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

; 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
define dso_local void @update_convolutional_layer(ptr noundef byval(%struct.layer) align 8 %0, i32 noundef %1, float noundef %2, float noundef %3, float noundef %4) #1 {
  %6 = alloca i32, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca i32, align 4
  store i32 %1, ptr %6, align 4, !tbaa !5
  store float %2, ptr %7, align 4, !tbaa !9
  store float %3, ptr %8, align 4, !tbaa !9
  store float %4, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %11 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 26
  %12 = load i32, ptr %11, align 4, !tbaa !11
  %13 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 26
  %14 = load i32, ptr %13, align 4, !tbaa !11
  %15 = mul nsw i32 %12, %14
  %16 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 19
  %17 = load i32, ptr %16, align 8, !tbaa !15
  %18 = mul nsw i32 %15, %17
  %19 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 23
  %20 = load i32, ptr %19, align 8, !tbaa !16
  %21 = mul nsw i32 %18, %20
  store i32 %21, ptr %10, align 4, !tbaa !5
  %22 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 23
  %23 = load i32, ptr %22, align 8, !tbaa !16
  %24 = load float, ptr %7, align 4, !tbaa !9
  %25 = load i32, ptr %6, align 4, !tbaa !5
  %26 = sitofp i32 %25 to float
  %27 = fdiv float %24, %26
  %28 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 94
  %29 = load ptr, ptr %28, align 8, !tbaa !17
  %30 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 93
  %31 = load ptr, ptr %30, align 8, !tbaa !18
  call void @axpy_cpu(i32 noundef %23, float noundef %27, ptr noundef %29, i32 noundef 1, ptr noundef %31, i32 noundef 1)
  %32 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 23
  %33 = load i32, ptr %32, align 8, !tbaa !16
  %34 = load float, ptr %8, align 4, !tbaa !9
  %35 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 94
  %36 = load ptr, ptr %35, align 8, !tbaa !17
  call void @scal_cpu(i32 noundef %33, float noundef %34, ptr noundef %36, i32 noundef 1)
  %37 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 95
  %38 = load ptr, ptr %37, align 8, !tbaa !19
  %39 = icmp ne ptr %38, null
  br i1 %39, label %40, label %56

40:                                               ; preds = %5
  %41 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 23
  %42 = load i32, ptr %41, align 8, !tbaa !16
  %43 = load float, ptr %7, align 4, !tbaa !9
  %44 = load i32, ptr %6, align 4, !tbaa !5
  %45 = sitofp i32 %44 to float
  %46 = fdiv float %43, %45
  %47 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 96
  %48 = load ptr, ptr %47, align 8, !tbaa !20
  %49 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 95
  %50 = load ptr, ptr %49, align 8, !tbaa !19
  call void @axpy_cpu(i32 noundef %42, float noundef %46, ptr noundef %48, i32 noundef 1, ptr noundef %50, i32 noundef 1)
  %51 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 23
  %52 = load i32, ptr %51, align 8, !tbaa !16
  %53 = load float, ptr %8, align 4, !tbaa !9
  %54 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 96
  %55 = load ptr, ptr %54, align 8, !tbaa !20
  call void @scal_cpu(i32 noundef %52, float noundef %53, ptr noundef %55, i32 noundef 1)
  br label %56

56:                                               ; preds = %40, %5
  %57 = load i32, ptr %10, align 4, !tbaa !5
  %58 = load float, ptr %9, align 4, !tbaa !9
  %59 = fneg float %58
  %60 = load i32, ptr %6, align 4, !tbaa !5
  %61 = sitofp i32 %60 to float
  %62 = fmul float %59, %61
  %63 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 97
  %64 = load ptr, ptr %63, align 8, !tbaa !21
  %65 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 98
  %66 = load ptr, ptr %65, align 8, !tbaa !22
  call void @axpy_cpu(i32 noundef %57, float noundef %62, ptr noundef %64, i32 noundef 1, ptr noundef %66, i32 noundef 1)
  %67 = load i32, ptr %10, align 4, !tbaa !5
  %68 = load float, ptr %7, align 4, !tbaa !9
  %69 = load i32, ptr %6, align 4, !tbaa !5
  %70 = sitofp i32 %69 to float
  %71 = fdiv float %68, %70
  %72 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 98
  %73 = load ptr, ptr %72, align 8, !tbaa !22
  %74 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 97
  %75 = load ptr, ptr %74, align 8, !tbaa !21
  call void @axpy_cpu(i32 noundef %67, float noundef %71, ptr noundef %73, i32 noundef 1, ptr noundef %75, i32 noundef 1)
  %76 = load i32, ptr %10, align 4, !tbaa !5
  %77 = load float, ptr %8, align 4, !tbaa !9
  %78 = getelementptr inbounds %struct.layer, ptr %0, i32 0, i32 98
  %79 = load ptr, ptr %78, align 8, !tbaa !22
  call void @scal_cpu(i32 noundef %76, float noundef %77, ptr noundef %79, i32 noundef 1)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  ret void
}

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

declare void @scal_cpu(i32 noundef, float noundef, ptr noundef, i32 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, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !6, i64 132}
!12 = !{!"layer", !6, i64 0, !6, i64 4, !6, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40, !13, i64 48, !13, 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, !10, i64 180, !10, i64 184, !10, i64 188, !10, i64 192, !10, i64 196, !10, i64 200, !10, 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, !10, i64 256, !10, i64 260, !10, i64 264, !6, i64 268, !10, i64 272, !10, i64 276, !10, i64 280, !10, i64 284, !10, i64 288, !10, i64 292, !10, i64 296, !6, i64 300, !6, i64 304, !10, i64 308, !6, i64 312, !6, i64 316, !6, i64 320, !6, i64 324, !10, i64 328, !10, i64 332, !10, i64 336, !13, i64 344, !13, i64 352, !13, i64 360, !13, i64 368, !13, i64 376, !13, i64 384, !13, i64 392, !13, i64 400, !13, i64 408, !13, i64 416, !13, i64 424, !13, i64 432, !13, i64 440, !13, i64 448, !13, i64 456, !13, i64 464, !13, i64 472, !13, i64 480, !13, i64 488, !13, i64 496, !13, i64 504, !13, i64 512, !13, i64 520, !13, i64 528, !13, i64 536, !13, i64 544, !13, i64 552, !13, i64 560, !13, i64 568, !13, i64 576, !13, i64 584, !13, i64 592, !13, i64 600, !13, i64 608, !13, i64 616, !13, i64 624, !13, i64 632, !13, i64 640, !13, i64 648, !13, i64 656, !13, i64 664, !13, i64 672, !13, i64 680, !13, i64 688, !13, i64 696, !13, i64 704, !13, i64 712, !13, i64 720, !13, i64 728, !13, i64 736, !13, i64 744, !13, i64 752, !13, i64 760, !13, i64 768, !13, i64 776, !13, i64 784, !13, i64 792, !14, i64 800}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!12, !6, i64 104}
!16 = !{!12, !6, i64 120}
!17 = !{!12, !13, i64 472}
!18 = !{!12, !13, i64 464}
!19 = !{!12, !13, i64 480}
!20 = !{!12, !13, i64 488}
!21 = !{!12, !13, i64 496}
!22 = !{!12, !13, i64 504}


; 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: nounwind uwtable
define dso_local void @update_convolutional_layer(ptr nocapture noundef readonly byval(%struct.layer) align 8 %0, i32 noundef %1, float noundef %2, float noundef %3, float noundef %4) local_unnamed_addr #0 {
  %6 = getelementptr inbounds i8, ptr %0, i64 132
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 104
  %9 = load i32, ptr %8, align 8, !tbaa !13
  %10 = getelementptr inbounds i8, ptr %0, i64 120
  %11 = load i32, ptr %10, align 8, !tbaa !14
  %12 = sitofp i32 %1 to float
  %13 = fdiv float %2, %12
  %14 = getelementptr inbounds i8, ptr %0, i64 472
  %15 = load ptr, ptr %14, align 8, !tbaa !15
  %16 = getelementptr inbounds i8, ptr %0, i64 464
  %17 = load ptr, ptr %16, align 8, !tbaa !16
  tail call void @axpy_cpu(i32 noundef %11, float noundef %13, ptr noundef %15, i32 noundef 1, ptr noundef %17, i32 noundef 1) #2
  tail call void @scal_cpu(i32 noundef %11, float noundef %3, ptr noundef %15, i32 noundef 1) #2
  %18 = getelementptr inbounds i8, ptr %0, i64 480
  %19 = load ptr, ptr %18, align 8, !tbaa !17
  %.not = icmp eq ptr %19, null
  br i1 %.not, label %23, label %20

20:                                               ; preds = %5
  %21 = getelementptr inbounds i8, ptr %0, i64 488
  %22 = load ptr, ptr %21, align 8, !tbaa !18
  tail call void @axpy_cpu(i32 noundef %11, float noundef %13, ptr noundef %22, i32 noundef 1, ptr noundef nonnull %19, i32 noundef 1) #2
  tail call void @scal_cpu(i32 noundef %11, float noundef %3, ptr noundef %22, i32 noundef 1) #2
  br label %23

23:                                               ; preds = %20, %5
  %24 = mul nsw i32 %7, %7
  %25 = mul nsw i32 %24, %9
  %26 = mul nsw i32 %25, %11
  %27 = fneg float %4
  %28 = fmul float %12, %27
  %29 = getelementptr inbounds i8, ptr %0, i64 496
  %30 = load ptr, ptr %29, align 8, !tbaa !19
  %31 = getelementptr inbounds i8, ptr %0, i64 504
  %32 = load ptr, ptr %31, align 8, !tbaa !20
  tail call void @axpy_cpu(i32 noundef %26, float noundef %28, ptr noundef %30, i32 noundef 1, ptr noundef %32, i32 noundef 1) #2
  tail call void @axpy_cpu(i32 noundef %26, float noundef %13, ptr noundef %32, i32 noundef 1, ptr noundef %30, i32 noundef 1) #2
  tail call void @scal_cpu(i32 noundef %26, float noundef %3, ptr noundef %32, i32 noundef 1) #2
  ret void
}

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

declare void @scal_cpu(i32 noundef, float noundef, ptr 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 132}
!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 120}
!15 = !{!6, !10, i64 472}
!16 = !{!6, !10, i64 464}
!17 = !{!6, !10, i64 480}
!18 = !{!6, !10, i64 488}
!19 = !{!6, !10, i64 496}
!20 = !{!6, !10, i64 504}


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