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

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

; 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

declare i64 @fwrite(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @save_convolutional_weights(ptr noundef byval(%struct.layer) align 8 %0, ptr noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %1, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 34
  %6 = load i32, ptr %5, align 4, !tbaa !9
  %7 = icmp ne i32 %6, 0
  br i1 %7, label %8, label %9

8:                                                ; preds = %2
  br label %9

9:                                                ; preds = %8, %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %10 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 23
  %11 = load i32, ptr %10, align 8, !tbaa !14
  %12 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 19
  %13 = load i32, ptr %12, align 8, !tbaa !15
  %14 = mul nsw i32 %11, %13
  %15 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 26
  %16 = load i32, ptr %15, align 4, !tbaa !16
  %17 = mul nsw i32 %14, %16
  %18 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 26
  %19 = load i32, ptr %18, align 4, !tbaa !16
  %20 = mul nsw i32 %17, %19
  store i32 %20, ptr %4, align 4, !tbaa !17
  %21 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 93
  %22 = load ptr, ptr %21, align 8, !tbaa !18
  %23 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 23
  %24 = load i32, ptr %23, align 8, !tbaa !14
  %25 = sext i32 %24 to i64
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = call i64 @fwrite(ptr noundef %22, i64 noundef 4, i64 noundef %25, ptr noundef %26)
  %28 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 9
  %29 = load i32, ptr %28, align 8, !tbaa !19
  %30 = icmp ne i32 %29, 0
  br i1 %30, label %31, label %53

31:                                               ; preds = %9
  %32 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 95
  %33 = load ptr, ptr %32, align 8, !tbaa !20
  %34 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 23
  %35 = load i32, ptr %34, align 8, !tbaa !14
  %36 = sext i32 %35 to i64
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = call i64 @fwrite(ptr noundef %33, i64 noundef 4, i64 noundef %36, ptr noundef %37)
  %39 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 109
  %40 = load ptr, ptr %39, align 8, !tbaa !21
  %41 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 23
  %42 = load i32, ptr %41, align 8, !tbaa !14
  %43 = sext i32 %42 to i64
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = call i64 @fwrite(ptr noundef %40, i64 noundef 4, i64 noundef %43, ptr noundef %44)
  %46 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 110
  %47 = load ptr, ptr %46, align 8, !tbaa !22
  %48 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 23
  %49 = load i32, ptr %48, align 8, !tbaa !14
  %50 = sext i32 %49 to i64
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = call i64 @fwrite(ptr noundef %47, i64 noundef 4, i64 noundef %50, ptr noundef %51)
  br label %53

53:                                               ; preds = %31, %9
  %54 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 97
  %55 = load ptr, ptr %54, align 8, !tbaa !23
  %56 = load i32, ptr %4, align 4, !tbaa !17
  %57 = sext i32 %56 to i64
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = call i64 @fwrite(ptr noundef %55, i64 noundef 4, i64 noundef %57, ptr noundef %58)
  %60 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 56
  %61 = load i32, ptr %60, align 4, !tbaa !24
  %62 = icmp ne i32 %61, 0
  br i1 %62, label %63, label %76

63:                                               ; preds = %53
  %64 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 113
  %65 = load ptr, ptr %64, align 8, !tbaa !25
  %66 = load i32, ptr %4, align 4, !tbaa !17
  %67 = sext i32 %66 to i64
  %68 = load ptr, ptr %3, align 8, !tbaa !5
  %69 = call i64 @fwrite(ptr noundef %65, i64 noundef 4, i64 noundef %67, ptr noundef %68)
  %70 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 114
  %71 = load ptr, ptr %70, align 8, !tbaa !26
  %72 = load i32, ptr %4, align 4, !tbaa !17
  %73 = sext i32 %72 to i64
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = call i64 @fwrite(ptr noundef %71, i64 noundef 4, i64 noundef %73, ptr noundef %74)
  br label %76

76:                                               ; preds = %63, %53
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  ret void
}

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


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

; Function Attrs: nofree nounwind
declare noundef i64 @fwrite(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #0

; Function Attrs: nofree nounwind uwtable
define dso_local void @save_convolutional_weights(ptr nocapture noundef readonly byval(%struct.layer) align 8 %0, ptr nocapture noundef %1) local_unnamed_addr #1 {
  %3 = getelementptr inbounds i8, ptr %0, i64 120
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 104
  %6 = load i32, ptr %5, align 8, !tbaa !13
  %7 = mul nsw i32 %6, %4
  %8 = getelementptr inbounds i8, ptr %0, i64 132
  %9 = load i32, ptr %8, align 4, !tbaa !14
  %10 = mul nsw i32 %7, %9
  %11 = mul nsw i32 %10, %9
  %12 = getelementptr inbounds i8, ptr %0, i64 464
  %13 = load ptr, ptr %12, align 8, !tbaa !15
  %14 = sext i32 %4 to i64
  %15 = tail call i64 @fwrite(ptr noundef %13, i64 noundef 4, i64 noundef %14, ptr noundef %1)
  %16 = getelementptr inbounds i8, ptr %0, i64 64
  %17 = load i32, ptr %16, align 8, !tbaa !16
  %.not = icmp eq i32 %17, 0
  br i1 %.not, label %28, label %18

18:                                               ; preds = %2
  %19 = getelementptr inbounds i8, ptr %0, i64 480
  %20 = load ptr, ptr %19, align 8, !tbaa !17
  %21 = tail call i64 @fwrite(ptr noundef %20, i64 noundef 4, i64 noundef %14, ptr noundef %1)
  %22 = getelementptr inbounds i8, ptr %0, i64 592
  %23 = load ptr, ptr %22, align 8, !tbaa !18
  %24 = tail call i64 @fwrite(ptr noundef %23, i64 noundef 4, i64 noundef %14, ptr noundef %1)
  %25 = getelementptr inbounds i8, ptr %0, i64 600
  %26 = load ptr, ptr %25, align 8, !tbaa !19
  %27 = tail call i64 @fwrite(ptr noundef %26, i64 noundef 4, i64 noundef %14, ptr noundef %1)
  br label %28

28:                                               ; preds = %18, %2
  %29 = getelementptr inbounds i8, ptr %0, i64 496
  %30 = load ptr, ptr %29, align 8, !tbaa !20
  %31 = sext i32 %11 to i64
  %32 = tail call i64 @fwrite(ptr noundef %30, i64 noundef 4, i64 noundef %31, ptr noundef %1)
  %33 = getelementptr inbounds i8, ptr %0, i64 252
  %34 = load i32, ptr %33, align 4, !tbaa !21
  %.not9 = icmp eq i32 %34, 0
  br i1 %.not9, label %42, label %35

35:                                               ; preds = %28
  %36 = getelementptr inbounds i8, ptr %0, i64 624
  %37 = load ptr, ptr %36, align 8, !tbaa !22
  %38 = tail call i64 @fwrite(ptr noundef %37, i64 noundef 4, i64 noundef %31, ptr noundef %1)
  %39 = getelementptr inbounds i8, ptr %0, i64 632
  %40 = load ptr, ptr %39, align 8, !tbaa !23
  %41 = tail call i64 @fwrite(ptr noundef %40, i64 noundef 4, i64 noundef %31, ptr noundef %1)
  br label %42

42:                                               ; preds = %35, %28
  ret void
}

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

!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 104}
!14 = !{!6, !7, i64 132}
!15 = !{!6, !10, i64 464}
!16 = !{!6, !7, i64 64}
!17 = !{!6, !10, i64 480}
!18 = !{!6, !10, i64 592}
!19 = !{!6, !10, i64 600}
!20 = !{!6, !10, i64 496}
!21 = !{!6, !7, i64 252}
!22 = !{!6, !10, i64 624}
!23 = !{!6, !10, i64 632}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass