; ModuleID = 'LFortran'
source_filename = "LFortran"

@0 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@1 = private unnamed_addr constant [10 x i8] c"calling b\00", align 1
@2 = private unnamed_addr constant [5 x i8] c"%s%s\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 [2 x i8] c"\0A\00", align 1
@6 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@7 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@8 = private unnamed_addr constant [5 x i8] c"%s%s\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

define i32 @__module_many_returns_b(i32* %a) {
.entry:
  %b = alloca i32, align 4
  %e = alloca i32, align 4
  call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @2, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0))
  %0 = call i32 @__module_many_returns_d(i32* %a)
  store i32 %0, i32* %b, align 4
  br label %return

return:                                           ; preds = %.entry
  %1 = load i32, i32* %b, align 4
  ret i32 %1
}

define i32 @__module_many_returns_d(i32* %i) {
.entry:
  %d = alloca i32, align 4
  %0 = load i32, i32* %i, align 4
  %1 = icmp eq i32 %0, 1
  br i1 %1, label %then, label %else

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

unreachable_after_return:                         ; No predecessors!
  br label %ifcont

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

ifcont:                                           ; preds = %else, %unreachable_after_return
  %2 = load i32, i32* %i, align 4
  %3 = icmp eq i32 %2, 2
  br i1 %3, label %then1, label %else3

then1:                                            ; preds = %ifcont
  store i32 2, i32* %d, align 4
  br label %return

unreachable_after_return2:                        ; No predecessors!
  br label %ifcont4

else3:                                            ; preds = %ifcont
  br label %ifcont4

ifcont4:                                          ; preds = %else3, %unreachable_after_return2
  %4 = load i32, i32* %i, align 4
  %5 = icmp eq i32 %4, 3
  br i1 %5, label %then5, label %else7

then5:                                            ; preds = %ifcont4
  store i32 3, i32* %d, align 4
  br label %return

unreachable_after_return6:                        ; No predecessors!
  br label %ifcont8

else7:                                            ; preds = %ifcont4
  br label %ifcont8

ifcont8:                                          ; preds = %else7, %unreachable_after_return6
  store i32 999, i32* %d, align 4
  br label %return

return:                                           ; preds = %ifcont8, %then5, %then1, %then
  %6 = load i32, i32* %d, align 4
  ret i32 %6
}

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

define i32 @main(i32 %0, i8** %1) {
.entry:
  %call_arg_value4 = alloca i32, align 4
  %call_arg_value3 = alloca i32, align 4
  %call_arg_value2 = alloca i32, align 4
  %call_arg_value = alloca i32, align 4
  %c = alloca i32, align 4
  call void @_lpython_call_initial_functions(i32 %0, i8** %1)
  %c1 = alloca i32, align 4
  store i32 1, i32* %call_arg_value, align 4
  %2 = call i32 @__module_many_returns_b(i32* %call_arg_value)
  store i32 %2, i32* %c1, align 4
  %3 = load i32, i32* %c1, align 4
  %4 = sext i32 %3 to i64
  %5 = call i8* (i32, i8*, ...) @_lcompilers_string_format_fortran(i32 2, i8* null, i32 2, i64 %4)
  call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @4, i32 0, i32 0), i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @3, i32 0, i32 0))
  store i32 2, i32* %call_arg_value2, align 4
  %6 = call i32 @__module_many_returns_b(i32* %call_arg_value2)
  store i32 %6, i32* %c1, align 4
  %7 = load i32, i32* %c1, align 4
  %8 = sext i32 %7 to i64
  %9 = call i8* (i32, i8*, ...) @_lcompilers_string_format_fortran(i32 2, i8* null, i32 2, i64 %8)
  call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @6, i32 0, i32 0), i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @5, i32 0, i32 0))
  store i32 3, i32* %call_arg_value3, align 4
  %10 = call i32 @__module_many_returns_b(i32* %call_arg_value3)
  store i32 %10, i32* %c1, align 4
  %11 = load i32, i32* %c1, align 4
  %12 = sext i32 %11 to i64
  %13 = call i8* (i32, i8*, ...) @_lcompilers_string_format_fortran(i32 2, i8* null, i32 2, i64 %12)
  call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @8, i32 0, i32 0), i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @7, i32 0, i32 0))
  store i32 4, i32* %call_arg_value4, align 4
  %14 = call i32 @__module_many_returns_b(i32* %call_arg_value4)
  store i32 %14, i32* %c1, align 4
  %15 = load i32, i32* %c1, align 4
  %16 = sext i32 %15 to i64
  %17 = call i8* (i32, i8*, ...) @_lcompilers_string_format_fortran(i32 2, i8* null, i32 2, i64 %16)
  call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @10, i32 0, i32 0), i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @9, i32 0, i32 0))
  call void @_lpython_free_argv()
  br label %return

return:                                           ; preds = %.entry
  ret i32 0
}

declare void @_lpython_call_initial_functions(i32, i8**)

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

declare void @_lpython_free_argv()
