; 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::vector.18" = type { ptr, i32, i32 }
%"class.basisu::image" = type { i32, i32, i32, %"class.basisu::vector.87" }
%"class.basisu::vector.87" = type { ptr, i32, i32 }
%"struct.basisu::etc_block" = type { %union.anon.22 }
%union.anon.22 = type { i64 }
%"class.basisu::color_rgba" = type { %union.anon }
%union.anon = type { [4 x i8] }
%"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.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 }
%"struct.basisu::basisu_frontend::endpoint_cluster_etc_params" = type <{ [2 x %"class.basisu::color_rgba"], [2 x i32], [2 x i64], %"class.basisu::vector.18", [2 x i8], i8, [5 x i8] }>

@_ZN6basisu20g_etc1_pixel_indicesE = external constant [2 x [2 x [8 x i32]]], align 16
@.str.47 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [35 x i8], align 1

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

; 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) #1

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6basisu15basisu_frontend42dump_endpoint_clusterization_visualizationEPKcb(ptr noundef nonnull align 8 dereferenceable(496) %0, ptr noundef %1, i1 noundef zeroext %2) #4 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca i32, align 4
  %8 = alloca %"class.basisu::vector.18", align 8
  %9 = alloca %"class.basisu::vector.18", align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca %"class.basisu::image", align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %"struct.basisu::etc_block", align 8
  %19 = alloca [4 x %"class.basisu::color_rgba"], align 16
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca ptr, align 8
  %26 = alloca ptr, align 8
  %27 = alloca [8 x %"class.basisu::color_rgba"], align 16
  %28 = alloca [2 x %"class.basisu::color_rgba"], align 1
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %31 = zext i1 %2 to i8
  store i8 %31, ptr %6, align 1, !tbaa !9
  %32 = load ptr, ptr %4, align 8
  call void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef @.str.47)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 0, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #7
  %33 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %32, i32 0, i32 13
  %34 = call noundef i32 @_ZNK6basisu6vectorINS0_IjEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %33)
  %35 = zext i32 %34 to i64
  call void @_ZN6basisu6vectorIjEC2Em(ptr noundef nonnull align 8 dereferenceable(16) %8, i64 noundef %35)
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #7
  %36 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %32, i32 0, i32 13
  %37 = invoke noundef i32 @_ZNK6basisu6vectorINS0_IjEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %36)
          to label %38 unwind label %48

38:                                               ; preds = %3
  %39 = zext i32 %37 to i64
  invoke void @_ZN6basisu6vectorIjEC2Em(ptr noundef nonnull align 8 dereferenceable(16) %9, i64 noundef %39)
          to label %40 unwind label %48

40:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !11
  br label %41

41:                                               ; preds = %78, %40
  %42 = load i32, ptr %12, align 4, !tbaa !11
  %43 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %32, i32 0, i32 13
  %44 = invoke noundef i32 @_ZNK6basisu6vectorINS0_IjEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %43)
          to label %45 unwind label %52

45:                                               ; preds = %41
  %46 = icmp ult i32 %42, %44
  br i1 %46, label %56, label %47

47:                                               ; preds = %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %81

48:                                               ; preds = %38, %3
  %49 = landingpad { ptr, i32 }
          cleanup
  %50 = extractvalue { ptr, i32 } %49, 0
  store ptr %50, ptr %10, align 8
  %51 = extractvalue { ptr, i32 } %49, 1
  store i32 %51, ptr %11, align 4
  br label %377

52:                                               ; preds = %73, %71, %66, %64, %62, %56, %41
  %53 = landingpad { ptr, i32 }
          cleanup
  %54 = extractvalue { ptr, i32 } %53, 0
  store ptr %54, ptr %10, align 8
  %55 = extractvalue { ptr, i32 } %53, 1
  store i32 %55, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %376

56:                                               ; preds = %45
  %57 = load i32, ptr %7, align 4, !tbaa !11
  %58 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %32, i32 0, i32 13
  %59 = load i32, ptr %12, align 4, !tbaa !11
  %60 = zext i32 %59 to i64
  %61 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN6basisu6vectorINS0_IjEEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %58, i64 noundef %60)
          to label %62 unwind label %52

62:                                               ; preds = %56
  %63 = invoke noundef i32 @_ZNK6basisu6vectorIjE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %61)
          to label %64 unwind label %52

64:                                               ; preds = %62
  %65 = invoke noundef i32 @_ZN6basisu7maximumIjEET_S1_S1_(i32 noundef %57, i32 noundef %63)
          to label %66 unwind label %52

66:                                               ; preds = %64
  store i32 %65, ptr %7, align 4, !tbaa !11
  %67 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %32, i32 0, i32 13
  %68 = load i32, ptr %12, align 4, !tbaa !11
  %69 = zext i32 %68 to i64
  %70 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN6basisu6vectorINS0_IjEEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %67, i64 noundef %69)
          to label %71 unwind label %52

71:                                               ; preds = %66
  %72 = invoke noundef i32 @_ZNK6basisu6vectorIjE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %70)
          to label %73 unwind label %52

73:                                               ; preds = %71
  %74 = load i32, ptr %12, align 4, !tbaa !11
  %75 = zext i32 %74 to i64
  %76 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %8, i64 noundef %75)
          to label %77 unwind label %52

77:                                               ; preds = %73
  store i32 %72, ptr %76, align 4, !tbaa !11
  br label %78

78:                                               ; preds = %77
  %79 = load i32, ptr %12, align 4, !tbaa !11
  %80 = add i32 %79, 1
  store i32 %80, ptr %12, align 4, !tbaa !11
  br label %41, !llvm.loop !13

81:                                               ; preds = %47
  %82 = load i32, ptr %7, align 4, !tbaa !11
  %83 = icmp ne i32 %82, 0
  br i1 %83, label %85, label %84

84:                                               ; preds = %81
  store i32 1, ptr %13, align 4
  br label %367

85:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !11
  br label %86

86:                                               ; preds = %103, %85
  %87 = load i32, ptr %14, align 4, !tbaa !11
  %88 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %32, i32 0, i32 13
  %89 = invoke noundef i32 @_ZNK6basisu6vectorINS0_IjEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %88)
          to label %90 unwind label %93

90:                                               ; preds = %86
  %91 = icmp ult i32 %87, %89
  br i1 %91, label %97, label %92

92:                                               ; preds = %90
  store i32 5, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %106

93:                                               ; preds = %97, %86
  %94 = landingpad { ptr, i32 }
          cleanup
  %95 = extractvalue { ptr, i32 } %94, 0
  store ptr %95, ptr %10, align 8
  %96 = extractvalue { ptr, i32 } %94, 1
  store i32 %96, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %376

97:                                               ; preds = %90
  %98 = load i32, ptr %14, align 4, !tbaa !11
  %99 = load i32, ptr %14, align 4, !tbaa !11
  %100 = zext i32 %99 to i64
  %101 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %9, i64 noundef %100)
          to label %102 unwind label %93

102:                                              ; preds = %97
  store i32 %98, ptr %101, align 4, !tbaa !11
  br label %103

103:                                              ; preds = %102
  %104 = load i32, ptr %14, align 4, !tbaa !11
  %105 = add i32 %104, 1
  store i32 %105, ptr %14, align 4, !tbaa !11
  br label %86, !llvm.loop !15

106:                                              ; preds = %92
  call void @llvm.lifetime.start.p0(i64 32, ptr %15) #7
  %107 = load i32, ptr %7, align 4, !tbaa !11
  %108 = invoke noundef i32 @_ZN6basisu7minimumIjEET_S1_S1_(i32 noundef %107, i32 noundef 2048)
          to label %109 unwind label %124

109:                                              ; preds = %106
  %110 = mul i32 %108, 5
  %111 = add i32 12, %110
  %112 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %32, i32 0, i32 13
  %113 = invoke noundef i32 @_ZNK6basisu6vectorINS0_IjEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %112)
          to label %114 unwind label %124

114:                                              ; preds = %109
  %115 = mul i32 %113, 3
  invoke void @_ZN6basisu5imageC2Ejjj(ptr noundef nonnull align 8 dereferenceable(32) %15, i32 noundef %111, i32 noundef %115, i32 noundef -1)
          to label %116 unwind label %124

116:                                              ; preds = %114
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 0, ptr %16, align 4, !tbaa !11
  br label %117

117:                                              ; preds = %354, %116
  %118 = load i32, ptr %16, align 4, !tbaa !11
  %119 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %32, i32 0, i32 13
  %120 = invoke noundef i32 @_ZNK6basisu6vectorINS0_IjEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %119)
          to label %121 unwind label %128

121:                                              ; preds = %117
  %122 = icmp ult i32 %118, %120
  br i1 %122, label %132, label %123

123:                                              ; preds = %121
  store i32 8, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %361

124:                                              ; preds = %114, %109, %106
  %125 = landingpad { ptr, i32 }
          cleanup
  %126 = extractvalue { ptr, i32 } %125, 0
  store ptr %126, ptr %10, align 8
  %127 = extractvalue { ptr, i32 } %125, 1
  store i32 %127, ptr %11, align 4
  br label %375

128:                                              ; preds = %117
  %129 = landingpad { ptr, i32 }
          cleanup
  %130 = extractvalue { ptr, i32 } %129, 0
  store ptr %130, ptr %10, align 8
  %131 = extractvalue { ptr, i32 } %129, 1
  store i32 %131, ptr %11, align 4
  br label %360

132:                                              ; preds = %121
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %133 = load i32, ptr %16, align 4, !tbaa !11
  %134 = zext i32 %133 to i64
  %135 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %9, i64 noundef %134)
          to label %136 unwind label %175

136:                                              ; preds = %132
  %137 = load i32, ptr %135, align 4, !tbaa !11
  store i32 %137, ptr %17, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  invoke void @_ZN6basisu9etc_block5clearEv(ptr noundef nonnull align 8 dereferenceable(8) %18)
          to label %138 unwind label %179

138:                                              ; preds = %136
  invoke void @_ZN6basisu9etc_block12set_flip_bitEb(ptr noundef nonnull align 8 dereferenceable(8) %18, i1 noundef zeroext false)
          to label %139 unwind label %179

139:                                              ; preds = %138
  invoke void @_ZN6basisu9etc_block12set_diff_bitEb(ptr noundef nonnull align 8 dereferenceable(8) %18, i1 noundef zeroext true)
          to label %140 unwind label %179

140:                                              ; preds = %139
  %141 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %32, i32 0, i32 17
  %142 = load i32, ptr %17, align 4, !tbaa !11
  %143 = zext i32 %142 to i64
  %144 = invoke noundef nonnull align 8 dereferenceable(51) ptr @_ZN6basisu6vectorINS_15basisu_frontend27endpoint_cluster_etc_paramsEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %141, i64 noundef %143)
          to label %145 unwind label %179

145:                                              ; preds = %140
  %146 = getelementptr inbounds %"struct.basisu::basisu_frontend::endpoint_cluster_etc_params", ptr %144, i32 0, i32 1
  %147 = getelementptr inbounds [2 x i32], ptr %146, i64 0, i64 0
  %148 = load i32, ptr %147, align 8, !tbaa !11
  invoke void @_ZN6basisu9etc_block22set_inten_tables_etc1sEj(ptr noundef nonnull align 8 dereferenceable(8) %18, i32 noundef %148)
          to label %149 unwind label %179

149:                                              ; preds = %145
  %150 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %32, i32 0, i32 17
  %151 = load i32, ptr %17, align 4, !tbaa !11
  %152 = zext i32 %151 to i64
  %153 = invoke noundef nonnull align 8 dereferenceable(51) ptr @_ZN6basisu6vectorINS_15basisu_frontend27endpoint_cluster_etc_paramsEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %150, i64 noundef %152)
          to label %154 unwind label %179

154:                                              ; preds = %149
  %155 = getelementptr inbounds %"struct.basisu::basisu_frontend::endpoint_cluster_etc_params", ptr %153, i32 0, i32 0
  %156 = getelementptr inbounds [2 x %"class.basisu::color_rgba"], ptr %155, i64 0, i64 0
  %157 = invoke noundef zeroext i16 @_ZN6basisu9etc_block11pack_color5ERKNS_10color_rgbaEbj(ptr noundef nonnull align 1 dereferenceable(4) %156, i1 noundef zeroext false, i32 noundef 127)
          to label %158 unwind label %179

158:                                              ; preds = %154
  invoke void @_ZN6basisu9etc_block15set_base5_colorEt(ptr noundef nonnull align 8 dereferenceable(8) %18, i16 noundef zeroext %157)
          to label %159 unwind label %179

159:                                              ; preds = %158
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #7
  %160 = getelementptr inbounds [4 x %"class.basisu::color_rgba"], ptr %19, i32 0, i32 0
  %161 = getelementptr inbounds %"class.basisu::color_rgba", ptr %160, i64 4
  br label %162

162:                                              ; preds = %164, %159
  %163 = phi ptr [ %160, %159 ], [ %165, %164 ]
  invoke void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %163)
          to label %164 unwind label %183

164:                                              ; preds = %162
  %165 = getelementptr inbounds %"class.basisu::color_rgba", ptr %163, i64 1
  %166 = icmp eq ptr %165, %161
  br i1 %166, label %167, label %162

167:                                              ; preds = %164
  %168 = getelementptr inbounds [4 x %"class.basisu::color_rgba"], ptr %19, i64 0, i64 0
  %169 = invoke noundef zeroext i1 @_ZNK6basisu9etc_block16get_block_colorsEPNS_10color_rgbaEj(ptr noundef nonnull align 8 dereferenceable(8) %18, ptr noundef %168, i32 noundef 0)
          to label %170 unwind label %183

170:                                              ; preds = %167
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  store i32 0, ptr %20, align 4, !tbaa !11
  br label %171

171:                                              ; preds = %197, %170
  %172 = load i32, ptr %20, align 4, !tbaa !11
  %173 = icmp ult i32 %172, 4
  br i1 %173, label %187, label %174

174:                                              ; preds = %171
  store i32 11, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %204

175:                                              ; preds = %132
  %176 = landingpad { ptr, i32 }
          cleanup
  %177 = extractvalue { ptr, i32 } %176, 0
  store ptr %177, ptr %10, align 8
  %178 = extractvalue { ptr, i32 } %176, 1
  store i32 %178, ptr %11, align 4
  br label %359

179:                                              ; preds = %158, %154, %149, %145, %140, %139, %138, %136
  %180 = landingpad { ptr, i32 }
          cleanup
  %181 = extractvalue { ptr, i32 } %180, 0
  store ptr %181, ptr %10, align 8
  %182 = extractvalue { ptr, i32 } %180, 1
  store i32 %182, ptr %11, align 4
  br label %358

183:                                              ; preds = %167, %162
  %184 = landingpad { ptr, i32 }
          cleanup
  %185 = extractvalue { ptr, i32 } %184, 0
  store ptr %185, ptr %10, align 8
  %186 = extractvalue { ptr, i32 } %184, 1
  store i32 %186, ptr %11, align 4
  br label %357

187:                                              ; preds = %171
  %188 = load i32, ptr %20, align 4, !tbaa !11
  %189 = mul i32 %188, 2
  %190 = load i32, ptr %16, align 4, !tbaa !11
  %191 = mul i32 3, %190
  %192 = load i32, ptr %20, align 4, !tbaa !11
  %193 = zext i32 %192 to i64
  %194 = getelementptr inbounds [4 x %"class.basisu::color_rgba"], ptr %19, i64 0, i64 %193
  %195 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN6basisu5image8fill_boxEjjjjRKNS_10color_rgbaE(ptr noundef nonnull align 8 dereferenceable(32) %15, i32 noundef %189, i32 noundef %191, i32 noundef 2, i32 noundef 2, ptr noundef nonnull align 1 dereferenceable(4) %194)
          to label %196 unwind label %200

196:                                              ; preds = %187
  br label %197

197:                                              ; preds = %196
  %198 = load i32, ptr %20, align 4, !tbaa !11
  %199 = add i32 %198, 1
  store i32 %199, ptr %20, align 4, !tbaa !11
  br label %171, !llvm.loop !16

200:                                              ; preds = %187
  %201 = landingpad { ptr, i32 }
          cleanup
  %202 = extractvalue { ptr, i32 } %201, 0
  store ptr %202, ptr %10, align 8
  %203 = extractvalue { ptr, i32 } %201, 1
  store i32 %203, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %357

204:                                              ; preds = %174
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  store i32 0, ptr %21, align 4, !tbaa !11
  br label %205

205:                                              ; preds = %345, %204
  %206 = load i32, ptr %21, align 4, !tbaa !11
  %207 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %32, i32 0, i32 13
  %208 = load i32, ptr %17, align 4, !tbaa !11
  %209 = zext i32 %208 to i64
  %210 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN6basisu6vectorINS0_IjEEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %207, i64 noundef %209)
          to label %211 unwind label %216

211:                                              ; preds = %205
  %212 = invoke noundef i32 @_ZNK6basisu6vectorIjE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %210)
          to label %213 unwind label %216

213:                                              ; preds = %211
  %214 = icmp ult i32 %206, %212
  br i1 %214, label %220, label %215

215:                                              ; preds = %213
  store i32 14, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %353

216:                                              ; preds = %211, %205
  %217 = landingpad { ptr, i32 }
          cleanup
  %218 = extractvalue { ptr, i32 } %217, 0
  store ptr %218, ptr %10, align 8
  %219 = extractvalue { ptr, i32 } %217, 1
  store i32 %219, ptr %11, align 4
  br label %352

220:                                              ; preds = %213
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  %221 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %32, i32 0, i32 13
  %222 = load i32, ptr %17, align 4, !tbaa !11
  %223 = zext i32 %222 to i64
  %224 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN6basisu6vectorINS0_IjEEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %221, i64 noundef %223)
          to label %225 unwind label %273

225:                                              ; preds = %220
  %226 = load i32, ptr %21, align 4, !tbaa !11
  %227 = zext i32 %226 to i64
  %228 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %224, i64 noundef %227)
          to label %229 unwind label %273

229:                                              ; preds = %225
  %230 = load i32, ptr %228, align 4, !tbaa !11
  store i32 %230, ptr %22, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #7
  %231 = load i32, ptr %22, align 4, !tbaa !11
  %232 = lshr i32 %231, 1
  store i32 %232, ptr %23, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #7
  %233 = load i32, ptr %22, align 4, !tbaa !11
  %234 = and i32 %233, 1
  store i32 %234, ptr %24, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #7
  %235 = getelementptr inbounds %"class.basisu::basisu_frontend", ptr %32, i32 0, i32 11
  %236 = load i32, ptr %23, align 4, !tbaa !11
  %237 = zext i32 %236 to i64
  %238 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN6basisu6vectorINS_9etc_blockEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %235, i64 noundef %237)
          to label %239 unwind label %277

239:                                              ; preds = %229
  store ptr %238, ptr %25, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #7
  %240 = load i32, ptr %23, align 4, !tbaa !11
  %241 = invoke noundef nonnull align 1 dereferenceable(64) ptr @_ZNK6basisu15basisu_frontend22get_source_pixel_blockEj(ptr noundef nonnull align 8 dereferenceable(496) %32, i32 noundef %240)
          to label %242 unwind label %281

242:                                              ; preds = %239
  %243 = invoke noundef ptr @_ZNK6basisu11pixel_block7get_ptrEv(ptr noundef nonnull align 1 dereferenceable(64) %241)
          to label %244 unwind label %281

244:                                              ; preds = %242
  store ptr %243, ptr %26, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %27) #7
  %245 = getelementptr inbounds [8 x %"class.basisu::color_rgba"], ptr %27, i32 0, i32 0
  %246 = getelementptr inbounds %"class.basisu::color_rgba", ptr %245, i64 8
  br label %247

247:                                              ; preds = %249, %244
  %248 = phi ptr [ %245, %244 ], [ %250, %249 ]
  invoke void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %248)
          to label %249 unwind label %285

249:                                              ; preds = %247
  %250 = getelementptr inbounds %"class.basisu::color_rgba", ptr %248, i64 1
  %251 = icmp eq ptr %250, %246
  br i1 %251, label %252, label %247

252:                                              ; preds = %249
  %253 = load i8, ptr %6, align 1, !tbaa !9, !range !17, !noundef !18
  %254 = trunc i8 %253 to i1
  br i1 %254, label %255, label %304

255:                                              ; preds = %252
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #7
  %256 = getelementptr inbounds [2 x %"class.basisu::color_rgba"], ptr %28, i32 0, i32 0
  %257 = getelementptr inbounds %"class.basisu::color_rgba", ptr %256, i64 2
  br label %258

258:                                              ; preds = %260, %255
  %259 = phi ptr [ %256, %255 ], [ %261, %260 ]
  invoke void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %259)
          to label %260 unwind label %289

260:                                              ; preds = %258
  %261 = getelementptr inbounds %"class.basisu::color_rgba", ptr %259, i64 1
  %262 = icmp eq ptr %261, %257
  br i1 %262, label %263, label %258

263:                                              ; preds = %260
  %264 = load ptr, ptr %25, align 8, !tbaa !5
  %265 = getelementptr inbounds [2 x %"class.basisu::color_rgba"], ptr %28, i64 0, i64 0
  %266 = load i32, ptr %24, align 4, !tbaa !11
  %267 = invoke noundef zeroext i1 @_ZNK6basisu9etc_block25get_block_low_high_colorsEPNS_10color_rgbaEj(ptr noundef nonnull align 8 dereferenceable(8) %264, ptr noundef %265, i32 noundef %266)
          to label %268 unwind label %289

268:                                              ; preds = %263
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #7
  store i32 0, ptr %29, align 4, !tbaa !11
  br label %269

269:                                              ; preds = %300, %268
  %270 = load i32, ptr %29, align 4, !tbaa !11
  %271 = icmp ult i32 %270, 8
  br i1 %271, label %293, label %272

272:                                              ; preds = %269
  store i32 17, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #7
  br label %303

273:                                              ; preds = %225, %220
  %274 = landingpad { ptr, i32 }
          cleanup
  %275 = extractvalue { ptr, i32 } %274, 0
  store ptr %275, ptr %10, align 8
  %276 = extractvalue { ptr, i32 } %274, 1
  store i32 %276, ptr %11, align 4
  br label %351

277:                                              ; preds = %229
  %278 = landingpad { ptr, i32 }
          cleanup
  %279 = extractvalue { ptr, i32 } %278, 0
  store ptr %279, ptr %10, align 8
  %280 = extractvalue { ptr, i32 } %278, 1
  store i32 %280, ptr %11, align 4
  br label %350

281:                                              ; preds = %242, %239
  %282 = landingpad { ptr, i32 }
          cleanup
  %283 = extractvalue { ptr, i32 } %282, 0
  store ptr %283, ptr %10, align 8
  %284 = extractvalue { ptr, i32 } %282, 1
  store i32 %284, ptr %11, align 4
  br label %349

285:                                              ; preds = %336, %247
  %286 = landingpad { ptr, i32 }
          cleanup
  %287 = extractvalue { ptr, i32 } %286, 0
  store ptr %287, ptr %10, align 8
  %288 = extractvalue { ptr, i32 } %286, 1
  store i32 %288, ptr %11, align 4
  br label %348

289:                                              ; preds = %263, %258
  %290 = landingpad { ptr, i32 }
          cleanup
  %291 = extractvalue { ptr, i32 } %290, 0
  store ptr %291, ptr %10, align 8
  %292 = extractvalue { ptr, i32 } %290, 1
  store i32 %292, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #7
  br label %348

293:                                              ; preds = %269
  %294 = load i32, ptr %24, align 4, !tbaa !11
  %295 = zext i32 %294 to i64
  %296 = getelementptr inbounds [2 x %"class.basisu::color_rgba"], ptr %28, i64 0, i64 %295
  %297 = load i32, ptr %29, align 4, !tbaa !11
  %298 = zext i32 %297 to i64
  %299 = getelementptr inbounds [8 x %"class.basisu::color_rgba"], ptr %27, i64 0, i64 %298
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %299, ptr align 1 %296, i64 4, i1 false), !tbaa.struct !19
  br label %300

300:                                              ; preds = %293
  %301 = load i32, ptr %29, align 4, !tbaa !11
  %302 = add i32 %301, 1
  store i32 %302, ptr %29, align 4, !tbaa !11
  br label %269, !llvm.loop !21

303:                                              ; preds = %272
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #7
  br label %336

304:                                              ; preds = %252
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #7
  store i32 0, ptr %30, align 4, !tbaa !11
  br label %305

305:                                              ; preds = %328, %304
  %306 = load i32, ptr %30, align 4, !tbaa !11
  %307 = icmp ult i32 %306, 8
  br i1 %307, label %309, label %308

308:                                              ; preds = %305
  store i32 20, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #7
  br label %335

309:                                              ; preds = %305
  %310 = load ptr, ptr %26, align 8, !tbaa !5
  %311 = load ptr, ptr %25, align 8, !tbaa !5
  %312 = invoke noundef zeroext i1 @_ZNK6basisu9etc_block12get_flip_bitEv(ptr noundef nonnull align 8 dereferenceable(8) %311)
          to label %313 unwind label %331

313:                                              ; preds = %309
  %314 = zext i1 %312 to i64
  %315 = getelementptr inbounds [2 x [2 x [8 x i32]]], ptr @_ZN6basisu20g_etc1_pixel_indicesE, i64 0, i64 %314
  %316 = load i32, ptr %24, align 4, !tbaa !11
  %317 = zext i32 %316 to i64
  %318 = getelementptr inbounds [2 x [8 x i32]], ptr %315, i64 0, i64 %317
  %319 = load i32, ptr %30, align 4, !tbaa !11
  %320 = zext i32 %319 to i64
  %321 = getelementptr inbounds [8 x i32], ptr %318, i64 0, i64 %320
  %322 = load i32, ptr %321, align 4, !tbaa !11
  %323 = zext i32 %322 to i64
  %324 = getelementptr inbounds %"class.basisu::color_rgba", ptr %310, i64 %323
  %325 = load i32, ptr %30, align 4, !tbaa !11
  %326 = zext i32 %325 to i64
  %327 = getelementptr inbounds [8 x %"class.basisu::color_rgba"], ptr %27, i64 0, i64 %326
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %327, ptr align 1 %324, i64 4, i1 false), !tbaa.struct !19
  br label %328

328:                                              ; preds = %313
  %329 = load i32, ptr %30, align 4, !tbaa !11
  %330 = add i32 %329, 1
  store i32 %330, ptr %30, align 4, !tbaa !11
  br label %305, !llvm.loop !22

331:                                              ; preds = %309
  %332 = landingpad { ptr, i32 }
          cleanup
  %333 = extractvalue { ptr, i32 } %332, 0
  store ptr %333, ptr %10, align 8
  %334 = extractvalue { ptr, i32 } %332, 1
  store i32 %334, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #7
  br label %348

335:                                              ; preds = %308
  br label %336

336:                                              ; preds = %335, %303
  %337 = getelementptr inbounds [8 x %"class.basisu::color_rgba"], ptr %27, i64 0, i64 0
  %338 = load i32, ptr %21, align 4, !tbaa !11
  %339 = mul i32 5, %338
  %340 = add i32 12, %339
  %341 = load i32, ptr %16, align 4, !tbaa !11
  %342 = mul i32 3, %341
  %343 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN6basisu5image17set_block_clippedEPKNS_10color_rgbaEjjjj(ptr noundef nonnull align 8 dereferenceable(32) %15, ptr noundef %337, i32 noundef %340, i32 noundef %342, i32 noundef 4, i32 noundef 2)
          to label %344 unwind label %285

344:                                              ; preds = %336
  call void @llvm.lifetime.end.p0(i64 32, ptr %27) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  br label %345

345:                                              ; preds = %344
  %346 = load i32, ptr %21, align 4, !tbaa !11
  %347 = add i32 %346, 1
  store i32 %347, ptr %21, align 4, !tbaa !11
  br label %205, !llvm.loop !23

348:                                              ; preds = %331, %289, %285
  call void @llvm.lifetime.end.p0(i64 32, ptr %27) #7
  br label %349

349:                                              ; preds = %348, %281
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #7
  br label %350

350:                                              ; preds = %349, %277
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  br label %351

351:                                              ; preds = %350, %273
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  br label %352

352:                                              ; preds = %351, %216
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %357

353:                                              ; preds = %215
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %354

354:                                              ; preds = %353
  %355 = load i32, ptr %16, align 4, !tbaa !11
  %356 = add i32 %355, 1
  store i32 %356, ptr %16, align 4, !tbaa !11
  br label %117, !llvm.loop !24

357:                                              ; preds = %352, %200, %183
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #7
  br label %358

358:                                              ; preds = %357, %179
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  br label %359

359:                                              ; preds = %358, %175
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %360

360:                                              ; preds = %359, %128
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %374

361:                                              ; preds = %123
  %362 = load ptr, ptr %5, align 8, !tbaa !5
  %363 = invoke noundef zeroext i1 @_ZN6basisu8save_pngEPKcRKNS_5imageEjj(ptr noundef %362, ptr noundef nonnull align 8 dereferenceable(32) %15, i32 noundef 0, i32 noundef 0)
          to label %364 unwind label %370

364:                                              ; preds = %361
  %365 = load ptr, ptr %5, align 8, !tbaa !5
  invoke void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef @.str.48, ptr noundef %365)
          to label %366 unwind label %370

366:                                              ; preds = %364
  call void @_ZN6basisu5imageD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #7
  store i32 0, ptr %13, align 4
  br label %367

367:                                              ; preds = %366, %84
  call void @_ZN6basisu6vectorIjED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #7
  call void @_ZN6basisu6vectorIjED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  %368 = load i32, ptr %13, align 4
  switch i32 %368, label %383 [
    i32 0, label %369
    i32 1, label %369
  ]

369:                                              ; preds = %367, %367
  ret void

370:                                              ; preds = %364, %361
  %371 = landingpad { ptr, i32 }
          cleanup
  %372 = extractvalue { ptr, i32 } %371, 0
  store ptr %372, ptr %10, align 8
  %373 = extractvalue { ptr, i32 } %371, 1
  store i32 %373, ptr %11, align 4
  br label %374

374:                                              ; preds = %370, %360
  call void @_ZN6basisu5imageD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #7
  br label %375

375:                                              ; preds = %374, %124
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #7
  br label %376

376:                                              ; preds = %375, %93, %52
  call void @_ZN6basisu6vectorIjED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #7
  br label %377

377:                                              ; preds = %376, %48
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #7
  call void @_ZN6basisu6vectorIjED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %378

378:                                              ; preds = %377
  %379 = load ptr, ptr %10, align 8
  %380 = load i32, ptr %11, align 4
  %381 = insertvalue { ptr, i32 } poison, ptr %379, 0
  %382 = insertvalue { ptr, i32 } %381, i32 %380, 1
  resume { ptr, i32 } %382

383:                                              ; preds = %367
  unreachable
}

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6basisu9etc_block12set_flip_bitEb(ptr noundef nonnull align 8 dereferenceable(8), i1 noundef zeroext) #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK6basisu11pixel_block7get_ptrEv(ptr noundef nonnull align 1 dereferenceable(64)) #6 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6basisu5imageC2Ejjj(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef, i32 noundef) unnamed_addr #4 align 2

declare noundef zeroext i1 @_ZN6basisu8save_pngEPKcRKNS_5imageEjj(ptr noundef, ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef) #0

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

; 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 void @_ZN6basisu9etc_block5clearEv(ptr noundef nonnull align 8 dereferenceable(8)) #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6basisu9etc_block12set_diff_bitEb(ptr noundef nonnull align 8 dereferenceable(8), i1 noundef zeroext) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6basisu9etc_block15set_base5_colorEt(ptr noundef nonnull align 8 dereferenceable(8), i16 noundef zeroext) #2 align 2

declare noundef zeroext i16 @_ZN6basisu9etc_block11pack_color5ERKNS_10color_rgbaEbj(ptr noundef nonnull align 1 dereferenceable(4), i1 noundef zeroext, i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK6basisu9etc_block16get_block_colorsEPNS_10color_rgbaEj(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i32 noundef) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZN6basisu5image8fill_boxEjjjjRKNS_10color_rgbaE(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef nonnull align 1 dereferenceable(4)) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK6basisu9etc_block25get_block_low_high_colorsEPNS_10color_rgbaEj(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i32 noundef) #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6basisu9etc_block12get_flip_bitEv(ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZN6basisu5image17set_block_clippedEPKNS_10color_rgbaEjjjj(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #4 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{i64 0, i64 4, !20}
!20 = !{!7, !7, i64 0}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !14}
!23 = distinct !{!23, !14}
!24 = distinct !{!24, !14}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.basisu::vector.18" = type { ptr, i32, i32 }
%"class.basisu::image" = type { i32, i32, i32, %"class.basisu::vector.87" }
%"class.basisu::vector.87" = type { ptr, i32, i32 }
%"struct.basisu::etc_block" = type { %union.anon.22 }
%union.anon.22 = type { i64 }
%"class.basisu::color_rgba" = type { %union.anon }
%union.anon = type { [4 x i8] }

@_ZN6basisu20g_etc1_pixel_indicesE = external local_unnamed_addr constant [2 x [2 x [8 x i32]]], align 16
@.str.47 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [35 x i8], align 1

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6basisu15basisu_frontend42dump_endpoint_clusterization_visualizationEPKcb(ptr noundef nonnull align 8 dereferenceable(496) %0, ptr noundef %1, i1 noundef zeroext %2) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.basisu::vector.18", align 8
  %5 = alloca %"class.basisu::vector.18", align 8
  %6 = alloca %"class.basisu::image", align 8
  %7 = alloca %"struct.basisu::etc_block", align 8
  %8 = alloca [4 x %"class.basisu::color_rgba"], align 16
  %9 = alloca [8 x %"class.basisu::color_rgba"], align 16
  %10 = alloca [2 x %"class.basisu::color_rgba"], align 1
  tail call void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef nonnull @.str.47)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #6
  %11 = getelementptr inbounds i8, ptr %0, i64 216
  %12 = tail call noundef i32 @_ZNK6basisu6vectorINS0_IjEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %11)
  %13 = zext i32 %12 to i64
  call void @_ZN6basisu6vectorIjEC2Em(ptr noundef nonnull align 8 dereferenceable(16) %4, i64 noundef %13)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #6
  %14 = call noundef i32 @_ZNK6basisu6vectorINS0_IjEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %11)
  %15 = zext i32 %14 to i64
  invoke void @_ZN6basisu6vectorIjEC2Em(ptr noundef nonnull align 8 dereferenceable(16) %5, i64 noundef %15)
          to label %.preheader88 unwind label %18

.preheader88:                                     ; preds = %3
  %16 = call noundef i32 @_ZNK6basisu6vectorINS0_IjEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %11)
  %.not103 = icmp eq i32 %16, 0
  br i1 %.not103, label %._crit_edge.thread, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph
  %.not = icmp eq i32 %22, 0
  br i1 %.not, label %._crit_edge.thread, label %.preheader87

.preheader87:                                     ; preds = %._crit_edge
  %17 = call noundef i32 @_ZNK6basisu6vectorINS0_IjEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %11)
  %.not104 = icmp eq i32 %17, 0
  br i1 %.not104, label %._crit_edge93, label %.lr.ph92

18:                                               ; preds = %3
  %19 = landingpad { ptr, i32 }
          cleanup
  br label %176

.lr.ph:                                           ; preds = %.preheader88, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader88 ]
  %.05290 = phi i32 [ %22, %.lr.ph ], [ 0, %.preheader88 ]
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN6basisu6vectorINS0_IjEEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %11, i64 noundef %indvars.iv)
  %21 = call noundef i32 @_ZNK6basisu6vectorIjE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %20)
  %22 = call noundef i32 @_ZN6basisu7maximumIjEET_S1_S1_(i32 noundef %.05290, i32 noundef %21)
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN6basisu6vectorINS0_IjEEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %11, i64 noundef %indvars.iv)
  %24 = call noundef i32 @_ZNK6basisu6vectorIjE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %23)
  %25 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %4, i64 noundef %indvars.iv)
  store i32 %24, ptr %25, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %26 = call noundef i32 @_ZNK6basisu6vectorINS0_IjEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %11)
  %27 = zext i32 %26 to i64
  %28 = icmp ult i64 %indvars.iv.next, %27
  br i1 %28, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge93:                                    ; preds = %.lr.ph92, %.preheader87
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #6
  %29 = call noundef i32 @_ZN6basisu7minimumIjEET_S1_S1_(i32 noundef %22, i32 noundef 2048)
  %30 = mul i32 %29, 5
  %31 = add i32 %30, 12
  %32 = call noundef i32 @_ZNK6basisu6vectorINS0_IjEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %11)
  %33 = mul i32 %32, 3
  invoke void @_ZN6basisu5imageC2Ejjj(ptr noundef nonnull align 8 dereferenceable(32) %6, i32 noundef %31, i32 noundef %33, i32 noundef -1)
          to label %.preheader86 unwind label %43

.preheader86:                                     ; preds = %._crit_edge93
  %34 = call noundef i32 @_ZNK6basisu6vectorINS0_IjEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %11)
  %.not105 = icmp eq i32 %34, 0
  br i1 %.not105, label %._crit_edge102, label %.lr.ph101

.lr.ph101:                                        ; preds = %.preheader86
  %35 = getelementptr inbounds i8, ptr %0, i64 280
  %36 = getelementptr inbounds i8, ptr %0, i64 160
  %.ptr.1 = getelementptr inbounds i8, ptr %8, i64 4
  %.ptr.2 = getelementptr inbounds i8, ptr %8, i64 8
  %.ptr.3 = getelementptr inbounds i8, ptr %8, i64 12
  %.ptr69.1 = getelementptr inbounds i8, ptr %9, i64 4
  %.ptr69.2 = getelementptr inbounds i8, ptr %9, i64 8
  %.ptr69.3 = getelementptr inbounds i8, ptr %9, i64 12
  %.ptr69.4 = getelementptr inbounds i8, ptr %9, i64 16
  %.ptr69.5 = getelementptr inbounds i8, ptr %9, i64 20
  %.ptr69.6 = getelementptr inbounds i8, ptr %9, i64 24
  %.ptr69.7 = getelementptr inbounds i8, ptr %9, i64 28
  %.ptr73.1 = getelementptr inbounds i8, ptr %10, i64 4
  br label %45

.lr.ph92:                                         ; preds = %.preheader87, %.lr.ph92
  %indvars.iv108 = phi i64 [ %indvars.iv.next109, %.lr.ph92 ], [ 0, %.preheader87 ]
  %37 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %5, i64 noundef %indvars.iv108)
  %38 = trunc nuw i64 %indvars.iv108 to i32
  store i32 %38, ptr %37, align 4, !tbaa !5
  %indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
  %39 = call noundef i32 @_ZNK6basisu6vectorINS0_IjEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %11)
  %40 = zext i32 %39 to i64
  %41 = icmp ult i64 %indvars.iv.next109, %40
  br i1 %41, label %.lr.ph92, label %._crit_edge93, !llvm.loop !11

._crit_edge102:                                   ; preds = %._crit_edge99, %.preheader86
  %42 = invoke noundef zeroext i1 @_ZN6basisu8save_pngEPKcRKNS_5imageEjj(ptr noundef %1, ptr noundef nonnull align 8 dereferenceable(32) %6, i32 noundef 0, i32 noundef 0)
          to label %170 unwind label %172

43:                                               ; preds = %._crit_edge93
  %44 = landingpad { ptr, i32 }
          cleanup
  br label %175

45:                                               ; preds = %.lr.ph101, %._crit_edge99
  %indvars.iv123 = phi i64 [ 0, %.lr.ph101 ], [ %indvars.iv.next124, %._crit_edge99 ]
  %46 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %5, i64 noundef %indvars.iv123)
  %47 = load i32, ptr %46, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  invoke void @_ZN6basisu9etc_block5clearEv(ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %48 unwind label %61

48:                                               ; preds = %45
  call void @_ZN6basisu9etc_block12set_flip_bitEb(ptr noundef nonnull align 8 dereferenceable(8) %7, i1 noundef zeroext false)
  call void @_ZN6basisu9etc_block12set_diff_bitEb(ptr noundef nonnull align 8 dereferenceable(8) %7, i1 noundef zeroext true)
  %49 = zext i32 %47 to i64
  %50 = call noundef nonnull align 8 dereferenceable(51) ptr @_ZN6basisu6vectorINS_15basisu_frontend27endpoint_cluster_etc_paramsEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %35, i64 noundef %49)
  %51 = getelementptr inbounds i8, ptr %50, i64 8
  %52 = load i32, ptr %51, align 8, !tbaa !5
  invoke void @_ZN6basisu9etc_block22set_inten_tables_etc1sEj(ptr noundef nonnull align 8 dereferenceable(8) %7, i32 noundef %52)
          to label %53 unwind label %61

53:                                               ; preds = %48
  %54 = call noundef nonnull align 8 dereferenceable(51) ptr @_ZN6basisu6vectorINS_15basisu_frontend27endpoint_cluster_etc_paramsEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %35, i64 noundef %49)
  %55 = invoke noundef zeroext i16 @_ZN6basisu9etc_block11pack_color5ERKNS_10color_rgbaEbj(ptr noundef nonnull align 1 dereferenceable(4) %54, i1 noundef zeroext false, i32 noundef 127)
          to label %56 unwind label %61

56:                                               ; preds = %53
  call void @_ZN6basisu9etc_block15set_base5_colorEt(ptr noundef nonnull align 8 dereferenceable(8) %7, i16 noundef zeroext %55)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #6
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %8)
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %.ptr.1)
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %.ptr.2)
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %.ptr.3)
  %57 = invoke noundef zeroext i1 @_ZNK6basisu9etc_block16get_block_colorsEPNS_10color_rgbaEj(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull %8, i32 noundef 0)
          to label %.preheader85 unwind label %63

.preheader85:                                     ; preds = %56
  %58 = trunc nuw i64 %indvars.iv123 to i32
  %59 = mul i32 %58, 3
  %60 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN6basisu5image8fill_boxEjjjjRKNS_10color_rgbaE(ptr noundef nonnull align 8 dereferenceable(32) %6, i32 noundef 0, i32 noundef %59, i32 noundef 2, i32 noundef 2, ptr noundef nonnull align 1 dereferenceable(4) %8)
          to label %65 unwind label %73

61:                                               ; preds = %53, %48, %45
  %62 = landingpad { ptr, i32 }
          cleanup
  br label %169

63:                                               ; preds = %56
  %64 = landingpad { ptr, i32 }
          cleanup
  br label %168

65:                                               ; preds = %.preheader85
  %66 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN6basisu5image8fill_boxEjjjjRKNS_10color_rgbaE(ptr noundef nonnull align 8 dereferenceable(32) %6, i32 noundef 2, i32 noundef %59, i32 noundef 2, i32 noundef 2, ptr noundef nonnull align 1 dereferenceable(4) %.ptr.1)
          to label %67 unwind label %73

67:                                               ; preds = %65
  %68 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN6basisu5image8fill_boxEjjjjRKNS_10color_rgbaE(ptr noundef nonnull align 8 dereferenceable(32) %6, i32 noundef 4, i32 noundef %59, i32 noundef 2, i32 noundef 2, ptr noundef nonnull align 1 dereferenceable(4) %.ptr.2)
          to label %69 unwind label %73

69:                                               ; preds = %67
  %70 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN6basisu5image8fill_boxEjjjjRKNS_10color_rgbaE(ptr noundef nonnull align 8 dereferenceable(32) %6, i32 noundef 6, i32 noundef %59, i32 noundef 2, i32 noundef 2, ptr noundef nonnull align 1 dereferenceable(4) %.ptr.3)
          to label %.preheader84 unwind label %73

.preheader84:                                     ; preds = %69
  %71 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN6basisu6vectorINS0_IjEEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %11, i64 noundef %49)
  %72 = call noundef i32 @_ZNK6basisu6vectorIjE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %71)
  %.not106 = icmp eq i32 %72, 0
  br i1 %.not106, label %._crit_edge99, label %.lr.ph98

73:                                               ; preds = %69, %67, %65, %.preheader85
  %74 = landingpad { ptr, i32 }
          cleanup
  br label %168

._crit_edge99:                                    ; preds = %162, %.preheader84
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  %indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1
  %75 = call noundef i32 @_ZNK6basisu6vectorINS0_IjEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %11)
  %76 = zext i32 %75 to i64
  %77 = icmp ult i64 %indvars.iv.next124, %76
  br i1 %77, label %45, label %._crit_edge102, !llvm.loop !12

.lr.ph98:                                         ; preds = %.preheader84, %162
  %indvars.iv120 = phi i64 [ %indvars.iv.next121, %162 ], [ 0, %.preheader84 ]
  %78 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN6basisu6vectorINS0_IjEEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %11, i64 noundef %49)
  %79 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6basisu6vectorIjEixEm(ptr noundef nonnull align 8 dereferenceable(16) %78, i64 noundef %indvars.iv120)
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = lshr i32 %80, 1
  %82 = and i32 %80, 1
  %83 = zext nneg i32 %81 to i64
  %84 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN6basisu6vectorINS_9etc_blockEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %36, i64 noundef %83)
  %85 = invoke noundef nonnull align 1 dereferenceable(64) ptr @_ZNK6basisu15basisu_frontend22get_source_pixel_blockEj(ptr noundef nonnull align 8 dereferenceable(496) %0, i32 noundef %81)
          to label %86 unwind label %152

86:                                               ; preds = %.lr.ph98
  %87 = call noundef ptr @_ZNK6basisu11pixel_block7get_ptrEv(ptr noundef nonnull align 1 dereferenceable(64) %85)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #6
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %9)
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %.ptr69.1)
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %.ptr69.2)
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %.ptr69.3)
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %.ptr69.4)
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %.ptr69.5)
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %.ptr69.6)
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %.ptr69.7)
  br i1 %2, label %145, label %.preheader83

.preheader83:                                     ; preds = %86
  %88 = zext nneg i32 %82 to i64
  %89 = call noundef zeroext i1 @_ZNK6basisu9etc_block12get_flip_bitEv(ptr noundef nonnull align 8 dereferenceable(8) %84)
  %90 = zext i1 %89 to i64
  %91 = getelementptr inbounds [2 x [2 x [8 x i32]]], ptr @_ZN6basisu20g_etc1_pixel_indicesE, i64 0, i64 %90, i64 %88, i64 0
  %92 = load i32, ptr %91, align 16, !tbaa !5
  %93 = zext i32 %92 to i64
  %94 = getelementptr inbounds %"class.basisu::color_rgba", ptr %87, i64 %93
  %95 = load i32, ptr %94, align 1, !tbaa !13
  store i32 %95, ptr %9, align 16, !tbaa !13
  %96 = call noundef zeroext i1 @_ZNK6basisu9etc_block12get_flip_bitEv(ptr noundef nonnull align 8 dereferenceable(8) %84)
  %97 = zext i1 %96 to i64
  %98 = getelementptr inbounds [2 x [2 x [8 x i32]]], ptr @_ZN6basisu20g_etc1_pixel_indicesE, i64 0, i64 %97, i64 %88, i64 1
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = zext i32 %99 to i64
  %101 = getelementptr inbounds %"class.basisu::color_rgba", ptr %87, i64 %100
  %102 = load i32, ptr %101, align 1, !tbaa !13
  store i32 %102, ptr %.ptr69.1, align 4, !tbaa !13
  %103 = call noundef zeroext i1 @_ZNK6basisu9etc_block12get_flip_bitEv(ptr noundef nonnull align 8 dereferenceable(8) %84)
  %104 = zext i1 %103 to i64
  %105 = getelementptr inbounds [2 x [2 x [8 x i32]]], ptr @_ZN6basisu20g_etc1_pixel_indicesE, i64 0, i64 %104, i64 %88, i64 2
  %106 = load i32, ptr %105, align 8, !tbaa !5
  %107 = zext i32 %106 to i64
  %108 = getelementptr inbounds %"class.basisu::color_rgba", ptr %87, i64 %107
  %109 = load i32, ptr %108, align 1, !tbaa !13
  store i32 %109, ptr %.ptr69.2, align 8, !tbaa !13
  %110 = call noundef zeroext i1 @_ZNK6basisu9etc_block12get_flip_bitEv(ptr noundef nonnull align 8 dereferenceable(8) %84)
  %111 = zext i1 %110 to i64
  %112 = getelementptr inbounds [2 x [2 x [8 x i32]]], ptr @_ZN6basisu20g_etc1_pixel_indicesE, i64 0, i64 %111, i64 %88, i64 3
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = zext i32 %113 to i64
  %115 = getelementptr inbounds %"class.basisu::color_rgba", ptr %87, i64 %114
  %116 = load i32, ptr %115, align 1, !tbaa !13
  store i32 %116, ptr %.ptr69.3, align 4, !tbaa !13
  %117 = call noundef zeroext i1 @_ZNK6basisu9etc_block12get_flip_bitEv(ptr noundef nonnull align 8 dereferenceable(8) %84)
  %118 = zext i1 %117 to i64
  %119 = getelementptr inbounds [2 x [2 x [8 x i32]]], ptr @_ZN6basisu20g_etc1_pixel_indicesE, i64 0, i64 %118, i64 %88, i64 4
  %120 = load i32, ptr %119, align 16, !tbaa !5
  %121 = zext i32 %120 to i64
  %122 = getelementptr inbounds %"class.basisu::color_rgba", ptr %87, i64 %121
  %123 = load i32, ptr %122, align 1, !tbaa !13
  store i32 %123, ptr %.ptr69.4, align 16, !tbaa !13
  %124 = call noundef zeroext i1 @_ZNK6basisu9etc_block12get_flip_bitEv(ptr noundef nonnull align 8 dereferenceable(8) %84)
  %125 = zext i1 %124 to i64
  %126 = getelementptr inbounds [2 x [2 x [8 x i32]]], ptr @_ZN6basisu20g_etc1_pixel_indicesE, i64 0, i64 %125, i64 %88, i64 5
  %127 = load i32, ptr %126, align 4, !tbaa !5
  %128 = zext i32 %127 to i64
  %129 = getelementptr inbounds %"class.basisu::color_rgba", ptr %87, i64 %128
  %130 = load i32, ptr %129, align 1, !tbaa !13
  store i32 %130, ptr %.ptr69.5, align 4, !tbaa !13
  %131 = call noundef zeroext i1 @_ZNK6basisu9etc_block12get_flip_bitEv(ptr noundef nonnull align 8 dereferenceable(8) %84)
  %132 = zext i1 %131 to i64
  %133 = getelementptr inbounds [2 x [2 x [8 x i32]]], ptr @_ZN6basisu20g_etc1_pixel_indicesE, i64 0, i64 %132, i64 %88, i64 6
  %134 = load i32, ptr %133, align 8, !tbaa !5
  %135 = zext i32 %134 to i64
  %136 = getelementptr inbounds %"class.basisu::color_rgba", ptr %87, i64 %135
  %137 = load i32, ptr %136, align 1, !tbaa !13
  store i32 %137, ptr %.ptr69.6, align 8, !tbaa !13
  %138 = call noundef zeroext i1 @_ZNK6basisu9etc_block12get_flip_bitEv(ptr noundef nonnull align 8 dereferenceable(8) %84)
  %139 = zext i1 %138 to i64
  %140 = getelementptr inbounds [2 x [2 x [8 x i32]]], ptr @_ZN6basisu20g_etc1_pixel_indicesE, i64 0, i64 %139, i64 %88, i64 7
  %141 = load i32, ptr %140, align 4, !tbaa !5
  %142 = zext i32 %141 to i64
  %143 = getelementptr inbounds %"class.basisu::color_rgba", ptr %87, i64 %142
  %144 = load i32, ptr %143, align 1, !tbaa !13
  store i32 %144, ptr %.ptr69.7, align 4, !tbaa !13
  br label %.loopexit

145:                                              ; preds = %86
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #6
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %10)
  call void @_ZN6basisu10color_rgbaC2Ev(ptr noundef nonnull align 1 dereferenceable(4) %.ptr73.1)
  %146 = invoke noundef zeroext i1 @_ZNK6basisu9etc_block25get_block_low_high_colorsEPNS_10color_rgbaEj(ptr noundef nonnull align 8 dereferenceable(8) %84, ptr noundef nonnull %10, i32 noundef %82)
          to label %.preheader unwind label %156

.preheader:                                       ; preds = %145
  %147 = zext nneg i32 %82 to i64
  %148 = getelementptr inbounds [2 x %"class.basisu::color_rgba"], ptr %10, i64 0, i64 %147
  %149 = load i32, ptr %148, align 1, !tbaa !13
  %150 = insertelement <4 x i32> poison, i32 %149, i64 0
  %151 = shufflevector <4 x i32> %150, <4 x i32> poison, <4 x i32> zeroinitializer
  store <4 x i32> %151, ptr %9, align 16, !tbaa !13
  store <4 x i32> %151, ptr %.ptr69.4, align 16, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  br label %.loopexit

152:                                              ; preds = %.lr.ph98
  %153 = landingpad { ptr, i32 }
          cleanup
  br label %168

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

156:                                              ; preds = %145
  %157 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  br label %167

.loopexit:                                        ; preds = %.preheader83, %.preheader
  %158 = trunc nuw i64 %indvars.iv120 to i32
  %159 = mul i32 %158, 5
  %160 = add i32 %159, 12
  %161 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN6basisu5image17set_block_clippedEPKNS_10color_rgbaEjjjj(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull %9, i32 noundef %160, i32 noundef %59, i32 noundef 4, i32 noundef 2)
          to label %162 unwind label %154

162:                                              ; preds = %.loopexit
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #6
  %indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1
  %163 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN6basisu6vectorINS0_IjEEEixEm(ptr noundef nonnull align 8 dereferenceable(16) %11, i64 noundef %49)
  %164 = call noundef i32 @_ZNK6basisu6vectorIjE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %163)
  %165 = zext i32 %164 to i64
  %166 = icmp ult i64 %indvars.iv.next121, %165
  br i1 %166, label %.lr.ph98, label %._crit_edge99, !llvm.loop !14

167:                                              ; preds = %156, %154
  %.pn = phi { ptr, i32 } [ %155, %154 ], [ %157, %156 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #6
  br label %168

168:                                              ; preds = %152, %167, %73, %63
  %.pn77 = phi { ptr, i32 } [ %74, %73 ], [ %64, %63 ], [ %.pn, %167 ], [ %153, %152 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #6
  br label %169

169:                                              ; preds = %168, %61
  %.pn77.pn = phi { ptr, i32 } [ %.pn77, %168 ], [ %62, %61 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  br label %174

170:                                              ; preds = %._crit_edge102
  invoke void (ptr, ...) @_ZN6basisu12debug_printfEPKcz(ptr noundef nonnull @.str.48, ptr noundef %1)
          to label %171 unwind label %172

171:                                              ; preds = %170
  call void @_ZN6basisu5imageD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #6
  br label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %.preheader88, %._crit_edge, %171
  call void @_ZN6basisu6vectorIjED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #6
  call void @_ZN6basisu6vectorIjED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #6
  ret void

172:                                              ; preds = %170, %._crit_edge102
  %173 = landingpad { ptr, i32 }
          cleanup
  br label %174

174:                                              ; preds = %172, %169
  %.pn77.pn.pn = phi { ptr, i32 } [ %.pn77.pn, %169 ], [ %173, %172 ]
  call void @_ZN6basisu5imageD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #6
  br label %175

175:                                              ; preds = %174, %43
  %.pn77.pn.pn.pn = phi { ptr, i32 } [ %.pn77.pn.pn, %174 ], [ %44, %43 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #6
  call void @_ZN6basisu6vectorIjED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #6
  br label %176

176:                                              ; preds = %175, %18
  %.pn77.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn77.pn.pn.pn, %175 ], [ %19, %18 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #6
  call void @_ZN6basisu6vectorIjED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #6
  resume { ptr, i32 } %.pn77.pn.pn.pn.pn
}

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK6basisu11pixel_block7get_ptrEv(ptr noundef nonnull align 1 dereferenceable(64)) local_unnamed_addr #5 align 2

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

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

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

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

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

declare noundef zeroext i1 @_ZN6basisu8save_pngEPKcRKNS_5imageEjj(ptr noundef, ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

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

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

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

declare noundef zeroext i16 @_ZN6basisu9etc_block11pack_color5ERKNS_10color_rgbaEbj(ptr noundef nonnull align 1 dereferenceable(4), i1 noundef zeroext, i32 noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZN6basisu5image8fill_boxEjjjjRKNS_10color_rgbaE(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef nonnull align 1 dereferenceable(4)) local_unnamed_addr #3 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZN6basisu5image17set_block_clippedEPKNS_10color_rgbaEjjjj(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #3 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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !10}


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