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

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

; Function Attrs: nounwind uwtable
define dso_local void @backward_connected_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
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  %10 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 101
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 15
  %13 = load i32, ptr %12, align 8, !tbaa !13
  %14 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 11
  %15 = load i32, ptr %14, align 8, !tbaa !14
  %16 = mul nsw i32 %13, %15
  %17 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 1
  %18 = load i32, ptr %17, align 4, !tbaa !15
  %19 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 100
  %20 = load ptr, ptr %19, align 8, !tbaa !16
  call void @gradient_array(ptr noundef %11, i32 noundef %16, i32 noundef %18, ptr noundef %20)
  store i32 0, ptr %3, align 4, !tbaa !17
  br label %21

21:                                               ; preds = %39, %2
  %22 = load i32, ptr %3, align 4, !tbaa !17
  %23 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 11
  %24 = load i32, ptr %23, align 8, !tbaa !14
  %25 = icmp slt i32 %22, %24
  br i1 %25, label %26, label %42

26:                                               ; preds = %21
  %27 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 15
  %28 = load i32, ptr %27, align 8, !tbaa !13
  %29 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 100
  %30 = load ptr, ptr %29, align 8, !tbaa !16
  %31 = load i32, ptr %3, align 4, !tbaa !17
  %32 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 15
  %33 = load i32, ptr %32, align 8, !tbaa !13
  %34 = mul nsw i32 %31, %33
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds float, ptr %30, i64 %35
  %37 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 94
  %38 = load ptr, ptr %37, align 8, !tbaa !18
  call void @axpy_cpu(i32 noundef %28, float noundef 1.000000e+00, ptr noundef %36, i32 noundef 1, ptr noundef %38, i32 noundef 1)
  br label %39

39:                                               ; preds = %26
  %40 = load i32, ptr %3, align 4, !tbaa !17
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %3, align 4, !tbaa !17
  br label %21, !llvm.loop !19

42:                                               ; preds = %21
  %43 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 9
  %44 = load i32, ptr %43, align 8, !tbaa !21
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %46, label %105

46:                                               ; preds = %42
  %47 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 112
  %48 = load ptr, ptr %47, align 8, !tbaa !22
  %49 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 100
  %50 = load ptr, ptr %49, align 8, !tbaa !16
  %51 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 11
  %52 = load i32, ptr %51, align 8, !tbaa !14
  %53 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 15
  %54 = load i32, ptr %53, align 8, !tbaa !13
  %55 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 96
  %56 = load ptr, ptr %55, align 8, !tbaa !23
  call void @backward_scale_cpu(ptr noundef %48, ptr noundef %50, i32 noundef %52, i32 noundef %54, i32 noundef 1, ptr noundef %56)
  %57 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 100
  %58 = load ptr, ptr %57, align 8, !tbaa !16
  %59 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 95
  %60 = load ptr, ptr %59, align 8, !tbaa !24
  %61 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 11
  %62 = load i32, ptr %61, align 8, !tbaa !14
  %63 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 15
  %64 = load i32, ptr %63, align 8, !tbaa !13
  call void @scale_bias(ptr noundef %58, ptr noundef %60, i32 noundef %62, i32 noundef %64, i32 noundef 1)
  %65 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 100
  %66 = load ptr, ptr %65, align 8, !tbaa !16
  %67 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 106
  %68 = load ptr, ptr %67, align 8, !tbaa !25
  %69 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 11
  %70 = load i32, ptr %69, align 8, !tbaa !14
  %71 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 15
  %72 = load i32, ptr %71, align 8, !tbaa !13
  %73 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 107
  %74 = load ptr, ptr %73, align 8, !tbaa !26
  call void @mean_delta_cpu(ptr noundef %66, ptr noundef %68, i32 noundef %70, i32 noundef %72, i32 noundef 1, ptr noundef %74)
  %75 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 111
  %76 = load ptr, ptr %75, align 8, !tbaa !27
  %77 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 100
  %78 = load ptr, ptr %77, align 8, !tbaa !16
  %79 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 105
  %80 = load ptr, ptr %79, align 8, !tbaa !28
  %81 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 106
  %82 = load ptr, ptr %81, align 8, !tbaa !25
  %83 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 11
  %84 = load i32, ptr %83, align 8, !tbaa !14
  %85 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 15
  %86 = load i32, ptr %85, align 8, !tbaa !13
  %87 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 108
  %88 = load ptr, ptr %87, align 8, !tbaa !29
  call void @variance_delta_cpu(ptr noundef %76, ptr noundef %78, ptr noundef %80, ptr noundef %82, i32 noundef %84, i32 noundef %86, i32 noundef 1, ptr noundef %88)
  %89 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 111
  %90 = load ptr, ptr %89, align 8, !tbaa !27
  %91 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 105
  %92 = load ptr, ptr %91, align 8, !tbaa !28
  %93 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 106
  %94 = load ptr, ptr %93, align 8, !tbaa !25
  %95 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 107
  %96 = load ptr, ptr %95, align 8, !tbaa !26
  %97 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 108
  %98 = load ptr, ptr %97, align 8, !tbaa !29
  %99 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 11
  %100 = load i32, ptr %99, align 8, !tbaa !14
  %101 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 15
  %102 = load i32, ptr %101, align 8, !tbaa !13
  %103 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 100
  %104 = load ptr, ptr %103, align 8, !tbaa !16
  call void @normalize_delta_cpu(ptr noundef %90, ptr noundef %92, ptr noundef %94, ptr noundef %96, ptr noundef %98, i32 noundef %100, i32 noundef %102, i32 noundef 1, ptr noundef %104)
  br label %105

105:                                              ; preds = %46, %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %106 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 15
  %107 = load i32, ptr %106, align 8, !tbaa !13
  store i32 %107, ptr %4, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %108 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 11
  %109 = load i32, ptr %108, align 8, !tbaa !14
  store i32 %109, ptr %5, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %110 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 14
  %111 = load i32, ptr %110, align 4, !tbaa !30
  store i32 %111, ptr %6, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %112 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 100
  %113 = load ptr, ptr %112, align 8, !tbaa !16
  store ptr %113, ptr %7, align 8, !tbaa !31
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %114 = getelementptr inbounds %struct.network_state, ptr %1, i32 0, i32 1
  %115 = load ptr, ptr %114, align 8, !tbaa !32
  store ptr %115, ptr %8, align 8, !tbaa !31
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %116 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 98
  %117 = load ptr, ptr %116, align 8, !tbaa !35
  store ptr %117, ptr %9, align 8, !tbaa !31
  %118 = load i32, ptr %4, align 4, !tbaa !17
  %119 = load i32, ptr %6, align 4, !tbaa !17
  %120 = load i32, ptr %5, align 4, !tbaa !17
  %121 = load ptr, ptr %7, align 8, !tbaa !31
  %122 = load i32, ptr %4, align 4, !tbaa !17
  %123 = load ptr, ptr %8, align 8, !tbaa !31
  %124 = load i32, ptr %6, align 4, !tbaa !17
  %125 = load ptr, ptr %9, align 8, !tbaa !31
  %126 = load i32, ptr %6, align 4, !tbaa !17
  call void @gemm(i32 noundef 1, i32 noundef 0, i32 noundef %118, i32 noundef %119, i32 noundef %120, float noundef 1.000000e+00, ptr noundef %121, i32 noundef %122, ptr noundef %123, i32 noundef %124, float noundef 1.000000e+00, ptr noundef %125, i32 noundef %126)
  %127 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 11
  %128 = load i32, ptr %127, align 8, !tbaa !14
  store i32 %128, ptr %4, align 4, !tbaa !17
  %129 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 15
  %130 = load i32, ptr %129, align 8, !tbaa !13
  store i32 %130, ptr %5, align 4, !tbaa !17
  %131 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 14
  %132 = load i32, ptr %131, align 4, !tbaa !30
  store i32 %132, ptr %6, align 4, !tbaa !17
  %133 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 100
  %134 = load ptr, ptr %133, align 8, !tbaa !16
  store ptr %134, ptr %7, align 8, !tbaa !31
  %135 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 97
  %136 = load ptr, ptr %135, align 8, !tbaa !36
  store ptr %136, ptr %8, align 8, !tbaa !31
  %137 = getelementptr inbounds %struct.network_state, ptr %1, i32 0, i32 2
  %138 = load ptr, ptr %137, align 8, !tbaa !37
  store ptr %138, ptr %9, align 8, !tbaa !31
  %139 = load ptr, ptr %9, align 8, !tbaa !31
  %140 = icmp ne ptr %139, null
  br i1 %140, label %141, label %151

141:                                              ; preds = %105
  %142 = load i32, ptr %4, align 4, !tbaa !17
  %143 = load i32, ptr %6, align 4, !tbaa !17
  %144 = load i32, ptr %5, align 4, !tbaa !17
  %145 = load ptr, ptr %7, align 8, !tbaa !31
  %146 = load i32, ptr %5, align 4, !tbaa !17
  %147 = load ptr, ptr %8, align 8, !tbaa !31
  %148 = load i32, ptr %6, align 4, !tbaa !17
  %149 = load ptr, ptr %9, align 8, !tbaa !31
  %150 = load i32, ptr %6, align 4, !tbaa !17
  call void @gemm(i32 noundef 0, i32 noundef 0, i32 noundef %142, i32 noundef %143, i32 noundef %144, float noundef 1.000000e+00, ptr noundef %145, i32 noundef %146, ptr noundef %147, i32 noundef %148, float noundef 1.000000e+00, ptr noundef %149, i32 noundef %150)
  br label %151

151:                                              ; preds = %141, %105
  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
  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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare void @axpy_cpu(i32 noundef, float noundef, ptr noundef, i32 noundef, ptr noundef, i32 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 @scale_bias(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef) #2

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

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

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

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

declare void @normalize_delta_cpu(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr 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, !10, i64 528}
!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 88}
!14 = !{!6, !7, i64 72}
!15 = !{!6, !7, i64 4}
!16 = !{!6, !10, i64 520}
!17 = !{!7, !7, i64 0}
!18 = !{!6, !10, i64 472}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!6, !7, i64 64}
!22 = !{!6, !10, i64 616}
!23 = !{!6, !10, i64 488}
!24 = !{!6, !10, i64 480}
!25 = !{!6, !10, i64 568}
!26 = !{!6, !10, i64 576}
!27 = !{!6, !10, i64 608}
!28 = !{!6, !10, i64 560}
!29 = !{!6, !10, i64 584}
!30 = !{!6, !7, i64 84}
!31 = !{!10, !10, i64 0}
!32 = !{!33, !10, i64 8}
!33 = !{!"network_state", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !7, i64 32, !7, i64 36, !34, i64 40}
!34 = !{!"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}
!35 = !{!6, !10, i64 504}
!36 = !{!6, !10, i64 496}
!37 = !{!33, !10, i64 16}


; 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
define dso_local void @backward_connected_layer(ptr nocapture noundef readonly byval(%struct.layer) align 8 %0, ptr nocapture noundef readonly byval(%struct.network_state) align 8 %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 528
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 88
  %6 = load i32, ptr %5, align 8, !tbaa !13
  %7 = getelementptr inbounds i8, ptr %0, i64 72
  %8 = load i32, ptr %7, align 8, !tbaa !14
  %9 = mul nsw i32 %8, %6
  %10 = getelementptr inbounds i8, ptr %0, i64 4
  %11 = load i32, ptr %10, align 4, !tbaa !15
  %12 = getelementptr inbounds i8, ptr %0, i64 520
  %13 = load ptr, ptr %12, align 8, !tbaa !16
  tail call void @gradient_array(ptr noundef %4, i32 noundef %9, i32 noundef %11, ptr noundef %13) #2
  %14 = icmp sgt i32 %8, 0
  br i1 %14, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2
  %15 = getelementptr inbounds i8, ptr %0, i64 472
  %16 = load ptr, ptr %15, align 8, !tbaa !17
  %17 = sext i32 %6 to i64
  %wide.trip.count = zext nneg i32 %8 to i64
  br label %18

18:                                               ; preds = %.lr.ph, %18
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %18 ]
  %19 = mul nsw i64 %indvars.iv, %17
  %20 = getelementptr inbounds float, ptr %13, i64 %19
  tail call void @axpy_cpu(i32 noundef %6, float noundef 1.000000e+00, ptr noundef %20, i32 noundef 1, ptr noundef %16, i32 noundef 1) #2
  %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 %._crit_edge, label %18, !llvm.loop !18

._crit_edge:                                      ; preds = %18, %2
  %21 = getelementptr inbounds i8, ptr %0, i64 64
  %22 = load i32, ptr %21, align 8, !tbaa !20
  %.not = icmp eq i32 %22, 0
  br i1 %.not, label %40, label %23

23:                                               ; preds = %._crit_edge
  %24 = getelementptr inbounds i8, ptr %0, i64 616
  %25 = load ptr, ptr %24, align 8, !tbaa !21
  %26 = getelementptr inbounds i8, ptr %0, i64 488
  %27 = load ptr, ptr %26, align 8, !tbaa !22
  tail call void @backward_scale_cpu(ptr noundef %25, ptr noundef %13, i32 noundef %8, i32 noundef %6, i32 noundef 1, ptr noundef %27) #2
  %28 = getelementptr inbounds i8, ptr %0, i64 480
  %29 = load ptr, ptr %28, align 8, !tbaa !23
  tail call void @scale_bias(ptr noundef %13, ptr noundef %29, i32 noundef %8, i32 noundef %6, i32 noundef 1) #2
  %30 = getelementptr inbounds i8, ptr %0, i64 568
  %31 = load ptr, ptr %30, align 8, !tbaa !24
  %32 = getelementptr inbounds i8, ptr %0, i64 576
  %33 = load ptr, ptr %32, align 8, !tbaa !25
  tail call void @mean_delta_cpu(ptr noundef %13, ptr noundef %31, i32 noundef %8, i32 noundef %6, i32 noundef 1, ptr noundef %33) #2
  %34 = getelementptr inbounds i8, ptr %0, i64 608
  %35 = load ptr, ptr %34, align 8, !tbaa !26
  %36 = getelementptr inbounds i8, ptr %0, i64 560
  %37 = load ptr, ptr %36, align 8, !tbaa !27
  %38 = getelementptr inbounds i8, ptr %0, i64 584
  %39 = load ptr, ptr %38, align 8, !tbaa !28
  tail call void @variance_delta_cpu(ptr noundef %35, ptr noundef %13, ptr noundef %37, ptr noundef %31, i32 noundef %8, i32 noundef %6, i32 noundef 1, ptr noundef %39) #2
  tail call void @normalize_delta_cpu(ptr noundef %35, ptr noundef %37, ptr noundef %31, ptr noundef %33, ptr noundef %39, i32 noundef %8, i32 noundef %6, i32 noundef 1, ptr noundef %13) #2
  br label %40

40:                                               ; preds = %23, %._crit_edge
  %41 = getelementptr inbounds i8, ptr %0, i64 84
  %42 = load i32, ptr %41, align 4, !tbaa !29
  %43 = getelementptr inbounds i8, ptr %1, i64 8
  %44 = load ptr, ptr %43, align 8, !tbaa !30
  %45 = getelementptr inbounds i8, ptr %0, i64 504
  %46 = load ptr, ptr %45, align 8, !tbaa !33
  tail call void @gemm(i32 noundef 1, i32 noundef 0, i32 noundef %6, i32 noundef %42, i32 noundef %8, float noundef 1.000000e+00, ptr noundef %13, i32 noundef %6, ptr noundef %44, i32 noundef %42, float noundef 1.000000e+00, ptr noundef %46, i32 noundef %42) #2
  %47 = getelementptr inbounds i8, ptr %1, i64 16
  %48 = load ptr, ptr %47, align 8, !tbaa !34
  %.not23 = icmp eq ptr %48, null
  br i1 %.not23, label %52, label %49

49:                                               ; preds = %40
  %50 = getelementptr inbounds i8, ptr %0, i64 496
  %51 = load ptr, ptr %50, align 8, !tbaa !35
  tail call void @gemm(i32 noundef 0, i32 noundef 0, i32 noundef %8, i32 noundef %42, i32 noundef %6, float noundef 1.000000e+00, ptr noundef %13, i32 noundef %6, ptr noundef %51, i32 noundef %42, float noundef 1.000000e+00, ptr noundef nonnull %48, i32 noundef %42) #2
  br label %52

52:                                               ; preds = %49, %40
  ret void
}

declare void @axpy_cpu(i32 noundef, float noundef, ptr noundef, i32 noundef, ptr noundef, i32 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 @scale_bias(ptr noundef, ptr noundef, i32 noundef, i32 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_scale_cpu(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

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

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

declare void @normalize_delta_cpu(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr 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, !10, i64 528}
!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 88}
!14 = !{!6, !7, i64 72}
!15 = !{!6, !7, i64 4}
!16 = !{!6, !10, i64 520}
!17 = !{!6, !10, i64 472}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!6, !7, i64 64}
!21 = !{!6, !10, i64 616}
!22 = !{!6, !10, i64 488}
!23 = !{!6, !10, i64 480}
!24 = !{!6, !10, i64 568}
!25 = !{!6, !10, i64 576}
!26 = !{!6, !10, i64 608}
!27 = !{!6, !10, i64 560}
!28 = !{!6, !10, i64 584}
!29 = !{!6, !7, i64 84}
!30 = !{!31, !10, i64 8}
!31 = !{!"network_state", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !7, i64 32, !7, i64 36, !32, i64 40}
!32 = !{!"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}
!33 = !{!6, !10, i64 504}
!34 = !{!31, !10, i64 16}
!35 = !{!6, !10, i64 496}


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