; LLVM IR from aap/librw :: src/gl/gl3raster.ll (ZN2rw3gl315rasterFromImageEPNS_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::gl3::Gl3Caps" = type { i32, i32, i8, i8, float }
%"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::gl3::Gl3Raster" = type { i32, i32, i32, i32, i32, i8, i8, i8, i8, i8, i8, i8, i32, i32, ptr, ptr }

@_ZN2rw3gl318nativeRasterOffsetE = external dso_local global i32, align 4
@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [8 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [22 x i8], align 1
@__PRETTY_FUNCTION__._ZN2rw3gl315rasterFromImageEPNS_6RasterEPNS_5ImageE = external hidden unnamed_addr constant [51 x i8], align 1
@_ZN2rw3gl37gl3CapsE = external global %"struct.rw::gl3::Gl3Caps", align 4
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.7 = 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: 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: 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) #3

declare noundef i32 @_ZN2rw5Image8hasAlphaEv(ptr noundef nonnull align 8 dereferenceable(40)) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN2rw3gl315rasterFromImageEPNS_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 i8, align 1
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %"struct.rw::Raster", ptr %19, i32 0, i32 1
  %21 = load i32, ptr %20, align 4, !tbaa !9
  %22 = and i32 %21, 15
  %23 = icmp ne i32 %22, 4
  br i1 %23, label %24, label %25

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

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

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

58:                                               ; preds = %30, %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = load i32, ptr @_ZN2rw3gl318nativeRasterOffsetE, align 4, !tbaa !19
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds i8, ptr %59, i64 %61
  store ptr %62, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = getelementptr inbounds %"struct.rw::Raster", ptr %63, i32 0, i32 4
  %65 = load i32, ptr %64, align 8, !tbaa !20
  %66 = and i32 %65, 3840
  store i32 %66, ptr %9, align 4, !tbaa !19
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  %68 = getelementptr inbounds %"struct.rw::gl3::Gl3Raster", ptr %67, i32 0, i32 5
  %69 = load i8, ptr %68, align 4, !tbaa !21, !range !24, !noundef !25
  %70 = trunc i8 %69 to i1
  %71 = xor i1 %70, true
  br i1 %71, label %72, label %73

72:                                               ; preds = %58
  br label %75

73:                                               ; preds = %58
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 659, ptr noundef @__PRETTY_FUNCTION__._ZN2rw3gl315rasterFromImageEPNS_6RasterEPNS_5ImageE) #6
  unreachable

74:                                               ; No predecessors!
  br label %75

75:                                               ; preds = %74, %72
  %76 = load ptr, ptr %5, align 8, !tbaa !5
  %77 = getelementptr inbounds %"struct.rw::Image", ptr %76, i32 0, i32 3
  %78 = load i32, ptr %77, align 4, !tbaa !12
  switch i32 %78, label %123 [
    i32 32, label %79
    i32 24, label %95
    i32 16, label %111
    i32 8, label %122
    i32 4, label %122
  ]

79:                                               ; preds = %75
  %80 = load i32, ptr @_ZN2rw3gl37gl3CapsE, align 4, !tbaa !26
  %81 = icmp ne i32 %80, 0
  br i1 %81, label %82, label %83

82:                                               ; preds = %79
  store ptr @_ZN2rw27conv_RGBA8888_from_RGBA8888EPhS0_, ptr %6, align 8, !tbaa !5
  br label %94

83:                                               ; preds = %79
  %84 = load i32, ptr %9, align 4, !tbaa !19
  %85 = icmp eq i32 %84, 1280
  br i1 %85, label %86, label %87

86:                                               ; preds = %83
  store ptr @_ZN2rw27conv_RGBA8888_from_RGBA8888EPhS0_, ptr %6, align 8, !tbaa !5
  br label %93

87:                                               ; preds = %83
  %88 = load i32, ptr %9, align 4, !tbaa !19
  %89 = icmp eq i32 %88, 1536
  br i1 %89, label %90, label %91

90:                                               ; preds = %87
  store ptr @_ZN2rw23conv_RGB888_from_RGB888EPhS0_, ptr %6, align 8, !tbaa !5
  br label %92

91:                                               ; preds = %87
  br label %124

92:                                               ; preds = %90
  br label %93

93:                                               ; preds = %92, %86
  br label %94

94:                                               ; preds = %93, %82
  br label %135

95:                                               ; preds = %75
  %96 = load i32, ptr @_ZN2rw3gl37gl3CapsE, align 4, !tbaa !26
  %97 = icmp ne i32 %96, 0
  br i1 %97, label %98, label %99

98:                                               ; preds = %95
  store ptr @_ZN2rw25conv_RGBA8888_from_RGB888EPhS0_, ptr %6, align 8, !tbaa !5
  br label %110

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

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

103:                                              ; preds = %99
  %104 = load i32, ptr %9, align 4, !tbaa !19
  %105 = icmp eq i32 %104, 1536
  br i1 %105, label %106, label %107

106:                                              ; preds = %103
  store ptr @_ZN2rw23conv_RGB888_from_RGB888EPhS0_, ptr %6, align 8, !tbaa !5
  br label %108

107:                                              ; preds = %103
  br label %124

108:                                              ; preds = %106
  br label %109

109:                                              ; preds = %108, %102
  br label %110

110:                                              ; preds = %109, %98
  br label %135

111:                                              ; preds = %75
  %112 = load i32, ptr @_ZN2rw3gl37gl3CapsE, align 4, !tbaa !26
  %113 = icmp ne i32 %112, 0
  br i1 %113, label %114, label %115

114:                                              ; preds = %111
  store ptr @_ZN2rw27conv_RGBA8888_from_ARGB1555EPhS0_, ptr %6, align 8, !tbaa !5
  br label %121

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

118:                                              ; preds = %115
  store ptr @_ZN2rw27conv_RGBA5551_from_ARGB1555EPhS0_, ptr %6, align 8, !tbaa !5
  br label %120

119:                                              ; preds = %115
  br label %124

120:                                              ; preds = %118
  br label %121

121:                                              ; preds = %120, %114
  br label %135

122:                                              ; preds = %75, %75
  br label %123

123:                                              ; preds = %122, %75
  br label %124

124:                                              ; preds = %123, %119, %107, %91
  br label %125

125:                                              ; preds = %124
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %126 = getelementptr inbounds %"struct.rw::Error", ptr %10, i32 0, i32 0
  store i32 2816, ptr %126, align 4, !tbaa !29
  %127 = getelementptr inbounds %"struct.rw::Error", ptr %10, i32 0, i32 1
  store i32 -2147483638, ptr %127, align 4, !tbaa !31
  %128 = load ptr, ptr @stderr, align 8, !tbaa !5
  %129 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %128, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 694) #5
  %130 = load ptr, ptr @stderr, align 8, !tbaa !5
  %131 = call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483638)
  %132 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %130, ptr noundef @.str.2, ptr noundef %131) #5
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef %10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %133

133:                                              ; preds = %125
  br label %134

134:                                              ; preds = %133
  store i32 0, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %256

135:                                              ; preds = %121, %110, %94
  %136 = load ptr, ptr %5, align 8, !tbaa !5
  %137 = call noundef i32 @_ZN2rw5Image8hasAlphaEv(ptr noundef nonnull align 8 dereferenceable(40) %136)
  %138 = icmp ne i32 %137, 0
  %139 = load ptr, ptr %8, align 8, !tbaa !5
  %140 = getelementptr inbounds %"struct.rw::gl3::Gl3Raster", ptr %139, i32 0, i32 6
  %141 = zext i1 %138 to i8
  store i8 %141, ptr %140, align 1, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #5
  store i8 0, ptr %12, align 1, !tbaa !33
  %142 = load ptr, ptr %4, align 8, !tbaa !5
  %143 = getelementptr inbounds %"struct.rw::Raster", ptr %142, i32 0, i32 9
  %144 = load ptr, ptr %143, align 8, !tbaa !34
  %145 = icmp eq ptr %144, null
  br i1 %145, label %146, label %149

146:                                              ; preds = %135
  %147 = load ptr, ptr %4, align 8, !tbaa !5
  %148 = call noundef ptr @_ZN2rw6Raster4lockEii(ptr noundef nonnull align 8 dereferenceable(96) %147, i32 noundef 0, i32 noundef 5)
  store i8 1, ptr %12, align 1, !tbaa !33
  br label %149

149:                                              ; preds = %146, %135
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %150 = load ptr, ptr %4, align 8, !tbaa !5
  %151 = getelementptr inbounds %"struct.rw::Raster", ptr %150, i32 0, i32 9
  %152 = load ptr, ptr %151, align 8, !tbaa !34
  store ptr %152, ptr %13, align 8, !tbaa !5
  %153 = load ptr, ptr %13, align 8, !tbaa !5
  %154 = icmp ne ptr %153, null
  br i1 %154, label %155, label %156

155:                                              ; preds = %149
  br label %158

156:                                              ; preds = %149
  call void @__assert_fail(ptr noundef @.str.5, ptr noundef @.str.1, i32 noundef 707, ptr noundef @__PRETTY_FUNCTION__._ZN2rw3gl315rasterFromImageEPNS_6RasterEPNS_5ImageE) #6
  unreachable

157:                                              ; No predecessors!
  br label %158

158:                                              ; preds = %157, %155
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #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 !16
  %162 = load ptr, ptr %5, align 8, !tbaa !5
  %163 = getelementptr inbounds %"struct.rw::Image", ptr %162, i32 0, i32 2
  %164 = load i32, ptr %163, align 8, !tbaa !15
  %165 = sub nsw i32 %164, 1
  %166 = load ptr, ptr %5, align 8, !tbaa !5
  %167 = getelementptr inbounds %"struct.rw::Image", ptr %166, i32 0, i32 5
  %168 = load i32, ptr %167, align 4, !tbaa !17
  %169 = mul nsw i32 %165, %168
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds i8, ptr %161, i64 %170
  store ptr %171, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %172 = load ptr, ptr %5, align 8, !tbaa !5
  %173 = getelementptr inbounds %"struct.rw::Image", ptr %172, i32 0, i32 1
  %174 = load i32, ptr %173, align 4, !tbaa !14
  %175 = load ptr, ptr %4, align 8, !tbaa !5
  %176 = getelementptr inbounds %"struct.rw::Raster", ptr %175, i32 0, i32 5
  %177 = load i32, ptr %176, align 4, !tbaa !35
  %178 = icmp eq i32 %174, %177
  br i1 %178, label %179, label %180

179:                                              ; preds = %158
  br label %182

180:                                              ; preds = %158
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.1, i32 noundef 711, ptr noundef @__PRETTY_FUNCTION__._ZN2rw3gl315rasterFromImageEPNS_6RasterEPNS_5ImageE) #6
  unreachable

181:                                              ; No predecessors!
  br label %182

182:                                              ; preds = %181, %179
  %183 = load ptr, ptr %5, align 8, !tbaa !5
  %184 = getelementptr inbounds %"struct.rw::Image", ptr %183, i32 0, i32 2
  %185 = load i32, ptr %184, align 8, !tbaa !15
  %186 = load ptr, ptr %4, align 8, !tbaa !5
  %187 = getelementptr inbounds %"struct.rw::Raster", ptr %186, i32 0, i32 6
  %188 = load i32, ptr %187, align 8, !tbaa !36
  %189 = icmp eq i32 %185, %188
  br i1 %189, label %190, label %191

190:                                              ; preds = %182
  br label %193

191:                                              ; preds = %182
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.1, i32 noundef 712, ptr noundef @__PRETTY_FUNCTION__._ZN2rw3gl315rasterFromImageEPNS_6RasterEPNS_5ImageE) #6
  unreachable

192:                                              ; No predecessors!
  br label %193

193:                                              ; preds = %192, %190
  store i32 0, ptr %16, align 4, !tbaa !19
  br label %194

194:                                              ; preds = %242, %193
  %195 = load i32, ptr %16, align 4, !tbaa !19
  %196 = load ptr, ptr %5, align 8, !tbaa !5
  %197 = getelementptr inbounds %"struct.rw::Image", ptr %196, i32 0, i32 2
  %198 = load i32, ptr %197, align 8, !tbaa !15
  %199 = icmp slt i32 %195, %198
  br i1 %199, label %200, label %245

200:                                              ; preds = %194
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %201 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %201, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %202 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %202, ptr %18, align 8, !tbaa !5
  store i32 0, ptr %15, align 4, !tbaa !19
  br label %203

203:                                              ; preds = %225, %200
  %204 = load i32, ptr %15, align 4, !tbaa !19
  %205 = load ptr, ptr %5, align 8, !tbaa !5
  %206 = getelementptr inbounds %"struct.rw::Image", ptr %205, i32 0, i32 1
  %207 = load i32, ptr %206, align 4, !tbaa !14
  %208 = icmp slt i32 %204, %207
  br i1 %208, label %209, label %228

209:                                              ; preds = %203
  %210 = load ptr, ptr %6, align 8, !tbaa !5
  %211 = load ptr, ptr %18, align 8, !tbaa !5
  %212 = load ptr, ptr %17, align 8, !tbaa !5
  call void %210(ptr noundef %211, ptr noundef %212)
  %213 = load ptr, ptr %5, align 8, !tbaa !5
  %214 = getelementptr inbounds %"struct.rw::Image", ptr %213, i32 0, i32 4
  %215 = load i32, ptr %214, align 8, !tbaa !37
  %216 = load ptr, ptr %17, align 8, !tbaa !5
  %217 = sext i32 %215 to i64
  %218 = getelementptr inbounds i8, ptr %216, i64 %217
  store ptr %218, ptr %17, align 8, !tbaa !5
  %219 = load ptr, ptr %8, align 8, !tbaa !5
  %220 = getelementptr inbounds %"struct.rw::gl3::Gl3Raster", ptr %219, i32 0, i32 3
  %221 = load i32, ptr %220, align 4, !tbaa !38
  %222 = load ptr, ptr %18, align 8, !tbaa !5
  %223 = sext i32 %221 to i64
  %224 = getelementptr inbounds i8, ptr %222, i64 %223
  store ptr %224, ptr %18, align 8, !tbaa !5
  br label %225

225:                                              ; preds = %209
  %226 = load i32, ptr %15, align 4, !tbaa !19
  %227 = add nsw i32 %226, 1
  store i32 %227, ptr %15, align 4, !tbaa !19
  br label %203, !llvm.loop !39

228:                                              ; preds = %203
  %229 = load ptr, ptr %5, align 8, !tbaa !5
  %230 = getelementptr inbounds %"struct.rw::Image", ptr %229, i32 0, i32 5
  %231 = load i32, ptr %230, align 4, !tbaa !17
  %232 = load ptr, ptr %14, align 8, !tbaa !5
  %233 = sext i32 %231 to i64
  %234 = sub i64 0, %233
  %235 = getelementptr inbounds i8, ptr %232, i64 %234
  store ptr %235, ptr %14, align 8, !tbaa !5
  %236 = load ptr, ptr %4, align 8, !tbaa !5
  %237 = getelementptr inbounds %"struct.rw::Raster", ptr %236, i32 0, i32 8
  %238 = load i32, ptr %237, align 8, !tbaa !41
  %239 = load ptr, ptr %13, align 8, !tbaa !5
  %240 = sext i32 %238 to i64
  %241 = getelementptr inbounds i8, ptr %239, i64 %240
  store ptr %241, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  br label %242

242:                                              ; preds = %228
  %243 = load i32, ptr %16, align 4, !tbaa !19
  %244 = add nsw i32 %243, 1
  store i32 %244, ptr %16, align 4, !tbaa !19
  br label %194, !llvm.loop !42

245:                                              ; preds = %194
  %246 = load i8, ptr %12, align 1, !tbaa !33, !range !24, !noundef !25
  %247 = trunc i8 %246 to i1
  br i1 %247, label %248, label %250

248:                                              ; preds = %245
  %249 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN2rw6Raster6unlockEi(ptr noundef nonnull align 8 dereferenceable(96) %249, i32 noundef 0)
  br label %250

250:                                              ; preds = %248, %245
  %251 = load ptr, ptr %7, align 8, !tbaa !5
  %252 = icmp ne ptr %251, null
  br i1 %252, label %253, label %255

253:                                              ; preds = %250
  %254 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN2rw5Image7destroyEv(ptr noundef nonnull align 8 dereferenceable(40) %254)
  br label %255

255:                                              ; preds = %253, %250
  store i32 1, ptr %3, align 4
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #5
  br label %256

256:                                              ; preds = %255, %134
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %257

257:                                              ; preds = %256, %24
  %258 = load i32, ptr %3, align 4
  ret i32 %258
}

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_RGBA8888_from_RGBA8888EPhS0_(ptr noundef, ptr noundef) #2

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

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

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

declare void @_ZN2rw27conv_RGBA5551_from_ARGB1555EPhS0_(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 = { 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, !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 = !{!13, !11, i64 4}
!15 = !{!13, !11, i64 8}
!16 = !{!13, !6, i64 24}
!17 = !{!13, !11, i64 20}
!18 = !{!13, !6, i64 32}
!19 = !{!11, !11, i64 0}
!20 = !{!10, !11, i64 16}
!21 = !{!22, !23, i64 20}
!22 = !{!"_ZTSN2rw3gl39Gl3RasterE", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !23, i64 20, !23, i64 21, !23, i64 22, !7, i64 23, !7, i64 24, !7, i64 25, !7, i64 26, !11, i64 28, !11, i64 32, !6, i64 40, !6, i64 48}
!23 = !{!"bool", !7, i64 0}
!24 = !{i8 0, i8 2}
!25 = !{}
!26 = !{!27, !11, i64 0}
!27 = !{!"_ZTSN2rw3gl37Gl3CapsE", !11, i64 0, !11, i64 4, !23, i64 8, !23, i64 9, !28, i64 12}
!28 = !{!"float", !7, i64 0}
!29 = !{!30, !11, i64 0}
!30 = !{!"_ZTSN2rw5ErrorE", !11, i64 0, !11, i64 4}
!31 = !{!30, !11, i64 4}
!32 = !{!22, !23, i64 21}
!33 = !{!23, !23, i64 0}
!34 = !{!10, !6, i64 40}
!35 = !{!10, !11, i64 20}
!36 = !{!10, !11, i64 24}
!37 = !{!13, !11, i64 16}
!38 = !{!22, !11, i64 12}
!39 = distinct !{!39, !40}
!40 = !{!"llvm.loop.mustprogress"}
!41 = !{!10, !11, i64 32}
!42 = distinct !{!42, !40}


; 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::gl3::Gl3Caps" = type { i32, i32, i8, i8, float }
%"struct.rw::Error" = type { i32, i32 }

@_ZN2rw3gl318nativeRasterOffsetE = external dso_local local_unnamed_addr global i32, align 4
@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [8 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [22 x i8], align 1
@__PRETTY_FUNCTION__._ZN2rw3gl315rasterFromImageEPNS_6RasterEPNS_5ImageE = external hidden unnamed_addr constant [51 x i8], align 1
@_ZN2rw3gl37gl3CapsE = external local_unnamed_addr global %"struct.rw::gl3::Gl3Caps", align 4
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.7 = 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: 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

declare noundef i32 @_ZN2rw5Image8hasAlphaEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 2) i32 @_ZN2rw3gl315rasterFromImageEPNS_6RasterEPNS_5ImageE(ptr noundef %0, ptr noundef %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 %123

7:                                                ; preds = %2
  %8 = getelementptr inbounds i8, ptr %1, i64 12
  %9 = load i32, ptr %8, align 4, !tbaa !11
  %10 = icmp slt i32 %9, 9
  br i1 %10, label %11, label %23

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

23:                                               ; preds = %11, %7
  %.066 = phi ptr [ %16, %11 ], [ null, %7 ]
  %.065 = phi ptr [ %16, %11 ], [ %1, %7 ]
  %24 = load i32, ptr @_ZN2rw3gl318nativeRasterOffsetE, align 4, !tbaa !17
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds i8, ptr %0, i64 %25
  %27 = getelementptr inbounds i8, ptr %0, i64 16
  %28 = load i32, ptr %27, align 8, !tbaa !18
  %29 = and i32 %28, 3840
  %30 = getelementptr inbounds i8, ptr %26, i64 20
  %31 = load i8, ptr %30, align 4, !tbaa !19, !range !22, !noundef !23
  %32 = trunc nuw i8 %31 to i1
  br i1 %32, label %33, label %34

33:                                               ; preds = %23
  tail call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 659, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw3gl315rasterFromImageEPNS_6RasterEPNS_5ImageE) #6
  unreachable

34:                                               ; preds = %23
  %35 = getelementptr inbounds i8, ptr %.065, i64 12
  %36 = load i32, ptr %35, align 4, !tbaa !11
  %37 = add i32 %36, -4
  %38 = tail call i32 @llvm.fshl.i32(i32 %37, i32 %37, i32 30)
  switch i32 %38, label %51 [
    i32 7, label %39
    i32 5, label %43
    i32 3, label %47
  ]

39:                                               ; preds = %34
  %40 = load i32, ptr @_ZN2rw3gl37gl3CapsE, align 4, !tbaa !24
  %.not74 = icmp eq i32 %40, 0
  br i1 %.not74, label %41, label %58

41:                                               ; preds = %39
  switch i32 %29, label %51 [
    i32 1280, label %58
    i32 1536, label %42
  ]

42:                                               ; preds = %41
  br label %58

43:                                               ; preds = %34
  %44 = load i32, ptr @_ZN2rw3gl37gl3CapsE, align 4, !tbaa !24
  %.not73 = icmp eq i32 %44, 0
  br i1 %.not73, label %45, label %58

45:                                               ; preds = %43
  switch i32 %29, label %51 [
    i32 1280, label %58
    i32 1536, label %46
  ]

46:                                               ; preds = %45
  br label %58

47:                                               ; preds = %34
  %48 = load i32, ptr @_ZN2rw3gl37gl3CapsE, align 4, !tbaa !24
  %.not72 = icmp eq i32 %48, 0
  br i1 %.not72, label %49, label %58

49:                                               ; preds = %47
  %50 = icmp eq i32 %29, 256
  br i1 %50, label %58, label %51

51:                                               ; preds = %45, %41, %49, %34
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  store i32 2816, ptr %3, align 4, !tbaa !27
  %52 = getelementptr inbounds i8, ptr %3, i64 4
  store i32 -2147483638, ptr %52, align 4, !tbaa !29
  %53 = load ptr, ptr @stderr, align 8, !tbaa !16
  %54 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %53, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 694) #8
  %55 = load ptr, ptr @stderr, align 8, !tbaa !16
  %56 = tail call noundef ptr (i32, ...) @_ZN2rw9dbgsprintEjz(i32 noundef -2147483638)
  %57 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %55, ptr noundef nonnull @.str.2, ptr noundef %56) #8
  call void @_ZN2rw8setErrorEPNS_5ErrorE(ptr noundef nonnull %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  br label %123

58:                                               ; preds = %49, %47, %45, %43, %41, %39, %46, %42
  %.067 = phi ptr [ @_ZN2rw23conv_RGB888_from_RGB888EPhS0_, %46 ], [ @_ZN2rw23conv_RGB888_from_RGB888EPhS0_, %42 ], [ @_ZN2rw27conv_RGBA8888_from_RGBA8888EPhS0_, %39 ], [ @_ZN2rw27conv_RGBA8888_from_RGBA8888EPhS0_, %41 ], [ @_ZN2rw25conv_RGBA8888_from_RGB888EPhS0_, %43 ], [ @_ZN2rw25conv_RGBA8888_from_RGB888EPhS0_, %45 ], [ @_ZN2rw27conv_RGBA8888_from_ARGB1555EPhS0_, %47 ], [ @_ZN2rw27conv_RGBA5551_from_ARGB1555EPhS0_, %49 ]
  %59 = tail call noundef i32 @_ZN2rw5Image8hasAlphaEv(ptr noundef nonnull align 8 dereferenceable(40) %.065)
  %60 = icmp ne i32 %59, 0
  %61 = getelementptr inbounds i8, ptr %26, i64 21
  %62 = zext i1 %60 to i8
  store i8 %62, ptr %61, align 1, !tbaa !30
  %63 = getelementptr inbounds i8, ptr %0, i64 40
  %64 = load ptr, ptr %63, align 8, !tbaa !31
  %65 = icmp eq ptr %64, null
  br i1 %65, label %66, label %.thread

66:                                               ; preds = %58
  %67 = tail call noundef ptr @_ZN2rw6Raster4lockEii(ptr noundef nonnull align 8 dereferenceable(96) %0, i32 noundef 0, i32 noundef 5)
  %.pr = load ptr, ptr %63, align 8, !tbaa !31
  %.not75 = icmp eq ptr %.pr, null
  br i1 %.not75, label %68, label %.thread

68:                                               ; preds = %66
  tail call void @__assert_fail(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.1, i32 noundef 707, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw3gl315rasterFromImageEPNS_6RasterEPNS_5ImageE) #6
  unreachable

.thread:                                          ; preds = %58, %66
  %69 = phi ptr [ %.pr, %66 ], [ %64, %58 ]
  %70 = getelementptr inbounds i8, ptr %.065, i64 8
  %71 = getelementptr inbounds i8, ptr %.065, i64 20
  %72 = getelementptr inbounds i8, ptr %.065, i64 4
  %73 = load i32, ptr %72, align 4, !tbaa !13
  %74 = getelementptr inbounds i8, ptr %0, i64 20
  %75 = load i32, ptr %74, align 4, !tbaa !32
  %76 = icmp eq i32 %73, %75
  br i1 %76, label %78, label %77

77:                                               ; preds = %.thread
  tail call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.1, i32 noundef 711, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw3gl315rasterFromImageEPNS_6RasterEPNS_5ImageE) #6
  unreachable

78:                                               ; preds = %.thread
  %79 = getelementptr inbounds i8, ptr %.065, i64 24
  %80 = load ptr, ptr %79, align 8, !tbaa !33
  %81 = load i32, ptr %70, align 8, !tbaa !14
  %82 = add nsw i32 %81, -1
  %83 = load i32, ptr %71, align 4, !tbaa !15
  %84 = mul nsw i32 %82, %83
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds i8, ptr %80, i64 %85
  %87 = getelementptr inbounds i8, ptr %0, i64 24
  %88 = load i32, ptr %87, align 8, !tbaa !34
  %89 = icmp eq i32 %81, %88
  br i1 %89, label %.preheader78, label %95

.preheader78:                                     ; preds = %78
  %90 = icmp sgt i32 %81, 0
  br i1 %90, label %.preheader.lr.ph, label %._crit_edge85

.preheader.lr.ph:                                 ; preds = %.preheader78
  %91 = getelementptr inbounds i8, ptr %.065, i64 16
  %92 = getelementptr inbounds i8, ptr %26, i64 12
  %93 = getelementptr inbounds i8, ptr %0, i64 32
  %94 = icmp sgt i32 %73, 0
  br i1 %94, label %.preheader, label %._crit_edge85

95:                                               ; preds = %78
  tail call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.1, i32 noundef 712, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2rw3gl315rasterFromImageEPNS_6RasterEPNS_5ImageE) #6
  unreachable

.preheader:                                       ; preds = %.preheader.lr.ph, %._crit_edge
  %96 = phi i32 [ %109, %._crit_edge ], [ %81, %.preheader.lr.ph ]
  %97 = phi i32 [ %110, %._crit_edge ], [ %83, %.preheader.lr.ph ]
  %98 = phi i32 [ %111, %._crit_edge ], [ %73, %.preheader.lr.ph ]
  %.05984 = phi i32 [ %118, %._crit_edge ], [ 0, %.preheader.lr.ph ]
  %.06183 = phi ptr [ %114, %._crit_edge ], [ %86, %.preheader.lr.ph ]
  %.06282 = phi ptr [ %117, %._crit_edge ], [ %69, %.preheader.lr.ph ]
  %99 = icmp sgt i32 %98, 0
  br i1 %99, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %.081 = phi ptr [ %105, %.lr.ph ], [ %.06282, %.preheader ]
  %.05880 = phi ptr [ %102, %.lr.ph ], [ %.06183, %.preheader ]
  %.06079 = phi i32 [ %106, %.lr.ph ], [ 0, %.preheader ]
  tail call void %.067(ptr noundef %.081, ptr noundef %.05880)
  %100 = load i32, ptr %91, align 8, !tbaa !35
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds i8, ptr %.05880, i64 %101
  %103 = load i32, ptr %92, align 4, !tbaa !36
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds i8, ptr %.081, i64 %104
  %106 = add nuw nsw i32 %.06079, 1
  %107 = load i32, ptr %72, align 4, !tbaa !13
  %108 = icmp slt i32 %106, %107
  br i1 %108, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !37

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load i32, ptr %71, align 4, !tbaa !15
  %.pre87 = load i32, ptr %70, align 8, !tbaa !14
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %109 = phi i32 [ %.pre87, %._crit_edge.loopexit ], [ %96, %.preheader ]
  %110 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %97, %.preheader ]
  %111 = phi i32 [ %107, %._crit_edge.loopexit ], [ %98, %.preheader ]
  %112 = sext i32 %110 to i64
  %113 = sub nsw i64 0, %112
  %114 = getelementptr inbounds i8, ptr %.06183, i64 %113
  %115 = load i32, ptr %93, align 8, !tbaa !39
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds i8, ptr %.06282, i64 %116
  %118 = add nuw nsw i32 %.05984, 1
  %119 = icmp slt i32 %118, %109
  br i1 %119, label %.preheader, label %._crit_edge85, !llvm.loop !40

._crit_edge85:                                    ; preds = %._crit_edge, %.preheader.lr.ph, %.preheader78
  br i1 %65, label %120, label %121

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

121:                                              ; preds = %120, %._crit_edge85
  %.not76 = icmp eq ptr %.066, null
  br i1 %.not76, label %123, label %122

122:                                              ; preds = %121
  tail call void @_ZN2rw5Image7destroyEv(ptr noundef nonnull align 8 dereferenceable(40) %.066)
  br label %123

123:                                              ; preds = %51, %122, %121, %2
  %.1 = phi i32 [ 0, %2 ], [ 0, %51 ], [ 1, %122 ], [ 1, %121 ]
  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_RGBA8888_from_RGBA8888EPhS0_(ptr noundef, ptr noundef) local_unnamed_addr #2

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

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

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

declare void @_ZN2rw27conv_RGBA5551_from_ARGB1555EPhS0_(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) #5

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { noreturn nounwind }
attributes #7 = { nounwind }
attributes #8 = { cold 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, !21, i64 20}
!20 = !{!"_ZTSN2rw3gl39Gl3RasterE", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !21, i64 20, !21, i64 21, !21, i64 22, !8, i64 23, !8, i64 24, !8, i64 25, !8, i64 26, !7, i64 28, !7, i64 32, !10, i64 40, !10, i64 48}
!21 = !{!"bool", !8, i64 0}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = !{!25, !7, i64 0}
!25 = !{!"_ZTSN2rw3gl37Gl3CapsE", !7, i64 0, !7, i64 4, !21, i64 8, !21, i64 9, !26, i64 12}
!26 = !{!"float", !8, i64 0}
!27 = !{!28, !7, i64 0}
!28 = !{!"_ZTSN2rw5ErrorE", !7, i64 0, !7, i64 4}
!29 = !{!28, !7, i64 4}
!30 = !{!20, !21, i64 21}
!31 = !{!6, !10, i64 40}
!32 = !{!6, !7, i64 20}
!33 = !{!12, !10, i64 24}
!34 = !{!6, !7, i64 24}
!35 = !{!12, !7, i64 16}
!36 = !{!20, !7, i64 12}
!37 = distinct !{!37, !38}
!38 = !{!"llvm.loop.mustprogress"}
!39 = !{!6, !7, i64 32}
!40 = distinct !{!40, !38, !41}
!41 = !{!"llvm.loop.unswitch.partial.disable"}


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