; LLVM IR from facebookresearch/habitat-sim :: src/deps/basis-universal/encoder (basisu_backend)

; 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.basisu::histogram" = type { %"class.basisu::vector.14" }
%"class.basisu::vector.14" = type { ptr, i32, i32 }
%"class.basisu::huffman_encoding_table" = type { %"class.basisu::vector.4", %"class.basisu::vector.0" }
%"class.basisu::vector.4" = type { ptr, i32, i32 }
%"class.basisu::vector.0" = type { ptr, i32, i32 }
%"class.basisu::bitwise_coder" = type { %"class.basisu::vector.0", i32, i32, i64 }
%"class.basisu::huff2D" = type { %"class.basisu::vector.14", %"class.basisu::huffman_encoding_table", %"class.basisu::histogram", i32, i32, i32, i32, i32, i32 }
%"struct.basist::etc1_selector_palette_entry" = type { [16 x i8] }
%"class.basisu::basisu_backend" = type { ptr, %"struct.basisu::basisu_backend_params", %"class.basisu::vector", %"struct.basisu::basisu_backend_output", ptr, %"class.basisu::vector.6", %"class.basisu::vector.8", %"class.basisu::vector.10", %"class.basisu::vector.12", %"class.basisu::vector.14", %"class.basisu::vector.14", %"class.basisu::vector.16", %"class.basisu::vector.16", %"class.basisu::vector.14", %"class.basisu::vector.14" }
%"struct.basisu::basisu_backend_params" = type <{ i8, i8, i8, i8, float, float, i32, i8, [3 x i8], i32, i32, i8, i8, [2 x i8] }>
%"class.basisu::vector" = type { ptr, i32, i32 }
%"struct.basisu::basisu_backend_output" = type { i32, i8, i8, i8, i32, i32, %"class.basisu::vector.0", %"class.basisu::vector.0", %"class.basisu::vector", %"class.basisu::vector.0", %"class.basisu::vector.2", %"class.basisu::vector.4" }
%"class.basisu::vector.2" = type { ptr, i32, i32 }
%"class.basisu::vector.6" = type { ptr, i32, i32 }
%"class.basisu::vector.8" = type { ptr, i32, i32 }
%"class.basisu::vector.10" = type { ptr, i32, i32 }
%"class.basisu::vector.12" = type { ptr, i32, i32 }
%"class.basisu::vector.16" = type { ptr, i32, i32 }
%"struct.basisu::basisu_backend::etc1_global_selector_cb_entry_desc" = type { i32, i32, i8 }
%"struct.basist::etc1_global_selector_codebook_entry_id" = type <{ i32, %"class.basist::etc1_global_palette_entry_modifier", [3 x i8] }>
%"class.basist::etc1_global_palette_entry_modifier" = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 }

@.str.32 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [79 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [84 x i8], align 1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

declare void @_ZN6basisu12debug_printfEPKcz(ptr noundef, ...) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496)) #2 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(16) ptr @_ZN6basisu6vectorIN6basist27etc1_selector_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZN6basisu6vectorINS_14basisu_backend34etc1_global_selector_cb_entry_descEEixEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6basisu15basisu_frontend46get_selector_cluster_global_selector_entry_idsEv(ptr noundef nonnull align 8 dereferenceable(496)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(17) ptr @_ZNK6basisu6vectorIN6basist38etc1_global_selector_codebook_entry_idEEixEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6basist34etc1_global_palette_entry_modifier9get_indexEv(ptr noundef nonnull align 1 dereferenceable(13)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6basisu15basisu_frontend39get_selector_cluster_uses_global_cb_vecEv(ptr noundef nonnull align 8 dereferenceable(496)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZNK6basisu6vectorIbEixEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16), i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu9histogramC2Ej(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6basisu9histogram3incEj(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNK6basisu9histogram9get_totalEv(ptr noundef nonnull align 8 dereferenceable(16)) #5 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN6basisu22huffman_encoding_table4initERKNS_9histogramEj(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #5 align 2

declare void @_ZN6basisu12error_printfEPKcz(ptr noundef, ...) #1

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6basisu13bitwise_coder4initEj(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) #6 align 2

declare noundef i32 @_ZN6basisu13bitwise_coder18emit_huffman_tableERKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef) #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNK6basisu14basisu_backend22get_total_input_texelsEv(ptr noundef nonnull align 8 dereferenceable(336)) #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN6basisu13bitwise_coder5flushEv(ptr noundef nonnull align 8 dereferenceable(32)) #6 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6basisu13bitwise_coder9get_bytesEv(ptr noundef nonnull align 8 dereferenceable(32)) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZN6basisu6vectorIhEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #6 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN6basisu13bitwise_coder8put_codeEjRKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, ptr noundef nonnull align 8 dereferenceable(32)) #6 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6basisu6vectorIhE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16)) #4 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN6basisu14basisu_backend23encode_selector_paletteEv(ptr noundef nonnull align 8 dereferenceable(336) %0) #5 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"class.basisu::histogram", align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca %"class.basisu::huffman_encoding_table", align 8
  %10 = alloca %"class.basisu::huffman_encoding_table", align 8
  %11 = alloca i32, align 4
  %12 = alloca %"class.basisu::bitwise_coder", align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %"class.basisu::huff2D", align 8
  %19 = alloca %"class.basisu::histogram", align 8
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i8, align 1
  %23 = alloca %"class.basisu::huffman_encoding_table", align 8
  %24 = alloca %"class.basisu::bitwise_coder", align 8
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  %31 = alloca i32, align 4
  %32 = alloca i32, align 4
  %33 = alloca i8, align 1
  %34 = alloca i32, align 4
  %35 = alloca %"class.basisu::histogram", align 8
  %36 = alloca i32, align 4
  %37 = alloca ptr, align 8
  %38 = alloca %"struct.basist::etc1_selector_palette_entry", align 1
  %39 = alloca i32, align 4
  %40 = alloca %"class.basisu::huffman_encoding_table", align 8
  %41 = alloca %"class.basisu::bitwise_coder", align 8
  %42 = alloca i32, align 4
  %43 = alloca i32, align 4
  %44 = alloca ptr, align 8
  %45 = alloca %"struct.basist::etc1_selector_palette_entry", align 1
  %46 = alloca i32, align 4
  %47 = alloca i32, align 4
  %48 = alloca i32, align 4
  %49 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %50 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  %51 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8, !tbaa !9
  store ptr %52, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 1
  %54 = getelementptr inbounds %"struct.basisu::basisu_backend_params", ptr %53, i32 0, i32 7
  %55 = load i8, ptr %54, align 8, !tbaa !27, !range !28, !noundef !29
  %56 = trunc i8 %55 to i1
  br i1 %56, label %57, label %263

57:                                               ; preds = %1
  %58 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 1
  %59 = getelementptr inbounds %"struct.basisu::basisu_backend_params", ptr %58, i32 0, i32 11
  %60 = load i8, ptr %59, align 4, !tbaa !30, !range !28, !noundef !29
  %61 = trunc i8 %60 to i1
  br i1 %61, label %263, label %62

62:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #7
  %63 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 1
  %64 = getelementptr inbounds %"struct.basisu::basisu_backend_params", ptr %63, i32 0, i32 10
  %65 = load i32, ptr %64, align 8, !tbaa !31
  %66 = shl i32 1, %65
  call void @_ZN6basisu9histogramC2Ej(ptr noundef nonnull align 8 dereferenceable(16) %5, i32 noundef %66)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 0, ptr %6, align 4, !tbaa !32
  br label %67

67:                                               ; preds = %87, %62
  %68 = load i32, ptr %6, align 4, !tbaa !32
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = invoke noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %69)
          to label %71 unwind label %74

71:                                               ; preds = %67
  %72 = icmp ult i32 %68, %70
  br i1 %72, label %78, label %73

73:                                               ; preds = %71
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %90

74:                                               ; preds = %83, %78, %67
  %75 = landingpad { ptr, i32 }
          cleanup
  %76 = extractvalue { ptr, i32 } %75, 0
  store ptr %76, ptr %7, align 8
  %77 = extractvalue { ptr, i32 } %75, 1
  store i32 %77, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %262

78:                                               ; preds = %71
  %79 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 7
  %80 = load i32, ptr %6, align 4, !tbaa !32
  %81 = zext i32 %80 to i64
  %82 = invoke noundef nonnull align 4 dereferenceable(12) ptr @_ZN6basisu6vectorINS_14basisu_backend34etc1_global_selector_cb_entry_descEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %79, i64 noundef %81)
          to label %83 unwind label %74

83:                                               ; preds = %78
  %84 = getelementptr inbounds %"struct.basisu::basisu_backend::etc1_global_selector_cb_entry_desc", ptr %82, i32 0, i32 1
  %85 = load i32, ptr %84, align 4, !tbaa !33
  invoke void @_ZN6basisu9histogram3incEj(ptr noundef nonnull align 8 dereferenceable(16) %5, i32 noundef %85)
          to label %86 unwind label %74

86:                                               ; preds = %83
  br label %87

87:                                               ; preds = %86
  %88 = load i32, ptr %6, align 4, !tbaa !32
  %89 = add i32 %88, 1
  store i32 %89, ptr %6, align 4, !tbaa !32
  br label %67, !llvm.loop !35

90:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #7
  invoke void @_ZN6basisu22huffman_encoding_tableC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9)
          to label %91 unwind label %97

91:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #7
  invoke void @_ZN6basisu22huffman_encoding_tableC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10)
          to label %92 unwind label %101

92:                                               ; preds = %91
  %93 = invoke noundef zeroext i1 @_ZN6basisu22huffman_encoding_table4initERKNS_9histogramEj(ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef nonnull align 8 dereferenceable(16) %5, i32 noundef 16)
          to label %94 unwind label %105

94:                                               ; preds = %92
  br i1 %93, label %109, label %95

95:                                               ; preds = %94
  invoke void (ptr, ...) @_ZN6basisu12error_printfEPKcz(ptr noundef @.str.32)
          to label %96 unwind label %105

96:                                               ; preds = %95
  store i1 false, ptr %2, align 1
  store i32 1, ptr %11, align 4
  br label %248

97:                                               ; preds = %90
  %98 = landingpad { ptr, i32 }
          cleanup
  %99 = extractvalue { ptr, i32 } %98, 0
  store ptr %99, ptr %7, align 8
  %100 = extractvalue { ptr, i32 } %98, 1
  store i32 %100, ptr %8, align 4
  br label %261

101:                                              ; preds = %91
  %102 = landingpad { ptr, i32 }
          cleanup
  %103 = extractvalue { ptr, i32 } %102, 0
  store ptr %103, ptr %7, align 8
  %104 = extractvalue { ptr, i32 } %102, 1
  store i32 %104, ptr %8, align 4
  br label %260

105:                                              ; preds = %95, %92
  %106 = landingpad { ptr, i32 }
          cleanup
  %107 = extractvalue { ptr, i32 } %106, 0
  store ptr %107, ptr %7, align 8
  %108 = extractvalue { ptr, i32 } %106, 1
  store i32 %108, ptr %8, align 4
  br label %259

109:                                              ; preds = %94
  call void @llvm.lifetime.start.p0(i64 32, ptr %12) #7
  invoke void @_ZN6basisu13bitwise_coderC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12)
          to label %110 unwind label %131

110:                                              ; preds = %109
  invoke void @_ZN6basisu13bitwise_coder4initEj(ptr noundef nonnull align 8 dereferenceable(32) %12, i32 noundef 1048576)
          to label %111 unwind label %135

111:                                              ; preds = %110
  %112 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %12, i32 noundef 1, i32 noundef 1)
          to label %113 unwind label %135

113:                                              ; preds = %111
  %114 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 1
  %115 = getelementptr inbounds %"struct.basisu::basisu_backend_params", ptr %114, i32 0, i32 9
  %116 = load i32, ptr %115, align 4, !tbaa !37
  %117 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %12, i32 noundef %116, i32 noundef 4)
          to label %118 unwind label %135

118:                                              ; preds = %113
  %119 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 1
  %120 = getelementptr inbounds %"struct.basisu::basisu_backend_params", ptr %119, i32 0, i32 10
  %121 = load i32, ptr %120, align 8, !tbaa !31
  %122 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %12, i32 noundef %121, i32 noundef 4)
          to label %123 unwind label %135

123:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 0, ptr %13, align 4, !tbaa !32
  %124 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 1
  %125 = getelementptr inbounds %"struct.basisu::basisu_backend_params", ptr %124, i32 0, i32 10
  %126 = load i32, ptr %125, align 8, !tbaa !31
  %127 = icmp ne i32 %126, 0
  br i1 %127, label %128, label %143

128:                                              ; preds = %123
  %129 = invoke noundef i32 @_ZN6basisu13bitwise_coder18emit_huffman_tableERKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %12, ptr noundef nonnull align 8 dereferenceable(32) %10)
          to label %130 unwind label %139

130:                                              ; preds = %128
  store i32 %129, ptr %13, align 4, !tbaa !32
  br label %143

131:                                              ; preds = %109
  %132 = landingpad { ptr, i32 }
          cleanup
  %133 = extractvalue { ptr, i32 } %132, 0
  store ptr %133, ptr %7, align 8
  %134 = extractvalue { ptr, i32 } %132, 1
  store i32 %134, ptr %8, align 4
  br label %258

135:                                              ; preds = %118, %113, %111, %110
  %136 = landingpad { ptr, i32 }
          cleanup
  %137 = extractvalue { ptr, i32 } %136, 0
  store ptr %137, ptr %7, align 8
  %138 = extractvalue { ptr, i32 } %136, 1
  store i32 %138, ptr %8, align 4
  br label %257

139:                                              ; preds = %128
  %140 = landingpad { ptr, i32 }
          cleanup
  %141 = extractvalue { ptr, i32 } %140, 0
  store ptr %141, ptr %7, align 8
  %142 = extractvalue { ptr, i32 } %140, 1
  store i32 %142, ptr %8, align 4
  br label %256

143:                                              ; preds = %130, %123
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store i32 0, ptr %15, align 4, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 0, ptr %16, align 4, !tbaa !32
  br label %144

144:                                              ; preds = %206, %143
  %145 = load i32, ptr %16, align 4, !tbaa !32
  %146 = load ptr, ptr %4, align 8, !tbaa !5
  %147 = invoke noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %146)
          to label %148 unwind label %151

148:                                              ; preds = %144
  %149 = icmp ult i32 %145, %147
  br i1 %149, label %155, label %150

150:                                              ; preds = %148
  store i32 5, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %210

151:                                              ; preds = %144
  %152 = landingpad { ptr, i32 }
          cleanup
  %153 = extractvalue { ptr, i32 } %152, 0
  store ptr %153, ptr %7, align 8
  %154 = extractvalue { ptr, i32 } %152, 1
  store i32 %154, ptr %8, align 4
  br label %209

155:                                              ; preds = %148
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %156 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 14
  %157 = load i32, ptr %16, align 4, !tbaa !32
  %158 = zext i32 %157 to i64
  %159 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %156, i64 noundef %158)
          to label %160 unwind label %184

160:                                              ; preds = %155
  %161 = load i32, ptr %159, align 4, !tbaa !32
  store i32 %161, ptr %17, align 4, !tbaa !32
  %162 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 1
  %163 = getelementptr inbounds %"struct.basisu::basisu_backend_params", ptr %162, i32 0, i32 9
  %164 = load i32, ptr %163, align 4, !tbaa !37
  %165 = icmp ne i32 %164, 0
  br i1 %165, label %166, label %188

166:                                              ; preds = %160
  %167 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 7
  %168 = load i32, ptr %17, align 4, !tbaa !32
  %169 = zext i32 %168 to i64
  %170 = invoke noundef nonnull align 4 dereferenceable(12) ptr @_ZN6basisu6vectorINS_14basisu_backend34etc1_global_selector_cb_entry_descEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %167, i64 noundef %169)
          to label %171 unwind label %184

171:                                              ; preds = %166
  %172 = getelementptr inbounds %"struct.basisu::basisu_backend::etc1_global_selector_cb_entry_desc", ptr %170, i32 0, i32 0
  %173 = load i32, ptr %172, align 4, !tbaa !38
  %174 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 1
  %175 = getelementptr inbounds %"struct.basisu::basisu_backend_params", ptr %174, i32 0, i32 9
  %176 = load i32, ptr %175, align 4, !tbaa !37
  %177 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %12, i32 noundef %173, i32 noundef %176)
          to label %178 unwind label %184

178:                                              ; preds = %171
  %179 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 1
  %180 = getelementptr inbounds %"struct.basisu::basisu_backend_params", ptr %179, i32 0, i32 9
  %181 = load i32, ptr %180, align 4, !tbaa !37
  %182 = load i32, ptr %14, align 4, !tbaa !32
  %183 = add i32 %182, %181
  store i32 %183, ptr %14, align 4, !tbaa !32
  br label %188

184:                                              ; preds = %198, %193, %171, %166, %155
  %185 = landingpad { ptr, i32 }
          cleanup
  %186 = extractvalue { ptr, i32 } %185, 0
  store ptr %186, ptr %7, align 8
  %187 = extractvalue { ptr, i32 } %185, 1
  store i32 %187, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %209

188:                                              ; preds = %178, %160
  %189 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 1
  %190 = getelementptr inbounds %"struct.basisu::basisu_backend_params", ptr %189, i32 0, i32 10
  %191 = load i32, ptr %190, align 8, !tbaa !31
  %192 = icmp ne i32 %191, 0
  br i1 %192, label %193, label %205

193:                                              ; preds = %188
  %194 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 7
  %195 = load i32, ptr %17, align 4, !tbaa !32
  %196 = zext i32 %195 to i64
  %197 = invoke noundef nonnull align 4 dereferenceable(12) ptr @_ZN6basisu6vectorINS_14basisu_backend34etc1_global_selector_cb_entry_descEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %194, i64 noundef %196)
          to label %198 unwind label %184

198:                                              ; preds = %193
  %199 = getelementptr inbounds %"struct.basisu::basisu_backend::etc1_global_selector_cb_entry_desc", ptr %197, i32 0, i32 1
  %200 = load i32, ptr %199, align 4, !tbaa !33
  %201 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_codeEjRKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %12, i32 noundef %200, ptr noundef nonnull align 8 dereferenceable(32) %10)
          to label %202 unwind label %184

202:                                              ; preds = %198
  %203 = load i32, ptr %15, align 4, !tbaa !32
  %204 = add i32 %203, %201
  store i32 %204, ptr %15, align 4, !tbaa !32
  br label %205

205:                                              ; preds = %202, %188
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %206

206:                                              ; preds = %205
  %207 = load i32, ptr %16, align 4, !tbaa !32
  %208 = add i32 %207, 1
  store i32 %208, ptr %16, align 4, !tbaa !32
  br label %144, !llvm.loop !39

209:                                              ; preds = %184, %151
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %255

210:                                              ; preds = %150
  %211 = invoke noundef i32 @_ZN6basisu13bitwise_coder5flushEv(ptr noundef nonnull align 8 dereferenceable(32) %12)
          to label %212 unwind label %251

212:                                              ; preds = %210
  %213 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6basisu13bitwise_coder9get_bytesEv(ptr noundef nonnull align 8 dereferenceable(32) %12)
          to label %214 unwind label %251

214:                                              ; preds = %212
  %215 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 3
  %216 = getelementptr inbounds %"struct.basisu::basisu_backend_output", ptr %215, i32 0, i32 7
  %217 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN6basisu6vectorIhEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %216, ptr noundef nonnull align 8 dereferenceable(16) %213)
          to label %218 unwind label %251

218:                                              ; preds = %214
  %219 = load i32, ptr %13, align 4, !tbaa !32
  %220 = load i32, ptr %13, align 4, !tbaa !32
  %221 = uitofp i32 %220 to float
  %222 = load ptr, ptr %4, align 8, !tbaa !5
  %223 = invoke noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %222)
          to label %224 unwind label %251

224:                                              ; preds = %218
  %225 = uitofp i32 %223 to float
  %226 = fdiv float %221, %225
  %227 = fpext float %226 to double
  invoke void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef @.str.33, i32 noundef %219, double noundef %227)
          to label %228 unwind label %251

228:                                              ; preds = %224
  %229 = load i32, ptr %14, align 4, !tbaa !32
  %230 = load i32, ptr %14, align 4, !tbaa !32
  %231 = uitofp i32 %230 to float
  %232 = load ptr, ptr %4, align 8, !tbaa !5
  %233 = invoke noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %232)
          to label %234 unwind label %251

234:                                              ; preds = %228
  %235 = uitofp i32 %233 to float
  %236 = fdiv float %231, %235
  %237 = fpext float %236 to double
  %238 = load i32, ptr %15, align 4, !tbaa !32
  %239 = load i32, ptr %15, align 4, !tbaa !32
  %240 = uitofp i32 %239 to float
  %241 = load ptr, ptr %4, align 8, !tbaa !5
  %242 = invoke noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %241)
          to label %243 unwind label %251

243:                                              ; preds = %234
  %244 = uitofp i32 %242 to float
  %245 = fdiv float %240, %244
  %246 = fpext float %245 to double
  invoke void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef @.str.34, i32 noundef %229, double noundef %237, i32 noundef %238, double noundef %246)
          to label %247 unwind label %251

247:                                              ; preds = %243
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @_ZN6basisu13bitwise_coderD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %12) #7
  store i32 0, ptr %11, align 4
  br label %248

248:                                              ; preds = %247, %96
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #7
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #7
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #7
  %249 = load i32, ptr %11, align 4
  switch i32 %249, label %885 [
    i32 0, label %250
  ]

250:                                              ; preds = %248
  br label %858

251:                                              ; preds = %243, %234, %228, %224, %218, %214, %212, %210
  %252 = landingpad { ptr, i32 }
          cleanup
  %253 = extractvalue { ptr, i32 } %252, 0
  store ptr %253, ptr %7, align 8
  %254 = extractvalue { ptr, i32 } %252, 1
  store i32 %254, ptr %8, align 4
  br label %255

255:                                              ; preds = %251, %209
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %256

256:                                              ; preds = %255, %139
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %257

257:                                              ; preds = %256, %135
  call void @_ZN6basisu13bitwise_coderD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #7
  br label %258

258:                                              ; preds = %257, %131
  call void @llvm.lifetime.end.p0(i64 32, ptr %12) #7
  br label %259

259:                                              ; preds = %258, %105
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #7
  br label %260

260:                                              ; preds = %259, %101
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #7
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #7
  br label %261

261:                                              ; preds = %260, %97
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #7
  br label %262

262:                                              ; preds = %261, %74
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #7
  br label %887

263:                                              ; preds = %57, %1
  %264 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 1
  %265 = getelementptr inbounds %"struct.basisu::basisu_backend_params", ptr %264, i32 0, i32 11
  %266 = load i8, ptr %265, align 4, !tbaa !30, !range !28, !noundef !29
  %267 = trunc i8 %266 to i1
  br i1 %267, label %268, label %544

268:                                              ; preds = %263
  call void @llvm.lifetime.start.p0(i64 88, ptr %18) #7
  call void @_ZN6basisu6huff2DC2Ejj(ptr noundef nonnull align 8 dereferenceable(88) %18, i32 noundef 1, i32 noundef 8)
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #7
  %269 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 1
  %270 = getelementptr inbounds %"struct.basisu::basisu_backend_params", ptr %269, i32 0, i32 10
  %271 = load i32, ptr %270, align 8, !tbaa !31
  %272 = shl i32 1, %271
  invoke void @_ZN6basisu9histogramC2Ej(ptr noundef nonnull align 8 dereferenceable(16) %19, i32 noundef %272)
          to label %273 unwind label %281

273:                                              ; preds = %268
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  store i32 0, ptr %20, align 4, !tbaa !32
  br label %274

274:                                              ; preds = %318, %273
  %275 = load i32, ptr %20, align 4, !tbaa !32
  %276 = load ptr, ptr %4, align 8, !tbaa !5
  %277 = invoke noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %276)
          to label %278 unwind label %285

278:                                              ; preds = %274
  %279 = icmp ult i32 %275, %277
  br i1 %279, label %289, label %280

280:                                              ; preds = %278
  store i32 8, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %331

281:                                              ; preds = %268
  %282 = landingpad { ptr, i32 }
          cleanup
  %283 = extractvalue { ptr, i32 } %282, 0
  store ptr %283, ptr %7, align 8
  %284 = extractvalue { ptr, i32 } %282, 1
  store i32 %284, ptr %8, align 4
  br label %543

285:                                              ; preds = %274
  %286 = landingpad { ptr, i32 }
          cleanup
  %287 = extractvalue { ptr, i32 } %286, 0
  store ptr %287, ptr %7, align 8
  %288 = extractvalue { ptr, i32 } %286, 1
  store i32 %288, ptr %8, align 4
  br label %330

289:                                              ; preds = %278
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  %290 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 14
  %291 = load i32, ptr %20, align 4, !tbaa !32
  %292 = zext i32 %291 to i64
  %293 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %290, i64 noundef %292)
          to label %294 unwind label %321

294:                                              ; preds = %289
  %295 = load i32, ptr %293, align 4, !tbaa !32
  store i32 %295, ptr %21, align 4, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 1, ptr %22) #7
  %296 = load ptr, ptr %4, align 8, !tbaa !5
  %297 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6basisu15basisu_frontend39get_selector_cluster_uses_global_cb_vecEv(ptr noundef nonnull align 8 dereferenceable(496) %296)
          to label %298 unwind label %325

298:                                              ; preds = %294
  %299 = load i32, ptr %21, align 4, !tbaa !32
  %300 = zext i32 %299 to i64
  %301 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNK6basisu6vectorIbEixEm(ptr noundef nonnull align 8 dereferenceable(16) %297, i64 noundef %300)
          to label %302 unwind label %325

302:                                              ; preds = %298
  %303 = load i8, ptr %301, align 1, !tbaa !40, !range !28, !noundef !29
  %304 = trunc i8 %303 to i1
  %305 = zext i1 %304 to i8
  store i8 %305, ptr %22, align 1, !tbaa !40
  %306 = load i8, ptr %22, align 1, !tbaa !40, !range !28, !noundef !29
  %307 = trunc i8 %306 to i1
  %308 = zext i1 %307 to i32
  invoke void @_ZN6basisu6huff2D4emitEj(ptr noundef nonnull align 8 dereferenceable(88) %18, i32 noundef %308)
          to label %309 unwind label %325

309:                                              ; preds = %302
  %310 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 7
  %311 = load i32, ptr %21, align 4, !tbaa !32
  %312 = zext i32 %311 to i64
  %313 = invoke noundef nonnull align 4 dereferenceable(12) ptr @_ZN6basisu6vectorINS_14basisu_backend34etc1_global_selector_cb_entry_descEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %310, i64 noundef %312)
          to label %314 unwind label %325

314:                                              ; preds = %309
  %315 = getelementptr inbounds %"struct.basisu::basisu_backend::etc1_global_selector_cb_entry_desc", ptr %313, i32 0, i32 1
  %316 = load i32, ptr %315, align 4, !tbaa !33
  invoke void @_ZN6basisu9histogram3incEj(ptr noundef nonnull align 8 dereferenceable(16) %19, i32 noundef %316)
          to label %317 unwind label %325

317:                                              ; preds = %314
  call void @llvm.lifetime.end.p0(i64 1, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %318

318:                                              ; preds = %317
  %319 = load i32, ptr %20, align 4, !tbaa !32
  %320 = add i32 %319, 1
  store i32 %320, ptr %20, align 4, !tbaa !32
  br label %274, !llvm.loop !41

321:                                              ; preds = %289
  %322 = landingpad { ptr, i32 }
          cleanup
  %323 = extractvalue { ptr, i32 } %322, 0
  store ptr %323, ptr %7, align 8
  %324 = extractvalue { ptr, i32 } %322, 1
  store i32 %324, ptr %8, align 4
  br label %329

325:                                              ; preds = %314, %309, %302, %298, %294
  %326 = landingpad { ptr, i32 }
          cleanup
  %327 = extractvalue { ptr, i32 } %326, 0
  store ptr %327, ptr %7, align 8
  %328 = extractvalue { ptr, i32 } %326, 1
  store i32 %328, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %22) #7
  br label %329

329:                                              ; preds = %325, %321
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %330

330:                                              ; preds = %329, %285
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %542

331:                                              ; preds = %280
  call void @llvm.lifetime.start.p0(i64 32, ptr %23) #7
  invoke void @_ZN6basisu22huffman_encoding_tableC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %23)
          to label %332 unwind label %337

332:                                              ; preds = %331
  %333 = invoke noundef zeroext i1 @_ZN6basisu22huffman_encoding_table4initERKNS_9histogramEj(ptr noundef nonnull align 8 dereferenceable(32) %23, ptr noundef nonnull align 8 dereferenceable(16) %19, i32 noundef 16)
          to label %334 unwind label %341

334:                                              ; preds = %332
  br i1 %333, label %345, label %335

335:                                              ; preds = %334
  invoke void (ptr, ...) @_ZN6basisu12error_printfEPKcz(ptr noundef @.str.35)
          to label %336 unwind label %341

336:                                              ; preds = %335
  store i1 false, ptr %2, align 1
  store i32 1, ptr %11, align 4
  br label %530

337:                                              ; preds = %331
  %338 = landingpad { ptr, i32 }
          cleanup
  %339 = extractvalue { ptr, i32 } %338, 0
  store ptr %339, ptr %7, align 8
  %340 = extractvalue { ptr, i32 } %338, 1
  store i32 %340, ptr %8, align 4
  br label %541

341:                                              ; preds = %335, %332
  %342 = landingpad { ptr, i32 }
          cleanup
  %343 = extractvalue { ptr, i32 } %342, 0
  store ptr %343, ptr %7, align 8
  %344 = extractvalue { ptr, i32 } %342, 1
  store i32 %344, ptr %8, align 4
  br label %540

345:                                              ; preds = %334
  call void @llvm.lifetime.start.p0(i64 32, ptr %24) #7
  invoke void @_ZN6basisu13bitwise_coderC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %24)
          to label %346 unwind label %375

346:                                              ; preds = %345
  invoke void @_ZN6basisu13bitwise_coder4initEj(ptr noundef nonnull align 8 dereferenceable(32) %24, i32 noundef 1048576)
          to label %347 unwind label %379

347:                                              ; preds = %346
  %348 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %24, i32 noundef 0, i32 noundef 1)
          to label %349 unwind label %379

349:                                              ; preds = %347
  %350 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %24, i32 noundef 1, i32 noundef 1)
          to label %351 unwind label %379

351:                                              ; preds = %349
  %352 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 1
  %353 = getelementptr inbounds %"struct.basisu::basisu_backend_params", ptr %352, i32 0, i32 9
  %354 = load i32, ptr %353, align 4, !tbaa !37
  %355 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %24, i32 noundef %354, i32 noundef 4)
          to label %356 unwind label %379

356:                                              ; preds = %351
  %357 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 1
  %358 = getelementptr inbounds %"struct.basisu::basisu_backend_params", ptr %357, i32 0, i32 10
  %359 = load i32, ptr %358, align 8, !tbaa !31
  %360 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %24, i32 noundef %359, i32 noundef 4)
          to label %361 unwind label %379

361:                                              ; preds = %356
  %362 = invoke noundef zeroext i1 @_ZN6basisu6huff2D14start_encodingEj(ptr noundef nonnull align 8 dereferenceable(88) %18, i32 noundef 16)
          to label %363 unwind label %379

363:                                              ; preds = %361
  %364 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNK6basisu6huff2D18get_encoding_tableEv(ptr noundef nonnull align 8 dereferenceable(88) %18)
          to label %365 unwind label %379

365:                                              ; preds = %363
  %366 = invoke noundef i32 @_ZN6basisu13bitwise_coder18emit_huffman_tableERKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %24, ptr noundef nonnull align 8 dereferenceable(32) %364)
          to label %367 unwind label %379

367:                                              ; preds = %365
  %368 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 1
  %369 = getelementptr inbounds %"struct.basisu::basisu_backend_params", ptr %368, i32 0, i32 10
  %370 = load i32, ptr %369, align 8, !tbaa !31
  %371 = icmp ne i32 %370, 0
  br i1 %371, label %372, label %383

372:                                              ; preds = %367
  %373 = invoke noundef i32 @_ZN6basisu13bitwise_coder18emit_huffman_tableERKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %24, ptr noundef nonnull align 8 dereferenceable(32) %23)
          to label %374 unwind label %379

374:                                              ; preds = %372
  br label %383

375:                                              ; preds = %345
  %376 = landingpad { ptr, i32 }
          cleanup
  %377 = extractvalue { ptr, i32 } %376, 0
  store ptr %377, ptr %7, align 8
  %378 = extractvalue { ptr, i32 } %376, 1
  store i32 %378, ptr %8, align 4
  br label %539

379:                                              ; preds = %372, %365, %363, %361, %356, %351, %349, %347, %346
  %380 = landingpad { ptr, i32 }
          cleanup
  %381 = extractvalue { ptr, i32 } %380, 0
  store ptr %381, ptr %7, align 8
  %382 = extractvalue { ptr, i32 } %380, 1
  store i32 %382, ptr %8, align 4
  br label %538

383:                                              ; preds = %374, %367
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #7
  store i32 0, ptr %25, align 4, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #7
  store i32 0, ptr %26, align 4, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #7
  store i32 0, ptr %27, align 4, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #7
  store i32 0, ptr %28, align 4, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #7
  store i32 0, ptr %29, align 4, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #7
  store i32 0, ptr %30, align 4, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #7
  store i32 0, ptr %31, align 4, !tbaa !32
  br label %384

384:                                              ; preds = %488, %383
  %385 = load i32, ptr %31, align 4, !tbaa !32
  %386 = load ptr, ptr %4, align 8, !tbaa !5
  %387 = invoke noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %386)
          to label %388 unwind label %391

388:                                              ; preds = %384
  %389 = icmp ult i32 %385, %387
  br i1 %389, label %395, label %390

390:                                              ; preds = %388
  store i32 11, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #7
  br label %494

391:                                              ; preds = %384
  %392 = landingpad { ptr, i32 }
          cleanup
  %393 = extractvalue { ptr, i32 } %392, 0
  store ptr %393, ptr %7, align 8
  %394 = extractvalue { ptr, i32 } %392, 1
  store i32 %394, ptr %8, align 4
  br label %493

395:                                              ; preds = %388
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #7
  %396 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 14
  %397 = load i32, ptr %31, align 4, !tbaa !32
  %398 = zext i32 %397 to i64
  %399 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %396, i64 noundef %398)
          to label %400 unwind label %451

400:                                              ; preds = %395
  %401 = load i32, ptr %399, align 4, !tbaa !32
  store i32 %401, ptr %32, align 4, !tbaa !32
  %402 = invoke noundef i32 @_ZN6basisu6huff2D13emit_next_symERNS_13bitwise_coderE(ptr noundef nonnull align 8 dereferenceable(88) %18, ptr noundef nonnull align 8 dereferenceable(32) %24)
          to label %403 unwind label %451

403:                                              ; preds = %400
  %404 = load i32, ptr %30, align 4, !tbaa !32
  %405 = add i32 %404, %402
  store i32 %405, ptr %30, align 4, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 1, ptr %33) #7
  %406 = load ptr, ptr %4, align 8, !tbaa !5
  %407 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6basisu15basisu_frontend39get_selector_cluster_uses_global_cb_vecEv(ptr noundef nonnull align 8 dereferenceable(496) %406)
          to label %408 unwind label %455

408:                                              ; preds = %403
  %409 = load i32, ptr %32, align 4, !tbaa !32
  %410 = zext i32 %409 to i64
  %411 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNK6basisu6vectorIbEixEm(ptr noundef nonnull align 8 dereferenceable(16) %407, i64 noundef %410)
          to label %412 unwind label %455

412:                                              ; preds = %408
  %413 = load i8, ptr %411, align 1, !tbaa !40, !range !28, !noundef !29
  %414 = trunc i8 %413 to i1
  %415 = zext i1 %414 to i8
  store i8 %415, ptr %33, align 1, !tbaa !40
  %416 = load i8, ptr %33, align 1, !tbaa !40, !range !28, !noundef !29
  %417 = trunc i8 %416 to i1
  br i1 %417, label %418, label %459

418:                                              ; preds = %412
  %419 = load i32, ptr %25, align 4, !tbaa !32
  %420 = add i32 %419, 1
  store i32 %420, ptr %25, align 4, !tbaa !32
  %421 = load ptr, ptr %4, align 8, !tbaa !5
  %422 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6basisu15basisu_frontend46get_selector_cluster_global_selector_entry_idsEv(ptr noundef nonnull align 8 dereferenceable(496) %421)
          to label %423 unwind label %455

423:                                              ; preds = %418
  %424 = load i32, ptr %32, align 4, !tbaa !32
  %425 = zext i32 %424 to i64
  %426 = invoke noundef nonnull align 4 dereferenceable(17) ptr @_ZNK6basisu6vectorIN6basist38etc1_global_selector_codebook_entry_idEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %422, i64 noundef %425)
          to label %427 unwind label %455

427:                                              ; preds = %423
  %428 = getelementptr inbounds %"struct.basist::etc1_global_selector_codebook_entry_id", ptr %426, i32 0, i32 0
  %429 = load i32, ptr %428, align 4, !tbaa !42
  %430 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 1
  %431 = getelementptr inbounds %"struct.basisu::basisu_backend_params", ptr %430, i32 0, i32 9
  %432 = load i32, ptr %431, align 4, !tbaa !37
  %433 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %24, i32 noundef %429, i32 noundef %432)
          to label %434 unwind label %455

434:                                              ; preds = %427
  %435 = load i32, ptr %26, align 4, !tbaa !32
  %436 = add i32 %435, %433
  store i32 %436, ptr %26, align 4, !tbaa !32
  %437 = load ptr, ptr %4, align 8, !tbaa !5
  %438 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6basisu15basisu_frontend46get_selector_cluster_global_selector_entry_idsEv(ptr noundef nonnull align 8 dereferenceable(496) %437)
          to label %439 unwind label %455

439:                                              ; preds = %434
  %440 = load i32, ptr %32, align 4, !tbaa !32
  %441 = zext i32 %440 to i64
  %442 = invoke noundef nonnull align 4 dereferenceable(17) ptr @_ZNK6basisu6vectorIN6basist38etc1_global_selector_codebook_entry_idEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %438, i64 noundef %441)
          to label %443 unwind label %455

443:                                              ; preds = %439
  %444 = getelementptr inbounds %"struct.basist::etc1_global_selector_codebook_entry_id", ptr %442, i32 0, i32 1
  %445 = invoke noundef i32 @_ZNK6basist34etc1_global_palette_entry_modifier9get_indexEv(ptr noundef nonnull align 1 dereferenceable(13) %444)
          to label %446 unwind label %455

446:                                              ; preds = %443
  %447 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_codeEjRKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %24, i32 noundef %445, ptr noundef nonnull align 8 dereferenceable(32) %23)
          to label %448 unwind label %455

448:                                              ; preds = %446
  %449 = load i32, ptr %27, align 4, !tbaa !32
  %450 = add i32 %449, %447
  store i32 %450, ptr %27, align 4, !tbaa !32
  br label %487

451:                                              ; preds = %400, %395
  %452 = landingpad { ptr, i32 }
          cleanup
  %453 = extractvalue { ptr, i32 } %452, 0
  store ptr %453, ptr %7, align 8
  %454 = extractvalue { ptr, i32 } %452, 1
  store i32 %454, ptr %8, align 4
  br label %492

455:                                              ; preds = %446, %443, %439, %434, %427, %423, %418, %408, %403
  %456 = landingpad { ptr, i32 }
          cleanup
  %457 = extractvalue { ptr, i32 } %456, 0
  store ptr %457, ptr %7, align 8
  %458 = extractvalue { ptr, i32 } %456, 1
  store i32 %458, ptr %8, align 4
  br label %491

459:                                              ; preds = %412
  %460 = load i32, ptr %28, align 4, !tbaa !32
  %461 = add i32 %460, 1
  store i32 %461, ptr %28, align 4, !tbaa !32
  %462 = load i32, ptr %29, align 4, !tbaa !32
  %463 = add i32 %462, 32
  store i32 %463, ptr %29, align 4, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 4, ptr %34) #7
  store i32 0, ptr %34, align 4, !tbaa !32
  br label %464

464:                                              ; preds = %479, %459
  %465 = load i32, ptr %34, align 4, !tbaa !32
  %466 = icmp ult i32 %465, 4
  br i1 %466, label %468, label %467

467:                                              ; preds = %464
  store i32 14, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #7
  br label %486

468:                                              ; preds = %464
  %469 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 6
  %470 = load i32, ptr %32, align 4, !tbaa !32
  %471 = zext i32 %470 to i64
  %472 = invoke noundef nonnull align 1 dereferenceable(16) ptr @_ZN6basisu6vectorIN6basist27etc1_selector_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %469, i64 noundef %471)
          to label %473 unwind label %482

473:                                              ; preds = %468
  %474 = load i32, ptr %34, align 4, !tbaa !32
  %475 = invoke noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %472, i32 noundef %474)
          to label %476 unwind label %482

476:                                              ; preds = %473
  %477 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %24, i32 noundef %475, i32 noundef 8)
          to label %478 unwind label %482

478:                                              ; preds = %476
  br label %479

479:                                              ; preds = %478
  %480 = load i32, ptr %34, align 4, !tbaa !32
  %481 = add i32 %480, 1
  store i32 %481, ptr %34, align 4, !tbaa !32
  br label %464, !llvm.loop !45

482:                                              ; preds = %476, %473, %468
  %483 = landingpad { ptr, i32 }
          cleanup
  %484 = extractvalue { ptr, i32 } %483, 0
  store ptr %484, ptr %7, align 8
  %485 = extractvalue { ptr, i32 } %483, 1
  store i32 %485, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #7
  br label %491

486:                                              ; preds = %467
  br label %487

487:                                              ; preds = %486, %448
  call void @llvm.lifetime.end.p0(i64 1, ptr %33) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #7
  br label %488

488:                                              ; preds = %487
  %489 = load i32, ptr %31, align 4, !tbaa !32
  %490 = add i32 %489, 1
  store i32 %490, ptr %31, align 4, !tbaa !32
  br label %384, !llvm.loop !46

491:                                              ; preds = %482, %455
  call void @llvm.lifetime.end.p0(i64 1, ptr %33) #7
  br label %492

492:                                              ; preds = %491, %451
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #7
  br label %493

493:                                              ; preds = %492, %391
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #7
  br label %537

494:                                              ; preds = %390
  %495 = invoke noundef i32 @_ZN6basisu13bitwise_coder5flushEv(ptr noundef nonnull align 8 dereferenceable(32) %24)
          to label %496 unwind label %533

496:                                              ; preds = %494
  %497 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6basisu13bitwise_coder9get_bytesEv(ptr noundef nonnull align 8 dereferenceable(32) %24)
          to label %498 unwind label %533

498:                                              ; preds = %496
  %499 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 3
  %500 = getelementptr inbounds %"struct.basisu::basisu_backend_output", ptr %499, i32 0, i32 7
  %501 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN6basisu6vectorIhEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %500, ptr noundef nonnull align 8 dereferenceable(16) %497)
          to label %502 unwind label %533

502:                                              ; preds = %498
  %503 = load i32, ptr %25, align 4, !tbaa !32
  %504 = load i32, ptr %25, align 4, !tbaa !32
  %505 = uitofp i32 %504 to float
  %506 = fmul float %505, 1.000000e+02
  %507 = load ptr, ptr %4, align 8, !tbaa !5
  %508 = invoke noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %507)
          to label %509 unwind label %533

509:                                              ; preds = %502
  %510 = uitofp i32 %508 to float
  %511 = fdiv float %506, %510
  %512 = fpext float %511 to double
  invoke void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef @.str.36, i32 noundef %503, double noundef %512)
          to label %513 unwind label %533

513:                                              ; preds = %509
  %514 = load i32, ptr %28, align 4, !tbaa !32
  %515 = load i32, ptr %28, align 4, !tbaa !32
  %516 = uitofp i32 %515 to float
  %517 = fmul float %516, 1.000000e+02
  %518 = load ptr, ptr %4, align 8, !tbaa !5
  %519 = invoke noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %518)
          to label %520 unwind label %533

520:                                              ; preds = %513
  %521 = uitofp i32 %519 to float
  %522 = fdiv float %517, %521
  %523 = fpext float %522 to double
  invoke void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef @.str.37, i32 noundef %514, double noundef %523)
          to label %524 unwind label %533

524:                                              ; preds = %520
  %525 = load i32, ptr %26, align 4, !tbaa !32
  %526 = load i32, ptr %27, align 4, !tbaa !32
  %527 = load i32, ptr %29, align 4, !tbaa !32
  %528 = load i32, ptr %30, align 4, !tbaa !32
  invoke void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef @.str.38, i32 noundef %525, i32 noundef %526, i32 noundef %527, i32 noundef %528)
          to label %529 unwind label %533

529:                                              ; preds = %524
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #7
  call void @_ZN6basisu13bitwise_coderD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %24) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %24) #7
  store i32 0, ptr %11, align 4
  br label %530

530:                                              ; preds = %529, %336
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %23) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %23) #7
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %19) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #7
  call void @_ZN6basisu6huff2DD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %18) #7
  call void @llvm.lifetime.end.p0(i64 88, ptr %18) #7
  %531 = load i32, ptr %11, align 4
  switch i32 %531, label %885 [
    i32 0, label %532
  ]

532:                                              ; preds = %530
  br label %857

533:                                              ; preds = %524, %520, %513, %509, %502, %498, %496, %494
  %534 = landingpad { ptr, i32 }
          cleanup
  %535 = extractvalue { ptr, i32 } %534, 0
  store ptr %535, ptr %7, align 8
  %536 = extractvalue { ptr, i32 } %534, 1
  store i32 %536, ptr %8, align 4
  br label %537

537:                                              ; preds = %533, %493
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #7
  br label %538

538:                                              ; preds = %537, %379
  call void @_ZN6basisu13bitwise_coderD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %24) #7
  br label %539

539:                                              ; preds = %538, %375
  call void @llvm.lifetime.end.p0(i64 32, ptr %24) #7
  br label %540

540:                                              ; preds = %539, %341
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %23) #7
  br label %541

541:                                              ; preds = %540, %337
  call void @llvm.lifetime.end.p0(i64 32, ptr %23) #7
  br label %542

542:                                              ; preds = %541, %330
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %19) #7
  br label %543

543:                                              ; preds = %542, %281
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #7
  call void @_ZN6basisu6huff2DD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %18) #7
  call void @llvm.lifetime.end.p0(i64 88, ptr %18) #7
  br label %887

544:                                              ; preds = %263
  call void @llvm.lifetime.start.p0(i64 16, ptr %35) #7
  call void @_ZN6basisu9histogramC2Ej(ptr noundef nonnull align 8 dereferenceable(16) %35, i32 noundef 256)
  call void @llvm.lifetime.start.p0(i64 4, ptr %36) #7
  store i32 0, ptr %36, align 4, !tbaa !32
  br label %545

545:                                              ; preds = %612, %544
  %546 = load i32, ptr %36, align 4, !tbaa !32
  %547 = load ptr, ptr %4, align 8, !tbaa !5
  %548 = invoke noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %547)
          to label %549 unwind label %552

549:                                              ; preds = %545
  %550 = icmp ult i32 %546, %548
  br i1 %550, label %556, label %551

551:                                              ; preds = %549
  store i32 17, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %36) #7
  br label %618

552:                                              ; preds = %545
  %553 = landingpad { ptr, i32 }
          cleanup
  %554 = extractvalue { ptr, i32 } %553, 0
  store ptr %554, ptr %7, align 8
  %555 = extractvalue { ptr, i32 } %553, 1
  store i32 %555, ptr %8, align 4
  br label %617

556:                                              ; preds = %549
  %557 = load i32, ptr %36, align 4, !tbaa !32
  %558 = icmp ne i32 %557, 0
  br i1 %558, label %560, label %559

559:                                              ; preds = %556
  br label %612

560:                                              ; preds = %556
  call void @llvm.lifetime.start.p0(i64 8, ptr %37) #7
  %561 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 6
  %562 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 14
  %563 = load i32, ptr %36, align 4, !tbaa !32
  %564 = zext i32 %563 to i64
  %565 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %562, i64 noundef %564)
          to label %566 unwind label %586

566:                                              ; preds = %560
  %567 = load i32, ptr %565, align 4, !tbaa !32
  %568 = zext i32 %567 to i64
  %569 = invoke noundef nonnull align 1 dereferenceable(16) ptr @_ZN6basisu6vectorIN6basist27etc1_selector_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %561, i64 noundef %568)
          to label %570 unwind label %586

570:                                              ; preds = %566
  store ptr %569, ptr %37, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %38) #7
  %571 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 6
  %572 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 14
  %573 = load i32, ptr %36, align 4, !tbaa !32
  %574 = sub i32 %573, 1
  %575 = zext i32 %574 to i64
  %576 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %572, i64 noundef %575)
          to label %577 unwind label %590

577:                                              ; preds = %570
  %578 = load i32, ptr %576, align 4, !tbaa !32
  %579 = zext i32 %578 to i64
  %580 = invoke noundef nonnull align 1 dereferenceable(16) ptr @_ZN6basisu6vectorIN6basist27etc1_selector_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %571, i64 noundef %579)
          to label %581 unwind label %590

581:                                              ; preds = %577
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %38, ptr align 1 %580, i64 16, i1 false), !tbaa.struct !47
  call void @llvm.lifetime.start.p0(i64 4, ptr %39) #7
  store i32 0, ptr %39, align 4, !tbaa !32
  br label %582

582:                                              ; preds = %604, %581
  %583 = load i32, ptr %39, align 4, !tbaa !32
  %584 = icmp ult i32 %583, 4
  br i1 %584, label %594, label %585

585:                                              ; preds = %582
  store i32 20, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %39) #7
  br label %611

586:                                              ; preds = %566, %560
  %587 = landingpad { ptr, i32 }
          cleanup
  %588 = extractvalue { ptr, i32 } %587, 0
  store ptr %588, ptr %7, align 8
  %589 = extractvalue { ptr, i32 } %587, 1
  store i32 %589, ptr %8, align 4
  br label %616

590:                                              ; preds = %577, %570
  %591 = landingpad { ptr, i32 }
          cleanup
  %592 = extractvalue { ptr, i32 } %591, 0
  store ptr %592, ptr %7, align 8
  %593 = extractvalue { ptr, i32 } %591, 1
  store i32 %593, ptr %8, align 4
  br label %615

594:                                              ; preds = %582
  %595 = load ptr, ptr %37, align 8, !tbaa !5
  %596 = load i32, ptr %39, align 4, !tbaa !32
  %597 = invoke noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %595, i32 noundef %596)
          to label %598 unwind label %607

598:                                              ; preds = %594
  %599 = load i32, ptr %39, align 4, !tbaa !32
  %600 = invoke noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %38, i32 noundef %599)
          to label %601 unwind label %607

601:                                              ; preds = %598
  %602 = xor i32 %597, %600
  invoke void @_ZN6basisu9histogram3incEj(ptr noundef nonnull align 8 dereferenceable(16) %35, i32 noundef %602)
          to label %603 unwind label %607

603:                                              ; preds = %601
  br label %604

604:                                              ; preds = %603
  %605 = load i32, ptr %39, align 4, !tbaa !32
  %606 = add i32 %605, 1
  store i32 %606, ptr %39, align 4, !tbaa !32
  br label %582, !llvm.loop !49

607:                                              ; preds = %601, %598, %594
  %608 = landingpad { ptr, i32 }
          cleanup
  %609 = extractvalue { ptr, i32 } %608, 0
  store ptr %609, ptr %7, align 8
  %610 = extractvalue { ptr, i32 } %608, 1
  store i32 %610, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %39) #7
  br label %615

611:                                              ; preds = %585
  call void @llvm.lifetime.end.p0(i64 16, ptr %38) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %37) #7
  br label %612

612:                                              ; preds = %611, %559
  %613 = load i32, ptr %36, align 4, !tbaa !32
  %614 = add i32 %613, 1
  store i32 %614, ptr %36, align 4, !tbaa !32
  br label %545, !llvm.loop !50

615:                                              ; preds = %607, %590
  call void @llvm.lifetime.end.p0(i64 16, ptr %38) #7
  br label %616

616:                                              ; preds = %615, %586
  call void @llvm.lifetime.end.p0(i64 8, ptr %37) #7
  br label %617

617:                                              ; preds = %616, %552
  call void @llvm.lifetime.end.p0(i64 4, ptr %36) #7
  br label %856

618:                                              ; preds = %551
  %619 = invoke noundef i64 @_ZNK6basisu9histogram9get_totalEv(ptr noundef nonnull align 8 dereferenceable(16) %35)
          to label %620 unwind label %624

620:                                              ; preds = %618
  %621 = icmp ne i64 %619, 0
  br i1 %621, label %628, label %622

622:                                              ; preds = %620
  invoke void @_ZN6basisu9histogram3incEj(ptr noundef nonnull align 8 dereferenceable(16) %35, i32 noundef 0)
          to label %623 unwind label %624

623:                                              ; preds = %622
  br label %628

624:                                              ; preds = %622, %618
  %625 = landingpad { ptr, i32 }
          cleanup
  %626 = extractvalue { ptr, i32 } %625, 0
  store ptr %626, ptr %7, align 8
  %627 = extractvalue { ptr, i32 } %625, 1
  store i32 %627, ptr %8, align 4
  br label %856

628:                                              ; preds = %623, %620
  call void @llvm.lifetime.start.p0(i64 32, ptr %40) #7
  invoke void @_ZN6basisu22huffman_encoding_tableC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %40)
          to label %629 unwind label %634

629:                                              ; preds = %628
  %630 = invoke noundef zeroext i1 @_ZN6basisu22huffman_encoding_table4initERKNS_9histogramEj(ptr noundef nonnull align 8 dereferenceable(32) %40, ptr noundef nonnull align 8 dereferenceable(16) %35, i32 noundef 16)
          to label %631 unwind label %638

631:                                              ; preds = %629
  br i1 %630, label %642, label %632

632:                                              ; preds = %631
  invoke void (ptr, ...) @_ZN6basisu12error_printfEPKcz(ptr noundef @.str.39)
          to label %633 unwind label %638

633:                                              ; preds = %632
  store i1 false, ptr %2, align 1
  store i32 1, ptr %11, align 4
  br label %849

634:                                              ; preds = %628
  %635 = landingpad { ptr, i32 }
          cleanup
  %636 = extractvalue { ptr, i32 } %635, 0
  store ptr %636, ptr %7, align 8
  %637 = extractvalue { ptr, i32 } %635, 1
  store i32 %637, ptr %8, align 4
  br label %855

638:                                              ; preds = %632, %629
  %639 = landingpad { ptr, i32 }
          cleanup
  %640 = extractvalue { ptr, i32 } %639, 0
  store ptr %640, ptr %7, align 8
  %641 = extractvalue { ptr, i32 } %639, 1
  store i32 %641, ptr %8, align 4
  br label %854

642:                                              ; preds = %631
  call void @llvm.lifetime.start.p0(i64 32, ptr %41) #7
  invoke void @_ZN6basisu13bitwise_coderC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %41)
          to label %643 unwind label %660

643:                                              ; preds = %642
  invoke void @_ZN6basisu13bitwise_coder4initEj(ptr noundef nonnull align 8 dereferenceable(32) %41, i32 noundef 1048576)
          to label %644 unwind label %664

644:                                              ; preds = %643
  %645 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %41, i32 noundef 0, i32 noundef 1)
          to label %646 unwind label %664

646:                                              ; preds = %644
  %647 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %41, i32 noundef 0, i32 noundef 1)
          to label %648 unwind label %664

648:                                              ; preds = %646
  %649 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %41, i32 noundef 0, i32 noundef 1)
          to label %650 unwind label %664

650:                                              ; preds = %648
  %651 = invoke noundef i32 @_ZN6basisu13bitwise_coder18emit_huffman_tableERKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %41, ptr noundef nonnull align 8 dereferenceable(32) %40)
          to label %652 unwind label %664

652:                                              ; preds = %650
  call void @llvm.lifetime.start.p0(i64 4, ptr %42) #7
  store i32 0, ptr %42, align 4, !tbaa !32
  br label %653

653:                                              ; preds = %757, %652
  %654 = load i32, ptr %42, align 4, !tbaa !32
  %655 = load ptr, ptr %4, align 8, !tbaa !5
  %656 = invoke noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %655)
          to label %657 unwind label %668

657:                                              ; preds = %653
  %658 = icmp ult i32 %654, %656
  br i1 %658, label %672, label %659

659:                                              ; preds = %657
  store i32 23, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %42) #7
  br label %763

660:                                              ; preds = %642
  %661 = landingpad { ptr, i32 }
          cleanup
  %662 = extractvalue { ptr, i32 } %661, 0
  store ptr %662, ptr %7, align 8
  %663 = extractvalue { ptr, i32 } %661, 1
  store i32 %663, ptr %8, align 4
  br label %853

664:                                              ; preds = %843, %841, %839, %786, %784, %782, %781, %775, %771, %767, %765, %763, %650, %648, %646, %644, %643
  %665 = landingpad { ptr, i32 }
          cleanup
  %666 = extractvalue { ptr, i32 } %665, 0
  store ptr %666, ptr %7, align 8
  %667 = extractvalue { ptr, i32 } %665, 1
  store i32 %667, ptr %8, align 4
  br label %852

668:                                              ; preds = %653
  %669 = landingpad { ptr, i32 }
          cleanup
  %670 = extractvalue { ptr, i32 } %669, 0
  store ptr %670, ptr %7, align 8
  %671 = extractvalue { ptr, i32 } %669, 1
  store i32 %671, ptr %8, align 4
  br label %762

672:                                              ; preds = %657
  %673 = load i32, ptr %42, align 4, !tbaa !32
  %674 = icmp ne i32 %673, 0
  br i1 %674, label %704, label %675

675:                                              ; preds = %672
  call void @llvm.lifetime.start.p0(i64 4, ptr %43) #7
  store i32 0, ptr %43, align 4, !tbaa !32
  br label %676

676:                                              ; preds = %696, %675
  %677 = load i32, ptr %43, align 4, !tbaa !32
  %678 = icmp ult i32 %677, 4
  br i1 %678, label %680, label %679

679:                                              ; preds = %676
  store i32 26, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %43) #7
  br label %703

680:                                              ; preds = %676
  %681 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 6
  %682 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 14
  %683 = load i32, ptr %42, align 4, !tbaa !32
  %684 = zext i32 %683 to i64
  %685 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %682, i64 noundef %684)
          to label %686 unwind label %699

686:                                              ; preds = %680
  %687 = load i32, ptr %685, align 4, !tbaa !32
  %688 = zext i32 %687 to i64
  %689 = invoke noundef nonnull align 1 dereferenceable(16) ptr @_ZN6basisu6vectorIN6basist27etc1_selector_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %681, i64 noundef %688)
          to label %690 unwind label %699

690:                                              ; preds = %686
  %691 = load i32, ptr %43, align 4, !tbaa !32
  %692 = invoke noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %689, i32 noundef %691)
          to label %693 unwind label %699

693:                                              ; preds = %690
  %694 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %41, i32 noundef %692, i32 noundef 8)
          to label %695 unwind label %699

695:                                              ; preds = %693
  br label %696

696:                                              ; preds = %695
  %697 = load i32, ptr %43, align 4, !tbaa !32
  %698 = add i32 %697, 1
  store i32 %698, ptr %43, align 4, !tbaa !32
  br label %676, !llvm.loop !51

699:                                              ; preds = %693, %690, %686, %680
  %700 = landingpad { ptr, i32 }
          cleanup
  %701 = extractvalue { ptr, i32 } %700, 0
  store ptr %701, ptr %7, align 8
  %702 = extractvalue { ptr, i32 } %700, 1
  store i32 %702, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %43) #7
  br label %762

703:                                              ; preds = %679
  br label %757

704:                                              ; preds = %672
  call void @llvm.lifetime.start.p0(i64 8, ptr %44) #7
  %705 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 6
  %706 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 14
  %707 = load i32, ptr %42, align 4, !tbaa !32
  %708 = zext i32 %707 to i64
  %709 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %706, i64 noundef %708)
          to label %710 unwind label %730

710:                                              ; preds = %704
  %711 = load i32, ptr %709, align 4, !tbaa !32
  %712 = zext i32 %711 to i64
  %713 = invoke noundef nonnull align 1 dereferenceable(16) ptr @_ZN6basisu6vectorIN6basist27etc1_selector_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %705, i64 noundef %712)
          to label %714 unwind label %730

714:                                              ; preds = %710
  store ptr %713, ptr %44, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %45) #7
  %715 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 6
  %716 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 14
  %717 = load i32, ptr %42, align 4, !tbaa !32
  %718 = sub i32 %717, 1
  %719 = zext i32 %718 to i64
  %720 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %716, i64 noundef %719)
          to label %721 unwind label %734

721:                                              ; preds = %714
  %722 = load i32, ptr %720, align 4, !tbaa !32
  %723 = zext i32 %722 to i64
  %724 = invoke noundef nonnull align 1 dereferenceable(16) ptr @_ZN6basisu6vectorIN6basist27etc1_selector_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %715, i64 noundef %723)
          to label %725 unwind label %734

725:                                              ; preds = %721
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %45, ptr align 1 %724, i64 16, i1 false), !tbaa.struct !47
  call void @llvm.lifetime.start.p0(i64 4, ptr %46) #7
  store i32 0, ptr %46, align 4, !tbaa !32
  br label %726

726:                                              ; preds = %749, %725
  %727 = load i32, ptr %46, align 4, !tbaa !32
  %728 = icmp ult i32 %727, 4
  br i1 %728, label %738, label %729

729:                                              ; preds = %726
  store i32 29, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %46) #7
  br label %756

730:                                              ; preds = %710, %704
  %731 = landingpad { ptr, i32 }
          cleanup
  %732 = extractvalue { ptr, i32 } %731, 0
  store ptr %732, ptr %7, align 8
  %733 = extractvalue { ptr, i32 } %731, 1
  store i32 %733, ptr %8, align 4
  br label %761

734:                                              ; preds = %721, %714
  %735 = landingpad { ptr, i32 }
          cleanup
  %736 = extractvalue { ptr, i32 } %735, 0
  store ptr %736, ptr %7, align 8
  %737 = extractvalue { ptr, i32 } %735, 1
  store i32 %737, ptr %8, align 4
  br label %760

738:                                              ; preds = %726
  %739 = load ptr, ptr %44, align 8, !tbaa !5
  %740 = load i32, ptr %46, align 4, !tbaa !32
  %741 = invoke noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %739, i32 noundef %740)
          to label %742 unwind label %752

742:                                              ; preds = %738
  %743 = load i32, ptr %46, align 4, !tbaa !32
  %744 = invoke noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %45, i32 noundef %743)
          to label %745 unwind label %752

745:                                              ; preds = %742
  %746 = xor i32 %741, %744
  %747 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_codeEjRKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %41, i32 noundef %746, ptr noundef nonnull align 8 dereferenceable(32) %40)
          to label %748 unwind label %752

748:                                              ; preds = %745
  br label %749

749:                                              ; preds = %748
  %750 = load i32, ptr %46, align 4, !tbaa !32
  %751 = add i32 %750, 1
  store i32 %751, ptr %46, align 4, !tbaa !32
  br label %726, !llvm.loop !52

752:                                              ; preds = %745, %742, %738
  %753 = landingpad { ptr, i32 }
          cleanup
  %754 = extractvalue { ptr, i32 } %753, 0
  store ptr %754, ptr %7, align 8
  %755 = extractvalue { ptr, i32 } %753, 1
  store i32 %755, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %46) #7
  br label %760

756:                                              ; preds = %729
  call void @llvm.lifetime.end.p0(i64 16, ptr %45) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %44) #7
  br label %757

757:                                              ; preds = %756, %703
  %758 = load i32, ptr %42, align 4, !tbaa !32
  %759 = add i32 %758, 1
  store i32 %759, ptr %42, align 4, !tbaa !32
  br label %653, !llvm.loop !53

760:                                              ; preds = %752, %734
  call void @llvm.lifetime.end.p0(i64 16, ptr %45) #7
  br label %761

761:                                              ; preds = %760, %730
  call void @llvm.lifetime.end.p0(i64 8, ptr %44) #7
  br label %762

762:                                              ; preds = %761, %699, %668
  call void @llvm.lifetime.end.p0(i64 4, ptr %42) #7
  br label %852

763:                                              ; preds = %659
  %764 = invoke noundef i32 @_ZN6basisu13bitwise_coder5flushEv(ptr noundef nonnull align 8 dereferenceable(32) %41)
          to label %765 unwind label %664

765:                                              ; preds = %763
  %766 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6basisu13bitwise_coder9get_bytesEv(ptr noundef nonnull align 8 dereferenceable(32) %41)
          to label %767 unwind label %664

767:                                              ; preds = %765
  %768 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 3
  %769 = getelementptr inbounds %"struct.basisu::basisu_backend_output", ptr %768, i32 0, i32 7
  %770 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN6basisu6vectorIhEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %769, ptr noundef nonnull align 8 dereferenceable(16) %766)
          to label %771 unwind label %664

771:                                              ; preds = %767
  %772 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 3
  %773 = getelementptr inbounds %"struct.basisu::basisu_backend_output", ptr %772, i32 0, i32 7
  %774 = invoke noundef i32 @_ZNK6basisu6vectorIhE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %773)
          to label %775 unwind label %664

775:                                              ; preds = %771
  %776 = load ptr, ptr %4, align 8, !tbaa !5
  %777 = invoke noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %776)
          to label %778 unwind label %664

778:                                              ; preds = %775
  %779 = mul i32 %777, 4
  %780 = icmp uge i32 %774, %779
  br i1 %780, label %781, label %848

781:                                              ; preds = %778
  invoke void @_ZN6basisu13bitwise_coder4initEj(ptr noundef nonnull align 8 dereferenceable(32) %41, i32 noundef 1048576)
          to label %782 unwind label %664

782:                                              ; preds = %781
  %783 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %41, i32 noundef 0, i32 noundef 1)
          to label %784 unwind label %664

784:                                              ; preds = %782
  %785 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %41, i32 noundef 0, i32 noundef 1)
          to label %786 unwind label %664

786:                                              ; preds = %784
  %787 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %41, i32 noundef 1, i32 noundef 1)
          to label %788 unwind label %664

788:                                              ; preds = %786
  call void @llvm.lifetime.start.p0(i64 4, ptr %47) #7
  store i32 0, ptr %47, align 4, !tbaa !32
  br label %789

789:                                              ; preds = %834, %788
  %790 = load i32, ptr %47, align 4, !tbaa !32
  %791 = load ptr, ptr %4, align 8, !tbaa !5
  %792 = invoke noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %791)
          to label %793 unwind label %796

793:                                              ; preds = %789
  %794 = icmp ult i32 %790, %792
  br i1 %794, label %800, label %795

795:                                              ; preds = %793
  store i32 32, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %47) #7
  br label %839

796:                                              ; preds = %789
  %797 = landingpad { ptr, i32 }
          cleanup
  %798 = extractvalue { ptr, i32 } %797, 0
  store ptr %798, ptr %7, align 8
  %799 = extractvalue { ptr, i32 } %797, 1
  store i32 %799, ptr %8, align 4
  br label %838

800:                                              ; preds = %793
  call void @llvm.lifetime.start.p0(i64 4, ptr %48) #7
  %801 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 14
  %802 = load i32, ptr %47, align 4, !tbaa !32
  %803 = zext i32 %802 to i64
  %804 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %801, i64 noundef %803)
          to label %805 unwind label %811

805:                                              ; preds = %800
  %806 = load i32, ptr %804, align 4, !tbaa !32
  store i32 %806, ptr %48, align 4, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 4, ptr %49) #7
  store i32 0, ptr %49, align 4, !tbaa !32
  br label %807

807:                                              ; preds = %826, %805
  %808 = load i32, ptr %49, align 4, !tbaa !32
  %809 = icmp ult i32 %808, 4
  br i1 %809, label %815, label %810

810:                                              ; preds = %807
  store i32 35, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %49) #7
  br label %833

811:                                              ; preds = %800
  %812 = landingpad { ptr, i32 }
          cleanup
  %813 = extractvalue { ptr, i32 } %812, 0
  store ptr %813, ptr %7, align 8
  %814 = extractvalue { ptr, i32 } %812, 1
  store i32 %814, ptr %8, align 4
  br label %837

815:                                              ; preds = %807
  %816 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 6
  %817 = load i32, ptr %48, align 4, !tbaa !32
  %818 = zext i32 %817 to i64
  %819 = invoke noundef nonnull align 1 dereferenceable(16) ptr @_ZN6basisu6vectorIN6basist27etc1_selector_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %816, i64 noundef %818)
          to label %820 unwind label %829

820:                                              ; preds = %815
  %821 = load i32, ptr %49, align 4, !tbaa !32
  %822 = invoke noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %819, i32 noundef %821)
          to label %823 unwind label %829

823:                                              ; preds = %820
  %824 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %41, i32 noundef %822, i32 noundef 8)
          to label %825 unwind label %829

825:                                              ; preds = %823
  br label %826

826:                                              ; preds = %825
  %827 = load i32, ptr %49, align 4, !tbaa !32
  %828 = add i32 %827, 1
  store i32 %828, ptr %49, align 4, !tbaa !32
  br label %807, !llvm.loop !54

829:                                              ; preds = %823, %820, %815
  %830 = landingpad { ptr, i32 }
          cleanup
  %831 = extractvalue { ptr, i32 } %830, 0
  store ptr %831, ptr %7, align 8
  %832 = extractvalue { ptr, i32 } %830, 1
  store i32 %832, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %49) #7
  br label %837

833:                                              ; preds = %810
  call void @llvm.lifetime.end.p0(i64 4, ptr %48) #7
  br label %834

834:                                              ; preds = %833
  %835 = load i32, ptr %47, align 4, !tbaa !32
  %836 = add i32 %835, 1
  store i32 %836, ptr %47, align 4, !tbaa !32
  br label %789, !llvm.loop !55

837:                                              ; preds = %829, %811
  call void @llvm.lifetime.end.p0(i64 4, ptr %48) #7
  br label %838

838:                                              ; preds = %837, %796
  call void @llvm.lifetime.end.p0(i64 4, ptr %47) #7
  br label %852

839:                                              ; preds = %795
  %840 = invoke noundef i32 @_ZN6basisu13bitwise_coder5flushEv(ptr noundef nonnull align 8 dereferenceable(32) %41)
          to label %841 unwind label %664

841:                                              ; preds = %839
  %842 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6basisu13bitwise_coder9get_bytesEv(ptr noundef nonnull align 8 dereferenceable(32) %41)
          to label %843 unwind label %664

843:                                              ; preds = %841
  %844 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 3
  %845 = getelementptr inbounds %"struct.basisu::basisu_backend_output", ptr %844, i32 0, i32 7
  %846 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN6basisu6vectorIhEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %845, ptr noundef nonnull align 8 dereferenceable(16) %842)
          to label %847 unwind label %664

847:                                              ; preds = %843
  br label %848

848:                                              ; preds = %847, %778
  call void @_ZN6basisu13bitwise_coderD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %41) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %41) #7
  store i32 0, ptr %11, align 4
  br label %849

849:                                              ; preds = %848, %633
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %40) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %40) #7
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %35) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %35) #7
  %850 = load i32, ptr %11, align 4
  switch i32 %850, label %885 [
    i32 0, label %851
  ]

851:                                              ; preds = %849
  br label %857

852:                                              ; preds = %838, %762, %664
  call void @_ZN6basisu13bitwise_coderD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %41) #7
  br label %853

853:                                              ; preds = %852, %660
  call void @llvm.lifetime.end.p0(i64 32, ptr %41) #7
  br label %854

854:                                              ; preds = %853, %638
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %40) #7
  br label %855

855:                                              ; preds = %854, %634
  call void @llvm.lifetime.end.p0(i64 32, ptr %40) #7
  br label %856

856:                                              ; preds = %855, %624, %617
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %35) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %35) #7
  br label %887

857:                                              ; preds = %851, %532
  br label %858

858:                                              ; preds = %857, %250
  %859 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 3
  %860 = getelementptr inbounds %"struct.basisu::basisu_backend_output", ptr %859, i32 0, i32 7
  %861 = call noundef i32 @_ZNK6basisu6vectorIhE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %860)
  %862 = mul nsw i32 %861, 8
  %863 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 3
  %864 = getelementptr inbounds %"struct.basisu::basisu_backend_output", ptr %863, i32 0, i32 7
  %865 = call noundef i32 @_ZNK6basisu6vectorIhE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %864)
  %866 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 3
  %867 = getelementptr inbounds %"struct.basisu::basisu_backend_output", ptr %866, i32 0, i32 7
  %868 = call noundef i32 @_ZNK6basisu6vectorIhE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %867)
  %869 = uitofp i32 %868 to float
  %870 = fmul float %869, 8.000000e+00
  %871 = load ptr, ptr %4, align 8, !tbaa !5
  %872 = call noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %871)
  %873 = uitofp i32 %872 to float
  %874 = fdiv float %870, %873
  %875 = fpext float %874 to double
  %876 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %50, i32 0, i32 3
  %877 = getelementptr inbounds %"struct.basisu::basisu_backend_output", ptr %876, i32 0, i32 7
  %878 = call noundef i32 @_ZNK6basisu6vectorIhE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %877)
  %879 = uitofp i32 %878 to float
  %880 = fmul float %879, 8.000000e+00
  %881 = call noundef i32 @_ZNK6basisu14basisu_backend22get_total_input_texelsEv(ptr noundef nonnull align 8 dereferenceable(336) %50)
  %882 = uitofp i32 %881 to float
  %883 = fdiv float %880, %882
  %884 = fpext float %883 to double
  call void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef @.str.40, i32 noundef %862, i32 noundef %865, double noundef %875, double noundef %884)
  store i1 true, ptr %2, align 1
  store i32 1, ptr %11, align 4
  br label %885

885:                                              ; preds = %858, %849, %530, %248
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  %886 = load i1, ptr %2, align 1
  ret i1 %886

887:                                              ; preds = %856, %543, %262
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  br label %888

888:                                              ; preds = %887
  %889 = load ptr, ptr %7, align 8
  %890 = load i32, ptr %8, align 4
  %891 = insertvalue { ptr, i32 } poison, ptr %889, 0
  %892 = insertvalue { ptr, i32 } %891, i32 %890, 1
  resume { ptr, i32 } %892
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu6huff2DC2Ejj(ptr noundef nonnull align 8 dereferenceable(88), i32 noundef, i32 noundef) unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6basisu6huff2D4emitEj(ptr noundef nonnull align 8 dereferenceable(88), i32 noundef) #6 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN6basisu6huff2D14start_encodingEj(ptr noundef nonnull align 8 dereferenceable(88), i32 noundef) #6 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZNK6basisu6huff2D18get_encoding_tableEv(ptr noundef nonnull align 8 dereferenceable(88)) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN6basisu6huff2D13emit_next_symERNS_13bitwise_coderE(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef nonnull align 8 dereferenceable(32)) #6 align 2

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

attributes #0 = { nocallback nofree 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 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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 #7 = { 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 0}
!10 = !{!"_ZTSN6basisu14basisu_backendE", !6, i64 0, !11, i64 8, !15, i64 40, !16, i64 56, !6, i64 168, !21, i64 176, !22, i64 192, !23, i64 208, !24, i64 224, !25, i64 240, !25, i64 256, !26, i64 272, !26, i64 288, !25, i64 304, !25, i64 320}
!11 = !{!"_ZTSN6basisu21basisu_backend_paramsE", !12, i64 0, !12, i64 1, !12, i64 2, !13, i64 4, !13, i64 8, !14, i64 12, !12, i64 16, !14, i64 20, !14, i64 24, !12, i64 28, !12, i64 29}
!12 = !{!"bool", !7, i64 0}
!13 = !{!"float", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_ZTSN6basisu6vectorINS_25basisu_backend_slice_descEEE", !6, i64 0, !14, i64 8, !14, i64 12}
!16 = !{!"_ZTSN6basisu21basisu_backend_outputE", !17, i64 0, !12, i64 4, !12, i64 5, !12, i64 6, !14, i64 8, !14, i64 12, !18, i64 16, !18, i64 32, !15, i64 48, !18, i64 64, !19, i64 80, !20, i64 96}
!17 = !{!"_ZTSN6basist16basis_tex_formatE", !7, i64 0}
!18 = !{!"_ZTSN6basisu6vectorIhEE", !6, i64 0, !14, i64 8, !14, i64 12}
!19 = !{!"_ZTSN6basisu6vectorINS0_IhEEEE", !6, i64 0, !14, i64 8, !14, i64 12}
!20 = !{!"_ZTSN6basisu6vectorItEE", !6, i64 0, !14, i64 8, !14, i64 12}
!21 = !{!"_ZTSN6basisu6vectorINS_27etc1_endpoint_palette_entryEEE", !6, i64 0, !14, i64 8, !14, i64 12}
!22 = !{!"_ZTSN6basisu6vectorIN6basist27etc1_selector_palette_entryEEE", !6, i64 0, !14, i64 8, !14, i64 12}
!23 = !{!"_ZTSN6basisu6vectorINS_14basisu_backend34etc1_global_selector_cb_entry_descEEE", !6, i64 0, !14, i64 8, !14, i64 12}
!24 = !{!"_ZTSN6basisu6vectorINS_8vector2DINS_13encoder_blockEEEEE", !6, i64 0, !14, i64 8, !14, i64 12}
!25 = !{!"_ZTSN6basisu6vectorIjEE", !6, i64 0, !14, i64 8, !14, i64 12}
!26 = !{!"_ZTSN6basisu6vectorIbEE", !6, i64 0, !14, i64 8, !14, i64 12}
!27 = !{!10, !12, i64 24}
!28 = !{i8 0, i8 2}
!29 = !{}
!30 = !{!10, !12, i64 36}
!31 = !{!10, !14, i64 32}
!32 = !{!14, !14, i64 0}
!33 = !{!34, !14, i64 4}
!34 = !{!"_ZTSN6basisu14basisu_backend34etc1_global_selector_cb_entry_descE", !14, i64 0, !14, i64 4, !12, i64 8}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}
!37 = !{!10, !14, i64 28}
!38 = !{!34, !14, i64 0}
!39 = distinct !{!39, !36}
!40 = !{!12, !12, i64 0}
!41 = distinct !{!41, !36}
!42 = !{!43, !14, i64 0}
!43 = !{!"_ZTSN6basist38etc1_global_selector_codebook_entry_idE", !14, i64 0, !44, i64 4}
!44 = !{!"_ZTSN6basist34etc1_global_palette_entry_modifierE", !7, i64 0, !12, i64 1, !12, i64 2, !12, i64 3, !12, i64 4, !12, i64 5, !12, i64 6, !12, i64 7, !12, i64 8, !12, i64 9, !12, i64 10, !12, i64 11, !7, i64 12}
!45 = distinct !{!45, !36}
!46 = distinct !{!46, !36}
!47 = !{i64 0, i64 16, !48}
!48 = !{!7, !7, i64 0}
!49 = distinct !{!49, !36}
!50 = distinct !{!50, !36}
!51 = distinct !{!51, !36}
!52 = distinct !{!52, !36}
!53 = distinct !{!53, !36}
!54 = distinct !{!54, !36}
!55 = distinct !{!55, !36}


; 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.basisu::histogram" = type { %"class.basisu::vector.14" }
%"class.basisu::vector.14" = type { ptr, i32, i32 }
%"class.basisu::huffman_encoding_table" = type { %"class.basisu::vector.4", %"class.basisu::vector.0" }
%"class.basisu::vector.4" = type { ptr, i32, i32 }
%"class.basisu::vector.0" = type { ptr, i32, i32 }
%"class.basisu::bitwise_coder" = type { %"class.basisu::vector.0", i32, i32, i64 }
%"class.basisu::huff2D" = type { %"class.basisu::vector.14", %"class.basisu::huffman_encoding_table", %"class.basisu::histogram", i32, i32, i32, i32, i32, i32 }
%"struct.basist::etc1_selector_palette_entry" = type { [16 x i8] }

@.str.32 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [79 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [84 x i8], align 1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

declare void @_ZN6basisu12debug_printfEPKcz(ptr noundef, ...) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496)) local_unnamed_addr #2 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(16) ptr @_ZN6basisu6vectorIN6basist27etc1_selector_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZN6basisu6vectorINS_14basisu_backend34etc1_global_selector_cb_entry_descEEixEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6basisu15basisu_frontend46get_selector_cluster_global_selector_entry_idsEv(ptr noundef nonnull align 8 dereferenceable(496)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(17) ptr @_ZNK6basisu6vectorIN6basist38etc1_global_selector_codebook_entry_idEEixEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6basist34etc1_global_palette_entry_modifier9get_indexEv(ptr noundef nonnull align 1 dereferenceable(13)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6basisu15basisu_frontend39get_selector_cluster_uses_global_cb_vecEv(ptr noundef nonnull align 8 dereferenceable(496)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZNK6basisu6vectorIbEixEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu9histogramC2Ej(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6basisu9histogram3incEj(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNK6basisu9histogram9get_totalEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #5 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN6basisu22huffman_encoding_table4initERKNS_9histogramEj(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #5 align 2

declare void @_ZN6basisu12error_printfEPKcz(ptr noundef, ...) local_unnamed_addr #1

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6basisu13bitwise_coder4initEj(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) local_unnamed_addr #6 align 2

declare noundef i32 @_ZN6basisu13bitwise_coder18emit_huffman_tableERKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef) local_unnamed_addr #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNK6basisu14basisu_backend22get_total_input_texelsEv(ptr noundef nonnull align 8 dereferenceable(336)) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN6basisu13bitwise_coder5flushEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #6 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6basisu13bitwise_coder9get_bytesEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZN6basisu6vectorIhEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #6 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN6basisu13bitwise_coder8put_codeEjRKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #6 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6basisu6vectorIhE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN6basisu14basisu_backend23encode_selector_paletteEv(ptr noundef nonnull align 8 dereferenceable(336) %0) local_unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.basisu::histogram", align 8
  %3 = alloca %"class.basisu::huffman_encoding_table", align 8
  %4 = alloca %"class.basisu::huffman_encoding_table", align 8
  %5 = alloca %"class.basisu::bitwise_coder", align 8
  %6 = alloca %"class.basisu::huff2D", align 8
  %7 = alloca %"class.basisu::histogram", align 8
  %8 = alloca %"class.basisu::huffman_encoding_table", align 8
  %9 = alloca %"class.basisu::bitwise_coder", align 8
  %10 = alloca %"class.basisu::histogram", align 8
  %11 = alloca %"struct.basist::etc1_selector_palette_entry", align 1
  %12 = alloca %"class.basisu::huffman_encoding_table", align 8
  %13 = alloca %"class.basisu::bitwise_coder", align 8
  %14 = alloca %"struct.basist::etc1_selector_palette_entry", align 1
  %15 = load ptr, ptr %0, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %0, i64 24
  %17 = load i8, ptr %16, align 8, !tbaa !26, !range !27, !noundef !28
  %18 = trunc nuw i8 %17 to i1
  %19 = getelementptr inbounds i8, ptr %0, i64 36
  %20 = load i8, ptr %19, align 4, !tbaa !29, !range !27
  br i1 %18, label %21, label %._crit_edge308

21:                                               ; preds = %1
  %22 = trunc nuw i8 %20 to i1
  br i1 %22, label %._crit_edge308, label %23

23:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #7
  %24 = getelementptr inbounds i8, ptr %0, i64 32
  %25 = load i32, ptr %24, align 8, !tbaa !30
  %26 = shl nuw i32 1, %25
  call void @_ZN6basisu9histogramC2Ej(ptr noundef nonnull align 8 dereferenceable(16) %2, i32 noundef %26)
  %27 = call noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %.not265 = icmp eq i32 %27, 0
  br i1 %.not265, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %23
  %28 = getelementptr inbounds i8, ptr %0, i64 208
  br label %31

._crit_edge:                                      ; preds = %35, %23
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #7
  invoke void @_ZN6basisu22huffman_encoding_tableC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3)
          to label %39 unwind label %44

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

31:                                               ; preds = %.lr.ph, %35
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %35 ]
  %32 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN6basisu6vectorINS_14basisu_backend34etc1_global_selector_cb_entry_descEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %28, i64 noundef %indvars.iv)
  %33 = getelementptr inbounds i8, ptr %32, i64 4
  %34 = load i32, ptr %33, align 4, !tbaa !31
  invoke void @_ZN6basisu9histogram3incEj(ptr noundef nonnull align 8 dereferenceable(16) %2, i32 noundef %34)
          to label %35 unwind label %29

35:                                               ; preds = %31
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %36 = call noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %37 = zext i32 %36 to i64
  %38 = icmp ult i64 %indvars.iv.next, %37
  br i1 %38, label %31, label %._crit_edge, !llvm.loop !33

39:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #7
  invoke void @_ZN6basisu22huffman_encoding_tableC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %40 unwind label %46

40:                                               ; preds = %39
  %41 = invoke noundef zeroext i1 @_ZN6basisu22huffman_encoding_table4initERKNS_9histogramEj(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull align 8 dereferenceable(16) %2, i32 noundef 16)
          to label %42 unwind label %48

42:                                               ; preds = %40
  br i1 %41, label %50, label %43

43:                                               ; preds = %42
  invoke void (ptr, ...) @_ZN6basisu12error_printfEPKcz(ptr noundef nonnull @.str.32)
          to label %127 unwind label %48

44:                                               ; preds = %._crit_edge
  %45 = landingpad { ptr, i32 }
          cleanup
  br label %134

46:                                               ; preds = %39
  %47 = landingpad { ptr, i32 }
          cleanup
  br label %133

48:                                               ; preds = %43, %40
  %49 = landingpad { ptr, i32 }
          cleanup
  br label %132

50:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #7
  invoke void @_ZN6basisu13bitwise_coderC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %51 unwind label %65

51:                                               ; preds = %50
  invoke void @_ZN6basisu13bitwise_coder4initEj(ptr noundef nonnull align 8 dereferenceable(32) %5, i32 noundef 1048576)
          to label %52 unwind label %67

52:                                               ; preds = %51
  %53 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %5, i32 noundef 1, i32 noundef 1)
          to label %54 unwind label %67

54:                                               ; preds = %52
  %55 = getelementptr inbounds i8, ptr %0, i64 28
  %56 = load i32, ptr %55, align 4, !tbaa !35
  %57 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %5, i32 noundef %56, i32 noundef 4)
          to label %58 unwind label %67

58:                                               ; preds = %54
  %59 = load i32, ptr %24, align 8, !tbaa !30
  %60 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %5, i32 noundef %59, i32 noundef 4)
          to label %61 unwind label %67

61:                                               ; preds = %58
  %62 = load i32, ptr %24, align 8, !tbaa !30
  %.not = icmp eq i32 %62, 0
  br i1 %.not, label %71, label %63

63:                                               ; preds = %61
  %64 = invoke noundef i32 @_ZN6basisu13bitwise_coder18emit_huffman_tableERKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %71 unwind label %69

65:                                               ; preds = %50
  %66 = landingpad { ptr, i32 }
          cleanup
  br label %131

67:                                               ; preds = %58, %54, %52, %51
  %68 = landingpad { ptr, i32 }
          cleanup
  br label %130

69:                                               ; preds = %63
  %70 = landingpad { ptr, i32 }
          cleanup
  br label %130

71:                                               ; preds = %63, %61
  %.0156 = phi i32 [ 0, %61 ], [ %64, %63 ]
  %72 = call noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %.not266 = icmp eq i32 %72, 0
  br i1 %.not266, label %._crit_edge229, label %.lr.ph228

.lr.ph228:                                        ; preds = %71
  %73 = getelementptr inbounds i8, ptr %0, i64 320
  %74 = getelementptr inbounds i8, ptr %0, i64 208
  br label %76

._crit_edge229:                                   ; preds = %101, %71
  %.0160.lcssa = phi i32 [ 0, %71 ], [ %.1161, %101 ]
  %.0157.lcssa = phi i32 [ 0, %71 ], [ %.1158, %101 ]
  %75 = invoke noundef i32 @_ZN6basisu13bitwise_coder5flushEv(ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %105 unwind label %128

76:                                               ; preds = %.lr.ph228, %101
  %indvars.iv275 = phi i64 [ 0, %.lr.ph228 ], [ %indvars.iv.next276, %101 ]
  %.0157226 = phi i32 [ 0, %.lr.ph228 ], [ %.1158, %101 ]
  %.0160225 = phi i32 [ 0, %.lr.ph228 ], [ %.1161, %101 ]
  %77 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %73, i64 noundef %indvars.iv275)
  %78 = load i32, ptr %77, align 4, !tbaa !36
  %79 = load i32, ptr %55, align 4, !tbaa !35
  %.not163 = icmp eq i32 %79, 0
  br i1 %.not163, label %91, label %80

80:                                               ; preds = %76
  %81 = zext i32 %78 to i64
  %82 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN6basisu6vectorINS_14basisu_backend34etc1_global_selector_cb_entry_descEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %74, i64 noundef %81)
  %83 = load i32, ptr %82, align 4, !tbaa !37
  %84 = load i32, ptr %55, align 4, !tbaa !35
  %85 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %5, i32 noundef %83, i32 noundef %84)
          to label %86 unwind label %89

86:                                               ; preds = %80
  %87 = load i32, ptr %55, align 4, !tbaa !35
  %88 = add i32 %87, %.0157226
  br label %91

89:                                               ; preds = %93, %80
  %90 = landingpad { ptr, i32 }
          cleanup
  br label %130

91:                                               ; preds = %86, %76
  %.1158 = phi i32 [ %88, %86 ], [ %.0157226, %76 ]
  %92 = load i32, ptr %24, align 8, !tbaa !30
  %.not164 = icmp eq i32 %92, 0
  br i1 %.not164, label %101, label %93

93:                                               ; preds = %91
  %94 = zext i32 %78 to i64
  %95 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN6basisu6vectorINS_14basisu_backend34etc1_global_selector_cb_entry_descEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %74, i64 noundef %94)
  %96 = getelementptr inbounds i8, ptr %95, i64 4
  %97 = load i32, ptr %96, align 4, !tbaa !31
  %98 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_codeEjRKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %5, i32 noundef %97, ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %99 unwind label %89

99:                                               ; preds = %93
  %100 = add i32 %98, %.0160225
  br label %101

101:                                              ; preds = %99, %91
  %.1161 = phi i32 [ %100, %99 ], [ %.0160225, %91 ]
  %indvars.iv.next276 = add nuw nsw i64 %indvars.iv275, 1
  %102 = call noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %103 = zext i32 %102 to i64
  %104 = icmp ult i64 %indvars.iv.next276, %103
  br i1 %104, label %76, label %._crit_edge229, !llvm.loop !38

105:                                              ; preds = %._crit_edge229
  %106 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6basisu13bitwise_coder9get_bytesEv(ptr noundef nonnull align 8 dereferenceable(32) %5)
  %107 = getelementptr inbounds i8, ptr %0, i64 88
  %108 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN6basisu6vectorIhEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %107, ptr noundef nonnull align 8 dereferenceable(16) %106)
          to label %109 unwind label %128

109:                                              ; preds = %105
  %110 = uitofp i32 %.0156 to float
  %111 = call noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %112 = uitofp i32 %111 to float
  %113 = fdiv float %110, %112
  %114 = fpext float %113 to double
  invoke void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef nonnull @.str.33, i32 noundef %.0156, double noundef %114)
          to label %115 unwind label %128

115:                                              ; preds = %109
  %116 = uitofp i32 %.0157.lcssa to float
  %117 = call noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %118 = uitofp i32 %117 to float
  %119 = fdiv float %116, %118
  %120 = fpext float %119 to double
  %121 = uitofp i32 %.0160.lcssa to float
  %122 = call noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %123 = uitofp i32 %122 to float
  %124 = fdiv float %121, %123
  %125 = fpext float %124 to double
  invoke void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef nonnull @.str.34, i32 noundef %.0157.lcssa, double noundef %120, i32 noundef %.0160.lcssa, double noundef %125)
          to label %126 unwind label %128

126:                                              ; preds = %115
  call void @_ZN6basisu13bitwise_coderD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #7
  br label %127

127:                                              ; preds = %43, %126
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #7
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #7
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %2) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #7
  br i1 %41, label %467, label %486

128:                                              ; preds = %115, %109, %105, %._crit_edge229
  %129 = landingpad { ptr, i32 }
          cleanup
  br label %130

130:                                              ; preds = %69, %128, %89, %67
  %.pn.pn.pn = phi { ptr, i32 } [ %68, %67 ], [ %70, %69 ], [ %90, %89 ], [ %129, %128 ]
  call void @_ZN6basisu13bitwise_coderD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #7
  br label %131

131:                                              ; preds = %130, %65
  %.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn, %130 ], [ %66, %65 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #7
  br label %132

132:                                              ; preds = %131, %48
  %.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn.pn, %131 ], [ %49, %48 ]
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #7
  br label %133

133:                                              ; preds = %132, %46
  %.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn.pn.pn, %132 ], [ %47, %46 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #7
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #7
  br label %134

134:                                              ; preds = %133, %44
  %.pn.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn.pn.pn.pn, %133 ], [ %45, %44 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #7
  br label %135

135:                                              ; preds = %134, %29
  %.pn172 = phi { ptr, i32 } [ %30, %29 ], [ %.pn.pn.pn.pn.pn.pn.pn, %134 ]
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %2) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #7
  br label %487

._crit_edge308:                                   ; preds = %1, %21
  %136 = trunc nuw i8 %20 to i1
  br i1 %136, label %137, label %286

137:                                              ; preds = %._crit_edge308
  call void @llvm.lifetime.start.p0(i64 88, ptr nonnull %6) #7
  call void @_ZN6basisu6huff2DC2Ejj(ptr noundef nonnull align 8 dereferenceable(88) %6, i32 noundef 1, i32 noundef 8)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #7
  %138 = getelementptr inbounds i8, ptr %0, i64 32
  %139 = load i32, ptr %138, align 8, !tbaa !30
  %140 = shl nuw i32 1, %139
  invoke void @_ZN6basisu9histogramC2Ej(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef %140)
          to label %.preheader unwind label %144

.preheader:                                       ; preds = %137
  %141 = call noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %.not270 = icmp eq i32 %141, 0
  br i1 %.not270, label %._crit_edge247, label %.lr.ph246

.lr.ph246:                                        ; preds = %.preheader
  %142 = getelementptr inbounds i8, ptr %0, i64 320
  %143 = getelementptr inbounds i8, ptr %0, i64 208
  br label %146

._crit_edge247:                                   ; preds = %158, %.preheader
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #7
  invoke void @_ZN6basisu22huffman_encoding_tableC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8)
          to label %164 unwind label %168

144:                                              ; preds = %137
  %145 = landingpad { ptr, i32 }
          cleanup
  br label %285

146:                                              ; preds = %.lr.ph246, %158
  %indvars.iv302 = phi i64 [ 0, %.lr.ph246 ], [ %indvars.iv.next303, %158 ]
  %147 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %142, i64 noundef %indvars.iv302)
  %148 = load i32, ptr %147, align 4, !tbaa !36
  %149 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6basisu15basisu_frontend39get_selector_cluster_uses_global_cb_vecEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %150 = zext i32 %148 to i64
  %151 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNK6basisu6vectorIbEixEm(ptr noundef nonnull align 8 dereferenceable(16) %149, i64 noundef %150)
  %152 = load i8, ptr %151, align 1, !tbaa !39, !range !27, !noundef !28
  %153 = zext nneg i8 %152 to i32
  invoke void @_ZN6basisu6huff2D4emitEj(ptr noundef nonnull align 8 dereferenceable(88) %6, i32 noundef %153)
          to label %154 unwind label %162

154:                                              ; preds = %146
  %155 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN6basisu6vectorINS_14basisu_backend34etc1_global_selector_cb_entry_descEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %143, i64 noundef %150)
  %156 = getelementptr inbounds i8, ptr %155, i64 4
  %157 = load i32, ptr %156, align 4, !tbaa !31
  invoke void @_ZN6basisu9histogram3incEj(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef %157)
          to label %158 unwind label %162

158:                                              ; preds = %154
  %indvars.iv.next303 = add nuw nsw i64 %indvars.iv302, 1
  %159 = call noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %160 = zext i32 %159 to i64
  %161 = icmp ult i64 %indvars.iv.next303, %160
  br i1 %161, label %146, label %._crit_edge247, !llvm.loop !40

162:                                              ; preds = %154, %146
  %163 = landingpad { ptr, i32 }
          cleanup
  br label %284

164:                                              ; preds = %._crit_edge247
  %165 = invoke noundef zeroext i1 @_ZN6basisu22huffman_encoding_table4initERKNS_9histogramEj(ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef 16)
          to label %166 unwind label %170

166:                                              ; preds = %164
  br i1 %165, label %172, label %167

167:                                              ; preds = %166
  invoke void (ptr, ...) @_ZN6basisu12error_printfEPKcz(ptr noundef nonnull @.str.35)
          to label %277 unwind label %170

168:                                              ; preds = %._crit_edge247
  %169 = landingpad { ptr, i32 }
          cleanup
  br label %283

170:                                              ; preds = %167, %164
  %171 = landingpad { ptr, i32 }
          cleanup
  br label %282

172:                                              ; preds = %166
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #7
  invoke void @_ZN6basisu13bitwise_coderC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9)
          to label %173 unwind label %194

173:                                              ; preds = %172
  invoke void @_ZN6basisu13bitwise_coder4initEj(ptr noundef nonnull align 8 dereferenceable(32) %9, i32 noundef 1048576)
          to label %174 unwind label %196

174:                                              ; preds = %173
  %175 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %9, i32 noundef 0, i32 noundef 1)
          to label %176 unwind label %196

176:                                              ; preds = %174
  %177 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %9, i32 noundef 1, i32 noundef 1)
          to label %178 unwind label %196

178:                                              ; preds = %176
  %179 = getelementptr inbounds i8, ptr %0, i64 28
  %180 = load i32, ptr %179, align 4, !tbaa !35
  %181 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %9, i32 noundef %180, i32 noundef 4)
          to label %182 unwind label %196

182:                                              ; preds = %178
  %183 = load i32, ptr %138, align 8, !tbaa !30
  %184 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %9, i32 noundef %183, i32 noundef 4)
          to label %185 unwind label %196

185:                                              ; preds = %182
  %186 = invoke noundef zeroext i1 @_ZN6basisu6huff2D14start_encodingEj(ptr noundef nonnull align 8 dereferenceable(88) %6, i32 noundef 16)
          to label %187 unwind label %196

187:                                              ; preds = %185
  %188 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK6basisu6huff2D18get_encoding_tableEv(ptr noundef nonnull align 8 dereferenceable(88) %6)
  %189 = invoke noundef i32 @_ZN6basisu13bitwise_coder18emit_huffman_tableERKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull align 8 dereferenceable(32) %188)
          to label %190 unwind label %196

190:                                              ; preds = %187
  %191 = load i32, ptr %138, align 8, !tbaa !30
  %.not186 = icmp eq i32 %191, 0
  br i1 %.not186, label %198, label %192

192:                                              ; preds = %190
  %193 = invoke noundef i32 @_ZN6basisu13bitwise_coder18emit_huffman_tableERKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull align 8 dereferenceable(32) %8)
          to label %198 unwind label %196

194:                                              ; preds = %172
  %195 = landingpad { ptr, i32 }
          cleanup
  br label %281

196:                                              ; preds = %192, %187, %185, %182, %178, %176, %174, %173
  %197 = landingpad { ptr, i32 }
          cleanup
  br label %280

198:                                              ; preds = %192, %190
  %199 = call noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %.not271 = icmp eq i32 %199, 0
  br i1 %.not271, label %._crit_edge258, label %.lr.ph257

.lr.ph257:                                        ; preds = %198
  %200 = getelementptr inbounds i8, ptr %0, i64 320
  %201 = getelementptr inbounds i8, ptr %0, i64 192
  br label %203

._crit_edge258:                                   ; preds = %.loopexit, %198
  %.0154.lcssa = phi i32 [ 0, %198 ], [ %.1155, %.loopexit ]
  %.0152.lcssa = phi i32 [ 0, %198 ], [ %.1153, %.loopexit ]
  %.0150.lcssa = phi i32 [ 0, %198 ], [ %.1151, %.loopexit ]
  %.0148.lcssa = phi i32 [ 0, %198 ], [ %.1149, %.loopexit ]
  %.0146.lcssa = phi i32 [ 0, %198 ], [ %.1147, %.loopexit ]
  %.0145.lcssa = phi i32 [ 0, %198 ], [ %208, %.loopexit ]
  %202 = invoke noundef i32 @_ZN6basisu13bitwise_coder5flushEv(ptr noundef nonnull align 8 dereferenceable(32) %9)
          to label %257 unwind label %278

203:                                              ; preds = %.lr.ph257, %.loopexit
  %indvars.iv305 = phi i64 [ 0, %.lr.ph257 ], [ %indvars.iv.next306, %.loopexit ]
  %.0145254 = phi i32 [ 0, %.lr.ph257 ], [ %208, %.loopexit ]
  %.0146253 = phi i32 [ 0, %.lr.ph257 ], [ %.1147, %.loopexit ]
  %.0148252 = phi i32 [ 0, %.lr.ph257 ], [ %.1149, %.loopexit ]
  %.0150251 = phi i32 [ 0, %.lr.ph257 ], [ %.1151, %.loopexit ]
  %.0152250 = phi i32 [ 0, %.lr.ph257 ], [ %.1153, %.loopexit ]
  %.0154249 = phi i32 [ 0, %.lr.ph257 ], [ %.1155, %.loopexit ]
  %204 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %200, i64 noundef %indvars.iv305)
  %205 = load i32, ptr %204, align 4, !tbaa !36
  %206 = invoke noundef i32 @_ZN6basisu6huff2D13emit_next_symERNS_13bitwise_coderE(ptr noundef nonnull align 8 dereferenceable(88) %6, ptr noundef nonnull align 8 dereferenceable(32) %9)
          to label %207 unwind label %230

207:                                              ; preds = %203
  %208 = add i32 %206, %.0145254
  %209 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6basisu15basisu_frontend39get_selector_cluster_uses_global_cb_vecEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %210 = zext i32 %205 to i64
  %211 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNK6basisu6vectorIbEixEm(ptr noundef nonnull align 8 dereferenceable(16) %209, i64 noundef %210)
  %212 = load i8, ptr %211, align 1, !tbaa !39, !range !27, !noundef !28
  %213 = trunc nuw i8 %212 to i1
  br i1 %213, label %214, label %234

214:                                              ; preds = %207
  %215 = add i32 %.0154249, 1
  %216 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6basisu15basisu_frontend46get_selector_cluster_global_selector_entry_idsEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %217 = call noundef nonnull align 4 dereferenceable(17) ptr @_ZNK6basisu6vectorIN6basist38etc1_global_selector_codebook_entry_idEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %216, i64 noundef %210)
  %218 = load i32, ptr %217, align 4, !tbaa !41
  %219 = load i32, ptr %179, align 4, !tbaa !35
  %220 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %9, i32 noundef %218, i32 noundef %219)
          to label %221 unwind label %232

221:                                              ; preds = %214
  %222 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6basisu15basisu_frontend46get_selector_cluster_global_selector_entry_idsEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %223 = call noundef nonnull align 4 dereferenceable(17) ptr @_ZNK6basisu6vectorIN6basist38etc1_global_selector_codebook_entry_idEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %222, i64 noundef %210)
  %224 = getelementptr inbounds i8, ptr %223, i64 4
  %225 = call noundef i32 @_ZNK6basist34etc1_global_palette_entry_modifier9get_indexEv(ptr noundef nonnull align 1 dereferenceable(13) %224)
  %226 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_codeEjRKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %9, i32 noundef %225, ptr noundef nonnull align 8 dereferenceable(32) %8)
          to label %227 unwind label %232

227:                                              ; preds = %221
  %228 = add i32 %220, %.0152250
  %229 = add i32 %226, %.0150251
  br label %.loopexit

230:                                              ; preds = %203
  %231 = landingpad { ptr, i32 }
          cleanup
  br label %280

232:                                              ; preds = %221, %214
  %233 = landingpad { ptr, i32 }
          cleanup
  br label %280

234:                                              ; preds = %207
  %235 = add i32 %.0148252, 1
  %236 = add i32 %.0146253, 32
  %237 = call noundef nonnull align 1 dereferenceable(16) ptr @_ZN6basisu6vectorIN6basist27etc1_selector_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %201, i64 noundef %210)
  %238 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %237, i32 noundef 0)
  %239 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %9, i32 noundef %238, i32 noundef 8)
          to label %240 unwind label %252

240:                                              ; preds = %234
  %241 = call noundef nonnull align 1 dereferenceable(16) ptr @_ZN6basisu6vectorIN6basist27etc1_selector_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %201, i64 noundef %210)
  %242 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %241, i32 noundef 1)
  %243 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %9, i32 noundef %242, i32 noundef 8)
          to label %244 unwind label %252

244:                                              ; preds = %240
  %245 = call noundef nonnull align 1 dereferenceable(16) ptr @_ZN6basisu6vectorIN6basist27etc1_selector_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %201, i64 noundef %210)
  %246 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %245, i32 noundef 2)
  %247 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %9, i32 noundef %246, i32 noundef 8)
          to label %248 unwind label %252

248:                                              ; preds = %244
  %249 = call noundef nonnull align 1 dereferenceable(16) ptr @_ZN6basisu6vectorIN6basist27etc1_selector_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %201, i64 noundef %210)
  %250 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %249, i32 noundef 3)
  %251 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %9, i32 noundef %250, i32 noundef 8)
          to label %.loopexit unwind label %252

252:                                              ; preds = %248, %244, %240, %234
  %253 = landingpad { ptr, i32 }
          cleanup
  br label %280

.loopexit:                                        ; preds = %248, %227
  %.1155 = phi i32 [ %215, %227 ], [ %.0154249, %248 ]
  %.1153 = phi i32 [ %228, %227 ], [ %.0152250, %248 ]
  %.1151 = phi i32 [ %229, %227 ], [ %.0150251, %248 ]
  %.1149 = phi i32 [ %.0148252, %227 ], [ %235, %248 ]
  %.1147 = phi i32 [ %.0146253, %227 ], [ %236, %248 ]
  %indvars.iv.next306 = add nuw nsw i64 %indvars.iv305, 1
  %254 = call noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %255 = zext i32 %254 to i64
  %256 = icmp ult i64 %indvars.iv.next306, %255
  br i1 %256, label %203, label %._crit_edge258, !llvm.loop !44

257:                                              ; preds = %._crit_edge258
  %258 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6basisu13bitwise_coder9get_bytesEv(ptr noundef nonnull align 8 dereferenceable(32) %9)
  %259 = getelementptr inbounds i8, ptr %0, i64 88
  %260 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN6basisu6vectorIhEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %259, ptr noundef nonnull align 8 dereferenceable(16) %258)
          to label %261 unwind label %278

261:                                              ; preds = %257
  %262 = uitofp i32 %.0154.lcssa to float
  %263 = fmul float %262, 1.000000e+02
  %264 = call noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %265 = uitofp i32 %264 to float
  %266 = fdiv float %263, %265
  %267 = fpext float %266 to double
  invoke void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef nonnull @.str.36, i32 noundef %.0154.lcssa, double noundef %267)
          to label %268 unwind label %278

268:                                              ; preds = %261
  %269 = uitofp i32 %.0148.lcssa to float
  %270 = fmul float %269, 1.000000e+02
  %271 = call noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %272 = uitofp i32 %271 to float
  %273 = fdiv float %270, %272
  %274 = fpext float %273 to double
  invoke void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef nonnull @.str.37, i32 noundef %.0148.lcssa, double noundef %274)
          to label %275 unwind label %278

275:                                              ; preds = %268
  invoke void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef nonnull @.str.38, i32 noundef %.0152.lcssa, i32 noundef %.0150.lcssa, i32 noundef %.0146.lcssa, i32 noundef %.0145.lcssa)
          to label %276 unwind label %278

276:                                              ; preds = %275
  call void @_ZN6basisu13bitwise_coderD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #7
  br label %277

277:                                              ; preds = %167, %276
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #7
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #7
  call void @_ZN6basisu6huff2DD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %6) #7
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %6) #7
  br i1 %165, label %467, label %486

278:                                              ; preds = %275, %268, %261, %257, %._crit_edge258
  %279 = landingpad { ptr, i32 }
          cleanup
  br label %280

280:                                              ; preds = %278, %232, %252, %230, %196
  %.pn187.pn.pn.pn = phi { ptr, i32 } [ %197, %196 ], [ %279, %278 ], [ %231, %230 ], [ %233, %232 ], [ %253, %252 ]
  call void @_ZN6basisu13bitwise_coderD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #7
  br label %281

281:                                              ; preds = %280, %194
  %.pn187.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn187.pn.pn.pn, %280 ], [ %195, %194 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #7
  br label %282

282:                                              ; preds = %281, %170
  %.pn187.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn187.pn.pn.pn.pn, %281 ], [ %171, %170 ]
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #7
  br label %283

283:                                              ; preds = %282, %168
  %.pn187.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn187.pn.pn.pn.pn.pn, %282 ], [ %169, %168 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #7
  br label %284

284:                                              ; preds = %283, %162
  %.pn195 = phi { ptr, i32 } [ %163, %162 ], [ %.pn187.pn.pn.pn.pn.pn.pn, %283 ]
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #7
  br label %285

285:                                              ; preds = %284, %144
  %.pn195.pn = phi { ptr, i32 } [ %.pn195, %284 ], [ %145, %144 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #7
  call void @_ZN6basisu6huff2DD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %6) #7
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %6) #7
  br label %487

286:                                              ; preds = %._crit_edge308
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #7
  call void @_ZN6basisu9histogramC2Ej(ptr noundef nonnull align 8 dereferenceable(16) %10, i32 noundef 256)
  %287 = call noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %.not267 = icmp eq i32 %287, 0
  br i1 %.not267, label %._crit_edge235, label %288

288:                                              ; preds = %286
  %289 = getelementptr inbounds i8, ptr %0, i64 192
  %290 = getelementptr inbounds i8, ptr %0, i64 320
  %291 = call noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %292 = icmp ugt i32 %291, 1
  br i1 %292, label %.peel.next, label %._crit_edge235

._crit_edge235:                                   ; preds = %319, %288, %286
  %293 = invoke noundef i64 @_ZNK6basisu9histogram9get_totalEv(ptr noundef nonnull align 8 dereferenceable(16) %10)
          to label %323 unwind label %325

.peel.next:                                       ; preds = %288, %319
  %indvars.iv278 = phi i64 [ %indvars.iv.next279, %319 ], [ 1, %288 ]
  %294 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %290, i64 noundef %indvars.iv278)
  %295 = load i32, ptr %294, align 4, !tbaa !36
  %296 = zext i32 %295 to i64
  %297 = call noundef nonnull align 1 dereferenceable(16) ptr @_ZN6basisu6vectorIN6basist27etc1_selector_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %289, i64 noundef %296)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %11) #7
  %298 = add nsw i64 %indvars.iv278, -1
  %299 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %290, i64 noundef %298)
  %300 = load i32, ptr %299, align 4, !tbaa !36
  %301 = zext i32 %300 to i64
  %302 = call noundef nonnull align 1 dereferenceable(16) ptr @_ZN6basisu6vectorIN6basist27etc1_selector_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %289, i64 noundef %301)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(16) %11, ptr noundef nonnull align 1 dereferenceable(16) %302, i64 16, i1 false), !tbaa.struct !45
  %303 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %297, i32 noundef 0)
  %304 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %11, i32 noundef 0)
  %305 = xor i32 %304, %303
  invoke void @_ZN6basisu9histogram3incEj(ptr noundef nonnull align 8 dereferenceable(16) %10, i32 noundef %305)
          to label %306 unwind label %318

306:                                              ; preds = %.peel.next
  %307 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %297, i32 noundef 1)
  %308 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %11, i32 noundef 1)
  %309 = xor i32 %308, %307
  invoke void @_ZN6basisu9histogram3incEj(ptr noundef nonnull align 8 dereferenceable(16) %10, i32 noundef %309)
          to label %310 unwind label %318

310:                                              ; preds = %306
  %311 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %297, i32 noundef 2)
  %312 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %11, i32 noundef 2)
  %313 = xor i32 %312, %311
  invoke void @_ZN6basisu9histogram3incEj(ptr noundef nonnull align 8 dereferenceable(16) %10, i32 noundef %313)
          to label %314 unwind label %318

314:                                              ; preds = %310
  %315 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %297, i32 noundef 3)
  %316 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %11, i32 noundef 3)
  %317 = xor i32 %316, %315
  invoke void @_ZN6basisu9histogram3incEj(ptr noundef nonnull align 8 dereferenceable(16) %10, i32 noundef %317)
          to label %319 unwind label %318

318:                                              ; preds = %314, %310, %306, %.peel.next
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %11) #7
  br label %466

319:                                              ; preds = %314
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %11) #7
  %indvars.iv.next279 = add nuw nsw i64 %indvars.iv278, 1
  %320 = call noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %321 = zext i32 %320 to i64
  %322 = icmp ult i64 %indvars.iv.next279, %321
  br i1 %322, label %.peel.next, label %._crit_edge235, !llvm.loop !47

323:                                              ; preds = %._crit_edge235
  %.not174 = icmp eq i64 %293, 0
  br i1 %.not174, label %324, label %327

324:                                              ; preds = %323
  invoke void @_ZN6basisu9histogram3incEj(ptr noundef nonnull align 8 dereferenceable(16) %10, i32 noundef 0)
          to label %327 unwind label %325

325:                                              ; preds = %324, %._crit_edge235
  %326 = landingpad { ptr, i32 }
          cleanup
  br label %466

327:                                              ; preds = %324, %323
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %12) #7
  invoke void @_ZN6basisu22huffman_encoding_tableC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12)
          to label %328 unwind label %332

328:                                              ; preds = %327
  %329 = invoke noundef zeroext i1 @_ZN6basisu22huffman_encoding_table4initERKNS_9histogramEj(ptr noundef nonnull align 8 dereferenceable(32) %12, ptr noundef nonnull align 8 dereferenceable(16) %10, i32 noundef 16)
          to label %330 unwind label %334

330:                                              ; preds = %328
  br i1 %329, label %336, label %331

331:                                              ; preds = %330
  invoke void (ptr, ...) @_ZN6basisu12error_printfEPKcz(ptr noundef nonnull @.str.39)
          to label %461 unwind label %334

332:                                              ; preds = %327
  %333 = landingpad { ptr, i32 }
          cleanup
  br label %465

334:                                              ; preds = %331, %328
  %335 = landingpad { ptr, i32 }
          cleanup
  br label %464

336:                                              ; preds = %330
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %13) #7
  invoke void @_ZN6basisu13bitwise_coderC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13)
          to label %337 unwind label %376

337:                                              ; preds = %336
  invoke void @_ZN6basisu13bitwise_coder4initEj(ptr noundef nonnull align 8 dereferenceable(32) %13, i32 noundef 1048576)
          to label %338 unwind label %378

338:                                              ; preds = %337
  %339 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %13, i32 noundef 0, i32 noundef 1)
          to label %340 unwind label %378

340:                                              ; preds = %338
  %341 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %13, i32 noundef 0, i32 noundef 1)
          to label %342 unwind label %378

342:                                              ; preds = %340
  %343 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %13, i32 noundef 0, i32 noundef 1)
          to label %344 unwind label %378

344:                                              ; preds = %342
  %345 = invoke noundef i32 @_ZN6basisu13bitwise_coder18emit_huffman_tableERKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %13, ptr noundef nonnull align 8 dereferenceable(32) %12)
          to label %.preheader202 unwind label %378

.preheader202:                                    ; preds = %344
  %346 = call noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %.not268 = icmp eq i32 %346, 0
  br i1 %.not268, label %._crit_edge240, label %.preheader200.preheader.peel

.preheader200.preheader.peel:                     ; preds = %.preheader202
  %347 = getelementptr inbounds i8, ptr %0, i64 192
  %348 = getelementptr inbounds i8, ptr %0, i64 320
  %349 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %348, i64 noundef 0)
  %350 = load i32, ptr %349, align 4, !tbaa !36
  %351 = zext i32 %350 to i64
  %352 = call noundef nonnull align 1 dereferenceable(16) ptr @_ZN6basisu6vectorIN6basist27etc1_selector_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %347, i64 noundef %351)
  %353 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %352, i32 noundef 0)
  %354 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %13, i32 noundef %353, i32 noundef 8)
          to label %.preheader200.1.peel unwind label %380

.preheader200.1.peel:                             ; preds = %.preheader200.preheader.peel
  %355 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %348, i64 noundef 0)
  %356 = load i32, ptr %355, align 4, !tbaa !36
  %357 = zext i32 %356 to i64
  %358 = call noundef nonnull align 1 dereferenceable(16) ptr @_ZN6basisu6vectorIN6basist27etc1_selector_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %347, i64 noundef %357)
  %359 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %358, i32 noundef 1)
  %360 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %13, i32 noundef %359, i32 noundef 8)
          to label %.preheader200.2.peel unwind label %380

.preheader200.2.peel:                             ; preds = %.preheader200.1.peel
  %361 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %348, i64 noundef 0)
  %362 = load i32, ptr %361, align 4, !tbaa !36
  %363 = zext i32 %362 to i64
  %364 = call noundef nonnull align 1 dereferenceable(16) ptr @_ZN6basisu6vectorIN6basist27etc1_selector_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %347, i64 noundef %363)
  %365 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %364, i32 noundef 2)
  %366 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %13, i32 noundef %365, i32 noundef 8)
          to label %.preheader200.3.peel unwind label %380

.preheader200.3.peel:                             ; preds = %.preheader200.2.peel
  %367 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %348, i64 noundef 0)
  %368 = load i32, ptr %367, align 4, !tbaa !36
  %369 = zext i32 %368 to i64
  %370 = call noundef nonnull align 1 dereferenceable(16) ptr @_ZN6basisu6vectorIN6basist27etc1_selector_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %347, i64 noundef %369)
  %371 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %370, i32 noundef 3)
  %372 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %13, i32 noundef %371, i32 noundef 8)
          to label %.loopexit201.peel unwind label %380

.loopexit201.peel:                                ; preds = %.preheader200.3.peel
  %373 = call noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %374 = icmp ugt i32 %373, 1
  br i1 %374, label %.peel.next287, label %._crit_edge240

._crit_edge240:                                   ; preds = %.loopexit201, %.loopexit201.peel, %.preheader202
  %375 = invoke noundef i32 @_ZN6basisu13bitwise_coder5flushEv(ptr noundef nonnull align 8 dereferenceable(32) %13)
          to label %413 unwind label %378

376:                                              ; preds = %336
  %377 = landingpad { ptr, i32 }
          cleanup
  br label %463

378:                                              ; preds = %457, %._crit_edge244, %426, %424, %422, %421, %413, %._crit_edge240, %344, %342, %340, %338, %337
  %379 = landingpad { ptr, i32 }
          cleanup
  br label %462

380:                                              ; preds = %.preheader200.3.peel, %.preheader200.2.peel, %.preheader200.1.peel, %.preheader200.preheader.peel
  %lpad.loopexit.split-lp297 = landingpad { ptr, i32 }
          cleanup
  br label %462

.peel.next287:                                    ; preds = %.loopexit201.peel, %.loopexit201
  %indvars.iv283 = phi i64 [ %indvars.iv.next284, %.loopexit201 ], [ 1, %.loopexit201.peel ]
  %381 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %348, i64 noundef %indvars.iv283)
  %382 = load i32, ptr %381, align 4, !tbaa !36
  %383 = zext i32 %382 to i64
  %384 = call noundef nonnull align 1 dereferenceable(16) ptr @_ZN6basisu6vectorIN6basist27etc1_selector_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %347, i64 noundef %383)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %14) #7
  %385 = add nsw i64 %indvars.iv283, -1
  %386 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %348, i64 noundef %385)
  %387 = load i32, ptr %386, align 4, !tbaa !36
  %388 = zext i32 %387 to i64
  %389 = call noundef nonnull align 1 dereferenceable(16) ptr @_ZN6basisu6vectorIN6basist27etc1_selector_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %347, i64 noundef %388)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(16) %14, ptr noundef nonnull align 1 dereferenceable(16) %389, i64 16, i1 false), !tbaa.struct !45
  %390 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %384, i32 noundef 0)
  %391 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %14, i32 noundef 0)
  %392 = xor i32 %391, %390
  %393 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_codeEjRKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %13, i32 noundef %392, ptr noundef nonnull align 8 dereferenceable(32) %12)
          to label %394 unwind label %409

394:                                              ; preds = %.peel.next287
  %395 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %384, i32 noundef 1)
  %396 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %14, i32 noundef 1)
  %397 = xor i32 %396, %395
  %398 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_codeEjRKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %13, i32 noundef %397, ptr noundef nonnull align 8 dereferenceable(32) %12)
          to label %399 unwind label %409

399:                                              ; preds = %394
  %400 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %384, i32 noundef 2)
  %401 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %14, i32 noundef 2)
  %402 = xor i32 %401, %400
  %403 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_codeEjRKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %13, i32 noundef %402, ptr noundef nonnull align 8 dereferenceable(32) %12)
          to label %404 unwind label %409

404:                                              ; preds = %399
  %405 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %384, i32 noundef 3)
  %406 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %14, i32 noundef 3)
  %407 = xor i32 %406, %405
  %408 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_codeEjRKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %13, i32 noundef %407, ptr noundef nonnull align 8 dereferenceable(32) %12)
          to label %.loopexit201 unwind label %409

409:                                              ; preds = %404, %399, %394, %.peel.next287
  %lpad.loopexit291 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %14) #7
  br label %462

.loopexit201:                                     ; preds = %404
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %14) #7
  %indvars.iv.next284 = add nuw nsw i64 %indvars.iv283, 1
  %410 = call noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %411 = zext i32 %410 to i64
  %412 = icmp ult i64 %indvars.iv.next284, %411
  br i1 %412, label %.peel.next287, label %._crit_edge240, !llvm.loop !49

413:                                              ; preds = %._crit_edge240
  %414 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6basisu13bitwise_coder9get_bytesEv(ptr noundef nonnull align 8 dereferenceable(32) %13)
  %415 = getelementptr inbounds i8, ptr %0, i64 88
  %416 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN6basisu6vectorIhEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %415, ptr noundef nonnull align 8 dereferenceable(16) %414)
          to label %417 unwind label %378

417:                                              ; preds = %413
  %418 = call noundef i32 @_ZNK6basisu6vectorIhE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %415)
  %419 = call noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %420 = shl i32 %419, 2
  %.not175 = icmp ult i32 %418, %420
  br i1 %.not175, label %460, label %421

421:                                              ; preds = %417
  invoke void @_ZN6basisu13bitwise_coder4initEj(ptr noundef nonnull align 8 dereferenceable(32) %13, i32 noundef 1048576)
          to label %422 unwind label %378

422:                                              ; preds = %421
  %423 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %13, i32 noundef 0, i32 noundef 1)
          to label %424 unwind label %378

424:                                              ; preds = %422
  %425 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %13, i32 noundef 0, i32 noundef 1)
          to label %426 unwind label %378

426:                                              ; preds = %424
  %427 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %13, i32 noundef 1, i32 noundef 1)
          to label %.preheader199 unwind label %378

.preheader199:                                    ; preds = %426
  %428 = call noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %.not269 = icmp eq i32 %428, 0
  br i1 %.not269, label %._crit_edge244, label %.lr.ph243

.lr.ph243:                                        ; preds = %.preheader199
  %429 = getelementptr inbounds i8, ptr %0, i64 320
  %430 = getelementptr inbounds i8, ptr %0, i64 192
  br label %432

._crit_edge244:                                   ; preds = %451, %.preheader199
  %431 = invoke noundef i32 @_ZN6basisu13bitwise_coder5flushEv(ptr noundef nonnull align 8 dereferenceable(32) %13)
          to label %457 unwind label %378

432:                                              ; preds = %.lr.ph243, %451
  %indvars.iv299 = phi i64 [ 0, %.lr.ph243 ], [ %indvars.iv.next300, %451 ]
  %433 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %429, i64 noundef %indvars.iv299)
  %434 = load i32, ptr %433, align 4, !tbaa !36
  %435 = zext i32 %434 to i64
  %436 = call noundef nonnull align 1 dereferenceable(16) ptr @_ZN6basisu6vectorIN6basist27etc1_selector_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %430, i64 noundef %435)
  %437 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %436, i32 noundef 0)
  %438 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %13, i32 noundef %437, i32 noundef 8)
          to label %439 unwind label %455

439:                                              ; preds = %432
  %440 = call noundef nonnull align 1 dereferenceable(16) ptr @_ZN6basisu6vectorIN6basist27etc1_selector_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %430, i64 noundef %435)
  %441 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %440, i32 noundef 1)
  %442 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %13, i32 noundef %441, i32 noundef 8)
          to label %443 unwind label %455

443:                                              ; preds = %439
  %444 = call noundef nonnull align 1 dereferenceable(16) ptr @_ZN6basisu6vectorIN6basist27etc1_selector_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %430, i64 noundef %435)
  %445 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %444, i32 noundef 2)
  %446 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %13, i32 noundef %445, i32 noundef 8)
          to label %447 unwind label %455

447:                                              ; preds = %443
  %448 = call noundef nonnull align 1 dereferenceable(16) ptr @_ZN6basisu6vectorIN6basist27etc1_selector_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %430, i64 noundef %435)
  %449 = call noundef i32 @_ZNK6basist27etc1_selector_palette_entry8get_byteEj(ptr noundef nonnull align 1 dereferenceable(16) %448, i32 noundef 3)
  %450 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %13, i32 noundef %449, i32 noundef 8)
          to label %451 unwind label %455

451:                                              ; preds = %447
  %indvars.iv.next300 = add nuw nsw i64 %indvars.iv299, 1
  %452 = call noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %453 = zext i32 %452 to i64
  %454 = icmp ult i64 %indvars.iv.next300, %453
  br i1 %454, label %432, label %._crit_edge244, !llvm.loop !50

455:                                              ; preds = %447, %443, %439, %432
  %456 = landingpad { ptr, i32 }
          cleanup
  br label %462

457:                                              ; preds = %._crit_edge244
  %458 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6basisu13bitwise_coder9get_bytesEv(ptr noundef nonnull align 8 dereferenceable(32) %13)
  %459 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN6basisu6vectorIhEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %415, ptr noundef nonnull align 8 dereferenceable(16) %458)
          to label %460 unwind label %378

460:                                              ; preds = %457, %417
  call void @_ZN6basisu13bitwise_coderD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %13) #7
  br label %461

461:                                              ; preds = %331, %460
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %12) #7
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %10) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #7
  br i1 %329, label %467, label %486

462:                                              ; preds = %380, %409, %455, %378
  %.pn177.pn = phi { ptr, i32 } [ %456, %455 ], [ %379, %378 ], [ %lpad.loopexit291, %409 ], [ %lpad.loopexit.split-lp297, %380 ]
  call void @_ZN6basisu13bitwise_coderD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #7
  br label %463

463:                                              ; preds = %462, %376
  %.pn177.pn.pn = phi { ptr, i32 } [ %.pn177.pn, %462 ], [ %377, %376 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %13) #7
  br label %464

464:                                              ; preds = %463, %334
  %.pn177.pn.pn.pn = phi { ptr, i32 } [ %.pn177.pn.pn, %463 ], [ %335, %334 ]
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #7
  br label %465

465:                                              ; preds = %464, %332
  %.pn177.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn177.pn.pn.pn, %464 ], [ %333, %332 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %12) #7
  br label %466

466:                                              ; preds = %465, %325, %318
  %.pn184 = phi { ptr, i32 } [ %lpad.loopexit, %318 ], [ %.pn177.pn.pn.pn.pn, %465 ], [ %326, %325 ]
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %10) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #7
  br label %487

467:                                              ; preds = %277, %461, %127
  %468 = getelementptr inbounds i8, ptr %0, i64 88
  %469 = call noundef i32 @_ZNK6basisu6vectorIhE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %468)
  %470 = shl nsw i32 %469, 3
  %471 = call noundef i32 @_ZNK6basisu6vectorIhE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %468)
  %472 = call noundef i32 @_ZNK6basisu6vectorIhE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %468)
  %473 = uitofp i32 %472 to float
  %474 = fmul float %473, 8.000000e+00
  %475 = call noundef i32 @_ZNK6basisu15basisu_frontend27get_total_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %15)
  %476 = uitofp i32 %475 to float
  %477 = fdiv float %474, %476
  %478 = fpext float %477 to double
  %479 = call noundef i32 @_ZNK6basisu6vectorIhE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %468)
  %480 = uitofp i32 %479 to float
  %481 = fmul float %480, 8.000000e+00
  %482 = call noundef i32 @_ZNK6basisu14basisu_backend22get_total_input_texelsEv(ptr noundef nonnull align 8 dereferenceable(336) %0)
  %483 = uitofp i32 %482 to float
  %484 = fdiv float %481, %483
  %485 = fpext float %484 to double
  call void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef nonnull @.str.40, i32 noundef %470, i32 noundef %471, double noundef %478, double noundef %485)
  br label %486

486:                                              ; preds = %127, %277, %461, %467
  %.3 = phi i1 [ true, %467 ], [ false, %277 ], [ false, %461 ], [ false, %127 ]
  ret i1 %.3

487:                                              ; preds = %466, %285, %135
  %.pn195.pn.pn = phi { ptr, i32 } [ %.pn195.pn, %285 ], [ %.pn184, %466 ], [ %.pn172, %135 ]
  resume { ptr, i32 } %.pn195.pn.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu6huff2DC2Ejj(ptr noundef nonnull align 8 dereferenceable(88), i32 noundef, i32 noundef) unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6basisu6huff2D4emitEj(ptr noundef nonnull align 8 dereferenceable(88), i32 noundef) local_unnamed_addr #6 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN6basisu6huff2D14start_encodingEj(ptr noundef nonnull align 8 dereferenceable(88), i32 noundef) local_unnamed_addr #6 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZNK6basisu6huff2D18get_encoding_tableEv(ptr noundef nonnull align 8 dereferenceable(88)) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN6basisu6huff2D13emit_next_symERNS_13bitwise_coderE(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #6 align 2

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

attributes #0 = { mustprogress nocallback nofree 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 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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 #7 = { 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 0}
!6 = !{!"_ZTSN6basisu14basisu_backendE", !7, i64 0, !10, i64 8, !14, i64 40, !15, i64 56, !7, i64 168, !20, i64 176, !21, i64 192, !22, i64 208, !23, i64 224, !24, i64 240, !24, i64 256, !25, i64 272, !25, i64 288, !24, i64 304, !24, i64 320}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN6basisu21basisu_backend_paramsE", !11, i64 0, !11, i64 1, !11, i64 2, !12, i64 4, !12, i64 8, !13, i64 12, !11, i64 16, !13, i64 20, !13, i64 24, !11, i64 28, !11, i64 29}
!11 = !{!"bool", !8, i64 0}
!12 = !{!"float", !8, i64 0}
!13 = !{!"int", !8, i64 0}
!14 = !{!"_ZTSN6basisu6vectorINS_25basisu_backend_slice_descEEE", !7, i64 0, !13, i64 8, !13, i64 12}
!15 = !{!"_ZTSN6basisu21basisu_backend_outputE", !16, i64 0, !11, i64 4, !11, i64 5, !11, i64 6, !13, i64 8, !13, i64 12, !17, i64 16, !17, i64 32, !14, i64 48, !17, i64 64, !18, i64 80, !19, i64 96}
!16 = !{!"_ZTSN6basist16basis_tex_formatE", !8, i64 0}
!17 = !{!"_ZTSN6basisu6vectorIhEE", !7, i64 0, !13, i64 8, !13, i64 12}
!18 = !{!"_ZTSN6basisu6vectorINS0_IhEEEE", !7, i64 0, !13, i64 8, !13, i64 12}
!19 = !{!"_ZTSN6basisu6vectorItEE", !7, i64 0, !13, i64 8, !13, i64 12}
!20 = !{!"_ZTSN6basisu6vectorINS_27etc1_endpoint_palette_entryEEE", !7, i64 0, !13, i64 8, !13, i64 12}
!21 = !{!"_ZTSN6basisu6vectorIN6basist27etc1_selector_palette_entryEEE", !7, i64 0, !13, i64 8, !13, i64 12}
!22 = !{!"_ZTSN6basisu6vectorINS_14basisu_backend34etc1_global_selector_cb_entry_descEEE", !7, i64 0, !13, i64 8, !13, i64 12}
!23 = !{!"_ZTSN6basisu6vectorINS_8vector2DINS_13encoder_blockEEEEE", !7, i64 0, !13, i64 8, !13, i64 12}
!24 = !{!"_ZTSN6basisu6vectorIjEE", !7, i64 0, !13, i64 8, !13, i64 12}
!25 = !{!"_ZTSN6basisu6vectorIbEE", !7, i64 0, !13, i64 8, !13, i64 12}
!26 = !{!6, !11, i64 24}
!27 = !{i8 0, i8 2}
!28 = !{}
!29 = !{!6, !11, i64 36}
!30 = !{!6, !13, i64 32}
!31 = !{!32, !13, i64 4}
!32 = !{!"_ZTSN6basisu14basisu_backend34etc1_global_selector_cb_entry_descE", !13, i64 0, !13, i64 4, !11, i64 8}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = !{!6, !13, i64 28}
!36 = !{!13, !13, i64 0}
!37 = !{!32, !13, i64 0}
!38 = distinct !{!38, !34}
!39 = !{!11, !11, i64 0}
!40 = distinct !{!40, !34}
!41 = !{!42, !13, i64 0}
!42 = !{!"_ZTSN6basist38etc1_global_selector_codebook_entry_idE", !13, i64 0, !43, i64 4}
!43 = !{!"_ZTSN6basist34etc1_global_palette_entry_modifierE", !8, i64 0, !11, i64 1, !11, i64 2, !11, i64 3, !11, i64 4, !11, i64 5, !11, i64 6, !11, i64 7, !11, i64 8, !11, i64 9, !11, i64 10, !11, i64 11, !8, i64 12}
!44 = distinct !{!44, !34}
!45 = !{i64 0, i64 16, !46}
!46 = !{!8, !8, i64 0}
!47 = distinct !{!47, !34, !48}
!48 = !{!"llvm.loop.peeled.count", i32 1}
!49 = distinct !{!49, !34, !48}
!50 = distinct !{!50, !34}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopFullUnrollPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass