; ModuleID = 'LFortran'
source_filename = "LFortran"
target datalayout = "..."

%string_descriptor = type <{ i8*, i64 }>

@0 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@string_const_data = private constant [9 x i8] c"calling b"
@string_const = private global %string_descriptor <{ i8* getelementptr inbounds ([9 x i8], [9 x i8]* @string_const_data, i32 0, i32 0), i64 9 }>
@1 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@2 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@serialization_info = private unnamed_addr constant [3 x i8] c"I4\00", align 1
@3 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@4 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@serialization_info.1 = private unnamed_addr constant [3 x i8] c"I4\00", align 1
@5 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@6 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@serialization_info.2 = private unnamed_addr constant [3 x i8] c"I4\00", align 1
@7 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@8 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@serialization_info.3 = private unnamed_addr constant [3 x i8] c"I4\00", align 1
@9 = 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
  %0 = load i8*, i8** getelementptr inbounds (%string_descriptor, %string_descriptor* @string_const, i32 0, i32 0), align 8
  call void @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @1, i32 0, i32 0), i8* %0, i32 9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0), i32 1)
  %1 = call i32 @b.__module_many_returns_d(i32* %a)
  store i32 %1, i32* %b, align 4
  br label %return

return:                                           ; preds = %.entry
  br label %FINALIZE_SYMTABLE_b

FINALIZE_SYMTABLE_b:                              ; preds = %return
  %2 = load i32, i32* %b, align 4
  ret i32 %2
}

define i32 @b.__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
  br label %FINALIZE_SYMTABLE_d

FINALIZE_SYMTABLE_d:                              ; preds = %return
  %6 = load i32, i32* %d, align 4
  ret i32 %6
}

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

define i32 @main(i32 %0, i8** %1) {
.entry:
  %stringFormat_desc7 = alloca %string_descriptor, align 8
  %stringFormat_desc4 = alloca %string_descriptor, align 8
  %stringFormat_desc1 = alloca %string_descriptor, align 8
  %stringFormat_desc = alloca %string_descriptor, align 8
  %2 = call i8* @_lfortran_get_default_allocator()
  %call_arg_value = alloca i32, align 4
  call void @_lpython_call_initial_functions(i32 %0, i8** %1)
  %c = alloca i32, align 4
  store i32 1, i32* %call_arg_value, align 4
  %3 = call i32 @__module_many_returns_b(i32* %call_arg_value)
  store i32 %3, i32* %c, align 4
  %4 = alloca i64, align 8
  %5 = call i8* (i8*, i8*, i64, i8*, i64*, i32, i32, i32, i32, i32, ...) @_lcompilers_string_format_fortran(i8* %2, i8* null, i64 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @serialization_info, i32 0, i32 0), i64* %4, i32 0, i32 0, i32 0, i32 0, i32 0, i32* %c)
  %6 = load i64, i64* %4, align 8
  %7 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 0
  store i8* %5, i8** %7, align 8
  %8 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 1
  store i64 %6, i64* %8, align 8
  %9 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 0
  %10 = load i8*, i8** %9, align 8
  %11 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 1
  %12 = load i64, i64* %11, align 8
  %13 = trunc i64 %12 to i32
  call void @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @3, i32 0, i32 0), i8* %10, i32 %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @2, i32 0, i32 0), i32 1)
  %14 = icmp eq i8* %5, null
  br i1 %14, label %free_done, label %free_nonnull

free_nonnull:                                     ; preds = %.entry
  call void @_lfortran_free_alloc(i8* %2, i8* %5)
  br label %free_done

free_done:                                        ; preds = %free_nonnull, %.entry
  store i32 2, i32* %call_arg_value, align 4
  %15 = call i32 @__module_many_returns_b(i32* %call_arg_value)
  store i32 %15, i32* %c, align 4
  %16 = alloca i64, align 8
  %17 = call i8* (i8*, i8*, i64, i8*, i64*, i32, i32, i32, i32, i32, ...) @_lcompilers_string_format_fortran(i8* %2, i8* null, i64 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @serialization_info.1, i32 0, i32 0), i64* %16, i32 0, i32 0, i32 0, i32 0, i32 0, i32* %c)
  %18 = load i64, i64* %16, align 8
  %19 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc1, i32 0, i32 0
  store i8* %17, i8** %19, align 8
  %20 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc1, i32 0, i32 1
  store i64 %18, i64* %20, align 8
  %21 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc1, i32 0, i32 0
  %22 = load i8*, i8** %21, align 8
  %23 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc1, i32 0, i32 1
  %24 = load i64, i64* %23, align 8
  %25 = trunc i64 %24 to i32
  call void @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @5, i32 0, i32 0), i8* %22, i32 %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @4, i32 0, i32 0), i32 1)
  %26 = icmp eq i8* %17, null
  br i1 %26, label %free_done3, label %free_nonnull2

free_nonnull2:                                    ; preds = %free_done
  call void @_lfortran_free_alloc(i8* %2, i8* %17)
  br label %free_done3

free_done3:                                       ; preds = %free_nonnull2, %free_done
  store i32 3, i32* %call_arg_value, align 4
  %27 = call i32 @__module_many_returns_b(i32* %call_arg_value)
  store i32 %27, i32* %c, align 4
  %28 = alloca i64, align 8
  %29 = call i8* (i8*, i8*, i64, i8*, i64*, i32, i32, i32, i32, i32, ...) @_lcompilers_string_format_fortran(i8* %2, i8* null, i64 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @serialization_info.2, i32 0, i32 0), i64* %28, i32 0, i32 0, i32 0, i32 0, i32 0, i32* %c)
  %30 = load i64, i64* %28, align 8
  %31 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc4, i32 0, i32 0
  store i8* %29, i8** %31, align 8
  %32 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc4, i32 0, i32 1
  store i64 %30, i64* %32, align 8
  %33 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc4, i32 0, i32 0
  %34 = load i8*, i8** %33, align 8
  %35 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc4, i32 0, i32 1
  %36 = load i64, i64* %35, align 8
  %37 = trunc i64 %36 to i32
  call void @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @7, i32 0, i32 0), i8* %34, i32 %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @6, i32 0, i32 0), i32 1)
  %38 = icmp eq i8* %29, null
  br i1 %38, label %free_done6, label %free_nonnull5

free_nonnull5:                                    ; preds = %free_done3
  call void @_lfortran_free_alloc(i8* %2, i8* %29)
  br label %free_done6

free_done6:                                       ; preds = %free_nonnull5, %free_done3
  store i32 4, i32* %call_arg_value, align 4
  %39 = call i32 @__module_many_returns_b(i32* %call_arg_value)
  store i32 %39, i32* %c, align 4
  %40 = alloca i64, align 8
  %41 = call i8* (i8*, i8*, i64, i8*, i64*, i32, i32, i32, i32, i32, ...) @_lcompilers_string_format_fortran(i8* %2, i8* null, i64 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @serialization_info.3, i32 0, i32 0), i64* %40, i32 0, i32 0, i32 0, i32 0, i32 0, i32* %c)
  %42 = load i64, i64* %40, align 8
  %43 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc7, i32 0, i32 0
  store i8* %41, i8** %43, align 8
  %44 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc7, i32 0, i32 1
  store i64 %42, i64* %44, align 8
  %45 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc7, i32 0, i32 0
  %46 = load i8*, i8** %45, align 8
  %47 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc7, i32 0, i32 1
  %48 = load i64, i64* %47, align 8
  %49 = trunc i64 %48 to i32
  call void @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @9, i32 0, i32 0), i8* %46, i32 %49, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @8, i32 0, i32 0), i32 1)
  %50 = icmp eq i8* %41, null
  br i1 %50, label %free_done9, label %free_nonnull8

free_nonnull8:                                    ; preds = %free_done6
  call void @_lfortran_free_alloc(i8* %2, i8* %41)
  br label %free_done9

free_done9:                                       ; preds = %free_nonnull8, %free_done6
  br label %return

return:                                           ; preds = %free_done9
  br label %FINALIZE_SYMTABLE_returns

FINALIZE_SYMTABLE_returns:                        ; preds = %return
  call void @_lfortran_internal_alloc_finalize()
  ret i32 0
}

declare void @_lpython_call_initial_functions(i32, i8**)

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

declare i8* @_lfortran_get_default_allocator()

declare void @_lfortran_free_alloc(i8*, i8*)

declare void @_lfortran_internal_alloc_finalize()
