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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

; Function Attrs: nounwind uwtable
declare dso_local void @rotate_crop_image(ptr dead_on_unwind noalias writable sret(%struct.image) align 8, ptr noundef byval(%struct.image) align 8, float noundef, float noundef, i32 noundef, i32 noundef, float noundef, float noundef, float noundef) #2

declare i32 @rand_int(i32 noundef, i32 noundef) #3

; Function Attrs: nounwind uwtable
define dso_local void @random_augment_image(ptr dead_on_unwind noalias writable sret(%struct.image) align 8 %0, ptr noundef byval(%struct.image) align 8 %1, float noundef %2, float noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6) #2 {
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca float, align 4
  %16 = alloca float, align 4
  %17 = alloca float, align 4
  %18 = alloca float, align 4
  store float %2, ptr %8, align 4, !tbaa !5
  store float %3, ptr %9, align 4, !tbaa !5
  store i32 %4, ptr %10, align 4, !tbaa !9
  store i32 %5, ptr %11, align 4, !tbaa !9
  store i32 %6, ptr %12, align 4, !tbaa !9
  %19 = load float, ptr %9, align 4, !tbaa !5
  %20 = call float @rand_scale(float noundef %19)
  store float %20, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %21 = load i32, ptr %10, align 4, !tbaa !9
  %22 = load i32, ptr %11, align 4, !tbaa !9
  %23 = call i32 @rand_int(i32 noundef %21, i32 noundef %22)
  store i32 %23, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %24 = getelementptr inbounds %struct.image, ptr %1, i32 0, i32 0
  %25 = load i32, ptr %24, align 8, !tbaa !11
  %26 = sitofp i32 %25 to float
  %27 = getelementptr inbounds %struct.image, ptr %1, i32 0, i32 1
  %28 = load i32, ptr %27, align 4, !tbaa !14
  %29 = sitofp i32 %28 to float
  %30 = load float, ptr %9, align 4, !tbaa !5
  %31 = fmul float %29, %30
  %32 = fcmp olt float %26, %31
  br i1 %32, label %33, label %37

33:                                               ; preds = %7
  %34 = getelementptr inbounds %struct.image, ptr %1, i32 0, i32 0
  %35 = load i32, ptr %34, align 8, !tbaa !11
  %36 = sitofp i32 %35 to float
  br label %43

37:                                               ; preds = %7
  %38 = getelementptr inbounds %struct.image, ptr %1, i32 0, i32 1
  %39 = load i32, ptr %38, align 4, !tbaa !14
  %40 = sitofp i32 %39 to float
  %41 = load float, ptr %9, align 4, !tbaa !5
  %42 = fmul float %40, %41
  br label %43

43:                                               ; preds = %37, %33
  %44 = phi float [ %36, %33 ], [ %42, %37 ]
  %45 = fptosi float %44 to i32
  store i32 %45, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %46 = load i32, ptr %13, align 4, !tbaa !9
  %47 = sitofp i32 %46 to float
  %48 = load i32, ptr %14, align 4, !tbaa !9
  %49 = sitofp i32 %48 to float
  %50 = fdiv float %47, %49
  store float %50, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %51 = load float, ptr %8, align 4, !tbaa !5
  %52 = fneg float %51
  %53 = load float, ptr %8, align 4, !tbaa !5
  %54 = call float @rand_uniform(float noundef %52, float noundef %53)
  %55 = fpext float %54 to double
  %56 = fmul double %55, 0x401921FB54442D18
  %57 = fdiv double %56, 3.600000e+02
  %58 = fptrunc double %57 to float
  store float %58, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %59 = getelementptr inbounds %struct.image, ptr %1, i32 0, i32 1
  %60 = load i32, ptr %59, align 4, !tbaa !14
  %61 = sitofp i32 %60 to float
  %62 = load float, ptr %15, align 4, !tbaa !5
  %63 = fmul float %61, %62
  %64 = load float, ptr %9, align 4, !tbaa !5
  %65 = fdiv float %63, %64
  %66 = load i32, ptr %12, align 4, !tbaa !9
  %67 = sitofp i32 %66 to float
  %68 = fsub float %65, %67
  %69 = fpext float %68 to double
  %70 = fdiv double %69, 2.000000e+00
  %71 = fptrunc double %70 to float
  store float %71, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %72 = getelementptr inbounds %struct.image, ptr %1, i32 0, i32 0
  %73 = load i32, ptr %72, align 8, !tbaa !11
  %74 = sitofp i32 %73 to float
  %75 = load float, ptr %15, align 4, !tbaa !5
  %76 = load i32, ptr %12, align 4, !tbaa !9
  %77 = sitofp i32 %76 to float
  %78 = fneg float %77
  %79 = call float @llvm.fmuladd.f32(float %74, float %75, float %78)
  %80 = fpext float %79 to double
  %81 = fdiv double %80, 2.000000e+00
  %82 = fptrunc double %81 to float
  store float %82, ptr %18, align 4, !tbaa !5
  %83 = load float, ptr %17, align 4, !tbaa !5
  %84 = fcmp olt float %83, 0.000000e+00
  br i1 %84, label %85, label %86

85:                                               ; preds = %43
  store float 0.000000e+00, ptr %17, align 4, !tbaa !5
  br label %86

86:                                               ; preds = %85, %43
  %87 = load float, ptr %18, align 4, !tbaa !5
  %88 = fcmp olt float %87, 0.000000e+00
  br i1 %88, label %89, label %90

89:                                               ; preds = %86
  store float 0.000000e+00, ptr %18, align 4, !tbaa !5
  br label %90

90:                                               ; preds = %89, %86
  %91 = load float, ptr %17, align 4, !tbaa !5
  %92 = fneg float %91
  %93 = load float, ptr %17, align 4, !tbaa !5
  %94 = call float @rand_uniform(float noundef %92, float noundef %93)
  store float %94, ptr %17, align 4, !tbaa !5
  %95 = load float, ptr %18, align 4, !tbaa !5
  %96 = fneg float %95
  %97 = load float, ptr %18, align 4, !tbaa !5
  %98 = call float @rand_uniform(float noundef %96, float noundef %97)
  store float %98, ptr %18, align 4, !tbaa !5
  %99 = load float, ptr %16, align 4, !tbaa !5
  %100 = load float, ptr %15, align 4, !tbaa !5
  %101 = load i32, ptr %12, align 4, !tbaa !9
  %102 = load i32, ptr %12, align 4, !tbaa !9
  %103 = load float, ptr %17, align 4, !tbaa !5
  %104 = load float, ptr %18, align 4, !tbaa !5
  %105 = load float, ptr %9, align 4, !tbaa !5
  call void @rotate_crop_image(ptr dead_on_unwind writable sret(%struct.image) align 8 %0, ptr noundef byval(%struct.image) align 8 %1, float noundef %99, float noundef %100, i32 noundef %101, i32 noundef %102, float noundef %103, float noundef %104, float noundef %105)
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  ret void
}

declare float @rand_scale(float noundef) #3

declare float @rand_uniform(float noundef, float noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { "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 #4 = { 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"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !13, i64 16}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!12, !10, i64 4}


; 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.image = type { i32, i32, i32, ptr }

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #0

; Function Attrs: nounwind uwtable
declare dso_local void @rotate_crop_image(ptr dead_on_unwind noalias writable sret(%struct.image) align 8, ptr noundef byval(%struct.image) align 8, float noundef, float noundef, i32 noundef, i32 noundef, float noundef, float noundef, float noundef) local_unnamed_addr #1

declare i32 @rand_int(i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @random_augment_image(ptr dead_on_unwind noalias writable sret(%struct.image) align 8 %0, ptr noundef byval(%struct.image) align 8 %1, float noundef %2, float noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6) local_unnamed_addr #1 {
  %8 = tail call float @rand_scale(float noundef %3) #3
  %9 = tail call i32 @rand_int(i32 noundef %4, i32 noundef %5) #3
  %10 = load i32, ptr %1, align 8, !tbaa !5
  %11 = sitofp i32 %10 to float
  %12 = getelementptr inbounds i8, ptr %1, i64 4
  %13 = load i32, ptr %12, align 4, !tbaa !11
  %14 = sitofp i32 %13 to float
  %15 = fmul float %8, %14
  %16 = fcmp ogt float %15, %11
  %. = select i1 %16, float %11, float %15
  %17 = fptosi float %. to i32
  %18 = sitofp i32 %9 to float
  %19 = sitofp i32 %17 to float
  %20 = fdiv float %18, %19
  %21 = fneg float %2
  %22 = tail call float @rand_uniform(float noundef %21, float noundef %2) #3
  %23 = fmul float %20, %14
  %24 = fdiv float %23, %8
  %25 = sitofp i32 %6 to float
  %26 = fsub float %24, %25
  %27 = fmul float %26, 5.000000e-01
  %28 = fneg float %25
  %29 = tail call float @llvm.fmuladd.f32(float %11, float %20, float %28)
  %30 = fmul float %29, 5.000000e-01
  %31 = fcmp olt float %27, 0.000000e+00
  %.026 = select i1 %31, float 0.000000e+00, float %27
  %32 = fcmp olt float %30, 0.000000e+00
  %.0 = select i1 %32, float 0.000000e+00, float %30
  %33 = fpext float %22 to double
  %34 = fmul double %33, 0x401921FB54442D18
  %35 = fdiv double %34, 3.600000e+02
  %36 = fptrunc double %35 to float
  %37 = fneg float %.026
  %38 = tail call float @rand_uniform(float noundef %37, float noundef %.026) #3
  %39 = fneg float %.0
  %40 = tail call float @rand_uniform(float noundef %39, float noundef %.0) #3
  tail call void @rotate_crop_image(ptr dead_on_unwind writable sret(%struct.image) align 8 %0, ptr noundef nonnull byval(%struct.image) align 8 %1, float noundef %36, float noundef %20, i32 noundef %6, i32 noundef %6, float noundef %38, float noundef %40, float noundef %8)
  ret void
}

declare float @rand_scale(float noundef) local_unnamed_addr #2

declare float @rand_uniform(float noundef, float noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !7, i64 0}
!6 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 4}


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