; LLVM IR from aap/librw :: src/d3d/xbox.ll (ZN2rw4xbox13rasterToImageEPNS_6RasterE)

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

%"struct.rw::Raster" = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, i32, i32, i32, ptr, i32, i32 }
%"struct.rw::xbox::XboxRaster" = type { ptr, ptr, i32, i32, i8, i8, i32 }
%"struct.rw::Image" = type { i32, i32, i32, i32, i32, i32, ptr, ptr }

@.str.1 = external hidden unnamed_addr constant [60 x i8], align 1
@_ZN2rw4xbox18nativeRasterOffsetE = external dso_local global i32, align 4
@.str.14 = external hidden unnamed_addr constant [22 x i8], align 1
@__PRETTY_FUNCTION__._ZN2rw4xbox13rasterToImageEPNS_6RasterE = external hidden unnamed_addr constant [41 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [32 x i8], align 1

; 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: mustprogress uwtable
define dso_local noundef ptr @_ZN2rw4xbox13rasterToImageEPNS_6RasterE(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i8, align 1
  %19 = alloca i32, align 4
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #5
  store i8 0, ptr %6, align 1, !tbaa !9
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %"struct.rw::Raster", ptr %22, i32 0, i32 9
  %24 = load ptr, ptr %23, align 8, !tbaa !11
  %25 = icmp eq ptr %24, null
  br i1 %25, label %26, label %29

26:                                               ; preds = %1
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = call noundef ptr @_ZN2rw6Raster4lockEii(ptr noundef nonnull align 8 dereferenceable(96) %27, i32 noundef 0, i32 noundef 2)
  store i8 1, ptr %6, align 1, !tbaa !9
  br label %29

29:                                               ; preds = %26, %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = load i32, ptr @_ZN2rw4xbox18nativeRasterOffsetE, align 4, !tbaa !14
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds i8, ptr %30, i64 %32
  store ptr %33, ptr %7, align 8, !tbaa !5
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = getelementptr inbounds %"struct.rw::xbox::XboxRaster", ptr %34, i32 0, i32 5
  %36 = load i8, ptr %35, align 1, !tbaa !15, !range !17, !noundef !18
  %37 = trunc i8 %36 to i1
  br i1 %37, label %38, label %97

38:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  %40 = getelementptr inbounds %"struct.rw::Raster", ptr %39, i32 0, i32 5
  %41 = load i32, ptr %40, align 4, !tbaa !19
  store i32 %41, ptr %8, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = getelementptr inbounds %"struct.rw::Raster", ptr %42, i32 0, i32 6
  %44 = load i32, ptr %43, align 8, !tbaa !20
  store i32 %44, ptr %9, align 4, !tbaa !14
  %45 = load i32, ptr %8, align 4, !tbaa !14
  %46 = icmp slt i32 %45, 4
  br i1 %46, label %47, label %48

47:                                               ; preds = %38
  store i32 4, ptr %8, align 4, !tbaa !14
  br label %48

48:                                               ; preds = %47, %38
  %49 = load i32, ptr %9, align 4, !tbaa !14
  %50 = icmp slt i32 %49, 4
  br i1 %50, label %51, label %52

51:                                               ; preds = %48
  store i32 4, ptr %9, align 4, !tbaa !14
  br label %52

52:                                               ; preds = %51, %48
  %53 = load i32, ptr %8, align 4, !tbaa !14
  %54 = load i32, ptr %9, align 4, !tbaa !14
  %55 = call noundef ptr @_ZN2rw5Image6createEiii(i32 noundef %53, i32 noundef %54, i32 noundef 32)
  store ptr %55, ptr %5, align 8, !tbaa !5
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN2rw5Image8allocateEv(ptr noundef nonnull align 8 dereferenceable(40) %56)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  %58 = getelementptr inbounds %"struct.rw::Raster", ptr %57, i32 0, i32 9
  %59 = load ptr, ptr %58, align 8, !tbaa !11
  store ptr %59, ptr %10, align 8, !tbaa !5
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = getelementptr inbounds %"struct.rw::xbox::XboxRaster", ptr %60, i32 0, i32 2
  %62 = load i32, ptr %61, align 8, !tbaa !21
  switch i32 %62, label %79 [
    i32 12, label %63
    i32 14, label %73
    i32 15, label %76
  ]

63:                                               ; preds = %52
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN2rw5Image12setPixelsDXTEiPh(ptr noundef nonnull align 8 dereferenceable(40) %64, i32 noundef 1, ptr noundef %65)
  %66 = load ptr, ptr %7, align 8, !tbaa !5
  %67 = getelementptr inbounds %"struct.rw::xbox::XboxRaster", ptr %66, i32 0, i32 4
  %68 = load i8, ptr %67, align 8, !tbaa !22, !range !17, !noundef !18
  %69 = trunc i8 %68 to i1
  br i1 %69, label %72, label %70

70:                                               ; preds = %63
  %71 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN2rw5Image10removeMaskEv(ptr noundef nonnull align 8 dereferenceable(40) %71)
  br label %72

72:                                               ; preds = %70, %63
  br label %80

73:                                               ; preds = %52
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN2rw5Image12setPixelsDXTEiPh(ptr noundef nonnull align 8 dereferenceable(40) %74, i32 noundef 3, ptr noundef %75)
  br label %80

76:                                               ; preds = %52
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN2rw5Image12setPixelsDXTEiPh(ptr noundef nonnull align 8 dereferenceable(40) %77, i32 noundef 5, ptr noundef %78)
  br label %80

79:                                               ; preds = %52
  call void @__assert_fail(ptr noundef @.str.14, ptr noundef @.str.1, i32 noundef 730, ptr noundef @__PRETTY_FUNCTION__._ZN2rw4xbox13rasterToImageEPNS_6RasterE) #6
  unreachable

80:                                               ; preds = %76, %73, %72
  %81 = load ptr, ptr %3, align 8, !tbaa !5
  %82 = getelementptr inbounds %"struct.rw::Raster", ptr %81, i32 0, i32 5
  %83 = load i32, ptr %82, align 4, !tbaa !19
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  %85 = getelementptr inbounds %"struct.rw::Image", ptr %84, i32 0, i32 1
  store i32 %83, ptr %85, align 4, !tbaa !23
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = getelementptr inbounds %"struct.rw::Raster", ptr %86, i32 0, i32 6
  %88 = load i32, ptr %87, align 8, !tbaa !20
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = getelementptr inbounds %"struct.rw::Image", ptr %89, i32 0, i32 2
  store i32 %88, ptr %90, align 8, !tbaa !25
  %91 = load i8, ptr %6, align 1, !tbaa !9, !range !17, !noundef !18
  %92 = trunc i8 %91 to i1
  br i1 %92, label %93, label %95

93:                                               ; preds = %80
  %94 = load ptr, ptr %3, align 8, !tbaa !5
  call void @_ZN2rw6Raster6unlockEi(ptr noundef nonnull align 8 dereferenceable(96) %94, i32 noundef 0)
  br label %95

95:                                               ; preds = %93, %80
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %96, ptr %2, align 8
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %263

97:                                               ; preds = %29
  %98 = load ptr, ptr %3, align 8, !tbaa !5
  %99 = getelementptr inbounds %"struct.rw::Raster", ptr %98, i32 0, i32 4
  %100 = load i32, ptr %99, align 8, !tbaa !26
  %101 = and i32 %100, 3840
  switch i32 %101, label %106 [
    i32 256, label %102
    i32 1280, label %103
    i32 1536, label %104
    i32 2560, label %105
    i32 512, label %107
    i32 768, label %107
    i32 1024, label %107
  ]

102:                                              ; preds = %97
  store i32 16, ptr %4, align 4, !tbaa !14
  br label %108

103:                                              ; preds = %97
  store i32 32, ptr %4, align 4, !tbaa !14
  br label %108

104:                                              ; preds = %97
  store i32 24, ptr %4, align 4, !tbaa !14
  br label %108

105:                                              ; preds = %97
  store i32 16, ptr %4, align 4, !tbaa !14
  br label %108

106:                                              ; preds = %97
  br label %107

107:                                              ; preds = %106, %97, %97, %97
  call void @__assert_fail(ptr noundef @.str.15, ptr noundef @.str.1, i32 noundef 763, ptr noundef @__PRETTY_FUNCTION__._ZN2rw4xbox13rasterToImageEPNS_6RasterE) #6
  unreachable

108:                                              ; preds = %105, %104, %103, %102
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !14
  %109 = load ptr, ptr %3, align 8, !tbaa !5
  %110 = getelementptr inbounds %"struct.rw::Raster", ptr %109, i32 0, i32 4
  %111 = load i32, ptr %110, align 8, !tbaa !26
  %112 = and i32 %111, 16384
  %113 = icmp eq i32 %112, 16384
  br i1 %113, label %114, label %115

114:                                              ; preds = %108
  store i32 4, ptr %4, align 4, !tbaa !14
  store i32 16, ptr %12, align 4, !tbaa !14
  br label %123

115:                                              ; preds = %108
  %116 = load ptr, ptr %3, align 8, !tbaa !5
  %117 = getelementptr inbounds %"struct.rw::Raster", ptr %116, i32 0, i32 4
  %118 = load i32, ptr %117, align 8, !tbaa !26
  %119 = and i32 %118, 8192
  %120 = icmp eq i32 %119, 8192
  br i1 %120, label %121, label %122

121:                                              ; preds = %115
  store i32 8, ptr %4, align 4, !tbaa !14
  store i32 256, ptr %12, align 4, !tbaa !14
  br label %122

122:                                              ; preds = %121, %115
  br label %123

123:                                              ; preds = %122, %114
  %124 = load ptr, ptr %3, align 8, !tbaa !5
  %125 = getelementptr inbounds %"struct.rw::Raster", ptr %124, i32 0, i32 5
  %126 = load i32, ptr %125, align 4, !tbaa !19
  %127 = load ptr, ptr %3, align 8, !tbaa !5
  %128 = getelementptr inbounds %"struct.rw::Raster", ptr %127, i32 0, i32 6
  %129 = load i32, ptr %128, align 8, !tbaa !20
  %130 = load i32, ptr %4, align 4, !tbaa !14
  %131 = call noundef ptr @_ZN2rw5Image6createEiii(i32 noundef %126, i32 noundef %129, i32 noundef %130)
  store ptr %131, ptr %5, align 8, !tbaa !5
  %132 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN2rw5Image8allocateEv(ptr noundef nonnull align 8 dereferenceable(40) %132)
  %133 = load i32, ptr %12, align 4, !tbaa !14
  %134 = icmp ne i32 %133, 0
  br i1 %134, label %135, label %158

135:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %136 = load ptr, ptr %5, align 8, !tbaa !5
  %137 = getelementptr inbounds %"struct.rw::Image", ptr %136, i32 0, i32 7
  %138 = load ptr, ptr %137, align 8, !tbaa !27
  store ptr %138, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %139 = load ptr, ptr %7, align 8, !tbaa !5
  %140 = getelementptr inbounds %"struct.rw::xbox::XboxRaster", ptr %139, i32 0, i32 1
  %141 = load ptr, ptr %140, align 8, !tbaa !28
  store ptr %141, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !14
  br label %142

142:                                              ; preds = %154, %135
  %143 = load i32, ptr %15, align 4, !tbaa !14
  %144 = load i32, ptr %12, align 4, !tbaa !14
  %145 = icmp slt i32 %143, %144
  br i1 %145, label %147, label %146

146:                                              ; preds = %142
  store i32 4, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %157

147:                                              ; preds = %142
  %148 = load ptr, ptr %13, align 8, !tbaa !5
  %149 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_ZN2rw27conv_BGRA8888_from_RGBA8888EPhS0_(ptr noundef %148, ptr noundef %149)
  %150 = load ptr, ptr %14, align 8, !tbaa !5
  %151 = getelementptr inbounds i8, ptr %150, i64 4
  store ptr %151, ptr %14, align 8, !tbaa !5
  %152 = load ptr, ptr %13, align 8, !tbaa !5
  %153 = getelementptr inbounds i8, ptr %152, i64 4
  store ptr %153, ptr %13, align 8, !tbaa !5
  br label %154

154:                                              ; preds = %147
  %155 = load i32, ptr %15, align 4, !tbaa !14
  %156 = add nsw i32 %155, 1
  store i32 %156, ptr %15, align 4, !tbaa !14
  br label %142, !llvm.loop !29

157:                                              ; preds = %146
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %158

158:                                              ; preds = %157, %123
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %159 = load ptr, ptr %5, align 8, !tbaa !5
  %160 = getelementptr inbounds %"struct.rw::Image", ptr %159, i32 0, i32 6
  %161 = load ptr, ptr %160, align 8, !tbaa !31
  store ptr %161, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %162 = load ptr, ptr %3, align 8, !tbaa !5
  %163 = getelementptr inbounds %"struct.rw::Raster", ptr %162, i32 0, i32 9
  %164 = load ptr, ptr %163, align 8, !tbaa !11
  store ptr %164, ptr %17, align 8, !tbaa !5
  %165 = load ptr, ptr %5, align 8, !tbaa !5
  %166 = getelementptr inbounds %"struct.rw::Image", ptr %165, i32 0, i32 4
  %167 = load i32, ptr %166, align 8, !tbaa !32
  %168 = load ptr, ptr %7, align 8, !tbaa !5
  %169 = getelementptr inbounds %"struct.rw::xbox::XboxRaster", ptr %168, i32 0, i32 3
  %170 = load i32, ptr %169, align 4, !tbaa !33
  %171 = icmp eq i32 %167, %170
  br i1 %171, label %172, label %173

172:                                              ; preds = %158
  br label %175

173:                                              ; preds = %158
  call void @__assert_fail(ptr noundef @.str.16, ptr noundef @.str.1, i32 noundef 792, ptr noundef @__PRETTY_FUNCTION__._ZN2rw4xbox13rasterToImageEPNS_6RasterE) #6
  unreachable

174:                                              ; No predecessors!
  br label %175

175:                                              ; preds = %174, %172
  %176 = load ptr, ptr %5, align 8, !tbaa !5
  %177 = getelementptr inbounds %"struct.rw::Image", ptr %176, i32 0, i32 5
  %178 = load i32, ptr %177, align 4, !tbaa !34
  %179 = load ptr, ptr %3, align 8, !tbaa !5
  %180 = getelementptr inbounds %"struct.rw::Raster", ptr %179, i32 0, i32 8
  %181 = load i32, ptr %180, align 8, !tbaa !35
  %182 = icmp eq i32 %178, %181
  br i1 %182, label %183, label %184

183:                                              ; preds = %175
  br label %186

184:                                              ; preds = %175
  call void @__assert_fail(ptr noundef @.str.17, ptr noundef @.str.1, i32 noundef 793, ptr noundef @__PRETTY_FUNCTION__._ZN2rw4xbox13rasterToImageEPNS_6RasterE) #6
  unreachable

185:                                              ; No predecessors!
  br label %186

186:                                              ; preds = %185, %183
  %187 = load ptr, ptr %16, align 8, !tbaa !5
  %188 = load ptr, ptr %17, align 8, !tbaa !5
  %189 = load ptr, ptr %5, align 8, !tbaa !5
  %190 = getelementptr inbounds %"struct.rw::Image", ptr %189, i32 0, i32 1
  %191 = load i32, ptr %190, align 4, !tbaa !23
  %192 = load ptr, ptr %5, align 8, !tbaa !5
  %193 = getelementptr inbounds %"struct.rw::Image", ptr %192, i32 0, i32 2
  %194 = load i32, ptr %193, align 8, !tbaa !25
  %195 = load ptr, ptr %5, align 8, !tbaa !5
  %196 = getelementptr inbounds %"struct.rw::Image", ptr %195, i32 0, i32 4
  %197 = load i32, ptr %196, align 8, !tbaa !32
  call void @_ZN2rw4xboxL9unswizzleEPhS1_iii(ptr noundef %187, ptr noundef %188, i32 noundef %191, i32 noundef %194, i32 noundef %197)
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #5
  %198 = load i32, ptr %4, align 4, !tbaa !14
  %199 = icmp sgt i32 %198, 8
  br i1 %199, label %200, label %255

200:                                              ; preds = %186
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  store i32 0, ptr %19, align 4, !tbaa !14
  br label %201

201:                                              ; preds = %251, %200
  %202 = load i32, ptr %19, align 4, !tbaa !14
  %203 = load ptr, ptr %5, align 8, !tbaa !5
  %204 = getelementptr inbounds %"struct.rw::Image", ptr %203, i32 0, i32 2
  %205 = load i32, ptr %204, align 8, !tbaa !25
  %206 = icmp slt i32 %202, %205
  br i1 %206, label %208, label %207

207:                                              ; preds = %201
  store i32 7, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  br label %254

208:                                              ; preds = %201
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %209 = load ptr, ptr %16, align 8, !tbaa !5
  store ptr %209, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  store i32 0, ptr %21, align 4, !tbaa !14
  br label %210

210:                                              ; preds = %241, %208
  %211 = load i32, ptr %21, align 4, !tbaa !14
  %212 = load ptr, ptr %5, align 8, !tbaa !5
  %213 = getelementptr inbounds %"struct.rw::Image", ptr %212, i32 0, i32 1
  %214 = load i32, ptr %213, align 4, !tbaa !23
  %215 = icmp slt i32 %211, %214
  br i1 %215, label %217, label %216

216:                                              ; preds = %210
  store i32 10, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  br label %244

217:                                              ; preds = %210
  %218 = load ptr, ptr %3, align 8, !tbaa !5
  %219 = getelementptr inbounds %"struct.rw::Raster", ptr %218, i32 0, i32 4
  %220 = load i32, ptr %219, align 8, !tbaa !26
  %221 = and i32 %220, 3840
  switch i32 %221, label %240 [
    i32 1280, label %222
    i32 1536, label %222
  ]

222:                                              ; preds = %217, %217
  %223 = load ptr, ptr %20, align 8, !tbaa !5
  %224 = getelementptr inbounds i8, ptr %223, i64 0
  %225 = load i8, ptr %224, align 1, !tbaa !36
  store i8 %225, ptr %18, align 1, !tbaa !36
  %226 = load ptr, ptr %20, align 8, !tbaa !5
  %227 = getelementptr inbounds i8, ptr %226, i64 2
  %228 = load i8, ptr %227, align 1, !tbaa !36
  %229 = load ptr, ptr %20, align 8, !tbaa !5
  %230 = getelementptr inbounds i8, ptr %229, i64 0
  store i8 %228, ptr %230, align 1, !tbaa !36
  %231 = load i8, ptr %18, align 1, !tbaa !36
  %232 = load ptr, ptr %20, align 8, !tbaa !5
  %233 = getelementptr inbounds i8, ptr %232, i64 2
  store i8 %231, ptr %233, align 1, !tbaa !36
  %234 = load ptr, ptr %5, align 8, !tbaa !5
  %235 = getelementptr inbounds %"struct.rw::Image", ptr %234, i32 0, i32 4
  %236 = load i32, ptr %235, align 8, !tbaa !32
  %237 = load ptr, ptr %20, align 8, !tbaa !5
  %238 = sext i32 %236 to i64
  %239 = getelementptr inbounds i8, ptr %237, i64 %238
  store ptr %239, ptr %20, align 8, !tbaa !5
  br label %240

240:                                              ; preds = %222, %217
  br label %241

241:                                              ; preds = %240
  %242 = load i32, ptr %21, align 4, !tbaa !14
  %243 = add nsw i32 %242, 1
  store i32 %243, ptr %21, align 4, !tbaa !14
  br label %210, !llvm.loop !37

244:                                              ; preds = %216
  %245 = load ptr, ptr %5, align 8, !tbaa !5
  %246 = getelementptr inbounds %"struct.rw::Image", ptr %245, i32 0, i32 5
  %247 = load i32, ptr %246, align 4, !tbaa !34
  %248 = load ptr, ptr %16, align 8, !tbaa !5
  %249 = sext i32 %247 to i64
  %250 = getelementptr inbounds i8, ptr %248, i64 %249
  store ptr %250, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  br label %251

251:                                              ; preds = %244
  %252 = load i32, ptr %19, align 4, !tbaa !14
  %253 = add nsw i32 %252, 1
  store i32 %253, ptr %19, align 4, !tbaa !14
  br label %201, !llvm.loop !38

254:                                              ; preds = %207
  br label %255

255:                                              ; preds = %254, %186
  %256 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN2rw5Image15compressPaletteEv(ptr noundef nonnull align 8 dereferenceable(40) %256)
  %257 = load i8, ptr %6, align 1, !tbaa !9, !range !17, !noundef !18
  %258 = trunc i8 %257 to i1
  br i1 %258, label %259, label %261

259:                                              ; preds = %255
  %260 = load ptr, ptr %3, align 8, !tbaa !5
  call void @_ZN2rw6Raster6unlockEi(ptr noundef nonnull align 8 dereferenceable(96) %260, i32 noundef 0)
  br label %261

261:                                              ; preds = %259, %255
  %262 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %262, ptr %2, align 8
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %263

263:                                              ; preds = %261, %95
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  %264 = load ptr, ptr %2, align 8
  ret ptr %264
}

declare noundef ptr @_ZN2rw6Raster4lockEii(ptr noundef nonnull align 8 dereferenceable(96), i32 noundef, i32 noundef) #3

declare noundef ptr @_ZN2rw5Image6createEiii(i32 noundef, i32 noundef, i32 noundef) #3

declare void @_ZN2rw5Image8allocateEv(ptr noundef nonnull align 8 dereferenceable(40)) #3

declare void @_ZN2rw5Image12setPixelsDXTEiPh(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef, ptr noundef) #3

declare void @_ZN2rw5Image10removeMaskEv(ptr noundef nonnull align 8 dereferenceable(40)) #3

declare void @_ZN2rw6Raster6unlockEi(ptr noundef nonnull align 8 dereferenceable(96), i32 noundef) #3

declare void @_ZN2rw27conv_BGRA8888_from_RGBA8888EPhS0_(ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZN2rw4xboxL9unswizzleEPhS1_iii(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef) #4

declare void @_ZN2rw5Image15compressPaletteEv(ptr noundef nonnull align 8 dereferenceable(40)) #3

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 = { 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 #3 = { "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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { 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, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{!12, !6, i64 40}
!12 = !{!"_ZTSN2rw6RasterE", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !13, i64 64, !13, i64 68, !13, i64 72, !6, i64 80, !13, i64 88, !13, i64 92}
!13 = !{!"int", !7, i64 0}
!14 = !{!13, !13, i64 0}
!15 = !{!16, !10, i64 25}
!16 = !{!"_ZTSN2rw4xbox10XboxRasterE", !6, i64 0, !6, i64 8, !13, i64 16, !13, i64 20, !10, i64 24, !10, i64 25, !13, i64 28}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!12, !13, i64 20}
!20 = !{!12, !13, i64 24}
!21 = !{!16, !13, i64 16}
!22 = !{!16, !10, i64 24}
!23 = !{!24, !13, i64 4}
!24 = !{!"_ZTSN2rw5ImageE", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !6, i64 24, !6, i64 32}
!25 = !{!24, !13, i64 8}
!26 = !{!12, !13, i64 16}
!27 = !{!24, !6, i64 32}
!28 = !{!16, !6, i64 8}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = !{!24, !6, i64 24}
!32 = !{!24, !13, i64 16}
!33 = !{!16, !13, i64 20}
!34 = !{!24, !13, i64 20}
!35 = !{!12, !13, i64 32}
!36 = !{!7, !7, i64 0}
!37 = distinct !{!37, !30}
!38 = distinct !{!38, !30}


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

@.str.1 = external hidden unnamed_addr constant [60 x i8], align 1
@_ZN2rw4xbox18nativeRasterOffsetE = external dso_local local_unnamed_addr global i32, align 4
@.str.14 = external hidden unnamed_addr constant [22 x i8], align 1
@__PRETTY_FUNCTION__._ZN2rw4xbox13rasterToImageEPNS_6RasterE = external hidden unnamed_addr constant [41 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [32 x i8], align 1
@switch.table._ZN2rw4xbox13rasterToImageEPNS_6RasterE = private unnamed_addr constant [10 x i32] [i32 16, i32 16, i32 16, i32 16, i32 32, i32 24, i32 16, i32 16, i32 16, i32 16], align 4

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN2rw4xbox13rasterToImageEPNS_6RasterE(ptr noundef %0) local_unnamed_addr #1 {
  %2 = getelementptr inbounds i8, ptr %0, i64 40
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = icmp eq ptr %3, null
  br i1 %4, label %5, label %7

5:                                                ; preds = %1
  %6 = tail call noundef ptr @_ZN2rw6Raster4lockEii(ptr noundef nonnull align 8 dereferenceable(96) %0, i32 noundef 0, i32 noundef 2)
  br label %7

7:                                                ; preds = %5, %1
  %8 = load i32, ptr @_ZN2rw4xbox18nativeRasterOffsetE, align 4, !tbaa !11
  %9 = sext i32 %8 to i64
  %10 = getelementptr inbounds i8, ptr %0, i64 %9
  %11 = getelementptr inbounds i8, ptr %10, i64 25
  %12 = load i8, ptr %11, align 1, !tbaa !12, !range !15, !noundef !16
  %13 = trunc nuw i8 %12 to i1
  br i1 %13, label %14, label %34

14:                                               ; preds = %7
  %15 = getelementptr inbounds i8, ptr %0, i64 20
  %16 = load i32, ptr %15, align 4, !tbaa !17
  %17 = getelementptr inbounds i8, ptr %0, i64 24
  %18 = load i32, ptr %17, align 8, !tbaa !18
  %spec.store.select = tail call i32 @llvm.smax.i32(i32 %16, i32 4)
  %spec.store.select1 = tail call i32 @llvm.smax.i32(i32 %18, i32 4)
  %19 = tail call noundef ptr @_ZN2rw5Image6createEiii(i32 noundef %spec.store.select, i32 noundef %spec.store.select1, i32 noundef 32)
  tail call void @_ZN2rw5Image8allocateEv(ptr noundef nonnull align 8 dereferenceable(40) %19)
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %10, i64 16
  %22 = load i32, ptr %21, align 8, !tbaa !19
  switch i32 %22, label %30 [
    i32 12, label %23
    i32 14, label %28
    i32 15, label %29
  ]

23:                                               ; preds = %14
  tail call void @_ZN2rw5Image12setPixelsDXTEiPh(ptr noundef nonnull align 8 dereferenceable(40) %19, i32 noundef 1, ptr noundef %20)
  %24 = getelementptr inbounds i8, ptr %10, i64 24
  %25 = load i8, ptr %24, align 8, !tbaa !20, !range !15, !noundef !16
  %26 = trunc nuw i8 %25 to i1
  br i1 %26, label %31, label %27

27:                                               ; preds = %23
  tail call void @_ZN2rw5Image10removeMaskEv(ptr noundef nonnull align 8 dereferenceable(40) %19)
  br label %31

28:                                               ; preds = %14
  tail call void @_ZN2rw5Image12setPixelsDXTEiPh(ptr noundef nonnull align 8 dereferenceable(40) %19, i32 noundef 3, ptr noundef %20)
  br label %31

29:                                               ; preds = %14
  tail call void @_ZN2rw5Image12setPixelsDXTEiPh(ptr noundef nonnull align 8 dereferenceable(40) %19, i32 noundef 5, ptr noundef %20)
  br label %31

30:                                               ; preds = %14
  tail call void @__assert_fail(ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.1, i32 noundef 730, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw4xbox13rasterToImageEPNS_6RasterE) #5
  unreachable

31:                                               ; preds = %23, %27, %29, %28
  %32 = getelementptr inbounds i8, ptr %19, i64 4
  %33 = load <2 x i32>, ptr %15, align 4, !tbaa !11
  store <2 x i32> %33, ptr %32, align 4, !tbaa !11
  br i1 %4, label %.sink.split, label %112

34:                                               ; preds = %7
  %35 = getelementptr inbounds i8, ptr %0, i64 16
  %36 = load i32, ptr %35, align 8, !tbaa !21
  %37 = and i32 %36, 3840
  %38 = add nsw i32 %37, -256
  %39 = lshr exact i32 %38, 8
  %40 = icmp ult i32 %38, 2560
  br i1 %40, label %switch.hole_check, label %41

41:                                               ; preds = %switch.hole_check, %34
  tail call void @__assert_fail(ptr noundef nonnull @.str.15, ptr noundef nonnull @.str.1, i32 noundef 763, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw4xbox13rasterToImageEPNS_6RasterE) #5
  unreachable

switch.hole_check:                                ; preds = %34
  %switch.maskindex = trunc nuw i32 %39 to i16
  %switch.shifted = lshr i16 561, %switch.maskindex
  %switch.lobit = trunc i16 %switch.shifted to i1
  br i1 %switch.lobit, label %switch.lookup, label %41

switch.lookup:                                    ; preds = %switch.hole_check
  %42 = and i32 %36, 16384
  %.not = icmp eq i32 %42, 0
  br i1 %.not, label %43, label %47

43:                                               ; preds = %switch.lookup
  %44 = zext nneg i32 %39 to i64
  %switch.gep = getelementptr inbounds [10 x i32], ptr @switch.table._ZN2rw4xbox13rasterToImageEPNS_6RasterE, i64 0, i64 %44
  %switch.load = load i32, ptr %switch.gep, align 4
  %45 = and i32 %36, 8192
  %.not91 = icmp eq i32 %45, 0
  br i1 %.not91, label %47, label %46

46:                                               ; preds = %43
  br label %47

47:                                               ; preds = %switch.lookup, %43, %46
  %.not92 = phi i1 [ false, %46 ], [ true, %43 ], [ false, %switch.lookup ]
  %.088 = phi i32 [ 256, %46 ], [ 0, %43 ], [ 16, %switch.lookup ]
  %.183 = phi i32 [ 8, %46 ], [ %switch.load, %43 ], [ 4, %switch.lookup ]
  %48 = getelementptr inbounds i8, ptr %0, i64 20
  %49 = load i32, ptr %48, align 4, !tbaa !17
  %50 = getelementptr inbounds i8, ptr %0, i64 24
  %51 = load i32, ptr %50, align 8, !tbaa !18
  %52 = tail call noundef ptr @_ZN2rw5Image6createEiii(i32 noundef %49, i32 noundef %51, i32 noundef %.183)
  tail call void @_ZN2rw5Image8allocateEv(ptr noundef nonnull align 8 dereferenceable(40) %52)
  br i1 %.not92, label %.loopexit94, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %47
  %53 = getelementptr inbounds i8, ptr %10, i64 8
  %54 = load ptr, ptr %53, align 8, !tbaa !22
  %55 = getelementptr inbounds i8, ptr %52, i64 32
  %56 = load ptr, ptr %55, align 8, !tbaa !23
  %umax = tail call i32 @llvm.umax.i32(i32 %.088, i32 1)
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %.08597 = phi i32 [ %59, %.lr.ph ], [ 0, %.lr.ph.preheader ]
  %.08696 = phi ptr [ %57, %.lr.ph ], [ %54, %.lr.ph.preheader ]
  %.08795 = phi ptr [ %58, %.lr.ph ], [ %56, %.lr.ph.preheader ]
  tail call void @_ZN2rw27conv_BGRA8888_from_RGBA8888EPhS0_(ptr noundef %.08795, ptr noundef %.08696)
  %57 = getelementptr inbounds i8, ptr %.08696, i64 4
  %58 = getelementptr inbounds i8, ptr %.08795, i64 4
  %59 = add nuw nsw i32 %.08597, 1
  %exitcond.not = icmp eq i32 %59, %umax
  br i1 %exitcond.not, label %.loopexit94, label %.lr.ph, !llvm.loop !25

.loopexit94:                                      ; preds = %.lr.ph, %47
  %60 = getelementptr inbounds i8, ptr %52, i64 24
  %61 = load ptr, ptr %60, align 8, !tbaa !27
  %62 = load ptr, ptr %2, align 8, !tbaa !5
  %63 = getelementptr inbounds i8, ptr %52, i64 16
  %64 = load i32, ptr %63, align 8, !tbaa !28
  %65 = getelementptr inbounds i8, ptr %10, i64 20
  %66 = load i32, ptr %65, align 4, !tbaa !29
  %67 = icmp eq i32 %64, %66
  br i1 %67, label %69, label %68

68:                                               ; preds = %.loopexit94
  tail call void @__assert_fail(ptr noundef nonnull @.str.16, ptr noundef nonnull @.str.1, i32 noundef 792, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw4xbox13rasterToImageEPNS_6RasterE) #5
  unreachable

69:                                               ; preds = %.loopexit94
  %70 = getelementptr inbounds i8, ptr %52, i64 20
  %71 = load i32, ptr %70, align 4, !tbaa !30
  %72 = getelementptr inbounds i8, ptr %0, i64 32
  %73 = load i32, ptr %72, align 8, !tbaa !31
  %74 = icmp eq i32 %71, %73
  br i1 %74, label %76, label %75

75:                                               ; preds = %69
  tail call void @__assert_fail(ptr noundef nonnull @.str.17, ptr noundef nonnull @.str.1, i32 noundef 793, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw4xbox13rasterToImageEPNS_6RasterE) #5
  unreachable

76:                                               ; preds = %69
  %77 = getelementptr inbounds i8, ptr %52, i64 4
  %78 = load i32, ptr %77, align 4, !tbaa !32
  %79 = getelementptr inbounds i8, ptr %52, i64 8
  %80 = load i32, ptr %79, align 8, !tbaa !33
  tail call void @_ZN2rw4xboxL9unswizzleEPhS1_iii(ptr noundef %61, ptr noundef %62, i32 noundef %78, i32 noundef %80, i32 noundef %64)
  %81 = icmp sgt i32 %.183, 8
  br i1 %81, label %.preheader93, label %.loopexit

.preheader93:                                     ; preds = %76
  %82 = load i32, ptr %79, align 8, !tbaa !33
  %83 = icmp sgt i32 %82, 0
  br i1 %83, label %.preheader.lr.ph, label %.loopexit

.preheader.lr.ph:                                 ; preds = %.preheader93
  %84 = load i32, ptr %77, align 4, !tbaa !32
  %85 = icmp sgt i32 %84, 0
  br i1 %85, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %.preheader.lr.ph, %._crit_edge
  %86 = phi i32 [ %90, %._crit_edge ], [ %82, %.preheader.lr.ph ]
  %87 = phi i32 [ %91, %._crit_edge ], [ %84, %.preheader.lr.ph ]
  %88 = phi i32 [ %92, %._crit_edge ], [ %84, %.preheader.lr.ph ]
  %.080102 = phi i32 [ %96, %._crit_edge ], [ 0, %.preheader.lr.ph ]
  %.084101 = phi ptr [ %95, %._crit_edge ], [ %61, %.preheader.lr.ph ]
  %89 = icmp sgt i32 %88, 0
  br i1 %89, label %.lr.ph100, label %._crit_edge

._crit_edge.loopexit:                             ; preds = %108
  %.pre104 = load i32, ptr %79, align 8, !tbaa !33
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %90 = phi i32 [ %.pre104, %._crit_edge.loopexit ], [ %86, %.preheader ]
  %91 = phi i32 [ %109, %._crit_edge.loopexit ], [ %87, %.preheader ]
  %92 = phi i32 [ %109, %._crit_edge.loopexit ], [ %88, %.preheader ]
  %93 = load i32, ptr %70, align 4, !tbaa !30
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds i8, ptr %.084101, i64 %94
  %96 = add nuw nsw i32 %.080102, 1
  %97 = icmp slt i32 %96, %90
  br i1 %97, label %.preheader, label %.loopexit, !llvm.loop !34

.lr.ph100:                                        ; preds = %.preheader, %108
  %98 = phi i32 [ %109, %108 ], [ %87, %.preheader ]
  %.099 = phi i32 [ %110, %108 ], [ 0, %.preheader ]
  %.07998 = phi ptr [ %.1, %108 ], [ %.084101, %.preheader ]
  %99 = load i32, ptr %35, align 8, !tbaa !21
  %100 = and i32 %99, 3840
  switch i32 %100, label %108 [
    i32 1280, label %101
    i32 1536, label %101
  ]

101:                                              ; preds = %.lr.ph100, %.lr.ph100
  %102 = load i8, ptr %.07998, align 1, !tbaa !36
  %103 = getelementptr inbounds i8, ptr %.07998, i64 2
  %104 = load i8, ptr %103, align 1, !tbaa !36
  store i8 %104, ptr %.07998, align 1, !tbaa !36
  store i8 %102, ptr %103, align 1, !tbaa !36
  %105 = load i32, ptr %63, align 8, !tbaa !28
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds i8, ptr %.07998, i64 %106
  %.pre = load i32, ptr %77, align 4, !tbaa !32
  br label %108

108:                                              ; preds = %.lr.ph100, %101
  %109 = phi i32 [ %98, %.lr.ph100 ], [ %.pre, %101 ]
  %.1 = phi ptr [ %.07998, %.lr.ph100 ], [ %107, %101 ]
  %110 = add nuw nsw i32 %.099, 1
  %111 = icmp slt i32 %110, %109
  br i1 %111, label %.lr.ph100, label %._crit_edge.loopexit, !llvm.loop !37

.loopexit:                                        ; preds = %._crit_edge, %.preheader.lr.ph, %.preheader93, %76
  tail call void @_ZN2rw5Image15compressPaletteEv(ptr noundef nonnull align 8 dereferenceable(40) %52)
  br i1 %4, label %.sink.split, label %112

.sink.split:                                      ; preds = %.loopexit, %31
  %.081.ph = phi ptr [ %19, %31 ], [ %52, %.loopexit ]
  tail call void @_ZN2rw6Raster6unlockEi(ptr noundef nonnull align 8 dereferenceable(96) %0, i32 noundef 0)
  br label %112

112:                                              ; preds = %.sink.split, %.loopexit, %31
  %.081 = phi ptr [ %19, %31 ], [ %52, %.loopexit ], [ %.081.ph, %.sink.split ]
  ret ptr %.081
}

declare noundef ptr @_ZN2rw6Raster4lockEii(ptr noundef nonnull align 8 dereferenceable(96), i32 noundef, i32 noundef) local_unnamed_addr #2

declare noundef ptr @_ZN2rw5Image6createEiii(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

declare void @_ZN2rw5Image8allocateEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #2

declare void @_ZN2rw5Image12setPixelsDXTEiPh(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef, ptr noundef) local_unnamed_addr #2

declare void @_ZN2rw5Image10removeMaskEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #2

declare void @_ZN2rw6Raster6unlockEi(ptr noundef nonnull align 8 dereferenceable(96), i32 noundef) local_unnamed_addr #2

declare void @_ZN2rw27conv_BGRA8888_from_RGBA8888EPhS0_(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZN2rw4xboxL9unswizzleEPhS1_iii(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

declare void @_ZN2rw5Image15compressPaletteEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #2

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

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

attributes #0 = { 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 #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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, !10, i64 40}
!6 = !{!"_ZTSN2rw6RasterE", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !7, i64 64, !7, i64 68, !7, i64 72, !10, i64 80, !7, i64 88, !7, i64 92}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !14, i64 25}
!13 = !{!"_ZTSN2rw4xbox10XboxRasterE", !10, i64 0, !10, i64 8, !7, i64 16, !7, i64 20, !14, i64 24, !14, i64 25, !7, i64 28}
!14 = !{!"bool", !8, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!6, !7, i64 20}
!18 = !{!6, !7, i64 24}
!19 = !{!13, !7, i64 16}
!20 = !{!13, !14, i64 24}
!21 = !{!6, !7, i64 16}
!22 = !{!13, !10, i64 8}
!23 = !{!24, !10, i64 32}
!24 = !{!"_ZTSN2rw5ImageE", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !10, i64 24, !10, i64 32}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = !{!24, !10, i64 24}
!28 = !{!24, !7, i64 16}
!29 = !{!13, !7, i64 20}
!30 = !{!24, !7, i64 20}
!31 = !{!6, !7, i64 32}
!32 = !{!24, !7, i64 4}
!33 = !{!24, !7, i64 8}
!34 = distinct !{!34, !26, !35}
!35 = !{!"llvm.loop.unswitch.partial.disable"}
!36 = !{!8, !8, i64 0}
!37 = distinct !{!37, !26}


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