; ModuleID = 'LFortran'
source_filename = "LFortran"

@main.n = internal global i32 3
@0 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@1 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@2 = private unnamed_addr constant [11 x i8] c"ERROR STOP\00", align 1
@3 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@4 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@5 = private unnamed_addr constant [11 x i8] c"ERROR STOP\00", align 1
@6 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@7 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@8 = private unnamed_addr constant [11 x i8] c"ERROR STOP\00", align 1
@9 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@10 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@11 = private unnamed_addr constant [11 x i8] c"ERROR STOP\00", align 1
@12 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@13 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@14 = private unnamed_addr constant [11 x i8] c"ERROR STOP\00", align 1
@15 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@16 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@main.b = internal global [3 x i32] zeroinitializer

define i32 @main(i32 %0, i8** %1) {
.entry:
  %array_bound = alloca i32, align 4
  %__1_k = alloca i32, align 4
  call void @_lpython_call_initial_functions(i32 %0, i8** %1)
  %__1_k1 = alloca i32, align 4
  br i1 true, label %then, label %else

then:                                             ; preds = %.entry
  store i32 1, i32* %array_bound, align 4
  br label %ifcont

else:                                             ; preds = %.entry
  br label %ifcont

ifcont:                                           ; preds = %else, %then
  %2 = load i32, i32* %array_bound, align 4
  store i32 %2, i32* %__1_k1, align 4
  %3 = load i32, i32* %__1_k1, align 4
  %4 = sub i32 %3, 1
  %5 = mul i32 1, %4
  %6 = add i32 0, %5
  %7 = getelementptr [3 x i32], [3 x i32]* @main.b, i32 0, i32 %6
  store i32 10, i32* %7, align 4
  %8 = load i32, i32* %__1_k1, align 4
  %9 = add i32 %8, 1
  store i32 %9, i32* %__1_k1, align 4
  %10 = load i32, i32* %__1_k1, align 4
  %11 = sub i32 %10, 1
  %12 = mul i32 1, %11
  %13 = add i32 0, %12
  %14 = getelementptr [3 x i32], [3 x i32]* @main.b, i32 0, i32 %13
  store i32 20, i32* %14, align 4
  %15 = load i32, i32* %__1_k1, align 4
  %16 = add i32 %15, 1
  store i32 %16, i32* %__1_k1, align 4
  %17 = load i32, i32* %__1_k1, align 4
  %18 = sub i32 %17, 1
  %19 = mul i32 1, %18
  %20 = add i32 0, %19
  %21 = getelementptr [3 x i32], [3 x i32]* @main.b, i32 0, i32 %20
  store i32 30, i32* %21, align 4
  %22 = load i32, i32* %__1_k1, align 4
  %23 = add i32 %22, 1
  store i32 %23, i32* %__1_k1, align 4
  call void @driver(void (i32*, i32*, i32*)* @implicit_interface_check, i32* getelementptr inbounds ([3 x i32], [3 x i32]* @main.b, i32 0, i32 0), i32* @main.n)
  call void @_lpython_free_argv()
  br label %return

return:                                           ; preds = %ifcont
  ret i32 0
}

define void @driver(void (i32*, i32*, i32*)* %fnc, i32* %arr, i32* %m) {
.entry:
  %0 = call i8* (i32, i8*, ...) @_lcompilers_string_format_fortran(i32 2, i8* null, i32 6, double 1.000000e+00)
  call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @1, i32 0, i32 0), i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0))
  %1 = load i32, i32* %m, align 4
  %2 = mul i32 1, %1
  %3 = getelementptr inbounds i32, i32* %arr, i32 2
  call void %fnc(i32* %arr, i32* %m, i32* %3)
  br label %return

return:                                           ; preds = %.entry
  ret void
}

declare void @fnc(i32*, i32*, i32*)

define void @implicit_interface_check(i32* %arr1, i32* %m, i32* %c) {
.entry:
  %0 = load i32, i32* %m, align 4
  %1 = icmp ne i32 %0, 3
  br i1 %1, label %then, label %else

then:                                             ; preds = %.entry
  call void (i8*, ...) @_lcompilers_print_error(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @4, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @2, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @3, i32 0, i32 0))
  call void @exit(i32 1)
  br label %ifcont

else:                                             ; preds = %.entry
  br label %ifcont

ifcont:                                           ; preds = %else, %then
  %2 = load i32, i32* %c, align 4
  %3 = icmp ne i32 %2, 30
  br i1 %3, label %then1, label %else2

then1:                                            ; preds = %ifcont
  call void (i8*, ...) @_lcompilers_print_error(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @7, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @5, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @6, i32 0, i32 0))
  call void @exit(i32 1)
  br label %ifcont3

else2:                                            ; preds = %ifcont
  br label %ifcont3

ifcont3:                                          ; preds = %else2, %then1
  %4 = load i32, i32* %m, align 4
  %5 = mul i32 1, %4
  %6 = getelementptr inbounds i32, i32* %arr1, i32 0
  %7 = load i32, i32* %6, align 4
  %8 = icmp ne i32 %7, 10
  br i1 %8, label %then4, label %else5

then4:                                            ; preds = %ifcont3
  call void (i8*, ...) @_lcompilers_print_error(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @10, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @8, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @9, i32 0, i32 0))
  call void @exit(i32 1)
  br label %ifcont6

else5:                                            ; preds = %ifcont3
  br label %ifcont6

ifcont6:                                          ; preds = %else5, %then4
  %9 = load i32, i32* %m, align 4
  %10 = mul i32 1, %9
  %11 = getelementptr inbounds i32, i32* %arr1, i32 1
  %12 = load i32, i32* %11, align 4
  %13 = icmp ne i32 %12, 20
  br i1 %13, label %then7, label %else8

then7:                                            ; preds = %ifcont6
  call void (i8*, ...) @_lcompilers_print_error(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @13, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @11, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @12, i32 0, i32 0))
  call void @exit(i32 1)
  br label %ifcont9

else8:                                            ; preds = %ifcont6
  br label %ifcont9

ifcont9:                                          ; preds = %else8, %then7
  %14 = load i32, i32* %m, align 4
  %15 = mul i32 1, %14
  %16 = getelementptr inbounds i32, i32* %arr1, i32 2
  %17 = load i32, i32* %16, align 4
  %18 = icmp ne i32 %17, 30
  br i1 %18, label %then10, label %else11

then10:                                           ; preds = %ifcont9
  call void (i8*, ...) @_lcompilers_print_error(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @16, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @14, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @15, i32 0, i32 0))
  call void @exit(i32 1)
  br label %ifcont12

else11:                                           ; preds = %ifcont9
  br label %ifcont12

ifcont12:                                         ; preds = %else11, %then10
  br label %return

return:                                           ; preds = %ifcont12
  ret void
}

declare i8* @_lcompilers_string_format_fortran(i32, i8*, ...)

declare void @_lfortran_printf(i8*, ...)

declare void @_lcompilers_print_error(i8*, ...)

declare void @exit(i32)

declare void @_lpython_call_initial_functions(i32, i8**)

declare void @_lpython_free_argv()
