; LLVM IR from liminchen/OptCuts :: ext/libigl/external/cgal/src/CGAL_Project/config/testfiles/CGAL_CFG_IEEE_754 (main)

; 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: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z8is_validd(double noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z9is_finited(double noundef) #0

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() #1 {
  %1 = alloca i32, align 4
  %2 = alloca double, align 8
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = alloca i8, align 1
  %6 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #3
  store double 0.000000e+00, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %7 = load double, ptr %2, align 8, !tbaa !5
  %8 = fdiv double 1.000000e+00, %7
  store double %8, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %9 = load double, ptr %2, align 8, !tbaa !5
  %10 = load double, ptr %3, align 8, !tbaa !5
  %11 = fmul double %9, %10
  store double %11, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #3
  store i8 1, ptr %5, align 1, !tbaa !9
  %12 = load i8, ptr %5, align 1, !tbaa !9, !range !11, !noundef !12
  %13 = trunc i8 %12 to i1
  br i1 %13, label %14, label %17

14:                                               ; preds = %0
  %15 = load double, ptr %3, align 8, !tbaa !5
  %16 = call noundef zeroext i1 @_Z8is_validd(double noundef %15)
  br label %17

17:                                               ; preds = %14, %0
  %18 = phi i1 [ false, %0 ], [ %16, %14 ]
  %19 = zext i1 %18 to i8
  store i8 %19, ptr %5, align 1, !tbaa !9
  %20 = load i8, ptr %5, align 1, !tbaa !9, !range !11, !noundef !12
  %21 = trunc i8 %20 to i1
  br i1 %21, label %22, label %26

22:                                               ; preds = %17
  %23 = load double, ptr %4, align 8, !tbaa !5
  %24 = call noundef zeroext i1 @_Z8is_validd(double noundef %23)
  %25 = xor i1 %24, true
  br label %26

26:                                               ; preds = %22, %17
  %27 = phi i1 [ false, %17 ], [ %25, %22 ]
  %28 = zext i1 %27 to i8
  store i8 %28, ptr %5, align 1, !tbaa !9
  %29 = load i8, ptr %5, align 1, !tbaa !9, !range !11, !noundef !12
  %30 = trunc i8 %29 to i1
  br i1 %30, label %31, label %35

31:                                               ; preds = %26
  %32 = load double, ptr %3, align 8, !tbaa !5
  %33 = call noundef zeroext i1 @_Z9is_finited(double noundef %32)
  %34 = xor i1 %33, true
  br label %35

35:                                               ; preds = %31, %26
  %36 = phi i1 [ false, %26 ], [ %34, %31 ]
  %37 = zext i1 %36 to i8
  store i8 %37, ptr %5, align 1, !tbaa !9
  %38 = load i8, ptr %5, align 1, !tbaa !9, !range !11, !noundef !12
  %39 = trunc i8 %38 to i1
  br i1 %39, label %40, label %44

40:                                               ; preds = %35
  %41 = load double, ptr %4, align 8, !tbaa !5
  %42 = call noundef zeroext i1 @_Z9is_finited(double noundef %41)
  %43 = xor i1 %42, true
  br label %44

44:                                               ; preds = %40, %35
  %45 = phi i1 [ false, %35 ], [ %43, %40 ]
  %46 = zext i1 %45 to i8
  store i8 %46, ptr %5, align 1, !tbaa !9
  %47 = load i8, ptr %5, align 1, !tbaa !9, !range !11, !noundef !12
  %48 = trunc i8 %47 to i1
  br i1 %48, label %50, label %49

49:                                               ; preds = %44
  store i32 -1, ptr %1, align 4
  store i32 1, ptr %6, align 4
  br label %51

50:                                               ; preds = %44
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  br label %51

51:                                               ; preds = %50, %49
  call void @llvm.lifetime.end.p0(i64 1, 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 8, ptr %2) #3
  %52 = load i32, ptr %1, align 4
  ret i32 %52
}

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

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

attributes #0 = { mustprogress 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 = { mustprogress norecurse 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 willreturn memory(argmem: readwrite) }
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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}


; 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 nounwind uwtable
declare dso_local noundef zeroext i1 @_Z8is_validd(double noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z9is_finited(double noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef range(i32 -1, 1) i32 @main() local_unnamed_addr #1 {
  %1 = tail call noundef zeroext i1 @_Z8is_validd(double noundef 0x7FF0000000000000)
  br i1 %1, label %2, label %.critedge12.thread

2:                                                ; preds = %0
  %3 = tail call noundef zeroext i1 @_Z8is_validd(double noundef 0x7FF8000000000000)
  br i1 %3, label %.critedge12.thread, label %.critedge

.critedge:                                        ; preds = %2
  %4 = tail call noundef zeroext i1 @_Z9is_finited(double noundef 0x7FF0000000000000)
  br i1 %4, label %.critedge12.thread, label %.critedge12

.critedge12:                                      ; preds = %.critedge
  %5 = tail call noundef zeroext i1 @_Z9is_finited(double noundef 0x7FF8000000000000)
  %spec.select = sext i1 %5 to i32
  br label %.critedge12.thread

.critedge12.thread:                               ; preds = %.critedge12, %2, %0, %.critedge
  %6 = phi i32 [ -1, %.critedge ], [ -1, %0 ], [ -1, %2 ], [ %spec.select, %.critedge12 ]
  ret i32 %6
}

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

!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: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass,TailCallElimPass