; LLVM IR from Samson-Mano/EM_Propogation_simulation :: EM_Propogation_simulation/src/ImGui/implot.ll (ZN6ImPlot7NiceNumEdb)

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

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN6ImPlot7NiceNumEdb(double noundef %0, i1 noundef zeroext %1) #1 {
  %3 = alloca double, align 8
  %4 = alloca i8, align 1
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca i32, align 4
  store double %0, ptr %3, align 8, !tbaa !5
  %8 = zext i1 %1 to i8
  store i8 %8, ptr %4, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %9 = load double, ptr %3, align 8, !tbaa !5
  %10 = call noundef double @_ZL7ImLog10d(double noundef %9)
  %11 = call double @llvm.floor.f64(double %10)
  %12 = fptosi double %11 to i32
  store i32 %12, ptr %7, align 4, !tbaa !11
  %13 = load double, ptr %3, align 8, !tbaa !5
  %14 = load i32, ptr %7, align 4, !tbaa !11
  %15 = sitofp i32 %14 to double
  %16 = call noundef double @_ZL5ImPowdd(double noundef 1.000000e+01, double noundef %15)
  %17 = fdiv double %13, %16
  store double %17, ptr %5, align 8, !tbaa !5
  %18 = load i8, ptr %4, align 1, !tbaa !9, !range !13, !noundef !14
  %19 = trunc i8 %18 to i1
  br i1 %19, label %20, label %36

20:                                               ; preds = %2
  %21 = load double, ptr %5, align 8, !tbaa !5
  %22 = fcmp olt double %21, 1.500000e+00
  br i1 %22, label %23, label %24

23:                                               ; preds = %20
  store double 1.000000e+00, ptr %6, align 8, !tbaa !5
  br label %35

24:                                               ; preds = %20
  %25 = load double, ptr %5, align 8, !tbaa !5
  %26 = fcmp olt double %25, 3.000000e+00
  br i1 %26, label %27, label %28

27:                                               ; preds = %24
  store double 2.000000e+00, ptr %6, align 8, !tbaa !5
  br label %34

28:                                               ; preds = %24
  %29 = load double, ptr %5, align 8, !tbaa !5
  %30 = fcmp olt double %29, 7.000000e+00
  br i1 %30, label %31, label %32

31:                                               ; preds = %28
  store double 5.000000e+00, ptr %6, align 8, !tbaa !5
  br label %33

32:                                               ; preds = %28
  store double 1.000000e+01, ptr %6, align 8, !tbaa !5
  br label %33

33:                                               ; preds = %32, %31
  br label %34

34:                                               ; preds = %33, %27
  br label %35

35:                                               ; preds = %34, %23
  br label %52

36:                                               ; preds = %2
  %37 = load double, ptr %5, align 8, !tbaa !5
  %38 = fcmp ole double %37, 1.000000e+00
  br i1 %38, label %39, label %40

39:                                               ; preds = %36
  store double 1.000000e+00, ptr %6, align 8, !tbaa !5
  br label %51

40:                                               ; preds = %36
  %41 = load double, ptr %5, align 8, !tbaa !5
  %42 = fcmp ole double %41, 2.000000e+00
  br i1 %42, label %43, label %44

43:                                               ; preds = %40
  store double 2.000000e+00, ptr %6, align 8, !tbaa !5
  br label %50

44:                                               ; preds = %40
  %45 = load double, ptr %5, align 8, !tbaa !5
  %46 = fcmp ole double %45, 5.000000e+00
  br i1 %46, label %47, label %48

47:                                               ; preds = %44
  store double 5.000000e+00, ptr %6, align 8, !tbaa !5
  br label %49

48:                                               ; preds = %44
  store double 1.000000e+01, ptr %6, align 8, !tbaa !5
  br label %49

49:                                               ; preds = %48, %47
  br label %50

50:                                               ; preds = %49, %43
  br label %51

51:                                               ; preds = %50, %39
  br label %52

52:                                               ; preds = %51, %35
  %53 = load double, ptr %6, align 8, !tbaa !5
  %54 = load i32, ptr %7, align 4, !tbaa !11
  %55 = sitofp i32 %54 to double
  %56 = call noundef double @_ZL5ImPowdd(double noundef 1.000000e+01, double noundef %55)
  %57 = fmul double %53, %56
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret double %57
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef double @_ZL7ImLog10d(double noundef) #2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef double @_ZL5ImPowdd(double noundef, double noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 = { inlinehint 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 #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 = !{!"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 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}


; 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
define dso_local noundef double @_ZN6ImPlot7NiceNumEdb(double noundef %0, i1 noundef zeroext %1) local_unnamed_addr #0 {
  %3 = tail call noundef double @_ZL7ImLog10d(double noundef %0)
  %4 = tail call double @llvm.floor.f64(double %3)
  %5 = fptosi double %4 to i32
  %6 = sitofp i32 %5 to double
  %7 = tail call noundef double @_ZL5ImPowdd(double noundef 1.000000e+01, double noundef %6)
  %8 = fdiv double %0, %7
  br i1 %1, label %9, label %15

9:                                                ; preds = %2
  %10 = fcmp olt double %8, 1.500000e+00
  br i1 %10, label %21, label %11

11:                                               ; preds = %9
  %12 = fcmp olt double %8, 3.000000e+00
  br i1 %12, label %21, label %13

13:                                               ; preds = %11
  %14 = fcmp olt double %8, 7.000000e+00
  %. = select i1 %14, double 5.000000e+00, double 1.000000e+01
  br label %21

15:                                               ; preds = %2
  %16 = fcmp ugt double %8, 1.000000e+00
  br i1 %16, label %17, label %21

17:                                               ; preds = %15
  %18 = fcmp ugt double %8, 2.000000e+00
  br i1 %18, label %19, label %21

19:                                               ; preds = %17
  %20 = fcmp ugt double %8, 5.000000e+00
  %.12 = select i1 %20, double 1.000000e+01, double 5.000000e+00
  br label %21

21:                                               ; preds = %19, %17, %15, %13, %11, %9
  %.0 = phi double [ 1.000000e+00, %9 ], [ 2.000000e+00, %11 ], [ %., %13 ], [ 1.000000e+00, %15 ], [ 2.000000e+00, %17 ], [ %.12, %19 ]
  %22 = tail call noundef double @_ZL5ImPowdd(double noundef 1.000000e+01, double noundef %6)
  %23 = fmul double %.0, %22
  ret double %23
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef double @_ZL7ImLog10d(double noundef) local_unnamed_addr #1

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef double @_ZL5ImPowdd(double noundef, double noundef) local_unnamed_addr #1

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 = { inlinehint 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 #2 = { 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)"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass