; LLVM IR from MIT-SPARK/Kimera-VIO :: third_party/triangle/src (triangle)

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

@epsilon = external dso_local global float, align 4
@splitter = external dso_local global float, align 4
@resulterrbound = external dso_local global float, align 4
@ccwerrboundA = external dso_local global float, align 4
@ccwerrboundB = external dso_local global float, align 4
@ccwerrboundC = external dso_local global float, align 4
@iccerrboundA = external dso_local global float, align 4
@iccerrboundB = external dso_local global float, align 4
@iccerrboundC = external dso_local global float, align 4
@o3derrboundA = external dso_local global float, align 4
@o3derrboundB = external dso_local global float, align 4
@o3derrboundC = external dso_local global float, align 4

; 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 @exactinit() #1 {
  %1 = alloca float, align 4
  %2 = alloca float, align 4
  %3 = alloca float, align 4
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  store i32 1, ptr %4, align 4, !tbaa !5
  store float 5.000000e-01, ptr %1, align 4, !tbaa !9
  store float 1.000000e+00, ptr @epsilon, align 4, !tbaa !9
  store float 1.000000e+00, ptr @splitter, align 4, !tbaa !9
  store float 1.000000e+00, ptr %2, align 4, !tbaa !9
  br label %5

5:                                                ; preds = %34, %0
  %6 = load float, ptr %2, align 4, !tbaa !9
  store float %6, ptr %3, align 4, !tbaa !9
  %7 = load float, ptr %1, align 4, !tbaa !9
  %8 = load float, ptr @epsilon, align 4, !tbaa !9
  %9 = fmul float %8, %7
  store float %9, ptr @epsilon, align 4, !tbaa !9
  %10 = load i32, ptr %4, align 4, !tbaa !5
  %11 = icmp ne i32 %10, 0
  br i1 %11, label %12, label %17

12:                                               ; preds = %5
  %13 = load float, ptr @splitter, align 4, !tbaa !9
  %14 = fpext float %13 to double
  %15 = fmul double %14, 2.000000e+00
  %16 = fptrunc double %15 to float
  store float %16, ptr @splitter, align 4, !tbaa !9
  br label %17

17:                                               ; preds = %12, %5
  %18 = load i32, ptr %4, align 4, !tbaa !5
  %19 = icmp ne i32 %18, 0
  %20 = xor i1 %19, true
  %21 = zext i1 %20 to i32
  store i32 %21, ptr %4, align 4, !tbaa !5
  %22 = load float, ptr @epsilon, align 4, !tbaa !9
  %23 = fpext float %22 to double
  %24 = fadd double 1.000000e+00, %23
  %25 = fptrunc double %24 to float
  store float %25, ptr %2, align 4, !tbaa !9
  br label %26

26:                                               ; preds = %17
  %27 = load float, ptr %2, align 4, !tbaa !9
  %28 = fpext float %27 to double
  %29 = fcmp une double %28, 1.000000e+00
  br i1 %29, label %30, label %34

30:                                               ; preds = %26
  %31 = load float, ptr %2, align 4, !tbaa !9
  %32 = load float, ptr %3, align 4, !tbaa !9
  %33 = fcmp une float %31, %32
  br label %34

34:                                               ; preds = %30, %26
  %35 = phi i1 [ false, %26 ], [ %33, %30 ]
  br i1 %35, label %5, label %36, !llvm.loop !11

36:                                               ; preds = %34
  %37 = load float, ptr @splitter, align 4, !tbaa !9
  %38 = fpext float %37 to double
  %39 = fadd double %38, 1.000000e+00
  %40 = fptrunc double %39 to float
  store float %40, ptr @splitter, align 4, !tbaa !9
  %41 = load float, ptr @epsilon, align 4, !tbaa !9
  %42 = fpext float %41 to double
  %43 = call double @llvm.fmuladd.f64(double 8.000000e+00, double %42, double 3.000000e+00)
  %44 = load float, ptr @epsilon, align 4, !tbaa !9
  %45 = fpext float %44 to double
  %46 = fmul double %43, %45
  %47 = fptrunc double %46 to float
  store float %47, ptr @resulterrbound, align 4, !tbaa !9
  %48 = load float, ptr @epsilon, align 4, !tbaa !9
  %49 = fpext float %48 to double
  %50 = call double @llvm.fmuladd.f64(double 1.600000e+01, double %49, double 3.000000e+00)
  %51 = load float, ptr @epsilon, align 4, !tbaa !9
  %52 = fpext float %51 to double
  %53 = fmul double %50, %52
  %54 = fptrunc double %53 to float
  store float %54, ptr @ccwerrboundA, align 4, !tbaa !9
  %55 = load float, ptr @epsilon, align 4, !tbaa !9
  %56 = fpext float %55 to double
  %57 = call double @llvm.fmuladd.f64(double 1.200000e+01, double %56, double 2.000000e+00)
  %58 = load float, ptr @epsilon, align 4, !tbaa !9
  %59 = fpext float %58 to double
  %60 = fmul double %57, %59
  %61 = fptrunc double %60 to float
  store float %61, ptr @ccwerrboundB, align 4, !tbaa !9
  %62 = load float, ptr @epsilon, align 4, !tbaa !9
  %63 = fpext float %62 to double
  %64 = call double @llvm.fmuladd.f64(double 6.400000e+01, double %63, double 9.000000e+00)
  %65 = load float, ptr @epsilon, align 4, !tbaa !9
  %66 = fpext float %65 to double
  %67 = fmul double %64, %66
  %68 = load float, ptr @epsilon, align 4, !tbaa !9
  %69 = fpext float %68 to double
  %70 = fmul double %67, %69
  %71 = fptrunc double %70 to float
  store float %71, ptr @ccwerrboundC, align 4, !tbaa !9
  %72 = load float, ptr @epsilon, align 4, !tbaa !9
  %73 = fpext float %72 to double
  %74 = call double @llvm.fmuladd.f64(double 9.600000e+01, double %73, double 1.000000e+01)
  %75 = load float, ptr @epsilon, align 4, !tbaa !9
  %76 = fpext float %75 to double
  %77 = fmul double %74, %76
  %78 = fptrunc double %77 to float
  store float %78, ptr @iccerrboundA, align 4, !tbaa !9
  %79 = load float, ptr @epsilon, align 4, !tbaa !9
  %80 = fpext float %79 to double
  %81 = call double @llvm.fmuladd.f64(double 4.800000e+01, double %80, double 4.000000e+00)
  %82 = load float, ptr @epsilon, align 4, !tbaa !9
  %83 = fpext float %82 to double
  %84 = fmul double %81, %83
  %85 = fptrunc double %84 to float
  store float %85, ptr @iccerrboundB, align 4, !tbaa !9
  %86 = load float, ptr @epsilon, align 4, !tbaa !9
  %87 = fpext float %86 to double
  %88 = call double @llvm.fmuladd.f64(double 5.760000e+02, double %87, double 4.400000e+01)
  %89 = load float, ptr @epsilon, align 4, !tbaa !9
  %90 = fpext float %89 to double
  %91 = fmul double %88, %90
  %92 = load float, ptr @epsilon, align 4, !tbaa !9
  %93 = fpext float %92 to double
  %94 = fmul double %91, %93
  %95 = fptrunc double %94 to float
  store float %95, ptr @iccerrboundC, align 4, !tbaa !9
  %96 = load float, ptr @epsilon, align 4, !tbaa !9
  %97 = fpext float %96 to double
  %98 = call double @llvm.fmuladd.f64(double 5.600000e+01, double %97, double 7.000000e+00)
  %99 = load float, ptr @epsilon, align 4, !tbaa !9
  %100 = fpext float %99 to double
  %101 = fmul double %98, %100
  %102 = fptrunc double %101 to float
  store float %102, ptr @o3derrboundA, align 4, !tbaa !9
  %103 = load float, ptr @epsilon, align 4, !tbaa !9
  %104 = fpext float %103 to double
  %105 = call double @llvm.fmuladd.f64(double 2.800000e+01, double %104, double 3.000000e+00)
  %106 = load float, ptr @epsilon, align 4, !tbaa !9
  %107 = fpext float %106 to double
  %108 = fmul double %105, %107
  %109 = fptrunc double %108 to float
  store float %109, ptr @o3derrboundB, align 4, !tbaa !9
  %110 = load float, ptr @epsilon, align 4, !tbaa !9
  %111 = fpext float %110 to double
  %112 = call double @llvm.fmuladd.f64(double 2.880000e+02, double %111, double 2.600000e+01)
  %113 = load float, ptr @epsilon, align 4, !tbaa !9
  %114 = fpext float %113 to double
  %115 = fmul double %112, %114
  %116 = load float, ptr @epsilon, align 4, !tbaa !9
  %117 = fpext float %116 to double
  %118 = fmul double %115, %117
  %119 = fptrunc double %118 to float
  store float %119, ptr @o3derrboundC, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #3
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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

@epsilon = external dso_local local_unnamed_addr global float, align 4
@splitter = external dso_local local_unnamed_addr global float, align 4
@resulterrbound = external dso_local local_unnamed_addr global float, align 4
@ccwerrboundA = external dso_local local_unnamed_addr global float, align 4
@ccwerrboundB = external dso_local local_unnamed_addr global float, align 4
@ccwerrboundC = external dso_local local_unnamed_addr global float, align 4
@iccerrboundA = external dso_local local_unnamed_addr global float, align 4
@iccerrboundB = external dso_local local_unnamed_addr global float, align 4
@iccerrboundC = external dso_local local_unnamed_addr global float, align 4
@o3derrboundA = external dso_local local_unnamed_addr global float, align 4
@o3derrboundB = external dso_local local_unnamed_addr global float, align 4
@o3derrboundC = external dso_local local_unnamed_addr global float, align 4

