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

%string_descriptor = type <{ i8*, i64 }>
%complex_module.complextype_class = type <{ i32 (...)**, %complex_module.complextype* }>
%complex_module.complextype = type { float, float }

@0 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@string_const_data = private constant [27 x i8] c"Calling integer_add_subrout"
@string_const = private global %string_descriptor <{ i8* getelementptr inbounds ([27 x i8], [27 x i8]* @string_const_data, i32 0, i32 0), i64 27 }>
@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
@string_const_data.1 = private constant [24 x i8] c"Calling real_add_subrout"
@string_const.2 = private global %string_descriptor <{ i8* getelementptr inbounds ([24 x i8], [24 x i8]* @string_const_data.1, i32 0, i32 0), i64 24 }>
@3 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@_Name_complextype = private unnamed_addr constant [12 x i8] c"complextype\00", align 1
@_Type_Info_complextype = linkonce_odr unnamed_addr constant { i8*, i8*, i8* } { i8* getelementptr inbounds ([12 x i8], [12 x i8]* @_Name_complextype, i32 0, i32 0), i8* inttoptr (i64 8 to i8*), i8* null }, align 8
@_VTable_complextype = linkonce_odr unnamed_addr constant { [6 x i8*] } { [6 x i8*] [i8* null, i8* bitcast ({ i8*, i8*, i8* }* @_Type_Info_complextype to i8*), i8* bitcast (void (i8*, i8*)* @_copy_complex_module_complextype to i8*), i8* bitcast (void (i8**)* @_allocate_struct_complex_module_complextype to i8*), i8* bitcast (void (%complex_module.complextype_class*, i32*, i32*, %complex_module.complextype*)* @__module_complex_module_integer_add_subrout to i8*), i8* bitcast (void (%complex_module.complextype_class*, float*, float*, %complex_module.complextype*)* @__module_complex_module_real_add_subrout to i8*)] }, align 8
@4 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@serialization_info = private unnamed_addr constant [6 x i8] c"R4,R4\00", align 1
@5 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@"ERROR STOP" = 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 [2 x i8] c"\0A\00", align 1
@9 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
@10 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
@serialization_info.3 = private unnamed_addr constant [6 x i8] c"R4,R4\00", align 1
@11 = private unnamed_addr constant [5 x i8] c"%s%s\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

define void @__module_complex_module_integer_add_subrout(%complex_module.complextype_class* %this, i32* %r, i32* %i, %complex_module.complextype* %sum) {
.entry:
  %0 = getelementptr %complex_module.complextype, %complex_module.complextype* %sum, i32 0, i32 1
  %1 = getelementptr %complex_module.complextype, %complex_module.complextype* %sum, i32 0, i32 0
  %2 = 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* %2, i32 27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0), i32 1)
  %3 = getelementptr %complex_module.complextype, %complex_module.complextype* %sum, i32 0, i32 0
  %4 = getelementptr %complex_module.complextype_class, %complex_module.complextype_class* %this, i32 0, i32 1
  %5 = load %complex_module.complextype*, %complex_module.complextype** %4, align 8
  %6 = getelementptr %complex_module.complextype, %complex_module.complextype* %5, i32 0, i32 0
  %7 = load float, float* %6, align 4
  %8 = load i32, i32* %r, align 4
  %9 = sitofp i32 %8 to float
  %10 = fadd float %7, %9
  store float %10, float* %3, align 4
  %11 = getelementptr %complex_module.complextype, %complex_module.complextype* %sum, i32 0, i32 1
  %12 = getelementptr %complex_module.complextype_class, %complex_module.complextype_class* %this, i32 0, i32 1
  %13 = load %complex_module.complextype*, %complex_module.complextype** %12, align 8
  %14 = getelementptr %complex_module.complextype, %complex_module.complextype* %13, i32 0, i32 1
  %15 = load float, float* %14, align 4
  %16 = load i32, i32* %i, align 4
  %17 = sitofp i32 %16 to float
  %18 = fadd float %15, %17
  store float %18, float* %11, align 4
  br label %return

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

FINALIZE_SYMTABLE_integer_add_subrout:            ; preds = %return
  ret void
}

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

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

FINALIZE_SYMTABLE_real_add_subrout:               ; preds = %return
  ret void
}

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

define i32 @main(i32 %0, i8** %1) {
.entry:
  %2 = alloca %complex_module.complextype_class, align 8
  %3 = call i8* @_lfortran_get_default_allocator()
  %4 = alloca %complex_module.complextype_class, align 8
  call void @_lpython_call_initial_functions(i32 %0, i8** %1)
  %a = alloca %complex_module.complextype, align 8
  %5 = getelementptr %complex_module.complextype, %complex_module.complextype* %a, i32 0, i32 1
  %6 = getelementptr %complex_module.complextype, %complex_module.complextype* %a, i32 0, i32 0
  %c = alloca %complex_module.complextype, align 8
  %7 = getelementptr %complex_module.complextype, %complex_module.complextype* %c, i32 0, i32 1
  %8 = getelementptr %complex_module.complextype, %complex_module.complextype* %c, i32 0, i32 0
  %fpone = alloca float, align 4
  %fptwo = alloca float, align 4
  %fpzero = alloca float, align 4
  %ione = alloca i32, align 4
  %izero = 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* %ione, align 4
  store i32 0, i32* %izero, align 4
  store float -1.000000e+00, float* %negfpone, align 4
  %9 = getelementptr %complex_module.complextype, %complex_module.complextype* %c, i32 0, i32 0
  %10 = load float, float* %fpone, align 4
  store float %10, float* %9, align 4
  %11 = getelementptr %complex_module.complextype, %complex_module.complextype* %c, i32 0, i32 1
  %12 = load float, float* %fptwo, align 4
  store float %12, float* %11, align 4
  %13 = getelementptr %complex_module.complextype_class, %complex_module.complextype_class* %4, i32 0, i32 0
  store i32 (...)** bitcast (i8** getelementptr inbounds ({ [6 x i8*] }, { [6 x i8*] }* @_VTable_complextype, i32 0, i32 0, i32 2) to i32 (...)**), i32 (...)*** %13, align 8
  %14 = getelementptr %complex_module.complextype_class, %complex_module.complextype_class* %4, i32 0, i32 1
  store %complex_module.complextype* %c, %complex_module.complextype** %14, align 8
  call void @__module_complex_module_integer_add_subrout(%complex_module.complextype_class* %4, i32* %ione, i32* %izero, %complex_module.complextype* %a)
  %15 = alloca i64, align 8
  %16 = getelementptr %complex_module.complextype, %complex_module.complextype* %a, i32 0, i32 0
  %17 = load float, float* %16, align 4
  %18 = alloca float, align 4
  store float %17, float* %18, align 4
  %19 = getelementptr %complex_module.complextype, %complex_module.complextype* %a, i32 0, i32 1
  %20 = load float, float* %19, align 4
  %21 = alloca float, align 4
  store float %20, float* %21, align 4
  %22 = call i8* (i8*, i8*, i64, i8*, i64*, i32, i32, i32, i32, i32, ...) @_lcompilers_string_format_fortran(i8* %3, i8* null, i64 0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @serialization_info, i32 0, i32 0), i64* %15, i32 0, i32 0, i32 0, i32 0, i32 0, float* %18, float* %21)
  %23 = load i64, i64* %15, align 8
  %stringFormat_desc = alloca %string_descriptor, align 8
  %24 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 0
  store i8* %22, i8** %24, align 8
  %25 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 1
  store i64 %23, i64* %25, align 8
  %26 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 0
  %27 = load i8*, i8** %26, align 8
  %28 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc, i32 0, i32 1
  %29 = load i64, i64* %28, align 8
  %30 = trunc i64 %29 to i32
  call void @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @5, i32 0, i32 0), i8* %27, i32 %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @4, i32 0, i32 0), i32 1)
  %31 = icmp eq i8* %22, null
  br i1 %31, label %free_done, label %free_nonnull

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

free_done:                                        ; preds = %free_nonnull, %.entry
  %32 = getelementptr %complex_module.complextype, %complex_module.complextype* %a, i32 0, i32 0
  %33 = load float, float* %32, align 4
  %34 = fcmp une float %33, 2.000000e+00
  br i1 %34, label %then, label %else

then:                                             ; preds = %free_done
  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]* @"ERROR STOP", i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @6, i32 0, i32 0))
  call void @_lfortran_internal_alloc_finalize()
  call void @exit(i32 1)
  br label %ifcont

else:                                             ; preds = %free_done
  br label %ifcont

ifcont:                                           ; preds = %else, %then
  %35 = getelementptr %complex_module.complextype, %complex_module.complextype* %a, i32 0, i32 1
  %36 = load float, float* %35, align 4
  %37 = fcmp une float %36, 2.000000e+00
  br i1 %37, label %then1, label %else2

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

else2:                                            ; preds = %ifcont
  br label %ifcont3

ifcont3:                                          ; preds = %else2, %then1
  %38 = getelementptr %complex_module.complextype_class, %complex_module.complextype_class* %2, i32 0, i32 0
  store i32 (...)** bitcast (i8** getelementptr inbounds ({ [6 x i8*] }, { [6 x i8*] }* @_VTable_complextype, i32 0, i32 0, i32 2) to i32 (...)**), i32 (...)*** %38, align 8
  %39 = getelementptr %complex_module.complextype_class, %complex_module.complextype_class* %2, i32 0, i32 1
  store %complex_module.complextype* %c, %complex_module.complextype** %39, align 8
  call void @__module_complex_module_real_add_subrout(%complex_module.complextype_class* %2, float* %fpzero, float* %negfpone, %complex_module.complextype* %a)
  %40 = alloca i64, align 8
  %41 = getelementptr %complex_module.complextype, %complex_module.complextype* %a, i32 0, i32 0
  %42 = load float, float* %41, align 4
  %43 = alloca float, align 4
  store float %42, float* %43, align 4
  %44 = getelementptr %complex_module.complextype, %complex_module.complextype* %a, i32 0, i32 1
  %45 = load float, float* %44, align 4
  %46 = alloca float, align 4
  store float %45, float* %46, align 4
  %47 = call i8* (i8*, i8*, i64, i8*, i64*, i32, i32, i32, i32, i32, ...) @_lcompilers_string_format_fortran(i8* %3, i8* null, i64 0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @serialization_info.3, i32 0, i32 0), i64* %40, i32 0, i32 0, i32 0, i32 0, i32 0, float* %43, float* %46)
  %48 = load i64, i64* %40, align 8
  %stringFormat_desc4 = alloca %string_descriptor, align 8
  %49 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc4, i32 0, i32 0
  store i8* %47, i8** %49, align 8
  %50 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc4, i32 0, i32 1
  store i64 %48, i64* %50, align 8
  %51 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc4, i32 0, i32 0
  %52 = load i8*, i8** %51, align 8
  %53 = getelementptr %string_descriptor, %string_descriptor* %stringFormat_desc4, i32 0, i32 1
  %54 = load i64, i64* %53, align 8
  %55 = trunc i64 %54 to i32
  call void @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @11, i32 0, i32 0), i8* %52, i32 %55, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @10, i32 0, i32 0), i32 1)
  %56 = icmp eq i8* %47, null
  br i1 %56, label %free_done6, label %free_nonnull5

free_nonnull5:                                    ; preds = %ifcont3
  call void @_lfortran_free_alloc(i8* %3, i8* %47)
  br label %free_done6

free_done6:                                       ; preds = %free_nonnull5, %ifcont3
  %57 = getelementptr %complex_module.complextype, %complex_module.complextype* %a, i32 0, i32 0
  %58 = load float, float* %57, align 4
  %59 = fcmp une float %58, 1.000000e+00
  br i1 %59, label %then7, label %else8

then7:                                            ; preds = %free_done6
  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]* @"ERROR STOP", i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @12, i32 0, i32 0))
  call void @_lfortran_internal_alloc_finalize()
  call void @exit(i32 1)
  br label %ifcont9

else8:                                            ; preds = %free_done6
  br label %ifcont9

ifcont9:                                          ; preds = %else8, %then7
  %60 = getelementptr %complex_module.complextype, %complex_module.complextype* %a, i32 0, i32 1
  %61 = load float, float* %60, align 4
  %62 = fcmp une float %61, 1.000000e+00
  br i1 %62, label %then10, label %else11

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

else11:                                           ; preds = %ifcont9
  br label %ifcont12

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

return:                                           ; preds = %ifcont12
  br label %FINALIZE_SYMTABLE_generic_name_01

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

declare void @_lpython_call_initial_functions(i32, i8**)

define linkonce_odr void @_copy_complex_module_complextype(i8* %0, i8* %1) {
entry:
  %2 = bitcast i8* %0 to %complex_module.complextype*
  %3 = bitcast i8* %1 to %complex_module.complextype*
  %4 = getelementptr %complex_module.complextype, %complex_module.complextype* %2, i32 0, i32 0
  %5 = load float, float* %4, align 4
  %6 = getelementptr %complex_module.complextype, %complex_module.complextype* %3, i32 0, i32 0
  br i1 true, label %then, label %else

then:                                             ; preds = %entry
  store float %5, float* %6, align 4
  br label %ifcont

else:                                             ; preds = %entry
  br label %ifcont

ifcont:                                           ; preds = %else, %then
  %7 = getelementptr %complex_module.complextype, %complex_module.complextype* %2, i32 0, i32 1
  %8 = load float, float* %7, align 4
  %9 = getelementptr %complex_module.complextype, %complex_module.complextype* %3, i32 0, i32 1
  br i1 true, label %then1, label %else2

then1:                                            ; preds = %ifcont
  store float %8, float* %9, align 4
  br label %ifcont3

else2:                                            ; preds = %ifcont
  br label %ifcont3

ifcont3:                                          ; preds = %else2, %then1
  ret void
}

define linkonce_odr void @_allocate_struct_complex_module_complextype(i8** %0) {
entry:
  %1 = call i8* @_lfortran_get_default_allocator()
  %2 = call i8* @_lfortran_malloc_alloc(i8* %1, i64 16)
  call void @llvm.memset.p0i8.i32(i8* %2, i8 0, i32 16, i1 false)
  store i8* %2, i8** %0, align 8
  %3 = load i8*, i8** %0, align 8
  %4 = bitcast i8* %3 to %complex_module.complextype_class*
  %5 = bitcast %complex_module.complextype_class* %4 to i32 (...)***
  store i32 (...)** bitcast (i8** getelementptr inbounds ({ [6 x i8*] }, { [6 x i8*] }* @_VTable_complextype, i32 0, i32 0, i32 2) to i32 (...)**), i32 (...)*** %5, align 8
  %6 = getelementptr %complex_module.complextype_class, %complex_module.complextype_class* %4, i32 0, i32 1
  %7 = call i8* @_lfortran_get_default_allocator()
  %8 = call i8* @_lfortran_malloc_alloc(i8* %7, i64 8)
  call void @llvm.memset.p0i8.i32(i8* %8, i8 0, i32 8, i1 false)
  %9 = bitcast i8* %8 to %complex_module.complextype*
  store %complex_module.complextype* %9, %complex_module.complextype** %6, align 8
  %10 = getelementptr %complex_module.complextype, %complex_module.complextype* %9, i32 0, i32 1
  %11 = getelementptr %complex_module.complextype, %complex_module.complextype* %9, i32 0, i32 0
  ret void
}

declare i8* @_lfortran_malloc_alloc(i8*, i64)

declare i8* @_lfortran_get_default_allocator()

; Function Attrs: argmemonly nounwind willreturn writeonly
declare void @llvm.memset.p0i8.i32(i8* nocapture writeonly, i8, i32, i1 immarg) #0

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

declare void @_lfortran_free_alloc(i8*, i8*)

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

declare void @_lfortran_internal_alloc_finalize()

declare void @exit(i32)

attributes #0 = { argmemonly nounwind willreturn writeonly }
