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

; 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::Error" = type { i32, i32 }
%"struct.rw::Raster" = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, i32, i32, i32, ptr, i32, i32 }
%"struct.rw::Image" = type { i32, i32, i32, i32, i32, i32, ptr, ptr }
%"struct.rw::d3d::D3dRaster" = type { ptr, ptr, ptr, i32, i32, i8, i8, i8 }

@_ZN2rw3d3d13isP8supportedE = external dso_local global i32, align 4
@_ZN2rw3d3d18nativeRasterOffsetE = external dso_local global i32, align 4
@stderr = external global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [7 x i8], align 1
@stdout = external global ptr, align 8
@.str.8 = external hidden unnamed_addr constant [7 x i8], align 1
@__PRETTY_FUNCTION__._ZN2rw3d3d15rasterFromImageEPNS_6RasterEPNS_5ImageE = external hidden unnamed_addr constant [51 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.10 = 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: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

declare noundef ptr @_ZN2rw9dbgsprintEjz(i32 noundef, ...) #2

declare void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef) #2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN2rw3d3d15rasterFromImageEPNS_6RasterEPNS_5ImageE(ptr noundef %0, ptr noundef %1) #4 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %"struct.rw::Error", align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i8, align 1
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %"struct.rw::Raster", ptr %23, i32 0, i32 1
  %25 = load i32, ptr %24, align 4, !tbaa !9
  %26 = and i32 %25, 15
  %27 = icmp ne i32 %26, 4
  br i1 %27, label %28, label %29

28:                                               ; preds = %2
  store i32 0, ptr %3, align 4
  br label %286

29:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store ptr null, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  store ptr null, ptr %7, align 8, !tbaa !5
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %"struct.rw::Image", ptr %30, i32 0, i32 3
  %32 = load i32, ptr %31, align 4, !tbaa !12
  %33 = icmp sle i32 %32, 8
  br i1 %33, label %34, label %65

34:                                               ; preds = %29
  %35 = load i32, ptr @_ZN2rw3d3d13isP8supportedE, align 4, !tbaa !14
  %36 = icmp ne i32 %35, 0
  br i1 %36, label %65, label %37

37:                                               ; preds = %34
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %"struct.rw::Image", ptr %38, i32 0, i32 1
  %40 = load i32, ptr %39, align 4, !tbaa !15
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %"struct.rw::Image", ptr %41, i32 0, i32 2
  %43 = load i32, ptr %42, align 8, !tbaa !16
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %"struct.rw::Image", ptr %44, i32 0, i32 3
  %46 = load i32, ptr %45, align 4, !tbaa !12
  %47 = call noundef ptr @_ZN2rw5Image6createEiii(i32 noundef %40, i32 noundef %43, i32 noundef %46)
  store ptr %47, ptr %7, align 8, !tbaa !5
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = getelementptr inbounds %"struct.rw::Image", ptr %48, i32 0, i32 6
  %50 = load ptr, ptr %49, align 8, !tbaa !17
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = getelementptr inbounds %"struct.rw::Image", ptr %51, i32 0, i32 6
  store ptr %50, ptr %52, align 8, !tbaa !17
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = getelementptr inbounds %"struct.rw::Image", ptr %53, i32 0, i32 5
  %55 = load i32, ptr %54, align 4, !tbaa !18
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  %57 = getelementptr inbounds %"struct.rw::Image", ptr %56, i32 0, i32 5
  store i32 %55, ptr %57, align 4, !tbaa !18
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = getelementptr inbounds %"struct.rw::Image", ptr %58, i32 0, i32 7
  %60 = load ptr, ptr %59, align 8, !tbaa !19
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  %62 = getelementptr inbounds %"struct.rw::Image", ptr %61, i32 0, i32 7
  store ptr %60, ptr %62, align 8, !tbaa !19
  %63 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN2rw5Image11unpalettizeEb(ptr noundef nonnull align 8 dereferenceable(40) %63, i1 noundef zeroext false)
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %64, ptr %5, align 8, !tbaa !5
  br label %65

65:                                               ; preds = %37, %34, %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = load i32, ptr @_ZN2rw3d3d18nativeRasterOffsetE, align 4, !tbaa !14
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds i8, ptr %66, i64 %68
  store ptr %69, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  %71 = getelementptr inbounds %"struct.rw::Raster", ptr %70, i32 0, i32 4
  %72 = load i32, ptr %71, align 8, !tbaa !20
  %73 = and i32 %72, 28416
  store i32 %73, ptr %9, align 4, !tbaa !14
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds %"struct.rw::Image", ptr %74, i32 0, i32 3
  %76 = load i32, ptr %75, align 4, !tbaa !12
  switch i32 %76, label %120 [
    i32 32, label %77
    i32 24, label %88
    i32 16, label %99
    i32 8, label %105
    i32 4, label %111
  ]

77:                                               ; preds = %65
  %78 = load i32, ptr %9, align 4, !tbaa !14
  %79 = icmp eq i32 %78, 1280
  br i1 %79, label %80, label %81

