; LLVM IR from gzc/CLRS :: C16-Greedy-Algorithms/huffman (HUFFMAN)

; 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::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"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.HUFFMAN = type { ptr, %"class.std::map", ptr, ptr }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<char, std::pair<const char, std::vector<bool>>, std::_Select1st<std::pair<const char, std::vector<bool>>>, std::less<char>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<char, std::pair<const char, std::vector<bool>>, std::_Select1st<std::pair<const char, std::vector<bool>>>, std::less<char>>::_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 }
%struct.Htree = type <{ ptr, ptr, i32, i8, [3 x i8] }>

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.3 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [63 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7HUFFMAN7destroyEP5Htree(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef) #0 align 2

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) #1

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #2

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZL6isLeafP5Htree(ptr noundef) #4

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

; Function Attrs: mustprogress uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7HUFFMAN8readTrieEv(ptr noundef nonnull align 8 dereferenceable(72)) #0 align 2

declare noundef zeroext i1 @_ZN11BinaryStdIn8readBoolEv(ptr noundef nonnull align 8 dereferenceable(528)) #7

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7HUFFMAN6decodeENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8 %0, ptr noundef nonnull align 8 dereferenceable(72) %1, ptr noundef %2) #0 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %"class.std::__cxx11::basic_string", align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i1, align 1
  %11 = alloca i32, align 4
  %12 = alloca i1, align 1
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i8, align 1
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %16 = load ptr, ptr %5, align 8
  %17 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %18 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef @.str.3)
  %19 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %18, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %20 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 528) #8
  store i1 true, ptr %10, align 1
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef nonnull align 8 dereferenceable(32) %2)
          to label %21 unwind label %34

21:                                               ; preds = %3
  invoke void @_ZN11BinaryStdInC1ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(528) %20, ptr noundef %7)
          to label %22 unwind label %38

22:                                               ; preds = %21
  store i1 false, ptr %10, align 1
  %23 = getelementptr inbounds %class.HUFFMAN, ptr %16, i32 0, i32 3
  store ptr %20, ptr %23, align 8, !tbaa !9
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #9
  %24 = call noundef ptr @_ZN7HUFFMAN8readTrieEv(ptr noundef nonnull align 8 dereferenceable(72) %16)
  %25 = getelementptr inbounds %class.HUFFMAN, ptr %16, i32 0, i32 0
  store ptr %24, ptr %25, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #9
  %26 = getelementptr inbounds %class.HUFFMAN, ptr %16, i32 0, i32 3
  %27 = load ptr, ptr %26, align 8, !tbaa !9
  %28 = call noundef i32 @_ZN11BinaryStdIn7readIntEv(ptr noundef nonnull align 8 dereferenceable(528) %27)
  store i32 %28, ptr %11, align 4, !tbaa !21
  store i1 false, ptr %12, align 1
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #9
  store i32 0, ptr %13, align 4, !tbaa !21
  br label %29

29:                                               ; preds = %85, %22
  %30 = load i32, ptr %13, align 4, !tbaa !21
  %31 = load i32, ptr %11, align 4, !tbaa !21
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %46, label %33

33:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #9
  br label %89

34:                                               ; preds = %3
  %35 = landingpad { ptr, i32 }
          cleanup
  %36 = extractvalue { ptr, i32 } %35, 0
  store ptr %36, ptr %8, align 8
  %37 = extractvalue { ptr, i32 } %35, 1
  store i32 %37, ptr %9, align 4
  br label %42

38:                                               ; preds = %21
  %39 = landingpad { ptr, i32 }
          cleanup
  %40 = extractvalue { ptr, i32 } %39, 0
  store ptr %40, ptr %8, align 8
  %41 = extractvalue { ptr, i32 } %39, 1
  store i32 %41, ptr %9, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #9
  br label %42

42:                                               ; preds = %38, %34
  %43 = load i1, ptr %10, align 1
  br i1 %43, label %44, label %45

44:                                               ; preds = %42
  call void @_ZdlPvm(ptr noundef %20, i64 noundef 528) #10
  br label %45

45:                                               ; preds = %44, %42
  br label %117

46:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #9
  %47 = getelementptr inbounds %class.HUFFMAN, ptr %16, i32 0, i32 0
  %48 = load ptr, ptr %47, align 8, !tbaa !20
  store ptr %48, ptr %14, align 8, !tbaa !5
  br label %49

49:                                               ; preds = %78, %46
  %50 = load ptr, ptr %14, align 8, !tbaa !5
  %51 = invoke noundef zeroext i1 @_ZL6isLeafP5Htree(ptr noundef %50)
          to label %52 unwind label %66

52:                                               ; preds = %49
  %53 = xor i1 %51, true
  br i1 %53, label %54, label %79

54:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #9
  %55 = getelementptr inbounds %class.HUFFMAN, ptr %16, i32 0, i32 3
  %56 = load ptr, ptr %55, align 8, !tbaa !9
  %57 = invoke noundef zeroext i1 @_ZN11BinaryStdIn8readBoolEv(ptr noundef nonnull align 8 dereferenceable(528) %56)
          to label %58 unwind label %70

58:                                               ; preds = %54
  %59 = zext i1 %57 to i8
  store i8 %59, ptr %15, align 1, !tbaa !23
  %60 = load i8, ptr %15, align 1, !tbaa !23, !range !25, !noundef !26
  %61 = trunc i8 %60 to i1
  br i1 %61, label %62, label %74

62:                                               ; preds = %58
  %63 = load ptr, ptr %14, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.Htree, ptr %63, i32 0, i32 1
  %65 = load ptr, ptr %64, align 8, !tbaa !27
  store ptr %65, ptr %14, align 8, !tbaa !5
  br label %78

66:                                               ; preds = %79, %49
  %67 = landingpad { ptr, i32 }
          cleanup
  %68 = extractvalue { ptr, i32 } %67, 0
  store ptr %68, ptr %8, align 8
  %69 = extractvalue { ptr, i32 } %67, 1
  store i32 %69, ptr %9, align 4
  br label %88

70:                                               ; preds = %54
  %71 = landingpad { ptr, i32 }
          cleanup
  %72 = extractvalue { ptr, i32 } %71, 0
  store ptr %72, ptr %8, align 8
  %73 = extractvalue { ptr, i32 } %71, 1
  store i32 %73, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #9
  br label %88

74:                                               ; preds = %58
  %75 = load ptr, ptr %14, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.Htree, ptr %75, i32 0, i32 0
  %77 = load ptr, ptr %76, align 8, !tbaa !29
  store ptr %77, ptr %14, align 8, !tbaa !5
  br label %78

78:                                               ; preds = %74, %62
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #9
  br label %49, !llvm.loop !30

79:                                               ; preds = %52
  %80 = load ptr, ptr %14, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.Htree, ptr %80, i32 0, i32 3
  %82 = load i8, ptr %81, align 4, !tbaa !32
  %83 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %0, i8 noundef signext %82)
          to label %84 unwind label %66

84:                                               ; preds = %79
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  br label %85

85:                                               ; preds = %84
  %86 = load i32, ptr %13, align 4, !tbaa !21
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %13, align 4, !tbaa !21
  br label %29, !llvm.loop !33

88:                                               ; preds = %70, %66
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #9
  br label %116

89:                                               ; preds = %33
  %90 = getelementptr inbounds %class.HUFFMAN, ptr %16, i32 0, i32 3
  %91 = load ptr, ptr %90, align 8, !tbaa !9
  %92 = icmp eq ptr %91, null
  br i1 %92, label %94, label %93

93:                                               ; preds = %89
  call void @_ZN11BinaryStdInD2Ev(ptr noundef nonnull align 8 dereferenceable(528) %91) #9
  call void @_ZdlPvm(ptr noundef %91, i64 noundef 528) #10
  br label %94

94:                                               ; preds = %93, %89
  %95 = getelementptr inbounds %class.HUFFMAN, ptr %16, i32 0, i32 0
  %96 = load ptr, ptr %95, align 8, !tbaa !20
  %97 = icmp ne ptr %96, null
  br i1 %97, label %106, label %98

98:                                               ; preds = %94
  %99 = getelementptr inbounds %class.HUFFMAN, ptr %16, i32 0, i32 0
  %100 = load ptr, ptr %99, align 8, !tbaa !20
  invoke void @_ZN7HUFFMAN7destroyEP5Htree(ptr noundef nonnull align 8 dereferenceable(72) %16, ptr noundef %100)
          to label %101 unwind label %102

101:                                              ; preds = %98
  br label %106

102:                                              ; preds = %110, %108, %106, %98
  %103 = landingpad { ptr, i32 }
          cleanup
  %104 = extractvalue { ptr, i32 } %103, 0
  store ptr %104, ptr %8, align 8
  %105 = extractvalue { ptr, i32 } %103, 1
  store i32 %105, ptr %9, align 4
  br label %116

106:                                              ; preds = %101, %94
  %107 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %108 unwind label %102

108:                                              ; preds = %106
  %109 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %107, ptr noundef @.str.4)
          to label %110 unwind label %102

110:                                              ; preds = %108
  %111 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %109, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %112 unwind label %102

112:                                              ; preds = %110
  store i1 true, ptr %12, align 1
  %113 = load i1, ptr %12, align 1
  br i1 %113, label %115, label %114

114:                                              ; preds = %112
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #9
  br label %115

115:                                              ; preds = %114, %112
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  ret void

116:                                              ; preds = %102, %88
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  br label %117

117:                                              ; preds = %116, %45
  %118 = load ptr, ptr %8, align 8
  %119 = load i32, ptr %9, align 4
  %120 = insertvalue { ptr, i32 } poison, ptr %118, 0
  %121 = insertvalue { ptr, i32 } %120, i32 %119, 1
  resume { ptr, i32 } %121
}

declare void @_ZN11BinaryStdInC1ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(528), ptr noundef) unnamed_addr #7

declare noundef i32 @_ZN11BinaryStdIn7readIntEv(ptr noundef nonnull align 8 dereferenceable(528)) #7

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN11BinaryStdInD2Ev(ptr noundef nonnull align 8 dereferenceable(528)) unnamed_addr #4 align 2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nobuiltin allocsize(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 = { nobuiltin 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 #4 = { 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 #5 = { 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 #6 = { 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 #7 = { "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 #8 = { builtin allocsize(0) }
attributes #9 = { nounwind }
attributes #10 = { builtin 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 64}
!10 = !{!"_ZTS7HUFFMAN", !6, i64 0, !11, i64 8, !6, i64 56, !6, i64 64}
!11 = !{!"_ZTSSt3mapIcSt6vectorIbSaIbEESt4lessIcESaISt4pairIKcS2_EEE", !12, i64 0}
!12 = !{!"_ZTSSt8_Rb_treeIcSt4pairIKcSt6vectorIbSaIbEEESt10_Select1stIS5_ESt4lessIcESaIS5_EE", !13, i64 0}
!13 = !{!"_ZTSNSt8_Rb_treeIcSt4pairIKcSt6vectorIbSaIbEEESt10_Select1stIS5_ESt4lessIcESaIS5_EE13_Rb_tree_implIS9_Lb1EEE", !14, i64 0, !16, i64 8}
!14 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessIcEE", !15, i64 0}
!15 = !{!"_ZTSSt4lessIcE"}
!16 = !{!"_ZTSSt15_Rb_tree_header", !17, i64 0, !19, i64 32}
!17 = !{!"_ZTSSt18_Rb_tree_node_base", !18, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!18 = !{!"_ZTSSt14_Rb_tree_color", !7, i64 0}
!19 = !{!"long", !7, i64 0}
!20 = !{!10, !6, i64 0}
!21 = !{!22, !22, i64 0}
!22 = !{!"int", !7, i64 0}
!23 = !{!24, !24, i64 0}
!24 = !{!"bool", !7, i64 0}
!25 = !{i8 0, i8 2}
!26 = !{}
!27 = !{!28, !6, i64 8}
!28 = !{!"_ZTS5Htree", !6, i64 0, !6, i64 8, !22, i64 16, !7, i64 20}
!29 = !{!28, !6, i64 0}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = !{!28, !7, i64 20}
!33 = distinct !{!33, !31}


; 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::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"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] }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.3 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [63 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7HUFFMAN7destroyEP5Htree(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef) local_unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #1

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZL6isLeafP5Htree(ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #4

; Function Attrs: mustprogress uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7HUFFMAN8readTrieEv(ptr noundef nonnull align 8 dereferenceable(72)) local_unnamed_addr #0 align 2

declare noundef zeroext i1 @_ZN11BinaryStdIn8readBoolEv(ptr noundef nonnull align 8 dereferenceable(528)) local_unnamed_addr #6

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7HUFFMAN6decodeENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8 %0, ptr noundef nonnull align 8 dereferenceable(72) %1, ptr noundef %2) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.std::__cxx11::basic_string", align 8
  %5 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %6 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull @.str.3)
  %7 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %8 = tail call noalias noundef nonnull dereferenceable(528) ptr @_Znwm(i64 noundef 528) #7
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull align 8 dereferenceable(32) %2)
          to label %9 unwind label %19

9:                                                ; preds = %3
  invoke void @_ZN11BinaryStdInC1ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(528) %8, ptr noundef nonnull %4)
          to label %10 unwind label %21

10:                                               ; preds = %9
  %11 = getelementptr inbounds i8, ptr %1, i64 64
  store ptr %8, ptr %11, align 8, !tbaa !5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #8
  %12 = call noundef ptr @_ZN7HUFFMAN8readTrieEv(ptr noundef nonnull align 8 dereferenceable(72) %1)
  store ptr %12, ptr %1, align 8, !tbaa !19
  %13 = load ptr, ptr %11, align 8, !tbaa !5
  %14 = call noundef i32 @_ZN11BinaryStdIn7readIntEv(ptr noundef nonnull align 8 dereferenceable(528) %13)
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #8
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %.preheader, label %._crit_edge30

.preheader:                                       ; preds = %10, %35
  %.01429 = phi i32 [ %36, %35 ], [ 0, %10 ]
  %.01227 = load ptr, ptr %1, align 8, !tbaa !20
  %16 = call noundef zeroext i1 @_ZL6isLeafP5Htree(ptr noundef %.01227)
  br i1 %16, label %._crit_edge, label %.lr.ph

._crit_edge30:                                    ; preds = %35, %10
  %17 = load ptr, ptr %11, align 8, !tbaa !5
  %18 = icmp eq ptr %17, null
  br i1 %18, label %38, label %37

19:                                               ; preds = %3
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %23

21:                                               ; preds = %9
  %22 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #8
  br label %23

23:                                               ; preds = %19, %21
  %.pn = phi { ptr, i32 } [ %22, %21 ], [ %20, %19 ]
  call void @_ZdlPvm(ptr noundef nonnull %8, i64 noundef 528) #9
  br label %51

.lr.ph:                                           ; preds = %.preheader, %26
  %.01228 = phi ptr [ %.012, %26 ], [ %.01227, %.preheader ]
  %24 = load ptr, ptr %11, align 8, !tbaa !5
  %25 = invoke noundef zeroext i1 @_ZN11BinaryStdIn8readBoolEv(ptr noundef nonnull align 8 dereferenceable(528) %24)
          to label %26 unwind label %30

26:                                               ; preds = %.lr.ph
  %.113.in.idx = select i1 %25, i64 8, i64 0
  %.113.in = getelementptr inbounds i8, ptr %.01228, i64 %.113.in.idx
  %.012 = load ptr, ptr %.113.in, align 8, !tbaa !20
  %27 = call noundef zeroext i1 @_ZL6isLeafP5Htree(ptr noundef %.012)
  br i1 %27, label %._crit_edge, label %.lr.ph, !llvm.loop !21

28:                                               ; preds = %._crit_edge
  %29 = landingpad { ptr, i32 }
          cleanup
  br label %50

30:                                               ; preds = %.lr.ph
  %31 = landingpad { ptr, i32 }
          cleanup
  br label %50

._crit_edge:                                      ; preds = %26, %.preheader
  %.012.lcssa = phi ptr [ %.01227, %.preheader ], [ %.012, %26 ]
  %32 = getelementptr inbounds i8, ptr %.012.lcssa, i64 20
  %33 = load i8, ptr %32, align 4, !tbaa !23
  %34 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %0, i8 noundef signext %33)
          to label %35 unwind label %28

35:                                               ; preds = %._crit_edge
  %36 = add nuw nsw i32 %.01429, 1
  %exitcond.not = icmp eq i32 %36, %14
  br i1 %exitcond.not, label %._crit_edge30, label %.preheader, !llvm.loop !26

37:                                               ; preds = %._crit_edge30
  call void @_ZN11BinaryStdInD2Ev(ptr noundef nonnull align 8 dereferenceable(528) %17) #8
  call void @_ZdlPvm(ptr noundef nonnull %17, i64 noundef 528) #9
  br label %38

38:                                               ; preds = %37, %._crit_edge30
  %39 = load ptr, ptr %1, align 8, !tbaa !19
  %.not = icmp eq ptr %39, null
  br i1 %.not, label %40, label %43

40:                                               ; preds = %38
  invoke void @_ZN7HUFFMAN7destroyEP5Htree(ptr noundef nonnull align 8 dereferenceable(72) %1, ptr noundef null)
          to label %43 unwind label %41

41:                                               ; preds = %47, %45, %43, %40
  %42 = landingpad { ptr, i32 }
          cleanup
  br label %50

43:                                               ; preds = %40, %38
  %44 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %45 unwind label %41

45:                                               ; preds = %43
  %46 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %44, ptr noundef nonnull @.str.4)
          to label %47 unwind label %41

47:                                               ; preds = %45
  %48 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %46, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %49 unwind label %41

49:                                               ; preds = %47
  ret void

50:                                               ; preds = %28, %30, %41
  %.pn22.pn = phi { ptr, i32 } [ %42, %41 ], [ %31, %30 ], [ %29, %28 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #8
  br label %51

51:                                               ; preds = %23, %50
  %.pn22.pn.pn = phi { ptr, i32 } [ %.pn22.pn, %50 ], [ %.pn, %23 ]
  resume { ptr, i32 } %.pn22.pn.pn
}

declare void @_ZN11BinaryStdInC1ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(528), ptr noundef) unnamed_addr #6

declare noundef i32 @_ZN11BinaryStdIn7readIntEv(ptr noundef nonnull align 8 dereferenceable(528)) local_unnamed_addr #6

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN11BinaryStdInD2Ev(ptr noundef nonnull align 8 dereferenceable(528)) unnamed_addr #3 align 2

attributes #0 = { 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 #1 = { nobuiltin allocsize(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 = { nobuiltin 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 = { 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 #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 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 #6 = { "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 #7 = { builtin allocsize(0) }
attributes #8 = { nounwind }
attributes #9 = { builtin 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, !7, i64 64}
!6 = !{!"_ZTS7HUFFMAN", !7, i64 0, !10, i64 8, !7, i64 56, !7, i64 64}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSSt3mapIcSt6vectorIbSaIbEESt4lessIcESaISt4pairIKcS2_EEE", !11, i64 0}
!11 = !{!"_ZTSSt8_Rb_treeIcSt4pairIKcSt6vectorIbSaIbEEESt10_Select1stIS5_ESt4lessIcESaIS5_EE", !12, i64 0}
!12 = !{!"_ZTSNSt8_Rb_treeIcSt4pairIKcSt6vectorIbSaIbEEESt10_Select1stIS5_ESt4lessIcESaIS5_EE13_Rb_tree_implIS9_Lb1EEE", !13, i64 0, !15, i64 8}
!13 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessIcEE", !14, i64 0}
!14 = !{!"_ZTSSt4lessIcE"}
!15 = !{!"_ZTSSt15_Rb_tree_header", !16, i64 0, !18, i64 32}
!16 = !{!"_ZTSSt18_Rb_tree_node_base", !17, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!17 = !{!"_ZTSSt14_Rb_tree_color", !8, i64 0}
!18 = !{!"long", !8, i64 0}
!19 = !{!6, !7, i64 0}
!20 = !{!7, !7, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!24, !8, i64 20}
!24 = !{!"_ZTS5Htree", !7, i64 0, !7, i64 8, !25, i64 16, !8, i64 20}
!25 = !{!"int", !8, i64 0}
!26 = distinct !{!26, !22}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass