; LLVM IR from jingweizhanghuai/Morn :: src/image (morn_image_geometry2)

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

; 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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

; 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
declare dso_local i32 @LineCrossPoint(double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local double @PointVerticalDistance(double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind
declare double @sqrt(double noundef) #3

; Function Attrs: nounwind uwtable
define dso_local float @LineAngle(double noundef %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5, double noundef %6, double noundef %7) #2 {
  %9 = alloca float, align 4
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  %18 = alloca float, align 4
  %19 = alloca float, align 4
  %20 = alloca i32, align 4
  %21 = alloca float, align 4
  %22 = alloca float, align 4
  store double %0, ptr %10, align 8, !tbaa !5
  store double %1, ptr %11, align 8, !tbaa !5
  store double %2, ptr %12, align 8, !tbaa !5
  store double %3, ptr %13, align 8, !tbaa !5
  store double %4, ptr %14, align 8, !tbaa !5
  store double %5, ptr %15, align 8, !tbaa !5
  store double %6, ptr %16, align 8, !tbaa !5
  store double %7, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %23 = load double, ptr %10, align 8, !tbaa !5
  %24 = load double, ptr %11, align 8, !tbaa !5
  %25 = load double, ptr %12, align 8, !tbaa !5
  %26 = load double, ptr %13, align 8, !tbaa !5
  %27 = load double, ptr %14, align 8, !tbaa !5
  %28 = load double, ptr %15, align 8, !tbaa !5
  %29 = load double, ptr %16, align 8, !tbaa !5
  %30 = load double, ptr %17, align 8, !tbaa !5
  %31 = call i32 @LineCrossPoint(double noundef %23, double noundef %24, double noundef %25, double noundef %26, double noundef %27, double noundef %28, double noundef %29, double noundef %30, ptr noundef %18, ptr noundef %19)
  %32 = load float, ptr %18, align 4, !tbaa !9
  %33 = call i1 @llvm.is.fpclass.f32(float %32, i32 3)
  br i1 %33, label %34, label %35

34:                                               ; preds = %8
  store float 0.000000e+00, ptr %9, align 4
  store i32 1, ptr %20, align 4
  br label %105

35:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #4
  %36 = load double, ptr %12, align 8, !tbaa !5
  %37 = load double, ptr %13, align 8, !tbaa !5
  %38 = load double, ptr %14, align 8, !tbaa !5
  %39 = load double, ptr %15, align 8, !tbaa !5
  %40 = load double, ptr %16, align 8, !tbaa !5
  %41 = load double, ptr %17, align 8, !tbaa !5
  %42 = call double @PointVerticalDistance(double noundef %36, double noundef %37, double noundef %38, double noundef %39, double noundef %40, double noundef %41, ptr noundef null, ptr noundef null)
  %43 = fptrunc double %42 to float
  store float %43, ptr %22, align 4, !tbaa !9
  %44 = load float, ptr %22, align 4, !tbaa !9
  %45 = fcmp ole float %44, 0.000000e+00
  br i1 %45, label %46, label %75

46:                                               ; preds = %35
  %47 = load double, ptr %10, align 8, !tbaa !5
  %48 = load double, ptr %11, align 8, !tbaa !5
  %49 = load double, ptr %14, align 8, !tbaa !5
  %50 = load double, ptr %15, align 8, !tbaa !5
  %51 = load double, ptr %16, align 8, !tbaa !5
  %52 = load double, ptr %17, align 8, !tbaa !5
  %53 = call double @PointVerticalDistance(double noundef %47, double noundef %48, double noundef %49, double noundef %50, double noundef %51, double noundef %52, ptr noundef null, ptr noundef null)
  %54 = fptrunc double %53 to float
  store float %54, ptr %22, align 4, !tbaa !9
  %55 = load float, ptr %18, align 4, !tbaa !9
  %56 = fpext float %55 to double
  %57 = load double, ptr %10, align 8, !tbaa !5
  %58 = fsub double %56, %57
  %59 = load float, ptr %18, align 4, !tbaa !9
  %60 = fpext float %59 to double
  %61 = load double, ptr %10, align 8, !tbaa !5
  %62 = fsub double %60, %61
  %63 = load float, ptr %19, align 4, !tbaa !9
  %64 = fpext float %63 to double
  %65 = load double, ptr %11, align 8, !tbaa !5
  %66 = fsub double %64, %65
  %67 = load float, ptr %19, align 4, !tbaa !9
  %68 = fpext float %67 to double
  %69 = load double, ptr %11, align 8, !tbaa !5
  %70 = fsub double %68, %69
  %71 = fmul double %66, %70
  %72 = call double @llvm.fmuladd.f64(double %58, double %62, double %71)
  %73 = call double @sqrt(double noundef %72) #4
  %74 = fptrunc double %73 to float
  store float %74, ptr %21, align 4, !tbaa !9
  br label %96

75:                                               ; preds = %35
  %76 = load float, ptr %18, align 4, !tbaa !9
  %77 = fpext float %76 to double
  %78 = load double, ptr %12, align 8, !tbaa !5
  %79 = fsub double %77, %78
  %80 = load float, ptr %18, align 4, !tbaa !9
  %81 = fpext float %80 to double
  %82 = load double, ptr %12, align 8, !tbaa !5
  %83 = fsub double %81, %82
  %84 = load float, ptr %19, align 4, !tbaa !9
  %85 = fpext float %84 to double
  %86 = load double, ptr %13, align 8, !tbaa !5
  %87 = fsub double %85, %86
  %88 = load float, ptr %19, align 4, !tbaa !9
  %89 = fpext float %88 to double
  %90 = load double, ptr %13, align 8, !tbaa !5
  %91 = fsub double %89, %90
  %92 = fmul double %87, %91
  %93 = call double @llvm.fmuladd.f64(double %79, double %83, double %92)
  %94 = call double @sqrt(double noundef %93) #4
  %95 = fptrunc double %94 to float
  store float %95, ptr %21, align 4, !tbaa !9
  br label %96

96:                                               ; preds = %75, %46
  %97 = load float, ptr %22, align 4, !tbaa !9
  %98 = load float, ptr %21, align 4, !tbaa !9
  %99 = fdiv float %97, %98
  %100 = fpext float %99 to double
  %101 = call double @asin(double noundef %100) #4
  %102 = fmul double %101, 1.800000e+02
  %103 = fdiv double %102, 0x400921FB54442D18
  %104 = fptrunc double %103 to float
  store float %104, ptr %9, align 4
  store i32 1, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  br label %105

105:                                              ; preds = %96, %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  %106 = load float, ptr %9, align 4
  ret float %106
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i1 @llvm.is.fpclass.f32(float, i32 immarg) #1

; Function Attrs: nounwind
declare double @asin(double 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 = { 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 #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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}


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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @LineCrossPoint(double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local double @PointVerticalDistance(double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local float @LineAngle(double noundef %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5, double noundef %6, double noundef %7) local_unnamed_addr #2 {
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #5
  %11 = call i32 @LineCrossPoint(double noundef %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5, double noundef %6, double noundef %7, ptr noundef nonnull %9, ptr noundef nonnull %10)
  %12 = load float, ptr %9, align 4, !tbaa !5
  %13 = fcmp uno float %12, 0.000000e+00
  br i1 %13, label %45, label %14

14:                                               ; preds = %8
  %15 = call double @PointVerticalDistance(double noundef %2, double noundef %3, double noundef %4, double noundef %5, double noundef %6, double noundef %7, ptr noundef null, ptr noundef null)
  %16 = fptrunc double %15 to float
  %17 = fcmp ugt float %16, 0.000000e+00
  br i1 %17, label %29, label %18

18:                                               ; preds = %14
  %19 = call double @PointVerticalDistance(double noundef %0, double noundef %1, double noundef %4, double noundef %5, double noundef %6, double noundef %7, ptr noundef null, ptr noundef null)
  %20 = fptrunc double %19 to float
  %21 = load float, ptr %9, align 4, !tbaa !5
  %22 = fpext float %21 to double
  %23 = fsub double %22, %0
  %24 = load float, ptr %10, align 4, !tbaa !5
  %25 = fpext float %24 to double
  %26 = fsub double %25, %1
  %27 = fmul double %26, %26
  %28 = call double @llvm.fmuladd.f64(double %23, double %23, double %27)
  br label %38

29:                                               ; preds = %14
  %30 = load float, ptr %9, align 4, !tbaa !5
  %31 = fpext float %30 to double
  %32 = fsub double %31, %2
  %33 = load float, ptr %10, align 4, !tbaa !5
  %34 = fpext float %33 to double
  %35 = fsub double %34, %3
  %36 = fmul double %35, %35
  %37 = call double @llvm.fmuladd.f64(double %32, double %32, double %36)
  br label %38

38:                                               ; preds = %29, %18
  %.sink = phi double [ %37, %29 ], [ %28, %18 ]
  %.0 = phi float [ %16, %29 ], [ %20, %18 ]
  %sqrt35 = call double @llvm.sqrt.f64(double %.sink)
  %.032 = fptrunc double %sqrt35 to float
  %39 = fdiv float %.0, %.032
  %40 = fpext float %39 to double
  %41 = call double @asin(double noundef %40) #5
  %42 = fmul double %41, 1.800000e+02
  %43 = fdiv double %42, 0x400921FB54442D18
  %44 = fptrunc double %43 to float
  br label %45

45:                                               ; preds = %8, %38
  %.033 = phi float [ %44, %38 ], [ 0.000000e+00, %8 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #5
  ret float %.033
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @asin(double noundef) local_unnamed_addr #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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: AggressiveInstCombinePass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass