; LLVM IR from hans-ob1/neural_cam_ros :: src/detector (region_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.box = type { float, float, float, float }

; Function Attrs: nounwind uwtable
define dso_local { <2 x float>, <2 x float> } @get_region_box(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, i32 noundef %7) #0 {
  %9 = alloca %struct.box, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  store ptr %0, ptr %10, align 8, !tbaa !5
  store ptr %1, ptr %11, align 8, !tbaa !5
  store i32 %2, ptr %12, align 4, !tbaa !9
  store i32 %3, ptr %13, align 4, !tbaa !9
  store i32 %4, ptr %14, align 4, !tbaa !9
  store i32 %5, ptr %15, align 4, !tbaa !9
  store i32 %6, ptr %16, align 4, !tbaa !9
  store i32 %7, ptr %17, align 4, !tbaa !9
  %18 = load i32, ptr %14, align 4, !tbaa !9
  %19 = sitofp i32 %18 to float
  %20 = load ptr, ptr %10, align 8, !tbaa !5
  %21 = load i32, ptr %13, align 4, !tbaa !9
  %22 = add nsw i32 %21, 0
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds float, ptr %20, i64 %23
  %25 = load float, ptr %24, align 4, !tbaa !11
  %26 = call float @logistic_activate(float noundef %25)
  %27 = fadd float %19, %26
  %28 = load i32, ptr %16, align 4, !tbaa !9
  %29 = sitofp i32 %28 to float
  %30 = fdiv float %27, %29
  %31 = getelementptr inbounds %struct.box, ptr %9, i32 0, i32 0
  store float %30, ptr %31, align 4, !tbaa !13
  %32 = load i32, ptr %15, align 4, !tbaa !9
  %33 = sitofp i32 %32 to float
  %34 = load ptr, ptr %10, align 8, !tbaa !5
  %35 = load i32, ptr %13, align 4, !tbaa !9
  %36 = add nsw i32 %35, 1
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds float, ptr %34, i64 %37
  %39 = load float, ptr %38, align 4, !tbaa !11
  %40 = call float @logistic_activate(float noundef %39)
  %41 = fadd float %33, %40
  %42 = load i32, ptr %17, align 4, !tbaa !9
  %43 = sitofp i32 %42 to float
  %44 = fdiv float %41, %43
  %45 = getelementptr inbounds %struct.box, ptr %9, i32 0, i32 1
  store float %44, ptr %45, align 4, !tbaa !15
  %46 = load ptr, ptr %10, align 8, !tbaa !5
  %47 = load i32, ptr %13, align 4, !tbaa !9
  %48 = add nsw i32 %47, 2
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds float, ptr %46, i64 %49
  %51 = load float, ptr %50, align 4, !tbaa !11
  %52 = fpext float %51 to double
  %53 = call double @exp(double noundef %52) #3
  %54 = load ptr, ptr %11, align 8, !tbaa !5
  %55 = load i32, ptr %12, align 4, !tbaa !9
  %56 = mul nsw i32 2, %55
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds float, ptr %54, i64 %57
  %59 = load float, ptr %58, align 4, !tbaa !11
  %60 = fpext float %59 to double
  %61 = fmul double %53, %60
  %62 = load i32, ptr %16, align 4, !tbaa !9
  %63 = sitofp i32 %62 to double
  %64 = fdiv double %61, %63
  %65 = fptrunc double %64 to float
  %66 = getelementptr inbounds %struct.box, ptr %9, i32 0, i32 2
  store float %65, ptr %66, align 4, !tbaa !16
  %67 = load ptr, ptr %10, align 8, !tbaa !5
  %68 = load i32, ptr %13, align 4, !tbaa !9
  %69 = add nsw i32 %68, 3
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds float, ptr %67, i64 %70
  %72 = load float, ptr %71, align 4, !tbaa !11
  %73 = fpext float %72 to double
  %74 = call double @exp(double noundef %73) #3
  %75 = load ptr, ptr %11, align 8, !tbaa !5
  %76 = load i32, ptr %12, align 4, !tbaa !9
  %77 = mul nsw i32 2, %76
  %78 = add nsw i32 %77, 1
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds float, ptr %75, i64 %79
  %81 = load float, ptr %80, align 4, !tbaa !11
  %82 = fpext float %81 to double
  %83 = fmul double %74, %82
  %84 = load i32, ptr %17, align 4, !tbaa !9
  %85 = sitofp i32 %84 to double
  %86 = fdiv double %83, %85
  %87 = fptrunc double %86 to float
  %88 = getelementptr inbounds %struct.box, ptr %9, i32 0, i32 3
  store float %87, ptr %88, align 4, !tbaa !17
  %89 = load { <2 x float>, <2 x float> }, ptr %9, align 4
  ret { <2 x float>, <2 x float> } %89
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden float @logistic_activate(float noundef) #1

; Function Attrs: nounwind
declare double @exp(double 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 = { inlinehint 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 = { 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 #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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !12, i64 0}
!14 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12}
!15 = !{!14, !12, i64 4}
!16 = !{!14, !12, i64 8}
!17 = !{!14, !12, i64 12}


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

; Function Attrs: nounwind uwtable
define dso_local { <2 x float>, <2 x float> } @get_region_box(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, i32 noundef %7) local_unnamed_addr #0 {
  %9 = insertelement <2 x i32> poison, i32 %4, i64 0
  %10 = insertelement <2 x i32> %9, i32 %5, i64 1
  %11 = sitofp <2 x i32> %10 to <2 x float>
  %12 = sext i32 %3 to i64
  %13 = getelementptr inbounds float, ptr %0, i64 %12
  %14 = load float, ptr %13, align 4, !tbaa !5
  %15 = tail call float @logistic_activate(float noundef %14)
  %16 = insertelement <2 x i32> poison, i32 %6, i64 0
  %17 = insertelement <2 x i32> %16, i32 %7, i64 1
  %18 = sitofp <2 x i32> %17 to <2 x float>
  %19 = getelementptr i8, ptr %13, i64 4
  %20 = load float, ptr %19, align 4, !tbaa !5
  %21 = tail call float @logistic_activate(float noundef %20)
  %22 = insertelement <2 x float> poison, float %15, i64 0
  %23 = insertelement <2 x float> %22, float %21, i64 1
  %24 = fadd <2 x float> %23, %11
  %25 = fdiv <2 x float> %24, %18
  %26 = getelementptr i8, ptr %13, i64 8
  %27 = load float, ptr %26, align 4, !tbaa !5
  %28 = fpext float %27 to double
  %29 = tail call double @exp(double noundef %28) #3
  %30 = shl nsw i32 %2, 1
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds float, ptr %1, i64 %31
  %33 = sitofp <2 x i32> %17 to <2 x double>
  %34 = getelementptr i8, ptr %13, i64 12
  %35 = load float, ptr %34, align 4, !tbaa !5
  %36 = fpext float %35 to double
  %37 = or disjoint i32 %30, 1
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds float, ptr %1, i64 %38
  %40 = load float, ptr %32, align 4, !tbaa !5
  %41 = tail call double @exp(double noundef %36) #3
  %42 = load float, ptr %39, align 4, !tbaa !5
  %43 = insertelement <2 x float> poison, float %40, i64 0
  %44 = insertelement <2 x float> %43, float %42, i64 1
  %45 = fpext <2 x float> %44 to <2 x double>
  %46 = insertelement <2 x double> poison, double %29, i64 0
  %47 = insertelement <2 x double> %46, double %41, i64 1
  %48 = fmul <2 x double> %47, %45
  %49 = fdiv <2 x double> %48, %33
  %50 = fptrunc <2 x double> %49 to <2 x float>
  %.fca.0.insert = insertvalue { <2 x float>, <2 x float> } poison, <2 x float> %25, 0
  %.fca.1.insert = insertvalue { <2 x float>, <2 x float> } %.fca.0.insert, <2 x float> %50, 1
  ret { <2 x float>, <2 x float> } %.fca.1.insert
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden float @logistic_activate(float noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @exp(double noundef) local_unnamed_addr #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 = { inlinehint 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 = { mustprogress nofree nounwind willreturn memory(write) "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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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