; LLVM IR from tsotchke/quantum_rng :: examples/finance (monte_carlo)

; 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.simulation_results_t = type { double, double, double, double, double, double, ptr }
%struct.simulation_config_t = type { i32, i32, %struct.asset_params_t, [256 x i8], i32, i32, i32, [1024 x i8], double }
%struct.asset_params_t = type { double, double, double, double }

@stderr = external global ptr, align 8
@.str.11 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [18 x i8], align 1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 void @run_simulation(ptr dead_on_unwind noalias writable sret(%struct.simulation_results_t) align 8 %0, ptr noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca i32, align 4
  %13 = alloca double, align 8
  %14 = alloca i32, align 4
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  store ptr %1, ptr %3, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %0, i8 0, i64 56, i1 false)
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = icmp ne ptr %18, null
  br i1 %19, label %20, label %30

20:                                               ; preds = %2
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.simulation_config_t, ptr %21, i32 0, i32 0
  %23 = load i32, ptr %22, align 8, !tbaa !9
  %24 = icmp slt i32 %23, 1000
  br i1 %24, label %30, label %25

25:                                               ; preds = %20
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.simulation_config_t, ptr %26, i32 0, i32 0
  %28 = load i32, ptr %27, align 8, !tbaa !9
  %29 = icmp sgt i32 %28, 10000000
  br i1 %29, label %30, label %32

30:                                               ; preds = %25, %20, %2
  %31 = getelementptr inbounds %struct.simulation_results_t, ptr %0, i32 0, i32 6
  store ptr null, ptr %31, align 8, !tbaa !14
  br label %237

32:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.simulation_config_t, ptr %33, i32 0, i32 3
  %35 = getelementptr inbounds [256 x i8], ptr %34, i64 0, i64 0
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.simulation_config_t, ptr %36, i32 0, i32 4
  %38 = load i32, ptr %37, align 8, !tbaa !16
  %39 = sext i32 %38 to i64
  %40 = call i32 @qrng_init(ptr noundef %4, ptr noundef %35, i64 noundef %39)
  store i32 %40, ptr %5, align 4, !tbaa !17
  %41 = load i32, ptr %5, align 4, !tbaa !17
  %42 = icmp ne i32 %41, 0
  br i1 %42, label %43, label %45

43:                                               ; preds = %32
  %44 = getelementptr inbounds %struct.simulation_results_t, ptr %0, i32 0, i32 6
  store ptr null, ptr %44, align 8, !tbaa !14
  store i32 1, ptr %6, align 4
  br label %236

45:                                               ; preds = %32
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.simulation_config_t, ptr %46, i32 0, i32 0
  %48 = load i32, ptr %47, align 8, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = mul i64 %49, 8
  %51 = call noalias ptr @malloc(i64 noundef %50) #8
  %52 = getelementptr inbounds %struct.simulation_results_t, ptr %0, i32 0, i32 6
  store ptr %51, ptr %52, align 8, !tbaa !14
  %53 = getelementptr inbounds %struct.simulation_results_t, ptr %0, i32 0, i32 6
  %54 = load ptr, ptr %53, align 8, !tbaa !14
  %55 = icmp ne ptr %54, null
  br i1 %55, label %58, label %56

56:                                               ; preds = %45
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  call void @qrng_free(ptr noundef %57)
  store i32 1, ptr %6, align 4
  br label %236

58:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.simulation_config_t, ptr %59, i32 0, i32 1
  %61 = load i32, ptr %60, align 4, !tbaa !18
  %62 = sitofp i32 %61 to double
  %63 = fdiv double 1.000000e+00, %62
  store double %63, ptr %7, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.simulation_config_t, ptr %64, i32 0, i32 2
  %66 = getelementptr inbounds %struct.asset_params_t, ptr %65, i32 0, i32 2
  %67 = load double, ptr %66, align 8, !tbaa !20
  %68 = load ptr, ptr %3, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.simulation_config_t, ptr %68, i32 0, i32 2
  %70 = getelementptr inbounds %struct.asset_params_t, ptr %69, i32 0, i32 3
  %71 = load double, ptr %70, align 8, !tbaa !21
  %72 = fsub double %67, %71
  %73 = load ptr, ptr %3, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.simulation_config_t, ptr %73, i32 0, i32 2
  %75 = getelementptr inbounds %struct.asset_params_t, ptr %74, i32 0, i32 1
  %76 = load double, ptr %75, align 8, !tbaa !22
  %77 = fmul double 5.000000e-01, %76
  %78 = load ptr, ptr %3, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.simulation_config_t, ptr %78, i32 0, i32 2
  %80 = getelementptr inbounds %struct.asset_params_t, ptr %79, i32 0, i32 1
  %81 = load double, ptr %80, align 8, !tbaa !22
  %82 = fneg double %77
  %83 = call double @llvm.fmuladd.f64(double %82, double %81, double %72)
  %84 = load double, ptr %7, align 8, !tbaa !19
  %85 = fmul double %83, %84
  store double %85, ptr %8, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.simulation_config_t, ptr %86, i32 0, i32 2
  %88 = getelementptr inbounds %struct.asset_params_t, ptr %87, i32 0, i32 1
  %89 = load double, ptr %88, align 8, !tbaa !22
  %90 = load double, ptr %7, align 8, !tbaa !19
  %91 = call double @sqrt(double noundef %90) #7
  %92 = fmul double %89, %91
  store double %92, ptr %9, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  store double 0.000000e+00, ptr %10, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  store double 0.000000e+00, ptr %11, align 8, !tbaa !19
  %93 = getelementptr inbounds %struct.simulation_results_t, ptr %0, i32 0, i32 2
  store double 0x7FF0000000000000, ptr %93, align 8, !tbaa !23
  %94 = getelementptr inbounds %struct.simulation_results_t, ptr %0, i32 0, i32 3
  store double 0xFFF0000000000000, ptr %94, align 8, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !17
  br label %95

95:                                               ; preds = %179, %58
  %96 = load i32, ptr %12, align 4, !tbaa !17
  %97 = load ptr, ptr %3, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.simulation_config_t, ptr %97, i32 0, i32 0
  %99 = load i32, ptr %98, align 8, !tbaa !9
  %100 = icmp slt i32 %96, %99
  br i1 %100, label %102, label %101

101:                                              ; preds = %95
  store i32 2, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %182

102:                                              ; preds = %95
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %103 = load ptr, ptr %3, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.simulation_config_t, ptr %103, i32 0, i32 2
  %105 = getelementptr inbounds %struct.asset_params_t, ptr %104, i32 0, i32 0
  %106 = load double, ptr %105, align 8, !tbaa !25
  store double %106, ptr %13, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !17
  br label %107

107:                                              ; preds = %124, %102
  %108 = load i32, ptr %14, align 4, !tbaa !17
  %109 = load ptr, ptr %3, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.simulation_config_t, ptr %109, i32 0, i32 1
  %111 = load i32, ptr %110, align 4, !tbaa !18
  %112 = icmp slt i32 %108, %111
  br i1 %112, label %114, label %113

113:                                              ; preds = %107
  store i32 5, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %127

114:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %115 = load ptr, ptr %4, align 8, !tbaa !5
  %116 = call double @qrng_double(ptr noundef %115)
  store double %116, ptr %15, align 8, !tbaa !19
  %117 = load double, ptr %8, align 8, !tbaa !19
  %118 = load double, ptr %9, align 8, !tbaa !19
  %119 = load double, ptr %15, align 8, !tbaa !19
  %120 = call double @llvm.fmuladd.f64(double %118, double %119, double %117)
  %121 = call double @exp(double noundef %120) #7
  %122 = load double, ptr %13, align 8, !tbaa !19
  %123 = fmul double %122, %121
  store double %123, ptr %13, align 8, !tbaa !19
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  br label %124

124:                                              ; preds = %114
  %125 = load i32, ptr %14, align 4, !tbaa !17
  %126 = add nsw i32 %125, 1
  store i32 %126, ptr %14, align 4, !tbaa !17
  br label %107, !llvm.loop !26

127:                                              ; preds = %113
  %128 = load double, ptr %13, align 8, !tbaa !19
  %129 = getelementptr inbounds %struct.simulation_results_t, ptr %0, i32 0, i32 6
  %130 = load ptr, ptr %129, align 8, !tbaa !14
  %131 = load i32, ptr %12, align 4, !tbaa !17
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds double, ptr %130, i64 %132
  store double %128, ptr %133, align 8, !tbaa !19
  %134 = load double, ptr %13, align 8, !tbaa !19
  %135 = load double, ptr %10, align 8, !tbaa !19
  %136 = fadd double %135, %134
  store double %136, ptr %10, align 8, !tbaa !19
  %137 = load double, ptr %13, align 8, !tbaa !19
  %138 = load double, ptr %13, align 8, !tbaa !19
  %139 = load double, ptr %11, align 8, !tbaa !19
  %140 = call double @llvm.fmuladd.f64(double %137, double %138, double %139)
  store double %140, ptr %11, align 8, !tbaa !19
  %141 = load double, ptr %13, align 8, !tbaa !19
  %142 = getelementptr inbounds %struct.simulation_results_t, ptr %0, i32 0, i32 2
  %143 = load double, ptr %142, align 8, !tbaa !23
  %144 = fcmp olt double %141, %143
  br i1 %144, label %145, label %148

145:                                              ; preds = %127
  %146 = load double, ptr %13, align 8, !tbaa !19
  %147 = getelementptr inbounds %struct.simulation_results_t, ptr %0, i32 0, i32 2
  store double %146, ptr %147, align 8, !tbaa !23
  br label %148

148:                                              ; preds = %145, %127
  %149 = load double, ptr %13, align 8, !tbaa !19
  %150 = getelementptr inbounds %struct.simulation_results_t, ptr %0, i32 0, i32 3
  %151 = load double, ptr %150, align 8, !tbaa !24
  %152 = fcmp ogt double %149, %151
  br i1 %152, label %153, label %156

153:                                              ; preds = %148
  %154 = load double, ptr %13, align 8, !tbaa !19
  %155 = getelementptr inbounds %struct.simulation_results_t, ptr %0, i32 0, i32 3
  store double %154, ptr %155, align 8, !tbaa !24
  br label %156

156:                                              ; preds = %153, %148
  %157 = load ptr, ptr %3, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.simulation_config_t, ptr %157, i32 0, i32 6
  %159 = load i32, ptr %158, align 8, !tbaa !28
  %160 = icmp ne i32 %159, 0
  br i1 %160, label %161, label %178

161:                                              ; preds = %156
  %162 = load i32, ptr %12, align 4, !tbaa !17
  %163 = load ptr, ptr %3, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.simulation_config_t, ptr %163, i32 0, i32 0
  %165 = load i32, ptr %164, align 8, !tbaa !9
  %166 = sdiv i32 %165, 100
  %167 = srem i32 %162, %166
  %168 = icmp eq i32 %167, 0
  br i1 %168, label %169, label %178

169:                                              ; preds = %161
  %170 = load ptr, ptr @stderr, align 8, !tbaa !5
  %171 = load i32, ptr %12, align 4, !tbaa !17
  %172 = mul nsw i32 %171, 100
  %173 = load ptr, ptr %3, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.simulation_config_t, ptr %173, i32 0, i32 0
  %175 = load i32, ptr %174, align 8, !tbaa !9
  %176 = sdiv i32 %172, %175
  %177 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %170, ptr noundef @.str.11, i32 noundef %176) #7
  br label %178

178:                                              ; preds = %169, %161, %156
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %179

179:                                              ; preds = %178
  %180 = load i32, ptr %12, align 4, !tbaa !17
  %181 = add nsw i32 %180, 1
  store i32 %181, ptr %12, align 4, !tbaa !17
  br label %95, !llvm.loop !29

182:                                              ; preds = %101
  %183 = load ptr, ptr %3, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.simulation_config_t, ptr %183, i32 0, i32 6
  %185 = load i32, ptr %184, align 8, !tbaa !28
  %186 = icmp ne i32 %185, 0
  br i1 %186, label %187, label %190

187:                                              ; preds = %182
  %188 = load ptr, ptr @stderr, align 8, !tbaa !5
  %189 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %188, ptr noundef @.str.12) #7
  br label %190

190:                                              ; preds = %187, %182
  %191 = load double, ptr %10, align 8, !tbaa !19
  %192 = load ptr, ptr %3, align 8, !tbaa !5
  %193 = getelementptr inbounds %struct.simulation_config_t, ptr %192, i32 0, i32 0
  %194 = load i32, ptr %193, align 8, !tbaa !9
  %195 = sitofp i32 %194 to double
  %196 = fdiv double %191, %195
  %197 = getelementptr inbounds %struct.simulation_results_t, ptr %0, i32 0, i32 0
  store double %196, ptr %197, align 8, !tbaa !30
  %198 = load double, ptr %11, align 8, !tbaa !19
  %199 = load ptr, ptr %3, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct.simulation_config_t, ptr %199, i32 0, i32 0
  %201 = load i32, ptr %200, align 8, !tbaa !9
  %202 = sitofp i32 %201 to double
  %203 = fdiv double %198, %202
  %204 = getelementptr inbounds %struct.simulation_results_t, ptr %0, i32 0, i32 0
  %205 = load double, ptr %204, align 8, !tbaa !30
  %206 = getelementptr inbounds %struct.simulation_results_t, ptr %0, i32 0, i32 0
  %207 = load double, ptr %206, align 8, !tbaa !30
  %208 = fneg double %205
  %209 = call double @llvm.fmuladd.f64(double %208, double %207, double %203)
  %210 = call double @sqrt(double noundef %209) #7
  %211 = getelementptr inbounds %struct.simulation_results_t, ptr %0, i32 0, i32 1
  store double %210, ptr %211, align 8, !tbaa !31
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %212 = load ptr, ptr %3, align 8, !tbaa !5
  %213 = getelementptr inbounds %struct.simulation_config_t, ptr %212, i32 0, i32 8
  %214 = load double, ptr %213, align 8, !tbaa !32
  store double %214, ptr %16, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %215 = load double, ptr %16, align 8, !tbaa !19
  %216 = getelementptr inbounds %struct.simulation_results_t, ptr %0, i32 0, i32 1
  %217 = load double, ptr %216, align 8, !tbaa !31
  %218 = fmul double %215, %217
  %219 = load ptr, ptr %3, align 8, !tbaa !5
  %220 = getelementptr inbounds %struct.simulation_config_t, ptr %219, i32 0, i32 0
  %221 = load i32, ptr %220, align 8, !tbaa !9
  %222 = sitofp i32 %221 to double
  %223 = call double @sqrt(double noundef %222) #7
  %224 = fdiv double %218, %223
  store double %224, ptr %17, align 8, !tbaa !19
  %225 = getelementptr inbounds %struct.simulation_results_t, ptr %0, i32 0, i32 0
  %226 = load double, ptr %225, align 8, !tbaa !30
  %227 = load double, ptr %17, align 8, !tbaa !19
  %228 = fsub double %226, %227
  %229 = getelementptr inbounds %struct.simulation_results_t, ptr %0, i32 0, i32 4
  store double %228, ptr %229, align 8, !tbaa !33
  %230 = getelementptr inbounds %struct.simulation_results_t, ptr %0, i32 0, i32 0
  %231 = load double, ptr %230, align 8, !tbaa !30
  %232 = load double, ptr %17, align 8, !tbaa !19
  %233 = fadd double %231, %232
  %234 = getelementptr inbounds %struct.simulation_results_t, ptr %0, i32 0, i32 5
  store double %233, ptr %234, align 8, !tbaa !34
  %235 = load ptr, ptr %4, align 8, !tbaa !5
  call void @qrng_free(ptr noundef %235)
  store i32 1, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %236

236:                                              ; preds = %190, %56, %43
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  br label %237

237:                                              ; preds = %236, %30
  ret void
}

declare i32 @qrng_init(ptr noundef, ptr noundef, i64 noundef) #3

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #4

declare void @qrng_free(ptr noundef) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #5

; Function Attrs: nounwind
declare double @sqrt(double noundef) #6

declare double @qrng_double(ptr noundef) #3

; Function Attrs: nounwind
declare double @exp(double noundef) #6

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #6

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { "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 = { nounwind allocsize(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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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 #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }

!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, !11, i64 0}
!10 = !{!"", !11, i64 0, !11, i64 4, !12, i64 8, !7, i64 40, !11, i64 296, !11, i64 300, !11, i64 304, !7, i64 308, !13, i64 1336}
!11 = !{!"int", !7, i64 0}
!12 = !{!"", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24}
!13 = !{!"double", !7, i64 0}
!14 = !{!15, !6, i64 48}
!15 = !{!"", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40, !6, i64 48}
!16 = !{!10, !11, i64 296}
!17 = !{!11, !11, i64 0}
!18 = !{!10, !11, i64 4}
!19 = !{!13, !13, i64 0}
!20 = !{!10, !13, i64 24}
!21 = !{!10, !13, i64 32}
!22 = !{!10, !13, i64 16}
!23 = !{!15, !13, i64 16}
!24 = !{!15, !13, i64 24}
!25 = !{!10, !13, i64 8}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!10, !11, i64 304}
!29 = distinct !{!29, !27}
!30 = !{!15, !13, i64 0}
!31 = !{!15, !13, i64 8}
!32 = !{!10, !13, i64 1336}
!33 = !{!15, !13, i64 32}
!34 = !{!15, !13, i64 40}


; 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.simulation_results_t = type { double, double, double, double, double, double, ptr }

@stderr = external local_unnamed_addr global ptr, align 8
@.str.11 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [18 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 void @run_simulation(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.simulation_results_t) align 8 %0, ptr noundef %1) local_unnamed_addr #2 {
  %3 = alloca ptr, align 8
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(56) %0, i8 0, i64 56, i1 false)
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %110, label %4

4:                                                ; preds = %2
  %5 = load i32, ptr %1, align 8, !tbaa !5
  %6 = add i32 %5, -10000001
  %or.cond = icmp ult i32 %6, -9999001
  br i1 %or.cond, label %110, label %7

7:                                                ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  %8 = getelementptr inbounds i8, ptr %1, i64 40
  %9 = getelementptr inbounds i8, ptr %1, i64 296
  %10 = load i32, ptr %9, align 8, !tbaa !12
  %11 = sext i32 %10 to i64
  %12 = call i32 @qrng_init(ptr noundef nonnull %3, ptr noundef nonnull %8, i64 noundef %11) #8
  %.not57 = icmp eq i32 %12, 0
  br i1 %.not57, label %15, label %13

13:                                               ; preds = %7
  %14 = getelementptr inbounds i8, ptr %0, i64 48
  store ptr null, ptr %14, align 8, !tbaa !13
  br label %109

15:                                               ; preds = %7
  %16 = load i32, ptr %1, align 8, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = shl nsw i64 %17, 3
  %19 = call noalias ptr @malloc(i64 noundef %18) #9
  %20 = getelementptr inbounds i8, ptr %0, i64 48
  store ptr %19, ptr %20, align 8, !tbaa !13
  %.not58 = icmp eq ptr %19, null
  br i1 %.not58, label %21, label %23

21:                                               ; preds = %15
  %22 = load ptr, ptr %3, align 8, !tbaa !16
  call void @qrng_free(ptr noundef %22) #8
  br label %109

23:                                               ; preds = %15
  %24 = getelementptr inbounds i8, ptr %1, i64 4
  %25 = load i32, ptr %24, align 4, !tbaa !17
  %26 = sitofp i32 %25 to double
  %27 = fdiv double 1.000000e+00, %26
  %28 = getelementptr inbounds i8, ptr %1, i64 8
  %29 = getelementptr inbounds i8, ptr %1, i64 24
  %30 = load double, ptr %29, align 8, !tbaa !18
  %31 = getelementptr inbounds i8, ptr %1, i64 32
  %32 = load double, ptr %31, align 8, !tbaa !19
  %33 = fsub double %30, %32
  %34 = getelementptr inbounds i8, ptr %1, i64 16
  %35 = load double, ptr %34, align 8, !tbaa !20
  %36 = fmul double %35, -5.000000e-01
  %37 = call double @llvm.fmuladd.f64(double %36, double %35, double %33)
  %38 = fmul double %27, %37
  %39 = call double @sqrt(double noundef %27) #8
  %40 = fmul double %35, %39
  %41 = getelementptr inbounds i8, ptr %0, i64 16
  %42 = getelementptr inbounds i8, ptr %0, i64 24
  %43 = load i32, ptr %1, align 8, !tbaa !5
  %44 = icmp sgt i32 %43, 0
  br i1 %44, label %.lr.ph69, label %._crit_edge70

.lr.ph69:                                         ; preds = %23
  %45 = getelementptr inbounds i8, ptr %1, i64 304
  br label %49

._crit_edge70:                                    ; preds = %82, %23
  %46 = phi i32 [ %43, %23 ], [ %.pre8184, %82 ]
  %.lcssa64 = phi double [ 0xFFF0000000000000, %23 ], [ %61, %82 ]
  %.lcssa = phi double [ 0x7FF0000000000000, %23 ], [ %59, %82 ]
  %.051.lcssa = phi double [ 0.000000e+00, %23 ], [ %57, %82 ]
  %.0.lcssa = phi double [ 0.000000e+00, %23 ], [ %56, %82 ]
  store double %.lcssa, ptr %41, align 8, !tbaa !21
  store double %.lcssa64, ptr %42, align 8, !tbaa !22
  %47 = getelementptr inbounds i8, ptr %1, i64 304
  %48 = load i32, ptr %47, align 8, !tbaa !23
  %.not59 = icmp eq i32 %48, 0
  br i1 %.not59, label %88, label %85

49:                                               ; preds = %.lr.ph69, %82
  %.pre8183 = phi i32 [ %43, %.lr.ph69 ], [ %.pre8184, %82 ]
  %indvars.iv = phi i64 [ 0, %.lr.ph69 ], [ %indvars.iv.next, %82 ]
  %.067 = phi double [ 0.000000e+00, %.lr.ph69 ], [ %56, %82 ]
  %.05166 = phi double [ 0.000000e+00, %.lr.ph69 ], [ %57, %82 ]
  %50 = phi double [ 0x7FF0000000000000, %.lr.ph69 ], [ %59, %82 ]
  %51 = phi double [ 0xFFF0000000000000, %.lr.ph69 ], [ %61, %82 ]
  %52 = load double, ptr %28, align 8, !tbaa !24
  %53 = load i32, ptr %24, align 4, !tbaa !17
  %54 = icmp sgt i32 %53, 0
  br i1 %54, label %.lr.ph, label %._crit_edge

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre81.pre = load i32, ptr %1, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %49
  %.pre81 = phi i32 [ %.pre8183, %49 ], [ %.pre81.pre, %._crit_edge.loopexit ]
  %.053.lcssa = phi double [ %52, %49 ], [ %67, %._crit_edge.loopexit ]
  %55 = getelementptr inbounds double, ptr %19, i64 %indvars.iv
  store double %.053.lcssa, ptr %55, align 8, !tbaa !25
  %56 = fadd double %.067, %.053.lcssa
  %57 = call double @llvm.fmuladd.f64(double %.053.lcssa, double %.053.lcssa, double %.05166)
  %58 = fcmp olt double %.053.lcssa, %50
  %59 = select i1 %58, double %.053.lcssa, double %50
  %60 = fcmp ogt double %.053.lcssa, %51
  %61 = select i1 %60, double %.053.lcssa, double %51
  %62 = load i32, ptr %45, align 8, !tbaa !23
  %.not60 = icmp eq i32 %62, 0
  br i1 %.not60, label %82, label %71

.lr.ph:                                           ; preds = %49, %.lr.ph
  %.05262 = phi i32 [ %68, %.lr.ph ], [ 0, %49 ]
  %.05361 = phi double [ %67, %.lr.ph ], [ %52, %49 ]
  %63 = load ptr, ptr %3, align 8, !tbaa !16
  %64 = call double @qrng_double(ptr noundef %63) #8
  %65 = call double @llvm.fmuladd.f64(double %40, double %64, double %38)
  %66 = call double @exp(double noundef %65) #8
  %67 = fmul double %.05361, %66
  %68 = add nuw nsw i32 %.05262, 1
  %69 = load i32, ptr %24, align 4, !tbaa !17
  %70 = icmp slt i32 %68, %69
  br i1 %70, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !26

71:                                               ; preds = %._crit_edge
  %72 = sdiv i32 %.pre81, 100
  %73 = trunc nuw nsw i64 %indvars.iv to i32
  %74 = srem i32 %73, %72
  %75 = icmp eq i32 %74, 0
  br i1 %75, label %76, label %82

76:                                               ; preds = %71
  %77 = load ptr, ptr @stderr, align 8, !tbaa !16
  %78 = trunc i64 %indvars.iv to i32
  %79 = mul i32 %78, 100
  %80 = sdiv i32 %79, %.pre81
  %81 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %77, ptr noundef nonnull @.str.11, i32 noundef %80) #10
  %.pre = load i32, ptr %1, align 8, !tbaa !5
  br label %82

82:                                               ; preds = %76, %71, %._crit_edge
  %.pre8184 = phi i32 [ %.pre, %76 ], [ %.pre81, %71 ], [ %.pre81, %._crit_edge ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %83 = sext i32 %.pre8184 to i64
  %84 = icmp slt i64 %indvars.iv.next, %83
  br i1 %84, label %49, label %._crit_edge70, !llvm.loop !28

85:                                               ; preds = %._crit_edge70
  %86 = load ptr, ptr @stderr, align 8, !tbaa !16
  %87 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %86, ptr noundef nonnull @.str.12) #10
  %.pre82 = load i32, ptr %1, align 8, !tbaa !5
  br label %88

88:                                               ; preds = %85, %._crit_edge70
  %89 = phi i32 [ %.pre82, %85 ], [ %46, %._crit_edge70 ]
  %90 = sitofp i32 %89 to double
  %91 = fdiv double %.0.lcssa, %90
  store double %91, ptr %0, align 8, !tbaa !29
  %92 = fdiv double %.051.lcssa, %90
  %93 = fneg double %91
  %94 = call double @llvm.fmuladd.f64(double %93, double %91, double %92)
  %95 = call double @sqrt(double noundef %94) #8
  %96 = getelementptr inbounds i8, ptr %0, i64 8
  store double %95, ptr %96, align 8, !tbaa !30
  %97 = getelementptr inbounds i8, ptr %1, i64 1336
  %98 = load double, ptr %97, align 8, !tbaa !31
  %99 = fmul double %95, %98
  %100 = load i32, ptr %1, align 8, !tbaa !5
  %101 = sitofp i32 %100 to double
  %102 = call double @sqrt(double noundef %101) #8
  %103 = fdiv double %99, %102
  %104 = fsub double %91, %103
  %105 = getelementptr inbounds i8, ptr %0, i64 32
  store double %104, ptr %105, align 8, !tbaa !32
  %106 = fadd double %91, %103
  %107 = getelementptr inbounds i8, ptr %0, i64 40
  store double %106, ptr %107, align 8, !tbaa !33
  %108 = load ptr, ptr %3, align 8, !tbaa !16
  call void @qrng_free(ptr noundef %108) #8
  br label %109

109:                                              ; preds = %88, %21, %13
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  br label %110

110:                                              ; preds = %2, %4, %109
  ret void
}

declare i32 @qrng_init(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4

declare void @qrng_free(ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #5

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #6

declare double @qrng_double(ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @exp(double noundef) local_unnamed_addr #6

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

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #5 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { mustprogress nofree nounwind willreturn memory(write) "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 #7 = { 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 #8 = { nounwind }
attributes #9 = { nounwind allocsize(0) }
attributes #10 = { cold 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, !7, i64 0}
!6 = !{!"", !7, i64 0, !7, i64 4, !10, i64 8, !8, i64 40, !7, i64 296, !7, i64 300, !7, i64 304, !8, i64 308, !11, i64 1336}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!11 = !{!"double", !8, i64 0}
!12 = !{!6, !7, i64 296}
!13 = !{!14, !15, i64 48}
!14 = !{!"", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !15, i64 48}
!15 = !{!"any pointer", !8, i64 0}
!16 = !{!15, !15, i64 0}
!17 = !{!6, !7, i64 4}
!18 = !{!6, !11, i64 24}
!19 = !{!6, !11, i64 32}
!20 = !{!6, !11, i64 16}
!21 = !{!14, !11, i64 16}
!22 = !{!14, !11, i64 24}
!23 = !{!6, !7, i64 304}
!24 = !{!6, !11, i64 8}
!25 = !{!11, !11, i64 0}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = distinct !{!28, !27}
!29 = !{!14, !11, i64 0}
!30 = !{!14, !11, i64 8}
!31 = !{!6, !11, i64 1336}
!32 = !{!14, !11, i64 32}
!33 = !{!14, !11, i64 40}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass