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

; 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::basisu_frontend" = type { %"struct.basisu::basisu_frontend::params", i32, i32, i8, i8, i8, i32, i32, %"class.basisu::vector", %"class.basisu::vector.0", %"class.basisu::vector.0", %"class.basisu::vector.0", %"class.basisu::tree_vector_quant", %"class.basisu::vector.6", %"class.basisu::vector.6", %"class.basisu::vector.8", %"class.basisu::vector.6", %"class.basisu::vector.10", %"class.basisu::vector.12", %"class.basisu::vector.6", %"class.basisu::vector.0", %"class.basisu::vector.6", %"class.basisu::vector.8", %"class.basisu::vector.6", %"class.basisu::vector.14", %"class.basisu::vector.16", %"class.basisu::vector.18", %"class.basisu::vector.20", %"class.std::mutex" }
%"struct.basisu::basisu_frontend::params" = type { i32, ptr, i32, i32, i32, i8, i8, i8, i8, i8, i8, i8, ptr, i32, i32, i8, float, i32, ptr, ptr }
%"class.basisu::vector" = type { ptr, i32, i32 }
%"class.basisu::tree_vector_quant" = type <{ %"class.basisu::vector.2", %"class.basisu::vector.4", i32, [4 x i8] }>
%"class.basisu::vector.2" = type { ptr, i32, i32 }
%"class.basisu::vector.4" = type { ptr, i32, i32 }
%"class.basisu::vector.10" = type { ptr, i32, i32 }
%"class.basisu::vector.12" = type { ptr, i32, i32 }
%"class.basisu::vector.0" = type { ptr, i32, i32 }
%"class.basisu::vector.8" = type { ptr, i32, i32 }
%"class.basisu::vector.6" = type { ptr, i32, i32 }
%"class.basisu::vector.14" = type { ptr, i32, i32 }
%"class.basisu::vector.16" = type { ptr, i32, i32 }
%"class.basisu::vector.18" = type { ptr, i32, i32 }
%"class.basisu::vector.20" = type { ptr, i32, i32 }
%"class.std::mutex" = type { %"class.std::__mutex_base" }
%"class.std::__mutex_base" = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }

@.str.8 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [33 x i8], align 1

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN6basisu15basisu_frontend8compressEv(ptr noundef nonnull align 8 dereferenceable(496) %0) #1 align 2 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca [256 x i8], align 16
  %7 = alloca i8, align 1
  %8 = alloca [256 x i8], align 16
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %11 = load ptr, ptr %3, align 8
  call void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef @.str.8)
  %12 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %11, i32 0, i32 0
  %13 = getelementptr inbounds %"struct.basisu::basisu_frontend::params", ptr %12, i32 0, i32 0
  %14 = load i32, ptr %13, align 8, !tbaa !9
  %15 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %11, i32 0, i32 1
  store i32 %14, ptr %15, align 8, !tbaa !31
  %16 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %11, i32 0, i32 1
  %17 = load i32, ptr %16, align 8, !tbaa !31
  %18 = mul i32 %17, 16
  %19 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %11, i32 0, i32 2
  store i32 %18, ptr %19, align 4, !tbaa !32
  call void @_ZN6basisu15basisu_frontend16init_etc1_imagesEv(ptr noundef nonnull align 8 dereferenceable(496) %11)
  %20 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %11, i32 0, i32 0
  %21 = getelementptr inbounds %"struct.basisu::basisu_frontend::params", ptr %20, i32 0, i32 18
  %22 = load ptr, ptr %21, align 8, !tbaa !33
  %23 = icmp ne ptr %22, null
  br i1 %23, label %24, label %26

24:                                               ; preds = %1
  %25 = call noundef zeroext i1 @_ZN6basisu15basisu_frontend21init_global_codebooksEv(ptr noundef nonnull align 8 dereferenceable(496) %11)
  br label %184

26:                                               ; preds = %1
  call void @_ZN6basisu15basisu_frontend30init_endpoint_training_vectorsEv(ptr noundef nonnull align 8 dereferenceable(496) %11)
  call void @_ZN6basisu15basisu_frontend26generate_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %11)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !34
  br label %27

27:                                               ; preds = %117, %26
  %28 = load i32, ptr %4, align 4, !tbaa !34
  %29 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %11, i32 0, i32 6
  %30 = load i32, ptr %29, align 4, !tbaa !35
  %31 = icmp ult i32 %28, %30
  br i1 %31, label %33, label %32

32:                                               ; preds = %27
  store i32 2, ptr %5, align 4
  br label %120

33:                                               ; preds = %27
  br label %34

34:                                               ; preds = %33
  %35 = call noundef zeroext i1 @_ZNK6basisu15basisu_frontend23check_etc1s_constraintsEv(ptr noundef nonnull align 8 dereferenceable(496) %11)
  br i1 %35, label %37, label %36

36:                                               ; preds = %34
  call void @_ZN6basisuL21handle_verify_failureEi(i32 noundef 211)
  br label %37

37:                                               ; preds = %36, %34
  br label %38

38:                                               ; preds = %37
  br label %39

39:                                               ; preds = %38
  %40 = load i32, ptr %4, align 4, !tbaa !34
  %41 = icmp ne i32 %40, 0
  br i1 %41, label %42, label %43

42:                                               ; preds = %39
  call void @_ZN6basisu15basisu_frontend31introduce_new_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %11)
  br label %43

43:                                               ; preds = %42, %39
  %44 = load i32, ptr %4, align 4, !tbaa !34
  call void @_ZN6basisu15basisu_frontend26generate_endpoint_codebookEj(ptr noundef nonnull align 8 dereferenceable(496) %11, i32 noundef %44)
  %45 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %11, i32 0, i32 0
  %46 = getelementptr inbounds %"struct.basisu::basisu_frontend::params", ptr %45, i32 0, i32 7
  %47 = load i8, ptr %46, align 2, !tbaa !36, !range !37, !noundef !38
  %48 = trunc i8 %47 to i1
  br i1 %48, label %49, label %59

49:                                               ; preds = %43
  %50 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %11, i32 0, i32 0
  %51 = getelementptr inbounds %"struct.basisu::basisu_frontend::params", ptr %50, i32 0, i32 8
  %52 = load i8, ptr %51, align 1, !tbaa !39, !range !37, !noundef !38
  %53 = trunc i8 %52 to i1
  br i1 %53, label %54, label %59

54:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 256, ptr %6) #5
  %55 = getelementptr inbounds [256 x i8], ptr %6, i64 0, i64 0
  %56 = load i32, ptr %4, align 4, !tbaa !34
  %57 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %55, i64 noundef 256, ptr noundef @.str.9, i32 noundef %56) #5
  %58 = getelementptr inbounds [256 x i8], ptr %6, i64 0, i64 0
  call void @_ZN6basisu15basisu_frontend42dump_endpoint_clusterization_visualizationEPKcb(ptr noundef nonnull align 8 dereferenceable(496) %11, ptr noundef %58, i1 noundef zeroext false)
  call void @llvm.lifetime.end.p0(i64 256, ptr %6) #5
  br label %59

59:                                               ; preds = %54, %49, %43
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #5
  store i8 0, ptr %7, align 1, !tbaa !40
  %60 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %11, i32 0, i32 3
  %61 = load i8, ptr %60, align 8, !tbaa !41, !range !37, !noundef !38
  %62 = trunc i8 %61 to i1
  br i1 %62, label %63, label %101

63:                                               ; preds = %59
  %64 = call noundef i32 @_ZN6basisu15basisu_frontend30refine_endpoint_clusterizationEv(ptr noundef nonnull align 8 dereferenceable(496) %11)
  %65 = icmp ne i32 %64, 0
  br i1 %65, label %67, label %66

66:                                               ; preds = %63
  store i8 1, ptr %7, align 1, !tbaa !40
  br label %67

67:                                               ; preds = %66, %63
  %68 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %11, i32 0, i32 0
  %69 = getelementptr inbounds %"struct.basisu::basisu_frontend::params", ptr %68, i32 0, i32 17
  %70 = load i32, ptr %69, align 8, !tbaa !42
  %71 = icmp eq i32 %70, 3
  br i1 %71, label %72, label %81

72:                                               ; preds = %67
  %73 = load i32, ptr %4, align 4, !tbaa !34
  %74 = icmp ne i32 %73, 0
  br i1 %74, label %81, label %75

75:                                               ; preds = %72
  %76 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %11, i32 0, i32 6
  %77 = load i32, ptr %76, align 4, !tbaa !35
  %78 = icmp eq i32 %77, 1
  br i1 %78, label %79, label %81

79:                                               ; preds = %75
  call void @_ZN6basisu15basisu_frontend46eliminate_redundant_or_empty_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %11)
  %80 = load i32, ptr %4, align 4, !tbaa !34
  call void @_ZN6basisu15basisu_frontend26generate_endpoint_codebookEj(ptr noundef nonnull align 8 dereferenceable(496) %11, i32 noundef %80)
  br label %81

81:                                               ; preds = %79, %75, %72, %67
  %82 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %11, i32 0, i32 0
  %83 = getelementptr inbounds %"struct.basisu::basisu_frontend::params", ptr %82, i32 0, i32 7
  %84 = load i8, ptr %83, align 2, !tbaa !36, !range !37, !noundef !38
  %85 = trunc i8 %84 to i1
  br i1 %85, label %86, label %100

86:                                               ; preds = %81
  %87 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %11, i32 0, i32 0
  %88 = getelementptr inbounds %"struct.basisu::basisu_frontend::params", ptr %87, i32 0, i32 8
  %89 = load i8, ptr %88, align 1, !tbaa !39, !range !37, !noundef !38
  %90 = trunc i8 %89 to i1
  br i1 %90, label %91, label %100

91:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 256, ptr %8) #5
  %92 = getelementptr inbounds [256 x i8], ptr %8, i64 0, i64 0
  %93 = load i32, ptr %4, align 4, !tbaa !34
  %94 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %92, i64 noundef 256, ptr noundef @.str.10, i32 noundef %93) #5
  %95 = getelementptr inbounds [256 x i8], ptr %8, i64 0, i64 0
  call void @_ZN6basisu15basisu_frontend42dump_endpoint_clusterization_visualizationEPKcb(ptr noundef nonnull align 8 dereferenceable(496) %11, ptr noundef %95, i1 noundef zeroext false)
  %96 = getelementptr inbounds [256 x i8], ptr %8, i64 0, i64 0
  %97 = load i32, ptr %4, align 4, !tbaa !34
  %98 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %96, i64 noundef 256, ptr noundef @.str.11, i32 noundef %97) #5
  %99 = getelementptr inbounds [256 x i8], ptr %8, i64 0, i64 0
  call void @_ZN6basisu15basisu_frontend42dump_endpoint_clusterization_visualizationEPKcb(ptr noundef nonnull align 8 dereferenceable(496) %11, ptr noundef %99, i1 noundef zeroext true)
  call void @llvm.lifetime.end.p0(i64 256, ptr %8) #5
  br label %100

100:                                              ; preds = %91, %86, %81
  br label %101

101:                                              ; preds = %100, %59
  call void @_ZN6basisu15basisu_frontend46eliminate_redundant_or_empty_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %11)
  %102 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %11, i32 0, i32 0
  %103 = getelementptr inbounds %"struct.basisu::basisu_frontend::params", ptr %102, i32 0, i32 6
  %104 = load i8, ptr %103, align 1, !tbaa !43, !range !37, !noundef !38
  %105 = trunc i8 %104 to i1
  br i1 %105, label %106, label %109

106:                                              ; preds = %101
  %107 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %11, i32 0, i32 13
  %108 = call noundef i32 @_ZNK6basisu6vectorINS0_IjEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %107)
  call void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef @.str.12, i32 noundef %108)
  br label %109

109:                                              ; preds = %106, %101
  %110 = load i8, ptr %7, align 1, !tbaa !40, !range !37, !noundef !38
  %111 = trunc i8 %110 to i1
  br i1 %111, label %112, label %113

112:                                              ; preds = %109
  store i32 2, ptr %5, align 4
  br label %114

113:                                              ; preds = %109
  store i32 0, ptr %5, align 4
  br label %114

114:                                              ; preds = %113, %112
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #5
  %115 = load i32, ptr %5, align 4
  switch i32 %115, label %120 [
    i32 0, label %116
  ]

116:                                              ; preds = %114
  br label %117

117:                                              ; preds = %116
  %118 = load i32, ptr %4, align 4, !tbaa !34
  %119 = add i32 %118, 1
  store i32 %119, ptr %4, align 4, !tbaa !34
  br label %27, !llvm.loop !44

120:                                              ; preds = %114, %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %121

121:                                              ; preds = %120
  br label %122

122:                                              ; preds = %121
  %123 = call noundef zeroext i1 @_ZNK6basisu15basisu_frontend23check_etc1s_constraintsEv(ptr noundef nonnull align 8 dereferenceable(496) %11)
  br i1 %123, label %125, label %124

124:                                              ; preds = %122
  call void @_ZN6basisuL21handle_verify_failureEi(i32 noundef 263)
  br label %125

125:                                              ; preds = %124, %122
  br label %126

126:                                              ; preds = %125
  call void @_ZN6basisu15basisu_frontend32generate_block_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %11)
  call void @_ZN6basisu15basisu_frontend29create_initial_packed_textureEv(ptr noundef nonnull align 8 dereferenceable(496) %11)
  call void @_ZN6basisu15basisu_frontend26generate_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %11)
  %127 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %11, i32 0, i32 5
  %128 = load i8, ptr %127, align 2, !tbaa !46, !range !37, !noundef !38
  %129 = trunc i8 %128 to i1
  br i1 %129, label %130, label %131

130:                                              ; preds = %126
  call void @_ZN6basisu15basisu_frontend52compute_selector_clusters_within_each_parent_clusterEv(ptr noundef nonnull align 8 dereferenceable(496) %11)
  br label %131

131:                                              ; preds = %130, %126
  %132 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %11, i32 0, i32 0
  %133 = getelementptr inbounds %"struct.basisu::basisu_frontend::params", ptr %132, i32 0, i32 4
  %134 = load i32, ptr %133, align 8, !tbaa !47
  %135 = icmp eq i32 %134, 0
  br i1 %135, label %136, label %137

136:                                              ; preds = %131
  call void @_ZN6basisu15basisu_frontend34create_optimized_selector_codebookEj(ptr noundef nonnull align 8 dereferenceable(496) %11, i32 noundef 0)
  call void @_ZN6basisu15basisu_frontend45find_optimal_selector_clusters_for_each_blockEv(ptr noundef nonnull align 8 dereferenceable(496) %11)
  call void @_ZN6basisu15basisu_frontend35introduce_special_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %11)
  br label %175

137:                                              ; preds = %131
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %138 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %11, i32 0, i32 0
  %139 = getelementptr inbounds %"struct.basisu::basisu_frontend::params", ptr %138, i32 0, i32 12
  %140 = load ptr, ptr %139, align 8, !tbaa !48
  %141 = icmp ne ptr %140, null
  br i1 %141, label %142, label %143

142:                                              ; preds = %137
  br label %146

143:                                              ; preds = %137
  %144 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %11, i32 0, i32 7
  %145 = load i32, ptr %144, align 8, !tbaa !49
  br label %146

146:                                              ; preds = %143, %142
  %147 = phi i32 [ 1, %142 ], [ %145, %143 ]
  store i32 %147, ptr %9, align 4, !tbaa !34
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !34
  br label %148

148:                                              ; preds = %170, %146
  %149 = load i32, ptr %10, align 4, !tbaa !34
  %150 = load i32, ptr %9, align 4, !tbaa !34
  %151 = icmp ult i32 %149, %150
  br i1 %151, label %153, label %152

152:                                              ; preds = %148
  store i32 9, ptr %5, align 4
  br label %173

153:                                              ; preds = %148
  %154 = load i32, ptr %10, align 4, !tbaa !34
  call void @_ZN6basisu15basisu_frontend34create_optimized_selector_codebookEj(ptr noundef nonnull align 8 dereferenceable(496) %11, i32 noundef %154)
  call void @_ZN6basisu15basisu_frontend45find_optimal_selector_clusters_for_each_blockEv(ptr noundef nonnull align 8 dereferenceable(496) %11)
  call void @_ZN6basisu15basisu_frontend35introduce_special_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %11)
  %155 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %11, i32 0, i32 0
  %156 = getelementptr inbounds %"struct.basisu::basisu_frontend::params", ptr %155, i32 0, i32 4
  %157 = load i32, ptr %156, align 8, !tbaa !47
  %158 = icmp uge i32 %157, 4
  br i1 %158, label %164, label %159

159:                                              ; preds = %153
  %160 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %11, i32 0, i32 0
  %161 = getelementptr inbounds %"struct.basisu::basisu_frontend::params", ptr %160, i32 0, i32 17
  %162 = load i32, ptr %161, align 8, !tbaa !42
  %163 = icmp eq i32 %162, 3
  br i1 %163, label %164, label %169

164:                                              ; preds = %159, %153
  %165 = call noundef i32 @_ZN6basisu15basisu_frontend38refine_block_endpoints_given_selectorsEv(ptr noundef nonnull align 8 dereferenceable(496) %11)
  %166 = icmp ne i32 %165, 0
  br i1 %166, label %168, label %167

167:                                              ; preds = %164
  store i32 9, ptr %5, align 4
  br label %173

168:                                              ; preds = %164
  br label %169

169:                                              ; preds = %168, %159
  br label %170

170:                                              ; preds = %169
  %171 = load i32, ptr %10, align 4, !tbaa !34
  %172 = add i32 %171, 1
  store i32 %172, ptr %10, align 4, !tbaa !34
  br label %148, !llvm.loop !50

173:                                              ; preds = %167, %152
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %174

174:                                              ; preds = %173
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %175

175:                                              ; preds = %174, %136
  call void @_ZN6basisu15basisu_frontend26optimize_selector_codebookEv(ptr noundef nonnull align 8 dereferenceable(496) %11)
  %176 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %11, i32 0, i32 0
  %177 = getelementptr inbounds %"struct.basisu::basisu_frontend::params", ptr %176, i32 0, i32 6
  %178 = load i8, ptr %177, align 1, !tbaa !43, !range !37, !noundef !38
  %179 = trunc i8 %178 to i1
  br i1 %179, label %180, label %183

180:                                              ; preds = %175
  %181 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %11, i32 0, i32 19
  %182 = call noundef i32 @_ZNK6basisu6vectorINS0_IjEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %181)
  call void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef @.str.13, i32 noundef %182)
  br label %183

183:                                              ; preds = %180, %175
  br label %184

184:                                              ; preds = %183, %24
  call void @_ZN6basisu15basisu_frontend8finalizeEv(ptr noundef nonnull align 8 dereferenceable(496) %11)
  %185 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %11, i32 0, i32 0
  %186 = getelementptr inbounds %"struct.basisu::basisu_frontend::params", ptr %185, i32 0, i32 9
  %187 = load i8, ptr %186, align 8, !tbaa !51, !range !37, !noundef !38
  %188 = trunc i8 %187 to i1
  br i1 %188, label %189, label %193

189:                                              ; preds = %184
  %190 = call noundef zeroext i1 @_ZNK6basisu15basisu_frontend15validate_outputEv(ptr noundef nonnull align 8 dereferenceable(496) %11)
  br i1 %190, label %192, label %191

191:                                              ; preds = %189
  store i1 false, ptr %2, align 1
  br label %194

192:                                              ; preds = %189
  br label %193

193:                                              ; preds = %192, %184
  call void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef @.str.14)
  store i1 true, ptr %2, align 1
  br label %194

194:                                              ; preds = %193, %191
  %195 = load i1, ptr %2, align 1
  ret i1 %195
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN6basisu15basisu_frontend21init_global_codebooksEv(ptr noundef nonnull align 8 dereferenceable(496)) #1 align 2

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK6basisu15basisu_frontend23check_etc1s_constraintsEv(ptr noundef nonnull align 8 dereferenceable(496)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @_ZN6basisuL21handle_verify_failureEi(i32 noundef) #3

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu15basisu_frontend26generate_endpoint_codebookEj(ptr noundef nonnull align 8 dereferenceable(496), i32 noundef) #1 align 2

; Function Attrs: nounwind
declare i32 @snprintf(ptr noundef, i64 noundef, ptr noundef, ...) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu15basisu_frontend42dump_endpoint_clusterization_visualizationEPKcb(ptr noundef nonnull align 8 dereferenceable(496), ptr noundef, i1 noundef zeroext) #1 align 2

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu15basisu_frontend34create_optimized_selector_codebookEj(ptr noundef nonnull align 8 dereferenceable(496), i32 noundef) #1 align 2

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK6basisu15basisu_frontend15validate_outputEv(ptr noundef nonnull align 8 dereferenceable(496)) #1 align 2

attributes #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 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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, !12, i64 0}
!10 = !{!"_ZTSN6basisu15basisu_frontendE", !11, i64 0, !12, i64 88, !12, i64 92, !13, i64 96, !13, i64 97, !13, i64 98, !12, i64 100, !12, i64 104, !16, i64 112, !17, i64 128, !17, i64 144, !17, i64 160, !18, i64 176, !21, i64 216, !21, i64 232, !22, i64 248, !21, i64 264, !23, i64 280, !24, i64 296, !21, i64 312, !17, i64 328, !21, i64 344, !22, i64 360, !21, i64 376, !25, i64 392, !26, i64 408, !27, i64 424, !28, i64 440, !29, i64 456}
!11 = !{!"_ZTSN6basisu15basisu_frontend6paramsE", !12, i64 0, !6, i64 8, !12, i64 16, !12, i64 20, !12, i64 24, !13, i64 28, !13, i64 29, !13, i64 30, !13, i64 31, !13, i64 32, !13, i64 33, !13, i64 34, !6, i64 40, !12, i64 48, !12, i64 52, !13, i64 56, !14, i64 60, !15, i64 64, !6, i64 72, !6, i64 80}
!12 = !{!"int", !7, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = !{!"_ZTSN6basist18basis_texture_typeE", !7, i64 0}
!16 = !{!"_ZTSN6basisu6vectorINS_11pixel_blockEEE", !6, i64 0, !12, i64 8, !12, i64 12}
!17 = !{!"_ZTSN6basisu6vectorINS_9etc_blockEEE", !6, i64 0, !12, i64 8, !12, i64 12}
!18 = !{!"_ZTSN6basisu17tree_vector_quantINS_3vecILj6EfEEEE", !19, i64 0, !20, i64 16, !12, i64 32}
!19 = !{!"_ZTSN6basisu6vectorINS_17tree_vector_quantINS_3vecILj6EfEEE9tsvq_nodeEEE", !6, i64 0, !12, i64 8, !12, i64 12}
!20 = !{!"_ZTSN6basisu6vectorISt4pairINS_3vecILj6EfEEmEEE", !6, i64 0, !12, i64 8, !12, i64 12}
!21 = !{!"_ZTSN6basisu6vectorINS0_IjEEEE", !6, i64 0, !12, i64 8, !12, i64 12}
!22 = !{!"_ZTSN6basisu6vectorIhEE", !6, i64 0, !12, i64 8, !12, i64 12}
!23 = !{!"_ZTSN6basisu6vectorINS_15basisu_frontend27endpoint_cluster_etc_paramsEEE", !6, i64 0, !12, i64 8, !12, i64 12}
!24 = !{!"_ZTSN6basisu6vectorINS_5vec2UEEE", !6, i64 0, !12, i64 8, !12, i64 12}
!25 = !{!"_ZTSN6basisu6vectorIN6basist38etc1_global_selector_codebook_entry_idEEE", !6, i64 0, !12, i64 8, !12, i64 12}
!26 = !{!"_ZTSN6basisu6vectorIbEE", !6, i64 0, !12, i64 8, !12, i64 12}
!27 = !{!"_ZTSN6basisu6vectorIjEE", !6, i64 0, !12, i64 8, !12, i64 12}
!28 = !{!"_ZTSN6basisu6vectorINS_15basisu_frontend27subblock_endpoint_quant_errEEE", !6, i64 0, !12, i64 8, !12, i64 12}
!29 = !{!"_ZTSSt5mutex", !30, i64 0}
!30 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!31 = !{!10, !12, i64 88}
!32 = !{!10, !12, i64 92}
!33 = !{!10, !6, i64 72}
!34 = !{!12, !12, i64 0}
!35 = !{!10, !12, i64 100}
!36 = !{!10, !13, i64 30}
!37 = !{i8 0, i8 2}
!38 = !{}
!39 = !{!10, !13, i64 31}
!40 = !{!13, !13, i64 0}
!41 = !{!10, !13, i64 96}
!42 = !{!10, !15, i64 64}
!43 = !{!10, !13, i64 29}
!44 = distinct !{!44, !45}
!45 = !{!"llvm.loop.mustprogress"}
!46 = !{!10, !13, i64 98}
!47 = !{!10, !12, i64 24}
!48 = !{!10, !6, i64 40}
!49 = !{!10, !12, i64 104}
!50 = distinct !{!50, !45}
!51 = !{!10, !13, i64 32}


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

@.str.8 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [33 x i8], align 1

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN6basisu15basisu_frontend8compressEv(ptr noundef nonnull align 8 dereferenceable(496) %0) local_unnamed_addr #1 align 2 {
  %2 = alloca [256 x i8], align 16
  %3 = alloca [256 x i8], align 16
  tail call void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef nonnull @.str.8)
  %4 = load i32, ptr %0, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 88
  store i32 %4, ptr %5, align 8, !tbaa !30
  %6 = shl i32 %4, 4
  %7 = getelementptr inbounds i8, ptr %0, i64 92
  store i32 %6, ptr %7, align 4, !tbaa !31
  tail call void @_ZN6basisu15basisu_frontend16init_etc1_imagesEv(ptr noundef nonnull align 8 dereferenceable(496) %0)
  %8 = getelementptr inbounds i8, ptr %0, i64 72
  %9 = load ptr, ptr %8, align 8, !tbaa !32
  %.not = icmp eq ptr %9, null
  br i1 %.not, label %12, label %10

10:                                               ; preds = %1
  %11 = tail call noundef zeroext i1 @_ZN6basisu15basisu_frontend21init_global_codebooksEv(ptr noundef nonnull align 8 dereferenceable(496) %0)
  br label %124

12:                                               ; preds = %1
  tail call void @_ZN6basisu15basisu_frontend30init_endpoint_training_vectorsEv(ptr noundef nonnull align 8 dereferenceable(496) %0)
  tail call void @_ZN6basisu15basisu_frontend26generate_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %0)
  %13 = getelementptr inbounds i8, ptr %0, i64 100
  %14 = load i32, ptr %13, align 4, !tbaa !33
  %.not39 = icmp eq i32 %14, 0
  br i1 %.not39, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %12
  %15 = getelementptr inbounds i8, ptr %0, i64 30
  %16 = getelementptr inbounds i8, ptr %0, i64 31
  %17 = getelementptr inbounds i8, ptr %0, i64 96
  %18 = getelementptr inbounds i8, ptr %0, i64 64
  %19 = getelementptr inbounds i8, ptr %0, i64 29
  %20 = getelementptr inbounds i8, ptr %0, i64 216
  %21 = tail call noundef zeroext i1 @_ZNK6basisu15basisu_frontend23check_etc1s_constraintsEv(ptr noundef nonnull align 8 dereferenceable(496) %0)
  br i1 %21, label %23, label %22

22:                                               ; preds = %.lr.ph
  tail call void @_ZN6basisuL21handle_verify_failureEi(i32 noundef 211)
  br label %23

23:                                               ; preds = %.lr.ph, %22
  tail call void @_ZN6basisu15basisu_frontend26generate_endpoint_codebookEj(ptr noundef nonnull align 8 dereferenceable(496) %0, i32 noundef 0)
  %24 = load i8, ptr %15, align 2, !tbaa !34, !range !35, !noundef !36
  %25 = trunc nuw i8 %24 to i1
  br i1 %25, label %26, label %31

26:                                               ; preds = %23
  %27 = load i8, ptr %16, align 1, !tbaa !37, !range !35, !noundef !36
  %28 = trunc nuw i8 %27 to i1
  br i1 %28, label %29, label %31

29:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %2) #5
  %30 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %2, i64 noundef 256, ptr noundef nonnull @.str.9, i32 noundef 0) #5
  call void @_ZN6basisu15basisu_frontend42dump_endpoint_clusterization_visualizationEPKcb(ptr noundef nonnull align 8 dereferenceable(496) %0, ptr noundef nonnull %2, i1 noundef zeroext false)
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %2) #5
  br label %31

31:                                               ; preds = %29, %26, %23
  %32 = load i8, ptr %17, align 8, !tbaa !38, !range !35, !noundef !36
  %33 = trunc nuw i8 %32 to i1
  br i1 %33, label %34, label %50

34:                                               ; preds = %31
  %35 = call noundef i32 @_ZN6basisu15basisu_frontend30refine_endpoint_clusterizationEv(ptr noundef nonnull align 8 dereferenceable(496) %0)
  %.not21.peel = icmp eq i32 %35, 0
  %36 = load i32, ptr %18, align 8, !tbaa !39
  %37 = icmp eq i32 %36, 3
  %38 = load i32, ptr %13, align 4
  %39 = icmp eq i32 %38, 1
  %or.cond25.peel = select i1 %37, i1 %39, i1 false
  br i1 %or.cond25.peel, label %40, label %41

40:                                               ; preds = %34
  call void @_ZN6basisu15basisu_frontend46eliminate_redundant_or_empty_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %0)
  call void @_ZN6basisu15basisu_frontend26generate_endpoint_codebookEj(ptr noundef nonnull align 8 dereferenceable(496) %0, i32 noundef 0)
  br label %41

41:                                               ; preds = %40, %34
  %42 = load i8, ptr %15, align 2, !tbaa !34, !range !35, !noundef !36
  %43 = trunc nuw i8 %42 to i1
  br i1 %43, label %44, label %50

44:                                               ; preds = %41
  %45 = load i8, ptr %16, align 1, !tbaa !37, !range !35, !noundef !36
  %46 = trunc nuw i8 %45 to i1
  br i1 %46, label %47, label %50

47:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %3) #5
  %48 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %3, i64 noundef 256, ptr noundef nonnull @.str.10, i32 noundef 0) #5
  call void @_ZN6basisu15basisu_frontend42dump_endpoint_clusterization_visualizationEPKcb(ptr noundef nonnull align 8 dereferenceable(496) %0, ptr noundef nonnull %3, i1 noundef zeroext false)
  %49 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %3, i64 noundef 256, ptr noundef nonnull @.str.11, i32 noundef 0) #5
  call void @_ZN6basisu15basisu_frontend42dump_endpoint_clusterization_visualizationEPKcb(ptr noundef nonnull align 8 dereferenceable(496) %0, ptr noundef nonnull %3, i1 noundef zeroext true)
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %3) #5
  br label %50

50:                                               ; preds = %47, %44, %41, %31
  %.1.shrunk.peel = phi i1 [ %.not21.peel, %47 ], [ %.not21.peel, %44 ], [ %.not21.peel, %41 ], [ false, %31 ]
  call void @_ZN6basisu15basisu_frontend46eliminate_redundant_or_empty_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %0)
  %51 = load i8, ptr %19, align 1, !tbaa !40, !range !35, !noundef !36
  %52 = trunc nuw i8 %51 to i1
  br i1 %52, label %53, label %55

53:                                               ; preds = %50
  %54 = call noundef i32 @_ZNK6basisu6vectorINS0_IjEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %20)
  call void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef nonnull @.str.12, i32 noundef %54)
  br label %55

55:                                               ; preds = %53, %50
  %56 = load i32, ptr %13, align 4
  %57 = icmp ult i32 %56, 2
  %or.cond46.not = select i1 %.1.shrunk.peel, i1 true, i1 %57
  br i1 %or.cond46.not, label %._crit_edge, label %.peel.next

58:                                               ; preds = %89
  %59 = add nuw i32 %.02032, 1
  %60 = load i32, ptr %13, align 4, !tbaa !33
  %61 = icmp ult i32 %59, %60
  br i1 %61, label %.peel.next, label %._crit_edge, !llvm.loop !41

.peel.next:                                       ; preds = %55, %58
  %.02032 = phi i32 [ %59, %58 ], [ 1, %55 ]
  %62 = call noundef zeroext i1 @_ZNK6basisu15basisu_frontend23check_etc1s_constraintsEv(ptr noundef nonnull align 8 dereferenceable(496) %0)
  br i1 %62, label %64, label %63

63:                                               ; preds = %.peel.next
  call void @_ZN6basisuL21handle_verify_failureEi(i32 noundef 211)
  br label %64

64:                                               ; preds = %63, %.peel.next
  call void @_ZN6basisu15basisu_frontend31introduce_new_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %0)
  call void @_ZN6basisu15basisu_frontend26generate_endpoint_codebookEj(ptr noundef nonnull align 8 dereferenceable(496) %0, i32 noundef %.02032)
  %65 = load i8, ptr %15, align 2, !tbaa !34, !range !35, !noundef !36
  %66 = trunc nuw i8 %65 to i1
  br i1 %66, label %67, label %72

67:                                               ; preds = %64
  %68 = load i8, ptr %16, align 1, !tbaa !37, !range !35, !noundef !36
  %69 = trunc nuw i8 %68 to i1
  br i1 %69, label %70, label %72

70:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %2) #5
  %71 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %2, i64 noundef 256, ptr noundef nonnull @.str.9, i32 noundef %.02032) #5
  call void @_ZN6basisu15basisu_frontend42dump_endpoint_clusterization_visualizationEPKcb(ptr noundef nonnull align 8 dereferenceable(496) %0, ptr noundef nonnull %2, i1 noundef zeroext false)
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %2) #5
  br label %72

72:                                               ; preds = %70, %67, %64
  %73 = load i8, ptr %17, align 8, !tbaa !38, !range !35, !noundef !36
  %74 = trunc nuw i8 %73 to i1
  br i1 %74, label %75, label %84

75:                                               ; preds = %72
  %76 = call noundef i32 @_ZN6basisu15basisu_frontend30refine_endpoint_clusterizationEv(ptr noundef nonnull align 8 dereferenceable(496) %0)
  %.not21 = icmp eq i32 %76, 0
  %.pre = load i8, ptr %15, align 2, !tbaa !34, !range !35
  %77 = trunc nuw i8 %.pre to i1
  br i1 %77, label %78, label %84

78:                                               ; preds = %75
  %79 = load i8, ptr %16, align 1, !tbaa !37, !range !35, !noundef !36
  %80 = trunc nuw i8 %79 to i1
  br i1 %80, label %81, label %84

81:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %3) #5
  %82 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %3, i64 noundef 256, ptr noundef nonnull @.str.10, i32 noundef %.02032) #5
  call void @_ZN6basisu15basisu_frontend42dump_endpoint_clusterization_visualizationEPKcb(ptr noundef nonnull align 8 dereferenceable(496) %0, ptr noundef nonnull %3, i1 noundef zeroext false)
  %83 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %3, i64 noundef 256, ptr noundef nonnull @.str.11, i32 noundef %.02032) #5
  call void @_ZN6basisu15basisu_frontend42dump_endpoint_clusterization_visualizationEPKcb(ptr noundef nonnull align 8 dereferenceable(496) %0, ptr noundef nonnull %3, i1 noundef zeroext true)
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %3) #5
  br label %84

84:                                               ; preds = %75, %78, %81, %72
  %.1.shrunk = phi i1 [ %.not21, %81 ], [ %.not21, %78 ], [ %.not21, %75 ], [ false, %72 ]
  call void @_ZN6basisu15basisu_frontend46eliminate_redundant_or_empty_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %0)
  %85 = load i8, ptr %19, align 1, !tbaa !40, !range !35, !noundef !36
  %86 = trunc nuw i8 %85 to i1
  br i1 %86, label %87, label %89

87:                                               ; preds = %84
  %88 = call noundef i32 @_ZNK6basisu6vectorINS0_IjEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %20)
  call void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef nonnull @.str.12, i32 noundef %88)
  br label %89

89:                                               ; preds = %87, %84
  br i1 %.1.shrunk, label %._crit_edge, label %58

._crit_edge:                                      ; preds = %89, %58, %55, %12
  %90 = call noundef zeroext i1 @_ZNK6basisu15basisu_frontend23check_etc1s_constraintsEv(ptr noundef nonnull align 8 dereferenceable(496) %0)
  br i1 %90, label %92, label %91

91:                                               ; preds = %._crit_edge
  call void @_ZN6basisuL21handle_verify_failureEi(i32 noundef 263)
  br label %92

92:                                               ; preds = %._crit_edge, %91
  call void @_ZN6basisu15basisu_frontend32generate_block_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %0)
  call void @_ZN6basisu15basisu_frontend29create_initial_packed_textureEv(ptr noundef nonnull align 8 dereferenceable(496) %0)
  call void @_ZN6basisu15basisu_frontend26generate_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %0)
  %93 = getelementptr inbounds i8, ptr %0, i64 98
  %94 = load i8, ptr %93, align 2, !tbaa !44, !range !35, !noundef !36
  %95 = trunc nuw i8 %94 to i1
  br i1 %95, label %96, label %97

96:                                               ; preds = %92
  call void @_ZN6basisu15basisu_frontend52compute_selector_clusters_within_each_parent_clusterEv(ptr noundef nonnull align 8 dereferenceable(496) %0)
  br label %97

97:                                               ; preds = %96, %92
  %98 = getelementptr inbounds i8, ptr %0, i64 24
  %99 = load i32, ptr %98, align 8, !tbaa !45
  %100 = icmp eq i32 %99, 0
  br i1 %100, label %101, label %102

101:                                              ; preds = %97
  call void @_ZN6basisu15basisu_frontend34create_optimized_selector_codebookEj(ptr noundef nonnull align 8 dereferenceable(496) %0, i32 noundef 0)
  call void @_ZN6basisu15basisu_frontend45find_optimal_selector_clusters_for_each_blockEv(ptr noundef nonnull align 8 dereferenceable(496) %0)
  call void @_ZN6basisu15basisu_frontend35introduce_special_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %0)
  br label %.loopexit

102:                                              ; preds = %97
  %103 = getelementptr inbounds i8, ptr %0, i64 40
  %104 = load ptr, ptr %103, align 8, !tbaa !46
  %.not22 = icmp eq ptr %104, null
  %105 = getelementptr inbounds i8, ptr %0, i64 104
  %106 = load i32, ptr %105, align 8
  %107 = select i1 %.not22, i32 %106, i32 1
  %.not40 = icmp eq i32 %107, 0
  br i1 %.not40, label %.loopexit, label %.lr.ph36

.lr.ph36:                                         ; preds = %102
  %108 = getelementptr inbounds i8, ptr %0, i64 64
  br label %.backedge

.backedge:                                        ; preds = %.backedge.backedge, %.lr.ph36
  %.034 = phi i32 [ 0, %.lr.ph36 ], [ %.034.be, %.backedge.backedge ]
  call void @_ZN6basisu15basisu_frontend34create_optimized_selector_codebookEj(ptr noundef nonnull align 8 dereferenceable(496) %0, i32 noundef %.034)
  call void @_ZN6basisu15basisu_frontend45find_optimal_selector_clusters_for_each_blockEv(ptr noundef nonnull align 8 dereferenceable(496) %0)
  call void @_ZN6basisu15basisu_frontend35introduce_special_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496) %0)
  %109 = load i32, ptr %98, align 8, !tbaa !45
  %110 = icmp ugt i32 %109, 3
  %111 = load i32, ptr %108, align 8
  %112 = icmp eq i32 %111, 3
  %or.cond28 = select i1 %110, i1 true, i1 %112
  br i1 %or.cond28, label %113, label %117

113:                                              ; preds = %.backedge
  %114 = call noundef i32 @_ZN6basisu15basisu_frontend38refine_block_endpoints_given_selectorsEv(ptr noundef nonnull align 8 dereferenceable(496) %0)
  %.not23 = icmp ne i32 %114, 0
  %115 = add nuw i32 %.034, 1
  %116 = icmp ult i32 %115, %107
  %or.cond = select i1 %.not23, i1 %116, i1 false
  br i1 %or.cond, label %.backedge.backedge, label %.loopexit

117:                                              ; preds = %.backedge
  %.old = add nuw i32 %.034, 1
  %.old38 = icmp ult i32 %.old, %107
  br i1 %.old38, label %.backedge.backedge, label %.loopexit

.backedge.backedge:                               ; preds = %117, %113
  %.034.be = phi i32 [ %.old, %117 ], [ %115, %113 ]
  br label %.backedge, !llvm.loop !47

.loopexit:                                        ; preds = %113, %117, %102, %101
  call void @_ZN6basisu15basisu_frontend26optimize_selector_codebookEv(ptr noundef nonnull align 8 dereferenceable(496) %0)
  %118 = getelementptr inbounds i8, ptr %0, i64 29
  %119 = load i8, ptr %118, align 1, !tbaa !40, !range !35, !noundef !36
  %120 = trunc nuw i8 %119 to i1
  br i1 %120, label %121, label %124

121:                                              ; preds = %.loopexit
  %122 = getelementptr inbounds i8, ptr %0, i64 312
  %123 = call noundef i32 @_ZNK6basisu6vectorINS0_IjEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %122)
  call void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef nonnull @.str.13, i32 noundef %123)
  br label %124

124:                                              ; preds = %.loopexit, %121, %10
  call void @_ZN6basisu15basisu_frontend8finalizeEv(ptr noundef nonnull align 8 dereferenceable(496) %0)
  %125 = getelementptr inbounds i8, ptr %0, i64 32
  %126 = load i8, ptr %125, align 8, !tbaa !48, !range !35, !noundef !36
  %127 = trunc nuw i8 %126 to i1
  br i1 %127, label %128, label %130

128:                                              ; preds = %124
  %129 = call noundef zeroext i1 @_ZNK6basisu15basisu_frontend15validate_outputEv(ptr noundef nonnull align 8 dereferenceable(496) %0)
  br i1 %129, label %130, label %131

130:                                              ; preds = %128, %124
  call void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef nonnull @.str.14)
  br label %131

131:                                              ; preds = %128, %130
  %.017 = phi i1 [ true, %130 ], [ false, %128 ]
  ret i1 %.017
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu15basisu_frontend16init_etc1_imagesEv(ptr noundef nonnull align 8 dereferenceable(496)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN6basisu15basisu_frontend21init_global_codebooksEv(ptr noundef nonnull align 8 dereferenceable(496)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu15basisu_frontend30init_endpoint_training_vectorsEv(ptr noundef nonnull align 8 dereferenceable(496)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu15basisu_frontend26generate_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK6basisu15basisu_frontend23check_etc1s_constraintsEv(ptr noundef nonnull align 8 dereferenceable(496)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @_ZN6basisuL21handle_verify_failureEi(i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu15basisu_frontend31introduce_new_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu15basisu_frontend26generate_endpoint_codebookEj(ptr noundef nonnull align 8 dereferenceable(496), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: nofree nounwind
declare noundef i32 @snprintf(ptr noalias nocapture noundef writeonly, i64 noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu15basisu_frontend42dump_endpoint_clusterization_visualizationEPKcb(ptr noundef nonnull align 8 dereferenceable(496), ptr noundef, i1 noundef zeroext) 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) #2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu15basisu_frontend46eliminate_redundant_or_empty_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu15basisu_frontend32generate_block_endpoint_clustersEv(ptr noundef nonnull align 8 dereferenceable(496)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu15basisu_frontend29create_initial_packed_textureEv(ptr noundef nonnull align 8 dereferenceable(496)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu15basisu_frontend26generate_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu15basisu_frontend52compute_selector_clusters_within_each_parent_clusterEv(ptr noundef nonnull align 8 dereferenceable(496)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu15basisu_frontend34create_optimized_selector_codebookEj(ptr noundef nonnull align 8 dereferenceable(496), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu15basisu_frontend45find_optimal_selector_clusters_for_each_blockEv(ptr noundef nonnull align 8 dereferenceable(496)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu15basisu_frontend35introduce_special_selector_clustersEv(ptr noundef nonnull align 8 dereferenceable(496)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu15basisu_frontend26optimize_selector_codebookEv(ptr noundef nonnull align 8 dereferenceable(496)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu15basisu_frontend8finalizeEv(ptr noundef nonnull align 8 dereferenceable(496)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK6basisu15basisu_frontend15validate_outputEv(ptr noundef nonnull align 8 dereferenceable(496)) local_unnamed_addr #1 align 2

attributes #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 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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, !8, i64 0}
!6 = !{!"_ZTSN6basisu15basisu_frontendE", !7, i64 0, !8, i64 88, !8, i64 92, !12, i64 96, !12, i64 97, !12, i64 98, !8, i64 100, !8, i64 104, !15, i64 112, !16, i64 128, !16, i64 144, !16, i64 160, !17, i64 176, !20, i64 216, !20, i64 232, !21, i64 248, !20, i64 264, !22, i64 280, !23, i64 296, !20, i64 312, !16, i64 328, !20, i64 344, !21, i64 360, !20, i64 376, !24, i64 392, !25, i64 408, !26, i64 424, !27, i64 440, !28, i64 456}
!7 = !{!"_ZTSN6basisu15basisu_frontend6paramsE", !8, i64 0, !11, i64 8, !8, i64 16, !8, i64 20, !8, i64 24, !12, i64 28, !12, i64 29, !12, i64 30, !12, i64 31, !12, i64 32, !12, i64 33, !12, i64 34, !11, i64 40, !8, i64 48, !8, i64 52, !12, i64 56, !13, i64 60, !14, i64 64, !11, i64 72, !11, i64 80}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"bool", !9, i64 0}
!13 = !{!"float", !9, i64 0}
!14 = !{!"_ZTSN6basist18basis_texture_typeE", !9, i64 0}
!15 = !{!"_ZTSN6basisu6vectorINS_11pixel_blockEEE", !11, i64 0, !8, i64 8, !8, i64 12}
!16 = !{!"_ZTSN6basisu6vectorINS_9etc_blockEEE", !11, i64 0, !8, i64 8, !8, i64 12}
!17 = !{!"_ZTSN6basisu17tree_vector_quantINS_3vecILj6EfEEEE", !18, i64 0, !19, i64 16, !8, i64 32}
!18 = !{!"_ZTSN6basisu6vectorINS_17tree_vector_quantINS_3vecILj6EfEEE9tsvq_nodeEEE", !11, i64 0, !8, i64 8, !8, i64 12}
!19 = !{!"_ZTSN6basisu6vectorISt4pairINS_3vecILj6EfEEmEEE", !11, i64 0, !8, i64 8, !8, i64 12}
!20 = !{!"_ZTSN6basisu6vectorINS0_IjEEEE", !11, i64 0, !8, i64 8, !8, i64 12}
!21 = !{!"_ZTSN6basisu6vectorIhEE", !11, i64 0, !8, i64 8, !8, i64 12}
!22 = !{!"_ZTSN6basisu6vectorINS_15basisu_frontend27endpoint_cluster_etc_paramsEEE", !11, i64 0, !8, i64 8, !8, i64 12}
!23 = !{!"_ZTSN6basisu6vectorINS_5vec2UEEE", !11, i64 0, !8, i64 8, !8, i64 12}
!24 = !{!"_ZTSN6basisu6vectorIN6basist38etc1_global_selector_codebook_entry_idEEE", !11, i64 0, !8, i64 8, !8, i64 12}
!25 = !{!"_ZTSN6basisu6vectorIbEE", !11, i64 0, !8, i64 8, !8, i64 12}
!26 = !{!"_ZTSN6basisu6vectorIjEE", !11, i64 0, !8, i64 8, !8, i64 12}
!27 = !{!"_ZTSN6basisu6vectorINS_15basisu_frontend27subblock_endpoint_quant_errEEE", !11, i64 0, !8, i64 8, !8, i64 12}
!28 = !{!"_ZTSSt5mutex", !29, i64 0}
!29 = !{!"_ZTSSt12__mutex_base", !9, i64 0}
!30 = !{!6, !8, i64 88}
!31 = !{!6, !8, i64 92}
!32 = !{!6, !11, i64 72}
!33 = !{!6, !8, i64 100}
!34 = !{!6, !12, i64 30}
!35 = !{i8 0, i8 2}
!36 = !{}
!37 = !{!6, !12, i64 31}
!38 = !{!6, !12, i64 96}
!39 = !{!6, !14, i64 64}
!40 = !{!6, !12, i64 29}
!41 = distinct !{!41, !42, !43}
!42 = !{!"llvm.loop.mustprogress"}
!43 = !{!"llvm.loop.peeled.count", i32 1}
!44 = !{!6, !12, i64 98}
!45 = !{!6, !8, i64 24}
!46 = !{!6, !11, i64 40}
!47 = distinct !{!47, !42}
!48 = !{!6, !12, i64 32}


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