; 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::vector.16" = type { ptr, i32, i32 }
%"class.basisu::vector.14" = type { ptr, i32, i32 }
%"class.basisu::histogram" = type { %"class.basisu::vector.14" }
%"class.basisu::color_rgba" = type { %union.anon }
%union.anon = type { [4 x i8] }
%"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::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 }
%"struct.basisu::basisu_backend_slice_desc" = type <{ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, i8, [2 x i8] }>
%"struct.basisu::encoder_block" = type <{ i32, i32, i32, i32, i8, [3 x i8] }>
%"struct.basisu::etc1_endpoint_palette_entry" = type <{ %"class.basisu::color_rgba", i32, i8, [3 x i8] }>

@.str.27 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [81 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [88 x i8], align 1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6basisu10color_rgbaC2Eiiii(ptr noundef nonnull align 1 dereferenceable(4), i32 noundef, i32 noundef, i32 noundef, i32 noundef) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(9) ptr @_ZN6basisu6vectorINS_27etc1_endpoint_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) #1 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) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6basisu6vectorIjEC2Em(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) unnamed_addr #0 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(17) ptr @_ZN6basisu8vector2DINS_13encoder_blockEEclEjj(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) #0 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN6basisu7minimumIjEET_S1_S1_(i32 noundef, i32 noundef) #1

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu22huffman_encoding_tableC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 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) #3 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6basisu13bitwise_coder4initEj(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) #0 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)) #2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN6basisu13bitwise_coder5flushEv(ptr noundef nonnull align 8 dereferenceable(32)) #0 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)) #1 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)) #0 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)) #0 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN6basisu14basisu_backend23encode_endpoint_paletteEv(ptr noundef nonnull align 8 dereferenceable(336) %0) #3 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::vector.16", align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca %"class.basisu::vector.14", align 8
  %18 = alloca %"class.basisu::vector.16", align 8
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i8, align 1
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca %"class.basisu::histogram", align 8
  %29 = alloca %"class.basisu::histogram", align 8
  %30 = alloca %"class.basisu::histogram", align 8
  %31 = alloca %"class.basisu::histogram", align 8
  %32 = alloca %"class.basisu::color_rgba", align 1
  %33 = alloca i32, align 4
  %34 = alloca i32, align 4
  %35 = alloca i32, align 4
  %36 = alloca i32, align 4
  %37 = alloca i32, align 4
  %38 = alloca i32, align 4
  %39 = alloca %"class.basisu::huffman_encoding_table", align 8
  %40 = alloca %"class.basisu::huffman_encoding_table", align 8
  %41 = alloca %"class.basisu::huffman_encoding_table", align 8
  %42 = alloca %"class.basisu::huffman_encoding_table", align 8
  %43 = alloca %"class.basisu::bitwise_coder", align 8
  %44 = alloca i32, align 4
  %45 = alloca i32, align 4
  %46 = alloca i32, align 4
  %47 = alloca i32, align 4
  %48 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %49 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %50 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %49, i32 0, i32 0
  %51 = load ptr, ptr %50, align 8, !tbaa !9
  store ptr %51, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #5
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = call noundef i32 @_ZNK6basisu15basisu_frontend27get_total_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %52)
  %54 = zext i32 %53 to i64
  call void @_ZN6basisu6vectorIbEC2Em(ptr noundef nonnull align 8 dereferenceable(16) %5, i64 noundef %54)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 -1, ptr %6, align 4, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !27
  br label %55

55:                                               ; preds = %138, %1
  %56 = load i32, ptr %7, align 4, !tbaa !27
  %57 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %49, i32 0, i32 2
  %58 = invoke noundef i32 @_ZNK6basisu6vectorINS_25basisu_backend_slice_descEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %57)
          to label %59 unwind label %62

59:                                               ; preds = %55
  %60 = icmp ult i32 %56, %58
  br i1 %60, label %66, label %61

61:                                               ; preds = %59
  store i32 2, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %144

62:                                               ; preds = %55
  %63 = landingpad { ptr, i32 }
          cleanup
  %64 = extractvalue { ptr, i32 } %63, 0
  store ptr %64, ptr %8, align 8
  %65 = extractvalue { ptr, i32 } %63, 1
  store i32 %65, ptr %9, align 4
  br label %143

66:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %67 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %49, i32 0, i32 2
  %68 = load i32, ptr %7, align 4, !tbaa !27
  %69 = zext i32 %68 to i64
  %70 = invoke noundef nonnull align 4 dereferenceable(46) ptr @_ZN6basisu6vectorINS_25basisu_backend_slice_descEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %67, i64 noundef %69)
          to label %71 unwind label %86

71:                                               ; preds = %66
  %72 = getelementptr inbounds %"struct.basisu::basisu_backend_slice_desc", ptr %70, i32 0, i32 5
  %73 = load i32, ptr %72, align 4, !tbaa !28
  store i32 %73, ptr %11, align 4, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %74 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %49, i32 0, i32 2
  %75 = load i32, ptr %7, align 4, !tbaa !27
  %76 = zext i32 %75 to i64
  %77 = invoke noundef nonnull align 4 dereferenceable(46) ptr @_ZN6basisu6vectorINS_25basisu_backend_slice_descEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %74, i64 noundef %76)
          to label %78 unwind label %90

78:                                               ; preds = %71
  %79 = getelementptr inbounds %"struct.basisu::basisu_backend_slice_desc", ptr %77, i32 0, i32 6
  %80 = load i32, ptr %79, align 4, !tbaa !30
  store i32 %80, ptr %12, align 4, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !27
  br label %81

81:                                               ; preds = %134, %78
  %82 = load i32, ptr %13, align 4, !tbaa !27
  %83 = load i32, ptr %12, align 4, !tbaa !27
  %84 = icmp ult i32 %82, %83
  br i1 %84, label %94, label %85

85:                                               ; preds = %81
  store i32 5, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %137

86:                                               ; preds = %66
  %87 = landingpad { ptr, i32 }
          cleanup
  %88 = extractvalue { ptr, i32 } %87, 0
  store ptr %88, ptr %8, align 8
  %89 = extractvalue { ptr, i32 } %87, 1
  store i32 %89, ptr %9, align 4
  br label %142

90:                                               ; preds = %71
  %91 = landingpad { ptr, i32 }
          cleanup
  %92 = extractvalue { ptr, i32 } %91, 0
  store ptr %92, ptr %8, align 8
  %93 = extractvalue { ptr, i32 } %91, 1
  store i32 %93, ptr %9, align 4
  br label %141

94:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !27
  br label %95

95:                                               ; preds = %121, %94
  %96 = load i32, ptr %14, align 4, !tbaa !27
  %97 = load i32, ptr %11, align 4, !tbaa !27
  %98 = icmp ult i32 %96, %97
  br i1 %98, label %100, label %99

99:                                               ; preds = %95
  store i32 8, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %133

100:                                              ; preds = %95
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %101 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %49, i32 0, i32 8
  %102 = load i32, ptr %7, align 4, !tbaa !27
  %103 = zext i32 %102 to i64
  %104 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN6basisu6vectorINS_8vector2DINS_13encoder_blockEEEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %101, i64 noundef %103)
          to label %105 unwind label %124

105:                                              ; preds = %100
  %106 = load i32, ptr %14, align 4, !tbaa !27
  %107 = load i32, ptr %13, align 4, !tbaa !27
  %108 = invoke noundef nonnull align 4 dereferenceable(17) ptr @_ZN6basisu8vector2DINS_13encoder_blockEEclEjj(ptr noundef nonnull align 8 dereferenceable(24) %104, i32 noundef %106, i32 noundef %107)
          to label %109 unwind label %124

109:                                              ; preds = %105
  store ptr %108, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %110 = load ptr, ptr %15, align 8, !tbaa !5
  %111 = getelementptr inbounds %"struct.basisu::encoder_block", ptr %110, i32 0, i32 1
  %112 = load i32, ptr %111, align 4, !tbaa !31
  store i32 %112, ptr %16, align 4, !tbaa !27
  %113 = load i32, ptr %16, align 4, !tbaa !27
  %114 = zext i32 %113 to i64
  %115 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu6vectorIbEixEm(ptr noundef nonnull align 8 dereferenceable(16) %5, i64 noundef %114)
          to label %116 unwind label %128

116:                                              ; preds = %109
  store i8 1, ptr %115, align 1, !tbaa !33
  %117 = load i32, ptr %6, align 4, !tbaa !27
  %118 = load i32, ptr %16, align 4, !tbaa !27
  %119 = invoke noundef i32 @_ZN6basisu7minimumIjEET_S1_S1_(i32 noundef %117, i32 noundef %118)
          to label %120 unwind label %128

120:                                              ; preds = %116
  store i32 %119, ptr %6, align 4, !tbaa !27
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %121

121:                                              ; preds = %120
  %122 = load i32, ptr %14, align 4, !tbaa !27
  %123 = add i32 %122, 1
  store i32 %123, ptr %14, align 4, !tbaa !27
  br label %95, !llvm.loop !34

124:                                              ; preds = %105, %100
  %125 = landingpad { ptr, i32 }
          cleanup
  %126 = extractvalue { ptr, i32 } %125, 0
  store ptr %126, ptr %8, align 8
  %127 = extractvalue { ptr, i32 } %125, 1
  store i32 %127, ptr %9, align 4
  br label %132

128:                                              ; preds = %116, %109
  %129 = landingpad { ptr, i32 }
          cleanup
  %130 = extractvalue { ptr, i32 } %129, 0
  store ptr %130, ptr %8, align 8
  %131 = extractvalue { ptr, i32 } %129, 1
  store i32 %131, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %132

132:                                              ; preds = %128, %124
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %141

133:                                              ; preds = %99
  br label %134

134:                                              ; preds = %133
  %135 = load i32, ptr %13, align 4, !tbaa !27
  %136 = add i32 %135, 1
  store i32 %136, ptr %13, align 4, !tbaa !27
  br label %81, !llvm.loop !36

137:                                              ; preds = %85
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %138

138:                                              ; preds = %137
  %139 = load i32, ptr %7, align 4, !tbaa !27
  %140 = add i32 %139, 1
  store i32 %140, ptr %7, align 4, !tbaa !27
  br label %55, !llvm.loop !37

141:                                              ; preds = %132, %90
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %142

142:                                              ; preds = %141, %86
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %143

143:                                              ; preds = %142, %62
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %753

144:                                              ; preds = %61
  %145 = load i32, ptr %6, align 4, !tbaa !27
  invoke void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef @.str.27, i32 noundef %145)
          to label %146 unwind label %165

146:                                              ; preds = %144
  call void @llvm.lifetime.start.p0(i64 16, ptr %17) #5
  %147 = load ptr, ptr %4, align 8, !tbaa !5
  %148 = invoke noundef i32 @_ZNK6basisu15basisu_frontend27get_total_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %147)
          to label %149 unwind label %169

149:                                              ; preds = %146
  %150 = zext i32 %148 to i64
  invoke void @_ZN6basisu6vectorIjEC2Em(ptr noundef nonnull align 8 dereferenceable(16) %17, i64 noundef %150)
          to label %151 unwind label %169

151:                                              ; preds = %149
  invoke void @_ZN6basisu6vectorIjE7set_allERKj(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %152 unwind label %173

152:                                              ; preds = %151
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #5
  %153 = load ptr, ptr %4, align 8, !tbaa !5
  %154 = invoke noundef i32 @_ZNK6basisu15basisu_frontend27get_total_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %153)
          to label %155 unwind label %177

155:                                              ; preds = %152
  %156 = zext i32 %154 to i64
  invoke void @_ZN6basisu6vectorIbEC2Em(ptr noundef nonnull align 8 dereferenceable(16) %18, i64 noundef %156)
          to label %157 unwind label %177

157:                                              ; preds = %155
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  store i32 0, ptr %19, align 4, !tbaa !27
  br label %158

158:                                              ; preds = %213, %157
  %159 = load i32, ptr %19, align 4, !tbaa !27
  %160 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %49, i32 0, i32 9
  %161 = invoke noundef i32 @_ZNK6basisu6vectorIjE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %160)
          to label %162 unwind label %181

162:                                              ; preds = %158
  %163 = icmp ult i32 %159, %161
  br i1 %163, label %185, label %164

164:                                              ; preds = %162
  store i32 11, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  br label %217

165:                                              ; preds = %144
  %166 = landingpad { ptr, i32 }
          cleanup
  %167 = extractvalue { ptr, i32 } %166, 0
  store ptr %167, ptr %8, align 8
  %168 = extractvalue { ptr, i32 } %166, 1
  store i32 %168, ptr %9, align 4
  br label %753

169:                                              ; preds = %149, %146
  %170 = landingpad { ptr, i32 }
          cleanup
  %171 = extractvalue { ptr, i32 } %170, 0
  store ptr %171, ptr %8, align 8
  %172 = extractvalue { ptr, i32 } %170, 1
  store i32 %172, ptr %9, align 4
  br label %752

173:                                              ; preds = %151
  %174 = landingpad { ptr, i32 }
          cleanup
  %175 = extractvalue { ptr, i32 } %174, 0
  store ptr %175, ptr %8, align 8
  %176 = extractvalue { ptr, i32 } %174, 1
  store i32 %176, ptr %9, align 4
  br label %751

177:                                              ; preds = %155, %152
  %178 = landingpad { ptr, i32 }
          cleanup
  %179 = extractvalue { ptr, i32 } %178, 0
  store ptr %179, ptr %8, align 8
  %180 = extractvalue { ptr, i32 } %178, 1
  store i32 %180, ptr %9, align 4
  br label %750

181:                                              ; preds = %185, %158
  %182 = landingpad { ptr, i32 }
          cleanup
  %183 = extractvalue { ptr, i32 } %182, 0
  store ptr %183, ptr %8, align 8
  %184 = extractvalue { ptr, i32 } %182, 1
  store i32 %184, ptr %9, align 4
  br label %216

185:                                              ; preds = %162
  %186 = load i32, ptr %19, align 4, !tbaa !27
  %187 = zext i32 %186 to i64
  %188 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu6vectorIbEixEm(ptr noundef nonnull align 8 dereferenceable(16) %5, i64 noundef %187)
          to label %189 unwind label %181

189:                                              ; preds = %185
  %190 = load i8, ptr %188, align 1, !tbaa !33, !range !38, !noundef !39
  %191 = trunc i8 %190 to i1
  br i1 %191, label %192, label %212

192:                                              ; preds = %189
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  %193 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %49, i32 0, i32 9
  %194 = load i32, ptr %19, align 4, !tbaa !27
  %195 = zext i32 %194 to i64
  %196 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %193, i64 noundef %195)
          to label %197 unwind label %208

197:                                              ; preds = %192
  %198 = load i32, ptr %196, align 4, !tbaa !27
  store i32 %198, ptr %20, align 4, !tbaa !27
  %199 = load i32, ptr %20, align 4, !tbaa !27
  %200 = zext i32 %199 to i64
  %201 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu6vectorIbEixEm(ptr noundef nonnull align 8 dereferenceable(16) %18, i64 noundef %200)
          to label %202 unwind label %208

202:                                              ; preds = %197
  store i8 1, ptr %201, align 1, !tbaa !33
  %203 = load i32, ptr %19, align 4, !tbaa !27
  %204 = load i32, ptr %20, align 4, !tbaa !27
  %205 = zext i32 %204 to i64
  %206 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %17, i64 noundef %205)
          to label %207 unwind label %208

207:                                              ; preds = %202
  store i32 %203, ptr %206, align 4, !tbaa !27
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  br label %212

208:                                              ; preds = %202, %197, %192
  %209 = landingpad { ptr, i32 }
          cleanup
  %210 = extractvalue { ptr, i32 } %209, 0
  store ptr %210, ptr %8, align 8
  %211 = extractvalue { ptr, i32 } %209, 1
  store i32 %211, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  br label %216

212:                                              ; preds = %207, %189
  br label %213

213:                                              ; preds = %212
  %214 = load i32, ptr %19, align 4, !tbaa !27
  %215 = add i32 %214, 1
  store i32 %215, ptr %19, align 4, !tbaa !27
  br label %158, !llvm.loop !40

216:                                              ; preds = %208, %181
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  br label %749

217:                                              ; preds = %164
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  store i32 0, ptr %21, align 4, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #5
  store i32 0, ptr %22, align 4, !tbaa !27
  br label %218

218:                                              ; preds = %239, %217
  %219 = load i32, ptr %22, align 4, !tbaa !27
  %220 = invoke noundef i32 @_ZNK6basisu6vectorIbE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %18)
          to label %221 unwind label %224

221:                                              ; preds = %218
  %222 = icmp ult i32 %219, %220
  br i1 %222, label %228, label %223

223:                                              ; preds = %221
  store i32 14, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  br label %242

224:                                              ; preds = %228, %218
  %225 = landingpad { ptr, i32 }
          cleanup
  %226 = extractvalue { ptr, i32 } %225, 0
  store ptr %226, ptr %8, align 8
  %227 = extractvalue { ptr, i32 } %225, 1
  store i32 %227, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  br label %748

228:                                              ; preds = %221
  %229 = load i32, ptr %22, align 4, !tbaa !27
  %230 = zext i32 %229 to i64
  %231 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu6vectorIbEixEm(ptr noundef nonnull align 8 dereferenceable(16) %18, i64 noundef %230)
          to label %232 unwind label %224

232:                                              ; preds = %228
  %233 = load i8, ptr %231, align 1, !tbaa !33, !range !38, !noundef !39
  %234 = trunc i8 %233 to i1
  br i1 %234, label %238, label %235

235:                                              ; preds = %232
  %236 = load i32, ptr %21, align 4, !tbaa !27
  %237 = add i32 %236, 1
  store i32 %237, ptr %21, align 4, !tbaa !27
  br label %238

238:                                              ; preds = %235, %232
  br label %239

239:                                              ; preds = %238
  %240 = load i32, ptr %22, align 4, !tbaa !27
  %241 = add i32 %240, 1
  store i32 %241, ptr %22, align 4, !tbaa !27
  br label %218, !llvm.loop !41

242:                                              ; preds = %223
  %243 = load i32, ptr %21, align 4, !tbaa !27
  %244 = invoke noundef i32 @_ZNK6basisu6vectorIbE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %18)
          to label %245 unwind label %254

245:                                              ; preds = %242
  invoke void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef @.str.28, i32 noundef %243, i32 noundef %244)
          to label %246 unwind label %254

246:                                              ; preds = %245
  call void @llvm.lifetime.start.p0(i64 1, ptr %23) #5
  store i8 1, ptr %23, align 1, !tbaa !33
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #5
  store i32 0, ptr %24, align 4, !tbaa !27
  br label %247

247:                                              ; preds = %317, %246
  %248 = load i32, ptr %24, align 4, !tbaa !27
  %249 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %49, i32 0, i32 5
  %250 = invoke noundef i32 @_ZNK6basisu6vectorINS_27etc1_endpoint_palette_entryEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %249)
          to label %251 unwind label %258

251:                                              ; preds = %247
  %252 = icmp ult i32 %248, %250
  br i1 %252, label %262, label %253

253:                                              ; preds = %251
  store i32 17, ptr %10, align 4
  br label %322

254:                                              ; preds = %245, %242
  %255 = landingpad { ptr, i32 }
          cleanup
  %256 = extractvalue { ptr, i32 } %255, 0
  store ptr %256, ptr %8, align 8
  %257 = extractvalue { ptr, i32 } %255, 1
  store i32 %257, ptr %9, align 4
  br label %748

258:                                              ; preds = %247
  %259 = landingpad { ptr, i32 }
          cleanup
  %260 = extractvalue { ptr, i32 } %259, 0
  store ptr %260, ptr %8, align 8
  %261 = extractvalue { ptr, i32 } %259, 1
  store i32 %261, ptr %9, align 4
  br label %323

262:                                              ; preds = %251
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #5
  %263 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %49, i32 0, i32 5
  %264 = load i32, ptr %24, align 4, !tbaa !27
  %265 = zext i32 %264 to i64
  %266 = invoke noundef nonnull align 4 dereferenceable(9) ptr @_ZN6basisu6vectorINS_27etc1_endpoint_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %263, i64 noundef %265)
          to label %267 unwind label %301

267:                                              ; preds = %262
  %268 = getelementptr inbounds %"struct.basisu::etc1_endpoint_palette_entry", ptr %266, i32 0, i32 0
  %269 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %268, i32 noundef 0)
          to label %270 unwind label %301

270:                                              ; preds = %267
  %271 = load i8, ptr %269, align 1, !tbaa !42
  %272 = zext i8 %271 to i32
  store i32 %272, ptr %25, align 4, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #5
  %273 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %49, i32 0, i32 5
  %274 = load i32, ptr %24, align 4, !tbaa !27
  %275 = zext i32 %274 to i64
  %276 = invoke noundef nonnull align 4 dereferenceable(9) ptr @_ZN6basisu6vectorINS_27etc1_endpoint_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %273, i64 noundef %275)
          to label %277 unwind label %305

277:                                              ; preds = %270
  %278 = getelementptr inbounds %"struct.basisu::etc1_endpoint_palette_entry", ptr %276, i32 0, i32 0
  %279 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %278, i32 noundef 1)
          to label %280 unwind label %305

280:                                              ; preds = %277
  %281 = load i8, ptr %279, align 1, !tbaa !42
  %282 = zext i8 %281 to i32
  store i32 %282, ptr %26, align 4, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #5
  %283 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %49, i32 0, i32 5
  %284 = load i32, ptr %24, align 4, !tbaa !27
  %285 = zext i32 %284 to i64
  %286 = invoke noundef nonnull align 4 dereferenceable(9) ptr @_ZN6basisu6vectorINS_27etc1_endpoint_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %283, i64 noundef %285)
          to label %287 unwind label %309

287:                                              ; preds = %280
  %288 = getelementptr inbounds %"struct.basisu::etc1_endpoint_palette_entry", ptr %286, i32 0, i32 0
  %289 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %288, i32 noundef 2)
          to label %290 unwind label %309

290:                                              ; preds = %287
  %291 = load i8, ptr %289, align 1, !tbaa !42
  %292 = zext i8 %291 to i32
  store i32 %292, ptr %27, align 4, !tbaa !27
  %293 = load i32, ptr %25, align 4, !tbaa !27
  %294 = load i32, ptr %26, align 4, !tbaa !27
  %295 = icmp ne i32 %293, %294
  br i1 %295, label %300, label %296

296:                                              ; preds = %290
  %297 = load i32, ptr %25, align 4, !tbaa !27
  %298 = load i32, ptr %27, align 4, !tbaa !27
  %299 = icmp ne i32 %297, %298
  br i1 %299, label %300, label %313

300:                                              ; preds = %296, %290
  store i8 0, ptr %23, align 1, !tbaa !33
  store i32 17, ptr %10, align 4
  br label %314

301:                                              ; preds = %267, %262
  %302 = landingpad { ptr, i32 }
          cleanup
  %303 = extractvalue { ptr, i32 } %302, 0
  store ptr %303, ptr %8, align 8
  %304 = extractvalue { ptr, i32 } %302, 1
  store i32 %304, ptr %9, align 4
  br label %321

305:                                              ; preds = %277, %270
  %306 = landingpad { ptr, i32 }
          cleanup
  %307 = extractvalue { ptr, i32 } %306, 0
  store ptr %307, ptr %8, align 8
  %308 = extractvalue { ptr, i32 } %306, 1
  store i32 %308, ptr %9, align 4
  br label %320

309:                                              ; preds = %287, %280
  %310 = landingpad { ptr, i32 }
          cleanup
  %311 = extractvalue { ptr, i32 } %310, 0
  store ptr %311, ptr %8, align 8
  %312 = extractvalue { ptr, i32 } %310, 1
  store i32 %312, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #5
  br label %320

313:                                              ; preds = %296
  store i32 0, ptr %10, align 4
  br label %314

314:                                              ; preds = %313, %300
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #5
  %315 = load i32, ptr %10, align 4
  switch i32 %315, label %322 [
    i32 0, label %316
  ]

316:                                              ; preds = %314
  br label %317

317:                                              ; preds = %316
  %318 = load i32, ptr %24, align 4, !tbaa !27
  %319 = add i32 %318, 1
  store i32 %319, ptr %24, align 4, !tbaa !27
  br label %247, !llvm.loop !43

320:                                              ; preds = %309, %305
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #5
  br label %321

321:                                              ; preds = %320, %301
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #5
  br label %323

322:                                              ; preds = %314, %253
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  br label %324

323:                                              ; preds = %321, %258
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  br label %747

324:                                              ; preds = %322
  call void @llvm.lifetime.start.p0(i64 16, ptr %28) #5
  invoke void @_ZN6basisu9histogramC2Ej(ptr noundef nonnull align 8 dereferenceable(16) %28, i32 noundef 32)
          to label %325 unwind label %337

325:                                              ; preds = %324
  call void @llvm.lifetime.start.p0(i64 16, ptr %29) #5
  invoke void @_ZN6basisu9histogramC2Ej(ptr noundef nonnull align 8 dereferenceable(16) %29, i32 noundef 32)
          to label %326 unwind label %341

326:                                              ; preds = %325
  call void @llvm.lifetime.start.p0(i64 16, ptr %30) #5
  invoke void @_ZN6basisu9histogramC2Ej(ptr noundef nonnull align 8 dereferenceable(16) %30, i32 noundef 32)
          to label %327 unwind label %345

327:                                              ; preds = %326
  call void @llvm.lifetime.start.p0(i64 16, ptr %31) #5
  invoke void @_ZN6basisu9histogramC2Ej(ptr noundef nonnull align 8 dereferenceable(16) %31, i32 noundef 8)
          to label %328 unwind label %349

328:                                              ; preds = %327
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #5
  invoke void @_ZN6basisu10color_rgbaC2Eiiii(ptr noundef nonnull align 1 dereferenceable(4) %32, i32 noundef 16, i32 noundef 16, i32 noundef 16, i32 noundef 0)
          to label %329 unwind label %353

329:                                              ; preds = %328
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #5
  store i32 0, ptr %33, align 4, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 4, ptr %34) #5
  store i32 0, ptr %34, align 4, !tbaa !27
  br label %330

330:                                              ; preds = %466, %329
  %331 = load i32, ptr %34, align 4, !tbaa !27
  %332 = load ptr, ptr %4, align 8, !tbaa !5
  %333 = invoke noundef i32 @_ZNK6basisu15basisu_frontend27get_total_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %332)
          to label %334 unwind label %357

334:                                              ; preds = %330
  %335 = icmp ult i32 %331, %333
  br i1 %335, label %361, label %336

336:                                              ; preds = %334
  store i32 20, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #5
  br label %472

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

341:                                              ; preds = %325
  %342 = landingpad { ptr, i32 }
          cleanup
  %343 = extractvalue { ptr, i32 } %342, 0
  store ptr %343, ptr %8, align 8
  %344 = extractvalue { ptr, i32 } %342, 1
  store i32 %344, ptr %9, align 4
  br label %745

345:                                              ; preds = %326
  %346 = landingpad { ptr, i32 }
          cleanup
  %347 = extractvalue { ptr, i32 } %346, 0
  store ptr %347, ptr %8, align 8
  %348 = extractvalue { ptr, i32 } %346, 1
  store i32 %348, ptr %9, align 4
  br label %744

349:                                              ; preds = %327
  %350 = landingpad { ptr, i32 }
          cleanup
  %351 = extractvalue { ptr, i32 } %350, 0
  store ptr %351, ptr %8, align 8
  %352 = extractvalue { ptr, i32 } %350, 1
  store i32 %352, ptr %9, align 4
  br label %743

353:                                              ; preds = %328
  %354 = landingpad { ptr, i32 }
          cleanup
  %355 = extractvalue { ptr, i32 } %354, 0
  store ptr %355, ptr %8, align 8
  %356 = extractvalue { ptr, i32 } %354, 1
  store i32 %356, ptr %9, align 4
  br label %742

357:                                              ; preds = %330
  %358 = landingpad { ptr, i32 }
          cleanup
  %359 = extractvalue { ptr, i32 } %358, 0
  store ptr %359, ptr %8, align 8
  %360 = extractvalue { ptr, i32 } %358, 1
  store i32 %360, ptr %9, align 4
  br label %471

361:                                              ; preds = %334
  call void @llvm.lifetime.start.p0(i64 4, ptr %35) #5
  %362 = load i32, ptr %34, align 4, !tbaa !27
  %363 = zext i32 %362 to i64
  %364 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %17, i64 noundef %363)
          to label %365 unwind label %394

365:                                              ; preds = %361
  %366 = load i32, ptr %364, align 4, !tbaa !27
  store i32 %366, ptr %35, align 4, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 4, ptr %36) #5
  %367 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %49, i32 0, i32 5
  %368 = load i32, ptr %35, align 4, !tbaa !27
  %369 = zext i32 %368 to i64
  %370 = invoke noundef nonnull align 4 dereferenceable(9) ptr @_ZN6basisu6vectorINS_27etc1_endpoint_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %367, i64 noundef %369)
          to label %371 unwind label %398

371:                                              ; preds = %365
  %372 = getelementptr inbounds %"struct.basisu::etc1_endpoint_palette_entry", ptr %370, i32 0, i32 1
  %373 = load i32, ptr %372, align 4, !tbaa !44
  %374 = load i32, ptr %33, align 4, !tbaa !27
  %375 = sub i32 %373, %374
  store i32 %375, ptr %36, align 4, !tbaa !27
  %376 = load i32, ptr %36, align 4, !tbaa !27
  %377 = and i32 %376, 7
  invoke void @_ZN6basisu9histogram3incEj(ptr noundef nonnull align 8 dereferenceable(16) %31, i32 noundef %377)
          to label %378 unwind label %398

378:                                              ; preds = %371
  %379 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %49, i32 0, i32 5
  %380 = load i32, ptr %35, align 4, !tbaa !27
  %381 = zext i32 %380 to i64
  %382 = invoke noundef nonnull align 4 dereferenceable(9) ptr @_ZN6basisu6vectorINS_27etc1_endpoint_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %379, i64 noundef %381)
          to label %383 unwind label %398

383:                                              ; preds = %378
  %384 = getelementptr inbounds %"struct.basisu::etc1_endpoint_palette_entry", ptr %382, i32 0, i32 1
  %385 = load i32, ptr %384, align 4, !tbaa !44
  store i32 %385, ptr %33, align 4, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 4, ptr %37) #5
  store i32 0, ptr %37, align 4, !tbaa !27
  br label %386

386:                                              ; preds = %462, %383
  %387 = load i32, ptr %37, align 4, !tbaa !27
  %388 = load i8, ptr %23, align 1, !tbaa !33, !range !38, !noundef !39
  %389 = trunc i8 %388 to i1
  %390 = zext i1 %389 to i64
  %391 = select i1 %389, i32 1, i32 3
  %392 = icmp ult i32 %387, %391
  br i1 %392, label %402, label %393

393:                                              ; preds = %386
  store i32 23, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %37) #5
  br label %465

394:                                              ; preds = %361
  %395 = landingpad { ptr, i32 }
          cleanup
  %396 = extractvalue { ptr, i32 } %395, 0
  store ptr %396, ptr %8, align 8
  %397 = extractvalue { ptr, i32 } %395, 1
  store i32 %397, ptr %9, align 4
  br label %470

398:                                              ; preds = %378, %371, %365
  %399 = landingpad { ptr, i32 }
          cleanup
  %400 = extractvalue { ptr, i32 } %399, 0
  store ptr %400, ptr %8, align 8
  %401 = extractvalue { ptr, i32 } %399, 1
  store i32 %401, ptr %9, align 4
  br label %469

402:                                              ; preds = %386
  call void @llvm.lifetime.start.p0(i64 4, ptr %38) #5
  %403 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %49, i32 0, i32 5
  %404 = load i32, ptr %35, align 4, !tbaa !27
  %405 = zext i32 %404 to i64
  %406 = invoke noundef nonnull align 4 dereferenceable(9) ptr @_ZN6basisu6vectorINS_27etc1_endpoint_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %403, i64 noundef %405)
          to label %407 unwind label %430

407:                                              ; preds = %402
  %408 = getelementptr inbounds %"struct.basisu::etc1_endpoint_palette_entry", ptr %406, i32 0, i32 0
  %409 = load i32, ptr %37, align 4, !tbaa !27
  %410 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %408, i32 noundef %409)
          to label %411 unwind label %430

411:                                              ; preds = %407
  %412 = load i8, ptr %410, align 1, !tbaa !42
  %413 = zext i8 %412 to i32
  %414 = load i32, ptr %37, align 4, !tbaa !27
  %415 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %32, i32 noundef %414)
          to label %416 unwind label %430

416:                                              ; preds = %411
  %417 = load i8, ptr %415, align 1, !tbaa !42
  %418 = zext i8 %417 to i32
  %419 = sub nsw i32 %413, %418
  %420 = and i32 %419, 31
  store i32 %420, ptr %38, align 4, !tbaa !27
  %421 = load i32, ptr %37, align 4, !tbaa !27
  %422 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %32, i32 noundef %421)
          to label %423 unwind label %430

423:                                              ; preds = %416
  %424 = load i8, ptr %422, align 1, !tbaa !42
  %425 = zext i8 %424 to i32
  %426 = icmp sle i32 %425, 9
  br i1 %426, label %427, label %434

427:                                              ; preds = %423
  %428 = load i32, ptr %38, align 4, !tbaa !27
  invoke void @_ZN6basisu9histogram3incEj(ptr noundef nonnull align 8 dereferenceable(16) %28, i32 noundef %428)
          to label %429 unwind label %430

429:                                              ; preds = %427
  br label %448

430:                                              ; preds = %457, %453, %448, %444, %441, %434, %427, %416, %411, %407, %402
  %431 = landingpad { ptr, i32 }
          cleanup
  %432 = extractvalue { ptr, i32 } %431, 0
  store ptr %432, ptr %8, align 8
  %433 = extractvalue { ptr, i32 } %431, 1
  store i32 %433, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %38) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %37) #5
  br label %469

434:                                              ; preds = %423
  %435 = load i32, ptr %37, align 4, !tbaa !27
  %436 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %32, i32 noundef %435)
          to label %437 unwind label %430

437:                                              ; preds = %434
  %438 = load i8, ptr %436, align 1, !tbaa !42
  %439 = zext i8 %438 to i32
  %440 = icmp sle i32 %439, 21
  br i1 %440, label %441, label %444

441:                                              ; preds = %437
  %442 = load i32, ptr %38, align 4, !tbaa !27
  invoke void @_ZN6basisu9histogram3incEj(ptr noundef nonnull align 8 dereferenceable(16) %29, i32 noundef %442)
          to label %443 unwind label %430

443:                                              ; preds = %441
  br label %447

444:                                              ; preds = %437
  %445 = load i32, ptr %38, align 4, !tbaa !27
  invoke void @_ZN6basisu9histogram3incEj(ptr noundef nonnull align 8 dereferenceable(16) %30, i32 noundef %445)
          to label %446 unwind label %430

446:                                              ; preds = %444
  br label %447

447:                                              ; preds = %446, %443
  br label %448

448:                                              ; preds = %447, %429
  %449 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %49, i32 0, i32 5
  %450 = load i32, ptr %35, align 4, !tbaa !27
  %451 = zext i32 %450 to i64
  %452 = invoke noundef nonnull align 4 dereferenceable(9) ptr @_ZN6basisu6vectorINS_27etc1_endpoint_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %449, i64 noundef %451)
          to label %453 unwind label %430

453:                                              ; preds = %448
  %454 = getelementptr inbounds %"struct.basisu::etc1_endpoint_palette_entry", ptr %452, i32 0, i32 0
  %455 = load i32, ptr %37, align 4, !tbaa !27
  %456 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %454, i32 noundef %455)
          to label %457 unwind label %430

457:                                              ; preds = %453
  %458 = load i8, ptr %456, align 1, !tbaa !42
  %459 = load i32, ptr %37, align 4, !tbaa !27
  %460 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %32, i32 noundef %459)
          to label %461 unwind label %430

461:                                              ; preds = %457
  store i8 %458, ptr %460, align 1, !tbaa !42
  call void @llvm.lifetime.end.p0(i64 4, ptr %38) #5
  br label %462

462:                                              ; preds = %461
  %463 = load i32, ptr %37, align 4, !tbaa !27
  %464 = add i32 %463, 1
  store i32 %464, ptr %37, align 4, !tbaa !27
  br label %386, !llvm.loop !47

465:                                              ; preds = %393
  call void @llvm.lifetime.end.p0(i64 4, ptr %36) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %35) #5
  br label %466

466:                                              ; preds = %465
  %467 = load i32, ptr %34, align 4, !tbaa !27
  %468 = add i32 %467, 1
  store i32 %468, ptr %34, align 4, !tbaa !27
  br label %330, !llvm.loop !48

469:                                              ; preds = %430, %398
  call void @llvm.lifetime.end.p0(i64 4, ptr %36) #5
  br label %470

470:                                              ; preds = %469, %394
  call void @llvm.lifetime.end.p0(i64 4, ptr %35) #5
  br label %471

471:                                              ; preds = %470, %357
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #5
  br label %741

472:                                              ; preds = %336
  %473 = invoke noundef i64 @_ZNK6basisu9histogram9get_totalEv(ptr noundef nonnull align 8 dereferenceable(16) %28)
          to label %474 unwind label %478

474:                                              ; preds = %472
  %475 = icmp ne i64 %473, 0
  br i1 %475, label %482, label %476

476:                                              ; preds = %474
  invoke void @_ZN6basisu9histogram3incEj(ptr noundef nonnull align 8 dereferenceable(16) %28, i32 noundef 0)
          to label %477 unwind label %478

477:                                              ; preds = %476
  br label %482

478:                                              ; preds = %492, %488, %486, %482, %476, %472
  %479 = landingpad { ptr, i32 }
          cleanup
  %480 = extractvalue { ptr, i32 } %479, 0
  store ptr %480, ptr %8, align 8
  %481 = extractvalue { ptr, i32 } %479, 1
  store i32 %481, ptr %9, align 4
  br label %741

482:                                              ; preds = %477, %474
  %483 = invoke noundef i64 @_ZNK6basisu9histogram9get_totalEv(ptr noundef nonnull align 8 dereferenceable(16) %29)
          to label %484 unwind label %478

484:                                              ; preds = %482
  %485 = icmp ne i64 %483, 0
  br i1 %485, label %488, label %486

486:                                              ; preds = %484
  invoke void @_ZN6basisu9histogram3incEj(ptr noundef nonnull align 8 dereferenceable(16) %29, i32 noundef 0)
          to label %487 unwind label %478

487:                                              ; preds = %486
  br label %488

488:                                              ; preds = %487, %484
  %489 = invoke noundef i64 @_ZNK6basisu9histogram9get_totalEv(ptr noundef nonnull align 8 dereferenceable(16) %30)
          to label %490 unwind label %478

490:                                              ; preds = %488
  %491 = icmp ne i64 %489, 0
  br i1 %491, label %494, label %492

492:                                              ; preds = %490
  invoke void @_ZN6basisu9histogram3incEj(ptr noundef nonnull align 8 dereferenceable(16) %30, i32 noundef 0)
          to label %493 unwind label %478

493:                                              ; preds = %492
  br label %494

494:                                              ; preds = %493, %490
  call void @llvm.lifetime.start.p0(i64 32, ptr %39) #5
  invoke void @_ZN6basisu22huffman_encoding_tableC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %39)
          to label %495 unwind label %503

495:                                              ; preds = %494
  call void @llvm.lifetime.start.p0(i64 32, ptr %40) #5
  invoke void @_ZN6basisu22huffman_encoding_tableC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %40)
          to label %496 unwind label %507

496:                                              ; preds = %495
  call void @llvm.lifetime.start.p0(i64 32, ptr %41) #5
  invoke void @_ZN6basisu22huffman_encoding_tableC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %41)
          to label %497 unwind label %511

497:                                              ; preds = %496
  call void @llvm.lifetime.start.p0(i64 32, ptr %42) #5
  invoke void @_ZN6basisu22huffman_encoding_tableC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %42)
          to label %498 unwind label %515

498:                                              ; preds = %497
  %499 = invoke noundef zeroext i1 @_ZN6basisu22huffman_encoding_table4initERKNS_9histogramEj(ptr noundef nonnull align 8 dereferenceable(32) %39, ptr noundef nonnull align 8 dereferenceable(16) %28, i32 noundef 16)
          to label %500 unwind label %519

500:                                              ; preds = %498
  br i1 %499, label %523, label %501

501:                                              ; preds = %500
  invoke void (ptr, ...) @_ZN6basisu12error_printfEPKcz(ptr noundef @.str.29)
          to label %502 unwind label %519

502:                                              ; preds = %501
  store i1 false, ptr %2, align 1
  store i32 1, ptr %10, align 4
  br label %734

503:                                              ; preds = %494
  %504 = landingpad { ptr, i32 }
          cleanup
  %505 = extractvalue { ptr, i32 } %504, 0
  store ptr %505, ptr %8, align 8
  %506 = extractvalue { ptr, i32 } %504, 1
  store i32 %506, ptr %9, align 4
  br label %740

507:                                              ; preds = %495
  %508 = landingpad { ptr, i32 }
          cleanup
  %509 = extractvalue { ptr, i32 } %508, 0
  store ptr %509, ptr %8, align 8
  %510 = extractvalue { ptr, i32 } %508, 1
  store i32 %510, ptr %9, align 4
  br label %739

511:                                              ; preds = %496
  %512 = landingpad { ptr, i32 }
          cleanup
  %513 = extractvalue { ptr, i32 } %512, 0
  store ptr %513, ptr %8, align 8
  %514 = extractvalue { ptr, i32 } %512, 1
  store i32 %514, ptr %9, align 4
  br label %738

515:                                              ; preds = %497
  %516 = landingpad { ptr, i32 }
          cleanup
  %517 = extractvalue { ptr, i32 } %516, 0
  store ptr %517, ptr %8, align 8
  %518 = extractvalue { ptr, i32 } %516, 1
  store i32 %518, ptr %9, align 4
  br label %737

519:                                              ; preds = %536, %533, %531, %528, %526, %523, %501, %498
  %520 = landingpad { ptr, i32 }
          cleanup
  %521 = extractvalue { ptr, i32 } %520, 0
  store ptr %521, ptr %8, align 8
  %522 = extractvalue { ptr, i32 } %520, 1
  store i32 %522, ptr %9, align 4
  br label %736

523:                                              ; preds = %500
  %524 = invoke noundef zeroext i1 @_ZN6basisu22huffman_encoding_table4initERKNS_9histogramEj(ptr noundef nonnull align 8 dereferenceable(32) %40, ptr noundef nonnull align 8 dereferenceable(16) %29, i32 noundef 16)
          to label %525 unwind label %519

525:                                              ; preds = %523
  br i1 %524, label %528, label %526

526:                                              ; preds = %525
  invoke void (ptr, ...) @_ZN6basisu12error_printfEPKcz(ptr noundef @.str.29)
          to label %527 unwind label %519

527:                                              ; preds = %526
  store i1 false, ptr %2, align 1
  store i32 1, ptr %10, align 4
  br label %734

528:                                              ; preds = %525
  %529 = invoke noundef zeroext i1 @_ZN6basisu22huffman_encoding_table4initERKNS_9histogramEj(ptr noundef nonnull align 8 dereferenceable(32) %41, ptr noundef nonnull align 8 dereferenceable(16) %30, i32 noundef 16)
          to label %530 unwind label %519

530:                                              ; preds = %528
  br i1 %529, label %533, label %531

531:                                              ; preds = %530
  invoke void (ptr, ...) @_ZN6basisu12error_printfEPKcz(ptr noundef @.str.29)
          to label %532 unwind label %519

532:                                              ; preds = %531
  store i1 false, ptr %2, align 1
  store i32 1, ptr %10, align 4
  br label %734

533:                                              ; preds = %530
  %534 = invoke noundef zeroext i1 @_ZN6basisu22huffman_encoding_table4initERKNS_9histogramEj(ptr noundef nonnull align 8 dereferenceable(32) %42, ptr noundef nonnull align 8 dereferenceable(16) %31, i32 noundef 16)
          to label %535 unwind label %519

535:                                              ; preds = %533
  br i1 %534, label %538, label %536

536:                                              ; preds = %535
  invoke void (ptr, ...) @_ZN6basisu12error_printfEPKcz(ptr noundef @.str.30)
          to label %537 unwind label %519

537:                                              ; preds = %536
  store i1 false, ptr %2, align 1
  store i32 1, ptr %10, align 4
  br label %734

538:                                              ; preds = %535
  call void @llvm.lifetime.start.p0(i64 32, ptr %43) #5
  invoke void @_ZN6basisu13bitwise_coderC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %43)
          to label %539 unwind label %563

539:                                              ; preds = %538
  invoke void @_ZN6basisu13bitwise_coder4initEj(ptr noundef nonnull align 8 dereferenceable(32) %43, i32 noundef 8192)
          to label %540 unwind label %567

540:                                              ; preds = %539
  %541 = invoke noundef i32 @_ZN6basisu13bitwise_coder18emit_huffman_tableERKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %43, ptr noundef nonnull align 8 dereferenceable(32) %39)
          to label %542 unwind label %567

542:                                              ; preds = %540
  %543 = invoke noundef i32 @_ZN6basisu13bitwise_coder18emit_huffman_tableERKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %43, ptr noundef nonnull align 8 dereferenceable(32) %40)
          to label %544 unwind label %567

544:                                              ; preds = %542
  %545 = invoke noundef i32 @_ZN6basisu13bitwise_coder18emit_huffman_tableERKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %43, ptr noundef nonnull align 8 dereferenceable(32) %41)
          to label %546 unwind label %567

546:                                              ; preds = %544
  %547 = invoke noundef i32 @_ZN6basisu13bitwise_coder18emit_huffman_tableERKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %43, ptr noundef nonnull align 8 dereferenceable(32) %42)
          to label %548 unwind label %567

548:                                              ; preds = %546
  %549 = load i8, ptr %23, align 1, !tbaa !33, !range !38, !noundef !39
  %550 = trunc i8 %549 to i1
  %551 = zext i1 %550 to i32
  %552 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %43, i32 noundef %551, i32 noundef 1)
          to label %553 unwind label %567

553:                                              ; preds = %548
  %554 = invoke noundef nonnull align 1 dereferenceable(4) ptr @_ZN6basisu10color_rgba3setEiiii(ptr noundef nonnull align 1 dereferenceable(4) %32, i32 noundef 16, i32 noundef 16, i32 noundef 16, i32 noundef 0)
          to label %555 unwind label %567

555:                                              ; preds = %553
  store i32 0, ptr %33, align 4, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 4, ptr %44) #5
  store i32 0, ptr %44, align 4, !tbaa !27
  br label %556

556:                                              ; preds = %684, %555
  %557 = load i32, ptr %44, align 4, !tbaa !27
  %558 = load ptr, ptr %4, align 8, !tbaa !5
  %559 = invoke noundef i32 @_ZNK6basisu15basisu_frontend27get_total_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %558)
          to label %560 unwind label %571

560:                                              ; preds = %556
  %561 = icmp ult i32 %557, %559
  br i1 %561, label %575, label %562

562:                                              ; preds = %560
  store i32 26, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %44) #5
  br label %690

563:                                              ; preds = %538
  %564 = landingpad { ptr, i32 }
          cleanup
  %565 = extractvalue { ptr, i32 } %564, 0
  store ptr %565, ptr %8, align 8
  %566 = extractvalue { ptr, i32 } %564, 1
  store i32 %566, ptr %9, align 4
  br label %733

567:                                              ; preds = %727, %723, %716, %711, %707, %702, %698, %694, %692, %690, %553, %548, %546, %544, %542, %540, %539
  %568 = landingpad { ptr, i32 }
          cleanup
  %569 = extractvalue { ptr, i32 } %568, 0
  store ptr %569, ptr %8, align 8
  %570 = extractvalue { ptr, i32 } %568, 1
  store i32 %570, ptr %9, align 4
  br label %732

571:                                              ; preds = %556
  %572 = landingpad { ptr, i32 }
          cleanup
  %573 = extractvalue { ptr, i32 } %572, 0
  store ptr %573, ptr %8, align 8
  %574 = extractvalue { ptr, i32 } %572, 1
  store i32 %574, ptr %9, align 4
  br label %689

575:                                              ; preds = %560
  call void @llvm.lifetime.start.p0(i64 4, ptr %45) #5
  %576 = load i32, ptr %44, align 4, !tbaa !27
  %577 = zext i32 %576 to i64
  %578 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %17, i64 noundef %577)
          to label %579 unwind label %609

579:                                              ; preds = %575
  %580 = load i32, ptr %578, align 4, !tbaa !27
  store i32 %580, ptr %45, align 4, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 4, ptr %46) #5
  %581 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %49, i32 0, i32 5
  %582 = load i32, ptr %45, align 4, !tbaa !27
  %583 = zext i32 %582 to i64
  %584 = invoke noundef nonnull align 4 dereferenceable(9) ptr @_ZN6basisu6vectorINS_27etc1_endpoint_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %581, i64 noundef %583)
          to label %585 unwind label %613

585:                                              ; preds = %579
  %586 = getelementptr inbounds %"struct.basisu::etc1_endpoint_palette_entry", ptr %584, i32 0, i32 1
  %587 = load i32, ptr %586, align 4, !tbaa !44
  %588 = load i32, ptr %33, align 4, !tbaa !27
  %589 = sub i32 %587, %588
  %590 = and i32 %589, 7
  store i32 %590, ptr %46, align 4, !tbaa !27
  %591 = load i32, ptr %46, align 4, !tbaa !27
  %592 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_codeEjRKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %43, i32 noundef %591, ptr noundef nonnull align 8 dereferenceable(32) %42)
          to label %593 unwind label %613

593:                                              ; preds = %585
  %594 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %49, i32 0, i32 5
  %595 = load i32, ptr %45, align 4, !tbaa !27
  %596 = zext i32 %595 to i64
  %597 = invoke noundef nonnull align 4 dereferenceable(9) ptr @_ZN6basisu6vectorINS_27etc1_endpoint_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %594, i64 noundef %596)
          to label %598 unwind label %613

598:                                              ; preds = %593
  %599 = getelementptr inbounds %"struct.basisu::etc1_endpoint_palette_entry", ptr %597, i32 0, i32 1
  %600 = load i32, ptr %599, align 4, !tbaa !44
  store i32 %600, ptr %33, align 4, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 4, ptr %47) #5
  store i32 0, ptr %47, align 4, !tbaa !27
  br label %601

601:                                              ; preds = %680, %598
  %602 = load i32, ptr %47, align 4, !tbaa !27
  %603 = load i8, ptr %23, align 1, !tbaa !33, !range !38, !noundef !39
  %604 = trunc i8 %603 to i1
  %605 = zext i1 %604 to i64
  %606 = select i1 %604, i32 1, i32 3
  %607 = icmp ult i32 %602, %606
  br i1 %607, label %617, label %608

608:                                              ; preds = %601
  store i32 29, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %47) #5
  br label %683

609:                                              ; preds = %575
  %610 = landingpad { ptr, i32 }
          cleanup
  %611 = extractvalue { ptr, i32 } %610, 0
  store ptr %611, ptr %8, align 8
  %612 = extractvalue { ptr, i32 } %610, 1
  store i32 %612, ptr %9, align 4
  br label %688

613:                                              ; preds = %593, %585, %579
  %614 = landingpad { ptr, i32 }
          cleanup
  %615 = extractvalue { ptr, i32 } %614, 0
  store ptr %615, ptr %8, align 8
  %616 = extractvalue { ptr, i32 } %614, 1
  store i32 %616, ptr %9, align 4
  br label %687

617:                                              ; preds = %601
  call void @llvm.lifetime.start.p0(i64 4, ptr %48) #5
  %618 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %49, i32 0, i32 5
  %619 = load i32, ptr %45, align 4, !tbaa !27
  %620 = zext i32 %619 to i64
  %621 = invoke noundef nonnull align 4 dereferenceable(9) ptr @_ZN6basisu6vectorINS_27etc1_endpoint_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %618, i64 noundef %620)
          to label %622 unwind label %646

622:                                              ; preds = %617
  %623 = getelementptr inbounds %"struct.basisu::etc1_endpoint_palette_entry", ptr %621, i32 0, i32 0
  %624 = load i32, ptr %47, align 4, !tbaa !27
  %625 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %623, i32 noundef %624)
          to label %626 unwind label %646

626:                                              ; preds = %622
  %627 = load i8, ptr %625, align 1, !tbaa !42
  %628 = zext i8 %627 to i32
  %629 = load i32, ptr %47, align 4, !tbaa !27
  %630 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %32, i32 noundef %629)
          to label %631 unwind label %646

631:                                              ; preds = %626
  %632 = load i8, ptr %630, align 1, !tbaa !42
  %633 = zext i8 %632 to i32
  %634 = sub nsw i32 %628, %633
  %635 = and i32 %634, 31
  store i32 %635, ptr %48, align 4, !tbaa !27
  %636 = load i32, ptr %47, align 4, !tbaa !27
  %637 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %32, i32 noundef %636)
          to label %638 unwind label %646

638:                                              ; preds = %631
  %639 = load i8, ptr %637, align 1, !tbaa !42
  %640 = zext i8 %639 to i32
  %641 = icmp sle i32 %640, 9
  br i1 %641, label %642, label %650

642:                                              ; preds = %638
  %643 = load i32, ptr %48, align 4, !tbaa !27
  %644 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_codeEjRKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %43, i32 noundef %643, ptr noundef nonnull align 8 dereferenceable(32) %39)
          to label %645 unwind label %646

645:                                              ; preds = %642
  br label %666

646:                                              ; preds = %675, %671, %666, %661, %657, %650, %642, %631, %626, %622, %617
  %647 = landingpad { ptr, i32 }
          cleanup
  %648 = extractvalue { ptr, i32 } %647, 0
  store ptr %648, ptr %8, align 8
  %649 = extractvalue { ptr, i32 } %647, 1
  store i32 %649, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %48) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %47) #5
  br label %687

650:                                              ; preds = %638
  %651 = load i32, ptr %47, align 4, !tbaa !27
  %652 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %32, i32 noundef %651)
          to label %653 unwind label %646

653:                                              ; preds = %650
  %654 = load i8, ptr %652, align 1, !tbaa !42
  %655 = zext i8 %654 to i32
  %656 = icmp sle i32 %655, 21
  br i1 %656, label %657, label %661

657:                                              ; preds = %653
  %658 = load i32, ptr %48, align 4, !tbaa !27
  %659 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_codeEjRKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %43, i32 noundef %658, ptr noundef nonnull align 8 dereferenceable(32) %40)
          to label %660 unwind label %646

660:                                              ; preds = %657
  br label %665

661:                                              ; preds = %653
  %662 = load i32, ptr %48, align 4, !tbaa !27
  %663 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_codeEjRKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %43, i32 noundef %662, ptr noundef nonnull align 8 dereferenceable(32) %41)
          to label %664 unwind label %646

664:                                              ; preds = %661
  br label %665

665:                                              ; preds = %664, %660
  br label %666

666:                                              ; preds = %665, %645
  %667 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %49, i32 0, i32 5
  %668 = load i32, ptr %45, align 4, !tbaa !27
  %669 = zext i32 %668 to i64
  %670 = invoke noundef nonnull align 4 dereferenceable(9) ptr @_ZN6basisu6vectorINS_27etc1_endpoint_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %667, i64 noundef %669)
          to label %671 unwind label %646

671:                                              ; preds = %666
  %672 = getelementptr inbounds %"struct.basisu::etc1_endpoint_palette_entry", ptr %670, i32 0, i32 0
  %673 = load i32, ptr %47, align 4, !tbaa !27
  %674 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %672, i32 noundef %673)
          to label %675 unwind label %646

675:                                              ; preds = %671
  %676 = load i8, ptr %674, align 1, !tbaa !42
  %677 = load i32, ptr %47, align 4, !tbaa !27
  %678 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %32, i32 noundef %677)
          to label %679 unwind label %646

679:                                              ; preds = %675
  store i8 %676, ptr %678, align 1, !tbaa !42
  call void @llvm.lifetime.end.p0(i64 4, ptr %48) #5
  br label %680

680:                                              ; preds = %679
  %681 = load i32, ptr %47, align 4, !tbaa !27
  %682 = add i32 %681, 1
  store i32 %682, ptr %47, align 4, !tbaa !27
  br label %601, !llvm.loop !49

683:                                              ; preds = %608
  call void @llvm.lifetime.end.p0(i64 4, ptr %46) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %45) #5
  br label %684

684:                                              ; preds = %683
  %685 = load i32, ptr %44, align 4, !tbaa !27
  %686 = add i32 %685, 1
  store i32 %686, ptr %44, align 4, !tbaa !27
  br label %556, !llvm.loop !50

687:                                              ; preds = %646, %613
  call void @llvm.lifetime.end.p0(i64 4, ptr %46) #5
  br label %688

688:                                              ; preds = %687, %609
  call void @llvm.lifetime.end.p0(i64 4, ptr %45) #5
  br label %689

689:                                              ; preds = %688, %571
  call void @llvm.lifetime.end.p0(i64 4, ptr %44) #5
  br label %732

690:                                              ; preds = %562
  %691 = invoke noundef i32 @_ZN6basisu13bitwise_coder5flushEv(ptr noundef nonnull align 8 dereferenceable(32) %43)
          to label %692 unwind label %567

692:                                              ; preds = %690
  %693 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6basisu13bitwise_coder9get_bytesEv(ptr noundef nonnull align 8 dereferenceable(32) %43)
          to label %694 unwind label %567

694:                                              ; preds = %692
  %695 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %49, i32 0, i32 3
  %696 = getelementptr inbounds %"struct.basisu::basisu_backend_output", ptr %695, i32 0, i32 6
  %697 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN6basisu6vectorIhEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %696, ptr noundef nonnull align 8 dereferenceable(16) %693)
          to label %698 unwind label %567

698:                                              ; preds = %694
  %699 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %49, i32 0, i32 3
  %700 = getelementptr inbounds %"struct.basisu::basisu_backend_output", ptr %699, i32 0, i32 6
  %701 = invoke noundef i32 @_ZNK6basisu6vectorIhE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %700)
          to label %702 unwind label %567

702:                                              ; preds = %698
  %703 = mul nsw i32 8, %701
  %704 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %49, i32 0, i32 3
  %705 = getelementptr inbounds %"struct.basisu::basisu_backend_output", ptr %704, i32 0, i32 6
  %706 = invoke noundef i32 @_ZNK6basisu6vectorIhE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %705)
          to label %707 unwind label %567

707:                                              ; preds = %702
  %708 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %49, i32 0, i32 3
  %709 = getelementptr inbounds %"struct.basisu::basisu_backend_output", ptr %708, i32 0, i32 6
  %710 = invoke noundef i32 @_ZNK6basisu6vectorIhE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %709)
          to label %711 unwind label %567

711:                                              ; preds = %707
  %712 = uitofp i32 %710 to float
  %713 = fmul float %712, 8.000000e+00
  %714 = load ptr, ptr %4, align 8, !tbaa !5
  %715 = invoke noundef i32 @_ZNK6basisu15basisu_frontend27get_total_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %714)
          to label %716 unwind label %567

716:                                              ; preds = %711
  %717 = uitofp i32 %715 to float
  %718 = fdiv float %713, %717
  %719 = fpext float %718 to double
  %720 = getelementptr inbounds %"class.basisu::basisu_backend", ptr %49, i32 0, i32 3
  %721 = getelementptr inbounds %"struct.basisu::basisu_backend_output", ptr %720, i32 0, i32 6
  %722 = invoke noundef i32 @_ZNK6basisu6vectorIhE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %721)
          to label %723 unwind label %567

723:                                              ; preds = %716
  %724 = uitofp i32 %722 to float
  %725 = fmul float %724, 8.000000e+00
  %726 = invoke noundef i32 @_ZNK6basisu14basisu_backend22get_total_input_texelsEv(ptr noundef nonnull align 8 dereferenceable(336) %49)
          to label %727 unwind label %567

727:                                              ; preds = %723
  %728 = uitofp i32 %726 to float
  %729 = fdiv float %725, %728
  %730 = fpext float %729 to double
  invoke void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef @.str.31, i32 noundef %703, i32 noundef %706, double noundef %719, double noundef %730)
          to label %731 unwind label %567

731:                                              ; preds = %727
  store i1 true, ptr %2, align 1
  store i32 1, ptr %10, align 4
  call void @_ZN6basisu13bitwise_coderD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %43) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %43) #5
  br label %734

732:                                              ; preds = %689, %567
  call void @_ZN6basisu13bitwise_coderD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %43) #5
  br label %733

733:                                              ; preds = %732, %563
  call void @llvm.lifetime.end.p0(i64 32, ptr %43) #5
  br label %736

734:                                              ; preds = %731, %537, %532, %527, %502
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %42) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %42) #5
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %41) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %41) #5
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %40) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %40) #5
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %39) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %39) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #5
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %31) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %31) #5
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %30) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %30) #5
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %29) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %29) #5
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %28) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %28) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  call void @_ZN6basisu6vectorIbED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %18) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #5
  call void @_ZN6basisu6vectorIjED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %17) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @_ZN6basisu6vectorIbED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  %735 = load i1, ptr %2, align 1
  ret i1 %735

736:                                              ; preds = %733, %519
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %42) #5
  br label %737

737:                                              ; preds = %736, %515
  call void @llvm.lifetime.end.p0(i64 32, ptr %42) #5
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %41) #5
  br label %738

738:                                              ; preds = %737, %511
  call void @llvm.lifetime.end.p0(i64 32, ptr %41) #5
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %40) #5
  br label %739

739:                                              ; preds = %738, %507
  call void @llvm.lifetime.end.p0(i64 32, ptr %40) #5
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %39) #5
  br label %740

740:                                              ; preds = %739, %503
  call void @llvm.lifetime.end.p0(i64 32, ptr %39) #5
  br label %741

741:                                              ; preds = %740, %478, %471
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #5
  br label %742

742:                                              ; preds = %741, %353
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #5
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %31) #5
  br label %743

743:                                              ; preds = %742, %349
  call void @llvm.lifetime.end.p0(i64 16, ptr %31) #5
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %30) #5
  br label %744

744:                                              ; preds = %743, %345
  call void @llvm.lifetime.end.p0(i64 16, ptr %30) #5
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %29) #5
  br label %745

745:                                              ; preds = %744, %341
  call void @llvm.lifetime.end.p0(i64 16, ptr %29) #5
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %28) #5
  br label %746

746:                                              ; preds = %745, %337
  call void @llvm.lifetime.end.p0(i64 16, ptr %28) #5
  br label %747

747:                                              ; preds = %746, %323
  call void @llvm.lifetime.end.p0(i64 1, ptr %23) #5
  br label %748

748:                                              ; preds = %747, %254, %224
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  br label %749

749:                                              ; preds = %748, %216
  call void @_ZN6basisu6vectorIbED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %18) #5
  br label %750

750:                                              ; preds = %749, %177
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #5
  br label %751

751:                                              ; preds = %750, %173
  call void @_ZN6basisu6vectorIjED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %17) #5
  br label %752

752:                                              ; preds = %751, %169
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #5
  br label %753

753:                                              ; preds = %752, %165, %143
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @_ZN6basisu6vectorIbED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  br label %754

754:                                              ; preds = %753
  %755 = load ptr, ptr %8, align 8
  %756 = load i32, ptr %9, align 4
  %757 = insertvalue { ptr, i32 } poison, ptr %755, 0
  %758 = insertvalue { ptr, i32 } %757, i32 %756, 1
  resume { ptr, i32 } %758
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6basisu6vectorIbEC2Em(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) unnamed_addr #0 align 2

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

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

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

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

attributes #0 = { 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 #1 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = !{!14, !14, i64 0}
!28 = !{!29, !14, i64 20}
!29 = !{!"_ZTSN6basisu25basisu_backend_slice_descE", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12, !14, i64 16, !14, i64 20, !14, i64 24, !14, i64 28, !14, i64 32, !14, i64 36, !14, i64 40, !12, i64 44, !12, i64 45}
!30 = !{!29, !14, i64 24}
!31 = !{!32, !14, i64 4}
!32 = !{!"_ZTSN6basisu13encoder_blockE", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12, !12, i64 16}
!33 = !{!12, !12, i64 0}
!34 = distinct !{!34, !35}
!35 = !{!"llvm.loop.mustprogress"}
!36 = distinct !{!36, !35}
!37 = distinct !{!37, !35}
!38 = !{i8 0, i8 2}
!39 = !{}
!40 = distinct !{!40, !35}
!41 = distinct !{!41, !35}
!42 = !{!7, !7, i64 0}
!43 = distinct !{!43, !35}
!44 = !{!45, !14, i64 4}
!45 = !{!"_ZTSN6basisu27etc1_endpoint_palette_entryE", !46, i64 0, !14, i64 4, !12, i64 8}
!46 = !{!"_ZTSN6basisu10color_rgbaE", !7, i64 0}
!47 = distinct !{!47, !35}
!48 = distinct !{!48, !35}
!49 = distinct !{!49, !35}
!50 = distinct !{!50, !35}


; 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::vector.16" = type { ptr, i32, i32 }
%"class.basisu::vector.14" = type { ptr, i32, i32 }
%"class.basisu::histogram" = type { %"class.basisu::vector.14" }
%"class.basisu::color_rgba" = type { %union.anon }
%union.anon = type { [4 x i8] }
%"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 }

@.str.27 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [81 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [88 x i8], align 1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6basisu10color_rgbaC2Eiiii(ptr noundef nonnull align 1 dereferenceable(4), i32 noundef, i32 noundef, i32 noundef, i32 noundef) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(9) ptr @_ZN6basisu6vectorINS_27etc1_endpoint_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) local_unnamed_addr #1 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 #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6basisu6vectorIjEC2Em(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) unnamed_addr #0 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(17) ptr @_ZN6basisu8vector2DINS_13encoder_blockEEclEjj(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) local_unnamed_addr #0 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN6basisu7minimumIjEET_S1_S1_(i32 noundef, i32 noundef) local_unnamed_addr #1

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu22huffman_encoding_tableC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 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 #3 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu13bitwise_coderC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 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 #0 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 #2

; 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 #0 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 #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN6basisu13bitwise_coder5flushEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0 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 #1 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 #0 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 #0 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN6basisu14basisu_backend23encode_endpoint_paletteEv(ptr noundef nonnull align 8 dereferenceable(336) %0) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.basisu::vector.16", align 8
  %3 = alloca i32, align 4
  %4 = alloca %"class.basisu::vector.14", align 8
  %5 = alloca %"class.basisu::vector.16", align 8
  %6 = alloca %"class.basisu::histogram", align 8
  %7 = alloca %"class.basisu::histogram", align 8
  %8 = alloca %"class.basisu::histogram", align 8
  %9 = alloca %"class.basisu::histogram", align 8
  %10 = alloca %"class.basisu::color_rgba", align 1
  %11 = alloca %"class.basisu::huffman_encoding_table", align 8
  %12 = alloca %"class.basisu::huffman_encoding_table", align 8
  %13 = alloca %"class.basisu::huffman_encoding_table", align 8
  %14 = alloca %"class.basisu::huffman_encoding_table", align 8
  %15 = alloca %"class.basisu::bitwise_coder", align 8
  %16 = load ptr, ptr %0, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #5
  %17 = tail call noundef i32 @_ZNK6basisu15basisu_frontend27get_total_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %16)
  %18 = zext i32 %17 to i64
  call void @_ZN6basisu6vectorIbEC2Em(ptr noundef nonnull align 8 dereferenceable(16) %2, i64 noundef %18)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  store i32 -1, ptr %3, align 4, !tbaa !26
  %19 = getelementptr inbounds i8, ptr %0, i64 40
  %20 = call noundef i32 @_ZNK6basisu6vectorINS_25basisu_backend_slice_descEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %19)
  %.not182 = icmp eq i32 %20, 0
  br i1 %.not182, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %1
  %21 = getelementptr inbounds i8, ptr %0, i64 224
  br label %23

._crit_edge.loopexit:                             ; preds = %._crit_edge164
  %.pre = load i32, ptr %3, align 4, !tbaa !26
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %1
  %22 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ -1, %1 ]
  invoke void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef nonnull @.str.27, i32 noundef %22)
          to label %46 unwind label %57

23:                                               ; preds = %.lr.ph, %._crit_edge164
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %._crit_edge164 ]
  %24 = call noundef nonnull align 4 dereferenceable(46) ptr @_ZN6basisu6vectorINS_25basisu_backend_slice_descEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %19, i64 noundef %indvars.iv)
  %25 = getelementptr inbounds i8, ptr %24, i64 20
  %26 = load i32, ptr %25, align 4, !tbaa !27
  %27 = call noundef nonnull align 4 dereferenceable(46) ptr @_ZN6basisu6vectorINS_25basisu_backend_slice_descEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %19, i64 noundef %indvars.iv)
  %28 = getelementptr inbounds i8, ptr %27, i64 24
  %29 = load i32, ptr %28, align 4, !tbaa !29
  %.not183 = icmp eq i32 %29, 0
  %.not184 = icmp eq i32 %26, 0
  %or.cond212 = select i1 %.not183, i1 true, i1 %.not184
  br i1 %or.cond212, label %._crit_edge164, label %.preheader161.us

.preheader161.us:                                 ; preds = %23, %._crit_edge.us
  %.0117163.us = phi i32 [ %41, %._crit_edge.us ], [ 0, %23 ]
  br label %30

30:                                               ; preds = %.preheader161.us, %33
  %.0121162.us = phi i32 [ 0, %.preheader161.us ], [ %40, %33 ]
  %31 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN6basisu6vectorINS_8vector2DINS_13encoder_blockEEEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %21, i64 noundef %indvars.iv)
  %32 = invoke noundef nonnull align 4 dereferenceable(17) ptr @_ZN6basisu8vector2DINS_13encoder_blockEEclEjj(ptr noundef nonnull align 8 dereferenceable(24) %31, i32 noundef %.0121162.us, i32 noundef %.0117163.us)
          to label %33 unwind label %.split.us

33:                                               ; preds = %30
  %34 = getelementptr inbounds i8, ptr %32, i64 4
  %35 = load i32, ptr %34, align 4, !tbaa !30
  %36 = zext i32 %35 to i64
  %37 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu6vectorIbEixEm(ptr noundef nonnull align 8 dereferenceable(16) %2, i64 noundef %36)
  store i8 1, ptr %37, align 1, !tbaa !32
  %38 = load i32, ptr %3, align 4, !tbaa !26
  %39 = call noundef i32 @_ZN6basisu7minimumIjEET_S1_S1_(i32 noundef %38, i32 noundef %35)
  store i32 %39, ptr %3, align 4, !tbaa !26
  %40 = add nuw i32 %.0121162.us, 1
  %exitcond.not = icmp eq i32 %40, %26
  br i1 %exitcond.not, label %._crit_edge.us, label %30, !llvm.loop !33

._crit_edge.us:                                   ; preds = %33
  %41 = add nuw i32 %.0117163.us, 1
  %exitcond195.not = icmp eq i32 %41, %29
  br i1 %exitcond195.not, label %._crit_edge164, label %.preheader161.us, !llvm.loop !35

.split.us:                                        ; preds = %30
  %42 = landingpad { ptr, i32 }
          cleanup
  br label %321

._crit_edge164:                                   ; preds = %._crit_edge.us, %23
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %43 = call noundef i32 @_ZNK6basisu6vectorINS_25basisu_backend_slice_descEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %19)
  %44 = zext i32 %43 to i64
  %45 = icmp ult i64 %indvars.iv.next, %44
  br i1 %45, label %23, label %._crit_edge.loopexit, !llvm.loop !36

46:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #5
  %47 = invoke noundef i32 @_ZNK6basisu15basisu_frontend27get_total_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %16)
          to label %48 unwind label %59

48:                                               ; preds = %46
  %49 = zext i32 %47 to i64
  invoke void @_ZN6basisu6vectorIjEC2Em(ptr noundef nonnull align 8 dereferenceable(16) %4, i64 noundef %49)
          to label %50 unwind label %59

50:                                               ; preds = %48
  call void @_ZN6basisu6vectorIjE7set_allERKj(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #5
  %51 = invoke noundef i32 @_ZNK6basisu15basisu_frontend27get_total_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %16)
          to label %52 unwind label %61

52:                                               ; preds = %50
  %53 = zext i32 %51 to i64
  invoke void @_ZN6basisu6vectorIbEC2Em(ptr noundef nonnull align 8 dereferenceable(16) %5, i64 noundef %53)
          to label %.preheader160 unwind label %61

.preheader160:                                    ; preds = %52
  %54 = getelementptr inbounds i8, ptr %0, i64 240
  %55 = call noundef i32 @_ZNK6basisu6vectorIjE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %54)
  %.not185 = icmp eq i32 %55, 0
  br i1 %.not185, label %.preheader159, label %.lr.ph167

.preheader159:                                    ; preds = %73, %.preheader160
  %56 = call noundef i32 @_ZNK6basisu6vectorIbE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %5)
  %.not186 = icmp eq i32 %56, 0
  br i1 %.not186, label %._crit_edge171, label %.lr.ph170

57:                                               ; preds = %._crit_edge
  %58 = landingpad { ptr, i32 }
          cleanup
  br label %321

59:                                               ; preds = %48, %46
  %60 = landingpad { ptr, i32 }
          cleanup
  br label %320

61:                                               ; preds = %52, %50
  %62 = landingpad { ptr, i32 }
          cleanup
  br label %319

.lr.ph167:                                        ; preds = %.preheader160, %73
  %indvars.iv197 = phi i64 [ %indvars.iv.next198, %73 ], [ 0, %.preheader160 ]
  %63 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu6vectorIbEixEm(ptr noundef nonnull align 8 dereferenceable(16) %2, i64 noundef %indvars.iv197)
  %64 = load i8, ptr %63, align 1, !tbaa !32, !range !37, !noundef !38
  %65 = trunc nuw i8 %64 to i1
  br i1 %65, label %66, label %73

66:                                               ; preds = %.lr.ph167
  %67 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %54, i64 noundef %indvars.iv197)
  %68 = load i32, ptr %67, align 4, !tbaa !26
  %69 = zext i32 %68 to i64
  %70 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu6vectorIbEixEm(ptr noundef nonnull align 8 dereferenceable(16) %5, i64 noundef %69)
  store i8 1, ptr %70, align 1, !tbaa !32
  %71 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %4, i64 noundef %69)
  %72 = trunc nuw i64 %indvars.iv197 to i32
  store i32 %72, ptr %71, align 4, !tbaa !26
  br label %73

73:                                               ; preds = %.lr.ph167, %66
  %indvars.iv.next198 = add nuw nsw i64 %indvars.iv197, 1
  %74 = call noundef i32 @_ZNK6basisu6vectorIjE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %54)
  %75 = zext i32 %74 to i64
  %76 = icmp ult i64 %indvars.iv.next198, %75
  br i1 %76, label %.lr.ph167, label %.preheader159, !llvm.loop !39

._crit_edge171:                                   ; preds = %.lr.ph170, %.preheader159
  %.0123.lcssa = phi i32 [ 0, %.preheader159 ], [ %spec.select, %.lr.ph170 ]
  %77 = call noundef i32 @_ZNK6basisu6vectorIbE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %5)
  invoke void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef nonnull @.str.28, i32 noundef %.0123.lcssa, i32 noundef %77)
          to label %.preheader158 unwind label %90

.preheader158:                                    ; preds = %._crit_edge171
  %78 = getelementptr inbounds i8, ptr %0, i64 176
  %79 = call noundef i32 @_ZNK6basisu6vectorINS_27etc1_endpoint_palette_entryEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %78)
  %.not187 = icmp eq i32 %79, 0
  br i1 %.not187, label %._crit_edge174, label %.lr.ph173

.lr.ph170:                                        ; preds = %.preheader159, %.lr.ph170
  %indvars.iv200 = phi i64 [ %indvars.iv.next201, %.lr.ph170 ], [ 0, %.preheader159 ]
  %.0123169 = phi i32 [ %spec.select, %.lr.ph170 ], [ 0, %.preheader159 ]
  %80 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu6vectorIbEixEm(ptr noundef nonnull align 8 dereferenceable(16) %5, i64 noundef %indvars.iv200)
  %81 = load i8, ptr %80, align 1, !tbaa !32, !range !37, !noundef !38
  %82 = xor i8 %81, 1
  %not. = zext nneg i8 %82 to i32
  %spec.select = add i32 %.0123169, %not.
  %indvars.iv.next201 = add nuw nsw i64 %indvars.iv200, 1
  %83 = call noundef i32 @_ZNK6basisu6vectorIbE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %5)
  %84 = zext i32 %83 to i64
  %85 = icmp ult i64 %indvars.iv.next201, %84
  br i1 %85, label %.lr.ph170, label %._crit_edge171, !llvm.loop !40

86:                                               ; preds = %.lr.ph173
  %indvars.iv.next204 = add nuw nsw i64 %indvars.iv203, 1
  %87 = call noundef i32 @_ZNK6basisu6vectorINS_27etc1_endpoint_palette_entryEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %78)
  %88 = zext i32 %87 to i64
  %89 = icmp ult i64 %indvars.iv.next204, %88
  br i1 %89, label %.lr.ph173, label %._crit_edge174, !llvm.loop !41

90:                                               ; preds = %._crit_edge171
  %91 = landingpad { ptr, i32 }
          cleanup
  br label %318

.lr.ph173:                                        ; preds = %.preheader158, %86
  %indvars.iv203 = phi i64 [ %indvars.iv.next204, %86 ], [ 0, %.preheader158 ]
  %92 = call noundef nonnull align 4 dereferenceable(9) ptr @_ZN6basisu6vectorINS_27etc1_endpoint_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %78, i64 noundef %indvars.iv203)
  %93 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %92, i32 noundef 0)
  %94 = load i8, ptr %93, align 1, !tbaa !42
  %95 = call noundef nonnull align 4 dereferenceable(9) ptr @_ZN6basisu6vectorINS_27etc1_endpoint_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %78, i64 noundef %indvars.iv203)
  %96 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %95, i32 noundef 1)
  %97 = load i8, ptr %96, align 1, !tbaa !42
  %98 = call noundef nonnull align 4 dereferenceable(9) ptr @_ZN6basisu6vectorINS_27etc1_endpoint_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %78, i64 noundef %indvars.iv203)
  %99 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %98, i32 noundef 2)
  %.not = icmp eq i8 %94, %97
  %100 = load i8, ptr %99, align 1
  %.not131 = icmp eq i8 %94, %100
  %or.cond = select i1 %.not, i1 %.not131, i1 false
  br i1 %or.cond, label %86, label %._crit_edge174

._crit_edge174:                                   ; preds = %.lr.ph173, %86, %.preheader158
  %.2128 = phi i8 [ 1, %.preheader158 ], [ 1, %86 ], [ 0, %.lr.ph173 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #5
  invoke void @_ZN6basisu9histogramC2Ej(ptr noundef nonnull align 8 dereferenceable(16) %6, i32 noundef 32)
          to label %101 unwind label %113

101:                                              ; preds = %._crit_edge174
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #5
  invoke void @_ZN6basisu9histogramC2Ej(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef 32)
          to label %102 unwind label %115

102:                                              ; preds = %101
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #5
  invoke void @_ZN6basisu9histogramC2Ej(ptr noundef nonnull align 8 dereferenceable(16) %8, i32 noundef 32)
          to label %103 unwind label %117

103:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #5
  invoke void @_ZN6basisu9histogramC2Ej(ptr noundef nonnull align 8 dereferenceable(16) %9, i32 noundef 8)
          to label %104 unwind label %119

104:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #5
  invoke void @_ZN6basisu10color_rgbaC2Eiiii(ptr noundef nonnull align 1 dereferenceable(4) %10, i32 noundef 16, i32 noundef 16, i32 noundef 16, i32 noundef 0)
          to label %.preheader unwind label %121

.preheader:                                       ; preds = %104
  %105 = trunc nuw i8 %.2128 to i1
  br label %106

106:                                              ; preds = %.preheader, %138
  %indvars.iv206 = phi i64 [ 0, %.preheader ], [ %indvars.iv.next207, %138 ]
  %.0119 = phi i32 [ 0, %.preheader ], [ %137, %138 ]
  %107 = invoke noundef i32 @_ZNK6basisu15basisu_frontend27get_total_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %16)
          to label %108 unwind label %123

108:                                              ; preds = %106
  %109 = zext i32 %107 to i64
  %110 = icmp ult i64 %indvars.iv206, %109
  br i1 %110, label %125, label %111

111:                                              ; preds = %108
  %112 = invoke noundef i64 @_ZNK6basisu9histogram9get_totalEv(ptr noundef nonnull align 8 dereferenceable(16) %6)
          to label %168 unwind label %170

113:                                              ; preds = %._crit_edge174
  %114 = landingpad { ptr, i32 }
          cleanup
  br label %317

115:                                              ; preds = %101
  %116 = landingpad { ptr, i32 }
          cleanup
  br label %316

117:                                              ; preds = %102
  %118 = landingpad { ptr, i32 }
          cleanup
  br label %315

119:                                              ; preds = %103
  %120 = landingpad { ptr, i32 }
          cleanup
  br label %314

121:                                              ; preds = %104
  %122 = landingpad { ptr, i32 }
          cleanup
  br label %313

123:                                              ; preds = %106
  %124 = landingpad { ptr, i32 }
          cleanup
  br label %313

125:                                              ; preds = %108
  %126 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %4, i64 noundef %indvars.iv206)
  %127 = load i32, ptr %126, align 4, !tbaa !26
  %128 = zext i32 %127 to i64
  %129 = call noundef nonnull align 4 dereferenceable(9) ptr @_ZN6basisu6vectorINS_27etc1_endpoint_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %78, i64 noundef %128)
  %130 = getelementptr inbounds i8, ptr %129, i64 4
  %131 = load i32, ptr %130, align 4, !tbaa !43
  %132 = sub i32 %131, %.0119
  %133 = and i32 %132, 7
  invoke void @_ZN6basisu9histogram3incEj(ptr noundef nonnull align 8 dereferenceable(16) %9, i32 noundef %133)
          to label %134 unwind label %139

134:                                              ; preds = %125
  %135 = call noundef nonnull align 4 dereferenceable(9) ptr @_ZN6basisu6vectorINS_27etc1_endpoint_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %78, i64 noundef %128)
  %136 = getelementptr inbounds i8, ptr %135, i64 4
  %137 = load i32, ptr %136, align 4, !tbaa !43
  br label %141

138:                                              ; preds = %161
  %indvars.iv.next207 = add nuw nsw i64 %indvars.iv206, 1
  br label %106, !llvm.loop !46

139:                                              ; preds = %125
  %140 = landingpad { ptr, i32 }
          cleanup
  br label %313

141:                                              ; preds = %134, %161
  %.0115180 = phi i32 [ 0, %134 ], [ %166, %161 ]
  %142 = call noundef nonnull align 4 dereferenceable(9) ptr @_ZN6basisu6vectorINS_27etc1_endpoint_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %78, i64 noundef %128)
  %143 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %142, i32 noundef %.0115180)
  %144 = load i8, ptr %143, align 1, !tbaa !42
  %145 = zext i8 %144 to i32
  %146 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %10, i32 noundef %.0115180)
  %147 = load i8, ptr %146, align 1, !tbaa !42
  %148 = zext i8 %147 to i32
  %149 = sub nsw i32 %145, %148
  %150 = and i32 %149, 31
  %151 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %10, i32 noundef %.0115180)
  %152 = load i8, ptr %151, align 1, !tbaa !42
  %153 = icmp ult i8 %152, 10
  br i1 %153, label %.invoke, label %156

154:                                              ; preds = %.invoke
  %155 = landingpad { ptr, i32 }
          cleanup
  br label %313

156:                                              ; preds = %141
  %157 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %10, i32 noundef %.0115180)
  %158 = load i8, ptr %157, align 1, !tbaa !42
  %159 = icmp ult i8 %158, 22
  %. = select i1 %159, ptr %7, ptr %8
  br label %.invoke

.invoke:                                          ; preds = %141, %156
  %160 = phi ptr [ %., %156 ], [ %6, %141 ]
  invoke void @_ZN6basisu9histogram3incEj(ptr noundef nonnull align 8 dereferenceable(16) %160, i32 noundef %150)
          to label %161 unwind label %154

161:                                              ; preds = %.invoke
  %162 = call noundef nonnull align 4 dereferenceable(9) ptr @_ZN6basisu6vectorINS_27etc1_endpoint_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %78, i64 noundef %128)
  %163 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %162, i32 noundef %.0115180)
  %164 = load i8, ptr %163, align 1, !tbaa !42
  %165 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %10, i32 noundef %.0115180)
  store i8 %164, ptr %165, align 1, !tbaa !42
  %166 = add nuw nsw i32 %.0115180, 1
  %167 = icmp ugt i32 %.0115180, 1
  %.not193 = select i1 %105, i1 true, i1 %167
  br i1 %.not193, label %138, label %141, !llvm.loop !47

168:                                              ; preds = %111
  %.not132 = icmp eq i64 %112, 0
  br i1 %.not132, label %169, label %172

169:                                              ; preds = %168
  invoke void @_ZN6basisu9histogram3incEj(ptr noundef nonnull align 8 dereferenceable(16) %6, i32 noundef 0)
          to label %172 unwind label %170

170:                                              ; preds = %179, %176, %175, %172, %169, %111
  %171 = landingpad { ptr, i32 }
          cleanup
  br label %313

172:                                              ; preds = %169, %168
  %173 = invoke noundef i64 @_ZNK6basisu9histogram9get_totalEv(ptr noundef nonnull align 8 dereferenceable(16) %7)
          to label %174 unwind label %170

174:                                              ; preds = %172
  %.not133 = icmp eq i64 %173, 0
  br i1 %.not133, label %175, label %176

175:                                              ; preds = %174
  invoke void @_ZN6basisu9histogram3incEj(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef 0)
          to label %176 unwind label %170

176:                                              ; preds = %175, %174
  %177 = invoke noundef i64 @_ZNK6basisu9histogram9get_totalEv(ptr noundef nonnull align 8 dereferenceable(16) %8)
          to label %178 unwind label %170

178:                                              ; preds = %176
  %.not134 = icmp eq i64 %177, 0
  br i1 %.not134, label %179, label %180

179:                                              ; preds = %178
  invoke void @_ZN6basisu9histogram3incEj(ptr noundef nonnull align 8 dereferenceable(16) %8, i32 noundef 0)
          to label %180 unwind label %170

180:                                              ; preds = %179, %178
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %11) #5
  invoke void @_ZN6basisu22huffman_encoding_tableC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11)
          to label %181 unwind label %187

181:                                              ; preds = %180
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %12) #5
  invoke void @_ZN6basisu22huffman_encoding_tableC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12)
          to label %182 unwind label %189

182:                                              ; preds = %181
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %13) #5
  invoke void @_ZN6basisu22huffman_encoding_tableC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13)
          to label %183 unwind label %191

183:                                              ; preds = %182
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %14) #5
  invoke void @_ZN6basisu22huffman_encoding_tableC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14)
          to label %184 unwind label %193

184:                                              ; preds = %183
  %185 = invoke noundef zeroext i1 @_ZN6basisu22huffman_encoding_table4initERKNS_9histogramEj(ptr noundef nonnull align 8 dereferenceable(32) %11, ptr noundef nonnull align 8 dereferenceable(16) %6, i32 noundef 16)
          to label %186 unwind label %195

186:                                              ; preds = %184
  br i1 %185, label %197, label %.invoke213

187:                                              ; preds = %180
  %188 = landingpad { ptr, i32 }
          cleanup
  br label %312

189:                                              ; preds = %181
  %190 = landingpad { ptr, i32 }
          cleanup
  br label %311

191:                                              ; preds = %182
  %192 = landingpad { ptr, i32 }
          cleanup
  br label %310

193:                                              ; preds = %183
  %194 = landingpad { ptr, i32 }
          cleanup
  br label %309

195:                                              ; preds = %.invoke213, %203, %200, %197, %184
  %196 = landingpad { ptr, i32 }
          cleanup
  br label %308

197:                                              ; preds = %186
  %198 = invoke noundef zeroext i1 @_ZN6basisu22huffman_encoding_table4initERKNS_9histogramEj(ptr noundef nonnull align 8 dereferenceable(32) %12, ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef 16)
          to label %199 unwind label %195

199:                                              ; preds = %197
  br i1 %198, label %200, label %.invoke213

200:                                              ; preds = %199
  %201 = invoke noundef zeroext i1 @_ZN6basisu22huffman_encoding_table4initERKNS_9histogramEj(ptr noundef nonnull align 8 dereferenceable(32) %13, ptr noundef nonnull align 8 dereferenceable(16) %8, i32 noundef 16)
          to label %202 unwind label %195

202:                                              ; preds = %200
  br i1 %201, label %203, label %.invoke213

203:                                              ; preds = %202
  %204 = invoke noundef zeroext i1 @_ZN6basisu22huffman_encoding_table4initERKNS_9histogramEj(ptr noundef nonnull align 8 dereferenceable(32) %14, ptr noundef nonnull align 8 dereferenceable(16) %9, i32 noundef 16)
          to label %205 unwind label %195

205:                                              ; preds = %203
  br i1 %204, label %207, label %.invoke213

.invoke213:                                       ; preds = %186, %205, %202, %199
  %206 = phi ptr [ @.str.29, %199 ], [ @.str.29, %202 ], [ @.str.30, %205 ], [ @.str.29, %186 ]
  invoke void (ptr, ...) @_ZN6basisu12error_printfEPKcz(ptr noundef nonnull %206)
          to label %307 unwind label %195

207:                                              ; preds = %205
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %15) #5
  invoke void @_ZN6basisu13bitwise_coderC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15)
          to label %208 unwind label %229

208:                                              ; preds = %207
  invoke void @_ZN6basisu13bitwise_coder4initEj(ptr noundef nonnull align 8 dereferenceable(32) %15, i32 noundef 8192)
          to label %209 unwind label %231

209:                                              ; preds = %208
  %210 = invoke noundef i32 @_ZN6basisu13bitwise_coder18emit_huffman_tableERKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %15, ptr noundef nonnull align 8 dereferenceable(32) %11)
          to label %211 unwind label %231

211:                                              ; preds = %209
  %212 = invoke noundef i32 @_ZN6basisu13bitwise_coder18emit_huffman_tableERKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %15, ptr noundef nonnull align 8 dereferenceable(32) %12)
          to label %213 unwind label %231

213:                                              ; preds = %211
  %214 = invoke noundef i32 @_ZN6basisu13bitwise_coder18emit_huffman_tableERKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %15, ptr noundef nonnull align 8 dereferenceable(32) %13)
          to label %215 unwind label %231

215:                                              ; preds = %213
  %216 = invoke noundef i32 @_ZN6basisu13bitwise_coder18emit_huffman_tableERKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %15, ptr noundef nonnull align 8 dereferenceable(32) %14)
          to label %217 unwind label %231

217:                                              ; preds = %215
  %218 = zext nneg i8 %.2128 to i32
  %219 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_bitsEjj(ptr noundef nonnull align 8 dereferenceable(32) %15, i32 noundef %218, i32 noundef 1)
          to label %220 unwind label %231

220:                                              ; preds = %217
  %221 = call noundef nonnull align 1 dereferenceable(4) ptr @_ZN6basisu10color_rgba3setEiiii(ptr noundef nonnull align 1 dereferenceable(4) %10, i32 noundef 16, i32 noundef 16, i32 noundef 16, i32 noundef 0)
  br label %222

222:                                              ; preds = %249, %220
  %indvars.iv209 = phi i64 [ %indvars.iv.next210, %249 ], [ 0, %220 ]
  %.1120 = phi i32 [ %248, %249 ], [ 0, %220 ]
  %223 = invoke noundef i32 @_ZNK6basisu15basisu_frontend27get_total_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %16)
          to label %224 unwind label %233

224:                                              ; preds = %222
  %225 = zext i32 %223 to i64
  %226 = icmp ult i64 %indvars.iv209, %225
  br i1 %226, label %235, label %227

227:                                              ; preds = %224
  %228 = invoke noundef i32 @_ZN6basisu13bitwise_coder5flushEv(ptr noundef nonnull align 8 dereferenceable(32) %15)
          to label %280 unwind label %231

229:                                              ; preds = %207
  %230 = landingpad { ptr, i32 }
          cleanup
  br label %306

231:                                              ; preds = %293, %290, %284, %280, %227, %217, %215, %213, %211, %209, %208
  %232 = landingpad { ptr, i32 }
          cleanup
  br label %305

233:                                              ; preds = %222
  %234 = landingpad { ptr, i32 }
          cleanup
  br label %305

235:                                              ; preds = %224
  %236 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %4, i64 noundef %indvars.iv209)
  %237 = load i32, ptr %236, align 4, !tbaa !26
  %238 = zext i32 %237 to i64
  %239 = call noundef nonnull align 4 dereferenceable(9) ptr @_ZN6basisu6vectorINS_27etc1_endpoint_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %78, i64 noundef %238)
  %240 = getelementptr inbounds i8, ptr %239, i64 4
  %241 = load i32, ptr %240, align 4, !tbaa !43
  %242 = sub i32 %241, %.1120
  %243 = and i32 %242, 7
  %244 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_codeEjRKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %15, i32 noundef %243, ptr noundef nonnull align 8 dereferenceable(32) %14)
          to label %245 unwind label %250

245:                                              ; preds = %235
  %246 = call noundef nonnull align 4 dereferenceable(9) ptr @_ZN6basisu6vectorINS_27etc1_endpoint_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %78, i64 noundef %238)
  %247 = getelementptr inbounds i8, ptr %246, i64 4
  %248 = load i32, ptr %247, align 4, !tbaa !43
  br label %252

249:                                              ; preds = %273
  %indvars.iv.next210 = add nuw nsw i64 %indvars.iv209, 1
  br label %222, !llvm.loop !48

250:                                              ; preds = %235
  %251 = landingpad { ptr, i32 }
          cleanup
  br label %305

252:                                              ; preds = %245, %273
  %.090181 = phi i32 [ 0, %245 ], [ %278, %273 ]
  %253 = call noundef nonnull align 4 dereferenceable(9) ptr @_ZN6basisu6vectorINS_27etc1_endpoint_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %78, i64 noundef %238)
  %254 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %253, i32 noundef %.090181)
  %255 = load i8, ptr %254, align 1, !tbaa !42
  %256 = zext i8 %255 to i32
  %257 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %10, i32 noundef %.090181)
  %258 = load i8, ptr %257, align 1, !tbaa !42
  %259 = zext i8 %258 to i32
  %260 = sub nsw i32 %256, %259
  %261 = and i32 %260, 31
  %262 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %10, i32 noundef %.090181)
  %263 = load i8, ptr %262, align 1, !tbaa !42
  %264 = icmp ult i8 %263, 10
  br i1 %264, label %.invoke214, label %267

265:                                              ; preds = %.invoke214
  %266 = landingpad { ptr, i32 }
          cleanup
  br label %305

267:                                              ; preds = %252
  %268 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %10, i32 noundef %.090181)
  %269 = load i8, ptr %268, align 1, !tbaa !42
  %270 = icmp ult i8 %269, 22
  %.215 = select i1 %270, ptr %12, ptr %13
  br label %.invoke214

.invoke214:                                       ; preds = %252, %267
  %271 = phi ptr [ %.215, %267 ], [ %11, %252 ]
  %272 = invoke noundef i32 @_ZN6basisu13bitwise_coder8put_codeEjRKNS_22huffman_encoding_tableE(ptr noundef nonnull align 8 dereferenceable(32) %15, i32 noundef %261, ptr noundef nonnull align 8 dereferenceable(32) %271)
          to label %273 unwind label %265

273:                                              ; preds = %.invoke214
  %274 = call noundef nonnull align 4 dereferenceable(9) ptr @_ZN6basisu6vectorINS_27etc1_endpoint_palette_entryEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %78, i64 noundef %238)
  %275 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %274, i32 noundef %.090181)
  %276 = load i8, ptr %275, align 1, !tbaa !42
  %277 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu10color_rgbaixEj(ptr noundef nonnull align 1 dereferenceable(4) %10, i32 noundef %.090181)
  store i8 %276, ptr %277, align 1, !tbaa !42
  %278 = add nuw nsw i32 %.090181, 1
  %279 = icmp ugt i32 %.090181, 1
  %.not190 = select i1 %105, i1 true, i1 %279
  br i1 %.not190, label %249, label %252, !llvm.loop !49

280:                                              ; preds = %227
  %281 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6basisu13bitwise_coder9get_bytesEv(ptr noundef nonnull align 8 dereferenceable(32) %15)
  %282 = getelementptr inbounds i8, ptr %0, i64 72
  %283 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN6basisu6vectorIhEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %282, ptr noundef nonnull align 8 dereferenceable(16) %281)
          to label %284 unwind label %231

284:                                              ; preds = %280
  %285 = call noundef i32 @_ZNK6basisu6vectorIhE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %282)
  %286 = shl nsw i32 %285, 3
  %287 = call noundef i32 @_ZNK6basisu6vectorIhE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %282)
  %288 = call noundef i32 @_ZNK6basisu6vectorIhE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %282)
  %289 = invoke noundef i32 @_ZNK6basisu15basisu_frontend27get_total_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %16)
          to label %290 unwind label %231

290:                                              ; preds = %284
  %291 = call noundef i32 @_ZNK6basisu6vectorIhE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %282)
  %292 = invoke noundef i32 @_ZNK6basisu14basisu_backend22get_total_input_texelsEv(ptr noundef nonnull align 8 dereferenceable(336) %0)
          to label %293 unwind label %231

293:                                              ; preds = %290
  %294 = uitofp i32 %291 to float
  %295 = fmul float %294, 8.000000e+00
  %296 = uitofp i32 %288 to float
  %297 = fmul float %296, 8.000000e+00
  %298 = uitofp i32 %289 to float
  %299 = fdiv float %297, %298
  %300 = fpext float %299 to double
  %301 = uitofp i32 %292 to float
  %302 = fdiv float %295, %301
  %303 = fpext float %302 to double
  invoke void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef nonnull @.str.31, i32 noundef %286, i32 noundef %287, double noundef %300, double noundef %303)
          to label %304 unwind label %231

304:                                              ; preds = %293
  call void @_ZN6basisu13bitwise_coderD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %15) #5
  br label %307

305:                                              ; preds = %233, %265, %250, %231
  %.pn.pn.pn = phi { ptr, i32 } [ %232, %231 ], [ %234, %233 ], [ %266, %265 ], [ %251, %250 ]
  call void @_ZN6basisu13bitwise_coderD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #5
  br label %306

306:                                              ; preds = %305, %229
  %.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn, %305 ], [ %230, %229 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %15) #5
  br label %308

307:                                              ; preds = %.invoke213, %304
  %.0 = phi i1 [ true, %304 ], [ false, %.invoke213 ]
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %14) #5
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %13) #5
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %12) #5
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #5
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #5
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #5
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #5
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #5
  call void @_ZN6basisu6vectorIbED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #5
  call void @_ZN6basisu6vectorIjED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @_ZN6basisu6vectorIbED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %2) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #5
  ret i1 %.0

308:                                              ; preds = %306, %195
  %.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn.pn, %306 ], [ %196, %195 ]
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #5
  br label %309

309:                                              ; preds = %308, %193
  %.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn.pn.pn, %308 ], [ %194, %193 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %14) #5
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %13) #5
  br label %310

310:                                              ; preds = %309, %191
  %.pn.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn.pn.pn.pn, %309 ], [ %192, %191 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %13) #5
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #5
  br label %311

311:                                              ; preds = %310, %189
  %.pn.pn.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn.pn.pn.pn.pn, %310 ], [ %190, %189 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %12) #5
  call void @_ZN6basisu22huffman_encoding_tableD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #5
  br label %312

312:                                              ; preds = %311, %187
  %.pn.pn.pn.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn.pn.pn.pn.pn.pn, %311 ], [ %188, %187 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %11) #5
  br label %313

313:                                              ; preds = %170, %312, %139, %154, %123, %121
  %.pn144.pn.pn.pn = phi { ptr, i32 } [ %122, %121 ], [ %.pn.pn.pn.pn.pn.pn.pn.pn.pn, %312 ], [ %171, %170 ], [ %124, %123 ], [ %155, %154 ], [ %140, %139 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #5
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #5
  br label %314

314:                                              ; preds = %313, %119
  %.pn144.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn144.pn.pn.pn, %313 ], [ %120, %119 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #5
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #5
  br label %315

315:                                              ; preds = %314, %117
  %.pn144.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn144.pn.pn.pn.pn, %314 ], [ %118, %117 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #5
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #5
  br label %316

316:                                              ; preds = %315, %115
  %.pn144.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn144.pn.pn.pn.pn.pn, %315 ], [ %116, %115 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #5
  call void @_ZN6basisu9histogramD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #5
  br label %317

317:                                              ; preds = %316, %113
  %.pn144.pn.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn144.pn.pn.pn.pn.pn.pn, %316 ], [ %114, %113 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #5
  br label %318

318:                                              ; preds = %317, %90
  %.pn144.pn.pn.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn144.pn.pn.pn.pn.pn.pn.pn, %317 ], [ %91, %90 ]
  call void @_ZN6basisu6vectorIbED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #5
  br label %319

319:                                              ; preds = %318, %61
  %.pn144.pn.pn.pn.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn144.pn.pn.pn.pn.pn.pn.pn.pn, %318 ], [ %62, %61 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #5
  call void @_ZN6basisu6vectorIjED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #5
  br label %320

320:                                              ; preds = %319, %59
  %.pn144.pn.pn.pn.pn.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn144.pn.pn.pn.pn.pn.pn.pn.pn.pn, %319 ], [ %60, %59 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  br label %321

321:                                              ; preds = %320, %57, %.split.us
  %.pn156 = phi { ptr, i32 } [ %42, %.split.us ], [ %.pn144.pn.pn.pn.pn.pn.pn.pn.pn.pn.pn, %320 ], [ %58, %57 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @_ZN6basisu6vectorIbED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %2) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #5
  resume { ptr, i32 } %.pn156
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6basisu6vectorIbEC2Em(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) unnamed_addr #0 align 2

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

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

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

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

attributes #0 = { 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 #1 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = !{!13, !13, i64 0}
!27 = !{!28, !13, i64 20}
!28 = !{!"_ZTSN6basisu25basisu_backend_slice_descE", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !11, i64 44, !11, i64 45}
!29 = !{!28, !13, i64 24}
!30 = !{!31, !13, i64 4}
!31 = !{!"_ZTSN6basisu13encoder_blockE", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !11, i64 16}
!32 = !{!11, !11, i64 0}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = distinct !{!35, !34}
!36 = distinct !{!36, !34}
!37 = !{i8 0, i8 2}
!38 = !{}
!39 = distinct !{!39, !34}
!40 = distinct !{!40, !34}
!41 = distinct !{!41, !34}
!42 = !{!8, !8, i64 0}
!43 = !{!44, !13, i64 4}
!44 = !{!"_ZTSN6basisu27etc1_endpoint_palette_entryE", !45, i64 0, !13, i64 4, !11, i64 8}
!45 = !{!"_ZTSN6basisu10color_rgbaE", !8, i64 0}
!46 = distinct !{!46, !34}
!47 = distinct !{!47, !34}
!48 = distinct !{!48, !34}
!49 = distinct !{!49, !34}


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