; Function Attrs: nofree norecurse nosync nounwind memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @exactinit() local_unnamed_addr #0 {
  br label %1

1:                                                ; preds = %1, %0
  %2 = phi float [ 1.000000e+00, %0 ], [ %6, %1 ]
  %3 = phi float [ 1.000000e+00, %0 ], [ %4, %1 ]
  %.06 = phi float [ 1.000000e+00, %0 ], [ %8, %1 ]
  %.0 = phi i32 [ 1, %0 ], [ %7, %1 ]
  %4 = fmul float %3, 5.000000e-01
  %.not = icmp eq i32 %.0, 0
  %5 = fmul float %2, 2.000000e+00
  %6 = select i1 %.not, float %2, float %5
  %7 = xor i32 %.0, 1
  %8 = fadd float %4, 1.000000e+00
  %9 = fcmp une float %8, 1.000000e+00
  %10 = fcmp une float %8, %.06
  %11 = and i1 %9, %10
  br i1 %11, label %1, label %12, !llvm.loop !5

12:                                               ; preds = %1
  store float %4, ptr @epsilon, align 4, !tbaa !7
  %13 = fadd float %6, 1.000000e+00
  store float %13, ptr @splitter, align 4, !tbaa !7
  %14 = fpext float %4 to double
  %15 = tail call double @llvm.fmuladd.f64(double %14, double 8.000000e+00, double 3.000000e+00)
  %16 = fmul double %15, %14
  %17 = fptrunc double %16 to float
  store float %17, ptr @resulterrbound, align 4, !tbaa !7
  %18 = tail call double @llvm.fmuladd.f64(double %14, double 1.600000e+01, double 3.000000e+00)
  %19 = fmul double %18, %14
  %20 = fptrunc double %19 to float
  store float %20, ptr @ccwerrboundA, align 4, !tbaa !7
  %21 = tail call double @llvm.fmuladd.f64(double %14, double 1.200000e+01, double 2.000000e+00)
  %22 = fmul double %21, %14
  %23 = fptrunc double %22 to float
  store float %23, ptr @ccwerrboundB, align 4, !tbaa !7
  %24 = tail call double @llvm.fmuladd.f64(double %14, double 6.400000e+01, double 9.000000e+00)
  %25 = fmul double %24, %14
  %26 = fmul double %25, %14
  %27 = fptrunc double %26 to float
  store float %27, ptr @ccwerrboundC, align 4, !tbaa !7
  %28 = tail call double @llvm.fmuladd.f64(double %14, double 9.600000e+01, double 1.000000e+01)
  %29 = fmul double %28, %14
  %30 = fptrunc double %29 to float
  store float %30, ptr @iccerrboundA, align 4, !tbaa !7
  %31 = tail call double @llvm.fmuladd.f64(double %14, double 4.800000e+01, double 4.000000e+00)
  %32 = fmul double %31, %14
  %33 = fptrunc double %32 to float
  store float %33, ptr @iccerrboundB, align 4, !tbaa !7
  %34 = tail call double @llvm.fmuladd.f64(double %14, double 5.760000e+02, double 4.400000e+01)
  %35 = fmul double %34, %14
  %36 = fmul double %35, %14
  %37 = fptrunc double %36 to float
  store float %37, ptr @iccerrboundC, align 4, !tbaa !7
  %38 = tail call double @llvm.fmuladd.f64(double %14, double 5.600000e+01, double 7.000000e+00)
  %39 = fmul double %38, %14
  %40 = fptrunc double %39 to float
  store float %40, ptr @o3derrboundA, align 4, !tbaa !7
  %41 = tail call double @llvm.fmuladd.f64(double %14, double 2.800000e+01, double 3.000000e+00)
  %42 = fmul double %41, %14
  %43 = fptrunc double %42 to float
  store float %43, ptr @o3derrboundB, align 4, !tbaa !7
  %44 = tail call double @llvm.fmuladd.f64(double %14, double 2.880000e+02, double 2.600000e+01)
  %45 = fmul double %44, %14
  %46 = fmul double %45, %14
  %47 = fptrunc double %46 to float
  store float %47, ptr @o3derrboundC, align 4, !tbaa !7
  ret void
}

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

attributes #0 = { nofree norecurse nosync nounwind memory(write, argmem: none, inaccessiblemem: none) 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 = { mustprogress 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"float", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass