; LLVM IR from gem5/gem5 :: ext/dsent/libutil (Calculator)

; 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"

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.LibUtil::String" = type { %"class.std::__cxx11::basic_string" }
%"class.LibUtil::Calculator" = type { ptr, %"class.LibUtil::String", %"class.LibUtil::Map", i32, double, %"class.LibUtil::String" }
%"class.LibUtil::Map" = type { ptr, %"class.std::map" }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<LibUtil::String, std::pair<const LibUtil::String, double>, std::_Select1st<std::pair<const LibUtil::String, double>>, std::less<LibUtil::String>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<LibUtil::String, std::pair<const LibUtil::String, double>, std::_Select1st<std::pair<const LibUtil::String, double>>, std::less<LibUtil::String>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }

@.str.4 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [75 x i8], align 1
@_ZTIN7LibUtil9ExceptionE = external constant ptr
@.str.11 = external hidden unnamed_addr constant [21 x i8], align 1

declare i32 @__gxx_personality_v0(...)

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

declare void @_ZN7LibUtil6StringC1EPKc(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) unnamed_addr #1

; Function Attrs: nounwind
declare void @_ZN7LibUtil6StringD1Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEOS8_S9_(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #4

declare void @_ZN7LibUtil6String6formatERKS0_z(ptr dead_on_unwind writable sret(%"class.LibUtil::String") align 8, ptr noundef nonnull align 8 dereferenceable(32), ...) #1

declare void @_ZN7LibUtil6StringC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1

declare ptr @__cxa_allocate_exception(i64)

; Function Attrs: nounwind
declare void @_ZN7LibUtil9ExceptionC1ERKNS_6StringE(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2

; Function Attrs: nounwind
declare void @_ZN7LibUtil9ExceptionD1Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #2

declare void @__cxa_throw(ptr, ptr, ptr)

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZN7LibUtil10Calculator4primERNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEEEbRKSt3mapINS_6StringES9_St4lessIS9_ESaISt4pairIKS9_S9_EEEPN5DSENT5ModelE(ptr noundef nonnull align 8 dereferenceable(144), ptr noundef nonnull align 8 dereferenceable(120), i1 noundef zeroext, ptr noundef nonnull align 8 dereferenceable(48), ptr noundef) #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN7LibUtil10Calculator4termERNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEEEbRKSt3mapINS_6StringES9_St4lessIS9_ESaISt4pairIKS9_S9_EEEPN5DSENT5ModelE(ptr noundef nonnull align 8 dereferenceable(144) %0, ptr noundef nonnull align 8 dereferenceable(120) %1, i1 noundef zeroext %2, ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef %4) #5 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca double, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i8, align 1
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca ptr, align 8
  %15 = alloca %"class.LibUtil::String", align 8
  %16 = alloca %"class.std::__cxx11::basic_string", align 8
  %17 = alloca %"class.LibUtil::String", align 8
  %18 = alloca %"class.LibUtil::String", align 8
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca %"class.LibUtil::String", align 8
  %22 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  %23 = zext i1 %2 to i8
  store i8 %23, ptr %9, align 1, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  %24 = load ptr, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %25 = load ptr, ptr %8, align 8, !tbaa !5
  %26 = load i8, ptr %9, align 1, !tbaa !9, !range !11, !noundef !12
  %27 = trunc i8 %26 to i1
  %28 = load ptr, ptr %10, align 8, !tbaa !5
  %29 = load ptr, ptr %11, align 8, !tbaa !5
  %30 = call noundef double @_ZN7LibUtil10Calculator4primERNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEEEbRKSt3mapINS_6StringES9_St4lessIS9_ESaISt4pairIKS9_S9_EEEPN5DSENT5ModelE(ptr noundef nonnull align 8 dereferenceable(144) %24, ptr noundef nonnull align 8 dereferenceable(120) %25, i1 noundef zeroext %27, ptr noundef nonnull align 8 dereferenceable(48) %28, ptr noundef %29)
  store double %30, ptr %12, align 8, !tbaa !13
  br label %31

31:                                               ; preds = %92, %5
  br label %32

32:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %33 = getelementptr inbounds %"class.LibUtil::Calculator", ptr %24, i32 0, i32 3
  %34 = load i32, ptr %33, align 8, !tbaa !15
  switch i32 %34, label %87 [
    i32 42, label %35
    i32 47, label %42
  ]

35:                                               ; preds = %32
  %36 = load ptr, ptr %8, align 8, !tbaa !5
  %37 = load ptr, ptr %10, align 8, !tbaa !5
  %38 = load ptr, ptr %11, align 8, !tbaa !5
  %39 = call noundef double @_ZN7LibUtil10Calculator4primERNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEEEbRKSt3mapINS_6StringES9_St4lessIS9_ESaISt4pairIKS9_S9_EEEPN5DSENT5ModelE(ptr noundef nonnull align 8 dereferenceable(144) %24, ptr noundef nonnull align 8 dereferenceable(120) %36, i1 noundef zeroext true, ptr noundef nonnull align 8 dereferenceable(48) %37, ptr noundef %38)
  %40 = load double, ptr %12, align 8, !tbaa !13
  %41 = fmul double %40, %39
  store double %41, ptr %12, align 8, !tbaa !13
  br label %89

42:                                               ; preds = %32
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = load ptr, ptr %10, align 8, !tbaa !5
  %45 = load ptr, ptr %11, align 8, !tbaa !5
  %46 = call noundef double @_ZN7LibUtil10Calculator4primERNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEEEbRKSt3mapINS_6StringES9_St4lessIS9_ESaISt4pairIKS9_S9_EEEPN5DSENT5ModelE(ptr noundef nonnull align 8 dereferenceable(144) %24, ptr noundef nonnull align 8 dereferenceable(120) %43, i1 noundef zeroext true, ptr noundef nonnull align 8 dereferenceable(48) %44, ptr noundef %45)
  store double %46, ptr %13, align 8, !tbaa !13
  br label %47

47:                                               ; preds = %42
  %48 = load double, ptr %13, align 8, !tbaa !13
  %49 = fcmp une double %48, 0.000000e+00
  br i1 %49, label %81, label %50

50:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %18) #6
  call void @_ZN7LibUtil6StringC1EPKc(ptr noundef nonnull align 8 dereferenceable(32) %18, ptr noundef @.str.4)
  invoke void (ptr, ptr, ...) @_ZN7LibUtil6String6formatERKS0_z(ptr dead_on_unwind writable sret(%"class.LibUtil::String") align 8 %17, ptr noundef nonnull align 8 dereferenceable(32) %18, ptr noundef @.str.5, i32 noundef 236)
          to label %51 unwind label %57

51:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 32, ptr %21) #6
  invoke void @_ZN7LibUtil6StringC1EPKc(ptr noundef nonnull align 8 dereferenceable(32) %21, ptr noundef @.str.11)
          to label %52 unwind label %61

52:                                               ; preds = %51
  invoke void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEOS8_S9_(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %16, ptr noundef nonnull align 8 dereferenceable(32) %17, ptr noundef nonnull align 8 dereferenceable(32) %21)
          to label %53 unwind label %65

53:                                               ; preds = %52
  invoke void @_ZN7LibUtil6StringC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %15, ptr noundef nonnull align 8 dereferenceable(32) %16)
          to label %54 unwind label %69

54:                                               ; preds = %53
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %16) #6
  call void @_ZN7LibUtil6StringD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %21) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %21) #6
  call void @_ZN7LibUtil6StringD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %17) #6
  call void @_ZN7LibUtil6StringD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %18) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %16) #6
  store ptr %15, ptr %14, align 8, !tbaa !5
  %55 = call ptr @__cxa_allocate_exception(i64 40) #6
  %56 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_ZN7LibUtil9ExceptionC1ERKNS_6StringE(ptr noundef nonnull align 8 dereferenceable(40) %55, ptr noundef nonnull align 8 dereferenceable(32) %56) #6
  invoke void @__cxa_throw(ptr %55, ptr @_ZTIN7LibUtil9ExceptionE, ptr @_ZN7LibUtil9ExceptionD1Ev) #7
          to label %100 unwind label %76

57:                                               ; preds = %50
  %58 = landingpad { ptr, i32 }
          cleanup
  %59 = extractvalue { ptr, i32 } %58, 0
  store ptr %59, ptr %19, align 8
  %60 = extractvalue { ptr, i32 } %58, 1
  store i32 %60, ptr %20, align 4
  br label %75

61:                                               ; preds = %51
  %62 = landingpad { ptr, i32 }
          cleanup
  %63 = extractvalue { ptr, i32 } %62, 0
  store ptr %63, ptr %19, align 8
  %64 = extractvalue { ptr, i32 } %62, 1
  store i32 %64, ptr %20, align 4
  br label %74

65:                                               ; preds = %52
  %66 = landingpad { ptr, i32 }
          cleanup
  %67 = extractvalue { ptr, i32 } %66, 0
  store ptr %67, ptr %19, align 8
  %68 = extractvalue { ptr, i32 } %66, 1
  store i32 %68, ptr %20, align 4
  br label %73

69:                                               ; preds = %53
  %70 = landingpad { ptr, i32 }
          cleanup
  %71 = extractvalue { ptr, i32 } %70, 0
  store ptr %71, ptr %19, align 8
  %72 = extractvalue { ptr, i32 } %70, 1
  store i32 %72, ptr %20, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %16) #6
  br label %73

73:                                               ; preds = %69, %65
  call void @_ZN7LibUtil6StringD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %21) #6
  br label %74

74:                                               ; preds = %73, %61
  call void @llvm.lifetime.end.p0(i64 32, ptr %21) #6
  call void @_ZN7LibUtil6StringD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %17) #6
  br label %75

75:                                               ; preds = %74, %57
  call void @_ZN7LibUtil6StringD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %18) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %16) #6
  br label %80

76:                                               ; preds = %54
  %77 = landingpad { ptr, i32 }
          cleanup
  %78 = extractvalue { ptr, i32 } %77, 0
  store ptr %78, ptr %19, align 8
  %79 = extractvalue { ptr, i32 } %77, 1
  store i32 %79, ptr %20, align 4
  call void @_ZN7LibUtil6StringD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #6
  br label %80

80:                                               ; preds = %76, %75
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %95

81:                                               ; preds = %47
  br label %82

82:                                               ; preds = %81
  br label %83

83:                                               ; preds = %82
  %84 = load double, ptr %13, align 8, !tbaa !13
  %85 = load double, ptr %12, align 8, !tbaa !13
  %86 = fdiv double %85, %84
  store double %86, ptr %12, align 8, !tbaa !13
  br label %89

87:                                               ; preds = %32
  %88 = load double, ptr %12, align 8, !tbaa !13
  store double %88, ptr %6, align 8
  store i32 1, ptr %22, align 4
  br label %90

89:                                               ; preds = %83, %35
  store i32 0, ptr %22, align 4
  br label %90

90:                                               ; preds = %89, %87
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  %91 = load i32, ptr %22, align 4
  switch i32 %91, label %93 [
    i32 0, label %92
  ]

92:                                               ; preds = %90
  br label %31, !llvm.loop !31

93:                                               ; preds = %90
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  %94 = load double, ptr %6, align 8
  ret double %94

95:                                               ; preds = %80
  %96 = load ptr, ptr %19, align 8
  %97 = load i32, ptr %20, align 4
  %98 = insertvalue { ptr, i32 } poison, ptr %96, 0
  %99 = insertvalue { ptr, i32 } %98, i32 %97, 1
  resume { ptr, i32 } %99

100:                                              ; preds = %54
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 "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 = { 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 #4 = { inlinehint 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { noreturn }

!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 = !{!"any pointer", !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 = !{}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!16, !30, i64 96}
!16 = !{!"_ZTSN7LibUtil10CalculatorE", !17, i64 8, !21, i64 40, !30, i64 96, !14, i64 104, !17, i64 112}
!17 = !{!"_ZTSN7LibUtil6StringE", !18, i64 0}
!18 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !19, i64 0, !20, i64 8, !7, i64 16}
!19 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!20 = !{!"long", !7, i64 0}
!21 = !{!"_ZTSN7LibUtil3MapIdEE", !22, i64 8}
!22 = !{!"_ZTSSt3mapIN7LibUtil6StringEdSt4lessIS1_ESaISt4pairIKS1_dEEE", !23, i64 0}
!23 = !{!"_ZTSSt8_Rb_treeIN7LibUtil6StringESt4pairIKS1_dESt10_Select1stIS4_ESt4lessIS1_ESaIS4_EE", !24, i64 0}
!24 = !{!"_ZTSNSt8_Rb_treeIN7LibUtil6StringESt4pairIKS1_dESt10_Select1stIS4_ESt4lessIS1_ESaIS4_EE13_Rb_tree_implIS8_Lb1EEE", !25, i64 0, !27, i64 8}
!25 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessIN7LibUtil6StringEEE", !26, i64 0}
!26 = !{!"_ZTSSt4lessIN7LibUtil6StringEE"}
!27 = !{!"_ZTSSt15_Rb_tree_header", !28, i64 0, !20, i64 32}
!28 = !{!"_ZTSSt18_Rb_tree_node_base", !29, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!29 = !{!"_ZTSSt14_Rb_tree_color", !7, i64 0}
!30 = !{!"_ZTSN7LibUtil10Calculator5TokenE", !7, i64 0}
!31 = distinct !{!31, !32}
!32 = !{!"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"

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.LibUtil::String" = type { %"class.std::__cxx11::basic_string" }

@.str.4 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [75 x i8], align 1
@_ZTIN7LibUtil9ExceptionE = external constant ptr
@.str.11 = external hidden unnamed_addr constant [21 x i8], align 1

declare i32 @__gxx_personality_v0(...)

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

declare void @_ZN7LibUtil6StringC1EPKc(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) unnamed_addr #1

; Function Attrs: nounwind
declare void @_ZN7LibUtil6StringD1Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEOS8_S9_(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #4

declare void @_ZN7LibUtil6String6formatERKS0_z(ptr dead_on_unwind writable sret(%"class.LibUtil::String") align 8, ptr noundef nonnull align 8 dereferenceable(32), ...) local_unnamed_addr #1

declare void @_ZN7LibUtil6StringC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

; Function Attrs: nounwind
declare void @_ZN7LibUtil9ExceptionC1ERKNS_6StringE(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2

; Function Attrs: nounwind
declare void @_ZN7LibUtil9ExceptionD1Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #2

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZN7LibUtil10Calculator4primERNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEEEbRKSt3mapINS_6StringES9_St4lessIS9_ESaISt4pairIKS9_S9_EEEPN5DSENT5ModelE(ptr noundef nonnull align 8 dereferenceable(144), ptr noundef nonnull align 8 dereferenceable(120), i1 noundef zeroext, ptr noundef nonnull align 8 dereferenceable(48), ptr noundef) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN7LibUtil10Calculator4termERNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEEEbRKSt3mapINS_6StringES9_St4lessIS9_ESaISt4pairIKS9_S9_EEEPN5DSENT5ModelE(ptr noundef nonnull align 8 dereferenceable(144) %0, ptr noundef nonnull align 8 dereferenceable(120) %1, i1 noundef zeroext %2, ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef %4) local_unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca %"class.LibUtil::String", align 8
  %7 = alloca %"class.std::__cxx11::basic_string", align 8
  %8 = alloca %"class.LibUtil::String", align 8
  %9 = alloca %"class.LibUtil::String", align 8
  %10 = alloca %"class.LibUtil::String", align 8
  %11 = tail call noundef double @_ZN7LibUtil10Calculator4primERNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEEEbRKSt3mapINS_6StringES9_St4lessIS9_ESaISt4pairIKS9_S9_EEEPN5DSENT5ModelE(ptr noundef nonnull align 8 dereferenceable(144) %0, ptr noundef nonnull align 8 dereferenceable(120) %1, i1 noundef zeroext %2, ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef %4)
  %12 = getelementptr inbounds i8, ptr %0, i64 96
  br label %13

13:                                               ; preds = %.backedge, %5
  %.027 = phi double [ %11, %5 ], [ %.027.be, %.backedge ]
  %14 = load i32, ptr %12, align 8, !tbaa !5
  switch i32 %14, label %43 [
    i32 42, label %15
    i32 47, label %18
  ]

15:                                               ; preds = %13
  %16 = tail call noundef double @_ZN7LibUtil10Calculator4primERNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEEEbRKSt3mapINS_6StringES9_St4lessIS9_ESaISt4pairIKS9_S9_EEEPN5DSENT5ModelE(ptr noundef nonnull align 8 dereferenceable(144) %0, ptr noundef nonnull align 8 dereferenceable(120) %1, i1 noundef zeroext true, ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef %4)
  %17 = fmul double %.027, %16
  br label %.backedge

.backedge:                                        ; preds = %15, %41
  %.027.be = phi double [ %42, %41 ], [ %17, %15 ]
  br label %13, !llvm.loop !25

18:                                               ; preds = %13
  %19 = tail call noundef double @_ZN7LibUtil10Calculator4primERNSt7__cxx1119basic_istringstreamIcSt11char_traitsIcESaIcEEEbRKSt3mapINS_6StringES9_St4lessIS9_ESaISt4pairIKS9_S9_EEEPN5DSENT5ModelE(ptr noundef nonnull align 8 dereferenceable(144) %0, ptr noundef nonnull align 8 dereferenceable(120) %1, i1 noundef zeroext true, ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef %4)
  %20 = fcmp une double %19, 0.000000e+00
  br i1 %20, label %41, label %21

21:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #6
  call void @_ZN7LibUtil6StringC1EPKc(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull @.str.4)
  invoke void (ptr, ptr, ...) @_ZN7LibUtil6String6formatERKS0_z(ptr dead_on_unwind nonnull writable sret(%"class.LibUtil::String") align 8 %8, ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull @.str.5, i32 noundef 236)
          to label %22 unwind label %27

22:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %10) #6
  invoke void @_ZN7LibUtil6StringC1EPKc(ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef nonnull @.str.11)
          to label %23 unwind label %29

23:                                               ; preds = %22
  invoke void @_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EEOS8_S9_(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %7, ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef nonnull align 8 dereferenceable(32) %10)
          to label %24 unwind label %31

24:                                               ; preds = %23
  invoke void @_ZN7LibUtil6StringC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull align 8 dereferenceable(32) %7)
          to label %25 unwind label %33

25:                                               ; preds = %24
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #6
  call void @_ZN7LibUtil6StringD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %10) #6
  call void @_ZN7LibUtil6StringD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #6
  call void @_ZN7LibUtil6StringD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #6
  %26 = call ptr @__cxa_allocate_exception(i64 40) #6
  call void @_ZN7LibUtil9ExceptionC1ERKNS_6StringE(ptr noundef nonnull align 8 dereferenceable(40) %26, ptr noundef nonnull align 8 dereferenceable(32) %6) #6
  invoke void @__cxa_throw(ptr nonnull %26, ptr nonnull @_ZTIN7LibUtil9ExceptionE, ptr nonnull @_ZN7LibUtil9ExceptionD1Ev) #7
          to label %44 unwind label %38

27:                                               ; preds = %21
  %28 = landingpad { ptr, i32 }
          cleanup
  br label %37

29:                                               ; preds = %22
  %30 = landingpad { ptr, i32 }
          cleanup
  br label %36

31:                                               ; preds = %23
  %32 = landingpad { ptr, i32 }
          cleanup
  br label %35

33:                                               ; preds = %24
  %34 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #6
  br label %35

35:                                               ; preds = %33, %31
  %.pn = phi { ptr, i32 } [ %34, %33 ], [ %32, %31 ]
  call void @_ZN7LibUtil6StringD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #6
  br label %36

36:                                               ; preds = %35, %29
  %.pn.pn = phi { ptr, i32 } [ %.pn, %35 ], [ %30, %29 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %10) #6
  call void @_ZN7LibUtil6StringD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #6
  br label %37

37:                                               ; preds = %36, %27
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %36 ], [ %28, %27 ]
  call void @_ZN7LibUtil6StringD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #6
  br label %40

38:                                               ; preds = %25
  %39 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7LibUtil6StringD1Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #6
  br label %40

40:                                               ; preds = %38, %37
  %.pn34 = phi { ptr, i32 } [ %39, %38 ], [ %.pn.pn.pn, %37 ]
  resume { ptr, i32 } %.pn34

41:                                               ; preds = %18
  %42 = fdiv double %.027, %19
  br label %.backedge

43:                                               ; preds = %13
  ret double %.027

44:                                               ; preds = %25
  unreachable
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 "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 = { 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 #4 = { inlinehint 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { noreturn }

!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, !23, i64 96}
!6 = !{!"_ZTSN7LibUtil10CalculatorE", !7, i64 8, !14, i64 40, !23, i64 96, !24, i64 104, !7, i64 112}
!7 = !{!"_ZTSN7LibUtil6StringE", !8, i64 0}
!8 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !9, i64 0, !13, i64 8, !11, i64 16}
!9 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !10, i64 0}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = !{!"long", !11, i64 0}
!14 = !{!"_ZTSN7LibUtil3MapIdEE", !15, i64 8}
!15 = !{!"_ZTSSt3mapIN7LibUtil6StringEdSt4lessIS1_ESaISt4pairIKS1_dEEE", !16, i64 0}
!16 = !{!"_ZTSSt8_Rb_treeIN7LibUtil6StringESt4pairIKS1_dESt10_Select1stIS4_ESt4lessIS1_ESaIS4_EE", !17, i64 0}
!17 = !{!"_ZTSNSt8_Rb_treeIN7LibUtil6StringESt4pairIKS1_dESt10_Select1stIS4_ESt4lessIS1_ESaIS4_EE13_Rb_tree_implIS8_Lb1EEE", !18, i64 0, !20, i64 8}
!18 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessIN7LibUtil6StringEEE", !19, i64 0}
!19 = !{!"_ZTSSt4lessIN7LibUtil6StringEE"}
!20 = !{!"_ZTSSt15_Rb_tree_header", !21, i64 0, !13, i64 32}
!21 = !{!"_ZTSSt18_Rb_tree_node_base", !22, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!22 = !{!"_ZTSSt14_Rb_tree_color", !11, i64 0}
!23 = !{!"_ZTSN7LibUtil10Calculator5TokenE", !11, i64 0}
!24 = !{!"double", !11, i64 0}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass