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

%struct.MImagePoint = type { float, float }
%struct.MImageCircle = type { %struct.MImagePoint, float }

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @mCircumCircle(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #3 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca double, align 8
  %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 double, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.MImagePoint, ptr %19, i32 0, i32 0
  %21 = load float, ptr %20, align 4, !tbaa !9
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.MImagePoint, ptr %22, i32 0, i32 0
  %24 = load float, ptr %23, align 4, !tbaa !9
  %25 = fadd float %21, %24
  %26 = fpext float %25 to double
  %27 = fdiv double %26, 2.000000e+00
  store double %27, ptr %9, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.MImagePoint, ptr %28, i32 0, i32 1
  %30 = load float, ptr %29, align 4, !tbaa !14
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.MImagePoint, ptr %31, i32 0, i32 1
  %33 = load float, ptr %32, align 4, !tbaa !14
  %34 = fadd float %30, %33
  %35 = fpext float %34 to double
  %36 = fdiv double %35, 2.000000e+00
  store double %36, ptr %10, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.MImagePoint, ptr %37, i32 0, i32 0
  %39 = load float, ptr %38, align 4, !tbaa !9
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.MImagePoint, ptr %40, i32 0, i32 0
  %42 = load float, ptr %41, align 4, !tbaa !9
  %43 = fadd float %39, %42
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.MImagePoint, ptr %44, i32 0, i32 1
  %46 = load float, ptr %45, align 4, !tbaa !14
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.MImagePoint, ptr %47, i32 0, i32 1
  %49 = load float, ptr %48, align 4, !tbaa !14
  %50 = fsub float %46, %49
  %51 = fdiv float %43, %50
  %52 = fpext float %51 to double
  store double %52, ptr %11, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %53 = load double, ptr %10, align 8, !tbaa !12
  %54 = load double, ptr %11, align 8, !tbaa !12
  %55 = load double, ptr %9, align 8, !tbaa !12
  %56 = fneg double %54
  %57 = call double @llvm.fmuladd.f64(double %56, double %55, double %53)
  store double %57, ptr %12, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.MImagePoint, ptr %58, i32 0, i32 0
  %60 = load float, ptr %59, align 4, !tbaa !9
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.MImagePoint, ptr %61, i32 0, i32 0
  %63 = load float, ptr %62, align 4, !tbaa !9
  %64 = fadd float %60, %63
  %65 = fpext float %64 to double
  %66 = fdiv double %65, 2.000000e+00
  store double %66, ptr %13, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %67 = load ptr, ptr %7, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.MImagePoint, ptr %67, i32 0, i32 1
  %69 = load float, ptr %68, align 4, !tbaa !14
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.MImagePoint, ptr %70, i32 0, i32 1
  %72 = load float, ptr %71, align 4, !tbaa !14
  %73 = fadd float %69, %72
  %74 = fpext float %73 to double
  %75 = fdiv double %74, 2.000000e+00
  store double %75, ptr %14, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %76 = load ptr, ptr %7, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.MImagePoint, ptr %76, i32 0, i32 0
  %78 = load float, ptr %77, align 4, !tbaa !9
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.MImagePoint, ptr %79, i32 0, i32 0
  %81 = load float, ptr %80, align 4, !tbaa !9
  %82 = fadd float %78, %81
  %83 = load ptr, ptr %6, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.MImagePoint, ptr %83, i32 0, i32 1
  %85 = load float, ptr %84, align 4, !tbaa !14
  %86 = load ptr, ptr %7, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.MImagePoint, ptr %86, i32 0, i32 1
  %88 = load float, ptr %87, align 4, !tbaa !14
  %89 = fsub float %85, %88
  %90 = fdiv float %82, %89
  %91 = fpext float %90 to double
  store double %91, ptr %15, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %92 = load double, ptr %14, align 8, !tbaa !12
  %93 = load double, ptr %15, align 8, !tbaa !12
  %94 = load double, ptr %13, align 8, !tbaa !12
  %95 = fneg double %93
  %96 = call double @llvm.fmuladd.f64(double %95, double %94, double %92)
  store double %96, ptr %16, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %97 = load double, ptr %16, align 8, !tbaa !12
  %98 = load double, ptr %12, align 8, !tbaa !12
  %99 = fsub double %97, %98
  %100 = load double, ptr %11, align 8, !tbaa !12
  %101 = load double, ptr %15, align 8, !tbaa !12
  %102 = fsub double %100, %101
  %103 = fdiv double %99, %102
  store double %103, ptr %17, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %104 = load double, ptr %11, align 8, !tbaa !12
  %105 = load double, ptr %17, align 8, !tbaa !12
  %106 = load double, ptr %12, align 8, !tbaa !12
  %107 = call double @llvm.fmuladd.f64(double %104, double %105, double %106)
  store double %107, ptr %18, align 8, !tbaa !12
  %108 = load double, ptr %17, align 8, !tbaa !12
  %109 = fptrunc double %108 to float
  %110 = load ptr, ptr %8, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.MImageCircle, ptr %110, i32 0, i32 0
  %112 = getelementptr inbounds %struct.MImagePoint, ptr %111, i32 0, i32 0
  store float %109, ptr %112, align 4, !tbaa !15
  %113 = load double, ptr %18, align 8, !tbaa !12
  %114 = fptrunc double %113 to float
  %115 = load ptr, ptr %8, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.MImageCircle, ptr %115, i32 0, i32 0
  %117 = getelementptr inbounds %struct.MImagePoint, ptr %116, i32 0, i32 1
  store float %114, ptr %117, align 4, !tbaa !17
  %118 = load ptr, ptr %8, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.MImageCircle, ptr %118, i32 0, i32 0
  %120 = getelementptr inbounds %struct.MImagePoint, ptr %119, i32 0, i32 0
  %121 = load float, ptr %120, align 4, !tbaa !9
  %122 = load ptr, ptr %6, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.MImagePoint, ptr %122, i32 0, i32 0
  %124 = load float, ptr %123, align 4, !tbaa !9
  %125 = fsub float %121, %124
  %126 = load ptr, ptr %8, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.MImageCircle, ptr %126, i32 0, i32 0
  %128 = getelementptr inbounds %struct.MImagePoint, ptr %127, i32 0, i32 0
  %129 = load float, ptr %128, align 4, !tbaa !9
  %130 = load ptr, ptr %6, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.MImagePoint, ptr %130, i32 0, i32 0
  %132 = load float, ptr %131, align 4, !tbaa !9
  %133 = fsub float %129, %132
  %134 = load ptr, ptr %8, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.MImageCircle, ptr %134, i32 0, i32 0
  %136 = getelementptr inbounds %struct.MImagePoint, ptr %135, i32 0, i32 1
  %137 = load float, ptr %136, align 4, !tbaa !14
  %138 = load ptr, ptr %6, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.MImagePoint, ptr %138, i32 0, i32 1
  %140 = load float, ptr %139, align 4, !tbaa !14
  %141 = fsub float %137, %140
  %142 = load ptr, ptr %8, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.MImageCircle, ptr %142, i32 0, i32 0
  %144 = getelementptr inbounds %struct.MImagePoint, ptr %143, i32 0, i32 1
  %145 = load float, ptr %144, align 4, !tbaa !14
  %146 = load ptr, ptr %6, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.MImagePoint, ptr %146, i32 0, i32 1
  %148 = load float, ptr %147, align 4, !tbaa !14
  %149 = fsub float %145, %148
  %150 = fmul float %141, %149
  %151 = call float @llvm.fmuladd.f32(float %125, float %133, float %150)
  %152 = fpext float %151 to double
  %153 = call double @sqrt(double noundef %152) #4
  %154 = fptrunc double %153 to float
  %155 = load ptr, ptr %8, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.MImageCircle, ptr %155, i32 0, i32 1
  store float %154, ptr %156, align 4, !tbaa !18
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"MImagePoint", !11, i64 0, !11, i64 4}
!11 = !{!"float", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = !{!10, !11, i64 4}
!15 = !{!16, !11, i64 0}
!16 = !{!"MImageCircle", !10, i64 0, !11, i64 8}
!17 = !{!16, !11, i64 4}
!18 = !{!16, !11, i64 8}


; 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 speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #0

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

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @mCircumCircle(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2, ptr nocapture noundef writeonly %3) local_unnamed_addr #1 {
  %5 = load float, ptr %0, align 4, !tbaa !5
  %6 = load float, ptr %1, align 4, !tbaa !5
  %7 = fadd float %5, %6
  %8 = fpext float %7 to double
  %9 = fmul double %8, 5.000000e-01
  %10 = getelementptr inbounds i8, ptr %0, i64 4
  %11 = load float, ptr %10, align 4, !tbaa !10
  %12 = getelementptr inbounds i8, ptr %1, i64 4
  %13 = load float, ptr %12, align 4, !tbaa !10
  %14 = fadd float %11, %13
  %15 = fpext float %14 to double
  %16 = fmul double %15, 5.000000e-01
  %17 = fsub float %13, %11
  %18 = fdiv float %7, %17
  %19 = fpext float %18 to double
  %20 = fneg double %19
  %21 = tail call double @llvm.fmuladd.f64(double %20, double %9, double %16)
  %22 = load float, ptr %2, align 4, !tbaa !5
  %23 = fadd float %6, %22
  %24 = fpext float %23 to double
  %25 = fmul double %24, 5.000000e-01
  %26 = getelementptr inbounds i8, ptr %2, i64 4
  %27 = load float, ptr %26, align 4, !tbaa !10
  %28 = fadd float %13, %27
  %29 = fpext float %28 to double
  %30 = fmul double %29, 5.000000e-01
  %31 = fsub float %13, %27
  %32 = fdiv float %23, %31
  %33 = fpext float %32 to double
  %34 = fneg double %33
  %35 = tail call double @llvm.fmuladd.f64(double %34, double %25, double %30)
  %36 = fsub double %35, %21
  %37 = fsub double %19, %33
  %38 = fdiv double %36, %37
  %39 = tail call double @llvm.fmuladd.f64(double %19, double %38, double %21)
  %40 = fptrunc double %38 to float
  store float %40, ptr %3, align 4, !tbaa !11
  %41 = fptrunc double %39 to float
  %42 = getelementptr inbounds i8, ptr %3, i64 4
  store float %41, ptr %42, align 4, !tbaa !13
  %43 = load float, ptr %1, align 4, !tbaa !5
  %44 = fsub float %40, %43
  %45 = load float, ptr %12, align 4, !tbaa !10
  %46 = fsub float %41, %45
  %47 = fmul float %46, %46
  %48 = tail call float @llvm.fmuladd.f32(float %44, float %44, float %47)
  %sqrt = tail call float @llvm.sqrt.f32(float %48)
  %49 = getelementptr inbounds i8, ptr %3, i64 8
  store float %sqrt, ptr %49, align 4, !tbaa !14
  ret void
}

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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 = !{!"MImagePoint", !7, i64 0, !7, i64 4}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 4}
!11 = !{!12, !7, i64 0}
!12 = !{!"MImageCircle", !6, i64 0, !7, i64 8}
!13 = !{!12, !7, i64 4}
!14 = !{!12, !7, i64 8}


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