80:                                               ; preds = %77
  store ptr @_ZN2rw27conv_BGRA8888_from_RGBA8888EPhS0_, ptr %6, align 8, !tbaa !5
  br label %87

81:                                               ; preds = %77
  %82 = load i32, ptr %9, align 4, !tbaa !14
  %83 = icmp eq i32 %82, 1536
  br i1 %83, label %84, label %85

84:                                               ; preds = %81
  store ptr @_ZN2rw23conv_BGR888_from_RGB888EPhS0_, ptr %6, align 8, !tbaa !5
  br label %86

85:                                               ; preds = %81
  br label %121

86:                                               ; preds = %84
  br label %87

87:                                               ; preds = %86, %80
  br label %140

88:                                               ; preds = %65
  %89 = load i32, ptr %9, align 4, !tbaa !14
  %90 = icmp eq i32 %89, 1280
  br i1 %90, label %91, label %92

91:                                               ; preds = %88
  store ptr @_ZN2rw25conv_BGRA8888_from_RGB888EPhS0_, ptr %6, align 8, !tbaa !5
  br label %98

92:                                               ; preds = %88
  %93 = load i32, ptr %9, align 4, !tbaa !14
  %94 = icmp eq i32 %93, 1536
  br i1 %94, label %95, label %96

95:                                               ; preds = %92
  store ptr @_ZN2rw23conv_BGR888_from_RGB888EPhS0_, ptr %6, align 8, !tbaa !5
  br label %97

96:                                               ; preds = %92
  br label %121

97:                                               ; preds = %95
  br label %98

98:                                               ; preds = %97, %91
  br label %140

99:                                               ; preds = %65
  %100 = load i32, ptr %9, align 4, !tbaa !14
  %101 = icmp eq i32 %100, 256
  br i1 %101, label %102, label %103

102:                                              ; preds = %99
  store ptr @_ZN2rw27conv_ARGB1555_from_ARGB1555EPhS0_, ptr %6, align 8, !tbaa !5
  br label %104

103:                                              ; preds = %99
  br label %121

104:                                              ; preds = %102
  br label %140

105:                                              ; preds = %65
  %106 = load i32, ptr %9, align 4, !tbaa !14
  %107 = icmp eq i32 %106, 9472
  br i1 %107, label %108, label %109

108:                                              ; preds = %105
  store ptr @_ZN2rw13conv_8_from_8EPhS0_, ptr %6, align 8, !tbaa !5
  br label %110

109:                                              ; preds = %105
  br label %121

110:                                              ; preds = %108
  br label %140

111:                                              ; preds = %65
  %112 = load i32, ptr %9, align 4, !tbaa !14
  %113 = icmp eq i32 %112, 17664
  br i1 %113, label %117, label %114

114:                                              ; preds = %111
  %115 = load i32, ptr %9, align 4, !tbaa !14
  %116 = icmp eq i32 %115, 9472
  br i1 %116, label %117, label %118

117:                                              ; preds = %114, %111
  store ptr @_ZN2rw13conv_8_from_8EPhS0_, ptr %6, align 8, !tbaa !5
  br label %119

118:                                              ; preds = %114
  br label %121

119:                                              ; preds = %117
  br label %140

120:                                              ; preds = %65
  br label %121

121:                                              ; preds = %120, %118, %109, %103, %96, %85
  %122 = load ptr, ptr @stderr, align 8, !tbaa !5
  %123 = load ptr, ptr %5, align 8, !tbaa !5
  %124 = getelementptr inbounds %"struct.rw::Image", ptr %123, i32 0, i32 3
  %125 = load i32, ptr %124, align 4, !tbaa !12
  %126 = load i32, ptr %9, align 4, !tbaa !14
  %127 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %122, ptr noundef @.str.7, i32 noundef %125, i32 noundef %126) #6
  %128 = load ptr, ptr @stdout, align 8, !tbaa !5
  %129 = call i32 @fflush(ptr noundef %128)
  br label %130

130:                                              ; preds = %121
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %131 = getelementptr inbounds %"struct.rw::Error", ptr %10, i32 0, i32 0
  store i32 2816, ptr %131, align 4, !tbaa !21
  %132 = getelementptr inbounds %"struct.rw::Error", ptr %10, i32 0, i32 1
  store i32 -2147483638, ptr %132, align 4, !tbaa !23
  %133 = load ptr, ptr @stderr, align 8, !tbaa !5
  %134 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %133, ptr noundef @.str.3, ptr noundef @.str.4, i32 noundef 785) #6
  %135 = load ptr, ptr @stderr, align 8, !tbaa !5
  %136 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483638)
  %137 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %135, ptr noundef @.str.5, ptr noundef %136) #6
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef %10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %138

138:                                              ; preds = %130
  br label %139

139:                                              ; preds = %138
  store i32 0, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %285

140:                                              ; preds = %119, %110, %104, %98, %87
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !14
  %141 = load ptr, ptr %4, align 8, !tbaa !5
  %142 = getelementptr inbounds %"struct.rw::Raster", ptr %141, i32 0, i32 4
  %143 = load i32, ptr %142, align 8, !tbaa !20
  %144 = and i32 %143, 16384
  %145 = icmp ne i32 %144, 0
  br i1 %145, label %146, label %147

146:                                              ; preds = %140
  store i32 16, ptr %14, align 4, !tbaa !14
  br label %155

147:                                              ; preds = %140
  %148 = load ptr, ptr %4, align 8, !tbaa !5
  %149 = getelementptr inbounds %"struct.rw::Raster", ptr %148, i32 0, i32 4
  %150 = load i32, ptr %149, align 8, !tbaa !20
  %151 = and i32 %150, 8192
  %152 = icmp ne i32 %151, 0
  br i1 %152, label %153, label %154

153:                                              ; preds = %147
  store i32 256, ptr %14, align 4, !tbaa !14
  br label %154

154:                                              ; preds = %153, %147
  br label %155

155:                                              ; preds = %154, %146
  %156 = load i32, ptr %14, align 4, !tbaa !14
  %157 = icmp ne i32 %156, 0
  br i1 %157, label %158, label %181

158:                                              ; preds = %155
  %159 = load ptr, ptr %5, align 8, !tbaa !5
  %160 = getelementptr inbounds %"struct.rw::Image", ptr %159, i32 0, i32 7
  %161 = load ptr, ptr %160, align 8, !tbaa !19
  store ptr %161, ptr %12, align 8, !tbaa !5
  %162 = load ptr, ptr %8, align 8, !tbaa !5
  %163 = getelementptr inbounds %"struct.rw::d3d::D3dRaster", ptr %162, i32 0, i32 1
  %164 = load ptr, ptr %163, align 8, !tbaa !24
  store ptr %164, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 0, ptr %15, align 4, !tbaa !14
  br label %165

165:                                              ; preds = %177, %158
  %166 = load i32, ptr %15, align 4, !tbaa !14
  %167 = load i32, ptr %14, align 4, !tbaa !14
  %168 = icmp slt i32 %166, %167
  br i1 %168, label %170, label %169

169:                                              ; preds = %165
  store i32 6, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %180

170:                                              ; preds = %165
  %171 = load ptr, ptr %13, align 8, !tbaa !5
  %172 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZN2rw27conv_RGBA8888_from_RGBA8888EPhS0_(ptr noundef %171, ptr noundef %172)
  %173 = load ptr, ptr %12, align 8, !tbaa !5
  %174 = getelementptr inbounds i8, ptr %173, i64 4
  store ptr %174, ptr %12, align 8, !tbaa !5
  %175 = load ptr, ptr %13, align 8, !tbaa !5
  %176 = getelementptr inbounds i8, ptr %175, i64 4
  store ptr %176, ptr %13, align 8, !tbaa !5
  br label %177

177:                                              ; preds = %170
  %178 = load i32, ptr %15, align 4, !tbaa !14
  %179 = add nsw i32 %178, 1
  store i32 %179, ptr %15, align 4, !tbaa !14
  br label %165, !llvm.loop !27

180:                                              ; preds = %169
  br label %181

181:                                              ; preds = %180, %155
  call void @llvm.lifetime.start.p0(i64 1, ptr %16) #6
  store i8 0, ptr %16, align 1, !tbaa !29
  %182 = load ptr, ptr %4, align 8, !tbaa !5
  %183 = getelementptr inbounds %"struct.rw::Raster", ptr %182, i32 0, i32 9
  %184 = load ptr, ptr %183, align 8, !tbaa !30
  %185 = icmp eq ptr %184, null
  br i1 %185, label %186, label %189

186:                                              ; preds = %181
  %187 = load ptr, ptr %4, align 8, !tbaa !5
  %188 = call noundef ptr @_ZN2rw6Raster4lockEii(ptr noundef nonnull align 8 dereferenceable(96) %187, i32 noundef 0, i32 noundef 5)
  store i8 1, ptr %16, align 1, !tbaa !29
  br label %189

189:                                              ; preds = %186, %181
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %190 = load ptr, ptr %4, align 8, !tbaa !5
  %191 = getelementptr inbounds %"struct.rw::Raster", ptr %190, i32 0, i32 9
  %192 = load ptr, ptr %191, align 8, !tbaa !30
  store ptr %192, ptr %17, align 8, !tbaa !5
  %193 = load ptr, ptr %17, align 8, !tbaa !5
  %194 = icmp ne ptr %193, null
  br i1 %194, label %195, label %196

195:                                              ; preds = %189
  br label %198

196:                                              ; preds = %189
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.4, i32 noundef 812, ptr noundef @__PRETTY_FUNCTION__._ZN2rw3d3d15rasterFromImageEPNS_6RasterEPNS_5ImageE) #7
  unreachable

197:                                              ; No predecessors!
  br label %198

198:                                              ; preds = %197, %195
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %199 = load ptr, ptr %5, align 8, !tbaa !5
  %200 = getelementptr inbounds %"struct.rw::Image", ptr %199, i32 0, i32 6
  %201 = load ptr, ptr %200, align 8, !tbaa !17
  store ptr %201, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  %202 = load ptr, ptr %5, align 8, !tbaa !5
  %203 = getelementptr inbounds %"struct.rw::Image", ptr %202, i32 0, i32 1
  %204 = load i32, ptr %203, align 4, !tbaa !15
  %205 = load ptr, ptr %4, align 8, !tbaa !5
  %206 = getelementptr inbounds %"struct.rw::Raster", ptr %205, i32 0, i32 5
  %207 = load i32, ptr %206, align 4, !tbaa !31
  %208 = icmp eq i32 %204, %207
  br i1 %208, label %209, label %210

209:                                              ; preds = %198
  br label %212

210:                                              ; preds = %198
  call void @__assert_fail(ptr noundef @.str.9, ptr noundef @.str.4, i32 noundef 816, ptr noundef @__PRETTY_FUNCTION__._ZN2rw3d3d15rasterFromImageEPNS_6RasterEPNS_5ImageE) #7
  unreachable

211:                                              ; No predecessors!
  br label %212

212:                                              ; preds = %211, %209
  %213 = load ptr, ptr %5, align 8, !tbaa !5
  %214 = getelementptr inbounds %"struct.rw::Image", ptr %213, i32 0, i32 2
  %215 = load i32, ptr %214, align 8, !tbaa !16
  %216 = load ptr, ptr %4, align 8, !tbaa !5
  %217 = getelementptr inbounds %"struct.rw::Raster", ptr %216, i32 0, i32 6
  %218 = load i32, ptr %217, align 8, !tbaa !32
  %219 = icmp eq i32 %215, %218
  br i1 %219, label %220, label %221

220:                                              ; preds = %212
  br label %223

221:                                              ; preds = %212
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str.4, i32 noundef 817, ptr noundef @__PRETTY_FUNCTION__._ZN2rw3d3d15rasterFromImageEPNS_6RasterEPNS_5ImageE) #7
  unreachable

222:                                              ; No predecessors!
  br label %223

223:                                              ; preds = %222, %220
  store i32 0, ptr %20, align 4, !tbaa !14
  br label %224

224:                                              ; preds = %271, %223
  %225 = load i32, ptr %20, align 4, !tbaa !14
  %226 = load ptr, ptr %5, align 8, !tbaa !5
  %227 = getelementptr inbounds %"struct.rw::Image", ptr %226, i32 0, i32 2
  %228 = load i32, ptr %227, align 8, !tbaa !16
  %229 = icmp slt i32 %225, %228
  br i1 %229, label %230, label %274

230:                                              ; preds = %224
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %231 = load ptr, ptr %18, align 8, !tbaa !5
  store ptr %231, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #6
  %232 = load ptr, ptr %17, align 8, !tbaa !5
  store ptr %232, ptr %22, align 8, !tbaa !5
  store i32 0, ptr %19, align 4, !tbaa !14
  br label %233

233:                                              ; preds = %255, %230
  %234 = load i32, ptr %19, align 4, !tbaa !14
  %235 = load ptr, ptr %5, align 8, !tbaa !5
  %236 = getelementptr inbounds %"struct.rw::Image", ptr %235, i32 0, i32 1
  %237 = load i32, ptr %236, align 4, !tbaa !15
  %238 = icmp slt i32 %234, %237
  br i1 %238, label %239, label %258

239:                                              ; preds = %233
  %240 = load ptr, ptr %6, align 8, !tbaa !5
  %241 = load ptr, ptr %22, align 8, !tbaa !5
  %242 = load ptr, ptr %21, align 8, !tbaa !5
  call void %240(ptr noundef %241, ptr noundef %242)
  %243 = load ptr, ptr %5, align 8, !tbaa !5
  %244 = getelementptr inbounds %"struct.rw::Image", ptr %243, i32 0, i32 4
  %245 = load i32, ptr %244, align 8, !tbaa !33
  %246 = load ptr, ptr %21, align 8, !tbaa !5
  %247 = sext i32 %245 to i64
  %248 = getelementptr inbounds i8, ptr %246, i64 %247
  store ptr %248, ptr %21, align 8, !tbaa !5
  %249 = load ptr, ptr %8, align 8, !tbaa !5
  %250 = getelementptr inbounds %"struct.rw::d3d::D3dRaster", ptr %249, i32 0, i32 4
  %251 = load i32, ptr %250, align 4, !tbaa !34
  %252 = load ptr, ptr %22, align 8, !tbaa !5
  %253 = zext i32 %251 to i64
  %254 = getelementptr inbounds i8, ptr %252, i64 %253
  store ptr %254, ptr %22, align 8, !tbaa !5
  br label %255

255:                                              ; preds = %239
  %256 = load i32, ptr %19, align 4, !tbaa !14
  %257 = add nsw i32 %256, 1
  store i32 %257, ptr %19, align 4, !tbaa !14
  br label %233, !llvm.loop !35

258:                                              ; preds = %233
  %259 = load ptr, ptr %5, align 8, !tbaa !5
  %260 = getelementptr inbounds %"struct.rw::Image", ptr %259, i32 0, i32 5
  %261 = load i32, ptr %260, align 4, !tbaa !18
  %262 = load ptr, ptr %18, align 8, !tbaa !5
  %263 = sext i32 %261 to i64
  %264 = getelementptr inbounds i8, ptr %262, i64 %263
  store ptr %264, ptr %18, align 8, !tbaa !5
  %265 = load ptr, ptr %4, align 8, !tbaa !5
  %266 = getelementptr inbounds %"struct.rw::Raster", ptr %265, i32 0, i32 8
  %267 = load i32, ptr %266, align 8, !tbaa !36
  %268 = load ptr, ptr %17, align 8, !tbaa !5
  %269 = sext i32 %267 to i64
  %270 = getelementptr inbounds i8, ptr %268, i64 %269
  store ptr %270, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  br label %271

271:                                              ; preds = %258
  %272 = load i32, ptr %20, align 4, !tbaa !14
  %273 = add nsw i32 %272, 1
  store i32 %273, ptr %20, align 4, !tbaa !14
  br label %224, !llvm.loop !37

274:                                              ; preds = %224
  %275 = load i8, ptr %16, align 1, !tbaa !29, !range !38, !noundef !39
  %276 = trunc i8 %275 to i1
  br i1 %276, label %277, label %279

277:                                              ; preds = %274
  %278 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN2rw6Raster6unlockEi(ptr noundef nonnull align 8 dereferenceable(96) %278, i32 noundef 0)
  br label %279

279:                                              ; preds = %277, %274
  %280 = load ptr, ptr %7, align 8, !tbaa !5
  %281 = icmp ne ptr %280, null
  br i1 %281, label %282, label %284

282:                                              ; preds = %279
  %283 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN2rw5Image7destroyEv(ptr noundef nonnull align 8 dereferenceable(40) %283)
  br label %284

284:                                              ; preds = %282, %279
  store i32 1, ptr %3, align 4
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %285

285:                                              ; preds = %284, %139
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %286

286:                                              ; preds = %285, %28
  %287 = load i32, ptr %3, align 4
  ret i32 %287
}

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

declare void @_ZN2rw5Image11unpalettizeEb(ptr noundef nonnull align 8 dereferenceable(40), i1 noundef zeroext) #2

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

declare void @_ZN2rw23conv_BGR888_from_RGB888EPhS0_(ptr noundef, ptr noundef) #2

declare void @_ZN2rw25conv_BGRA8888_from_RGB888EPhS0_(ptr noundef, ptr noundef) #2

declare void @_ZN2rw27conv_ARGB1555_from_ARGB1555EPhS0_(ptr noundef, ptr noundef) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN2rw13conv_8_from_8EPhS0_(ptr noundef, ptr noundef) #5

declare i32 @fflush(ptr noundef) #2

declare void @_ZN2rw27conv_RGBA8888_from_RGBA8888EPhS0_(ptr noundef, ptr noundef) #2

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { "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 = { 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 #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 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 }
attributes #7 = { noreturn nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 4}
!10 = !{!"_ZTSN2rw6RasterE", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !11, i64 64, !11, i64 68, !11, i64 72, !6, i64 80, !11, i64 88, !11, i64 92}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !11, i64 12}
!13 = !{!"_ZTSN2rw5ImageE", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !6, i64 24, !6, i64 32}
!14 = !{!11, !11, i64 0}
!15 = !{!13, !11, i64 4}
!16 = !{!13, !11, i64 8}
!17 = !{!13, !6, i64 24}
!18 = !{!13, !11, i64 20}
!19 = !{!13, !6, i64 32}
!20 = !{!10, !11, i64 16}
!21 = !{!22, !11, i64 0}
!22 = !{!"_ZTSN2rw5ErrorE", !11, i64 0, !11, i64 4}
!23 = !{!22, !11, i64 4}
!24 = !{!25, !6, i64 8}
!25 = !{!"_ZTSN2rw3d3d9D3dRasterE", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !11, i64 28, !26, i64 32, !26, i64 33, !26, i64 34}
!26 = !{!"bool", !7, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = !{!26, !26, i64 0}
!30 = !{!10, !6, i64 40}
!31 = !{!10, !11, i64 20}
!32 = !{!10, !11, i64 24}
!33 = !{!13, !11, i64 16}
!34 = !{!25, !11, i64 28}
!35 = distinct !{!35, !28}
!36 = !{!10, !11, i64 32}
!37 = distinct !{!37, !28}
!38 = !{i8 0, i8 2}
!39 = !{}


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

%"struct.rw::Error" = type { i32, i32 }

@_ZN2rw3d3d13isP8supportedE = external dso_local local_unnamed_addr global i32, align 4
@_ZN2rw3d3d18nativeRasterOffsetE = external dso_local local_unnamed_addr global i32, align 4
@stderr = external local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [7 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.8 = external hidden unnamed_addr constant [7 x i8], align 1
@__PRETTY_FUNCTION__._ZN2rw3d3d15rasterFromImageEPNS_6RasterEPNS_5ImageE = external hidden unnamed_addr constant [51 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [32 x i8], align 1

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

declare noundef ptr @_ZN2rw9dbgsprintEjz(i32 noundef, ...) local_unnamed_addr #2

declare void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 2) i32 @_ZN2rw3d3d15rasterFromImageEPNS_6RasterEPNS_5ImageE(ptr noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #4 {
  %3 = alloca %"struct.rw::Error", align 4
  %4 = getelementptr inbounds i8, ptr %0, i64 4
  %5 = load i32, ptr %4, align 4, !tbaa !5
  %6 = and i32 %5, 15
  %.not = icmp eq i32 %6, 4
  br i1 %.not, label %7, label %120

7:                                                ; preds = %2
  %8 = getelementptr inbounds i8, ptr %1, i64 12
  %9 = load i32, ptr %8, align 4, !tbaa !11
  %10 = icmp sgt i32 %9, 8
  %11 = load i32, ptr @_ZN2rw3d3d13isP8supportedE, align 4
  %12 = icmp ne i32 %11, 0
  %or.cond = select i1 %10, i1 true, i1 %12
  br i1 %or.cond, label %25, label %13

13:                                               ; preds = %7
  %14 = getelementptr inbounds i8, ptr %1, i64 4
  %15 = load i32, ptr %14, align 4, !tbaa !13
  %16 = getelementptr inbounds i8, ptr %1, i64 8
  %17 = load i32, ptr %16, align 8, !tbaa !14
  %18 = tail call noundef ptr @_ZN2rw5Image6createEiii(i32 noundef %15, i32 noundef %17, i32 noundef %9)
  %19 = getelementptr inbounds i8, ptr %1, i64 24
  %20 = getelementptr inbounds i8, ptr %18, i64 24
  %21 = getelementptr inbounds i8, ptr %1, i64 20
  %22 = load i32, ptr %21, align 4, !tbaa !15
  %23 = getelementptr inbounds i8, ptr %18, i64 20
  store i32 %22, ptr %23, align 4, !tbaa !15
  %24 = load <2 x ptr>, ptr %19, align 8, !tbaa !16
  store <2 x ptr> %24, ptr %20, align 8, !tbaa !16
  tail call void @_ZN2rw5Image11unpalettizeEb(ptr noundef nonnull align 8 dereferenceable(40) %18, i1 noundef zeroext false)
  %.phi.trans.insert = getelementptr inbounds i8, ptr %18, i64 12
  %.pre = load i32, ptr %.phi.trans.insert, align 4, !tbaa !11
  br label %25

25:                                               ; preds = %13, %7
  %26 = phi i32 [ %9, %7 ], [ %.pre, %13 ]
  %.085 = phi ptr [ null, %7 ], [ %18, %13 ]
  %.084 = phi ptr [ %1, %7 ], [ %18, %13 ]
  %27 = load i32, ptr @_ZN2rw3d3d18nativeRasterOffsetE, align 4, !tbaa !17
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds i8, ptr %0, i64 %28
  %30 = getelementptr inbounds i8, ptr %0, i64 16
  %31 = load i32, ptr %30, align 8, !tbaa !18
  %32 = and i32 %31, 28416
  %33 = add i32 %26, -4
  %34 = tail call i32 @llvm.fshl.i32(i32 %33, i32 %33, i32 30)
  switch i32 %34, label %44 [
    i32 7, label %35
    i32 5, label %37
    i32 3, label %39
    i32 1, label %41
    i32 0, label %43
  ]

35:                                               ; preds = %25
  switch i32 %32, label %44 [
    i32 1280, label %55
    i32 1536, label %36
  ]

36:                                               ; preds = %35
  br label %55

37:                                               ; preds = %25
  switch i32 %32, label %44 [
    i32 1280, label %55
    i32 1536, label %38
  ]

38:                                               ; preds = %37
  br label %55

39:                                               ; preds = %25
  %40 = icmp eq i32 %32, 256
  br i1 %40, label %55, label %44

41:                                               ; preds = %25
  %42 = icmp eq i32 %32, 9472
  br i1 %42, label %55, label %44

43:                                               ; preds = %25
  switch i32 %32, label %44 [
    i32 17664, label %55
    i32 9472, label %55
  ]

44:                                               ; preds = %43, %37, %35, %25, %41, %39
  %45 = load ptr, ptr @stderr, align 8, !tbaa !16
  %46 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef nonnull @.str.7, i32 noundef %26, i32 noundef %32) #7
  %47 = load ptr, ptr @stdout, align 8, !tbaa !16
  %48 = tail call i32 @fflush(ptr noundef %47)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  store i32 2816, ptr %3, align 4, !tbaa !19
  %49 = getelementptr inbounds i8, ptr %3, i64 4
  store i32 -2147483638, ptr %49, align 4, !tbaa !21
  %50 = load ptr, ptr @stderr, align 8, !tbaa !16
  %51 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %50, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, i32 noundef 785) #7
  %52 = load ptr, ptr @stderr, align 8, !tbaa !16
  %53 = tail call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483638)
  %54 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %52, ptr noundef nonnull @.str.5, ptr noundef %53) #7
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef nonnull %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  br label %120

55:                                               ; preds = %43, %43, %41, %39, %37, %35, %38, %36
  %.086 = phi ptr [ @_ZN2rw23conv_BGR888_from_RGB888EPhS0_, %38 ], [ @_ZN2rw23conv_BGR888_from_RGB888EPhS0_, %36 ], [ @_ZN2rw27conv_BGRA8888_from_RGBA8888EPhS0_, %35 ], [ @_ZN2rw25conv_BGRA8888_from_RGB888EPhS0_, %37 ], [ @_ZN2rw27conv_ARGB1555_from_ARGB1555EPhS0_, %39 ], [ @_ZN2rw13conv_8_from_8EPhS0_, %41 ], [ @_ZN2rw13conv_8_from_8EPhS0_, %43 ], [ @_ZN2rw13conv_8_from_8EPhS0_, %43 ]
  %56 = and i32 %31, 16384
  %.not91 = icmp eq i32 %56, 0
  br i1 %.not91, label %57, label %.thread

57:                                               ; preds = %55
  %58 = and i32 %31, 8192
  %.not92 = icmp eq i32 %58, 0
  br i1 %.not92, label %.loopexit, label %.thread

.thread:                                          ; preds = %55, %57
  %.08099 = phi i32 [ 256, %57 ], [ 16, %55 ]
  %59 = getelementptr inbounds i8, ptr %.084, i64 32
  %60 = load ptr, ptr %59, align 8, !tbaa !22
  %61 = getelementptr inbounds i8, ptr %29, i64 8
  %62 = load ptr, ptr %61, align 8, !tbaa !23
  br label %63

63:                                               ; preds = %.thread, %63
  %.079105 = phi i32 [ 0, %.thread ], [ %66, %63 ]
  %.081104 = phi ptr [ %62, %.thread ], [ %65, %63 ]
  %.082103 = phi ptr [ %60, %.thread ], [ %64, %63 ]
  tail call void @_ZN2rw27conv_RGBA8888_from_RGBA8888EPhS0_(ptr noundef %.081104, ptr noundef %.082103)
  %64 = getelementptr inbounds i8, ptr %.082103, i64 4
  %65 = getelementptr inbounds i8, ptr %.081104, i64 4
  %66 = add nuw nsw i32 %.079105, 1
  %exitcond.not = icmp eq i32 %66, %.08099
  br i1 %exitcond.not, label %.loopexit, label %63, !llvm.loop !26

.loopexit:                                        ; preds = %63, %57
  %67 = getelementptr inbounds i8, ptr %0, i64 40
  %68 = load ptr, ptr %67, align 8, !tbaa !28
  %69 = icmp eq ptr %68, null
  br i1 %69, label %70, label %.thread100

70:                                               ; preds = %.loopexit
  %71 = tail call noundef ptr @_ZN2rw6Raster4lockEii(ptr noundef nonnull align 8 dereferenceable(96) %0, i32 noundef 0, i32 noundef 5)
  %.pr = load ptr, ptr %67, align 8, !tbaa !28
  %.not94 = icmp eq ptr %.pr, null
  br i1 %.not94, label %72, label %.thread100

72:                                               ; preds = %70
  tail call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.4, i32 noundef 812, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw3d3d15rasterFromImageEPNS_6RasterEPNS_5ImageE) #9
  unreachable

.thread100:                                       ; preds = %.loopexit, %70
  %73 = phi ptr [ %.pr, %70 ], [ %68, %.loopexit ]
  %74 = getelementptr inbounds i8, ptr %.084, i64 4
  %75 = load i32, ptr %74, align 4, !tbaa !13
  %76 = getelementptr inbounds i8, ptr %0, i64 20
  %77 = load i32, ptr %76, align 4, !tbaa !29
  %78 = icmp eq i32 %75, %77
  br i1 %78, label %80, label %79

79:                                               ; preds = %.thread100
  tail call void @__assert_fail(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.4, i32 noundef 816, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw3d3d15rasterFromImageEPNS_6RasterEPNS_5ImageE) #9
  unreachable

80:                                               ; preds = %.thread100
  %81 = getelementptr inbounds i8, ptr %.084, i64 24
  %82 = load ptr, ptr %81, align 8, !tbaa !30
  %83 = getelementptr inbounds i8, ptr %.084, i64 8
  %84 = load i32, ptr %83, align 8, !tbaa !14
  %85 = getelementptr inbounds i8, ptr %0, i64 24
  %86 = load i32, ptr %85, align 8, !tbaa !31
  %87 = icmp eq i32 %84, %86
  br i1 %87, label %.preheader102, label %94

.preheader102:                                    ; preds = %80
  %88 = icmp sgt i32 %84, 0
  br i1 %88, label %.preheader.lr.ph, label %._crit_edge112

.preheader.lr.ph:                                 ; preds = %.preheader102
  %89 = getelementptr inbounds i8, ptr %.084, i64 16
  %90 = getelementptr inbounds i8, ptr %29, i64 28
  %91 = getelementptr inbounds i8, ptr %.084, i64 20
  %92 = getelementptr inbounds i8, ptr %0, i64 32
  %93 = icmp sgt i32 %75, 0
  br i1 %93, label %.preheader, label %._crit_edge112

94:                                               ; preds = %80
  tail call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.4, i32 noundef 817, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw3d3d15rasterFromImageEPNS_6RasterEPNS_5ImageE) #9
  unreachable

.preheader:                                       ; preds = %.preheader.lr.ph, %._crit_edge
  %95 = phi i32 [ %107, %._crit_edge ], [ %84, %.preheader.lr.ph ]
  %96 = phi i32 [ %108, %._crit_edge ], [ %75, %.preheader.lr.ph ]
  %.074111 = phi i32 [ %115, %._crit_edge ], [ 0, %.preheader.lr.ph ]
  %.076110 = phi ptr [ %111, %._crit_edge ], [ %82, %.preheader.lr.ph ]
  %.077109 = phi ptr [ %114, %._crit_edge ], [ %73, %.preheader.lr.ph ]
  %97 = icmp sgt i32 %96, 0
  br i1 %97, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %.0108 = phi ptr [ %103, %.lr.ph ], [ %.077109, %.preheader ]
  %.073107 = phi ptr [ %100, %.lr.ph ], [ %.076110, %.preheader ]
  %.075106 = phi i32 [ %104, %.lr.ph ], [ 0, %.preheader ]
  tail call void %.086(ptr noundef %.0108, ptr noundef %.073107)
  %98 = load i32, ptr %89, align 8, !tbaa !32
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds i8, ptr %.073107, i64 %99
  %101 = load i32, ptr %90, align 4, !tbaa !33
  %102 = zext i32 %101 to i64
  %103 = getelementptr inbounds i8, ptr %.0108, i64 %102
  %104 = add nuw nsw i32 %.075106, 1
  %105 = load i32, ptr %74, align 4, !tbaa !13
  %106 = icmp slt i32 %104, %105
  br i1 %106, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !34

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre114 = load i32, ptr %83, align 8, !tbaa !14
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %107 = phi i32 [ %.pre114, %._crit_edge.loopexit ], [ %95, %.preheader ]
  %108 = phi i32 [ %105, %._crit_edge.loopexit ], [ %96, %.preheader ]
  %109 = load i32, ptr %91, align 4, !tbaa !15
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds i8, ptr %.076110, i64 %110
  %112 = load i32, ptr %92, align 8, !tbaa !35
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds i8, ptr %.077109, i64 %113
  %115 = add nuw nsw i32 %.074111, 1
  %116 = icmp slt i32 %115, %107
  br i1 %116, label %.preheader, label %._crit_edge112, !llvm.loop !36

._crit_edge112:                                   ; preds = %._crit_edge, %.preheader.lr.ph, %.preheader102
  br i1 %69, label %117, label %118

117:                                              ; preds = %._crit_edge112
  tail call void @_ZN2rw6Raster6unlockEi(ptr noundef nonnull align 8 dereferenceable(96) %0, i32 noundef 0)
  br label %118

118:                                              ; preds = %117, %._crit_edge112
  %.not95 = icmp eq ptr %.085, null
  br i1 %.not95, label %120, label %119

119:                                              ; preds = %118
  tail call void @_ZN2rw5Image7destroyEv(ptr noundef nonnull align 8 dereferenceable(40) %.085)
  br label %120

120:                                              ; preds = %44, %119, %118, %2
  %.1 = phi i32 [ 0, %2 ], [ 0, %44 ], [ 1, %119 ], [ 1, %118 ]
  ret i32 %.1
}

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

declare void @_ZN2rw5Image11unpalettizeEb(ptr noundef nonnull align 8 dereferenceable(40), i1 noundef zeroext) local_unnamed_addr #2

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN2rw13conv_8_from_8EPhS0_(ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #1

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

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

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

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { 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 #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 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { cold nounwind }
attributes #8 = { nounwind }
attributes #9 = { 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, !7, i64 4}
!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 = !{!12, !7, i64 12}
!12 = !{!"_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}
!13 = !{!12, !7, i64 4}
!14 = !{!12, !7, i64 8}
!15 = !{!12, !7, i64 20}
!16 = !{!10, !10, i64 0}
!17 = !{!7, !7, i64 0}
!18 = !{!6, !7, i64 16}
!19 = !{!20, !7, i64 0}
!20 = !{!"_ZTSN2rw5ErrorE", !7, i64 0, !7, i64 4}
!21 = !{!20, !7, i64 4}
!22 = !{!12, !10, i64 32}
!23 = !{!24, !10, i64 8}
!24 = !{!"_ZTSN2rw3d3d9D3dRasterE", !10, i64 0, !10, i64 8, !10, i64 16, !7, i64 24, !7, i64 28, !25, i64 32, !25, i64 33, !25, i64 34}
!25 = !{!"bool", !8, i64 0}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!6, !10, i64 40}
!29 = !{!6, !7, i64 20}
!30 = !{!12, !10, i64 24}
!31 = !{!6, !7, i64 24}
!32 = !{!12, !7, i64 16}
!33 = !{!24, !7, i64 28}
!34 = distinct !{!34, !27}
!35 = !{!6, !7, i64 32}
!36 = distinct !{!36, !27, !37}
!37 = !{!"llvm.loop.unswitch.partial.disable"}


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