; LLVM IR from ETH3D/dataset-pipeline :: thirdparty/cork/cork/isct (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 double, align 8
@splitter = external dso_local global double, align 8
@resulterrbound = external dso_local global double, align 8
@ccwerrboundA = external dso_local global double, align 8
@ccwerrboundB = external dso_local global double, align 8
@ccwerrboundC = external dso_local global double, align 8
@iccerrboundA = external dso_local global double, align 8
@iccerrboundB = external dso_local global double, align 8
@iccerrboundC = external dso_local global double, align 8
@o3derrboundA = external dso_local global double, align 8
@o3derrboundB = external dso_local global double, align 8
@o3derrboundC = external dso_local global double, align 8

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

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

12:                                               ; preds = %5
  %13 = load double, ptr @splitter, align 8, !tbaa !9
  %14 = fmul double %13, 2.000000e+00
  store double %14, ptr @splitter, align 8, !tbaa !9
  br label %15

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

22:                                               ; preds = %15
  %23 = load double, ptr %2, align 8, !tbaa !9
  %24 = fcmp une double %23, 1.000000e+00
  br i1 %24, label %25, label %29

25:                                               ; preds = %22
  %26 = load double, ptr %2, align 8, !tbaa !9
  %27 = load double, ptr %3, align 8, !tbaa !9
  %28 = fcmp une double %26, %27
  br label %29

29:                                               ; preds = %25, %22
  %30 = phi i1 [ false, %22 ], [ %28, %25 ]
  br i1 %30, label %5, label %31, !llvm.loop !11

31:                                               ; preds = %29
  %32 = load double, ptr @splitter, align 8, !tbaa !9
  %33 = fadd double %32, 1.000000e+00
  store double %33, ptr @splitter, align 8, !tbaa !9
  %34 = load double, ptr @epsilon, align 8, !tbaa !9
  %35 = call double @llvm.fmuladd.f64(double 8.000000e+00, double %34, double 3.000000e+00)
  %36 = load double, ptr @epsilon, align 8, !tbaa !9
  %37 = fmul double %35, %36
  store double %37, ptr @resulterrbound, align 8, !tbaa !9
  %38 = load double, ptr @epsilon, align 8, !tbaa !9
  %39 = call double @llvm.fmuladd.f64(double 1.600000e+01, double %38, double 3.000000e+00)
  %40 = load double, ptr @epsilon, align 8, !tbaa !9
  %41 = fmul double %39, %40
  store double %41, ptr @ccwerrboundA, align 8, !tbaa !9
  %42 = load double, ptr @epsilon, align 8, !tbaa !9
  %43 = call double @llvm.fmuladd.f64(double 1.200000e+01, double %42, double 2.000000e+00)
  %44 = load double, ptr @epsilon, align 8, !tbaa !9
  %45 = fmul double %43, %44
  store double %45, ptr @ccwerrboundB, align 8, !tbaa !9
  %46 = load double, ptr @epsilon, align 8, !tbaa !9
  %47 = call double @llvm.fmuladd.f64(double 6.400000e+01, double %46, double 9.000000e+00)
  %48 = load double, ptr @epsilon, align 8, !tbaa !9
  %49 = fmul double %47, %48
  %50 = load double, ptr @epsilon, align 8, !tbaa !9
  %51 = fmul double %49, %50
  store double %51, ptr @ccwerrboundC, align 8, !tbaa !9
  %52 = load double, ptr @epsilon, align 8, !tbaa !9
  %53 = call double @llvm.fmuladd.f64(double 9.600000e+01, double %52, double 1.000000e+01)
  %54 = load double, ptr @epsilon, align 8, !tbaa !9
  %55 = fmul double %53, %54
  store double %55, ptr @iccerrboundA, align 8, !tbaa !9
  %56 = load double, ptr @epsilon, align 8, !tbaa !9
  %57 = call double @llvm.fmuladd.f64(double 4.800000e+01, double %56, double 4.000000e+00)
  %58 = load double, ptr @epsilon, align 8, !tbaa !9
  %59 = fmul double %57, %58
  store double %59, ptr @iccerrboundB, align 8, !tbaa !9
  %60 = load double, ptr @epsilon, align 8, !tbaa !9
  %61 = call double @llvm.fmuladd.f64(double 5.760000e+02, double %60, double 4.400000e+01)
  %62 = load double, ptr @epsilon, align 8, !tbaa !9
  %63 = fmul double %61, %62
  %64 = load double, ptr @epsilon, align 8, !tbaa !9
  %65 = fmul double %63, %64
  store double %65, ptr @iccerrboundC, align 8, !tbaa !9
  %66 = load double, ptr @epsilon, align 8, !tbaa !9
  %67 = call double @llvm.fmuladd.f64(double 5.600000e+01, double %66, double 7.000000e+00)
  %68 = load double, ptr @epsilon, align 8, !tbaa !9
  %69 = fmul double %67, %68
  store double %69, ptr @o3derrboundA, align 8, !tbaa !9
  %70 = load double, ptr @epsilon, align 8, !tbaa !9
  %71 = call double @llvm.fmuladd.f64(double 2.800000e+01, double %70, double 3.000000e+00)
  %72 = load double, ptr @epsilon, align 8, !tbaa !9
  %73 = fmul double %71, %72
  store double %73, ptr @o3derrboundB, align 8, !tbaa !9
  %74 = load double, ptr @epsilon, align 8, !tbaa !9
  %75 = call double @llvm.fmuladd.f64(double 2.880000e+02, double %74, double 2.600000e+01)
  %76 = load double, ptr @epsilon, align 8, !tbaa !9
  %77 = fmul double %75, %76
  %78 = load double, ptr @epsilon, align 8, !tbaa !9
  %79 = fmul double %77, %78
  store double %79, ptr @o3derrboundC, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #3
  ret void
}

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 }

!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 = !{!"double", !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 double, align 8
@splitter = external dso_local local_unnamed_addr global double, align 8
@resulterrbound = external dso_local local_unnamed_addr global double, align 8
@ccwerrboundA = external dso_local local_unnamed_addr global double, align 8
@ccwerrboundB = external dso_local local_unnamed_addr global double, align 8
@ccwerrboundC = external dso_local local_unnamed_addr global double, align 8
@iccerrboundA = external dso_local local_unnamed_addr global double, align 8
@iccerrboundB = external dso_local local_unnamed_addr global double, align 8
@iccerrboundC = external dso_local local_unnamed_addr global double, align 8
@o3derrboundA = external dso_local local_unnamed_addr global double, align 8
@o3derrboundB = external dso_local local_unnamed_addr global double, align 8
@o3derrboundC = external dso_local local_unnamed_addr global double, align 8

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

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

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

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

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

!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 = !{!"double", !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