; LLVM IR from hans-ob1/neural_cam_ros :: src/detector (connected_layer)

; 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.layer = type { i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, float, float, float, float, float, float, float, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, float, float, float, i32, float, float, float, float, float, float, float, i32, i32, float, i32, i32, i32, i32, float, float, float, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64 }
%struct.network_state = type { ptr, ptr, ptr, ptr, i32, i32, %struct.network }
%struct.network = type { ptr, i32, i32, ptr, float, i32, float, float, ptr, i32, ptr, i32, float, float, float, float, i32, i32, i32, ptr, ptr, i32, i32, i32, float, float, float, i32, i32, i32, i32, i32, i32, float, float, float, float, float, i32, ptr }

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [51 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @make_connected_layer(ptr dead_on_unwind noalias writable sret(%struct.layer) align 8 %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5) #0 {
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca float, align 4
  store i32 %1, ptr %7, align 4, !tbaa !5
  store i32 %2, ptr %8, align 4, !tbaa !5
  store i32 %3, ptr %9, align 4, !tbaa !5
  store i32 %4, ptr %10, align 4, !tbaa !5
  store i32 %5, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  call void @llvm.memset.p0.i64(ptr align 8 %0, i8 0, i64 808, i1 false)
  %14 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 0
  store i32 2, ptr %14, align 8, !tbaa !9
  %15 = load i32, ptr %8, align 4, !tbaa !5
  %16 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 14
  store i32 %15, ptr %16, align 4, !tbaa !14
  %17 = load i32, ptr %9, align 4, !tbaa !5
  %18 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 15
  store i32 %17, ptr %18, align 8, !tbaa !15
  %19 = load i32, ptr %7, align 4, !tbaa !5
  %20 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 11
  store i32 %19, ptr %20, align 8, !tbaa !16
  %21 = load i32, ptr %11, align 4, !tbaa !5
  %22 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 9
  store i32 %21, ptr %22, align 8, !tbaa !17
  %23 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 17
  store i32 1, ptr %23, align 8, !tbaa !18
  %24 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 18
  store i32 1, ptr %24, align 4, !tbaa !19
  %25 = load i32, ptr %8, align 4, !tbaa !5
  %26 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 19
  store i32 %25, ptr %26, align 8, !tbaa !20
  %27 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 20
  store i32 1, ptr %27, align 4, !tbaa !21
  %28 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 21
  store i32 1, ptr %28, align 8, !tbaa !22
  %29 = load i32, ptr %9, align 4, !tbaa !5
  %30 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 22
  store i32 %29, ptr %30, align 4, !tbaa !23
  %31 = load i32, ptr %7, align 4, !tbaa !5
  %32 = load i32, ptr %9, align 4, !tbaa !5
  %33 = mul nsw i32 %31, %32
  %34 = sext i32 %33 to i64
  %35 = call noalias ptr @calloc(i64 noundef %34, i64 noundef 4) #7
  %36 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 101
  store ptr %35, ptr %36, align 8, !tbaa !24
  %37 = load i32, ptr %7, align 4, !tbaa !5
  %38 = load i32, ptr %9, align 4, !tbaa !5
  %39 = mul nsw i32 %37, %38
  %40 = sext i32 %39 to i64
  %41 = call noalias ptr @calloc(i64 noundef %40, i64 noundef 4) #7
  %42 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 100
  store ptr %41, ptr %42, align 8, !tbaa !25
  %43 = load i32, ptr %8, align 4, !tbaa !5
  %44 = load i32, ptr %9, align 4, !tbaa !5
  %45 = mul nsw i32 %43, %44
  %46 = sext i32 %45 to i64
  %47 = call noalias ptr @calloc(i64 noundef %46, i64 noundef 4) #7
  %48 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 98
  store ptr %47, ptr %48, align 8, !tbaa !26
  %49 = load i32, ptr %9, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = call noalias ptr @calloc(i64 noundef %50, i64 noundef 4) #7
  %52 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 94
  store ptr %51, ptr %52, align 8, !tbaa !27
  %53 = load i32, ptr %9, align 4, !tbaa !5
  %54 = load i32, ptr %8, align 4, !tbaa !5
  %55 = mul nsw i32 %53, %54
  %56 = sext i32 %55 to i64
  %57 = call noalias ptr @calloc(i64 noundef %56, i64 noundef 4) #7
  %58 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 97
  store ptr %57, ptr %58, align 8, !tbaa !28
  %59 = load i32, ptr %9, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = call noalias ptr @calloc(i64 noundef %60, i64 noundef 4) #7
  %62 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 93
  store ptr %61, ptr %62, align 8, !tbaa !29
  %63 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 3
  store ptr @forward_connected_layer, ptr %63, align 8, !tbaa !30
  %64 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 4
  store ptr @backward_connected_layer, ptr %64, align 8, !tbaa !31
  %65 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 5
  store ptr @update_connected_layer, ptr %65, align 8, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %66 = load i32, ptr %8, align 4, !tbaa !5
  %67 = sitofp i32 %66 to double
  %68 = fdiv double 2.000000e+00, %67
  %69 = call double @sqrt(double noundef %68) #6
  %70 = fptrunc double %69 to float
  store float %70, ptr %13, align 4, !tbaa !33
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %71

71:                                               ; preds = %86, %6
  %72 = load i32, ptr %12, align 4, !tbaa !5
  %73 = load i32, ptr %9, align 4, !tbaa !5
  %74 = load i32, ptr %8, align 4, !tbaa !5
  %75 = mul nsw i32 %73, %74
  %76 = icmp slt i32 %72, %75
  br i1 %76, label %77, label %89

77:                                               ; preds = %71
  %78 = load float, ptr %13, align 4, !tbaa !33
  %79 = call float @rand_uniform(float noundef -1.000000e+00, float noundef 1.000000e+00)
  %80 = fmul float %78, %79
  %81 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 97
  %82 = load ptr, ptr %81, align 8, !tbaa !28
  %83 = load i32, ptr %12, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds float, ptr %82, i64 %84
  store float %80, ptr %85, align 4, !tbaa !33
  br label %86

86:                                               ; preds = %77
  %87 = load i32, ptr %12, align 4, !tbaa !5
  %88 = add nsw i32 %87, 1
  store i32 %88, ptr %12, align 4, !tbaa !5
  br label %71, !llvm.loop !34

89:                                               ; preds = %71
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %90

90:                                               ; preds = %100, %89
  %91 = load i32, ptr %12, align 4, !tbaa !5
  %92 = load i32, ptr %9, align 4, !tbaa !5
  %93 = icmp slt i32 %91, %92
  br i1 %93, label %94, label %103

94:                                               ; preds = %90
  %95 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 93
  %96 = load ptr, ptr %95, align 8, !tbaa !29
  %97 = load i32, ptr %12, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds float, ptr %96, i64 %98
  store float 0.000000e+00, ptr %99, align 4, !tbaa !33
  br label %100

100:                                              ; preds = %94
  %101 = load i32, ptr %12, align 4, !tbaa !5
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %12, align 4, !tbaa !5
  br label %90, !llvm.loop !36

103:                                              ; preds = %90
  %104 = load i32, ptr %11, align 4, !tbaa !5
  %105 = icmp ne i32 %104, 0
  br i1 %105, label %106, label %165

106:                                              ; preds = %103
  %107 = load i32, ptr %9, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = call noalias ptr @calloc(i64 noundef %108, i64 noundef 4) #7
  %110 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 95
  store ptr %109, ptr %110, align 8, !tbaa !37
  %111 = load i32, ptr %9, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = call noalias ptr @calloc(i64 noundef %112, i64 noundef 4) #7
  %114 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 96
  store ptr %113, ptr %114, align 8, !tbaa !38
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %115

115:                                              ; preds = %125, %106
  %116 = load i32, ptr %12, align 4, !tbaa !5
  %117 = load i32, ptr %9, align 4, !tbaa !5
  %118 = icmp slt i32 %116, %117
  br i1 %118, label %119, label %128

119:                                              ; preds = %115
  %120 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 95
  %121 = load ptr, ptr %120, align 8, !tbaa !37
  %122 = load i32, ptr %12, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds float, ptr %121, i64 %123
  store float 1.000000e+00, ptr %124, align 4, !tbaa !33
  br label %125

125:                                              ; preds = %119
  %126 = load i32, ptr %12, align 4, !tbaa !5
  %127 = add nsw i32 %126, 1
  store i32 %127, ptr %12, align 4, !tbaa !5
  br label %115, !llvm.loop !39

128:                                              ; preds = %115
  %129 = load i32, ptr %9, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = call noalias ptr @calloc(i64 noundef %130, i64 noundef 4) #7
  %132 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 105
  store ptr %131, ptr %132, align 8, !tbaa !40
  %133 = load i32, ptr %9, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = call noalias ptr @calloc(i64 noundef %134, i64 noundef 4) #7
  %136 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 107
  store ptr %135, ptr %136, align 8, !tbaa !41
  %137 = load i32, ptr %9, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = call noalias ptr @calloc(i64 noundef %138, i64 noundef 4) #7
  %140 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 106
  store ptr %139, ptr %140, align 8, !tbaa !42
  %141 = load i32, ptr %9, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = call noalias ptr @calloc(i64 noundef %142, i64 noundef 4) #7
  %144 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 108
  store ptr %143, ptr %144, align 8, !tbaa !43
  %145 = load i32, ptr %9, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = call noalias ptr @calloc(i64 noundef %146, i64 noundef 4) #7
  %148 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 109
  store ptr %147, ptr %148, align 8, !tbaa !44
  %149 = load i32, ptr %9, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = call noalias ptr @calloc(i64 noundef %150, i64 noundef 4) #7
  %152 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 110
  store ptr %151, ptr %152, align 8, !tbaa !45
  %153 = load i32, ptr %7, align 4, !tbaa !5
  %154 = load i32, ptr %9, align 4, !tbaa !5
  %155 = mul nsw i32 %153, %154
  %156 = sext i32 %155 to i64
  %157 = call noalias ptr @calloc(i64 noundef %156, i64 noundef 4) #7
  %158 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 111
  store ptr %157, ptr %158, align 8, !tbaa !46
  %159 = load i32, ptr %7, align 4, !tbaa !5
  %160 = load i32, ptr %9, align 4, !tbaa !5
  %161 = mul nsw i32 %159, %160
  %162 = sext i32 %161 to i64
  %163 = call noalias ptr @calloc(i64 noundef %162, i64 noundef 4) #7
  %164 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 112
  store ptr %163, ptr %164, align 8, !tbaa !47
  br label %165

165:                                              ; preds = %128, %103
  %166 = load i32, ptr %10, align 4, !tbaa !5
  %167 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 1
  store i32 %166, ptr %167, align 4, !tbaa !48
  %168 = load ptr, ptr @stderr, align 8, !tbaa !49
  %169 = load i32, ptr %8, align 4, !tbaa !5
  %170 = load i32, ptr %9, align 4, !tbaa !5
  %171 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %168, ptr noundef @.str, i32 noundef %169, i32 noundef %170) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  ret void
}

; 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local void @forward_connected_layer(ptr noundef byval(%struct.layer) align 8, ptr noundef byval(%struct.network_state) align 8) #0

; Function Attrs: nounwind uwtable
declare dso_local void @backward_connected_layer(ptr noundef byval(%struct.layer) align 8, ptr noundef byval(%struct.network_state) align 8) #0

; Function Attrs: nounwind uwtable
declare dso_local void @update_connected_layer(ptr noundef byval(%struct.layer) align 8, i32 noundef, float noundef, float noundef, float noundef) #0

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

declare float @rand_uniform(float noundef, float noundef) #5

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

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nounwind allocsize(0,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 #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 = { "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 #6 = { nounwind }
attributes #7 = { nounwind allocsize(0,1) }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"layer", !6, i64 0, !6, i64 4, !6, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !6, i64 64, !6, i64 68, !6, i64 72, !6, i64 76, !6, i64 80, !6, i64 84, !6, i64 88, !6, i64 92, !6, i64 96, !6, i64 100, !6, i64 104, !6, i64 108, !6, i64 112, !6, i64 116, !6, i64 120, !6, i64 124, !6, i64 128, !6, i64 132, !6, i64 136, !6, i64 140, !6, i64 144, !6, i64 148, !6, i64 152, !6, i64 156, !6, i64 160, !6, i64 164, !6, i64 168, !6, i64 172, !6, i64 176, !12, i64 180, !12, i64 184, !12, i64 188, !12, i64 192, !12, i64 196, !12, i64 200, !12, i64 204, !6, i64 208, !6, i64 212, !6, i64 216, !6, i64 220, !6, i64 224, !6, i64 228, !6, i64 232, !6, i64 236, !6, i64 240, !6, i64 244, !6, i64 248, !6, i64 252, !12, i64 256, !12, i64 260, !12, i64 264, !6, i64 268, !12, i64 272, !12, i64 276, !12, i64 280, !12, i64 284, !12, i64 288, !12, i64 292, !12, i64 296, !6, i64 300, !6, i64 304, !12, i64 308, !6, i64 312, !6, i64 316, !6, i64 320, !6, i64 324, !12, i64 328, !12, i64 332, !12, i64 336, !11, i64 344, !11, i64 352, !11, i64 360, !11, i64 368, !11, i64 376, !11, i64 384, !11, i64 392, !11, i64 400, !11, i64 408, !11, i64 416, !11, i64 424, !11, i64 432, !11, i64 440, !11, i64 448, !11, i64 456, !11, i64 464, !11, i64 472, !11, i64 480, !11, i64 488, !11, i64 496, !11, i64 504, !11, i64 512, !11, i64 520, !11, i64 528, !11, i64 536, !11, i64 544, !11, i64 552, !11, i64 560, !11, i64 568, !11, i64 576, !11, i64 584, !11, i64 592, !11, i64 600, !11, i64 608, !11, i64 616, !11, i64 624, !11, i64 632, !11, i64 640, !11, i64 648, !11, i64 656, !11, i64 664, !11, i64 672, !11, i64 680, !11, i64 688, !11, i64 696, !11, i64 704, !11, i64 712, !11, i64 720, !11, i64 728, !11, i64 736, !11, i64 744, !11, i64 752, !11, i64 760, !11, i64 768, !11, i64 776, !11, i64 784, !11, i64 792, !13, i64 800}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!10, !6, i64 84}
!15 = !{!10, !6, i64 88}
!16 = !{!10, !6, i64 72}
!17 = !{!10, !6, i64 64}
!18 = !{!10, !6, i64 96}
!19 = !{!10, !6, i64 100}
!20 = !{!10, !6, i64 104}
!21 = !{!10, !6, i64 108}
!22 = !{!10, !6, i64 112}
!23 = !{!10, !6, i64 116}
!24 = !{!10, !11, i64 528}
!25 = !{!10, !11, i64 520}
!26 = !{!10, !11, i64 504}
!27 = !{!10, !11, i64 472}
!28 = !{!10, !11, i64 496}
!29 = !{!10, !11, i64 464}
!30 = !{!10, !11, i64 16}
!31 = !{!10, !11, i64 24}
!32 = !{!10, !11, i64 32}
!33 = !{!12, !12, i64 0}
!34 = distinct !{!34, !35}
!35 = !{!"llvm.loop.mustprogress"}
!36 = distinct !{!36, !35}
!37 = !{!10, !11, i64 480}
!38 = !{!10, !11, i64 488}
!39 = distinct !{!39, !35}
!40 = !{!10, !11, i64 560}
!41 = !{!10, !11, i64 576}
!42 = !{!10, !11, i64 568}
!43 = !{!10, !11, i64 584}
!44 = !{!10, !11, i64 592}
!45 = !{!10, !11, i64 600}
!46 = !{!10, !11, i64 608}
!47 = !{!10, !11, i64 616}
!48 = !{!10, !6, i64 4}
!49 = !{!11, !11, i64 0}


; 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.layer = type { i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, float, float, float, float, float, float, float, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, float, float, float, i32, float, float, float, float, float, float, float, i32, i32, float, i32, i32, i32, i32, float, float, float, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64 }
%struct.network_state = type { ptr, ptr, ptr, ptr, i32, i32, %struct.network }
%struct.network = type { ptr, i32, i32, ptr, float, i32, float, float, ptr, i32, ptr, i32, float, float, float, float, i32, i32, i32, ptr, ptr, i32, i32, i32, float, float, float, i32, i32, i32, i32, i32, i32, float, float, float, float, float, i32, ptr }

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

; Function Attrs: nounwind uwtable
define dso_local void @make_connected_layer(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.layer) align 8 %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5) local_unnamed_addr #0 {
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(808) %0, i8 0, i64 808, i1 false)
  store i32 2, ptr %0, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 84
  store i32 %2, ptr %7, align 4, !tbaa !13
  %8 = getelementptr inbounds i8, ptr %0, i64 88
  store i32 %3, ptr %8, align 8, !tbaa !14
  %9 = getelementptr inbounds i8, ptr %0, i64 72
  store i32 %1, ptr %9, align 8, !tbaa !15
  %10 = getelementptr inbounds i8, ptr %0, i64 64
  store i32 %5, ptr %10, align 8, !tbaa !16
  %11 = getelementptr inbounds i8, ptr %0, i64 96
  store i32 1, ptr %11, align 8, !tbaa !17
  %12 = getelementptr inbounds i8, ptr %0, i64 100
  store i32 1, ptr %12, align 4, !tbaa !18
  %13 = getelementptr inbounds i8, ptr %0, i64 104
  store i32 %2, ptr %13, align 8, !tbaa !19
  %14 = getelementptr inbounds i8, ptr %0, i64 108
  store i32 1, ptr %14, align 4, !tbaa !20
  %15 = getelementptr inbounds i8, ptr %0, i64 112
  store i32 1, ptr %15, align 8, !tbaa !21
  %16 = getelementptr inbounds i8, ptr %0, i64 116
  store i32 %3, ptr %16, align 4, !tbaa !22
  %17 = mul nsw i32 %3, %1
  %18 = sext i32 %17 to i64
  %19 = tail call noalias ptr @calloc(i64 noundef %18, i64 noundef 4) #6
  %20 = getelementptr inbounds i8, ptr %0, i64 528
  store ptr %19, ptr %20, align 8, !tbaa !23
  %21 = tail call noalias ptr @calloc(i64 noundef %18, i64 noundef 4) #6
  %22 = getelementptr inbounds i8, ptr %0, i64 520
  store ptr %21, ptr %22, align 8, !tbaa !24
  %23 = mul nsw i32 %3, %2
  %24 = sext i32 %23 to i64
  %25 = tail call noalias ptr @calloc(i64 noundef %24, i64 noundef 4) #6
  %26 = getelementptr inbounds i8, ptr %0, i64 504
  store ptr %25, ptr %26, align 8, !tbaa !25
  %27 = sext i32 %3 to i64
  %28 = tail call noalias ptr @calloc(i64 noundef %27, i64 noundef 4) #6
  %29 = getelementptr inbounds i8, ptr %0, i64 472
  store ptr %28, ptr %29, align 8, !tbaa !26
  %30 = tail call noalias ptr @calloc(i64 noundef %24, i64 noundef 4) #6
  %31 = getelementptr inbounds i8, ptr %0, i64 496
  store ptr %30, ptr %31, align 8, !tbaa !27
  %32 = tail call noalias ptr @calloc(i64 noundef %27, i64 noundef 4) #6
  %33 = getelementptr inbounds i8, ptr %0, i64 464
  store ptr %32, ptr %33, align 8, !tbaa !28
  %34 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr @forward_connected_layer, ptr %34, align 8, !tbaa !29
  %35 = getelementptr inbounds i8, ptr %0, i64 24
  store ptr @backward_connected_layer, ptr %35, align 8, !tbaa !30
  %36 = getelementptr inbounds i8, ptr %0, i64 32
  store ptr @update_connected_layer, ptr %36, align 8, !tbaa !31
  %37 = sitofp i32 %2 to double
  %38 = fdiv double 2.000000e+00, %37
  %39 = tail call double @sqrt(double noundef %38) #7
  %40 = fptrunc double %39 to float
  %41 = icmp sgt i32 %23, 0
  br i1 %41, label %.lr.ph.preheader, label %.preheader

.lr.ph.preheader:                                 ; preds = %6
  %wide.trip.count = zext nneg i32 %23 to i64
  br label %.lr.ph

.preheader:                                       ; preds = %.lr.ph, %6
  %42 = icmp sgt i32 %3, 0
  br i1 %42, label %.lr.ph49.preheader, label %._crit_edge

.lr.ph49.preheader:                               ; preds = %.preheader
  %43 = zext nneg i32 %3 to i64
  %44 = shl nuw nsw i64 %43, 2
  tail call void @llvm.memset.p0.i64(ptr align 4 %32, i8 0, i64 %44, i1 false), !tbaa !32
  br label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %45 = tail call float @rand_uniform(float noundef -1.000000e+00, float noundef 1.000000e+00) #7
  %46 = fmul float %45, %40
  %47 = getelementptr inbounds float, ptr %30, i64 %indvars.iv
  store float %46, ptr %47, align 4, !tbaa !32
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader, label %.lr.ph, !llvm.loop !33

._crit_edge:                                      ; preds = %.lr.ph49.preheader, %.preheader
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %73, label %48

48:                                               ; preds = %._crit_edge
  %49 = tail call noalias ptr @calloc(i64 noundef %27, i64 noundef 4) #6
  %50 = getelementptr inbounds i8, ptr %0, i64 480
  store ptr %49, ptr %50, align 8, !tbaa !35
  %51 = tail call noalias ptr @calloc(i64 noundef %27, i64 noundef 4) #6
  %52 = getelementptr inbounds i8, ptr %0, i64 488
  store ptr %51, ptr %52, align 8, !tbaa !36
  br i1 %42, label %.lr.ph52.preheader, label %._crit_edge53

.lr.ph52.preheader:                               ; preds = %48
  %wide.trip.count61 = zext nneg i32 %3 to i64
  %min.iters.check = icmp ult i32 %3, 8
  br i1 %min.iters.check, label %.lr.ph52.preheader63, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph52.preheader
  %n.vec = and i64 %wide.trip.count61, 2147483640
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %53 = getelementptr inbounds float, ptr %49, i64 %index
  %54 = getelementptr inbounds i8, ptr %53, i64 16
  store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, ptr %53, align 4, !tbaa !32
  store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, ptr %54, align 4, !tbaa !32
  %index.next = add nuw i64 %index, 8
  %55 = icmp eq i64 %index.next, %n.vec
  br i1 %55, label %middle.block, label %vector.body, !llvm.loop !37

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count61
  br i1 %cmp.n, label %._crit_edge53, label %.lr.ph52.preheader63

.lr.ph52.preheader63:                             ; preds = %middle.block, %.lr.ph52.preheader
  %indvars.iv58.ph = phi i64 [ 0, %.lr.ph52.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph52

.lr.ph52:                                         ; preds = %.lr.ph52.preheader63, %.lr.ph52
  %indvars.iv58 = phi i64 [ %indvars.iv.next59, %.lr.ph52 ], [ %indvars.iv58.ph, %.lr.ph52.preheader63 ]
  %56 = getelementptr inbounds float, ptr %49, i64 %indvars.iv58
  store float 1.000000e+00, ptr %56, align 4, !tbaa !32
  %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
  %exitcond62.not = icmp eq i64 %indvars.iv.next59, %wide.trip.count61
  br i1 %exitcond62.not, label %._crit_edge53, label %.lr.ph52, !llvm.loop !40

._crit_edge53:                                    ; preds = %.lr.ph52, %middle.block, %48
  %57 = tail call noalias ptr @calloc(i64 noundef %27, i64 noundef 4) #6
  %58 = getelementptr inbounds i8, ptr %0, i64 560
  store ptr %57, ptr %58, align 8, !tbaa !41
  %59 = tail call noalias ptr @calloc(i64 noundef %27, i64 noundef 4) #6
  %60 = getelementptr inbounds i8, ptr %0, i64 576
  store ptr %59, ptr %60, align 8, !tbaa !42
  %61 = tail call noalias ptr @calloc(i64 noundef %27, i64 noundef 4) #6
  %62 = getelementptr inbounds i8, ptr %0, i64 568
  store ptr %61, ptr %62, align 8, !tbaa !43
  %63 = tail call noalias ptr @calloc(i64 noundef %27, i64 noundef 4) #6
  %64 = getelementptr inbounds i8, ptr %0, i64 584
  store ptr %63, ptr %64, align 8, !tbaa !44
  %65 = tail call noalias ptr @calloc(i64 noundef %27, i64 noundef 4) #6
  %66 = getelementptr inbounds i8, ptr %0, i64 592
  store ptr %65, ptr %66, align 8, !tbaa !45
  %67 = tail call noalias ptr @calloc(i64 noundef %27, i64 noundef 4) #6
  %68 = getelementptr inbounds i8, ptr %0, i64 600
  store ptr %67, ptr %68, align 8, !tbaa !46
  %69 = tail call noalias ptr @calloc(i64 noundef %18, i64 noundef 4) #6
  %70 = getelementptr inbounds i8, ptr %0, i64 608
  store ptr %69, ptr %70, align 8, !tbaa !47
  %71 = tail call noalias ptr @calloc(i64 noundef %18, i64 noundef 4) #6
  %72 = getelementptr inbounds i8, ptr %0, i64 616
  store ptr %71, ptr %72, align 8, !tbaa !48
  br label %73

73:                                               ; preds = %._crit_edge53, %._crit_edge
  %74 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 %4, ptr %74, align 4, !tbaa !49
  %75 = load ptr, ptr @stderr, align 8, !tbaa !50
  %76 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %75, ptr noundef nonnull @.str, i32 noundef %2, i32 noundef %3) #8
  ret void
}

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @forward_connected_layer(ptr noundef byval(%struct.layer) align 8, ptr noundef byval(%struct.network_state) align 8) #0

; Function Attrs: nounwind uwtable
declare dso_local void @backward_connected_layer(ptr noundef byval(%struct.layer) align 8, ptr noundef byval(%struct.network_state) align 8) #0

; Function Attrs: nounwind uwtable
declare dso_local void @update_connected_layer(ptr noundef byval(%struct.layer) align 8, i32 noundef, float noundef, float noundef, float noundef) #0

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

declare float @rand_uniform(float noundef, float noundef) local_unnamed_addr #4

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

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) 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 #3 = { 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 #4 = { "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 = { 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 #6 = { nounwind allocsize(0,1) }
attributes #7 = { nounwind }
attributes #8 = { 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 = !{!"layer", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !7, i64 64, !7, i64 68, !7, i64 72, !7, i64 76, !7, i64 80, !7, i64 84, !7, i64 88, !7, i64 92, !7, i64 96, !7, i64 100, !7, i64 104, !7, i64 108, !7, i64 112, !7, i64 116, !7, i64 120, !7, i64 124, !7, i64 128, !7, i64 132, !7, i64 136, !7, i64 140, !7, i64 144, !7, i64 148, !7, i64 152, !7, i64 156, !7, i64 160, !7, i64 164, !7, i64 168, !7, i64 172, !7, i64 176, !11, i64 180, !11, i64 184, !11, i64 188, !11, i64 192, !11, i64 196, !11, i64 200, !11, i64 204, !7, i64 208, !7, i64 212, !7, i64 216, !7, i64 220, !7, i64 224, !7, i64 228, !7, i64 232, !7, i64 236, !7, i64 240, !7, i64 244, !7, i64 248, !7, i64 252, !11, i64 256, !11, i64 260, !11, i64 264, !7, i64 268, !11, i64 272, !11, i64 276, !11, i64 280, !11, i64 284, !11, i64 288, !11, i64 292, !11, i64 296, !7, i64 300, !7, i64 304, !11, i64 308, !7, i64 312, !7, i64 316, !7, i64 320, !7, i64 324, !11, i64 328, !11, i64 332, !11, i64 336, !10, i64 344, !10, i64 352, !10, i64 360, !10, i64 368, !10, i64 376, !10, i64 384, !10, i64 392, !10, i64 400, !10, i64 408, !10, i64 416, !10, i64 424, !10, i64 432, !10, i64 440, !10, i64 448, !10, i64 456, !10, i64 464, !10, i64 472, !10, i64 480, !10, i64 488, !10, i64 496, !10, i64 504, !10, i64 512, !10, i64 520, !10, i64 528, !10, i64 536, !10, i64 544, !10, i64 552, !10, i64 560, !10, i64 568, !10, i64 576, !10, i64 584, !10, i64 592, !10, i64 600, !10, i64 608, !10, i64 616, !10, i64 624, !10, i64 632, !10, i64 640, !10, i64 648, !10, i64 656, !10, i64 664, !10, i64 672, !10, i64 680, !10, i64 688, !10, i64 696, !10, i64 704, !10, i64 712, !10, i64 720, !10, i64 728, !10, i64 736, !10, i64 744, !10, i64 752, !10, i64 760, !10, i64 768, !10, i64 776, !10, i64 784, !10, i64 792, !12, i64 800}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!"long", !8, i64 0}
!13 = !{!6, !7, i64 84}
!14 = !{!6, !7, i64 88}
!15 = !{!6, !7, i64 72}
!16 = !{!6, !7, i64 64}
!17 = !{!6, !7, i64 96}
!18 = !{!6, !7, i64 100}
!19 = !{!6, !7, i64 104}
!20 = !{!6, !7, i64 108}
!21 = !{!6, !7, i64 112}
!22 = !{!6, !7, i64 116}
!23 = !{!6, !10, i64 528}
!24 = !{!6, !10, i64 520}
!25 = !{!6, !10, i64 504}
!26 = !{!6, !10, i64 472}
!27 = !{!6, !10, i64 496}
!28 = !{!6, !10, i64 464}
!29 = !{!6, !10, i64 16}
!30 = !{!6, !10, i64 24}
!31 = !{!6, !10, i64 32}
!32 = !{!11, !11, i64 0}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = !{!6, !10, i64 480}
!36 = !{!6, !10, i64 488}
!37 = distinct !{!37, !34, !38, !39}
!38 = !{!"llvm.loop.isvectorized", i32 1}
!39 = !{!"llvm.loop.unroll.runtime.disable"}
!40 = distinct !{!40, !34, !39, !38}
!41 = !{!6, !10, i64 560}
!42 = !{!6, !10, i64 576}
!43 = !{!6, !10, i64 568}
!44 = !{!6, !10, i64 584}
!45 = !{!6, !10, i64 592}
!46 = !{!6, !10, i64 600}
!47 = !{!6, !10, i64 608}
!48 = !{!6, !10, i64 616}
!49 = !{!6, !7, i64 4}
!50 = !{!10, !10, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopIdiomRecognizePass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass