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

; Function Attrs: nounwind
declare i64 @random() #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 float @floatrand() #2 {
  %1 = alloca float, align 4
  %2 = alloca float, align 4
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  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 8, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %6 = call i64 @random() #3
  store i64 %6, ptr %3, align 8, !tbaa !5
  %7 = call i64 @random() #3
  store i64 %7, ptr %4, align 8, !tbaa !5
  %8 = load i64, ptr %3, align 8, !tbaa !5
  %9 = sub nsw i64 %8, 1073741824
  %10 = ashr i64 %9, 6
  %11 = sitofp i64 %10 to float
  store float %11, ptr %1, align 4, !tbaa !9
  store i64 512, ptr %5, align 8, !tbaa !5
  store float 2.000000e+00, ptr %2, align 4, !tbaa !9
  br label %12

12:                                               ; preds = %25, %0
  %13 = load i64, ptr %5, align 8, !tbaa !5
  %14 = icmp sle i64 %13, 16384
  br i1 %14, label %15, label %31

15:                                               ; preds = %12
  %16 = load i64, ptr %4, align 8, !tbaa !5
  %17 = load i64, ptr %5, align 8, !tbaa !5
  %18 = and i64 %16, %17
  %19 = icmp ne i64 %18, 0
  br i1 %19, label %20, label %24

20:                                               ; preds = %15
  %21 = load float, ptr %2, align 4, !tbaa !9
  %22 = load float, ptr %1, align 4, !tbaa !9
  %23 = fmul float %22, %21
  store float %23, ptr %1, align 4, !tbaa !9
  br label %24

24:                                               ; preds = %20, %15
  br label %25

25:                                               ; preds = %24
  %26 = load i64, ptr %5, align 8, !tbaa !5
  %27 = mul nsw i64 %26, 2
  store i64 %27, ptr %5, align 8, !tbaa !5
  %28 = load float, ptr %2, align 4, !tbaa !9
  %29 = load float, ptr %2, align 4, !tbaa !9
  %30 = fmul float %28, %29
  store float %30, ptr %2, align 4, !tbaa !9
  br label %12, !llvm.loop !11

31:                                               ; preds = %12
  %32 = load float, ptr %1, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, 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 float %32
}

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

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

; Function Attrs: nounwind uwtable
define dso_local float @floatrand() local_unnamed_addr #1 {
  %1 = tail call i64 @random() #2
  %2 = tail call i64 @random() #2
  %3 = add nsw i64 %1, -1073741824
  %4 = ashr i64 %3, 6
  %5 = sitofp i64 %4 to float
  %6 = and i64 %2, 512
  %.not = icmp eq i64 %6, 0
  %7 = fmul float %5, 2.000000e+00
  %.1 = select i1 %.not, float %5, float %7
  %8 = and i64 %2, 1024
  %.not.1 = icmp eq i64 %8, 0
  %9 = fmul float %.1, 4.000000e+00
  %.1.1 = select i1 %.not.1, float %.1, float %9
  %10 = and i64 %2, 2048
  %.not.2 = icmp eq i64 %10, 0
  %11 = fmul float %.1.1, 1.600000e+01
  %.1.2 = select i1 %.not.2, float %.1.1, float %11
  %12 = and i64 %2, 4096
  %.not.3 = icmp eq i64 %12, 0
  %13 = fmul float %.1.2, 2.560000e+02
  %.1.3 = select i1 %.not.3, float %.1.2, float %13
  %14 = and i64 %2, 8192
  %.not.4 = icmp eq i64 %14, 0
  %15 = fmul float %.1.3, 6.553600e+04
  %.1.4 = select i1 %.not.4, float %.1.3, float %15
  %16 = and i64 %2, 16384
  %.not.5 = icmp eq i64 %16, 0
  %17 = fmul float %.1.4, 0x41F0000000000000
  %.1.5 = select i1 %.not.5, float %.1.4, float %17
  ret float %.1.5
}

attributes #0 = { 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 #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 = { 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