; LLVM IR from nragland37/cpp-projects :: data_structures-II/09-Huffman-Algorithm/Decoding/main.ll (Z17createHuffmanTreeP5StockPdi)

; 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.Stock = type { %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", double }
%"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] }
%struct.Node = type { %class.Stock, double, ptr, ptr }

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

declare i32 @__gxx_personality_v0(...)

; 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 ptr @_Z17createHuffmanTreeP5StockPdi(ptr noundef %0, ptr noundef %1, i32 noundef %2) #1 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  %19 = load i32, ptr %6, align 4, !tbaa !9
  %20 = sext i32 %19 to i64
  %21 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %20, i64 8)
  %22 = extractvalue { i64, i1 } %21, 1
  %23 = extractvalue { i64, i1 } %21, 0
  %24 = select i1 %22, i64 -1, i64 %23
  %25 = call noalias noundef nonnull ptr @_Znam(i64 noundef %24) #9
  store ptr %25, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %26

26:                                               ; preds = %72, %3
  %27 = load i32, ptr %12, align 4, !tbaa !9
  %28 = load i32, ptr %6, align 4, !tbaa !9
  %29 = icmp slt i32 %27, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %79

31:                                               ; preds = %26
  %32 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 96) #9
  invoke void @_ZN4NodeI5StockEC2Ev(ptr noundef nonnull align 8 dereferenceable(96) %32)
          to label %33 unwind label %75

33:                                               ; preds = %31
  %34 = load ptr, ptr %11, align 8, !tbaa !5
  %35 = load i32, ptr %12, align 4, !tbaa !9
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds ptr, ptr %34, i64 %36
  store ptr %32, ptr %37, align 8, !tbaa !5
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = load i32, ptr %12, align 4, !tbaa !9
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds %class.Stock, ptr %38, i64 %40
  %42 = load ptr, ptr %11, align 8, !tbaa !5
  %43 = load i32, ptr %12, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds ptr, ptr %42, i64 %44
  %46 = load ptr, ptr %45, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.Node, ptr %46, i32 0, i32 0
  %48 = call noundef nonnull align 8 dereferenceable(72) ptr @_ZN5StockaSERKS_(ptr noundef nonnull align 8 dereferenceable(72) %47, ptr noundef nonnull align 8 dereferenceable(72) %41)
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = load i32, ptr %12, align 4, !tbaa !9
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds double, ptr %49, i64 %51
  %53 = load double, ptr %52, align 8, !tbaa !11
  %54 = load ptr, ptr %11, align 8, !tbaa !5
  %55 = load i32, ptr %12, align 4, !tbaa !9
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds ptr, ptr %54, i64 %56
  %58 = load ptr, ptr %57, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.Node, ptr %58, i32 0, i32 1
  store double %53, ptr %59, align 8, !tbaa !13
  %60 = load ptr, ptr %11, align 8, !tbaa !5
  %61 = load i32, ptr %12, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds ptr, ptr %60, i64 %62
  %64 = load ptr, ptr %63, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.Node, ptr %64, i32 0, i32 2
  store ptr null, ptr %65, align 8, !tbaa !19
  %66 = load ptr, ptr %11, align 8, !tbaa !5
  %67 = load i32, ptr %12, align 4, !tbaa !9
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds ptr, ptr %66, i64 %68
  %70 = load ptr, ptr %69, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.Node, ptr %70, i32 0, i32 3
  store ptr null, ptr %71, align 8, !tbaa !20
  br label %72

72:                                               ; preds = %33
  %73 = load i32, ptr %12, align 4, !tbaa !9
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %12, align 4, !tbaa !9
  br label %26, !llvm.loop !21

75:                                               ; preds = %31
  %76 = landingpad { ptr, i32 }
          cleanup
  %77 = extractvalue { ptr, i32 } %76, 0
  store ptr %77, ptr %13, align 8
  %78 = extractvalue { ptr, i32 } %76, 1
  store i32 %78, ptr %14, align 4
  call void @_ZdlPvm(ptr noundef %32, i64 noundef 96) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %205

79:                                               ; preds = %30
  br label %80

80:                                               ; preds = %193, %79
  %81 = load i32, ptr %6, align 4, !tbaa !9
  %82 = icmp sgt i32 %81, 1
  br i1 %82, label %83, label %196

83:                                               ; preds = %80
  store i32 0, ptr %8, align 4, !tbaa !9
  store i32 0, ptr %7, align 4, !tbaa !9
  %84 = call noundef double @_ZNSt14numeric_limitsIdE3maxEv() #8
  store double %84, ptr %10, align 8, !tbaa !11
  store double %84, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %85

85:                                               ; preds = %136, %83
  %86 = load i32, ptr %15, align 4, !tbaa !9
  %87 = load i32, ptr %6, align 4, !tbaa !9
  %88 = icmp slt i32 %86, %87
  br i1 %88, label %90, label %89

89:                                               ; preds = %85
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  br label %139

90:                                               ; preds = %85
  %91 = load ptr, ptr %11, align 8, !tbaa !5
  %92 = load i32, ptr %15, align 4, !tbaa !9
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds ptr, ptr %91, i64 %93
  %95 = load ptr, ptr %94, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.Node, ptr %95, i32 0, i32 1
  %97 = load double, ptr %96, align 8, !tbaa !13
  %98 = load double, ptr %9, align 8, !tbaa !11
  %99 = fcmp olt double %97, %98
  br i1 %99, label %100, label %111

100:                                              ; preds = %90
  %101 = load double, ptr %9, align 8, !tbaa !11
  store double %101, ptr %10, align 8, !tbaa !11
  %102 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %102, ptr %8, align 4, !tbaa !9
  %103 = load ptr, ptr %11, align 8, !tbaa !5
  %104 = load i32, ptr %15, align 4, !tbaa !9
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds ptr, ptr %103, i64 %105
  %107 = load ptr, ptr %106, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.Node, ptr %107, i32 0, i32 1
  %109 = load double, ptr %108, align 8, !tbaa !13
  store double %109, ptr %9, align 8, !tbaa !11
  %110 = load i32, ptr %15, align 4, !tbaa !9
  store i32 %110, ptr %7, align 4, !tbaa !9
  br label %135

111:                                              ; preds = %90
  %112 = load ptr, ptr %11, align 8, !tbaa !5
  %113 = load i32, ptr %15, align 4, !tbaa !9
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds ptr, ptr %112, i64 %114
  %116 = load ptr, ptr %115, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.Node, ptr %116, i32 0, i32 1
  %118 = load double, ptr %117, align 8, !tbaa !13
  %119 = load double, ptr %10, align 8, !tbaa !11
  %120 = fcmp olt double %118, %119
  br i1 %120, label %121, label %134

121:                                              ; preds = %111
  %122 = load i32, ptr %15, align 4, !tbaa !9
  %123 = load i32, ptr %7, align 4, !tbaa !9
  %124 = icmp ne i32 %122, %123
  br i1 %124, label %125, label %134

125:                                              ; preds = %121
  %126 = load ptr, ptr %11, align 8, !tbaa !5
  %127 = load i32, ptr %15, align 4, !tbaa !9
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds ptr, ptr %126, i64 %128
  %130 = load ptr, ptr %129, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.Node, ptr %130, i32 0, i32 1
  %132 = load double, ptr %131, align 8, !tbaa !13
  store double %132, ptr %10, align 8, !tbaa !11
  %133 = load i32, ptr %15, align 4, !tbaa !9
  store i32 %133, ptr %8, align 4, !tbaa !9
  br label %134

134:                                              ; preds = %125, %121, %111
  br label %135

135:                                              ; preds = %134, %100
  br label %136

136:                                              ; preds = %135
  %137 = load i32, ptr %15, align 4, !tbaa !9
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %15, align 4, !tbaa !9
  br label %85, !llvm.loop !23

139:                                              ; preds = %89
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %140 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 96) #9
  invoke void @_ZN4NodeI5StockEC2Ev(ptr noundef nonnull align 8 dereferenceable(96) %140)
          to label %141 unwind label %175

141:                                              ; preds = %139
  store ptr %140, ptr %16, align 8, !tbaa !5
  %142 = load ptr, ptr %11, align 8, !tbaa !5
  %143 = load i32, ptr %7, align 4, !tbaa !9
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds ptr, ptr %142, i64 %144
  %146 = load ptr, ptr %145, align 8, !tbaa !5
  %147 = load ptr, ptr %16, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.Node, ptr %147, i32 0, i32 2
  store ptr %146, ptr %148, align 8, !tbaa !19
  %149 = load ptr, ptr %11, align 8, !tbaa !5
  %150 = load i32, ptr %8, align 4, !tbaa !9
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds ptr, ptr %149, i64 %151
  %153 = load ptr, ptr %152, align 8, !tbaa !5
  %154 = load ptr, ptr %16, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.Node, ptr %154, i32 0, i32 3
  store ptr %153, ptr %155, align 8, !tbaa !20
  %156 = load double, ptr %9, align 8, !tbaa !11
  %157 = load double, ptr %10, align 8, !tbaa !11
  %158 = fadd double %156, %157
  %159 = load ptr, ptr %16, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.Node, ptr %159, i32 0, i32 1
  store double %158, ptr %160, align 8, !tbaa !13
  %161 = load ptr, ptr %16, align 8, !tbaa !5
  %162 = load ptr, ptr %11, align 8, !tbaa !5
  %163 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %164 = load i32, ptr %163, align 4, !tbaa !9
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds ptr, ptr %162, i64 %165
  store ptr %161, ptr %166, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  %167 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %168 = load i32, ptr %167, align 4, !tbaa !9
  store i32 %168, ptr %17, align 4, !tbaa !9
  br label %169

169:                                              ; preds = %190, %141
  %170 = load i32, ptr %17, align 4, !tbaa !9
  %171 = load i32, ptr %6, align 4, !tbaa !9
  %172 = sub nsw i32 %171, 1
  %173 = icmp slt i32 %170, %172
  br i1 %173, label %179, label %174

174:                                              ; preds = %169
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  br label %193

175:                                              ; preds = %139
  %176 = landingpad { ptr, i32 }
          cleanup
  %177 = extractvalue { ptr, i32 } %176, 0
  store ptr %177, ptr %13, align 8
  %178 = extractvalue { ptr, i32 } %176, 1
  store i32 %178, ptr %14, align 4
  call void @_ZdlPvm(ptr noundef %140, i64 noundef 96) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  br label %205

179:                                              ; preds = %169
  %180 = load ptr, ptr %11, align 8, !tbaa !5
  %181 = load i32, ptr %17, align 4, !tbaa !9
  %182 = add nsw i32 %181, 1
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds ptr, ptr %180, i64 %183
  %185 = load ptr, ptr %184, align 8, !tbaa !5
  %186 = load ptr, ptr %11, align 8, !tbaa !5
  %187 = load i32, ptr %17, align 4, !tbaa !9
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds ptr, ptr %186, i64 %188
  store ptr %185, ptr %189, align 8, !tbaa !5
  br label %190

190:                                              ; preds = %179
  %191 = load i32, ptr %17, align 4, !tbaa !9
  %192 = add nsw i32 %191, 1
  store i32 %192, ptr %17, align 4, !tbaa !9
  br label %169, !llvm.loop !24

193:                                              ; preds = %174
  %194 = load i32, ptr %6, align 4, !tbaa !9
  %195 = add nsw i32 %194, -1
  store i32 %195, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  br label %80, !llvm.loop !25

196:                                              ; preds = %80
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  %197 = load ptr, ptr %11, align 8, !tbaa !5
  %198 = getelementptr inbounds ptr, ptr %197, i64 0
  %199 = load ptr, ptr %198, align 8, !tbaa !5
  store ptr %199, ptr %18, align 8, !tbaa !5
  %200 = load ptr, ptr %11, align 8, !tbaa !5
  %201 = icmp eq ptr %200, null
  br i1 %201, label %203, label %202

202:                                              ; preds = %196
  call void @_ZdaPv(ptr noundef %200) #10
  br label %203

203:                                              ; preds = %202, %196
  store ptr null, ptr %11, align 8, !tbaa !5
  %204 = load ptr, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  ret ptr %204

205:                                              ; preds = %175, %75
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  br label %206

206:                                              ; preds = %205
  %207 = load ptr, ptr %13, align 8
  %208 = load i32, ptr %14, align 4
  %209 = insertvalue { ptr, i32 } poison, ptr %207, 0
  %210 = insertvalue { ptr, i32 } %209, i32 %208, 1
  resume { ptr, i32 } %210
}

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #3

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4NodeI5StockEC2Ev(ptr noundef nonnull align 8 dereferenceable(96)) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNSt14numeric_limitsIdE3maxEv() #6 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #7

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #7

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 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 #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 = { 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 #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }
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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !12, i64 72}
!14 = !{!"_ZTS4NodeI5StockE", !15, i64 0, !12, i64 72, !6, i64 80, !6, i64 88}
!15 = !{!"_ZTS5Stock", !16, i64 0, !16, i64 32, !12, i64 64}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !17, i64 0, !18, i64 8, !7, i64 16}
!17 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!18 = !{!"long", !7, i64 0}
!19 = !{!14, !6, i64 80}
!20 = !{!14, !6, i64 88}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}
!24 = distinct !{!24, !22}
!25 = distinct !{!25, !22}


; 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.Stock = type { %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", double }
%"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] }

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

declare i32 @__gxx_personality_v0(...)

; 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 uwtable
define dso_local noundef ptr @_Z17createHuffmanTreeP5StockPdi(ptr noundef %0, ptr nocapture noundef readonly %1, i32 noundef %2) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  %6 = zext i32 %2 to i64
  %7 = icmp slt i32 %2, 0
  %8 = shl nuw nsw i64 %6, 3
  %9 = select i1 %7, i64 -1, i64 %8
  %10 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %9) #9
  %11 = icmp sgt i32 %2, 0
  br i1 %11, label %.lr.ph, label %._crit_edge

.preheader:                                       ; preds = %14
  %.not98 = icmp eq i32 %2, 1
  br i1 %.not98, label %._crit_edge, label %.lr.ph77.preheader

.lr.ph77.preheader:                               ; preds = %.preheader
  %12 = zext nneg i32 %2 to i64
  br label %.lr.ph77

.lr.ph:                                           ; preds = %3, %14
  %indvars.iv = phi i64 [ %indvars.iv.next, %14 ], [ 0, %3 ]
  %13 = tail call noalias noundef nonnull dereferenceable(96) ptr @_Znwm(i64 noundef 96) #9
  invoke void @_ZN4NodeI5StockEC2Ev(ptr noundef nonnull align 8 dereferenceable(96) %13)
          to label %14 unwind label %22

14:                                               ; preds = %.lr.ph
  %15 = getelementptr inbounds ptr, ptr %10, i64 %indvars.iv
  store ptr %13, ptr %15, align 8, !tbaa !5
  %16 = getelementptr inbounds %class.Stock, ptr %0, i64 %indvars.iv
  %17 = tail call noundef nonnull align 8 dereferenceable(72) ptr @_ZN5StockaSERKS_(ptr noundef nonnull align 8 dereferenceable(72) %13, ptr noundef nonnull align 8 dereferenceable(72) %16)
  %18 = getelementptr inbounds double, ptr %1, i64 %indvars.iv
  %19 = load double, ptr %18, align 8, !tbaa !9
  %20 = getelementptr inbounds i8, ptr %13, i64 72
  store double %19, ptr %20, align 8, !tbaa !11
  %21 = getelementptr inbounds i8, ptr %13, i64 80
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %6
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %21, i8 0, i64 16, i1 false)
  br i1 %exitcond.not, label %.preheader, label %.lr.ph, !llvm.loop !17

22:                                               ; preds = %.lr.ph
  %23 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %13, i64 noundef 96) #10
  br label %81

.loopexit:                                        ; preds = %.lr.ph75, %middle.block, %46
  %24 = icmp sgt i64 %indvars.iv92, 2
  %indvar.next = add i64 %indvar, 1
  br i1 %24, label %.lr.ph77, label %._crit_edge, !llvm.loop !19

.lr.ph77:                                         ; preds = %.lr.ph77.preheader, %.loopexit
  %indvar = phi i64 [ 0, %.lr.ph77.preheader ], [ %indvar.next, %.loopexit ]
  %indvars.iv92 = phi i64 [ %12, %.lr.ph77.preheader ], [ %indvars.iv.next93, %.loopexit ]
  %25 = xor i64 %indvar, -1
  %26 = add i64 %25, %6
  store i32 0, ptr %5, align 4, !tbaa !20
  store i32 0, ptr %4, align 4, !tbaa !20
  %27 = call noundef double @_ZNSt14numeric_limitsIdE3maxEv() #8
  %.promoted = load i32, ptr %4, align 4
  br label %30

28:                                               ; preds = %44
  %29 = call noalias noundef nonnull dereferenceable(96) ptr @_Znwm(i64 noundef 96) #9
  invoke void @_ZN4NodeI5StockEC2Ev(ptr noundef nonnull align 8 dereferenceable(96) %29)
          to label %46 unwind label %74

30:                                               ; preds = %.lr.ph77, %44
  %indvars.iv82 = phi i64 [ 0, %.lr.ph77 ], [ %indvars.iv.next83, %44 ]
  %.05873 = phi double [ %27, %.lr.ph77 ], [ %.1, %44 ]
  %.06371 = phi double [ %27, %.lr.ph77 ], [ %.164, %44 ]
  %31 = phi i32 [ %.promoted, %.lr.ph77 ], [ %45, %44 ]
  %32 = getelementptr inbounds ptr, ptr %10, i64 %indvars.iv82
  %33 = load ptr, ptr %32, align 8, !tbaa !5
  %34 = getelementptr inbounds i8, ptr %33, i64 72
  %35 = load double, ptr %34, align 8, !tbaa !11
  %36 = fcmp olt double %35, %.05873
  br i1 %36, label %37, label %39

37:                                               ; preds = %30
  store i32 %31, ptr %5, align 4, !tbaa !20
  %38 = trunc nuw nsw i64 %indvars.iv82 to i32
  store i32 %38, ptr %4, align 4, !tbaa !20
  br label %44

39:                                               ; preds = %30
  %40 = fcmp uge double %35, %.06371
  %41 = zext i32 %31 to i64
  %.not = icmp eq i64 %indvars.iv82, %41
  %or.cond = select i1 %40, i1 true, i1 %.not
  br i1 %or.cond, label %44, label %42

42:                                               ; preds = %39
  %43 = trunc nuw nsw i64 %indvars.iv82 to i32
  store i32 %43, ptr %5, align 4, !tbaa !20
  br label %44

44:                                               ; preds = %37, %42, %39
  %45 = phi i32 [ %38, %37 ], [ %31, %42 ], [ %31, %39 ]
  %.164 = phi double [ %.05873, %37 ], [ %35, %42 ], [ %.06371, %39 ]
  %.1 = phi double [ %35, %37 ], [ %.05873, %42 ], [ %.05873, %39 ]
  %indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
  %exitcond86.not = icmp eq i64 %indvars.iv.next83, %indvars.iv92
  br i1 %exitcond86.not, label %28, label %30, !llvm.loop !22

46:                                               ; preds = %28
  %47 = load i32, ptr %4, align 4, !tbaa !20
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds ptr, ptr %10, i64 %48
  %50 = load ptr, ptr %49, align 8, !tbaa !5
  %51 = getelementptr inbounds i8, ptr %29, i64 80
  store ptr %50, ptr %51, align 8, !tbaa !23
  %52 = load i32, ptr %5, align 4, !tbaa !20
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds ptr, ptr %10, i64 %53
  %55 = load ptr, ptr %54, align 8, !tbaa !5
  %56 = getelementptr inbounds i8, ptr %29, i64 88
  store ptr %55, ptr %56, align 8, !tbaa !24
  %57 = fadd double %.164, %.1
  %58 = getelementptr inbounds i8, ptr %29, i64 72
  store double %57, ptr %58, align 8, !tbaa !11
  %59 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %60 = load i32, ptr %59, align 4, !tbaa !20
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds ptr, ptr %10, i64 %61
  store ptr %29, ptr %62, align 8, !tbaa !5
  %63 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %64 = load i32, ptr %63, align 4, !tbaa !20
  %indvars.iv.next93 = add nsw i64 %indvars.iv92, -1
  %65 = sext i32 %64 to i64
  %66 = icmp sgt i64 %indvars.iv.next93, %65
  br i1 %66, label %.lr.ph75.preheader, label %.loopexit

.lr.ph75.preheader:                               ; preds = %46
  %67 = sub i64 %26, %65
  %min.iters.check = icmp ult i64 %67, 4
  br i1 %min.iters.check, label %.lr.ph75.preheader103, label %vector.ph

.lr.ph75.preheader103:                            ; preds = %middle.block, %.lr.ph75.preheader
  %indvars.iv89.ph = phi i64 [ %65, %.lr.ph75.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph75

vector.ph:                                        ; preds = %.lr.ph75.preheader
  %n.vec = and i64 %67, -4
  %ind.end = add i64 %n.vec, %65
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = add i64 %index, %65
  %68 = getelementptr ptr, ptr %10, i64 %offset.idx
  %69 = getelementptr i8, ptr %68, i64 8
  %70 = getelementptr i8, ptr %68, i64 24
  %wide.load = load <2 x ptr>, ptr %69, align 8, !tbaa !5
  %wide.load102 = load <2 x ptr>, ptr %70, align 8, !tbaa !5
  %71 = getelementptr inbounds ptr, ptr %10, i64 %offset.idx
  %72 = getelementptr inbounds i8, ptr %71, i64 16
  store <2 x ptr> %wide.load, ptr %71, align 8, !tbaa !5
  store <2 x ptr> %wide.load102, ptr %72, align 8, !tbaa !5
  %index.next = add nuw i64 %index, 4
  %73 = icmp eq i64 %index.next, %n.vec
  br i1 %73, label %middle.block, label %vector.body, !llvm.loop !25

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %67, %n.vec
  br i1 %cmp.n, label %.loopexit, label %.lr.ph75.preheader103

74:                                               ; preds = %28
  %75 = landingpad { ptr, i32 }
          cleanup
  call void @_ZdlPvm(ptr noundef nonnull %29, i64 noundef 96) #10
  br label %81

.lr.ph75:                                         ; preds = %.lr.ph75.preheader103, %.lr.ph75
  %indvars.iv89 = phi i64 [ %indvars.iv.next90, %.lr.ph75 ], [ %indvars.iv89.ph, %.lr.ph75.preheader103 ]
  %indvars.iv.next90 = add nsw i64 %indvars.iv89, 1
  %76 = getelementptr inbounds ptr, ptr %10, i64 %indvars.iv.next90
  %77 = load ptr, ptr %76, align 8, !tbaa !5
  %78 = getelementptr inbounds ptr, ptr %10, i64 %indvars.iv89
  store ptr %77, ptr %78, align 8, !tbaa !5
  %79 = icmp slt i64 %indvars.iv.next90, %indvars.iv.next93
  br i1 %79, label %.lr.ph75, label %.loopexit, !llvm.loop !28

._crit_edge:                                      ; preds = %.loopexit, %3, %.preheader
  %80 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZdaPv(ptr noundef nonnull %10) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  ret ptr %80

81:                                               ; preds = %74, %22
  %.pn = phi { ptr, i32 } [ %23, %22 ], [ %75, %74 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  resume { ptr, i32 } %.pn
}

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4NodeI5StockEC2Ev(ptr noundef nonnull align 8 dereferenceable(96)) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNSt14numeric_limitsIdE3maxEv() local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #6

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7

attributes #0 = { mustprogress 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 = { 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 = { 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 #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 = { 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 #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }
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, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !10, i64 72}
!12 = !{!"_ZTS4NodeI5StockE", !13, i64 0, !10, i64 72, !6, i64 80, !6, i64 88}
!13 = !{!"_ZTS5Stock", !14, i64 0, !14, i64 32, !10, i64 64}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !15, i64 0, !16, i64 8, !7, i64 16}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = !{!21, !21, i64 0}
!21 = !{!"int", !7, i64 0}
!22 = distinct !{!22, !18}
!23 = !{!12, !6, i64 80}
!24 = !{!12, !6, i64 88}
!25 = distinct !{!25, !18, !26, !27}
!26 = !{!"llvm.loop.isvectorized", i32 1}
!27 = !{!"llvm.loop.unroll.runtime.disable"}
!28 = distinct !{!28, !18, !27, !26}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,MemCpyOptPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass