; ModuleID = 'LFortran'
source_filename = "LFortran"

%complextype_polymorphic = type { i64, %complextype* }
%complextype = type { float, float }
%__vtab_complextype = type { i64 }

@0 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@1 = private unnamed_addr constant [28 x i8] c"Calling integer_add_subrout\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 [25 x i8] c"Calling real_add_subrout\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
@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 [2 x i8] c"\0A\00", align 1
@15 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@16 = private unnamed_addr constant [11 x i8] c"ERROR STOP\00", align 1
@17 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@18 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@19 = private unnamed_addr constant [11 x i8] c"ERROR STOP\00", align 1
@20 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@21 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1

define void @__module_complex_module_integer_add_subrout(%complextype_polymorphic* %this, i32* %r, i32* %i, %complextype* %sum) {
.entry:
  %0 = alloca %__vtab_complextype, align 8
  %1 = getelementptr %__vtab_complextype, %__vtab_complextype* %0, i32 0, i32 0
  store i64 0, i64* %1, align 4
  call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @2, i32 0, i32 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0))
  %2 = getelementptr %complextype, %complextype* %sum, i32 0, i32 0
  %3 = getelementptr %complextype_polymorphic, %complextype_polymorphic* %this, i32 0, i32 1
  %4 = load %complextype*, %complextype** %3, align 8
  %5 = getelementptr %complextype, %complextype* %4, i32 0, i32 0
  %6 = load float, float* %5, align 4
  %7 = load i32, i32* %r, align 4
  %8 = sitofp i32 %7 to float
  %9 = fadd float %6, %8
  store float %9, float* %2, align 4
  %10 = getelementptr %complextype, %complextype* %sum, i32 0, i32 1
  %11 = getelementptr %complextype_polymorphic, %complextype_polymorphic* %this, i32 0, i32 1
  %12 = load %complextype*, %complextype** %11, align 8
  %13 = getelementptr %complextype, %complextype* %12, i32 0, i32 1
  %14 = load float, float* %13, align 4
  %15 = load i32, i32* %i, align 4
  %16 = sitofp i32 %15 to float
  %17 = fadd float %14, %16
  store float %17, float* %10, align 4
  br label %return

return:                                           ; preds = %.entry
  ret void
}

define void @__module_complex_module_real_add_subrout(%complextype_polymorphic* %this, float* %r, float* %i, %complextype* %sum) {
.entry:
  %0 = alloca %__vtab_complextype, align 8
  %1 = getelementptr %__vtab_complextype, %__vtab_complextype* %0, i32 0, i32 0
  store i64 0, i64* %1, align 4
  call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @5, i32 0, i32 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @4, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @3, i32 0, i32 0))
  %2 = getelementptr %complextype, %complextype* %sum, i32 0, i32 0
  %3 = getelementptr %complextype_polymorphic, %complextype_polymorphic* %this, i32 0, i32 1
  %4 = load %complextype*, %complextype** %3, align 8
  %5 = getelementptr %complextype, %complextype* %4, i32 0, i32 0
  %6 = load float, float* %5, align 4
  %7 = load float, float* %r, align 4
  %8 = fadd float %6, %7
  store float %8, float* %2, align 4
  %9 = getelementptr %complextype, %complextype* %sum, i32 0, i32 1
  %10 = getelementptr %complextype_polymorphic, %complextype_polymorphic* %this, i32 0, i32 1
  %11 = load %complextype*, %complextype** %10, align 8
  %12 = getelementptr %complextype, %complextype* %11, i32 0, i32 1
  %13 = load float, float* %12, align 4
  %14 = load float, float* %i, align 4
  %15 = fadd float %13, %14
  store float %15, float* %9, align 4
  br label %return

return:                                           ; preds = %.entry
  ret void
}

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

define i32 @main(i32 %0, i8** %1) {
.entry:
  %ione = alloca i32, align 4
  %izero = alloca i32, align 4
  call void @_lpython_call_initial_functions(i32 %0, i8** %1)
  %a = alloca %complextype, align 8
  %2 = getelementptr %complextype, %complextype* %a, i32 0, i32 1
  %3 = getelementptr %complextype, %complextype* %a, i32 0, i32 0
  %c = alloca %complextype, align 8
  %4 = getelementptr %complextype, %complextype* %c, i32 0, i32 1
  %5 = getelementptr %complextype, %complextype* %c, i32 0, i32 0
  %fpone = alloca float, align 4
  %fptwo = alloca float, align 4
  %fpzero = alloca float, align 4
  %ione1 = alloca i32, align 4
  %izero2 = alloca i32, align 4
  %negfpone = alloca float, align 4
  store float 1.000000e+00, float* %fpone, align 4
  store float 2.000000e+00, float* %fptwo, align 4
  store float 0.000000e+00, float* %fpzero, align 4
  store i32 1, i32* %ione1, align 4
  store i32 0, i32* %izero2, align 4
  store float -1.000000e+00, float* %negfpone, align 4
  %6 = getelementptr %complextype, %complextype* %c, i32 0, i32 0
  %7 = load float, float* %fpone, align 4
  store float %7, float* %6, align 4
  %8 = getelementptr %complextype, %complextype* %c, i32 0, i32 1
  %9 = load float, float* %fptwo, align 4
  store float %9, float* %8, align 4
  %10 = alloca %complextype_polymorphic, align 8
  %11 = getelementptr %complextype_polymorphic, %complextype_polymorphic* %10, i32 0, i32 0
  store i64 0, i64* %11, align 4
  %12 = getelementptr %complextype_polymorphic, %complextype_polymorphic* %10, i32 0, i32 1
  store %complextype* %c, %complextype** %12, align 8
  call void @__module_complex_module_integer_add_subrout(%complextype_polymorphic* %10, i32* %ione1, i32* %izero2, %complextype* %a)
  %13 = getelementptr %complextype, %complextype* %a, i32 0, i32 0
  %14 = load float, float* %13, align 4
  %15 = fpext float %14 to double
  %16 = getelementptr %complextype, %complextype* %a, i32 0, i32 1
  %17 = load float, float* %16, align 4
  %18 = fpext float %17 to double
  %19 = call i8* (i32, i8*, ...) @_lcompilers_string_format_fortran(i32 4, i8* null, i32 6, double %15, i32 6, double %18)
  call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @7, i32 0, i32 0), i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @6, i32 0, i32 0))
  %20 = getelementptr %complextype, %complextype* %a, i32 0, i32 0
  %21 = load float, float* %20, align 4
  %22 = fcmp une float %21, 2.000000e+00
  br i1 %22, label %then, label %else

then:                                             ; preds = %.entry
  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 %ifcont

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

ifcont:                                           ; preds = %else, %then
  %23 = getelementptr %complextype, %complextype* %a, i32 0, i32 1
  %24 = load float, float* %23, align 4
  %25 = fcmp une float %24, 2.000000e+00
  br i1 %25, label %then3, label %else4

then3:                                            ; preds = %ifcont
  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 %ifcont5

else4:                                            ; preds = %ifcont
  br label %ifcont5

ifcont5:                                          ; preds = %else4, %then3
  %26 = alloca %complextype_polymorphic, align 8
  %27 = getelementptr %complextype_polymorphic, %complextype_polymorphic* %26, i32 0, i32 0
  store i64 0, i64* %27, align 4
  %28 = getelementptr %complextype_polymorphic, %complextype_polymorphic* %26, i32 0, i32 1
  store %complextype* %c, %complextype** %28, align 8
  call void @__module_complex_module_real_add_subrout(%complextype_polymorphic* %26, float* %fpzero, float* %negfpone, %complextype* %a)
  %29 = getelementptr %complextype, %complextype* %a, i32 0, i32 0
  %30 = load float, float* %29, align 4
  %31 = fpext float %30 to double
  %32 = getelementptr %complextype, %complextype* %a, i32 0, i32 1
  %33 = load float, float* %32, align 4
  %34 = fpext float %33 to double
  %35 = call i8* (i32, i8*, ...) @_lcompilers_string_format_fortran(i32 4, i8* null, i32 6, double %31, i32 6, double %34)
  call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @15, i32 0, i32 0), i8* %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @14, i32 0, i32 0))
  %36 = getelementptr %complextype, %complextype* %a, i32 0, i32 0
  %37 = load float, float* %36, align 4
  %38 = fcmp une float %37, 1.000000e+00
  br i1 %38, label %then6, label %else7

then6:                                            ; preds = %ifcont5
  call void (i8*, ...) @_lcompilers_print_error(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @18, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @16, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @17, i32 0, i32 0))
  call void @exit(i32 1)
  br label %ifcont8

else7:                                            ; preds = %ifcont5
  br label %ifcont8

ifcont8:                                          ; preds = %else7, %then6
  %39 = getelementptr %complextype, %complextype* %a, i32 0, i32 1
  %40 = load float, float* %39, align 4
  %41 = fcmp une float %40, 1.000000e+00
  br i1 %41, label %then9, label %else10

then9:                                            ; preds = %ifcont8
  call void (i8*, ...) @_lcompilers_print_error(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @21, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @19, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @20, i32 0, i32 0))
  call void @exit(i32 1)
  br label %ifcont11

else10:                                           ; preds = %ifcont8
  br label %ifcont11

ifcont11:                                         ; preds = %else10, %then9
  call void @_lpython_free_argv()
  br label %return

return:                                           ; preds = %ifcont11
  ret i32 0
}

declare void @_lpython_call_initial_functions(i32, i8**)

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

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

declare void @exit(i32)

declare void @_lpython_free_argv()
