; LLVM IR from jrouwe/JoltPhysics :: TestFramework/Image (BlitSurface)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.JPH::RefConst" = type { ptr }
%"class.JPH::Ref" = type { ptr }
%"class.JPH::Color" = type { %union.anon }
%union.anon = type { i32 }
%class.BlitSettings = type { i8, i8, i8, i8, i8, %"class.JPH::Color", %"class.JPH::Color", %class.ZoomSettings }
%class.ZoomSettings = type { i32, i8, float }

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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z11BlitSurfaceN3JPH8RefConstI7SurfaceEENS_3RefIS1_EERK12BlitSettings(ptr noundef %0, ptr noundef %1, ptr noundef nonnull align 4 dereferenceable(28) %2) #2 personality ptr @__gxx_personality_v0 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %"class.JPH::RefConst", align 8
  %9 = alloca %"class.JPH::Ref", align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca %"class.JPH::RefConst", align 8
  %13 = alloca %"class.JPH::Ref", align 8
  %14 = alloca %"class.JPH::Ref", align 8
  %15 = alloca %"class.JPH::Ref", align 8
  %16 = alloca %"class.JPH::Ref", align 8
  %17 = alloca %"class.JPH::Ref", align 8
  %18 = alloca %"class.JPH::Ref", align 8
  %19 = alloca %"class.JPH::Color", align 4
  %20 = alloca %"class.JPH::Color", align 4
  %21 = alloca %"class.JPH::RefConst", align 8
  %22 = alloca %"class.JPH::Ref", align 8
  %23 = alloca i32, align 4
  %24 = alloca %"class.JPH::RefConst", align 8
  %25 = alloca %"class.JPH::Ref", align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  call void @_ZN3JPH8RefConstI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %0)
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = getelementptr inbounds %class.BlitSettings, ptr %26, i32 0, i32 0
  %28 = load i8, ptr %27, align 4, !tbaa !9, !range !16, !noundef !17
  %29 = trunc i8 %28 to i1
  br i1 %29, label %50, label %30

30:                                               ; preds = %3
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = getelementptr inbounds %class.BlitSettings, ptr %31, i32 0, i32 1
  %33 = load i8, ptr %32, align 1, !tbaa !18, !range !16, !noundef !17
  %34 = trunc i8 %33 to i1
  br i1 %34, label %50, label %35

35:                                               ; preds = %30
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = getelementptr inbounds %class.BlitSettings, ptr %36, i32 0, i32 2
  %38 = load i8, ptr %37, align 2, !tbaa !19, !range !16, !noundef !17
  %39 = trunc i8 %38 to i1
  br i1 %39, label %50, label %40

40:                                               ; preds = %35
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = getelementptr inbounds %class.BlitSettings, ptr %41, i32 0, i32 3
  %43 = load i8, ptr %42, align 1, !tbaa !20, !range !16, !noundef !17
  %44 = trunc i8 %43 to i1
  br i1 %44, label %50, label %45

45:                                               ; preds = %40
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = getelementptr inbounds %class.BlitSettings, ptr %46, i32 0, i32 4
  %48 = load i8, ptr %47, align 4, !tbaa !21, !range !16, !noundef !17
  %49 = trunc i8 %48 to i1
  br i1 %49, label %50, label %168

50:                                               ; preds = %45, %40, %35, %30, %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  %51 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 64) #9
          to label %52 unwind label %79

52:                                               ; preds = %50
  %53 = invoke noundef ptr @_ZNK3JPH8RefConstI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %0)
          to label %54 unwind label %83

54:                                               ; preds = %52
  %55 = invoke noundef i32 @_ZNK7Surface8GetWidthEv(ptr noundef nonnull align 8 dereferenceable(48) %53)
          to label %56 unwind label %83

56:                                               ; preds = %54
  %57 = invoke noundef ptr @_ZNK3JPH8RefConstI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %0)
          to label %58 unwind label %83

58:                                               ; preds = %56
  %59 = invoke noundef i32 @_ZNK7Surface9GetHeightEv(ptr noundef nonnull align 8 dereferenceable(48) %57)
          to label %60 unwind label %83

60:                                               ; preds = %58
  invoke void @_ZN15SoftwareSurfaceC1Eii14ESurfaceFormati(ptr noundef nonnull align 8 dereferenceable(64) %51, i32 noundef %55, i32 noundef %59, i32 noundef 13, i32 noundef 0)
          to label %61 unwind label %83

61:                                               ; preds = %60
  invoke void @_ZN3JPH3RefI7SurfaceEC2EPS1_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef %51)
          to label %62 unwind label %79

62:                                               ; preds = %61
  invoke void @_ZN3JPH8RefConstI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %0)
          to label %63 unwind label %87

63:                                               ; preds = %62
  invoke void @_ZN3JPH3RefI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %64 unwind label %91

64:                                               ; preds = %63
  %65 = invoke noundef zeroext i1 @_ZL13sConvertImageN3JPH8RefConstI7SurfaceEENS_3RefIS1_EE(ptr noundef %12, ptr noundef %13)
          to label %66 unwind label %95

66:                                               ; preds = %64
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %13) #8
  call void @_ZN3JPH8RefConstI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %12) #8
  %67 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN3JPH8RefConstI7SurfaceEaSERKNS_3RefIS1_EE(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %68 unwind label %87

68:                                               ; preds = %66
  %69 = invoke noundef ptr @_ZNK3JPH3RefI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %70 unwind label %87

70:                                               ; preds = %68
  invoke void @_ZNK7Surface4LockE16ESurfaceLockMode(ptr noundef nonnull align 8 dereferenceable(48) %69, i32 noundef 3)
          to label %71 unwind label %87

71:                                               ; preds = %70
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  %73 = getelementptr inbounds %class.BlitSettings, ptr %72, i32 0, i32 0
  %74 = load i8, ptr %73, align 4, !tbaa !9, !range !16, !noundef !17
  %75 = trunc i8 %74 to i1
  br i1 %75, label %76, label %104

76:                                               ; preds = %71
  invoke void @_ZN3JPH3RefI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %77 unwind label %87

77:                                               ; preds = %76
  invoke void @_ZL18sConvertRGBToAlphaN3JPH3RefI7SurfaceEE(ptr noundef %14)
          to label %78 unwind label %100

78:                                               ; preds = %77
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %14) #8
  br label %104

79:                                               ; preds = %61, %50
  %80 = landingpad { ptr, i32 }
          cleanup
  %81 = extractvalue { ptr, i32 } %80, 0
  store ptr %81, ptr %10, align 8
  %82 = extractvalue { ptr, i32 } %80, 1
  store i32 %82, ptr %11, align 4
  br label %167

83:                                               ; preds = %60, %58, %56, %54, %52
  %84 = landingpad { ptr, i32 }
          cleanup
  %85 = extractvalue { ptr, i32 } %84, 0
  store ptr %85, ptr %10, align 8
  %86 = extractvalue { ptr, i32 } %84, 1
  store i32 %86, ptr %11, align 4
  call void @_ZdlPvm(ptr noundef %51, i64 noundef 64) #10
  br label %167

87:                                               ; preds = %164, %162, %145, %133, %121, %109, %76, %70, %68, %66, %62
  %88 = landingpad { ptr, i32 }
          cleanup
  %89 = extractvalue { ptr, i32 } %88, 0
  store ptr %89, ptr %10, align 8
  %90 = extractvalue { ptr, i32 } %88, 1
  store i32 %90, ptr %11, align 4
  br label %166

91:                                               ; preds = %63
  %92 = landingpad { ptr, i32 }
          cleanup
  %93 = extractvalue { ptr, i32 } %92, 0
  store ptr %93, ptr %10, align 8
  %94 = extractvalue { ptr, i32 } %92, 1
  store i32 %94, ptr %11, align 4
  br label %99

95:                                               ; preds = %64
  %96 = landingpad { ptr, i32 }
          cleanup
  %97 = extractvalue { ptr, i32 } %96, 0
  store ptr %97, ptr %10, align 8
  %98 = extractvalue { ptr, i32 } %96, 1
  store i32 %98, ptr %11, align 4
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %13) #8
  br label %99

99:                                               ; preds = %95, %91
  call void @_ZN3JPH8RefConstI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %12) #8
  br label %166

100:                                              ; preds = %77
  %101 = landingpad { ptr, i32 }
          cleanup
  %102 = extractvalue { ptr, i32 } %101, 0
  store ptr %102, ptr %10, align 8
  %103 = extractvalue { ptr, i32 } %101, 1
  store i32 %103, ptr %11, align 4
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %14) #8
  br label %166

104:                                              ; preds = %78, %71
  %105 = load ptr, ptr %7, align 8, !tbaa !5
  %106 = getelementptr inbounds %class.BlitSettings, ptr %105, i32 0, i32 1
  %107 = load i8, ptr %106, align 1, !tbaa !18, !range !16, !noundef !17
  %108 = trunc i8 %107 to i1
  br i1 %108, label %109, label %116

109:                                              ; preds = %104
  invoke void @_ZN3JPH3RefI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %110 unwind label %87

110:                                              ; preds = %109
  invoke void @_ZL18sConvertAlphaToRGBN3JPH3RefI7SurfaceEE(ptr noundef %15)
          to label %111 unwind label %112

111:                                              ; preds = %110
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %15) #8
  br label %116

112:                                              ; preds = %110
  %113 = landingpad { ptr, i32 }
          cleanup
  %114 = extractvalue { ptr, i32 } %113, 0
  store ptr %114, ptr %10, align 8
  %115 = extractvalue { ptr, i32 } %113, 1
  store i32 %115, ptr %11, align 4
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %15) #8
  br label %166

116:                                              ; preds = %111, %104
  %117 = load ptr, ptr %7, align 8, !tbaa !5
  %118 = getelementptr inbounds %class.BlitSettings, ptr %117, i32 0, i32 2
  %119 = load i8, ptr %118, align 2, !tbaa !19, !range !16, !noundef !17
  %120 = trunc i8 %119 to i1
  br i1 %120, label %121, label %128

121:                                              ; preds = %116
  invoke void @_ZN3JPH3RefI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %122 unwind label %87

122:                                              ; preds = %121
  invoke void @_ZL19sConvertToGrayScaleN3JPH3RefI7SurfaceEE(ptr noundef %16)
          to label %123 unwind label %124

123:                                              ; preds = %122
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %16) #8
  br label %128

124:                                              ; preds = %122
  %125 = landingpad { ptr, i32 }
          cleanup
  %126 = extractvalue { ptr, i32 } %125, 0
  store ptr %126, ptr %10, align 8
  %127 = extractvalue { ptr, i32 } %125, 1
  store i32 %127, ptr %11, align 4
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %16) #8
  br label %166

128:                                              ; preds = %123, %116
  %129 = load ptr, ptr %7, align 8, !tbaa !5
  %130 = getelementptr inbounds %class.BlitSettings, ptr %129, i32 0, i32 3
  %131 = load i8, ptr %130, align 1, !tbaa !20, !range !16, !noundef !17
  %132 = trunc i8 %131 to i1
  br i1 %132, label %133, label %140

133:                                              ; preds = %128
  invoke void @_ZN3JPH3RefI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %134 unwind label %87

134:                                              ; preds = %133
  invoke void @_ZL12sInvertAlphaN3JPH3RefI7SurfaceEE(ptr noundef %17)
          to label %135 unwind label %136

135:                                              ; preds = %134
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %17) #8
  br label %140

136:                                              ; preds = %134
  %137 = landingpad { ptr, i32 }
          cleanup
  %138 = extractvalue { ptr, i32 } %137, 0
  store ptr %138, ptr %10, align 8
  %139 = extractvalue { ptr, i32 } %137, 1
  store i32 %139, ptr %11, align 4
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %17) #8
  br label %166

140:                                              ; preds = %135, %128
  %141 = load ptr, ptr %7, align 8, !tbaa !5
  %142 = getelementptr inbounds %class.BlitSettings, ptr %141, i32 0, i32 4
  %143 = load i8, ptr %142, align 4, !tbaa !21, !range !16, !noundef !17
  %144 = trunc i8 %143 to i1
  br i1 %144, label %145, label %162

145:                                              ; preds = %140
  invoke void @_ZN3JPH3RefI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %18, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %146 unwind label %87

146:                                              ; preds = %145
  %147 = load ptr, ptr %7, align 8, !tbaa !5
  %148 = getelementptr inbounds %class.BlitSettings, ptr %147, i32 0, i32 5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %148, i64 4, i1 false), !tbaa.struct !22
  %149 = load ptr, ptr %7, align 8, !tbaa !5
  %150 = getelementptr inbounds %class.BlitSettings, ptr %149, i32 0, i32 6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %20, ptr align 4 %150, i64 4, i1 false), !tbaa.struct !22
  %151 = getelementptr inbounds %"class.JPH::Color", ptr %19, i32 0, i32 0
  %152 = getelementptr inbounds %union.anon, ptr %151, i32 0, i32 0
  %153 = load i32, ptr %152, align 4
  %154 = getelementptr inbounds %"class.JPH::Color", ptr %20, i32 0, i32 0
  %155 = getelementptr inbounds %union.anon, ptr %154, i32 0, i32 0
  %156 = load i32, ptr %155, align 4
  invoke void @_ZL14sColorKeyAlphaN3JPH3RefI7SurfaceEENS_5ColorES3_(ptr noundef %18, i32 %153, i32 %156)
          to label %157 unwind label %158

157:                                              ; preds = %146
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %18) #8
  br label %162

158:                                              ; preds = %146
  %159 = landingpad { ptr, i32 }
          cleanup
  %160 = extractvalue { ptr, i32 } %159, 0
  store ptr %160, ptr %10, align 8
  %161 = extractvalue { ptr, i32 } %159, 1
  store i32 %161, ptr %11, align 4
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %18) #8
  br label %166

162:                                              ; preds = %157, %140
  %163 = invoke noundef ptr @_ZNK3JPH3RefI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %164 unwind label %87

164:                                              ; preds = %162
  invoke void @_ZNK7Surface6UnLockEv(ptr noundef nonnull align 8 dereferenceable(48) %163)
          to label %165 unwind label %87

165:                                              ; preds = %164
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  br label %168

166:                                              ; preds = %158, %136, %124, %112, %100, %99, %87
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #8
  br label %167

167:                                              ; preds = %166, %83, %79
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  br label %231

168:                                              ; preds = %165, %45
  %169 = invoke noundef ptr @_ZNK3JPH8RefConstI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %8)
          to label %170 unwind label %197

170:                                              ; preds = %168
  %171 = invoke noundef i32 @_ZNK7Surface8GetWidthEv(ptr noundef nonnull align 8 dereferenceable(48) %169)
          to label %172 unwind label %197

172:                                              ; preds = %170
  %173 = invoke noundef ptr @_ZNK3JPH3RefI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %1)
          to label %174 unwind label %197

174:                                              ; preds = %172
  %175 = invoke noundef i32 @_ZNK7Surface8GetWidthEv(ptr noundef nonnull align 8 dereferenceable(48) %173)
          to label %176 unwind label %197

176:                                              ; preds = %174
  %177 = icmp ne i32 %171, %175
  br i1 %177, label %188, label %178

178:                                              ; preds = %176
  %179 = invoke noundef ptr @_ZNK3JPH8RefConstI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %8)
          to label %180 unwind label %197

180:                                              ; preds = %178
  %181 = invoke noundef i32 @_ZNK7Surface9GetHeightEv(ptr noundef nonnull align 8 dereferenceable(48) %179)
          to label %182 unwind label %197

182:                                              ; preds = %180
  %183 = invoke noundef ptr @_ZNK3JPH3RefI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %1)
          to label %184 unwind label %197

184:                                              ; preds = %182
  %185 = invoke noundef i32 @_ZNK7Surface9GetHeightEv(ptr noundef nonnull align 8 dereferenceable(48) %183)
          to label %186 unwind label %197

186:                                              ; preds = %184
  %187 = icmp ne i32 %181, %185
  br i1 %187, label %188, label %211

188:                                              ; preds = %186, %176
  invoke void @_ZN3JPH8RefConstI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef nonnull align 8 dereferenceable(8) %8)
          to label %189 unwind label %197

189:                                              ; preds = %188
  invoke void @_ZN3JPH3RefI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %22, ptr noundef nonnull align 8 dereferenceable(8) %1)
          to label %190 unwind label %201

190:                                              ; preds = %189
  %191 = load ptr, ptr %7, align 8, !tbaa !5
  %192 = getelementptr inbounds %class.BlitSettings, ptr %191, i32 0, i32 7
  %193 = invoke noundef zeroext i1 @_Z9ZoomImageN3JPH8RefConstI7SurfaceEENS_3RefIS1_EERK12ZoomSettings(ptr noundef %21, ptr noundef %22, ptr noundef nonnull align 4 dereferenceable(12) %192)
          to label %194 unwind label %205

194:                                              ; preds = %190
  %195 = xor i1 %193, true
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %22) #8
  call void @_ZN3JPH8RefConstI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %21) #8
  br i1 %195, label %196, label %210

196:                                              ; preds = %194
  store i1 false, ptr %4, align 1
  store i32 1, ptr %23, align 4
  br label %229

197:                                              ; preds = %211, %188, %184, %182, %180, %178, %174, %172, %170, %168
  %198 = landingpad { ptr, i32 }
          cleanup
  %199 = extractvalue { ptr, i32 } %198, 0
  store ptr %199, ptr %10, align 8
  %200 = extractvalue { ptr, i32 } %198, 1
  store i32 %200, ptr %11, align 4
  br label %231

201:                                              ; preds = %189
  %202 = landingpad { ptr, i32 }
          cleanup
  %203 = extractvalue { ptr, i32 } %202, 0
  store ptr %203, ptr %10, align 8
  %204 = extractvalue { ptr, i32 } %202, 1
  store i32 %204, ptr %11, align 4
  br label %209

205:                                              ; preds = %190
  %206 = landingpad { ptr, i32 }
          cleanup
  %207 = extractvalue { ptr, i32 } %206, 0
  store ptr %207, ptr %10, align 8
  %208 = extractvalue { ptr, i32 } %206, 1
  store i32 %208, ptr %11, align 4
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %22) #8
  br label %209

209:                                              ; preds = %205, %201
  call void @_ZN3JPH8RefConstI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %21) #8
  br label %231

210:                                              ; preds = %194
  br label %228

211:                                              ; preds = %186
  invoke void @_ZN3JPH8RefConstI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %24, ptr noundef nonnull align 8 dereferenceable(8) %8)
          to label %212 unwind label %197

212:                                              ; preds = %211
  invoke void @_ZN3JPH3RefI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %25, ptr noundef nonnull align 8 dereferenceable(8) %1)
          to label %213 unwind label %218

213:                                              ; preds = %212
  %214 = invoke noundef zeroext i1 @_ZL13sConvertImageN3JPH8RefConstI7SurfaceEENS_3RefIS1_EE(ptr noundef %24, ptr noundef %25)
          to label %215 unwind label %222

215:                                              ; preds = %213
  %216 = xor i1 %214, true
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %25) #8
  call void @_ZN3JPH8RefConstI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %24) #8
  br i1 %216, label %217, label %227

217:                                              ; preds = %215
  store i1 false, ptr %4, align 1
  store i32 1, ptr %23, align 4
  br label %229

218:                                              ; preds = %212
  %219 = landingpad { ptr, i32 }
          cleanup
  %220 = extractvalue { ptr, i32 } %219, 0
  store ptr %220, ptr %10, align 8
  %221 = extractvalue { ptr, i32 } %219, 1
  store i32 %221, ptr %11, align 4
  br label %226

222:                                              ; preds = %213
  %223 = landingpad { ptr, i32 }
          cleanup
  %224 = extractvalue { ptr, i32 } %223, 0
  store ptr %224, ptr %10, align 8
  %225 = extractvalue { ptr, i32 } %223, 1
  store i32 %225, ptr %11, align 4
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %25) #8
  br label %226

226:                                              ; preds = %222, %218
  call void @_ZN3JPH8RefConstI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %24) #8
  br label %231

227:                                              ; preds = %215
  br label %228

228:                                              ; preds = %227, %210
  store i1 true, ptr %4, align 1
  store i32 1, ptr %23, align 4
  br label %229

229:                                              ; preds = %228, %217, %196
  call void @_ZN3JPH8RefConstI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  %230 = load i1, ptr %4, align 1
  ret i1 %230

231:                                              ; preds = %226, %209, %197, %167
  call void @_ZN3JPH8RefConstI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  br label %232

232:                                              ; preds = %231
  %233 = load ptr, ptr %10, align 8
  %234 = load i32, ptr %11, align 4
  %235 = insertvalue { ptr, i32 } poison, ptr %233, 0
  %236 = insertvalue { ptr, i32 } %235, i32 %234, 1
  resume { ptr, i32 } %236
}

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #4

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

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

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

declare void @_ZN15SoftwareSurfaceC1Eii14ESurfaceFormati(ptr noundef nonnull align 8 dereferenceable(64), i32 noundef, i32 noundef, i32 noundef, i32 noundef) unnamed_addr #6

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #7

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

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i1 @_ZL13sConvertImageN3JPH8RefConstI7SurfaceEENS_3RefIS1_EE(ptr noundef, ptr noundef) #2

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

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

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

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

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

declare void @_ZNK7Surface4LockE16ESurfaceLockMode(ptr noundef nonnull align 8 dereferenceable(48), i32 noundef) #6

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL18sConvertRGBToAlphaN3JPH3RefI7SurfaceEE(ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL18sConvertAlphaToRGBN3JPH3RefI7SurfaceEE(ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL19sConvertToGrayScaleN3JPH3RefI7SurfaceEE(ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL12sInvertAlphaN3JPH3RefI7SurfaceEE(ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL14sColorKeyAlphaN3JPH3RefI7SurfaceEENS_5ColorES3_(ptr noundef, i32, i32) #2

declare void @_ZNK7Surface6UnLockEv(ptr noundef nonnull align 8 dereferenceable(48)) #6

declare noundef zeroext i1 @_Z9ZoomImageN3JPH8RefConstI7SurfaceEENS_3RefIS1_EERK12ZoomSettings(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(12)) #6

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nobuiltin allocsize(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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nobuiltin 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 #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }
attributes #10 = { builtin 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 0}
!10 = !{!"_ZTS12BlitSettings", !11, i64 0, !11, i64 1, !11, i64 2, !11, i64 3, !11, i64 4, !12, i64 8, !12, i64 12, !13, i64 16}
!11 = !{!"bool", !7, i64 0}
!12 = !{!"_ZTSN3JPH5ColorE", !7, i64 0}
!13 = !{!"_ZTS12ZoomSettings", !14, i64 0, !11, i64 4, !15, i64 8}
!14 = !{!"_ZTS7EFilter", !7, i64 0}
!15 = !{!"float", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!10, !11, i64 1}
!19 = !{!10, !11, i64 2}
!20 = !{!10, !11, i64 3}
!21 = !{!10, !11, i64 4}
!22 = !{i64 0, i64 4, !23}
!23 = !{!7, !7, i64 0}


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

%"class.JPH::RefConst" = type { ptr }
%"class.JPH::Ref" = type { ptr }

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z11BlitSurfaceN3JPH8RefConstI7SurfaceEENS_3RefIS1_EERK12BlitSettings(ptr noundef nonnull %0, ptr noundef %1, ptr noundef nonnull align 4 dereferenceable(28) %2) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.JPH::RefConst", align 8
  %5 = alloca %"class.JPH::Ref", align 8
  %6 = alloca %"class.JPH::RefConst", align 8
  %7 = alloca %"class.JPH::Ref", align 8
  %8 = alloca %"class.JPH::Ref", align 8
  %9 = alloca %"class.JPH::Ref", align 8
  %10 = alloca %"class.JPH::Ref", align 8
  %11 = alloca %"class.JPH::Ref", align 8
  %12 = alloca %"class.JPH::Ref", align 8
  %13 = alloca %"class.JPH::RefConst", align 8
  %14 = alloca %"class.JPH::Ref", align 8
  %15 = alloca %"class.JPH::RefConst", align 8
  %16 = alloca %"class.JPH::Ref", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  call void @_ZN3JPH8RefConstI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %0)
  %17 = load i8, ptr %2, align 4, !tbaa !5, !range !14, !noundef !15
  %18 = trunc nuw i8 %17 to i1
  br i1 %18, label %35, label %19

19:                                               ; preds = %3
  %20 = getelementptr inbounds i8, ptr %2, i64 1
  %21 = load i8, ptr %20, align 1, !tbaa !16, !range !14, !noundef !15
  %22 = trunc nuw i8 %21 to i1
  br i1 %22, label %35, label %23

23:                                               ; preds = %19
  %24 = getelementptr inbounds i8, ptr %2, i64 2
  %25 = load i8, ptr %24, align 2, !tbaa !17, !range !14, !noundef !15
  %26 = trunc nuw i8 %25 to i1
  br i1 %26, label %35, label %27

27:                                               ; preds = %23
  %28 = getelementptr inbounds i8, ptr %2, i64 3
  %29 = load i8, ptr %28, align 1, !tbaa !18, !range !14, !noundef !15
  %30 = trunc nuw i8 %29 to i1
  br i1 %30, label %35, label %31

31:                                               ; preds = %27
  %32 = getelementptr inbounds i8, ptr %2, i64 4
  %33 = load i8, ptr %32, align 4, !tbaa !19, !range !14, !noundef !15
  %34 = trunc nuw i8 %33 to i1
  br i1 %34, label %35, label %112

35:                                               ; preds = %31, %27, %23, %19, %3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %36 = invoke noalias noundef nonnull dereferenceable(64) ptr @_Znwm(i64 noundef 64) #8
          to label %37 unwind label %56

37:                                               ; preds = %35
  %38 = call noundef ptr @_ZNK3JPH8RefConstI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %39 = call noundef i32 @_ZNK7Surface8GetWidthEv(ptr noundef nonnull align 8 dereferenceable(48) %38)
  %40 = call noundef ptr @_ZNK3JPH8RefConstI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %41 = call noundef i32 @_ZNK7Surface9GetHeightEv(ptr noundef nonnull align 8 dereferenceable(48) %40)
  invoke void @_ZN15SoftwareSurfaceC1Eii14ESurfaceFormati(ptr noundef nonnull align 8 dereferenceable(64) %36, i32 noundef %39, i32 noundef %41, i32 noundef 13, i32 noundef 0)
          to label %42 unwind label %58

42:                                               ; preds = %37
  call void @_ZN3JPH3RefI7SurfaceEC2EPS1_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull %36)
  invoke void @_ZN3JPH8RefConstI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %0)
          to label %43 unwind label %60

43:                                               ; preds = %42
  invoke void @_ZN3JPH3RefI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %44 unwind label %62

44:                                               ; preds = %43
  %45 = invoke noundef zeroext i1 @_ZL13sConvertImageN3JPH8RefConstI7SurfaceEENS_3RefIS1_EE(ptr noundef nonnull %6, ptr noundef nonnull %7)
          to label %46 unwind label %64

46:                                               ; preds = %44
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  call void @_ZN3JPH8RefConstI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  %47 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN3JPH8RefConstI7SurfaceEaSERKNS_3RefIS1_EE(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %48 unwind label %60

48:                                               ; preds = %46
  %49 = call noundef ptr @_ZNK3JPH3RefI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %5)
  invoke void @_ZNK7Surface4LockE16ESurfaceLockMode(ptr noundef nonnull align 8 dereferenceable(48) %49, i32 noundef 3)
          to label %50 unwind label %60

50:                                               ; preds = %48
  %51 = load i8, ptr %2, align 4, !tbaa !5, !range !14, !noundef !15
  %52 = trunc nuw i8 %51 to i1
  br i1 %52, label %53, label %69

53:                                               ; preds = %50
  invoke void @_ZN3JPH3RefI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %54 unwind label %60

54:                                               ; preds = %53
  invoke void @_ZL18sConvertRGBToAlphaN3JPH3RefI7SurfaceEE(ptr noundef nonnull %8)
          to label %55 unwind label %67

55:                                               ; preds = %54
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  br label %69

56:                                               ; preds = %35
  %57 = landingpad { ptr, i32 }
          cleanup
  br label %111

58:                                               ; preds = %37
  %59 = landingpad { ptr, i32 }
          cleanup
  call void @_ZdlPvm(ptr noundef nonnull %36, i64 noundef 64) #9
  br label %111

60:                                               ; preds = %107, %100, %91, %82, %73, %53, %48, %46, %42
  %61 = landingpad { ptr, i32 }
          cleanup
  br label %110

62:                                               ; preds = %43
  %63 = landingpad { ptr, i32 }
          cleanup
  br label %66

64:                                               ; preds = %44
  %65 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  br label %66

66:                                               ; preds = %64, %62
  %.pn = phi { ptr, i32 } [ %65, %64 ], [ %63, %62 ]
  call void @_ZN3JPH8RefConstI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  br label %110

67:                                               ; preds = %54
  %68 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  br label %110

69:                                               ; preds = %55, %50
  %70 = getelementptr inbounds i8, ptr %2, i64 1
  %71 = load i8, ptr %70, align 1, !tbaa !16, !range !14, !noundef !15
  %72 = trunc nuw i8 %71 to i1
  br i1 %72, label %73, label %78

73:                                               ; preds = %69
  invoke void @_ZN3JPH3RefI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %74 unwind label %60

74:                                               ; preds = %73
  invoke void @_ZL18sConvertAlphaToRGBN3JPH3RefI7SurfaceEE(ptr noundef nonnull %9)
          to label %75 unwind label %76

75:                                               ; preds = %74
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #7
  br label %78

76:                                               ; preds = %74
  %77 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #7
  br label %110

78:                                               ; preds = %75, %69
  %79 = getelementptr inbounds i8, ptr %2, i64 2
  %80 = load i8, ptr %79, align 2, !tbaa !17, !range !14, !noundef !15
  %81 = trunc nuw i8 %80 to i1
  br i1 %81, label %82, label %87

82:                                               ; preds = %78
  invoke void @_ZN3JPH3RefI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %83 unwind label %60

83:                                               ; preds = %82
  invoke void @_ZL19sConvertToGrayScaleN3JPH3RefI7SurfaceEE(ptr noundef nonnull %10)
          to label %84 unwind label %85

84:                                               ; preds = %83
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %10) #7
  br label %87

85:                                               ; preds = %83
  %86 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %10) #7
  br label %110

87:                                               ; preds = %84, %78
  %88 = getelementptr inbounds i8, ptr %2, i64 3
  %89 = load i8, ptr %88, align 1, !tbaa !18, !range !14, !noundef !15
  %90 = trunc nuw i8 %89 to i1
  br i1 %90, label %91, label %96

91:                                               ; preds = %87
  invoke void @_ZN3JPH3RefI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %92 unwind label %60

92:                                               ; preds = %91
  invoke void @_ZL12sInvertAlphaN3JPH3RefI7SurfaceEE(ptr noundef nonnull %11)
          to label %93 unwind label %94

93:                                               ; preds = %92
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %11) #7
  br label %96

94:                                               ; preds = %92
  %95 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %11) #7
  br label %110

96:                                               ; preds = %93, %87
  %97 = getelementptr inbounds i8, ptr %2, i64 4
  %98 = load i8, ptr %97, align 4, !tbaa !19, !range !14, !noundef !15
  %99 = trunc nuw i8 %98 to i1
  br i1 %99, label %100, label %107

100:                                              ; preds = %96
  invoke void @_ZN3JPH3RefI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %101 unwind label %60

101:                                              ; preds = %100
  %102 = getelementptr inbounds i8, ptr %2, i64 8
  %.sroa.01.0.copyload = load i32, ptr %102, align 4, !tbaa !20
  %103 = getelementptr inbounds i8, ptr %2, i64 12
  %.sroa.0.0.copyload = load i32, ptr %103, align 4, !tbaa !20
  invoke void @_ZL14sColorKeyAlphaN3JPH3RefI7SurfaceEENS_5ColorES3_(ptr noundef nonnull %12, i32 %.sroa.01.0.copyload, i32 %.sroa.0.0.copyload)
          to label %104 unwind label %105

104:                                              ; preds = %101
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %12) #7
  br label %107

105:                                              ; preds = %101
  %106 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %12) #7
  br label %110

107:                                              ; preds = %104, %96
  %108 = call noundef ptr @_ZNK3JPH3RefI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %5)
  invoke void @_ZNK7Surface6UnLockEv(ptr noundef nonnull align 8 dereferenceable(48) %108)
          to label %109 unwind label %60

109:                                              ; preds = %107
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br label %112

110:                                              ; preds = %105, %94, %85, %76, %67, %66, %60
  %.pn24 = phi { ptr, i32 } [ %61, %60 ], [ %106, %105 ], [ %95, %94 ], [ %86, %85 ], [ %77, %76 ], [ %68, %67 ], [ %.pn, %66 ]
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  br label %111

111:                                              ; preds = %110, %58, %56
  %.pn24.pn = phi { ptr, i32 } [ %.pn24, %110 ], [ %59, %58 ], [ %57, %56 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br label %147

112:                                              ; preds = %109, %31
  %113 = call noundef ptr @_ZNK3JPH8RefConstI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4)
  %114 = call noundef i32 @_ZNK7Surface8GetWidthEv(ptr noundef nonnull align 8 dereferenceable(48) %113)
  %115 = call noundef ptr @_ZNK3JPH3RefI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %1)
  %116 = call noundef i32 @_ZNK7Surface8GetWidthEv(ptr noundef nonnull align 8 dereferenceable(48) %115)
  %.not = icmp eq i32 %114, %116
  br i1 %.not, label %117, label %122

117:                                              ; preds = %112
  %118 = call noundef ptr @_ZNK3JPH8RefConstI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4)
  %119 = call noundef i32 @_ZNK7Surface9GetHeightEv(ptr noundef nonnull align 8 dereferenceable(48) %118)
  %120 = call noundef ptr @_ZNK3JPH3RefI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %1)
  %121 = call noundef i32 @_ZNK7Surface9GetHeightEv(ptr noundef nonnull align 8 dereferenceable(48) %120)
  %.not27 = icmp eq i32 %119, %121
  br i1 %.not27, label %135, label %122

122:                                              ; preds = %117, %112
  invoke void @_ZN3JPH8RefConstI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %123 unwind label %128

123:                                              ; preds = %122
  invoke void @_ZN3JPH3RefI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(8) %1)
          to label %124 unwind label %130

124:                                              ; preds = %123
  %125 = getelementptr inbounds i8, ptr %2, i64 16
  %126 = invoke noundef zeroext i1 @_Z9ZoomImageN3JPH8RefConstI7SurfaceEENS_3RefIS1_EERK12ZoomSettings(ptr noundef nonnull %13, ptr noundef nonnull %14, ptr noundef nonnull align 4 dereferenceable(12) %125)
          to label %127 unwind label %132

127:                                              ; preds = %124
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %14) #7
  call void @_ZN3JPH8RefConstI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %13) #7
  br i1 %126, label %145, label %146

128:                                              ; preds = %135, %122
  %129 = landingpad { ptr, i32 }
          cleanup
  br label %147

130:                                              ; preds = %123
  %131 = landingpad { ptr, i32 }
          cleanup
  br label %134

132:                                              ; preds = %124
  %133 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %14) #7
  br label %134

134:                                              ; preds = %132, %130
  %.pn30 = phi { ptr, i32 } [ %133, %132 ], [ %131, %130 ]
  call void @_ZN3JPH8RefConstI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %13) #7
  br label %147

135:                                              ; preds = %117
  invoke void @_ZN3JPH8RefConstI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %136 unwind label %128

136:                                              ; preds = %135
  invoke void @_ZN3JPH3RefI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(8) %1)
          to label %137 unwind label %140

137:                                              ; preds = %136
  %138 = invoke noundef zeroext i1 @_ZL13sConvertImageN3JPH8RefConstI7SurfaceEENS_3RefIS1_EE(ptr noundef nonnull %15, ptr noundef nonnull %16)
          to label %139 unwind label %142

139:                                              ; preds = %137
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %16) #7
  call void @_ZN3JPH8RefConstI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %15) #7
  br i1 %138, label %145, label %146

140:                                              ; preds = %136
  %141 = landingpad { ptr, i32 }
          cleanup
  br label %144

142:                                              ; preds = %137
  %143 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %16) #7
  br label %144

144:                                              ; preds = %142, %140
  %.pn28 = phi { ptr, i32 } [ %143, %142 ], [ %141, %140 ]
  call void @_ZN3JPH8RefConstI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %15) #7
  br label %147

145:                                              ; preds = %139, %127
  br label %146

146:                                              ; preds = %139, %127, %145
  %.0 = phi i1 [ true, %145 ], [ false, %127 ], [ false, %139 ]
  call void @_ZN3JPH8RefConstI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  ret i1 %.0

147:                                              ; preds = %144, %134, %128, %111
  %.pn30.pn = phi { ptr, i32 } [ %.pn30, %134 ], [ %129, %128 ], [ %.pn28, %144 ], [ %.pn24.pn, %111 ]
  call void @_ZN3JPH8RefConstI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  resume { ptr, i32 } %.pn30.pn
}

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #3

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

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

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

declare void @_ZN15SoftwareSurfaceC1Eii14ESurfaceFormati(ptr noundef nonnull align 8 dereferenceable(64), i32 noundef, i32 noundef, i32 noundef, i32 noundef) unnamed_addr #5

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #6

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

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i1 @_ZL13sConvertImageN3JPH8RefConstI7SurfaceEENS_3RefIS1_EE(ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

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

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

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

declare void @_ZNK7Surface4LockE16ESurfaceLockMode(ptr noundef nonnull align 8 dereferenceable(48), i32 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL18sConvertRGBToAlphaN3JPH3RefI7SurfaceEE(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL18sConvertAlphaToRGBN3JPH3RefI7SurfaceEE(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL19sConvertToGrayScaleN3JPH3RefI7SurfaceEE(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL12sInvertAlphaN3JPH3RefI7SurfaceEE(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL14sColorKeyAlphaN3JPH3RefI7SurfaceEENS_5ColorES3_(ptr noundef, i32, i32) local_unnamed_addr #1

declare void @_ZNK7Surface6UnLockEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #5

declare noundef zeroext i1 @_Z9ZoomImageN3JPH8RefConstI7SurfaceEENS_3RefIS1_EERK12ZoomSettings(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nobuiltin allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint mustprogress 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 = { "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 = { nobuiltin 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 #7 = { nounwind }
attributes #8 = { builtin allocsize(0) }
attributes #9 = { builtin 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 0}
!6 = !{!"_ZTS12BlitSettings", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !10, i64 8, !10, i64 12, !11, i64 16}
!7 = !{!"bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN3JPH5ColorE", !8, i64 0}
!11 = !{!"_ZTS12ZoomSettings", !12, i64 0, !7, i64 4, !13, i64 8}
!12 = !{!"_ZTS7EFilter", !8, i64 0}
!13 = !{!"float", !8, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = !{!6, !7, i64 1}
!17 = !{!6, !7, i64 2}
!18 = !{!6, !7, i64 3}
!19 = !{!6, !7, i64 4}
!20 = !{!8, !8, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass