; 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: nounwind uwtable
declare dso_local void @swap_binary(ptr noundef) #0

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @forward_convolutional_layer(ptr noundef byval(%struct.layer) align 8 %0, ptr noundef byval(%struct.network_state) align 8 %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  %12 = call i32 @convolutional_out_height(ptr noundef byval(%struct.layer) align 8 %0)
  store i32 %12, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %13 = call i32 @convolutional_out_width(ptr noundef byval(%struct.layer) align 8 %0)
  store i32 %13, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %14 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 15
  %15 = load i32, ptr %14, align 8, !tbaa !9
  %16 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 11
  %17 = load i32, ptr %16, align 8, !tbaa !14
  %18 = mul nsw i32 %15, %17
  %19 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 101
  %20 = load ptr, ptr %19, align 8, !tbaa !15
  call void @fill_cpu(i32 noundef %18, float noundef 0.000000e+00, ptr noundef %20, i32 noundef 1)
  %21 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 35
  %22 = load i32, ptr %21, align 8, !tbaa !16
  %23 = icmp ne i32 %22, 0
  br i1 %23, label %24, label %57

24:                                               ; preds = %2
  %25 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 97
  %26 = load ptr, ptr %25, align 8, !tbaa !17
  %27 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 23
  %28 = load i32, ptr %27, align 8, !tbaa !18
  %29 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 19
  %30 = load i32, ptr %29, align 8, !tbaa !19
  %31 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 26
  %32 = load i32, ptr %31, align 4, !tbaa !20
  %33 = mul nsw i32 %30, %32
  %34 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 26
  %35 = load i32, ptr %34, align 4, !tbaa !20
  %36 = mul nsw i32 %33, %35
  %37 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 92
  %38 = load ptr, ptr %37, align 8, !tbaa !21
  call void @binarize_weights(ptr noundef %26, i32 noundef %28, i32 noundef %36, ptr noundef %38)
  call void @swap_binary(ptr noundef %0)
  %39 = getelementptr inbounds %struct.network_state, ptr %1, i32 0, i32 1
  %40 = load ptr, ptr %39, align 8, !tbaa !22
  %41 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 19
  %42 = load i32, ptr %41, align 8, !tbaa !19
  %43 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 17
  %44 = load i32, ptr %43, align 8, !tbaa !25
  %45 = mul nsw i32 %42, %44
  %46 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 18
  %47 = load i32, ptr %46, align 4, !tbaa !26
  %48 = mul nsw i32 %45, %47
  %49 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 11
  %50 = load i32, ptr %49, align 8, !tbaa !14
  %51 = mul nsw i32 %48, %50
  %52 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 118
  %53 = load ptr, ptr %52, align 8, !tbaa !27
  call void @binarize_cpu(ptr noundef %40, i32 noundef %51, ptr noundef %53)
  %54 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 118
  %55 = load ptr, ptr %54, align 8, !tbaa !27
  %56 = getelementptr inbounds %struct.network_state, ptr %1, i32 0, i32 1
  store ptr %55, ptr %56, align 8, !tbaa !22
  br label %57

57:                                               ; preds = %24, %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %58 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 23
  %59 = load i32, ptr %58, align 8, !tbaa !18
  store i32 %59, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %60 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 26
  %61 = load i32, ptr %60, align 4, !tbaa !20
  %62 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 26
  %63 = load i32, ptr %62, align 4, !tbaa !20
  %64 = mul nsw i32 %61, %63
  %65 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 19
  %66 = load i32, ptr %65, align 8, !tbaa !19
  %67 = mul nsw i32 %64, %66
  store i32 %67, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %68 = load i32, ptr %3, align 4, !tbaa !5
  %69 = load i32, ptr %4, align 4, !tbaa !5
  %70 = mul nsw i32 %68, %69
  store i32 %70, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %71 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 97
  %72 = load ptr, ptr %71, align 8, !tbaa !17
  store ptr %72, ptr %9, align 8, !tbaa !28
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %73 = getelementptr inbounds %struct.network_state, ptr %1, i32 0, i32 3
  %74 = load ptr, ptr %73, align 8, !tbaa !29
  store ptr %74, ptr %10, align 8, !tbaa !28
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %75 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 101
  %76 = load ptr, ptr %75, align 8, !tbaa !15
  store ptr %76, ptr %11, align 8, !tbaa !28
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %77

77:                                               ; preds = %125, %57
  %78 = load i32, ptr %5, align 4, !tbaa !5
  %79 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 11
  %80 = load i32, ptr %79, align 8, !tbaa !14
  %81 = icmp slt i32 %78, %80
  br i1 %81, label %82, label %128

82:                                               ; preds = %77
  %83 = getelementptr inbounds %struct.network_state, ptr %1, i32 0, i32 1
  %84 = load ptr, ptr %83, align 8, !tbaa !22
  %85 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 19
  %86 = load i32, ptr %85, align 8, !tbaa !19
  %87 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 17
  %88 = load i32, ptr %87, align 8, !tbaa !25
  %89 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 18
  %90 = load i32, ptr %89, align 4, !tbaa !26
  %91 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 26
  %92 = load i32, ptr %91, align 4, !tbaa !20
  %93 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 28
  %94 = load i32, ptr %93, align 4, !tbaa !30
  %95 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 30
  %96 = load i32, ptr %95, align 4, !tbaa !31
  %97 = load ptr, ptr %10, align 8, !tbaa !28
  call void @im2col_cpu(ptr noundef %84, i32 noundef %86, i32 noundef %88, i32 noundef %90, i32 noundef %92, i32 noundef %94, i32 noundef %96, ptr noundef %97)
  %98 = load i32, ptr %6, align 4, !tbaa !5
  %99 = load i32, ptr %8, align 4, !tbaa !5
  %100 = load i32, ptr %7, align 4, !tbaa !5
  %101 = load ptr, ptr %9, align 8, !tbaa !28
  %102 = load i32, ptr %7, align 4, !tbaa !5
  %103 = load ptr, ptr %10, align 8, !tbaa !28
  %104 = load i32, ptr %8, align 4, !tbaa !5
  %105 = load ptr, ptr %11, align 8, !tbaa !28
  %106 = load i32, ptr %8, align 4, !tbaa !5
  call void @gemm(i32 noundef 0, i32 noundef 0, i32 noundef %98, i32 noundef %99, i32 noundef %100, float noundef 1.000000e+00, ptr noundef %101, i32 noundef %102, ptr noundef %103, i32 noundef %104, float noundef 1.000000e+00, ptr noundef %105, i32 noundef %106)
  %107 = load i32, ptr %8, align 4, !tbaa !5
  %108 = load i32, ptr %6, align 4, !tbaa !5
  %109 = mul nsw i32 %107, %108
  %110 = load ptr, ptr %11, align 8, !tbaa !28
  %111 = sext i32 %109 to i64
  %112 = getelementptr inbounds float, ptr %110, i64 %111
  store ptr %112, ptr %11, align 8, !tbaa !28
  %113 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 19
  %114 = load i32, ptr %113, align 8, !tbaa !19
  %115 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 17
  %116 = load i32, ptr %115, align 8, !tbaa !25
  %117 = mul nsw i32 %114, %116
  %118 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 18
  %119 = load i32, ptr %118, align 4, !tbaa !26
  %120 = mul nsw i32 %117, %119
  %121 = getelementptr inbounds %struct.network_state, ptr %1, i32 0, i32 1
  %122 = load ptr, ptr %121, align 8, !tbaa !22
  %123 = sext i32 %120 to i64
  %124 = getelementptr inbounds float, ptr %122, i64 %123
  store ptr %124, ptr %121, align 8, !tbaa !22
  br label %125

125:                                              ; preds = %82
  %126 = load i32, ptr %5, align 4, !tbaa !5
  %127 = add nsw i32 %126, 1
  store i32 %127, ptr %5, align 4, !tbaa !5
  br label %77, !llvm.loop !32

128:                                              ; preds = %77
  %129 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 9
  %130 = load i32, ptr %129, align 8, !tbaa !34
  %131 = icmp ne i32 %130, 0
  br i1 %131, label %132, label %133

132:                                              ; preds = %128
  call void @forward_batchnorm_layer(ptr noundef byval(%struct.layer) align 8 %0, ptr noundef byval(%struct.network_state) align 8 %1)
  br label %133

133:                                              ; preds = %132, %128
  %134 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 101
  %135 = load ptr, ptr %134, align 8, !tbaa !15
  %136 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 93
  %137 = load ptr, ptr %136, align 8, !tbaa !35
  %138 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 11
  %139 = load i32, ptr %138, align 8, !tbaa !14
  %140 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 23
  %141 = load i32, ptr %140, align 8, !tbaa !18
  %142 = load i32, ptr %3, align 4, !tbaa !5
  %143 = load i32, ptr %4, align 4, !tbaa !5
  %144 = mul nsw i32 %142, %143
  call void @add_bias(ptr noundef %135, ptr noundef %137, i32 noundef %139, i32 noundef %141, i32 noundef %144)
  %145 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 101
  %146 = load ptr, ptr %145, align 8, !tbaa !15
  %147 = load i32, ptr %6, align 4, !tbaa !5
  %148 = load i32, ptr %8, align 4, !tbaa !5
  %149 = mul nsw i32 %147, %148
  %150 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 11
  %151 = load i32, ptr %150, align 8, !tbaa !14
  %152 = mul nsw i32 %149, %151
  %153 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 1
  %154 = load i32, ptr %153, align 4, !tbaa !36
  call void @activate_array(ptr noundef %146, i32 noundef %152, i32 noundef %154)
  %155 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 34
  %156 = load i32, ptr %155, align 4, !tbaa !37
  %157 = icmp ne i32 %156, 0
  br i1 %157, label %162, label %158

158:                                              ; preds = %133
  %159 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 35
  %160 = load i32, ptr %159, align 8, !tbaa !16
  %161 = icmp ne i32 %160, 0
  br i1 %161, label %162, label %163

162:                                              ; preds = %158, %133
  call void @swap_binary(ptr noundef %0)
  br label %163

163:                                              ; preds = %162, %158
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  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 @add_bias(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef) #0

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

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 @forward_batchnorm_layer(ptr noundef byval(%struct.layer) align 8, ptr noundef byval(%struct.network_state) align 8) #2

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

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

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

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


; 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 void @swap_binary(ptr noundef) local_unnamed_addr #0

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

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

; 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 @forward_convolutional_layer(ptr noundef byval(%struct.layer) align 8 %0, ptr noundef byval(%struct.network_state) align 8 %1) local_unnamed_addr #0 {
  %3 = tail call i32 @convolutional_out_height(ptr noundef nonnull byval(%struct.layer) align 8 %0)
  %4 = tail call i32 @convolutional_out_width(ptr noundef nonnull byval(%struct.layer) align 8 %0)
  %5 = getelementptr inbounds i8, ptr %0, i64 88
  %6 = load i32, ptr %5, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 72
  %8 = load i32, ptr %7, align 8, !tbaa !13
  %9 = mul nsw i32 %8, %6
  %10 = getelementptr inbounds i8, ptr %0, i64 528
  %11 = load ptr, ptr %10, align 8, !tbaa !14
  tail call void @fill_cpu(i32 noundef %9, float noundef 0.000000e+00, ptr noundef %11, i32 noundef 1) #2
  %12 = getelementptr inbounds i8, ptr %0, i64 168
  %13 = load i32, ptr %12, align 8, !tbaa !15
  %.not = icmp eq i32 %13, 0
  br i1 %.not, label %41, label %14

14:                                               ; preds = %2
  %15 = getelementptr inbounds i8, ptr %0, i64 496
  %16 = load ptr, ptr %15, align 8, !tbaa !16
  %17 = getelementptr inbounds i8, ptr %0, i64 120
  %18 = load i32, ptr %17, align 8, !tbaa !17
  %19 = getelementptr inbounds i8, ptr %0, i64 104
  %20 = load i32, ptr %19, align 8, !tbaa !18
  %21 = getelementptr inbounds i8, ptr %0, i64 132
  %22 = load i32, ptr %21, align 4, !tbaa !19
  %23 = mul nsw i32 %22, %20
  %24 = mul nsw i32 %23, %22
  %25 = getelementptr inbounds i8, ptr %0, i64 456
  %26 = load ptr, ptr %25, align 8, !tbaa !20
  tail call void @binarize_weights(ptr noundef %16, i32 noundef %18, i32 noundef %24, ptr noundef %26)
  call void @swap_binary(ptr noundef nonnull %0)
  %27 = getelementptr inbounds i8, ptr %1, i64 8
  %28 = load ptr, ptr %27, align 8, !tbaa !21
  %29 = load i32, ptr %19, align 8, !tbaa !18
  %30 = getelementptr inbounds i8, ptr %0, i64 96
  %31 = load i32, ptr %30, align 8, !tbaa !24
  %32 = mul nsw i32 %31, %29
  %33 = getelementptr inbounds i8, ptr %0, i64 100
  %34 = load i32, ptr %33, align 4, !tbaa !25
  %35 = mul nsw i32 %32, %34
  %36 = load i32, ptr %7, align 8, !tbaa !13
  %37 = mul nsw i32 %35, %36
  %38 = getelementptr inbounds i8, ptr %0, i64 664
  %39 = load ptr, ptr %38, align 8, !tbaa !26
  call void @binarize_cpu(ptr noundef %28, i32 noundef %37, ptr noundef %39)
  %40 = load ptr, ptr %38, align 8, !tbaa !26
  store ptr %40, ptr %27, align 8, !tbaa !21
  br label %41

41:                                               ; preds = %14, %2
  %42 = getelementptr inbounds i8, ptr %0, i64 120
  %43 = load i32, ptr %42, align 8, !tbaa !17
  %44 = getelementptr inbounds i8, ptr %0, i64 132
  %45 = load i32, ptr %44, align 4, !tbaa !19
  %46 = mul nsw i32 %45, %45
  %47 = getelementptr inbounds i8, ptr %0, i64 104
  %48 = load i32, ptr %47, align 8, !tbaa !18
  %49 = mul nsw i32 %46, %48
  %50 = mul nsw i32 %4, %3
  %51 = getelementptr inbounds i8, ptr %0, i64 496
  %52 = load ptr, ptr %51, align 8, !tbaa !16
  %53 = getelementptr inbounds i8, ptr %1, i64 24
  %54 = load ptr, ptr %53, align 8, !tbaa !27
  %55 = load i32, ptr %7, align 8, !tbaa !13
  %56 = icmp sgt i32 %55, 0
  br i1 %56, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %41
  %57 = load ptr, ptr %10, align 8, !tbaa !14
  %58 = getelementptr inbounds i8, ptr %1, i64 8
  %59 = getelementptr inbounds i8, ptr %0, i64 96
  %60 = getelementptr inbounds i8, ptr %0, i64 100
  %61 = getelementptr inbounds i8, ptr %0, i64 140
  %62 = getelementptr inbounds i8, ptr %0, i64 148
  %63 = mul nsw i32 %43, %50
  %64 = sext i32 %63 to i64
  %.pre = load ptr, ptr %58, align 8, !tbaa !21
  %.pre26 = load i32, ptr %59, align 8, !tbaa !24
  %.pre27 = load i32, ptr %60, align 4, !tbaa !25
  br label %65

65:                                               ; preds = %.lr.ph, %65
  %66 = phi i32 [ %.pre27, %.lr.ph ], [ %77, %65 ]
  %67 = phi i32 [ %.pre26, %.lr.ph ], [ %75, %65 ]
  %68 = phi i32 [ %48, %.lr.ph ], [ %74, %65 ]
  %69 = phi ptr [ %.pre, %.lr.ph ], [ %80, %65 ]
  %.025 = phi ptr [ %57, %.lr.ph ], [ %73, %65 ]
  %.02224 = phi i32 [ 0, %.lr.ph ], [ %81, %65 ]
  %70 = load i32, ptr %44, align 4, !tbaa !19
  %71 = load i32, ptr %61, align 4, !tbaa !28
  %72 = load i32, ptr %62, align 4, !tbaa !29
  call void @im2col_cpu(ptr noundef %69, i32 noundef %68, i32 noundef %67, i32 noundef %66, i32 noundef %70, i32 noundef %71, i32 noundef %72, ptr noundef %54) #2
  call void @gemm(i32 noundef 0, i32 noundef 0, i32 noundef %43, i32 noundef %50, i32 noundef %49, float noundef 1.000000e+00, ptr noundef %52, i32 noundef %49, ptr noundef %54, i32 noundef %50, float noundef 1.000000e+00, ptr noundef %.025, i32 noundef %50) #2
  %73 = getelementptr inbounds float, ptr %.025, i64 %64
  %74 = load i32, ptr %47, align 8, !tbaa !18
  %75 = load i32, ptr %59, align 8, !tbaa !24
  %76 = mul nsw i32 %75, %74
  %77 = load i32, ptr %60, align 4, !tbaa !25
  %78 = mul nsw i32 %76, %77
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds float, ptr %69, i64 %79
  store ptr %80, ptr %58, align 8, !tbaa !21
  %81 = add nuw nsw i32 %.02224, 1
  %82 = load i32, ptr %7, align 8, !tbaa !13
  %83 = icmp slt i32 %81, %82
  br i1 %83, label %65, label %._crit_edge, !llvm.loop !30

._crit_edge:                                      ; preds = %65, %41
  %84 = phi i32 [ %55, %41 ], [ %82, %65 ]
  %85 = getelementptr inbounds i8, ptr %0, i64 64
  %86 = load i32, ptr %85, align 8, !tbaa !32
  %.not23 = icmp eq i32 %86, 0
  br i1 %.not23, label %88, label %87

87:                                               ; preds = %._crit_edge
  call void @forward_batchnorm_layer(ptr noundef nonnull byval(%struct.layer) align 8 %0, ptr noundef nonnull byval(%struct.network_state) align 8 %1) #2
  %.pre28 = load i32, ptr %7, align 8, !tbaa !13
  br label %88

88:                                               ; preds = %87, %._crit_edge
  %89 = phi i32 [ %.pre28, %87 ], [ %84, %._crit_edge ]
  %90 = load ptr, ptr %10, align 8, !tbaa !14
  %91 = getelementptr inbounds i8, ptr %0, i64 464
  %92 = load ptr, ptr %91, align 8, !tbaa !33
  %93 = load i32, ptr %42, align 8, !tbaa !17
  call void @add_bias(ptr noundef %90, ptr noundef %92, i32 noundef %89, i32 noundef %93, i32 noundef %50)
  %94 = load ptr, ptr %10, align 8, !tbaa !14
  %95 = mul nsw i32 %43, %50
  %96 = load i32, ptr %7, align 8, !tbaa !13
  %97 = mul nsw i32 %95, %96
  %98 = getelementptr inbounds i8, ptr %0, i64 4
  %99 = load i32, ptr %98, align 4, !tbaa !34
  call void @activate_array(ptr noundef %94, i32 noundef %97, i32 noundef %99) #2
  %100 = getelementptr inbounds i8, ptr %0, i64 164
  %101 = load i32, ptr %100, align 4, !tbaa !35
  %102 = icmp ne i32 %101, 0
  %103 = load i32, ptr %12, align 8
  %104 = icmp ne i32 %103, 0
  %or.cond = select i1 %102, i1 true, i1 %104
  br i1 %or.cond, label %105, label %106

105:                                              ; preds = %88
  call void @swap_binary(ptr noundef nonnull %0)
  br label %106

106:                                              ; preds = %88, %105
  ret void
}

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

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

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 @forward_batchnorm_layer(ptr noundef byval(%struct.layer) align 8, ptr noundef byval(%struct.network_state) align 8) local_unnamed_addr #1

declare void @activate_array(ptr noundef, i32 noundef, i32 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 88}
!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 72}
!14 = !{!6, !10, i64 528}
!15 = !{!6, !7, i64 168}
!16 = !{!6, !10, i64 496}
!17 = !{!6, !7, i64 120}
!18 = !{!6, !7, i64 104}
!19 = !{!6, !7, i64 132}
!20 = !{!6, !10, i64 456}
!21 = !{!22, !10, i64 8}
!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, !7, i64 96}
!25 = !{!6, !7, i64 100}
!26 = !{!6, !10, i64 664}
!27 = !{!22, !10, i64 24}
!28 = !{!6, !7, i64 140}
!29 = !{!6, !7, i64 148}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = !{!6, !7, i64 64}
!33 = !{!6, !10, i64 464}
!34 = !{!6, !7, i64 4}
!35 = !{!6, !7, i64 164}


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