; LLVM IR from hans-ob1/neural_cam_ros :: src/detector (convolutional_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 }

; 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
declare dso_local i32 @convolutional_out_height(ptr noundef byval(%struct.layer) align 8) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @convolutional_out_width(ptr noundef byval(%struct.layer) align 8) #1

; Function Attrs: nounwind uwtable
define dso_local void @backward_convolutional_layer(ptr noundef byval(%struct.layer) align 8 %0, ptr noundef byval(%struct.network_state) align 8 %1) #1 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %11 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 23
  %12 = load i32, ptr %11, align 8, !tbaa !5
  store i32 %12, ptr %4, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %13 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 26
  %14 = load i32, ptr %13, align 4, !tbaa !14
  %15 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 26
  %16 = load i32, ptr %15, align 4, !tbaa !14
  %17 = mul nsw i32 %14, %16
  %18 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 19
  %19 = load i32, ptr %18, align 8, !tbaa !15
  %20 = mul nsw i32 %17, %19
  store i32 %20, ptr %5, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %21 = call i32 @convolutional_out_height(ptr noundef byval(%struct.layer) align 8 %0)
  %22 = call i32 @convolutional_out_width(ptr noundef byval(%struct.layer) align 8 %0)
  %23 = mul nsw i32 %21, %22
  store i32 %23, ptr %6, align 4, !tbaa !13
  %24 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 101
  %25 = load ptr, ptr %24, align 8, !tbaa !16
  %26 = load i32, ptr %4, align 4, !tbaa !13
  %27 = load i32, ptr %6, align 4, !tbaa !13
  %28 = mul nsw i32 %26, %27
  %29 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 11
  %30 = load i32, ptr %29, align 8, !tbaa !17
  %31 = mul nsw i32 %28, %30
  %32 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 1
  %33 = load i32, ptr %32, align 4, !tbaa !18
  %34 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 100
  %35 = load ptr, ptr %34, align 8, !tbaa !19
  call void @gradient_array(ptr noundef %25, i32 noundef %31, i32 noundef %33, ptr noundef %35)
  %36 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 94
  %37 = load ptr, ptr %36, align 8, !tbaa !20
  %38 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 100
  %39 = load ptr, ptr %38, align 8, !tbaa !19
  %40 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 11
  %41 = load i32, ptr %40, align 8, !tbaa !17
  %42 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 23
  %43 = load i32, ptr %42, align 8, !tbaa !5
  %44 = load i32, ptr %6, align 4, !tbaa !13
  call void @backward_bias(ptr noundef %37, ptr noundef %39, i32 noundef %41, i32 noundef %43, i32 noundef %44)
  %45 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 9
  %46 = load i32, ptr %45, align 8, !tbaa !21
  %47 = icmp ne i32 %46, 0
  br i1 %47, label %48, label %49

48:                                               ; preds = %2
  call void @backward_batchnorm_layer(ptr noundef byval(%struct.layer) align 8 %0, ptr noundef byval(%struct.network_state) align 8 %1)
  br label %49

49:                                               ; preds = %48, %2
  store i32 0, ptr %3, align 4, !tbaa !13
  br label %50

50:                                               ; preds = %161, %49
  %51 = load i32, ptr %3, align 4, !tbaa !13
  %52 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 11
  %53 = load i32, ptr %52, align 8, !tbaa !17
  %54 = icmp slt i32 %51, %53
  br i1 %54, label %55, label %164

55:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %56 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 100
  %57 = load ptr, ptr %56, align 8, !tbaa !19
  %58 = load i32, ptr %3, align 4, !tbaa !13
  %59 = load i32, ptr %4, align 4, !tbaa !13
  %60 = mul nsw i32 %58, %59
  %61 = load i32, ptr %6, align 4, !tbaa !13
  %62 = mul nsw i32 %60, %61
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds float, ptr %57, i64 %63
  store ptr %64, ptr %7, align 8, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %65 = getelementptr inbounds %struct.network_state, ptr %1, i32 0, i32 3
  %66 = load ptr, ptr %65, align 8, !tbaa !23
  store ptr %66, ptr %8, align 8, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %67 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 98
  %68 = load ptr, ptr %67, align 8, !tbaa !26
  store ptr %68, ptr %9, align 8, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %69 = getelementptr inbounds %struct.network_state, ptr %1, i32 0, i32 1
  %70 = load ptr, ptr %69, align 8, !tbaa !27
  %71 = load i32, ptr %3, align 4, !tbaa !13
  %72 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 19
  %73 = load i32, ptr %72, align 8, !tbaa !15
  %74 = mul nsw i32 %71, %73
  %75 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 17
  %76 = load i32, ptr %75, align 8, !tbaa !28
  %77 = mul nsw i32 %74, %76
  %78 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 18
  %79 = load i32, ptr %78, align 4, !tbaa !29
  %80 = mul nsw i32 %77, %79
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds float, ptr %70, i64 %81
  store ptr %82, ptr %10, align 8, !tbaa !22
  %83 = load ptr, ptr %10, align 8, !tbaa !22
  %84 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 19
  %85 = load i32, ptr %84, align 8, !tbaa !15
  %86 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 17
  %87 = load i32, ptr %86, align 8, !tbaa !28
  %88 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 18
  %89 = load i32, ptr %88, align 4, !tbaa !29
  %90 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 26
  %91 = load i32, ptr %90, align 4, !tbaa !14
  %92 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 28
  %93 = load i32, ptr %92, align 4, !tbaa !30
  %94 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 30
  %95 = load i32, ptr %94, align 4, !tbaa !31
  %96 = load ptr, ptr %8, align 8, !tbaa !22
  call void @im2col_cpu(ptr noundef %83, i32 noundef %85, i32 noundef %87, i32 noundef %89, i32 noundef %91, i32 noundef %93, i32 noundef %95, ptr noundef %96)
  %97 = load i32, ptr %4, align 4, !tbaa !13
  %98 = load i32, ptr %5, align 4, !tbaa !13
  %99 = load i32, ptr %6, align 4, !tbaa !13
  %100 = load ptr, ptr %7, align 8, !tbaa !22
  %101 = load i32, ptr %6, align 4, !tbaa !13
  %102 = load ptr, ptr %8, align 8, !tbaa !22
  %103 = load i32, ptr %6, align 4, !tbaa !13
  %104 = load ptr, ptr %9, align 8, !tbaa !22
  %105 = load i32, ptr %5, align 4, !tbaa !13
  call void @gemm(i32 noundef 0, i32 noundef 1, i32 noundef %97, i32 noundef %98, i32 noundef %99, float noundef 1.000000e+00, ptr noundef %100, i32 noundef %101, ptr noundef %102, i32 noundef %103, float noundef 1.000000e+00, ptr noundef %104, i32 noundef %105)
  %106 = getelementptr inbounds %struct.network_state, ptr %1, i32 0, i32 2
  %107 = load ptr, ptr %106, align 8, !tbaa !32
  %108 = icmp ne ptr %107, null
  br i1 %108, label %109, label %160

109:                                              ; preds = %55
  %110 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 97
  %111 = load ptr, ptr %110, align 8, !tbaa !33
  store ptr %111, ptr %7, align 8, !tbaa !22
  %112 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 100
  %113 = load ptr, ptr %112, align 8, !tbaa !19
  %114 = load i32, ptr %3, align 4, !tbaa !13
  %115 = load i32, ptr %4, align 4, !tbaa !13
  %116 = mul nsw i32 %114, %115
  %117 = load i32, ptr %6, align 4, !tbaa !13
  %118 = mul nsw i32 %116, %117
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds float, ptr %113, i64 %119
  store ptr %120, ptr %8, align 8, !tbaa !22
  %121 = getelementptr inbounds %struct.network_state, ptr %1, i32 0, i32 3
  %122 = load ptr, ptr %121, align 8, !tbaa !23
  store ptr %122, ptr %9, align 8, !tbaa !22
  %123 = load i32, ptr %5, align 4, !tbaa !13
  %124 = load i32, ptr %6, align 4, !tbaa !13
  %125 = load i32, ptr %4, align 4, !tbaa !13
  %126 = load ptr, ptr %7, align 8, !tbaa !22
  %127 = load i32, ptr %5, align 4, !tbaa !13
  %128 = load ptr, ptr %8, align 8, !tbaa !22
  %129 = load i32, ptr %6, align 4, !tbaa !13
  %130 = load ptr, ptr %9, align 8, !tbaa !22
  %131 = load i32, ptr %6, align 4, !tbaa !13
  call void @gemm(i32 noundef 1, i32 noundef 0, i32 noundef %123, i32 noundef %124, i32 noundef %125, float noundef 1.000000e+00, ptr noundef %126, i32 noundef %127, ptr noundef %128, i32 noundef %129, float noundef 0.000000e+00, ptr noundef %130, i32 noundef %131)
  %132 = getelementptr inbounds %struct.network_state, ptr %1, i32 0, i32 3
  %133 = load ptr, ptr %132, align 8, !tbaa !23
  %134 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 19
  %135 = load i32, ptr %134, align 8, !tbaa !15
  %136 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 17
  %137 = load i32, ptr %136, align 8, !tbaa !28
  %138 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 18
  %139 = load i32, ptr %138, align 4, !tbaa !29
  %140 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 26
  %141 = load i32, ptr %140, align 4, !tbaa !14
  %142 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 28
  %143 = load i32, ptr %142, align 4, !tbaa !30
  %144 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 30
  %145 = load i32, ptr %144, align 4, !tbaa !31
  %146 = getelementptr inbounds %struct.network_state, ptr %1, i32 0, i32 2
  %147 = load ptr, ptr %146, align 8, !tbaa !32
  %148 = load i32, ptr %3, align 4, !tbaa !13
  %149 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 19
  %150 = load i32, ptr %149, align 8, !tbaa !15
  %151 = mul nsw i32 %148, %150
  %152 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 17
  %153 = load i32, ptr %152, align 8, !tbaa !28
  %154 = mul nsw i32 %151, %153
  %155 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 18
  %156 = load i32, ptr %155, align 4, !tbaa !29
  %157 = mul nsw i32 %154, %156
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds float, ptr %147, i64 %158
  call void @col2im_cpu(ptr noundef %133, i32 noundef %135, i32 noundef %137, i32 noundef %139, i32 noundef %141, i32 noundef %143, i32 noundef %145, ptr noundef %159)
  br label %160

160:                                              ; preds = %109, %55
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  br label %161

161:                                              ; preds = %160
  %162 = load i32, ptr %3, align 4, !tbaa !13
  %163 = add nsw i32 %162, 1
  store i32 %163, ptr %3, align 4, !tbaa !13
  br label %50, !llvm.loop !34

164:                                              ; preds = %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @backward_bias(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef) #1

declare void @im2col_cpu(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) #2

declare void @gemm(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, float noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef, float noundef, ptr noundef, i32 noundef) #2

declare void @gradient_array(ptr noundef, i32 noundef, i32 noundef, ptr noundef) #2

declare void @backward_batchnorm_layer(ptr noundef byval(%struct.layer) align 8, ptr noundef byval(%struct.network_state) align 8) #2

declare void @col2im_cpu(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) #2

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 120}
!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 = !{!7, !7, i64 0}
!14 = !{!6, !7, i64 132}
!15 = !{!6, !7, i64 104}
!16 = !{!6, !10, i64 528}
!17 = !{!6, !7, i64 72}
!18 = !{!6, !7, i64 4}
!19 = !{!6, !10, i64 520}
!20 = !{!6, !10, i64 472}
!21 = !{!6, !7, i64 64}
!22 = !{!10, !10, i64 0}
!23 = !{!24, !10, i64 24}
!24 = !{!"network_state", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !7, i64 32, !7, i64 36, !25, i64 40}
!25 = !{!"network", !10, i64 0, !7, i64 8, !7, i64 12, !10, i64 16, !11, i64 24, !7, i64 28, !11, i64 32, !11, i64 36, !10, i64 40, !7, i64 48, !10, i64 56, !7, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !11, i64 80, !7, i64 84, !7, i64 88, !7, i64 92, !10, i64 96, !10, i64 104, !7, i64 112, !7, i64 116, !7, i64 120, !11, i64 124, !11, i64 128, !11, i64 132, !7, i64 136, !7, i64 140, !7, i64 144, !7, i64 148, !7, i64 152, !7, i64 156, !11, i64 160, !11, i64 164, !11, i64 168, !11, i64 172, !11, i64 176, !7, i64 180, !10, i64 184}
!26 = !{!6, !10, i64 504}
!27 = !{!24, !10, i64 8}
!28 = !{!6, !7, i64 96}
!29 = !{!6, !7, i64 100}
!30 = !{!6, !7, i64 140}
!31 = !{!6, !7, i64 148}
!32 = !{!24, !10, i64 16}
!33 = !{!6, !10, i64 496}
!34 = distinct !{!34, !35}
!35 = !{!"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"

%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 }

; Function Attrs: nounwind uwtable
declare dso_local i32 @convolutional_out_height(ptr noundef byval(%struct.layer) align 8) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @convolutional_out_width(ptr noundef byval(%struct.layer) align 8) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @backward_convolutional_layer(ptr noundef byval(%struct.layer) align 8 %0, ptr noundef byval(%struct.network_state) align 8 %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 120
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 132
  %6 = load i32, ptr %5, align 4, !tbaa !13
  %7 = mul nsw i32 %6, %6
  %8 = getelementptr inbounds i8, ptr %0, i64 104
  %9 = load i32, ptr %8, align 8, !tbaa !14
  %10 = mul nsw i32 %7, %9
  %11 = tail call i32 @convolutional_out_height(ptr noundef nonnull byval(%struct.layer) align 8 %0)
  %12 = tail call i32 @convolutional_out_width(ptr noundef nonnull byval(%struct.layer) align 8 %0)
  %13 = mul nsw i32 %12, %11
  %14 = getelementptr inbounds i8, ptr %0, i64 528
  %15 = load ptr, ptr %14, align 8, !tbaa !15
  %16 = mul i32 %13, %4
  %17 = getelementptr inbounds i8, ptr %0, i64 72
  %18 = load i32, ptr %17, align 8, !tbaa !16
  %19 = mul nsw i32 %16, %18
  %20 = getelementptr inbounds i8, ptr %0, i64 4
  %21 = load i32, ptr %20, align 4, !tbaa !17
  %22 = getelementptr inbounds i8, ptr %0, i64 520
  %23 = load ptr, ptr %22, align 8, !tbaa !18
  tail call void @gradient_array(ptr noundef %15, i32 noundef %19, i32 noundef %21, ptr noundef %23) #2
  %24 = getelementptr inbounds i8, ptr %0, i64 472
  %25 = load ptr, ptr %24, align 8, !tbaa !19
  %26 = load ptr, ptr %22, align 8, !tbaa !18
  %27 = load i32, ptr %17, align 8, !tbaa !16
  %28 = load i32, ptr %3, align 8, !tbaa !5
  tail call void @backward_bias(ptr noundef %25, ptr noundef %26, i32 noundef %27, i32 noundef %28, i32 noundef %13)
  %29 = getelementptr inbounds i8, ptr %0, i64 64
  %30 = load i32, ptr %29, align 8, !tbaa !20
  %.not = icmp eq i32 %30, 0
  br i1 %.not, label %32, label %31

31:                                               ; preds = %2
  tail call void @backward_batchnorm_layer(ptr noundef nonnull byval(%struct.layer) align 8 %0, ptr noundef nonnull byval(%struct.network_state) align 8 %1) #2
  br label %32

32:                                               ; preds = %31, %2
  %33 = load i32, ptr %17, align 8, !tbaa !16
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %32
  %35 = getelementptr inbounds i8, ptr %1, i64 24
  %36 = getelementptr inbounds i8, ptr %0, i64 504
  %37 = getelementptr inbounds i8, ptr %1, i64 8
  %38 = getelementptr inbounds i8, ptr %0, i64 96
  %39 = getelementptr inbounds i8, ptr %0, i64 100
  %40 = getelementptr inbounds i8, ptr %0, i64 140
  %41 = getelementptr inbounds i8, ptr %0, i64 148
  %42 = getelementptr inbounds i8, ptr %1, i64 16
  %43 = getelementptr inbounds i8, ptr %0, i64 496
  br label %44

44:                                               ; preds = %.lr.ph, %83
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %83 ]
  %45 = load ptr, ptr %22, align 8, !tbaa !18
  %46 = trunc nuw nsw i64 %indvars.iv to i32
  %47 = mul i32 %16, %46
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds float, ptr %45, i64 %48
  %50 = load ptr, ptr %35, align 8, !tbaa !21
  %51 = load ptr, ptr %36, align 8, !tbaa !24
  %52 = load ptr, ptr %37, align 8, !tbaa !25
  %53 = load i32, ptr %8, align 8, !tbaa !14
  %54 = mul nsw i32 %53, %46
  %55 = load i32, ptr %38, align 8, !tbaa !26
  %56 = mul nsw i32 %54, %55
  %57 = load i32, ptr %39, align 4, !tbaa !27
  %58 = mul nsw i32 %56, %57
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds float, ptr %52, i64 %59
  %61 = load i32, ptr %5, align 4, !tbaa !13
  %62 = load i32, ptr %40, align 4, !tbaa !28
  %63 = load i32, ptr %41, align 4, !tbaa !29
  tail call void @im2col_cpu(ptr noundef %60, i32 noundef %53, i32 noundef %55, i32 noundef %57, i32 noundef %61, i32 noundef %62, i32 noundef %63, ptr noundef %50) #2
  tail call void @gemm(i32 noundef 0, i32 noundef 1, i32 noundef %4, i32 noundef %10, i32 noundef %13, float noundef 1.000000e+00, ptr noundef %49, i32 noundef %13, ptr noundef %50, i32 noundef %13, float noundef 1.000000e+00, ptr noundef %51, i32 noundef %10) #2
  %64 = load ptr, ptr %42, align 8, !tbaa !30
  %.not32 = icmp eq ptr %64, null
  br i1 %.not32, label %83, label %65

65:                                               ; preds = %44
  %66 = load ptr, ptr %43, align 8, !tbaa !31
  %67 = load ptr, ptr %22, align 8, !tbaa !18
  %68 = getelementptr inbounds float, ptr %67, i64 %48
  %69 = load ptr, ptr %35, align 8, !tbaa !21
  tail call void @gemm(i32 noundef 1, i32 noundef 0, i32 noundef %10, i32 noundef %13, i32 noundef %4, float noundef 1.000000e+00, ptr noundef %66, i32 noundef %10, ptr noundef %68, i32 noundef %13, float noundef 0.000000e+00, ptr noundef %69, i32 noundef %13) #2
  %70 = load ptr, ptr %35, align 8, !tbaa !21
  %71 = load i32, ptr %8, align 8, !tbaa !14
  %72 = load i32, ptr %38, align 8, !tbaa !26
  %73 = load i32, ptr %39, align 4, !tbaa !27
  %74 = load i32, ptr %5, align 4, !tbaa !13
  %75 = load i32, ptr %40, align 4, !tbaa !28
  %76 = load i32, ptr %41, align 4, !tbaa !29
  %77 = load ptr, ptr %42, align 8, !tbaa !30
  %78 = mul nsw i32 %71, %46
  %79 = mul nsw i32 %78, %72
  %80 = mul nsw i32 %79, %73
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds float, ptr %77, i64 %81
  tail call void @col2im_cpu(ptr noundef %70, i32 noundef %71, i32 noundef %72, i32 noundef %73, i32 noundef %74, i32 noundef %75, i32 noundef %76, ptr noundef %82) #2
  br label %83

83:                                               ; preds = %65, %44
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %84 = load i32, ptr %17, align 8, !tbaa !16
  %85 = sext i32 %84 to i64
  %86 = icmp slt i64 %indvars.iv.next, %85
  br i1 %86, label %44, label %._crit_edge, !llvm.loop !32

._crit_edge:                                      ; preds = %83, %32
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @backward_bias(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

declare void @im2col_cpu(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

declare void @gemm(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, float noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef, float noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare void @gradient_array(ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

declare void @backward_batchnorm_layer(ptr noundef byval(%struct.layer) align 8, ptr noundef byval(%struct.network_state) align 8) local_unnamed_addr #1

declare void @col2im_cpu(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #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 = { "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 }

!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 120}
!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 132}
!14 = !{!6, !7, i64 104}
!15 = !{!6, !10, i64 528}
!16 = !{!6, !7, i64 72}
!17 = !{!6, !7, i64 4}
!18 = !{!6, !10, i64 520}
!19 = !{!6, !10, i64 472}
!20 = !{!6, !7, i64 64}
!21 = !{!22, !10, i64 24}
!22 = !{!"network_state", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !7, i64 32, !7, i64 36, !23, i64 40}
!23 = !{!"network", !10, i64 0, !7, i64 8, !7, i64 12, !10, i64 16, !11, i64 24, !7, i64 28, !11, i64 32, !11, i64 36, !10, i64 40, !7, i64 48, !10, i64 56, !7, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !11, i64 80, !7, i64 84, !7, i64 88, !7, i64 92, !10, i64 96, !10, i64 104, !7, i64 112, !7, i64 116, !7, i64 120, !11, i64 124, !11, i64 128, !11, i64 132, !7, i64 136, !7, i64 140, !7, i64 144, !7, i64 148, !7, i64 152, !7, i64 156, !11, i64 160, !11, i64 164, !11, i64 168, !11, i64 172, !11, i64 176, !7, i64 180, !10, i64 184}
!24 = !{!6, !10, i64 504}
!25 = !{!22, !10, i64 8}
!26 = !{!6, !7, i64 96}
!27 = !{!6, !7, i64 100}
!28 = !{!6, !7, i64 140}
!29 = !{!6, !7, i64 148}
!30 = !{!22, !10, i64 16}
!31 = !{!6, !10, i64 496}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}


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