; LLVM IR from microsoft/LightAIMD :: src (scf)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.timespec = type { i64, i64 }
%struct.cmd_line_args = type { i64, ptr, ptr, i64, i64, i64, i64, i64, i64, i64, i64, i64, double, double, double, i64, i64 }
%struct.scf_context = type { ptr, i64, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, double, i64, double, double, double, i64, double, double, i64, double, i64, i64, ptr, ptr, ptr, i64, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, double, ptr, ptr, ptr, ptr, i64 }
%struct.molecule = type { i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, i64, ptr }

@.str.17 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [29 x i8], align 1

declare i32 @printf(ptr noundef, ...) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind uwtable
define dso_local ptr @scf_initialize(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %struct.timespec, align 8
  %6 = alloca %struct.timespec, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #3
  call void @get_wall_time(ptr noundef %5)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.cmd_line_args, ptr %13, i32 0, i32 2
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  store ptr %15, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.cmd_line_args, ptr %16, i32 0, i32 1
  %18 = load ptr, ptr %17, align 8, !tbaa !13
  store ptr %18, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %19 = call ptr @x_calloc(i64 noundef 1, i64 noundef 448)
  store ptr %19, ptr %9, align 8, !tbaa !5
  %20 = load ptr, ptr %9, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.scf_context, ptr %20, i32 0, i32 28
  store double 0x7FEFFFFFFFFFFFFF, ptr %21, align 8, !tbaa !14
  %22 = load ptr, ptr %9, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.scf_context, ptr %22, i32 0, i32 24
  store double 0x7FEFFFFFFFFFFFFF, ptr %23, align 8, !tbaa !16
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = load ptr, ptr %9, align 8, !tbaa !5
  call void %24(ptr noundef %25)
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = load ptr, ptr %9, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.scf_context, ptr %27, i32 0, i32 0
  store ptr %26, ptr %28, align 8, !tbaa !17
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.cmd_line_args, ptr %29, i32 0, i32 4
  %31 = load i64, ptr %30, align 8, !tbaa !18
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.scf_context, ptr %32, i32 0, i32 35
  store i64 %31, ptr %33, align 8, !tbaa !19
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.cmd_line_args, ptr %34, i32 0, i32 15
  %36 = load i64, ptr %35, align 8, !tbaa !20
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.scf_context, ptr %37, i32 0, i32 55
  store i64 %36, ptr %38, align 8, !tbaa !21
  %39 = load ptr, ptr %9, align 8, !tbaa !5
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  call void @build_basis_funcs(ptr noundef %39, ptr noundef %40)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %41 = load ptr, ptr %9, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.scf_context, ptr %41, i32 0, i32 1
  %43 = load i64, ptr %42, align 8, !tbaa !22
  store i64 %43, ptr %10, align 8, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %44 = load i64, ptr %10, align 8, !tbaa !23
  %45 = load i64, ptr %10, align 8, !tbaa !23
  %46 = mul i64 %44, %45
  store i64 %46, ptr %11, align 8, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %47 = load i64, ptr %11, align 8, !tbaa !23
  %48 = mul i64 %47, 8
  store i64 %48, ptr %12, align 8, !tbaa !23
  %49 = load i64, ptr %11, align 8, !tbaa !23
  %50 = load ptr, ptr %9, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.scf_context, ptr %50, i32 0, i32 2
  store i64 %49, ptr %51, align 8, !tbaa !24
  %52 = load i64, ptr %12, align 8, !tbaa !23
  %53 = load ptr, ptr %9, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.scf_context, ptr %53, i32 0, i32 3
  store i64 %52, ptr %54, align 8, !tbaa !25
  %55 = call ptr @threadpool_initialize(i64 noundef 0, i64 noundef 4096)
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.scf_context, ptr %56, i32 0, i32 36
  store ptr %55, ptr %57, align 8, !tbaa !26
  %58 = load i64, ptr %11, align 8, !tbaa !23
  %59 = call ptr @x_calloc(i64 noundef %58, i64 noundef 1)
  %60 = load ptr, ptr %9, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.scf_context, ptr %60, i32 0, i32 37
  store ptr %59, ptr %61, align 8, !tbaa !27
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  %63 = call double @calc_nuclear_repulsion_energy(ptr noundef %62)
  %64 = load ptr, ptr %9, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.scf_context, ptr %64, i32 0, i32 33
  store double %63, ptr %65, align 8, !tbaa !28
  %66 = load ptr, ptr %9, align 8, !tbaa !5
  call void @build_one_electron_integrals(ptr noundef %66)
  %67 = load i64, ptr %11, align 8, !tbaa !23
  %68 = call ptr @x_calloc(i64 noundef %67, i64 noundef 8)
  %69 = load ptr, ptr %9, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.scf_context, ptr %69, i32 0, i32 22
  store ptr %68, ptr %70, align 8, !tbaa !29
  %71 = load i64, ptr %12, align 8, !tbaa !23
  %72 = call ptr @x_malloc(i64 noundef %71)
  %73 = load ptr, ptr %9, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.scf_context, ptr %73, i32 0, i32 19
  store ptr %72, ptr %74, align 8, !tbaa !30
  %75 = load i64, ptr %12, align 8, !tbaa !23
  %76 = call ptr @x_malloc(i64 noundef %75)
  %77 = load ptr, ptr %9, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.scf_context, ptr %77, i32 0, i32 20
  store ptr %76, ptr %78, align 8, !tbaa !31
  %79 = load i64, ptr %12, align 8, !tbaa !23
  %80 = call ptr @x_malloc(i64 noundef %79)
  %81 = load ptr, ptr %9, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.scf_context, ptr %81, i32 0, i32 21
  store ptr %80, ptr %82, align 8, !tbaa !32
  %83 = load ptr, ptr %9, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.scf_context, ptr %83, i32 0, i32 25
  %85 = load i64, ptr %84, align 8, !tbaa !33
  %86 = icmp eq i64 %85, 1
  br i1 %86, label %87, label %98

87:                                               ; preds = %2
  %88 = load ptr, ptr %9, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.scf_context, ptr %88, i32 0, i32 22
  %90 = load ptr, ptr %89, align 8, !tbaa !29
  %91 = load i64, ptr %10, align 8, !tbaa !23
  %92 = load ptr, ptr %7, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.molecule, ptr %92, i32 0, i32 2
  %94 = load ptr, ptr %93, align 8, !tbaa !34
  %95 = load ptr, ptr %7, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.molecule, ptr %95, i32 0, i32 0
  %97 = load i64, ptr %96, align 8, !tbaa !36
  call void @soad_initialize_density_matrix(ptr noundef %90, i64 noundef %91, ptr noundef %94, i64 noundef %97)
  br label %98

98:                                               ; preds = %87, %2
  %99 = load ptr, ptr %9, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.scf_context, ptr %99, i32 0, i32 25
  %101 = load i64, ptr %100, align 8, !tbaa !33
  %102 = icmp eq i64 %101, 2
  br i1 %102, label %103, label %105

103:                                              ; preds = %98
  %104 = load ptr, ptr %9, align 8, !tbaa !5
  call void @initialize_density_matrix_with_H_core(ptr noundef %104)
  br label %105

105:                                              ; preds = %103, %98
  %106 = load ptr, ptr %9, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.scf_context, ptr %106, i32 0, i32 22
  %108 = load ptr, ptr %107, align 8, !tbaa !29
  %109 = load ptr, ptr %9, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.scf_context, ptr %109, i32 0, i32 22
  %111 = load ptr, ptr %110, align 8, !tbaa !29
  %112 = load i64, ptr %10, align 8, !tbaa !23
  %113 = load i64, ptr %10, align 8, !tbaa !23
  call void @mat_scalar_multiply(ptr noundef %108, ptr noundef %111, i64 noundef %112, i64 noundef %113, double noundef 2.000000e+00)
  br label %114

114:                                              ; preds = %105
  %115 = load ptr, ptr %9, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.scf_context, ptr %115, i32 0, i32 55
  %117 = load i64, ptr %116, align 8, !tbaa !21
  %118 = icmp ne i64 %117, 0
  br i1 %118, label %127, label %119

119:                                              ; preds = %114
  %120 = load ptr, ptr %9, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.scf_context, ptr %120, i32 0, i32 22
  %122 = load ptr, ptr %121, align 8, !tbaa !29
  %123 = load i64, ptr %10, align 8, !tbaa !23
  %124 = load i64, ptr %10, align 8, !tbaa !23
  %125 = call double @matsum(ptr noundef %122, i64 noundef %123, i64 noundef %124)
  %126 = call i32 (ptr, ...) @printf(ptr noundef @.str.17, double noundef %125)
  br label %127

127:                                              ; preds = %119, %114
  br label %128

128:                                              ; preds = %127
  br label %129

129:                                              ; preds = %128
  %130 = load ptr, ptr %9, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.scf_context, ptr %130, i32 0, i32 3
  %132 = load i64, ptr %131, align 8, !tbaa !25
  %133 = call ptr @x_malloc(i64 noundef %132)
  %134 = load ptr, ptr %9, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.scf_context, ptr %134, i32 0, i32 51
  store ptr %133, ptr %135, align 8, !tbaa !37
  %136 = load ptr, ptr %9, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.scf_context, ptr %136, i32 0, i32 3
  %138 = load i64, ptr %137, align 8, !tbaa !25
  %139 = call ptr @x_malloc(i64 noundef %138)
  %140 = load ptr, ptr %9, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.scf_context, ptr %140, i32 0, i32 52
  store ptr %139, ptr %141, align 8, !tbaa !38
  %142 = load ptr, ptr %9, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.scf_context, ptr %142, i32 0, i32 3
  %144 = load i64, ptr %143, align 8, !tbaa !25
  %145 = call ptr @x_malloc(i64 noundef %144)
  %146 = load ptr, ptr %9, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.scf_context, ptr %146, i32 0, i32 53
  store ptr %145, ptr %147, align 8, !tbaa !39
  %148 = load ptr, ptr %9, align 8, !tbaa !5
  call void @build_two_electron_integrals(ptr noundef %148)
  %149 = load ptr, ptr %9, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.scf_context, ptr %149, i32 0, i32 3
  %151 = load i64, ptr %150, align 8, !tbaa !25
  %152 = call ptr @x_malloc(i64 noundef %151)
  %153 = load ptr, ptr %9, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.scf_context, ptr %153, i32 0, i32 8
  store ptr %152, ptr %154, align 8, !tbaa !40
  %155 = load ptr, ptr %9, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.scf_context, ptr %155, i32 0, i32 2
  %157 = load i64, ptr %156, align 8, !tbaa !24
  %158 = call ptr @x_calloc(i64 noundef %157, i64 noundef 8)
  %159 = load ptr, ptr %9, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.scf_context, ptr %159, i32 0, i32 23
  store ptr %158, ptr %160, align 8, !tbaa !41
  %161 = load ptr, ptr %3, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.cmd_line_args, ptr %161, i32 0, i32 5
  %163 = load i64, ptr %162, align 8, !tbaa !42
  %164 = load ptr, ptr %9, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.scf_context, ptr %164, i32 0, i32 39
  store i64 %163, ptr %165, align 8, !tbaa !43
  %166 = load ptr, ptr %9, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.scf_context, ptr %166, i32 0, i32 40
  store i64 0, ptr %167, align 8, !tbaa !44
  %168 = load ptr, ptr %9, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.scf_context, ptr %168, i32 0, i32 41
  store i64 0, ptr %169, align 8, !tbaa !45
  %170 = load ptr, ptr %9, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.scf_context, ptr %170, i32 0, i32 3
  %172 = load i64, ptr %171, align 8, !tbaa !25
  %173 = load ptr, ptr %9, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.scf_context, ptr %173, i32 0, i32 39
  %175 = load i64, ptr %174, align 8, !tbaa !43
  %176 = mul i64 %172, %175
  %177 = call ptr @x_malloc(i64 noundef %176)
  %178 = load ptr, ptr %9, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.scf_context, ptr %178, i32 0, i32 42
  store ptr %177, ptr %179, align 8, !tbaa !46
  %180 = load ptr, ptr %9, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.scf_context, ptr %180, i32 0, i32 3
  %182 = load i64, ptr %181, align 8, !tbaa !25
  %183 = load ptr, ptr %9, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.scf_context, ptr %183, i32 0, i32 39
  %185 = load i64, ptr %184, align 8, !tbaa !43
  %186 = mul i64 %182, %185
  %187 = call ptr @x_malloc(i64 noundef %186)
  %188 = load ptr, ptr %9, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct.scf_context, ptr %188, i32 0, i32 43
  store ptr %187, ptr %189, align 8, !tbaa !47
  %190 = load ptr, ptr %9, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.scf_context, ptr %190, i32 0, i32 3
  %192 = load i64, ptr %191, align 8, !tbaa !25
  %193 = call ptr @x_malloc(i64 noundef %192)
  %194 = load ptr, ptr %9, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.scf_context, ptr %194, i32 0, i32 44
  store ptr %193, ptr %195, align 8, !tbaa !48
  %196 = load ptr, ptr %9, align 8, !tbaa !5
  %197 = getelementptr inbounds %struct.scf_context, ptr %196, i32 0, i32 3
  %198 = load i64, ptr %197, align 8, !tbaa !25
  %199 = call ptr @x_malloc(i64 noundef %198)
  %200 = load ptr, ptr %9, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct.scf_context, ptr %200, i32 0, i32 45
  store ptr %199, ptr %201, align 8, !tbaa !49
  %202 = load ptr, ptr %9, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.scf_context, ptr %202, i32 0, i32 39
  %204 = load i64, ptr %203, align 8, !tbaa !43
  %205 = add i64 %204, 1
  %206 = load ptr, ptr %9, align 8, !tbaa !5
  %207 = getelementptr inbounds %struct.scf_context, ptr %206, i32 0, i32 39
  %208 = load i64, ptr %207, align 8, !tbaa !43
  %209 = add i64 %208, 1
  %210 = mul i64 %205, %209
  %211 = mul i64 %210, 8
  %212 = call ptr @x_malloc(i64 noundef %211)
  %213 = load ptr, ptr %9, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.scf_context, ptr %213, i32 0, i32 46
  store ptr %212, ptr %214, align 8, !tbaa !50
  %215 = load ptr, ptr %9, align 8, !tbaa !5
  %216 = getelementptr inbounds %struct.scf_context, ptr %215, i32 0, i32 39
  %217 = load i64, ptr %216, align 8, !tbaa !43
  %218 = add i64 %217, 1
  %219 = mul i64 %218, 8
  %220 = call ptr @x_malloc(i64 noundef %219)
  %221 = load ptr, ptr %9, align 8, !tbaa !5
  %222 = getelementptr inbounds %struct.scf_context, ptr %221, i32 0, i32 47
  store ptr %220, ptr %222, align 8, !tbaa !51
  %223 = load ptr, ptr %9, align 8, !tbaa !5
  %224 = getelementptr inbounds %struct.scf_context, ptr %223, i32 0, i32 39
  %225 = load i64, ptr %224, align 8, !tbaa !43
  %226 = add i64 %225, 1
  %227 = mul i64 %226, 8
  %228 = call ptr @x_malloc(i64 noundef %227)
  %229 = load ptr, ptr %9, align 8, !tbaa !5
  %230 = getelementptr inbounds %struct.scf_context, ptr %229, i32 0, i32 48
  store ptr %228, ptr %230, align 8, !tbaa !52
  %231 = load ptr, ptr %9, align 8, !tbaa !5
  %232 = getelementptr inbounds %struct.scf_context, ptr %231, i32 0, i32 3
  %233 = load i64, ptr %232, align 8, !tbaa !25
  %234 = call ptr @x_malloc(i64 noundef %233)
  %235 = load ptr, ptr %9, align 8, !tbaa !5
  %236 = getelementptr inbounds %struct.scf_context, ptr %235, i32 0, i32 49
  store ptr %234, ptr %236, align 8, !tbaa !53
  %237 = load ptr, ptr %9, align 8, !tbaa !5
  %238 = getelementptr inbounds %struct.scf_context, ptr %237, i32 0, i32 50
  store double 5.000000e-01, ptr %238, align 8, !tbaa !54
  call void @get_wall_time(ptr noundef %6)
  br label %239

239:                                              ; preds = %129
  %240 = load ptr, ptr %9, align 8, !tbaa !5
  %241 = getelementptr inbounds %struct.scf_context, ptr %240, i32 0, i32 55
  %242 = load i64, ptr %241, align 8, !tbaa !21
  %243 = icmp ne i64 %242, 0
  br i1 %243, label %247, label %244

244:                                              ; preds = %239
  %245 = call double @diff_time_ms(ptr noundef %5, ptr noundef %6)
  %246 = call i32 (ptr, ...) @printf(ptr noundef @.str.18, double noundef %245)
  br label %247

247:                                              ; preds = %244, %239
  br label %248

248:                                              ; preds = %247
  br label %249

249:                                              ; preds = %248
  %250 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #3
  ret ptr %250
}

declare void @get_wall_time(ptr noundef) #0

declare ptr @x_calloc(i64 noundef, i64 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @build_basis_funcs(ptr noundef, ptr noundef) #2

declare ptr @threadpool_initialize(i64 noundef, i64 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden double @calc_nuclear_repulsion_energy(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @build_one_electron_integrals(ptr noundef) #2

declare ptr @x_malloc(i64 noundef) #0

declare void @soad_initialize_density_matrix(ptr noundef, i64 noundef, ptr noundef, i64 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @initialize_density_matrix_with_H_core(ptr noundef) #2

declare void @mat_scalar_multiply(ptr noundef, ptr noundef, i64 noundef, i64 noundef, double noundef) #0

declare double @matsum(ptr noundef, i64 noundef, i64 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @build_two_electron_integrals(ptr noundef) #2

declare double @diff_time_ms(ptr noundef, ptr noundef) #0

attributes #0 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 16}
!10 = !{!"cmd_line_args", !11, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !12, i64 96, !12, i64 104, !12, i64 112, !11, i64 120, !11, i64 128}
!11 = !{!"long", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!10, !6, i64 8}
!14 = !{!15, !12, i64 224}
!15 = !{!"scf_context", !6, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !12, i64 192, !11, i64 200, !12, i64 208, !12, i64 216, !12, i64 224, !11, i64 232, !12, i64 240, !12, i64 248, !11, i64 256, !12, i64 264, !11, i64 272, !11, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !11, i64 312, !11, i64 320, !11, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !6, i64 392, !12, i64 400, !6, i64 408, !6, i64 416, !6, i64 424, !6, i64 432, !11, i64 440}
!16 = !{!15, !12, i64 192}
!17 = !{!15, !6, i64 0}
!18 = !{!10, !11, i64 32}
!19 = !{!15, !11, i64 280}
!20 = !{!10, !11, i64 120}
!21 = !{!15, !11, i64 440}
!22 = !{!15, !11, i64 8}
!23 = !{!11, !11, i64 0}
!24 = !{!15, !11, i64 16}
!25 = !{!15, !11, i64 24}
!26 = !{!15, !6, i64 288}
!27 = !{!15, !6, i64 296}
!28 = !{!15, !12, i64 264}
!29 = !{!15, !6, i64 176}
!30 = !{!15, !6, i64 152}
!31 = !{!15, !6, i64 160}
!32 = !{!15, !6, i64 168}
!33 = !{!15, !11, i64 200}
!34 = !{!35, !6, i64 16}
!35 = !{!"molecule", !11, i64 0, !11, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !11, i64 64, !6, i64 72}
!36 = !{!35, !11, i64 0}
!37 = !{!15, !6, i64 408}
!38 = !{!15, !6, i64 416}
!39 = !{!15, !6, i64 424}
!40 = !{!15, !6, i64 64}
!41 = !{!15, !6, i64 184}
!42 = !{!10, !11, i64 40}
!43 = !{!15, !11, i64 312}
!44 = !{!15, !11, i64 320}
!45 = !{!15, !11, i64 328}
!46 = !{!15, !6, i64 336}
!47 = !{!15, !6, i64 344}
!48 = !{!15, !6, i64 352}
!49 = !{!15, !6, i64 360}
!50 = !{!15, !6, i64 368}
!51 = !{!15, !6, i64 376}
!52 = !{!15, !6, i64 384}
!53 = !{!15, !6, i64 392}
!54 = !{!15, !12, i64 400}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.timespec = type { i64, i64 }

@.str.17 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [29 x i8], align 1

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @scf_initialize(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1) local_unnamed_addr #2 {
  %3 = alloca %struct.timespec, align 8
  %4 = alloca %struct.timespec, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #5
  call void @get_wall_time(ptr noundef nonnull %3) #5
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = load ptr, ptr %7, align 8, !tbaa !12
  %9 = call ptr @x_calloc(i64 noundef 1, i64 noundef 448) #5
  %10 = getelementptr inbounds i8, ptr %9, i64 224
  store double 0x7FEFFFFFFFFFFFFF, ptr %10, align 8, !tbaa !13
  %11 = getelementptr inbounds i8, ptr %9, i64 192
  store double 0x7FEFFFFFFFFFFFFF, ptr %11, align 8, !tbaa !15
  call void %1(ptr noundef %9) #5
  store ptr %6, ptr %9, align 8, !tbaa !16
  %12 = getelementptr inbounds i8, ptr %0, i64 32
  %13 = load i64, ptr %12, align 8, !tbaa !17
  %14 = getelementptr inbounds i8, ptr %9, i64 280
  store i64 %13, ptr %14, align 8, !tbaa !18
  %15 = getelementptr inbounds i8, ptr %0, i64 120
  %16 = load i64, ptr %15, align 8, !tbaa !19
  %17 = getelementptr inbounds i8, ptr %9, i64 440
  store i64 %16, ptr %17, align 8, !tbaa !20
  call void @build_basis_funcs(ptr noundef nonnull %9, ptr noundef %8)
  %18 = getelementptr inbounds i8, ptr %9, i64 8
  %19 = load i64, ptr %18, align 8, !tbaa !21
  %20 = mul i64 %19, %19
  %21 = shl i64 %20, 3
  %22 = getelementptr inbounds i8, ptr %9, i64 16
  store i64 %20, ptr %22, align 8, !tbaa !22
  %23 = getelementptr inbounds i8, ptr %9, i64 24
  store i64 %21, ptr %23, align 8, !tbaa !23
  %24 = call ptr @threadpool_initialize(i64 noundef 0, i64 noundef 4096) #5
  %25 = getelementptr inbounds i8, ptr %9, i64 288
  store ptr %24, ptr %25, align 8, !tbaa !24
  %26 = call ptr @x_calloc(i64 noundef %20, i64 noundef 1) #5
  %27 = getelementptr inbounds i8, ptr %9, i64 296
  store ptr %26, ptr %27, align 8, !tbaa !25
  %28 = call double @calc_nuclear_repulsion_energy(ptr noundef %6)
  %29 = getelementptr inbounds i8, ptr %9, i64 264
  store double %28, ptr %29, align 8, !tbaa !26
  call void @build_one_electron_integrals(ptr noundef nonnull %9)
  %30 = call ptr @x_calloc(i64 noundef %20, i64 noundef 8) #5
  %31 = getelementptr inbounds i8, ptr %9, i64 176
  store ptr %30, ptr %31, align 8, !tbaa !27
  %32 = call ptr @x_malloc(i64 noundef %21) #5
  %33 = getelementptr inbounds i8, ptr %9, i64 152
  store ptr %32, ptr %33, align 8, !tbaa !28
  %34 = call ptr @x_malloc(i64 noundef %21) #5
  %35 = getelementptr inbounds i8, ptr %9, i64 160
  store ptr %34, ptr %35, align 8, !tbaa !29
  %36 = call ptr @x_malloc(i64 noundef %21) #5
  %37 = getelementptr inbounds i8, ptr %9, i64 168
  store ptr %36, ptr %37, align 8, !tbaa !30
  %38 = getelementptr inbounds i8, ptr %9, i64 200
  %39 = load i64, ptr %38, align 8, !tbaa !31
  %40 = icmp eq i64 %39, 1
  br i1 %40, label %41, label %46

41:                                               ; preds = %2
  %42 = load ptr, ptr %31, align 8, !tbaa !27
  %43 = getelementptr inbounds i8, ptr %6, i64 16
  %44 = load ptr, ptr %43, align 8, !tbaa !32
  %45 = load i64, ptr %6, align 8, !tbaa !34
  call void @soad_initialize_density_matrix(ptr noundef %42, i64 noundef %19, ptr noundef %44, i64 noundef %45) #5
  %.pr = load i64, ptr %38, align 8, !tbaa !31
  br label %46

46:                                               ; preds = %41, %2
  %47 = phi i64 [ %.pr, %41 ], [ %39, %2 ]
  %48 = icmp eq i64 %47, 2
  br i1 %48, label %49, label %50

49:                                               ; preds = %46
  call void @initialize_density_matrix_with_H_core(ptr noundef nonnull %9)
  br label %50

50:                                               ; preds = %49, %46
  %51 = load ptr, ptr %31, align 8, !tbaa !27
  call void @mat_scalar_multiply(ptr noundef %51, ptr noundef %51, i64 noundef %19, i64 noundef %19, double noundef 2.000000e+00) #5
  %52 = load i64, ptr %17, align 8, !tbaa !20
  %.not = icmp eq i64 %52, 0
  br i1 %.not, label %53, label %57

53:                                               ; preds = %50
  %54 = load ptr, ptr %31, align 8, !tbaa !27
  %55 = call double @matsum(ptr noundef %54, i64 noundef %19, i64 noundef %19) #5
  %56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.17, double noundef %55)
  br label %57

57:                                               ; preds = %53, %50
  %58 = load i64, ptr %23, align 8, !tbaa !23
  %59 = call ptr @x_malloc(i64 noundef %58) #5
  %60 = getelementptr inbounds i8, ptr %9, i64 408
  store ptr %59, ptr %60, align 8, !tbaa !35
  %61 = load i64, ptr %23, align 8, !tbaa !23
  %62 = call ptr @x_malloc(i64 noundef %61) #5
  %63 = getelementptr inbounds i8, ptr %9, i64 416
  store ptr %62, ptr %63, align 8, !tbaa !36
  %64 = load i64, ptr %23, align 8, !tbaa !23
  %65 = call ptr @x_malloc(i64 noundef %64) #5
  %66 = getelementptr inbounds i8, ptr %9, i64 424
  store ptr %65, ptr %66, align 8, !tbaa !37
  call void @build_two_electron_integrals(ptr noundef nonnull %9)
  %67 = load i64, ptr %23, align 8, !tbaa !23
  %68 = call ptr @x_malloc(i64 noundef %67) #5
  %69 = getelementptr inbounds i8, ptr %9, i64 64
  store ptr %68, ptr %69, align 8, !tbaa !38
  %70 = load i64, ptr %22, align 8, !tbaa !22
  %71 = call ptr @x_calloc(i64 noundef %70, i64 noundef 8) #5
  %72 = getelementptr inbounds i8, ptr %9, i64 184
  store ptr %71, ptr %72, align 8, !tbaa !39
  %73 = getelementptr inbounds i8, ptr %0, i64 40
  %74 = load i64, ptr %73, align 8, !tbaa !40
  %75 = getelementptr inbounds i8, ptr %9, i64 312
  store i64 %74, ptr %75, align 8, !tbaa !41
  %76 = getelementptr inbounds i8, ptr %9, i64 320
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %76, i8 0, i64 16, i1 false)
  %77 = load i64, ptr %23, align 8, !tbaa !23
  %78 = mul i64 %77, %74
  %79 = call ptr @x_malloc(i64 noundef %78) #5
  %80 = getelementptr inbounds i8, ptr %9, i64 336
  store ptr %79, ptr %80, align 8, !tbaa !42
  %81 = load i64, ptr %23, align 8, !tbaa !23
  %82 = load i64, ptr %75, align 8, !tbaa !41
  %83 = mul i64 %82, %81
  %84 = call ptr @x_malloc(i64 noundef %83) #5
  %85 = getelementptr inbounds i8, ptr %9, i64 344
  store ptr %84, ptr %85, align 8, !tbaa !43
  %86 = load i64, ptr %23, align 8, !tbaa !23
  %87 = call ptr @x_malloc(i64 noundef %86) #5
  %88 = getelementptr inbounds i8, ptr %9, i64 352
  store ptr %87, ptr %88, align 8, !tbaa !44
  %89 = load i64, ptr %23, align 8, !tbaa !23
  %90 = call ptr @x_malloc(i64 noundef %89) #5
  %91 = getelementptr inbounds i8, ptr %9, i64 360
  store ptr %90, ptr %91, align 8, !tbaa !45
  %92 = load i64, ptr %75, align 8, !tbaa !41
  %93 = add i64 %92, 1
  %94 = shl i64 %93, 3
  %95 = mul i64 %94, %93
  %96 = call ptr @x_malloc(i64 noundef %95) #5
  %97 = getelementptr inbounds i8, ptr %9, i64 368
  store ptr %96, ptr %97, align 8, !tbaa !46
  %98 = load i64, ptr %75, align 8, !tbaa !41
  %99 = shl i64 %98, 3
  %100 = add i64 %99, 8
  %101 = call ptr @x_malloc(i64 noundef %100) #5
  %102 = getelementptr inbounds i8, ptr %9, i64 376
  store ptr %101, ptr %102, align 8, !tbaa !47
  %103 = load i64, ptr %75, align 8, !tbaa !41
  %104 = shl i64 %103, 3
  %105 = add i64 %104, 8
  %106 = call ptr @x_malloc(i64 noundef %105) #5
  %107 = getelementptr inbounds i8, ptr %9, i64 384
  store ptr %106, ptr %107, align 8, !tbaa !48
  %108 = load i64, ptr %23, align 8, !tbaa !23
  %109 = call ptr @x_malloc(i64 noundef %108) #5
  %110 = getelementptr inbounds i8, ptr %9, i64 392
  store ptr %109, ptr %110, align 8, !tbaa !49
  %111 = getelementptr inbounds i8, ptr %9, i64 400
  store double 5.000000e-01, ptr %111, align 8, !tbaa !50
  call void @get_wall_time(ptr noundef nonnull %4) #5
  %112 = load i64, ptr %17, align 8, !tbaa !20
  %.not87 = icmp eq i64 %112, 0
  br i1 %.not87, label %113, label %116

113:                                              ; preds = %57
  %114 = call double @diff_time_ms(ptr noundef nonnull %3, ptr noundef nonnull %4) #5
  %115 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18, double noundef %114)
  br label %116

116:                                              ; preds = %113, %57
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #5
  ret ptr %9
}

declare void @get_wall_time(ptr noundef) local_unnamed_addr #3

declare ptr @x_calloc(i64 noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden void @build_basis_funcs(ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @threadpool_initialize(i64 noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden double @calc_nuclear_repulsion_energy(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @build_one_electron_integrals(ptr noundef) local_unnamed_addr #2

declare ptr @x_malloc(i64 noundef) local_unnamed_addr #3

declare void @soad_initialize_density_matrix(ptr noundef, i64 noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden void @initialize_density_matrix_with_H_core(ptr noundef) local_unnamed_addr #2

declare void @mat_scalar_multiply(ptr noundef, ptr noundef, i64 noundef, i64 noundef, double noundef) local_unnamed_addr #3

declare double @matsum(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden void @build_two_electron_integrals(ptr noundef) local_unnamed_addr #2

declare double @diff_time_ms(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

attributes #0 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !10, i64 16}
!6 = !{!"cmd_line_args", !7, i64 0, !10, i64 8, !10, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !11, i64 96, !11, i64 104, !11, i64 112, !7, i64 120, !7, i64 128}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!6, !10, i64 8}
!13 = !{!14, !11, i64 224}
!14 = !{!"scf_context", !10, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176, !10, i64 184, !11, i64 192, !7, i64 200, !11, i64 208, !11, i64 216, !11, i64 224, !7, i64 232, !11, i64 240, !11, i64 248, !7, i64 256, !11, i64 264, !7, i64 272, !7, i64 280, !10, i64 288, !10, i64 296, !10, i64 304, !7, i64 312, !7, i64 320, !7, i64 328, !10, i64 336, !10, i64 344, !10, i64 352, !10, i64 360, !10, i64 368, !10, i64 376, !10, i64 384, !10, i64 392, !11, i64 400, !10, i64 408, !10, i64 416, !10, i64 424, !10, i64 432, !7, i64 440}
!15 = !{!14, !11, i64 192}
!16 = !{!14, !10, i64 0}
!17 = !{!6, !7, i64 32}
!18 = !{!14, !7, i64 280}
!19 = !{!6, !7, i64 120}
!20 = !{!14, !7, i64 440}
!21 = !{!14, !7, i64 8}
!22 = !{!14, !7, i64 16}
!23 = !{!14, !7, i64 24}
!24 = !{!14, !10, i64 288}
!25 = !{!14, !10, i64 296}
!26 = !{!14, !11, i64 264}
!27 = !{!14, !10, i64 176}
!28 = !{!14, !10, i64 152}
!29 = !{!14, !10, i64 160}
!30 = !{!14, !10, i64 168}
!31 = !{!14, !7, i64 200}
!32 = !{!33, !10, i64 16}
!33 = !{!"molecule", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !7, i64 64, !10, i64 72}
!34 = !{!33, !7, i64 0}
!35 = !{!14, !10, i64 408}
!36 = !{!14, !10, i64 416}
!37 = !{!14, !10, i64 424}
!38 = !{!14, !10, i64 64}
!39 = !{!14, !10, i64 184}
!40 = !{!6, !7, i64 40}
!41 = !{!14, !7, i64 312}
!42 = !{!14, !10, i64 336}
!43 = !{!14, !10, i64 344}
!44 = !{!14, !10, i64 352}
!45 = !{!14, !10, i64 360}
!46 = !{!14, !10, i64 368}
!47 = !{!14, !10, i64 376}
!48 = !{!14, !10, i64 384}
!49 = !{!14, !10, i64 392}
!50 = !{!14, !11, i64 400}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,MemCpyOptPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass