; LLVM IR from bohanwang/libpgo :: src/core/mesh (predicates_Shewchuk)

; 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: nounwind uwtable
define dso_local double @doublerand() #0 {
  %1 = alloca double, align 8
  %2 = alloca double, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %7 = call i64 @random() #4
  store i64 %7, ptr %3, align 8, !tbaa !5
  %8 = call i64 @random() #4
  store i64 %8, ptr %4, align 8, !tbaa !5
  %9 = call i64 @random() #4
  store i64 %9, ptr %5, align 8, !tbaa !5
  %10 = load i64, ptr %3, align 8, !tbaa !5
  %11 = sub nsw i64 %10, 1073741824
  %12 = sitofp i64 %11 to double
  %13 = load i64, ptr %4, align 8, !tbaa !5
  %14 = ashr i64 %13, 8
  %15 = sitofp i64 %14 to double
  %16 = call double @llvm.fmuladd.f64(double %12, double 0x4160000000000000, double %15)
  store double %16, ptr %1, align 8, !tbaa !9
  store i64 512, ptr %6, align 8, !tbaa !5
  store double 2.000000e+00, ptr %2, align 8, !tbaa !9
  br label %17

17:                                               ; preds = %30, %0
  %18 = load i64, ptr %6, align 8, !tbaa !5
  %19 = icmp sle i64 %18, 131072
  br i1 %19, label %20, label %36

20:                                               ; preds = %17
  %21 = load i64, ptr %5, align 8, !tbaa !5
  %22 = load i64, ptr %6, align 8, !tbaa !5
  %23 = and i64 %21, %22
  %24 = icmp ne i64 %23, 0
  br i1 %24, label %25, label %29

25:                                               ; preds = %20
  %26 = load double, ptr %2, align 8, !tbaa !9
  %27 = load double, ptr %1, align 8, !tbaa !9
  %28 = fmul double %27, %26
  store double %28, ptr %1, align 8, !tbaa !9
  br label %29

29:                                               ; preds = %25, %20
  br label %30

30:                                               ; preds = %29
  %31 = load i64, ptr %6, align 8, !tbaa !5
  %32 = mul nsw i64 %31, 2
  store i64 %32, ptr %6, align 8, !tbaa !5
  %33 = load double, ptr %2, align 8, !tbaa !9
  %34 = load double, ptr %2, align 8, !tbaa !9
  %35 = fmul double %33, %34
  store double %35, ptr %2, align 8, !tbaa !9
  br label %17, !llvm.loop !11

36:                                               ; preds = %17
  %37 = load double, ptr %1, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #4
  ret double %37
}

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

; Function Attrs: nounwind
declare i64 @random() #2

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

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

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

; Function Attrs: nounwind uwtable
define dso_local double @doublerand() local_unnamed_addr #0 {
  %1 = tail call i64 @random() #3
  %2 = tail call i64 @random() #3
  %3 = tail call i64 @random() #3
  %4 = add nsw i64 %1, -1073741824
  %5 = sitofp i64 %4 to double
  %6 = ashr i64 %2, 8
  %7 = sitofp i64 %6 to double
  %8 = tail call double @llvm.fmuladd.f64(double %5, double 0x4160000000000000, double %7)
  %9 = and i64 %3, 512
  %.not = icmp eq i64 %9, 0
  %10 = fmul double %8, 2.000000e+00
  %.1 = select i1 %.not, double %8, double %10
  %11 = and i64 %3, 1024
  %.not.1 = icmp eq i64 %11, 0
  %12 = fmul double %.1, 4.000000e+00
  %.1.1 = select i1 %.not.1, double %.1, double %12
  %13 = and i64 %3, 2048
  %.not.2 = icmp eq i64 %13, 0
  %14 = fmul double %.1.1, 1.600000e+01
  %.1.2 = select i1 %.not.2, double %.1.1, double %14
  %15 = and i64 %3, 4096
  %.not.3 = icmp eq i64 %15, 0
  %16 = fmul double %.1.2, 2.560000e+02
  %.1.3 = select i1 %.not.3, double %.1.2, double %16
  %17 = and i64 %3, 8192
  %.not.4 = icmp eq i64 %17, 0
  %18 = fmul double %.1.3, 6.553600e+04
  %.1.4 = select i1 %.not.4, double %.1.3, double %18
  %19 = and i64 %3, 16384
  %.not.5 = icmp eq i64 %19, 0
  %20 = fmul double %.1.4, 0x41F0000000000000
  %.1.5 = select i1 %.not.5, double %.1.4, double %20
  %21 = and i64 %3, 32768
  %.not.6 = icmp eq i64 %21, 0
  %22 = fmul double %.1.5, 0x43F0000000000000
  %.1.6 = select i1 %.not.6, double %.1.5, double %22
  %23 = and i64 %3, 65536
  %.not.7 = icmp eq i64 %23, 0
  %24 = fmul double %.1.6, 0x47F0000000000000
  %.1.7 = select i1 %.not.7, double %.1.6, double %24
  %25 = and i64 %3, 131072
  %.not.8 = icmp eq i64 %25, 0
  %26 = fmul double %.1.7, 0x4FF0000000000000
  %.1.8 = select i1 %.not.8, double %.1.7, double %26
  ret double %.1.8
}

; Function Attrs: nounwind
declare i64 @random() local_unnamed_addr #1

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

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress 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)"}


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