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

; 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::color_rgba" = type { %union.anon }
%union.anon = type { [4 x i8] }
%"struct.basisu::etc1_optimizer::potential_solution" = type <{ %"struct.basisu::etc1_solution_coordinates", [4 x i8], %"class.basisu::vector.5", i64, i8, [7 x i8] }>
%"struct.basisu::etc1_solution_coordinates" = type <{ %"class.basisu::color_rgba", i32, i8, [3 x i8] }>
%"class.basisu::vector.5" = type { ptr, i32, i32 }
%"class.basisu::etc1_optimizer" = type { ptr, ptr, i32, %"class.basisu::vec", i32, i32, i32, i32, %"class.basisu::vector", %"class.basisu::vector.3", %"class.basisu::vector.3", ptr, ptr, %"class.basisu::vector.5", %"class.basisu::vector.5", %"struct.basisu::etc1_optimizer::potential_solution", %"struct.basisu::etc1_optimizer::potential_solution", %"class.basisu::vector.5", [128 x i8] }
%"class.basisu::vec" = type { [3 x float] }
%"class.basisu::vector" = type { ptr, i32, i32 }
%"class.basisu::vector.3" = type { ptr, i32, i32 }
%"struct.basisu::etc1_optimizer::params" = type { %"struct.basisu::basis_etc1_pack_params", i32, ptr, i8, ptr, i32, %"class.basisu::color_rgba", i8, i8, ptr }
%"struct.basisu::basis_etc1_pack_params" = type { i32, i8, i8, i8, i8, float }
%struct.anon = type { i8, i8, i8, i8 }

@.str.3 = external hidden unnamed_addr constant [110 x i8], align 1
@_ZN6basisu19g_etc1_inten_tablesE = external dso_local constant [8 x [4 x i32]], align 16
@.str.11 = external hidden unnamed_addr constant [39 x i8], align 1
@__PRETTY_FUNCTION__._ZN6basisu14etc1_optimizer22evaluate_solution_slowERKNS_25etc1_solution_coordinatesERNS0_18potential_solutionEPS4_ = external hidden unnamed_addr constant [131 x i8], align 1
@_ZN6basisuL18g_eval_dist_tablesE = external hidden global [8 x [256 x i8]], align 16

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress 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) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext, ptr noundef nonnull align 1 dereferenceable(4), ptr noundef nonnull align 1 dereferenceable(4), i1 noundef zeroext) #4

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i32 @_ZNK6basisu25etc1_solution_coordinates16get_scaled_colorEv(ptr noundef nonnull align 4 dereferenceable(9)) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN6basisu14etc1_optimizer28check_for_redundant_solutionERKNS_25etc1_solution_coordinatesE(ptr noundef nonnull align 8 dereferenceable(384), ptr noundef nonnull align 4 dereferenceable(9)) #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN6basisu14etc1_optimizer22evaluate_solution_slowERKNS_25etc1_solution_coordinatesERNS0_18potential_solutionEPS4_(ptr noundef nonnull align 8 dereferenceable(384) %0, ptr noundef nonnull align 4 dereferenceable(9) %1, ptr noundef nonnull align 8 dereferenceable(41) %2, ptr noundef %3) #5 align 2 {
  %5 = alloca i1, align 1
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %"class.basisu::color_rgba", align 1
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca [4 x %"class.basisu::color_rgba"], align 16
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i64, align 8
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  %25 = alloca ptr, align 8
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca i8, align 1
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  %30 = load ptr, ptr %6, align 8
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = call noundef zeroext i1 @_ZN6basisu14etc1_optimizer28check_for_redundant_solutionERKNS_25etc1_solution_coordinatesE(ptr noundef nonnull align 8 dereferenceable(384) %30, ptr noundef nonnull align 4 dereferenceable(9) %31)
  br i1 %32, label %34, label %33

33:                                               ; preds = %4
  store i1 false, ptr %5, align 1
  br label %358

34:                                               ; preds = %4
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = getelementptr inbounds %"struct.basisu::etc1_optimizer::potential_solution", ptr %35, i32 0, i32 4
  store i8 0, ptr %36, align 8, !tbaa !9
  %37 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %30, i32 0, i32 0
  %38 = load ptr, ptr %37, align 8, !tbaa !17
  %39 = getelementptr inbounds %"struct.basisu::etc1_optimizer::params", ptr %38, i32 0, i32 7
  %40 = load i8, ptr %39, align 8, !tbaa !22, !range !27, !noundef !28
  %41 = trunc i8 %40 to i1
  br i1 %41, label %42, label %101

42:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %43 = load ptr, ptr %7, align 8, !tbaa !5
  %44 = getelementptr inbounds %"struct.basisu::etc1_solution_coordinates", ptr %43, i32 0, i32 0
  %45 = getelementptr inbounds %"class.basisu::color_rgba", ptr %44, i32 0, i32 0
  %46 = getelementptr inbounds %struct.anon, ptr %45, i32 0, i32 0
  %47 = load i8, ptr %46, align 4, !tbaa !29
  %48 = zext i8 %47 to i32
  %49 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %30, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8, !tbaa !17
  %51 = getelementptr inbounds %"struct.basisu::etc1_optimizer::params", ptr %50, i32 0, i32 6
  %52 = getelementptr inbounds %"class.basisu::color_rgba", ptr %51, i32 0, i32 0
  %53 = getelementptr inbounds %struct.anon, ptr %52, i32 0, i32 0
  %54 = load i8, ptr %53, align 4, !tbaa !29
  %55 = zext i8 %54 to i32
  %56 = sub nsw i32 %48, %55
  store i32 %56, ptr %10, align 4, !tbaa !30
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = getelementptr inbounds %"struct.basisu::etc1_solution_coordinates", ptr %57, i32 0, i32 0
  %59 = getelementptr inbounds %"class.basisu::color_rgba", ptr %58, i32 0, i32 0
  %60 = getelementptr inbounds %struct.anon, ptr %59, i32 0, i32 1
  %61 = load i8, ptr %60, align 1, !tbaa !29
  %62 = zext i8 %61 to i32
  %63 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %30, i32 0, i32 0
  %64 = load ptr, ptr %63, align 8, !tbaa !17
  %65 = getelementptr inbounds %"struct.basisu::etc1_optimizer::params", ptr %64, i32 0, i32 6
  %66 = getelementptr inbounds %"class.basisu::color_rgba", ptr %65, i32 0, i32 0
  %67 = getelementptr inbounds %struct.anon, ptr %66, i32 0, i32 1
  %68 = load i8, ptr %67, align 1, !tbaa !29
  %69 = zext i8 %68 to i32
  %70 = sub nsw i32 %62, %69
  store i32 %70, ptr %11, align 4, !tbaa !30
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %71 = load ptr, ptr %7, align 8, !tbaa !5
  %72 = getelementptr inbounds %"struct.basisu::etc1_solution_coordinates", ptr %71, i32 0, i32 0
  %73 = getelementptr inbounds %"class.basisu::color_rgba", ptr %72, i32 0, i32 0
  %74 = getelementptr inbounds %struct.anon, ptr %73, i32 0, i32 2
  %75 = load i8, ptr %74, align 2, !tbaa !29
  %76 = zext i8 %75 to i32
  %77 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %30, i32 0, i32 0
  %78 = load ptr, ptr %77, align 8, !tbaa !17
  %79 = getelementptr inbounds %"struct.basisu::etc1_optimizer::params", ptr %78, i32 0, i32 6
  %80 = getelementptr inbounds %"class.basisu::color_rgba", ptr %79, i32 0, i32 0
  %81 = getelementptr inbounds %struct.anon, ptr %80, i32 0, i32 2
  %82 = load i8, ptr %81, align 2, !tbaa !29
  %83 = zext i8 %82 to i32
  %84 = sub nsw i32 %76, %83
  store i32 %84, ptr %12, align 4, !tbaa !30
  %85 = load i32, ptr %10, align 4, !tbaa !30
  %86 = load i32, ptr %11, align 4, !tbaa !30
  %87 = load i32, ptr %12, align 4, !tbaa !30
  %88 = call noundef i32 @_ZN6basisu7minimumIiEET_S1_S1_S1_(i32 noundef %85, i32 noundef %86, i32 noundef %87)
  %89 = icmp slt i32 %88, -4
  br i1 %89, label %96, label %90

90:                                               ; preds = %42
  %91 = load i32, ptr %10, align 4, !tbaa !30
  %92 = load i32, ptr %11, align 4, !tbaa !30
  %93 = load i32, ptr %12, align 4, !tbaa !30
  %94 = call noundef i32 @_ZN6basisu7maximumIiEET_S1_S1_S1_(i32 noundef %91, i32 noundef %92, i32 noundef %93)
  %95 = icmp sgt i32 %94, 3
  br i1 %95, label %96, label %97

96:                                               ; preds = %90, %42
  store i1 false, ptr %5, align 1
  store i32 1, ptr %13, align 4
  br label %98

97:                                               ; preds = %90
  store i32 0, ptr %13, align 4
  br label %98

98:                                               ; preds = %97, %96
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  %99 = load i32, ptr %13, align 4
  switch i32 %99, label %360 [
    i32 0, label %100
    i32 1, label %358
  ]

100:                                              ; preds = %98
  br label %101

101:                                              ; preds = %100, %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %102 = load ptr, ptr %7, align 8, !tbaa !5
  %103 = call i32 @_ZNK6basisu25etc1_solution_coordinates16get_scaled_colorEv(ptr noundef nonnull align 4 dereferenceable(9) %102)
  %104 = getelementptr inbounds %"class.basisu::color_rgba", ptr %14, i32 0, i32 0
  %105 = getelementptr inbounds %union.anon, ptr %104, i32 0, i32 0
  store i32 %103, ptr %105, align 1
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %106 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %30, i32 0, i32 0
  %107 = load ptr, ptr %106, align 8, !tbaa !17
  %108 = getelementptr inbounds %"struct.basisu::etc1_optimizer::params", ptr %107, i32 0, i32 1
  %109 = load i32, ptr %108, align 4, !tbaa !31
  store i32 %109, ptr %15, align 4, !tbaa !30
  %110 = load ptr, ptr %8, align 8, !tbaa !5
  %111 = getelementptr inbounds %"struct.basisu::etc1_optimizer::potential_solution", ptr %110, i32 0, i32 2
  %112 = call noundef i32 @_ZNK6basisu6vectorIhE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %111)
  %113 = load i32, ptr %15, align 4, !tbaa !30
  %114 = icmp eq i32 %112, %113
  br i1 %114, label %115, label %116

115:                                              ; preds = %101
  br label %118

116:                                              ; preds = %101
  call void @__assert_fail(ptr noundef @.str.11, ptr noundef @.str.3, i32 noundef 1116, ptr noundef @__PRETTY_FUNCTION__._ZN6basisu14etc1_optimizer22evaluate_solution_slowERKNS_25etc1_solution_coordinatesERNS0_18potential_solutionEPS4_) #7
  unreachable

117:                                              ; No predecessors!
  br label %118

118:                                              ; preds = %117, %115
  %119 = load ptr, ptr %8, align 8, !tbaa !5
  %120 = getelementptr inbounds %"struct.basisu::etc1_optimizer::potential_solution", ptr %119, i32 0, i32 3
  store i64 9223372036854775807, ptr %120, align 8, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %121 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %30, i32 0, i32 0
  %122 = load ptr, ptr %121, align 8, !tbaa !17
  %123 = getelementptr inbounds %"struct.basisu::etc1_optimizer::params", ptr %122, i32 0, i32 9
  %124 = load ptr, ptr %123, align 8, !tbaa !33
  store ptr %124, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  store i32 0, ptr %17, align 4, !tbaa !30
  br label %125

125:                                              ; preds = %322, %118
  %126 = load i32, ptr %17, align 4, !tbaa !30
  %127 = icmp ult i32 %126, 8
  br i1 %127, label %129, label %128

128:                                              ; preds = %125
  store i32 2, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %325

129:                                              ; preds = %125
  %130 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %30, i32 0, i32 0
  %131 = load ptr, ptr %130, align 8, !tbaa !17
  %132 = getelementptr inbounds %"struct.basisu::basis_etc1_pack_params", ptr %131, i32 0, i32 0
  %133 = load i32, ptr %132, align 8, !tbaa !34
  %134 = icmp sle i32 %133, 1
  br i1 %134, label %135, label %147

135:                                              ; preds = %129
  %136 = load i32, ptr %17, align 4, !tbaa !30
  %137 = zext i32 %136 to i64
  %138 = getelementptr inbounds [8 x [256 x i8]], ptr @_ZN6basisuL18g_eval_dist_tablesE, i64 0, i64 %137
  %139 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %30, i32 0, i32 7
  %140 = load i32, ptr %139, align 4, !tbaa !35
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [256 x i8], ptr %138, i64 0, i64 %141
  %143 = load i8, ptr %142, align 1, !tbaa !29
  %144 = icmp ne i8 %143, 0
  br i1 %144, label %146, label %145

145:                                              ; preds = %135
  br label %322

146:                                              ; preds = %135
  br label %147

147:                                              ; preds = %146, %129
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %148 = load i32, ptr %17, align 4, !tbaa !30
  %149 = zext i32 %148 to i64
  %150 = getelementptr inbounds [8 x [4 x i32]], ptr @_ZN6basisu19g_etc1_inten_tablesE, i64 0, i64 %149
  %151 = getelementptr inbounds [4 x i32], ptr %150, i64 0, i64 0
  store ptr %151, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #6
  %152 = getelementptr inbounds [4 x %"class.basisu::color_rgba"], ptr %19, i32 0, i32 0
  %153 = getelementptr inbounds %"class.basisu::color_rgba", ptr %152, i64 4
  br label %154

154:                                              ; preds = %154, %147
  %155 = phi ptr [ %152, %147 ], [ %156, %154 ]
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %155)
  %156 = getelementptr inbounds %"class.basisu::color_rgba", ptr %155, i64 1
  %157 = icmp eq ptr %156, %153
  br i1 %157, label %158, label %154

158:                                              ; preds = %154
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  store i32 0, ptr %20, align 4, !tbaa !30
  br label %159

159:                                              ; preds = %191, %158
  %160 = load i32, ptr %20, align 4, !tbaa !30
  %161 = icmp ult i32 %160, 4
  br i1 %161, label %163, label %162

162:                                              ; preds = %159
  store i32 5, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  br label %194

163:                                              ; preds = %159
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  %164 = load ptr, ptr %18, align 8, !tbaa !5
  %165 = load i32, ptr %20, align 4, !tbaa !30
  %166 = zext i32 %165 to i64
  %167 = getelementptr inbounds i32, ptr %164, i64 %166
  %168 = load i32, ptr %167, align 4, !tbaa !30
  store i32 %168, ptr %21, align 4, !tbaa !30
  %169 = load i32, ptr %20, align 4, !tbaa !30
  %170 = zext i32 %169 to i64
  %171 = getelementptr inbounds [4 x %"class.basisu::color_rgba"], ptr %19, i64 0, i64 %170
  %172 = getelementptr inbounds %"class.basisu::color_rgba", ptr %14, i32 0, i32 0
  %173 = getelementptr inbounds %struct.anon, ptr %172, i32 0, i32 0
  %174 = load i8, ptr %173, align 1, !tbaa !29
  %175 = zext i8 %174 to i32
  %176 = load i32, ptr %21, align 4, !tbaa !30
  %177 = add nsw i32 %175, %176
  %178 = getelementptr inbounds %"class.basisu::color_rgba", ptr %14, i32 0, i32 0
  %179 = getelementptr inbounds %struct.anon, ptr %178, i32 0, i32 1
  %180 = load i8, ptr %179, align 1, !tbaa !29
  %181 = zext i8 %180 to i32
  %182 = load i32, ptr %21, align 4, !tbaa !30
  %183 = add nsw i32 %181, %182
  %184 = getelementptr inbounds %"class.basisu::color_rgba", ptr %14, i32 0, i32 0
  %185 = getelementptr inbounds %struct.anon, ptr %184, i32 0, i32 2
  %186 = load i8, ptr %185, align 1, !tbaa !29
  %187 = zext i8 %186 to i32
  %188 = load i32, ptr %21, align 4, !tbaa !30
  %189 = add nsw i32 %187, %188
  %190 = call noundef nonnull align 1 dereferenceable(4) ptr @_ZN6basisu10color_rgba3setEiiii(ptr noundef nonnull align 1 dereferenceable(4) %171, i32 noundef %177, i32 noundef %183, i32 noundef %189, i32 noundef 255)
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %191

191:                                              ; preds = %163
  %192 = load i32, ptr %20, align 4, !tbaa !30
  %193 = add i32 %192, 1
  store i32 %193, ptr %20, align 4, !tbaa !30
  br label %159, !llvm.loop !36

194:                                              ; preds = %162
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #6
  store i64 0, ptr %22, align 8, !tbaa !38
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #6
  %195 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %30, i32 0, i32 0
  %196 = load ptr, ptr %195, align 8, !tbaa !17
  %197 = getelementptr inbounds %"struct.basisu::etc1_optimizer::params", ptr %196, i32 0, i32 2
  %198 = load ptr, ptr %197, align 8, !tbaa !39
  store ptr %198, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #6
  store i32 0, ptr %24, align 4, !tbaa !30
  br label %199

199:                                              ; preds = %298, %194
  %200 = load i32, ptr %24, align 4, !tbaa !30
  %201 = load i32, ptr %15, align 4, !tbaa !30
  %202 = icmp ult i32 %200, %201
  br i1 %202, label %204, label %203

203:                                              ; preds = %199
  store i32 8, ptr %13, align 4
  br label %301

204:                                              ; preds = %199
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #6
  %205 = load ptr, ptr %23, align 8, !tbaa !5
  %206 = getelementptr inbounds %"class.basisu::color_rgba", ptr %205, i32 1
  store ptr %206, ptr %23, align 8, !tbaa !5
  store ptr %205, ptr %25, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #6
  store i32 0, ptr %26, align 4, !tbaa !30
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #6
  store i32 0, ptr %27, align 4, !tbaa !30
  %207 = load ptr, ptr %16, align 8, !tbaa !5
  %208 = icmp ne ptr %207, null
  br i1 %208, label %209, label %226

209:                                              ; preds = %204
  %210 = load ptr, ptr %16, align 8, !tbaa !5
  %211 = load i32, ptr %24, align 4, !tbaa !30
  %212 = zext i32 %211 to i64
  %213 = getelementptr inbounds i8, ptr %210, i64 %212
  %214 = load i8, ptr %213, align 1, !tbaa !29
  %215 = zext i8 %214 to i32
  store i32 %215, ptr %26, align 4, !tbaa !30
  %216 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %30, i32 0, i32 0
  %217 = load ptr, ptr %216, align 8, !tbaa !17
  %218 = getelementptr inbounds %"struct.basisu::basis_etc1_pack_params", ptr %217, i32 0, i32 1
  %219 = load i8, ptr %218, align 4, !tbaa !40, !range !27, !noundef !28
  %220 = trunc i8 %219 to i1
  %221 = load ptr, ptr %25, align 8, !tbaa !5
  %222 = load i32, ptr %26, align 4, !tbaa !30
  %223 = zext i32 %222 to i64
  %224 = getelementptr inbounds [4 x %"class.basisu::color_rgba"], ptr %19, i64 0, i64 %223
  %225 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %220, ptr noundef nonnull align 1 dereferenceable(4) %221, ptr noundef nonnull align 1 dereferenceable(4) %224, i1 noundef zeroext false)
  store i32 %225, ptr %27, align 4, !tbaa !30
  br label %277

226:                                              ; preds = %204
  %227 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %30, i32 0, i32 0
  %228 = load ptr, ptr %227, align 8, !tbaa !17
  %229 = getelementptr inbounds %"struct.basisu::basis_etc1_pack_params", ptr %228, i32 0, i32 1
  %230 = load i8, ptr %229, align 4, !tbaa !40, !range !27, !noundef !28
  %231 = trunc i8 %230 to i1
  %232 = load ptr, ptr %25, align 8, !tbaa !5
  %233 = getelementptr inbounds [4 x %"class.basisu::color_rgba"], ptr %19, i64 0, i64 0
  %234 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %231, ptr noundef nonnull align 1 dereferenceable(4) %232, ptr noundef nonnull align 1 dereferenceable(4) %233, i1 noundef zeroext false)
  store i32 %234, ptr %27, align 4, !tbaa !30
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #6
  %235 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %30, i32 0, i32 0
  %236 = load ptr, ptr %235, align 8, !tbaa !17
  %237 = getelementptr inbounds %"struct.basisu::basis_etc1_pack_params", ptr %236, i32 0, i32 1
  %238 = load i8, ptr %237, align 4, !tbaa !40, !range !27, !noundef !28
  %239 = trunc i8 %238 to i1
  %240 = load ptr, ptr %25, align 8, !tbaa !5
  %241 = getelementptr inbounds [4 x %"class.basisu::color_rgba"], ptr %19, i64 0, i64 1
  %242 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %239, ptr noundef nonnull align 1 dereferenceable(4) %240, ptr noundef nonnull align 1 dereferenceable(4) %241, i1 noundef zeroext false)
  store i32 %242, ptr %28, align 4, !tbaa !30
  %243 = load i32, ptr %28, align 4, !tbaa !30
  %244 = load i32, ptr %27, align 4, !tbaa !30
  %245 = icmp ult i32 %243, %244
  br i1 %245, label %246, label %248

246:                                              ; preds = %226
  %247 = load i32, ptr %28, align 4, !tbaa !30
  store i32 %247, ptr %27, align 4, !tbaa !30
  store i32 1, ptr %26, align 4, !tbaa !30
  br label %248

248:                                              ; preds = %246, %226
  %249 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %30, i32 0, i32 0
  %250 = load ptr, ptr %249, align 8, !tbaa !17
  %251 = getelementptr inbounds %"struct.basisu::basis_etc1_pack_params", ptr %250, i32 0, i32 1
  %252 = load i8, ptr %251, align 4, !tbaa !40, !range !27, !noundef !28
  %253 = trunc i8 %252 to i1
  %254 = load ptr, ptr %25, align 8, !tbaa !5
  %255 = getelementptr inbounds [4 x %"class.basisu::color_rgba"], ptr %19, i64 0, i64 2
  %256 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %253, ptr noundef nonnull align 1 dereferenceable(4) %254, ptr noundef nonnull align 1 dereferenceable(4) %255, i1 noundef zeroext false)
  store i32 %256, ptr %28, align 4, !tbaa !30
  %257 = load i32, ptr %28, align 4, !tbaa !30
  %258 = load i32, ptr %27, align 4, !tbaa !30
  %259 = icmp ult i32 %257, %258
  br i1 %259, label %260, label %262

260:                                              ; preds = %248
  %261 = load i32, ptr %28, align 4, !tbaa !30
  store i32 %261, ptr %27, align 4, !tbaa !30
  store i32 2, ptr %26, align 4, !tbaa !30
  br label %262

262:                                              ; preds = %260, %248
  %263 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %30, i32 0, i32 0
  %264 = load ptr, ptr %263, align 8, !tbaa !17
  %265 = getelementptr inbounds %"struct.basisu::basis_etc1_pack_params", ptr %264, i32 0, i32 1
  %266 = load i8, ptr %265, align 4, !tbaa !40, !range !27, !noundef !28
  %267 = trunc i8 %266 to i1
  %268 = load ptr, ptr %25, align 8, !tbaa !5
  %269 = getelementptr inbounds [4 x %"class.basisu::color_rgba"], ptr %19, i64 0, i64 3
  %270 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %267, ptr noundef nonnull align 1 dereferenceable(4) %268, ptr noundef nonnull align 1 dereferenceable(4) %269, i1 noundef zeroext false)
  store i32 %270, ptr %28, align 4, !tbaa !30
  %271 = load i32, ptr %28, align 4, !tbaa !30
  %272 = load i32, ptr %27, align 4, !tbaa !30
  %273 = icmp ult i32 %271, %272
  br i1 %273, label %274, label %276

274:                                              ; preds = %262
  %275 = load i32, ptr %28, align 4, !tbaa !30
  store i32 %275, ptr %27, align 4, !tbaa !30
  store i32 3, ptr %26, align 4, !tbaa !30
  br label %276

276:                                              ; preds = %274, %262
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #6
  br label %277

