; LLVM IR from sbu-fsl/kernel-ml :: examples (xor_net)

; 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"

%union.val = type { double }
%struct.xor_net = type { i32, ptr, ptr, ptr, ptr, %struct.model_data, %struct.model_multithreading, %struct.model_state }
%struct.model_data = type { ptr, ptr, ptr, ptr }
%struct.model_multithreading = type { [32 x %struct.mt_buffer], [32 x i32], i32, i32, i32, i64, ptr }
%struct.mt_buffer = type { ptr, ptr }
%struct.model_state = type { i8, i32 }
%struct.matrix = type { i32, i32, i32, %union.anon }
%union.anon = type { ptr }

@__const.simulation.modula = external hidden unnamed_addr constant { float, [4 x i8] }, align 8
@__const.simulation.xor_inputs = external hidden unnamed_addr constant [4 x [2 x float]], align 16
@__const.simulation.xor_outputs = external hidden unnamed_addr constant [4 x float], align 16
@iter = external hidden global i32, align 4
@num_samples = external hidden global i32, align 4
@.str = external hidden unnamed_addr constant [31 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [29 x i8], align 1
@timing_sum = external hidden global float, align 4

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

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

; Function Attrs: nounwind uwtable
define dso_local float @simulation(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %union.val, align 8
  %8 = alloca float, align 4
  %9 = alloca [2 x float], align 4
  %10 = alloca [4 x [2 x float]], align 16
  %11 = alloca [4 x float], align 16
  %12 = alloca i32, align 4
  %13 = alloca float, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 20000, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 1000, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %7, ptr align 8 @__const.simulation.modula, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store float 0.000000e+00, ptr %8, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %10, ptr align 16 @__const.simulation.xor_inputs, i64 32, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %11, ptr align 16 @__const.simulation.xor_outputs, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.xor_net, ptr %14, i32 0, i32 3
  %16 = load ptr, ptr %15, align 8, !tbaa !13
  %17 = getelementptr inbounds %union.val, ptr %7, i32 0, i32 0
  %18 = load i64, ptr %17, align 8
  call void @set_random_weights(ptr noundef %16, i64 %18)
  br label %19

19:                                               ; preds = %179, %1
  %20 = load i32, ptr %4, align 4, !tbaa !9
  %21 = load i32, ptr %5, align 4, !tbaa !9
  %22 = load i32, ptr %6, align 4, !tbaa !9
  %23 = add nsw i32 %21, %22
  %24 = icmp slt i32 %20, %23
  br i1 %24, label %25, label %180

25:                                               ; preds = %19
  %26 = load i32, ptr @iter, align 4, !tbaa !9
  %27 = load i32, ptr %5, align 4, !tbaa !9
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.xor_net, ptr %28, i32 0, i32 0
  %30 = load i32, ptr %29, align 8, !tbaa !19
  %31 = sdiv i32 %27, %30
  %32 = icmp slt i32 %26, %31
  br i1 %32, label %33, label %37

33:                                               ; preds = %25
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.xor_net, ptr %34, i32 0, i32 7
  %36 = getelementptr inbounds %struct.model_state, ptr %35, i32 0, i32 0
  store atomic i8 1, ptr %36 seq_cst, align 1, !tbaa !20
  br label %50

37:                                               ; preds = %25
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.xor_net, ptr %38, i32 0, i32 7
  %40 = getelementptr inbounds %struct.model_state, ptr %39, i32 0, i32 0
  %41 = load atomic i8, ptr %40 seq_cst, align 1, !tbaa !20
  %42 = trunc i8 %41 to i1
  br i1 %42, label %43, label %46

43:                                               ; preds = %37
  %44 = load ptr, ptr %2, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.xor_net, ptr %44, i32 0, i32 6
  call void @wait_for_draining_pipeline(ptr noundef %45)
  br label %46

46:                                               ; preds = %43, %37
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.xor_net, ptr %47, i32 0, i32 7
  %49 = getelementptr inbounds %struct.model_state, ptr %48, i32 0, i32 0
  store atomic i8 0, ptr %49 seq_cst, align 1, !tbaa !20
  br label %50

50:                                               ; preds = %46, %33
  %51 = call i32 @rand() #5
  %52 = srem i32 %51, 4
  store i32 %52, ptr %12, align 4, !tbaa !9
  %53 = load i32, ptr %12, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [4 x [2 x float]], ptr %10, i64 0, i64 %54
  %56 = getelementptr inbounds [2 x float], ptr %55, i64 0, i64 0
  %57 = load float, ptr %56, align 8, !tbaa !11
  %58 = getelementptr inbounds [2 x float], ptr %9, i64 0, i64 0
  store float %57, ptr %58, align 4, !tbaa !11
  %59 = load i32, ptr %12, align 4, !tbaa !9
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [4 x [2 x float]], ptr %10, i64 0, i64 %60
  %62 = getelementptr inbounds [2 x float], ptr %61, i64 0, i64 1
  %63 = load float, ptr %62, align 4, !tbaa !11
  %64 = getelementptr inbounds [2 x float], ptr %9, i64 0, i64 1
  store float %63, ptr %64, align 4, !tbaa !11
  %65 = load i32, ptr %12, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [4 x float], ptr %11, i64 0, i64 %66
  %68 = load float, ptr %67, align 4, !tbaa !11
  store float %68, ptr %13, align 4, !tbaa !11
  %69 = getelementptr inbounds [2 x float], ptr %9, i64 0, i64 0
  %70 = load float, ptr %69, align 4, !tbaa !11
  %71 = load ptr, ptr %2, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.xor_net, ptr %71, i32 0, i32 5
  %73 = getelementptr inbounds %struct.model_data, ptr %72, i32 0, i32 2
  %74 = load ptr, ptr %73, align 8, !tbaa !21
  %75 = getelementptr inbounds %struct.matrix, ptr %74, i32 0, i32 3
  %76 = load ptr, ptr %75, align 8, !tbaa !22
  %77 = load i32, ptr %4, align 4, !tbaa !9
  %78 = load ptr, ptr %2, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.xor_net, ptr %78, i32 0, i32 5
  %80 = getelementptr inbounds %struct.model_data, ptr %79, i32 0, i32 2
  %81 = load ptr, ptr %80, align 8, !tbaa !21
  %82 = getelementptr inbounds %struct.matrix, ptr %81, i32 0, i32 1
  %83 = load i32, ptr %82, align 4, !tbaa !23
  %84 = mul nsw i32 %77, %83
  %85 = add nsw i32 %84, 0
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds float, ptr %76, i64 %86
  store float %70, ptr %87, align 4, !tbaa !11
  %88 = getelementptr inbounds [2 x float], ptr %9, i64 0, i64 1
  %89 = load float, ptr %88, align 4, !tbaa !11
  %90 = load ptr, ptr %2, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.xor_net, ptr %90, i32 0, i32 5
  %92 = getelementptr inbounds %struct.model_data, ptr %91, i32 0, i32 2
  %93 = load ptr, ptr %92, align 8, !tbaa !21
  %94 = getelementptr inbounds %struct.matrix, ptr %93, i32 0, i32 3
  %95 = load ptr, ptr %94, align 8, !tbaa !22
  %96 = load i32, ptr %4, align 4, !tbaa !9
  %97 = load ptr, ptr %2, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.xor_net, ptr %97, i32 0, i32 5
  %99 = getelementptr inbounds %struct.model_data, ptr %98, i32 0, i32 2
  %100 = load ptr, ptr %99, align 8, !tbaa !21
  %101 = getelementptr inbounds %struct.matrix, ptr %100, i32 0, i32 1
  %102 = load i32, ptr %101, align 4, !tbaa !23
  %103 = mul nsw i32 %96, %102
  %104 = add nsw i32 %103, 1
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds float, ptr %95, i64 %105
  store float %89, ptr %106, align 4, !tbaa !11
  %107 = load float, ptr %13, align 4, !tbaa !11
  %108 = load ptr, ptr %2, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.xor_net, ptr %108, i32 0, i32 5
  %110 = getelementptr inbounds %struct.model_data, ptr %109, i32 0, i32 3
  %111 = load ptr, ptr %110, align 8, !tbaa !25
  %112 = getelementptr inbounds %struct.matrix, ptr %111, i32 0, i32 3
  %113 = load ptr, ptr %112, align 8, !tbaa !22
  %114 = load i32, ptr %4, align 4, !tbaa !9
  %115 = load ptr, ptr %2, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.xor_net, ptr %115, i32 0, i32 5
  %117 = getelementptr inbounds %struct.model_data, ptr %116, i32 0, i32 3
  %118 = load ptr, ptr %117, align 8, !tbaa !25
  %119 = getelementptr inbounds %struct.matrix, ptr %118, i32 0, i32 1
  %120 = load i32, ptr %119, align 4, !tbaa !23
  %121 = mul nsw i32 %114, %120
  %122 = add nsw i32 %121, 0
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds float, ptr %113, i64 %123
  store float %107, ptr %124, align 4, !tbaa !11
  %125 = load i32, ptr %4, align 4, !tbaa !9
  %126 = add nsw i32 %125, 1
  store i32 %126, ptr %4, align 4, !tbaa !9
  %127 = load i32, ptr %4, align 4, !tbaa !9
  %128 = load ptr, ptr %2, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.xor_net, ptr %128, i32 0, i32 0
  %130 = load i32, ptr %129, align 8, !tbaa !19
  %131 = icmp eq i32 %127, %130
  br i1 %131, label %132, label %148

132:                                              ; preds = %50
  %133 = call i64 @clock() #5
  store i64 %133, ptr %3, align 8, !tbaa !26
  %134 = load ptr, ptr %2, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.xor_net, ptr %134, i32 0, i32 5
  %136 = load ptr, ptr %2, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.xor_net, ptr %136, i32 0, i32 6
  call void @set_data_async(ptr noundef %135, ptr noundef %137)
  %138 = call i64 @clock() #5
  %139 = load i64, ptr %3, align 8, !tbaa !26
  %140 = sub nsw i64 %138, %139
  store i64 %140, ptr %3, align 8, !tbaa !26
  %141 = load i64, ptr %3, align 8, !tbaa !26
  %142 = sitofp i64 %141 to float
  %143 = fdiv float %142, 1.000000e+06
  %144 = load float, ptr %8, align 4, !tbaa !11
  %145 = fadd float %144, %143
  store float %145, ptr %8, align 4, !tbaa !11
  store i32 0, ptr %4, align 4, !tbaa !9
  %146 = load i32, ptr @iter, align 4, !tbaa !9
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr @iter, align 4, !tbaa !9
  br label %148

148:                                              ; preds = %132, %50
  %149 = load i32, ptr @iter, align 4, !tbaa !9
  %150 = load i32, ptr @num_samples, align 4, !tbaa !9
  %151 = load ptr, ptr %2, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.xor_net, ptr %151, i32 0, i32 0
  %153 = load i32, ptr %152, align 8, !tbaa !19
  %154 = sdiv i32 %150, %153
  %155 = icmp eq i32 %149, %154
  br i1 %155, label %156, label %179

156:                                              ; preds = %148
  %157 = load ptr, ptr %2, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.xor_net, ptr %157, i32 0, i32 6
  call void @wait_for_draining_pipeline(ptr noundef %158)
  %159 = load ptr, ptr %2, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.xor_net, ptr %159, i32 0, i32 7
  %161 = getelementptr inbounds %struct.model_state, ptr %160, i32 0, i32 1
  %162 = load atomic i32, ptr %161 seq_cst, align 4, !tbaa !27
  %163 = sitofp i32 %162 to float
  %164 = load i32, ptr @iter, align 4, !tbaa !9
  %165 = load i32, ptr %5, align 4, !tbaa !9
  %166 = load ptr, ptr %2, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.xor_net, ptr %166, i32 0, i32 0
  %168 = load i32, ptr %167, align 8, !tbaa !19
  %169 = sdiv i32 %165, %168
  %170 = sub nsw i32 %164, %169
  %171 = load ptr, ptr %2, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.xor_net, ptr %171, i32 0, i32 0
  %173 = load i32, ptr %172, align 8, !tbaa !19
  %174 = mul nsw i32 %170, %173
  %175 = sitofp i32 %174 to float
  %176 = fdiv float %163, %175
  %177 = fpext float %176 to double
  %178 = call i32 (ptr, ...) @printf(ptr noundef @.str, double noundef %177)
  br label %180

179:                                              ; preds = %148
  br label %19, !llvm.loop !28

180:                                              ; preds = %156, %19
  %181 = load float, ptr %8, align 4, !tbaa !11
  %182 = fpext float %181 to double
  %183 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, double noundef %182)
  %184 = load float, ptr %8, align 4, !tbaa !11
  %185 = load float, ptr @timing_sum, align 4, !tbaa !11
  %186 = fadd float %185, %184
  store float %186, ptr @timing_sum, align 4, !tbaa !11
  %187 = load ptr, ptr %2, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.xor_net, ptr %187, i32 0, i32 7
  %189 = getelementptr inbounds %struct.model_state, ptr %188, i32 0, i32 1
  %190 = load atomic i32, ptr %189 seq_cst, align 4, !tbaa !27
  %191 = sitofp i32 %190 to float
  %192 = load i32, ptr @iter, align 4, !tbaa !9
  %193 = load i32, ptr %5, align 4, !tbaa !9
  %194 = load ptr, ptr %2, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.xor_net, ptr %194, i32 0, i32 0
  %196 = load i32, ptr %195, align 8, !tbaa !19
  %197 = sdiv i32 %193, %196
  %198 = sub nsw i32 %192, %197
  %199 = load ptr, ptr %2, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct.xor_net, ptr %199, i32 0, i32 0
  %201 = load i32, ptr %200, align 8, !tbaa !19
  %202 = mul nsw i32 %198, %201
  %203 = sitofp i32 %202 to float
  %204 = fdiv float %191, %203
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  ret float %204
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

declare void @set_random_weights(ptr noundef, i64) #3

declare void @wait_for_draining_pipeline(ptr noundef) #3

; Function Attrs: nounwind
declare i32 @rand() #4

; Function Attrs: nounwind
declare i64 @clock() #4

declare void @set_data_async(ptr noundef, ptr noundef) #3

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 "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 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !6, i64 24}
!14 = !{!"xor_net", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !15, i64 40, !16, i64 72, !18, i64 744}
!15 = !{!"model_data", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!16 = !{!"model_multithreading", !7, i64 0, !7, i64 512, !7, i64 640, !7, i64 644, !7, i64 648, !17, i64 656, !6, i64 664}
!17 = !{!"long", !7, i64 0}
!18 = !{!"model_state", !7, i64 0, !7, i64 4}
!19 = !{!14, !10, i64 0}
!20 = !{!14, !7, i64 744}
!21 = !{!14, !6, i64 56}
!22 = !{!7, !7, i64 0}
!23 = !{!24, !10, i64 4}
!24 = !{!"matrix", !10, i64 0, !10, i64 4, !10, i64 8, !7, i64 16}
!25 = !{!14, !6, i64 64}
!26 = !{!17, !17, i64 0}
!27 = !{!14, !7, i64 748}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}


; 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"

@__const.simulation.modula = external hidden unnamed_addr constant { float, [4 x i8] }, align 8
@__const.simulation.xor_inputs = external hidden unnamed_addr constant [4 x [2 x float]], align 16
@__const.simulation.xor_outputs = external hidden unnamed_addr constant [4 x float], align 16
@iter = external hidden local_unnamed_addr global i32, align 4
@num_samples = external hidden local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [31 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [29 x i8], align 1
@timing_sum = external hidden local_unnamed_addr global float, align 4

; Function Attrs: nounwind uwtable
define dso_local float @simulation(ptr noundef %0) local_unnamed_addr #0 {
  %.sroa.06.0.copyload = load i64, ptr @__const.simulation.modula, align 8
  %2 = getelementptr inbounds i8, ptr %0, i64 24
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  tail call void @set_random_weights(ptr noundef %3, i64 %.sroa.06.0.copyload) #4
  %4 = getelementptr inbounds i8, ptr %0, i64 744
  %5 = getelementptr inbounds i8, ptr %0, i64 72
  %6 = getelementptr inbounds i8, ptr %0, i64 56
  %7 = getelementptr inbounds i8, ptr %0, i64 64
  %8 = getelementptr inbounds i8, ptr %0, i64 40
  br label %9

9:                                                ; preds = %61, %1
  %.043 = phi float [ 0.000000e+00, %1 ], [ %.144, %61 ]
  %.0 = phi i32 [ 0, %1 ], [ %.1, %61 ]
  %10 = icmp slt i32 %.0, 21000
  br i1 %10, label %11, label %.loopexit

11:                                               ; preds = %9
  %12 = load i32, ptr @iter, align 4, !tbaa !15
  %13 = load i32, ptr %0, align 8, !tbaa !16
  %14 = sdiv i32 20000, %13
  %15 = icmp slt i32 %12, %14
  br i1 %15, label %20, label %16

16:                                               ; preds = %11
  %17 = load atomic i8, ptr %4 seq_cst, align 1, !tbaa !17
  %18 = trunc i8 %17 to i1
  br i1 %18, label %19, label %20

19:                                               ; preds = %16
  tail call void @wait_for_draining_pipeline(ptr noundef nonnull %5) #4
  br label %20

20:                                               ; preds = %16, %19, %11
  %.sink = phi i8 [ 1, %11 ], [ 0, %19 ], [ 0, %16 ]
  store atomic i8 %.sink, ptr %4 seq_cst, align 1, !tbaa !17
  %21 = tail call i32 @rand() #4
  %22 = srem i32 %21, 4
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [4 x [2 x float]], ptr @__const.simulation.xor_inputs, i64 0, i64 %23
  %25 = load float, ptr %24, align 8, !tbaa !18
  %26 = getelementptr inbounds i8, ptr %24, i64 4
  %27 = load float, ptr %26, align 4, !tbaa !18
  %28 = getelementptr inbounds [4 x float], ptr @__const.simulation.xor_outputs, i64 0, i64 %23
  %29 = load float, ptr %28, align 4, !tbaa !18
  %30 = load ptr, ptr %6, align 8, !tbaa !20
  %31 = getelementptr inbounds i8, ptr %30, i64 16
  %32 = load ptr, ptr %31, align 8, !tbaa !21
  %33 = getelementptr inbounds i8, ptr %30, i64 4
  %34 = load i32, ptr %33, align 4, !tbaa !22
  %35 = mul nsw i32 %34, %.0
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds float, ptr %32, i64 %36
  store float %25, ptr %37, align 4, !tbaa !18
  %38 = load ptr, ptr %31, align 8, !tbaa !21
  %39 = getelementptr float, ptr %38, i64 %36
  %40 = getelementptr i8, ptr %39, i64 4
  store float %27, ptr %40, align 4, !tbaa !18
  %41 = load ptr, ptr %7, align 8, !tbaa !24
  %42 = getelementptr inbounds i8, ptr %41, i64 16
  %43 = load ptr, ptr %42, align 8, !tbaa !21
  %44 = getelementptr inbounds i8, ptr %41, i64 4
  %45 = load i32, ptr %44, align 4, !tbaa !22
  %46 = mul nsw i32 %45, %.0
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds float, ptr %43, i64 %47
  store float %29, ptr %48, align 4, !tbaa !18
  %49 = add nsw i32 %.0, 1
  %50 = load i32, ptr %0, align 8, !tbaa !16
  %51 = icmp eq i32 %49, %50
  br i1 %51, label %52, label %._crit_edge

._crit_edge:                                      ; preds = %20
  %.pre = load i32, ptr @iter, align 4, !tbaa !15
  br label %61

52:                                               ; preds = %20
  %53 = tail call i64 @clock() #4
  tail call void @set_data_async(ptr noundef nonnull %8, ptr noundef nonnull %5) #4
  %54 = tail call i64 @clock() #4
  %55 = sub nsw i64 %54, %53
  %56 = sitofp i64 %55 to float
  %57 = fdiv float %56, 1.000000e+06
  %58 = fadd float %.043, %57
  %59 = load i32, ptr @iter, align 4, !tbaa !15
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr @iter, align 4, !tbaa !15
  %.pre48 = load i32, ptr %0, align 8, !tbaa !16
  br label %61

61:                                               ; preds = %._crit_edge, %52
  %62 = phi i32 [ %.pre48, %52 ], [ %50, %._crit_edge ]
  %63 = phi i32 [ %60, %52 ], [ %.pre, %._crit_edge ]
  %.144 = phi float [ %58, %52 ], [ %.043, %._crit_edge ]
  %.1 = phi i32 [ 0, %52 ], [ %49, %._crit_edge ]
  %64 = load i32, ptr @num_samples, align 4, !tbaa !15
  %65 = sdiv i32 %64, %62
  %66 = icmp eq i32 %63, %65
  br i1 %66, label %67, label %9, !llvm.loop !25

67:                                               ; preds = %61
  tail call void @wait_for_draining_pipeline(ptr noundef nonnull %5) #4
  %68 = getelementptr inbounds i8, ptr %0, i64 748
  %69 = load atomic i32, ptr %68 seq_cst, align 4, !tbaa !27
  %70 = sitofp i32 %69 to float
  %71 = load i32, ptr @iter, align 4, !tbaa !15
  %72 = load i32, ptr %0, align 8, !tbaa !16
  %73 = sdiv i32 20000, %72
  %74 = sub nsw i32 %71, %73
  %75 = mul nsw i32 %74, %72
  %76 = sitofp i32 %75 to float
  %77 = fdiv float %70, %76
  %78 = fpext float %77 to double
  %79 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %78)
  br label %.loopexit

.loopexit:                                        ; preds = %9, %67
  %.2 = phi float [ %.144, %67 ], [ %.043, %9 ]
  %80 = fpext float %.2 to double
  %81 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %80)
  %82 = load float, ptr @timing_sum, align 4, !tbaa !18
  %83 = fadd float %.2, %82
  store float %83, ptr @timing_sum, align 4, !tbaa !18
  %84 = getelementptr inbounds i8, ptr %0, i64 748
  %85 = load atomic i32, ptr %84 seq_cst, align 4, !tbaa !27
  %86 = sitofp i32 %85 to float
  %87 = load i32, ptr @iter, align 4, !tbaa !15
  %88 = load i32, ptr %0, align 8, !tbaa !16
  %89 = sdiv i32 20000, %88
  %90 = sub nsw i32 %87, %89
  %91 = mul nsw i32 %90, %88
  %92 = sitofp i32 %91 to float
  %93 = fdiv float %86, %92
  ret float %93
}

declare void @set_random_weights(ptr noundef, i64) local_unnamed_addr #1

declare void @wait_for_draining_pipeline(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #2

; Function Attrs: nounwind
declare i64 @clock() local_unnamed_addr #2

declare void @set_data_async(ptr noundef, ptr noundef) local_unnamed_addr #1

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

attributes #0 = { 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 #1 = { "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 #2 = { 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 #3 = { 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 #4 = { 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 24}
!6 = !{!"xor_net", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !11, i64 40, !12, i64 72, !14, i64 744}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"model_data", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!12 = !{!"model_multithreading", !8, i64 0, !8, i64 512, !8, i64 640, !8, i64 644, !8, i64 648, !13, i64 656, !10, i64 664}
!13 = !{!"long", !8, i64 0}
!14 = !{!"model_state", !8, i64 0, !8, i64 4}
!15 = !{!7, !7, i64 0}
!16 = !{!6, !7, i64 0}
!17 = !{!6, !8, i64 744}
!18 = !{!19, !19, i64 0}
!19 = !{!"float", !8, i64 0}
!20 = !{!6, !10, i64 56}
!21 = !{!8, !8, i64 0}
!22 = !{!23, !7, i64 4}
!23 = !{!"matrix", !7, i64 0, !7, i64 4, !7, i64 8, !8, i64 16}
!24 = !{!6, !10, i64 64}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = !{!6, !8, i64 748}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass