; ModuleID = 'LFortran'
source_filename = "LFortran"

%foo_c = type { %foo_b, %bar_c }
%foo_b = type { %foo_a, %bar_b }
%foo_a = type { %bar_a }
%bar_a = type { i32 }
%bar_b = type { %bar_a, i32 }
%bar_c = type { %bar_b, i32 }

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

define i32 @main(i32 %0, i8** %1) {
.entry:
  call void @_lpython_call_initial_functions(i32 %0, i8** %1)
  %foo = alloca %foo_c, align 8
  %2 = getelementptr %foo_c, %foo_c* %foo, i32 0, i32 1
  %3 = getelementptr %bar_c, %bar_c* %2, i32 0, i32 1
  %4 = getelementptr %foo_c, %foo_c* %foo, i32 0, i32 0
  %5 = getelementptr %foo_b, %foo_b* %4, i32 0, i32 0
  %6 = getelementptr %foo_a, %foo_a* %5, i32 0, i32 0
  %7 = getelementptr %bar_a, %bar_a* %6, i32 0, i32 0
  store i32 -20, i32* %7, align 4
  %8 = getelementptr %foo_c, %foo_c* %foo, i32 0, i32 0
  %9 = getelementptr %foo_b, %foo_b* %8, i32 0, i32 1
  %10 = getelementptr %bar_b, %bar_b* %9, i32 0, i32 1
  store i32 9, i32* %10, align 4
  %11 = getelementptr %foo_c, %foo_c* %foo, i32 0, i32 1
  %12 = getelementptr %bar_c, %bar_c* %11, i32 0, i32 1
  store i32 11, i32* %12, align 4
  %13 = getelementptr %foo_c, %foo_c* %foo, i32 0, i32 0
  %14 = getelementptr %foo_b, %foo_b* %13, i32 0, i32 0
  %15 = getelementptr %foo_a, %foo_a* %14, i32 0, i32 0
  %16 = getelementptr %bar_a, %bar_a* %15, i32 0, i32 0
  %17 = load i32, i32* %16, align 4
  %18 = sext i32 %17 to i64
  %19 = call i8* (i32, i8*, ...) @_lcompilers_string_format_fortran(i32 2, i8* null, i32 2, i64 %18)
  call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @1, i32 0, i32 0), i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0))
  %20 = getelementptr %foo_c, %foo_c* %foo, i32 0, i32 0
  %21 = getelementptr %foo_b, %foo_b* %20, i32 0, i32 1
  %22 = getelementptr %bar_b, %bar_b* %21, i32 0, i32 1
  %23 = load i32, i32* %22, align 4
  %24 = sext i32 %23 to i64
  %25 = call i8* (i32, i8*, ...) @_lcompilers_string_format_fortran(i32 2, i8* null, i32 2, i64 %24)
  call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @3, i32 0, i32 0), i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @2, i32 0, i32 0))
  %26 = getelementptr %foo_c, %foo_c* %foo, i32 0, i32 1
  %27 = getelementptr %bar_c, %bar_c* %26, i32 0, i32 1
  %28 = load i32, i32* %27, align 4
  %29 = sext i32 %28 to i64
  %30 = call i8* (i32, i8*, ...) @_lcompilers_string_format_fortran(i32 2, i8* null, i32 2, i64 %29)
  call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @5, i32 0, i32 0), i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @4, i32 0, i32 0))
  %31 = getelementptr %foo_c, %foo_c* %foo, i32 0, i32 0
  %32 = getelementptr %foo_b, %foo_b* %31, i32 0, i32 0
  %33 = getelementptr %foo_a, %foo_a* %32, i32 0, i32 0
  %34 = getelementptr %bar_a, %bar_a* %33, i32 0, i32 0
  %35 = load i32, i32* %34, align 4
  %36 = getelementptr %foo_c, %foo_c* %foo, i32 0, i32 0
  %37 = getelementptr %foo_b, %foo_b* %36, i32 0, i32 1
  %38 = getelementptr %bar_b, %bar_b* %37, i32 0, i32 1
  %39 = load i32, i32* %38, align 4
  %40 = add i32 %35, %39
  %41 = getelementptr %foo_c, %foo_c* %foo, i32 0, i32 1
  %42 = getelementptr %bar_c, %bar_c* %41, i32 0, i32 1
  %43 = load i32, i32* %42, align 4
  %44 = add i32 %40, %43
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %then, label %else

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

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

ifcont:                                           ; preds = %else, %then
  call void @_lpython_free_argv()
  br label %return

return:                                           ; preds = %ifcont
  ret i32 0
}

declare void @_lpython_call_initial_functions(i32, i8**)

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_free_argv()