277:                                              ; preds = %276, %209
  %278 = load i32, ptr %26, align 4, !tbaa !30
  %279 = trunc i32 %278 to i8
  %280 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %30, i32 0, i32 17
  %281 = load i32, ptr %24, align 4, !tbaa !30
  %282 = zext i32 %281 to i64
  %283 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu6vectorIhEixEm(ptr noundef nonnull align 8 dereferenceable(16) %280, i64 noundef %282)
  store i8 %279, ptr %283, align 1, !tbaa !29
  %284 = load i32, ptr %27, align 4, !tbaa !30
  %285 = zext i32 %284 to i64
  %286 = load i64, ptr %22, align 8, !tbaa !38
  %287 = add i64 %286, %285
  store i64 %287, ptr %22, align 8, !tbaa !38
  %288 = load i64, ptr %22, align 8, !tbaa !38
  %289 = load ptr, ptr %8, align 8, !tbaa !5
  %290 = getelementptr inbounds %"struct.basisu::etc1_optimizer::potential_solution", ptr %289, i32 0, i32 3
  %291 = load i64, ptr %290, align 8, !tbaa !32
  %292 = icmp uge i64 %288, %291
  br i1 %292, label %293, label %294

293:                                              ; preds = %277
  store i32 8, ptr %13, align 4
  br label %295

294:                                              ; preds = %277
  store i32 0, ptr %13, align 4
  br label %295

295:                                              ; preds = %294, %293
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #6
  %296 = load i32, ptr %13, align 4
  switch i32 %296, label %301 [
    i32 0, label %297
  ]

297:                                              ; preds = %295
  br label %298

298:                                              ; preds = %297
  %299 = load i32, ptr %24, align 4, !tbaa !30
  %300 = add i32 %299, 1
  store i32 %300, ptr %24, align 4, !tbaa !30
  br label %199, !llvm.loop !41

301:                                              ; preds = %295, %203
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  br label %302

302:                                              ; preds = %301
  %303 = load i64, ptr %22, align 8, !tbaa !38
  %304 = load ptr, ptr %8, align 8, !tbaa !5
  %305 = getelementptr inbounds %"struct.basisu::etc1_optimizer::potential_solution", ptr %304, i32 0, i32 3
  %306 = load i64, ptr %305, align 8, !tbaa !32
  %307 = icmp ult i64 %303, %306
  br i1 %307, label %308, label %321

308:                                              ; preds = %302
  %309 = load i64, ptr %22, align 8, !tbaa !38
  %310 = load ptr, ptr %8, align 8, !tbaa !5
  %311 = getelementptr inbounds %"struct.basisu::etc1_optimizer::potential_solution", ptr %310, i32 0, i32 3
  store i64 %309, ptr %311, align 8, !tbaa !32
  %312 = load i32, ptr %17, align 4, !tbaa !30
  %313 = load ptr, ptr %8, align 8, !tbaa !5
  %314 = getelementptr inbounds %"struct.basisu::etc1_optimizer::potential_solution", ptr %313, i32 0, i32 0
  %315 = getelementptr inbounds %"struct.basisu::etc1_solution_coordinates", ptr %314, i32 0, i32 1
  store i32 %312, ptr %315, align 4, !tbaa !42
  %316 = load ptr, ptr %8, align 8, !tbaa !5
  %317 = getelementptr inbounds %"struct.basisu::etc1_optimizer::potential_solution", ptr %316, i32 0, i32 2
  %318 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %30, i32 0, i32 17
  call void @_ZN6basisu6vectorIhE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(16) %317, ptr noundef nonnull align 8 dereferenceable(16) %318)
  %319 = load ptr, ptr %8, align 8, !tbaa !5
  %320 = getelementptr inbounds %"struct.basisu::etc1_optimizer::potential_solution", ptr %319, i32 0, i32 4
  store i8 1, ptr %320, align 8, !tbaa !9
  br label %321

321:                                              ; preds = %308, %302
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  br label %322

322:                                              ; preds = %321, %145
  %323 = load i32, ptr %17, align 4, !tbaa !30
  %324 = add i32 %323, 1
  store i32 %324, ptr %17, align 4, !tbaa !30
  br label %125, !llvm.loop !43

325:                                              ; preds = %128
  %326 = load ptr, ptr %7, align 8, !tbaa !5
  %327 = getelementptr inbounds %"struct.basisu::etc1_solution_coordinates", ptr %326, i32 0, i32 0
  %328 = load ptr, ptr %8, align 8, !tbaa !5
  %329 = getelementptr inbounds %"struct.basisu::etc1_optimizer::potential_solution", ptr %328, i32 0, i32 0
  %330 = getelementptr inbounds %"struct.basisu::etc1_solution_coordinates", ptr %329, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %330, ptr align 4 %327, i64 4, i1 false), !tbaa.struct !44
  %331 = getelementptr inbounds %"class.basisu::etc1_optimizer", ptr %30, i32 0, i32 0
  %332 = load ptr, ptr %331, align 8, !tbaa !17
  %333 = getelementptr inbounds %"struct.basisu::etc1_optimizer::params", ptr %332, i32 0, i32 3
  %334 = load i8, ptr %333, align 8, !tbaa !45, !range !27, !noundef !28
  %335 = trunc i8 %334 to i1
  %336 = load ptr, ptr %8, align 8, !tbaa !5
  %337 = getelementptr inbounds %"struct.basisu::etc1_optimizer::potential_solution", ptr %336, i32 0, i32 0
  %338 = getelementptr inbounds %"struct.basisu::etc1_solution_coordinates", ptr %337, i32 0, i32 2
  %339 = zext i1 %335 to i8
  store i8 %339, ptr %338, align 8, !tbaa !46
  call void @llvm.lifetime.start.p0(i64 1, ptr %29) #6
  store i8 0, ptr %29, align 1, !tbaa !47
  %340 = load ptr, ptr %9, align 8, !tbaa !5
  %341 = icmp ne ptr %340, null
  br i1 %341, label %342, label %355

342:                                              ; preds = %325
  %343 = load ptr, ptr %8, align 8, !tbaa !5
  %344 = getelementptr inbounds %"struct.basisu::etc1_optimizer::potential_solution", ptr %343, i32 0, i32 3
  %345 = load i64, ptr %344, align 8, !tbaa !32
  %346 = load ptr, ptr %9, align 8, !tbaa !5
  %347 = getelementptr inbounds %"struct.basisu::etc1_optimizer::potential_solution", ptr %346, i32 0, i32 3
  %348 = load i64, ptr %347, align 8, !tbaa !32
  %349 = icmp ult i64 %345, %348
  br i1 %349, label %350, label %354

350:                                              ; preds = %342
  %351 = load ptr, ptr %8, align 8, !tbaa !5
  %352 = load ptr, ptr %9, align 8, !tbaa !5
  %353 = call noundef nonnull align 8 dereferenceable(41) ptr @_ZN6basisu14etc1_optimizer18potential_solutionaSERKS1_(ptr noundef nonnull align 8 dereferenceable(41) %352, ptr noundef nonnull align 8 dereferenceable(41) %351)
  store i8 1, ptr %29, align 1, !tbaa !47
  br label %354

354:                                              ; preds = %350, %342
  br label %355

355:                                              ; preds = %354, %325
  %356 = load i8, ptr %29, align 1, !tbaa !47, !range !27, !noundef !28
  %357 = trunc i8 %356 to i1
  store i1 %357, ptr %5, align 1
  store i32 1, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %29) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %358

358:                                              ; preds = %355, %98, %33
  %359 = load i1, ptr %5, align 1
  ret i1 %359

360:                                              ; preds = %98
  unreachable
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN6basisu7maximumIiEET_S1_S1_S1_(i32 noundef, i32 noundef, i32 noundef) #4

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn 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 #2 = { nocallback nofree 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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { noreturn 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, !14, i64 40}
!10 = !{!"_ZTSN6basisu14etc1_optimizer18potential_solutionE", !11, i64 0, !15, i64 16, !16, i64 32, !14, i64 40}
!11 = !{!"_ZTSN6basisu25etc1_solution_coordinatesE", !12, i64 0, !13, i64 4, !14, i64 8}
!12 = !{!"_ZTSN6basisu10color_rgbaE", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!"_ZTSN6basisu6vectorIhEE", !6, i64 0, !13, i64 8, !13, i64 12}
!16 = !{!"long", !7, i64 0}
!17 = !{!18, !6, i64 0}
!18 = !{!"_ZTSN6basisu14etc1_optimizerE", !6, i64 0, !6, i64 8, !13, i64 16, !19, i64 20, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !20, i64 48, !21, i64 64, !21, i64 80, !6, i64 96, !6, i64 104, !15, i64 112, !15, i64 128, !10, i64 144, !10, i64 192, !15, i64 240, !7, i64 256}
!19 = !{!"_ZTSN6basisu3vecILj3EfEE", !7, i64 0}
!20 = !{!"_ZTSN6basisu6vectorItEE", !6, i64 0, !13, i64 8, !13, i64 12}
!21 = !{!"_ZTSN6basisu6vectorIjEE", !6, i64 0, !13, i64 8, !13, i64 12}
!22 = !{!23, !14, i64 48}
!23 = !{!"_ZTSN6basisu14etc1_optimizer6paramsE", !24, i64 0, !13, i64 12, !6, i64 16, !14, i64 24, !6, i64 32, !13, i64 40, !12, i64 44, !14, i64 48, !14, i64 49, !6, i64 56}
!24 = !{!"_ZTSN6basisu22basis_etc1_pack_paramsE", !25, i64 0, !14, i64 4, !14, i64 5, !14, i64 6, !14, i64 7, !26, i64 8}
!25 = !{!"_ZTSN6basisu17basis_etc_qualityE", !7, i64 0}
!26 = !{!"float", !7, i64 0}
!27 = !{i8 0, i8 2}
!28 = !{}
!29 = !{!7, !7, i64 0}
!30 = !{!13, !13, i64 0}
!31 = !{!23, !13, i64 12}
!32 = !{!10, !16, i64 32}
!33 = !{!23, !6, i64 56}
!34 = !{!24, !25, i64 0}
!35 = !{!18, !13, i64 44}
!36 = distinct !{!36, !37}
!37 = !{!"llvm.loop.mustprogress"}
!38 = !{!16, !16, i64 0}
!39 = !{!23, !6, i64 16}
!40 = !{!24, !14, i64 4}
!41 = distinct !{!41, !37}
!42 = !{!10, !13, i64 4}
!43 = distinct !{!43, !37}
!44 = !{i64 0, i64 4, !29}
!45 = !{!23, !14, i64 24}
!46 = !{!10, !14, i64 8}
!47 = !{!14, !14, i64 0}


; 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::color_rgba" = type { %union.anon }
%union.anon = type { [4 x i8] }

@.str.3 = external hidden unnamed_addr constant [110 x i8], align 1
@_ZN6basisu19g_etc1_inten_tablesE = external dso_local local_unnamed_addr constant [8 x [4 x i32]], align 16
@.str.11 = external hidden unnamed_addr constant [39 x i8], align 1
@__PRETTY_FUNCTION__._ZN6basisu14etc1_optimizer22evaluate_solution_slowERKNS_25etc1_solution_coordinatesERNS0_18potential_solutionEPS4_ = external hidden unnamed_addr constant [131 x i8], align 1
@_ZN6basisuL18g_eval_dist_tablesE = external hidden local_unnamed_addr global [8 x [256 x i8]], align 16

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: inlinehint mustprogress 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 #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext, ptr noundef nonnull align 1 dereferenceable(4), ptr noundef nonnull align 1 dereferenceable(4), i1 noundef zeroext) local_unnamed_addr #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i32 @_ZNK6basisu25etc1_solution_coordinates16get_scaled_colorEv(ptr noundef nonnull align 4 dereferenceable(9)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN6basisu14etc1_optimizer28check_for_redundant_solutionERKNS_25etc1_solution_coordinatesE(ptr noundef nonnull align 8 dereferenceable(384), ptr noundef nonnull align 4 dereferenceable(9)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN6basisu14etc1_optimizer22evaluate_solution_slowERKNS_25etc1_solution_coordinatesERNS0_18potential_solutionEPS4_(ptr noundef nonnull align 8 dereferenceable(384) %0, ptr noundef nonnull align 4 dereferenceable(9) %1, ptr noundef nonnull align 8 dereferenceable(41) %2, ptr noundef %3) local_unnamed_addr #4 align 2 {
  %5 = alloca [4 x %"class.basisu::color_rgba"], align 16
  %6 = tail call noundef zeroext i1 @_ZN6basisu14etc1_optimizer28check_for_redundant_solutionERKNS_25etc1_solution_coordinatesE(ptr noundef nonnull align 8 dereferenceable(384) %0, ptr noundef nonnull align 4 dereferenceable(9) %1)
  br i1 %6, label %7, label %.thread

7:                                                ; preds = %4
  %8 = getelementptr inbounds i8, ptr %2, i64 40
  store i8 0, ptr %8, align 8, !tbaa !5
  %9 = load ptr, ptr %0, align 8, !tbaa !16
  %10 = getelementptr inbounds i8, ptr %9, i64 48
  %11 = load i8, ptr %10, align 8, !tbaa !21, !range !26, !noundef !27
  %12 = trunc nuw i8 %11 to i1
  br i1 %12, label %13, label %39

13:                                               ; preds = %7
  %14 = load i8, ptr %1, align 4, !tbaa !28
  %15 = zext i8 %14 to i32
  %16 = getelementptr inbounds i8, ptr %9, i64 44
  %17 = load i8, ptr %16, align 4, !tbaa !28
  %18 = zext i8 %17 to i32
  %19 = sub nsw i32 %15, %18
  %20 = getelementptr inbounds i8, ptr %1, i64 1
  %21 = load i8, ptr %20, align 1, !tbaa !28
  %22 = zext i8 %21 to i32
  %23 = getelementptr inbounds i8, ptr %9, i64 45
  %24 = load i8, ptr %23, align 1, !tbaa !28
  %25 = zext i8 %24 to i32
  %26 = sub nsw i32 %22, %25
  %27 = getelementptr inbounds i8, ptr %1, i64 2
  %28 = load i8, ptr %27, align 2, !tbaa !28
  %29 = zext i8 %28 to i32
  %30 = getelementptr inbounds i8, ptr %9, i64 46
  %31 = load i8, ptr %30, align 2, !tbaa !28
  %32 = zext i8 %31 to i32
  %33 = sub nsw i32 %29, %32
  %34 = tail call noundef i32 @_ZN6basisu7minimumIiEET_S1_S1_S1_(i32 noundef %19, i32 noundef %26, i32 noundef %33)
  %35 = icmp slt i32 %34, -4
  br i1 %35, label %.thread, label %36

36:                                               ; preds = %13
  %37 = tail call noundef i32 @_ZN6basisu7maximumIiEET_S1_S1_S1_(i32 noundef %19, i32 noundef %26, i32 noundef %33)
  %38 = icmp slt i32 %37, 4
  br i1 %38, label %39, label %.thread

39:                                               ; preds = %36, %7
  %40 = tail call i32 @_ZNK6basisu25etc1_solution_coordinates16get_scaled_colorEv(ptr noundef nonnull align 4 dereferenceable(9) %1)
  %41 = load ptr, ptr %0, align 8, !tbaa !16
  %42 = getelementptr inbounds i8, ptr %41, i64 12
  %43 = load i32, ptr %42, align 4, !tbaa !29
  %.fr126 = freeze i32 %43
  %44 = getelementptr inbounds i8, ptr %2, i64 16
  %45 = tail call noundef i32 @_ZNK6basisu6vectorIhE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %44)
  %46 = icmp eq i32 %45, %.fr126
  br i1 %46, label %48, label %47

47:                                               ; preds = %39
  tail call void @__assert_fail(ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.3, i32 noundef 1116, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6basisu14etc1_optimizer22evaluate_solution_slowERKNS_25etc1_solution_coordinatesERNS0_18potential_solutionEPS4_) #6
  unreachable

48:                                               ; preds = %39
  %.sroa.5.0.extract.shift = lshr i32 %40, 16
  %.sroa.4.0.extract.shift = lshr i32 %40, 8
  %49 = getelementptr inbounds i8, ptr %2, i64 32
  store i64 9223372036854775807, ptr %49, align 8, !tbaa !30
  %50 = load ptr, ptr %0, align 8, !tbaa !16
  %51 = getelementptr inbounds i8, ptr %50, i64 56
  %52 = load ptr, ptr %51, align 8, !tbaa !31
  %.fr = freeze ptr %52
  %53 = getelementptr inbounds i8, ptr %0, i64 44
  %54 = and i32 %40, 255
  %55 = and i32 %.sroa.4.0.extract.shift, 255
  %56 = and i32 %.sroa.5.0.extract.shift, 255
  %.not127 = icmp eq i32 %.fr126, 0
  %57 = getelementptr inbounds i8, ptr %5, i64 4
  %58 = getelementptr inbounds i8, ptr %5, i64 8
  %59 = getelementptr inbounds i8, ptr %5, i64 12
  %60 = getelementptr inbounds i8, ptr %0, i64 240
  %61 = getelementptr inbounds i8, ptr %2, i64 4
  br i1 %.not127, label %.split, label %.split.us

.split.us:                                        ; preds = %48
  %.not99 = icmp eq ptr %.fr, null
  %62 = zext i32 %.fr126 to i64
  br i1 %.not99, label %.split.us.split.us, label %.split.us.split

.split.us.split.us:                               ; preds = %.split.us, %101
  %indvars.iv144 = phi i64 [ %indvars.iv.next145, %101 ], [ 0, %.split.us ]
  %63 = load ptr, ptr %0, align 8, !tbaa !16
  %64 = load i32, ptr %63, align 8, !tbaa !32
  %65 = icmp slt i32 %64, 2
  br i1 %65, label %66, label %.preheader.us.us.preheader

66:                                               ; preds = %.split.us.split.us
  %67 = load i32, ptr %53, align 4, !tbaa !33
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [8 x [256 x i8]], ptr @_ZN6basisuL18g_eval_dist_tablesE, i64 0, i64 %indvars.iv144, i64 %68
  %70 = load i8, ptr %69, align 1, !tbaa !28
  %.not97.us.us = icmp eq i8 %70, 0
  br i1 %.not97.us.us, label %101, label %.preheader.us.us.preheader

.preheader.us.us.preheader:                       ; preds = %66, %.split.us.split.us
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #7
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %5)
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %57)
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %58)
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %59)
  %71 = getelementptr inbounds [8 x [4 x i32]], ptr @_ZN6basisu19g_etc1_inten_tablesE, i64 0, i64 %indvars.iv144
  %72 = load i32, ptr %71, align 16, !tbaa !34
  %73 = add nsw i32 %72, %54
  %74 = add nsw i32 %72, %55
  %75 = add nsw i32 %72, %56
  %76 = call noundef nonnull align 1 dereferenceable(4) ptr @_ZN6basisu10color_rgba3setEiiii(ptr noundef nonnull align 1 dereferenceable(4) %5, i32 noundef %73, i32 noundef %74, i32 noundef %75, i32 noundef 255)
  %77 = getelementptr inbounds i8, ptr %71, i64 4
  %78 = load i32, ptr %77, align 4, !tbaa !34
  %79 = add nsw i32 %78, %54
  %80 = add nsw i32 %78, %55
  %81 = add nsw i32 %78, %56
  %82 = call noundef nonnull align 1 dereferenceable(4) ptr @_ZN6basisu10color_rgba3setEiiii(ptr noundef nonnull align 1 dereferenceable(4) %57, i32 noundef %79, i32 noundef %80, i32 noundef %81, i32 noundef 255)
  %83 = getelementptr inbounds i8, ptr %71, i64 8
  %84 = load i32, ptr %83, align 8, !tbaa !34
  %85 = add nsw i32 %84, %54
  %86 = add nsw i32 %84, %55
  %87 = add nsw i32 %84, %56
  %88 = call noundef nonnull align 1 dereferenceable(4) ptr @_ZN6basisu10color_rgba3setEiiii(ptr noundef nonnull align 1 dereferenceable(4) %58, i32 noundef %85, i32 noundef %86, i32 noundef %87, i32 noundef 255)
  %89 = getelementptr inbounds i8, ptr %71, i64 12
  %90 = load i32, ptr %89, align 4, !tbaa !34
  %91 = add nsw i32 %90, %54
  %92 = add nsw i32 %90, %55
  %93 = add nsw i32 %90, %56
  %94 = call noundef nonnull align 1 dereferenceable(4) ptr @_ZN6basisu10color_rgba3setEiiii(ptr noundef nonnull align 1 dereferenceable(4) %59, i32 noundef %91, i32 noundef %92, i32 noundef %93, i32 noundef 255)
  %95 = load ptr, ptr %0, align 8, !tbaa !16
  %96 = getelementptr inbounds i8, ptr %95, i64 16
  %97 = load ptr, ptr %96, align 8, !tbaa !35
  br label %102

._crit_edge.split.us.us.us:                       ; preds = %102
  br i1 %.not100.us.us.us, label %98, label %100

98:                                               ; preds = %._crit_edge.split.us.us.us
  store i64 %129, ptr %49, align 8, !tbaa !30
  %99 = trunc nuw nsw i64 %indvars.iv144 to i32
  store i32 %99, ptr %61, align 4, !tbaa !36
  call void @_ZN6basisu6vectorIhE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(16) %44, ptr noundef nonnull align 8 dereferenceable(16) %60)
  store i8 1, ptr %8, align 8, !tbaa !5
  br label %100

100:                                              ; preds = %98, %._crit_edge.split.us.us.us
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #7
  br label %101

101:                                              ; preds = %100, %66
  %indvars.iv.next145 = add nuw nsw i64 %indvars.iv144, 1
  %exitcond147.not = icmp eq i64 %indvars.iv.next145, 8
  br i1 %exitcond147.not, label %.split124.us, label %.split.us.split.us, !llvm.loop !37

102:                                              ; preds = %102, %.preheader.us.us.preheader
  %indvars.iv141 = phi i64 [ %indvars.iv.next142, %102 ], [ 0, %.preheader.us.us.preheader ]
  %.083107.us.us.us = phi ptr [ %103, %102 ], [ %97, %.preheader.us.us.preheader ]
  %.084106.us.us.us = phi i64 [ %129, %102 ], [ 0, %.preheader.us.us.preheader ]
  %103 = getelementptr inbounds i8, ptr %.083107.us.us.us, i64 4
  %104 = load ptr, ptr %0, align 8, !tbaa !16
  %105 = getelementptr inbounds i8, ptr %104, i64 4
  %106 = load i8, ptr %105, align 4, !tbaa !39, !range !26, !noundef !27
  %107 = trunc nuw i8 %106 to i1
  %108 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %107, ptr noundef nonnull align 1 dereferenceable(4) %.083107.us.us.us, ptr noundef nonnull align 1 dereferenceable(4) %5, i1 noundef zeroext false)
  %109 = load ptr, ptr %0, align 8, !tbaa !16
  %110 = getelementptr inbounds i8, ptr %109, i64 4
  %111 = load i8, ptr %110, align 4, !tbaa !39, !range !26, !noundef !27
  %112 = trunc nuw i8 %111 to i1
  %113 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %112, ptr noundef nonnull align 1 dereferenceable(4) %.083107.us.us.us, ptr noundef nonnull align 1 dereferenceable(4) %57, i1 noundef zeroext false)
  %114 = icmp ult i32 %113, %108
  %spec.select.us.us.us = zext i1 %114 to i8
  %spec.select101.us.us.us = call i32 @llvm.umin.i32(i32 %113, i32 %108)
  %115 = load ptr, ptr %0, align 8, !tbaa !16
  %116 = getelementptr inbounds i8, ptr %115, i64 4
  %117 = load i8, ptr %116, align 4, !tbaa !39, !range !26, !noundef !27
  %118 = trunc nuw i8 %117 to i1
  %119 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %118, ptr noundef nonnull align 1 dereferenceable(4) %.083107.us.us.us, ptr noundef nonnull align 1 dereferenceable(4) %58, i1 noundef zeroext false)
  %120 = icmp ult i32 %119, %spec.select101.us.us.us
  %.177.us.us.us = select i1 %120, i8 2, i8 %spec.select.us.us.us
  %.1.us.us.us = call i32 @llvm.umin.i32(i32 %119, i32 %spec.select101.us.us.us)
  %121 = load ptr, ptr %0, align 8, !tbaa !16
  %122 = getelementptr inbounds i8, ptr %121, i64 4
  %123 = load i8, ptr %122, align 4, !tbaa !39, !range !26, !noundef !27
  %124 = trunc nuw i8 %123 to i1
  %125 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %124, ptr noundef nonnull align 1 dereferenceable(4) %.083107.us.us.us, ptr noundef nonnull align 1 dereferenceable(4) %59, i1 noundef zeroext false)
  %126 = icmp ult i32 %125, %.1.us.us.us
  %.278.us.us.us = select i1 %126, i8 3, i8 %.177.us.us.us
  %.2.us.us.us = call i32 @llvm.umin.i32(i32 %125, i32 %.1.us.us.us)
  %127 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu6vectorIhEixEm(ptr noundef nonnull align 8 dereferenceable(16) %60, i64 noundef %indvars.iv141)
  store i8 %.278.us.us.us, ptr %127, align 1, !tbaa !28
  %128 = zext i32 %.2.us.us.us to i64
  %129 = add i64 %.084106.us.us.us, %128
  %130 = load i64, ptr %49, align 8, !tbaa !30
  %.not100.us.us.us = icmp ult i64 %129, %130
  %indvars.iv.next142 = add nuw nsw i64 %indvars.iv141, 1
  %131 = icmp ult i64 %indvars.iv.next142, %62
  %or.cond = select i1 %.not100.us.us.us, i1 %131, i1 false
  br i1 %or.cond, label %102, label %._crit_edge.split.us.us.us, !llvm.loop !40

.split.us.split:                                  ; preds = %.split.us, %186
  %indvars.iv134 = phi i64 [ %indvars.iv.next135, %186 ], [ 0, %.split.us ]
  %132 = load ptr, ptr %0, align 8, !tbaa !16
  %133 = load i32, ptr %132, align 8, !tbaa !32
  %134 = icmp slt i32 %133, 2
  br i1 %134, label %135, label %.preheader.us.preheader

135:                                              ; preds = %.split.us.split
  %136 = load i32, ptr %53, align 4, !tbaa !33
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [8 x [256 x i8]], ptr @_ZN6basisuL18g_eval_dist_tablesE, i64 0, i64 %indvars.iv134, i64 %137
  %139 = load i8, ptr %138, align 1, !tbaa !28
  %.not97.us = icmp eq i8 %139, 0
  br i1 %.not97.us, label %186, label %.preheader.us.preheader

.preheader.us.preheader:                          ; preds = %135, %.split.us.split
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #7
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %5)
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %57)
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %58)
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %59)
  %140 = getelementptr inbounds [8 x [4 x i32]], ptr @_ZN6basisu19g_etc1_inten_tablesE, i64 0, i64 %indvars.iv134
  %141 = load i32, ptr %140, align 16, !tbaa !34
  %142 = add nsw i32 %141, %54
  %143 = add nsw i32 %141, %55
  %144 = add nsw i32 %141, %56
  %145 = call noundef nonnull align 1 dereferenceable(4) ptr @_ZN6basisu10color_rgba3setEiiii(ptr noundef nonnull align 1 dereferenceable(4) %5, i32 noundef %142, i32 noundef %143, i32 noundef %144, i32 noundef 255)
  %146 = getelementptr inbounds i8, ptr %140, i64 4
  %147 = load i32, ptr %146, align 4, !tbaa !34
  %148 = add nsw i32 %147, %54
  %149 = add nsw i32 %147, %55
  %150 = add nsw i32 %147, %56
  %151 = call noundef nonnull align 1 dereferenceable(4) ptr @_ZN6basisu10color_rgba3setEiiii(ptr noundef nonnull align 1 dereferenceable(4) %57, i32 noundef %148, i32 noundef %149, i32 noundef %150, i32 noundef 255)
  %152 = getelementptr inbounds i8, ptr %140, i64 8
  %153 = load i32, ptr %152, align 8, !tbaa !34
  %154 = add nsw i32 %153, %54
  %155 = add nsw i32 %153, %55
  %156 = add nsw i32 %153, %56
  %157 = call noundef nonnull align 1 dereferenceable(4) ptr @_ZN6basisu10color_rgba3setEiiii(ptr noundef nonnull align 1 dereferenceable(4) %58, i32 noundef %154, i32 noundef %155, i32 noundef %156, i32 noundef 255)
  %158 = getelementptr inbounds i8, ptr %140, i64 12
  %159 = load i32, ptr %158, align 4, !tbaa !34
  %160 = add nsw i32 %159, %54
  %161 = add nsw i32 %159, %55
  %162 = add nsw i32 %159, %56
  %163 = call noundef nonnull align 1 dereferenceable(4) ptr @_ZN6basisu10color_rgba3setEiiii(ptr noundef nonnull align 1 dereferenceable(4) %59, i32 noundef %160, i32 noundef %161, i32 noundef %162, i32 noundef 255)
  %164 = load ptr, ptr %0, align 8, !tbaa !16
  %165 = getelementptr inbounds i8, ptr %164, i64 16
  %166 = load ptr, ptr %165, align 8, !tbaa !35
  br label %167

167:                                              ; preds = %167, %.preheader.us.preheader
  %indvars.iv = phi i64 [ %indvars.iv.next, %167 ], [ 0, %.preheader.us.preheader ]
  %.083107.us115 = phi ptr [ %168, %167 ], [ %166, %.preheader.us.preheader ]
  %.084106.us116 = phi i64 [ %180, %167 ], [ 0, %.preheader.us.preheader ]
  %168 = getelementptr inbounds i8, ptr %.083107.us115, i64 4
  %169 = getelementptr inbounds i8, ptr %.fr, i64 %indvars.iv
  %170 = load i8, ptr %169, align 1, !tbaa !28
  %171 = load ptr, ptr %0, align 8, !tbaa !16
  %172 = getelementptr inbounds i8, ptr %171, i64 4
  %173 = load i8, ptr %172, align 4, !tbaa !39, !range !26, !noundef !27
  %174 = trunc nuw i8 %173 to i1
  %175 = zext i8 %170 to i64
  %176 = getelementptr inbounds [4 x %"class.basisu::color_rgba"], ptr %5, i64 0, i64 %175
  %177 = call noundef i32 @_ZN6basisu14color_distanceEbRKNS_10color_rgbaES2_b(i1 noundef zeroext %174, ptr noundef nonnull align 1 dereferenceable(4) %.083107.us115, ptr noundef nonnull align 1 dereferenceable(4) %176, i1 noundef zeroext false)
  %178 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZN6basisu6vectorIhEixEm(ptr noundef nonnull align 8 dereferenceable(16) %60, i64 noundef %indvars.iv)
  store i8 %170, ptr %178, align 1, !tbaa !28
  %179 = zext i32 %177 to i64
  %180 = add i64 %.084106.us116, %179
  %181 = load i64, ptr %49, align 8, !tbaa !30
  %.not100.us117 = icmp ult i64 %180, %181
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %182 = icmp ult i64 %indvars.iv.next, %62
  %or.cond125 = select i1 %.not100.us117, i1 %182, i1 false
  br i1 %or.cond125, label %167, label %._crit_edge.split.us118, !llvm.loop !40

._crit_edge.split.us118:                          ; preds = %167
  br i1 %.not100.us117, label %183, label %185

183:                                              ; preds = %._crit_edge.split.us118
  store i64 %180, ptr %49, align 8, !tbaa !30
  %184 = trunc nuw nsw i64 %indvars.iv134 to i32
  store i32 %184, ptr %61, align 4, !tbaa !36
  call void @_ZN6basisu6vectorIhE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(16) %44, ptr noundef nonnull align 8 dereferenceable(16) %60)
  store i8 1, ptr %8, align 8, !tbaa !5
  br label %185

185:                                              ; preds = %183, %._crit_edge.split.us118
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #7
  br label %186

186:                                              ; preds = %185, %135
  %indvars.iv.next135 = add nuw nsw i64 %indvars.iv134, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next135, 8
  br i1 %exitcond.not, label %.split124.us, label %.split.us.split, !llvm.loop !37

.split124.us:                                     ; preds = %186, %101, %228
  %187 = load i32, ptr %1, align 4, !tbaa !28
  store i32 %187, ptr %2, align 8, !tbaa !28
  %188 = load ptr, ptr %0, align 8, !tbaa !16
  %189 = getelementptr inbounds i8, ptr %188, i64 24
  %190 = load i8, ptr %189, align 8, !tbaa !41, !range !26, !noundef !27
  %191 = getelementptr inbounds i8, ptr %2, i64 8
  store i8 %190, ptr %191, align 8, !tbaa !42
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %.thread, label %229

.split:                                           ; preds = %48, %228
  %indvars.iv152 = phi i64 [ %indvars.iv.next153, %228 ], [ 0, %48 ]
  %192 = load ptr, ptr %0, align 8, !tbaa !16
  %193 = load i32, ptr %192, align 8, !tbaa !32
  %194 = icmp slt i32 %193, 2
  br i1 %194, label %195, label %.preheader.preheader

195:                                              ; preds = %.split
  %196 = load i32, ptr %53, align 4, !tbaa !33
  %197 = sext i32 %196 to i64
  %198 = getelementptr inbounds [8 x [256 x i8]], ptr @_ZN6basisuL18g_eval_dist_tablesE, i64 0, i64 %indvars.iv152, i64 %197
  %199 = load i8, ptr %198, align 1, !tbaa !28
  %.not97 = icmp eq i8 %199, 0
  br i1 %.not97, label %228, label %.preheader.preheader

.preheader.preheader:                             ; preds = %195, %.split
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #7
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %5)
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %57)
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %58)
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %59)
  %200 = getelementptr inbounds [8 x [4 x i32]], ptr @_ZN6basisu19g_etc1_inten_tablesE, i64 0, i64 %indvars.iv152
  %201 = load i32, ptr %200, align 16, !tbaa !34
  %202 = add nsw i32 %201, %54
  %203 = add nsw i32 %201, %55
  %204 = add nsw i32 %201, %56
  %205 = call noundef nonnull align 1 dereferenceable(4) ptr @_ZN6basisu10color_rgba3setEiiii(ptr noundef nonnull align 1 dereferenceable(4) %5, i32 noundef %202, i32 noundef %203, i32 noundef %204, i32 noundef 255)
  %206 = getelementptr inbounds i8, ptr %200, i64 4
  %207 = load i32, ptr %206, align 4, !tbaa !34
  %208 = add nsw i32 %207, %54
  %209 = add nsw i32 %207, %55
  %210 = add nsw i32 %207, %56
  %211 = call noundef nonnull align 1 dereferenceable(4) ptr @_ZN6basisu10color_rgba3setEiiii(ptr noundef nonnull align 1 dereferenceable(4) %57, i32 noundef %208, i32 noundef %209, i32 noundef %210, i32 noundef 255)
  %212 = getelementptr inbounds i8, ptr %200, i64 8
  %213 = load i32, ptr %212, align 8, !tbaa !34
  %214 = add nsw i32 %213, %54
  %215 = add nsw i32 %213, %55
  %216 = add nsw i32 %213, %56
  %217 = call noundef nonnull align 1 dereferenceable(4) ptr @_ZN6basisu10color_rgba3setEiiii(ptr noundef nonnull align 1 dereferenceable(4) %58, i32 noundef %214, i32 noundef %215, i32 noundef %216, i32 noundef 255)
  %218 = getelementptr inbounds i8, ptr %200, i64 12
  %219 = load i32, ptr %218, align 4, !tbaa !34
  %220 = add nsw i32 %219, %54
  %221 = add nsw i32 %219, %55
  %222 = add nsw i32 %219, %56
  %223 = call noundef nonnull align 1 dereferenceable(4) ptr @_ZN6basisu10color_rgba3setEiiii(ptr noundef nonnull align 1 dereferenceable(4) %59, i32 noundef %220, i32 noundef %221, i32 noundef %222, i32 noundef 255)
  %224 = load i64, ptr %49, align 8, !tbaa !30
  %.not128 = icmp eq i64 %224, 0
  br i1 %.not128, label %227, label %225

225:                                              ; preds = %.preheader.preheader
  store i64 0, ptr %49, align 8, !tbaa !30
  %226 = trunc nuw nsw i64 %indvars.iv152 to i32
  store i32 %226, ptr %61, align 4, !tbaa !36
  call void @_ZN6basisu6vectorIhE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(16) %44, ptr noundef nonnull align 8 dereferenceable(16) %60)
  store i8 1, ptr %8, align 8, !tbaa !5
  br label %227

227:                                              ; preds = %225, %.preheader.preheader
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #7
  br label %228

228:                                              ; preds = %195, %227
  %indvars.iv.next153 = add nuw nsw i64 %indvars.iv152, 1
  %exitcond155.not = icmp eq i64 %indvars.iv.next153, 8
  br i1 %exitcond155.not, label %.split124.us, label %.split, !llvm.loop !37

229:                                              ; preds = %.split124.us
  %230 = load i64, ptr %49, align 8, !tbaa !30
  %231 = getelementptr inbounds i8, ptr %3, i64 32
  %232 = load i64, ptr %231, align 8, !tbaa !30
  %233 = icmp ult i64 %230, %232
  br i1 %233, label %234, label %.thread

234:                                              ; preds = %229
  %235 = call noundef nonnull align 8 dereferenceable(41) ptr @_ZN6basisu14etc1_optimizer18potential_solutionaSERKS1_(ptr noundef nonnull align 8 dereferenceable(41) %3, ptr noundef nonnull align 8 dereferenceable(41) %2)
  br label %.thread

.thread:                                          ; preds = %13, %.split124.us, %234, %229, %36, %4
  %.181 = phi i1 [ false, %36 ], [ false, %4 ], [ true, %234 ], [ false, %229 ], [ false, %.split124.us ], [ false, %13 ]
  ret i1 %.181
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN6basisu7maximumIiEET_S1_S1_S1_(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(41) ptr @_ZN6basisu14etc1_optimizer18potential_solutionaSERKS1_(ptr noundef nonnull align 8 dereferenceable(41), ptr noundef nonnull align 8 dereferenceable(41)) local_unnamed_addr #3 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umin.i32(i32, i32) #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn 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 #2 = { 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 #3 = { 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 #4 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { noreturn nounwind }
attributes #7 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !12, i64 40}
!6 = !{!"_ZTSN6basisu14etc1_optimizer18potential_solutionE", !7, i64 0, !13, i64 16, !15, i64 32, !12, i64 40}
!7 = !{!"_ZTSN6basisu25etc1_solution_coordinatesE", !8, i64 0, !11, i64 4, !12, i64 8}
!8 = !{!"_ZTSN6basisu10color_rgbaE", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"bool", !9, i64 0}
!13 = !{!"_ZTSN6basisu6vectorIhEE", !14, i64 0, !11, i64 8, !11, i64 12}
!14 = !{!"any pointer", !9, i64 0}
!15 = !{!"long", !9, i64 0}
!16 = !{!17, !14, i64 0}
!17 = !{!"_ZTSN6basisu14etc1_optimizerE", !14, i64 0, !14, i64 8, !11, i64 16, !18, i64 20, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !19, i64 48, !20, i64 64, !20, i64 80, !14, i64 96, !14, i64 104, !13, i64 112, !13, i64 128, !6, i64 144, !6, i64 192, !13, i64 240, !9, i64 256}
!18 = !{!"_ZTSN6basisu3vecILj3EfEE", !9, i64 0}
!19 = !{!"_ZTSN6basisu6vectorItEE", !14, i64 0, !11, i64 8, !11, i64 12}
!20 = !{!"_ZTSN6basisu6vectorIjEE", !14, i64 0, !11, i64 8, !11, i64 12}
!21 = !{!22, !12, i64 48}
!22 = !{!"_ZTSN6basisu14etc1_optimizer6paramsE", !23, i64 0, !11, i64 12, !14, i64 16, !12, i64 24, !14, i64 32, !11, i64 40, !8, i64 44, !12, i64 48, !12, i64 49, !14, i64 56}
!23 = !{!"_ZTSN6basisu22basis_etc1_pack_paramsE", !24, i64 0, !12, i64 4, !12, i64 5, !12, i64 6, !12, i64 7, !25, i64 8}
!24 = !{!"_ZTSN6basisu17basis_etc_qualityE", !9, i64 0}
!25 = !{!"float", !9, i64 0}
!26 = !{i8 0, i8 2}
!27 = !{}
!28 = !{!9, !9, i64 0}
!29 = !{!22, !11, i64 12}
!30 = !{!6, !15, i64 32}
!31 = !{!22, !14, i64 56}
!32 = !{!23, !24, i64 0}
!33 = !{!17, !11, i64 44}
!34 = !{!11, !11, i64 0}
!35 = !{!22, !14, i64 16}
!36 = !{!6, !11, i64 4}
!37 = distinct !{!37, !38}
!38 = !{!"llvm.loop.mustprogress"}
!39 = !{!23, !12, i64 4}
!40 = distinct !{!40, !38}
!41 = !{!22, !12, i64 24}
!42 = !{!6, !12, i64 8}


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