; LLVM IR from jrouwe/JoltPhysics :: TestFramework/Image/LoadBMP.ll (Z7SaveBMPN3JPH8RefConstI7SurfaceEERSo)

; 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.BlitSettings = type { i8, i8, i8, i8, i8, %"class.JPH::Color", %"class.JPH::Color", %class.ZoomSettings }
%"class.JPH::Color" = type { %union.anon.0 }
%union.anon.0 = type { i32 }
%class.ZoomSettings = type { i32, i8, float }
%"class.JPH::Ref" = type { ptr }
%"class.JPH::RefConst" = type { ptr }
%"struct.JPH::AssertLastParam" = type { i8 }
%struct.BitmapFileHeader = type <{ i8, i8, i32, i16, i16, i32 }>
%struct.BitmapInfoHeader = type { i32, i32, i32, i16, i16, i32, i32, i32, i32, i32, i32 }

@_ZN12BlitSettings8sDefaultE = external global %class.BlitSettings, align 4
@.str.4 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [84 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

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: mustprogress uwtable
declare noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEE4failEv(ptr noundef nonnull align 8 dereferenceable(264)) #1 align 2

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

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

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

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

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

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

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

; 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 #6 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z7SaveBMPN3JPH8RefConstI7SurfaceEERSo(ptr noundef %0, ptr noundef nonnull align 8 dereferenceable(8) %1) #1 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i8, align 1
  %6 = alloca ptr, align 8
  %7 = alloca %"class.JPH::Ref", align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %"class.JPH::RefConst", align 8
  %11 = alloca %"class.JPH::Ref", align 8
  %12 = alloca %"struct.JPH::AssertLastParam", align 1
  %13 = alloca %struct.BitmapFileHeader, align 1
  %14 = alloca %struct.BitmapInfoHeader, align 1
  %15 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #7
  store i8 1, ptr %5, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %16 = call noundef ptr @_ZNK3JPH8RefConstI7SurfaceEcvPKS1_Ev(ptr noundef nonnull align 8 dereferenceable(8) %0)
  store ptr %16, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  call void @_ZN3JPH3RefI7SurfaceEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7)
  %17 = invoke noundef ptr @_ZNK3JPH8RefConstI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %0)
          to label %18 unwind label %42

18:                                               ; preds = %2
  %19 = invoke noundef i32 @_ZNK7Surface9GetFormatEv(ptr noundef nonnull align 8 dereferenceable(48) %17)
          to label %20 unwind label %42

20:                                               ; preds = %18
  %21 = icmp ne i32 %19, 9
  br i1 %21, label %22, label %59

22:                                               ; preds = %20
  %23 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 64) #8
          to label %24 unwind label %42

24:                                               ; preds = %22
  %25 = invoke noundef ptr @_ZNK3JPH8RefConstI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %0)
          to label %26 unwind label %46

26:                                               ; preds = %24
  %27 = invoke noundef i32 @_ZNK7Surface8GetWidthEv(ptr noundef nonnull align 8 dereferenceable(48) %25)
          to label %28 unwind label %46

28:                                               ; preds = %26
  %29 = invoke noundef ptr @_ZNK3JPH8RefConstI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %0)
          to label %30 unwind label %46

30:                                               ; preds = %28
  %31 = invoke noundef i32 @_ZNK7Surface9GetHeightEv(ptr noundef nonnull align 8 dereferenceable(48) %29)
          to label %32 unwind label %46

32:                                               ; preds = %30
  invoke void @_ZN15SoftwareSurfaceC1Eii14ESurfaceFormati(ptr noundef nonnull align 8 dereferenceable(64) %23, i32 noundef %27, i32 noundef %31, i32 noundef 9, i32 noundef 0)
          to label %33 unwind label %46

33:                                               ; preds = %32
  %34 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN3JPH3RefI7SurfaceEaSEPS1_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef %23)
          to label %35 unwind label %42

35:                                               ; preds = %33
  invoke void @_ZN3JPH8RefConstI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %0)
          to label %36 unwind label %42

36:                                               ; preds = %35
  invoke void @_ZN3JPH3RefI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %37 unwind label %50

37:                                               ; preds = %36
  %38 = invoke noundef zeroext i1 @_Z11BlitSurfaceN3JPH8RefConstI7SurfaceEENS_3RefIS1_EERK12BlitSettings(ptr noundef %10, ptr noundef %11, ptr noundef nonnull align 4 dereferenceable(28) @_ZN12BlitSettings8sDefaultE)
          to label %39 unwind label %54

39:                                               ; preds = %37
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %11) #7
  call void @_ZN3JPH8RefConstI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %10) #7
  %40 = invoke noundef ptr @_ZNK3JPH3RefI7SurfaceE6GetPtrEv(ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %41 unwind label %42

41:                                               ; preds = %39
  store ptr %40, ptr %6, align 8, !tbaa !5
  br label %59

42:                                               ; preds = %68, %62, %59, %39, %35, %33, %22, %18, %2
  %43 = landingpad { ptr, i32 }
          cleanup
  %44 = extractvalue { ptr, i32 } %43, 0
  store ptr %44, ptr %8, align 8
  %45 = extractvalue { ptr, i32 } %43, 1
  store i32 %45, ptr %9, align 4
  br label %200

46:                                               ; preds = %32, %30, %28, %26, %24
  %47 = landingpad { ptr, i32 }
          cleanup
  %48 = extractvalue { ptr, i32 } %47, 0
  store ptr %48, ptr %8, align 8
  %49 = extractvalue { ptr, i32 } %47, 1
  store i32 %49, ptr %9, align 4
  call void @_ZdlPvm(ptr noundef %23, i64 noundef 64) #9
  br label %200

50:                                               ; preds = %36
  %51 = landingpad { ptr, i32 }
          cleanup
  %52 = extractvalue { ptr, i32 } %51, 0
  store ptr %52, ptr %8, align 8
  %53 = extractvalue { ptr, i32 } %51, 1
  store i32 %53, ptr %9, align 4
  br label %58

54:                                               ; preds = %37
  %55 = landingpad { ptr, i32 }
          cleanup
  %56 = extractvalue { ptr, i32 } %55, 0
  store ptr %56, ptr %8, align 8
  %57 = extractvalue { ptr, i32 } %55, 1
  store i32 %57, ptr %9, align 4
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %11) #7
  br label %58

58:                                               ; preds = %54, %50
  call void @_ZN3JPH8RefConstI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %10) #7
  br label %200

59:                                               ; preds = %41, %20
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  invoke void @_ZNK7Surface4LockE16ESurfaceLockMode(ptr noundef nonnull align 8 dereferenceable(48) %60, i32 noundef 1)
          to label %61 unwind label %42

61:                                               ; preds = %59
  br label %62

62:                                               ; preds = %61
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = invoke noundef i32 @_ZNK7Surface9GetStrideEv(ptr noundef nonnull align 8 dereferenceable(48) %63)
          to label %65 unwind label %42

65:                                               ; preds = %62
  %66 = srem i32 %64, 4
  %67 = icmp eq i32 %66, 0
  br i1 %67, label %72, label %68

68:                                               ; preds = %65
  %69 = invoke noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef @.str.4, ptr noundef @.str.5, i32 noundef 158)
          to label %70 unwind label %42

70:                                               ; preds = %68
  br i1 %69, label %71, label %72

71:                                               ; preds = %70
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #7, !srcloc !11
  br label %72

72:                                               ; preds = %71, %70, %65
  br label %73

73:                                               ; preds = %72
  br label %74

74:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 14, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 40, ptr %14) #7
  %75 = getelementptr inbounds %struct.BitmapFileHeader, ptr %13, i32 0, i32 0
  store i8 66, ptr %75, align 1, !tbaa !12
  %76 = getelementptr inbounds %struct.BitmapFileHeader, ptr %13, i32 0, i32 1
  store i8 77, ptr %76, align 1, !tbaa !16
  %77 = load ptr, ptr %6, align 8, !tbaa !5
  %78 = invoke noundef i32 @_ZNK7Surface9GetHeightEv(ptr noundef nonnull align 8 dereferenceable(48) %77)
          to label %79 unwind label %157

79:                                               ; preds = %74
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  %81 = invoke noundef i32 @_ZNK7Surface9GetStrideEv(ptr noundef nonnull align 8 dereferenceable(48) %80)
          to label %82 unwind label %157

82:                                               ; preds = %79
  %83 = mul nsw i32 %78, %81
  %84 = sext i32 %83 to i64
  %85 = add i64 54, %84
  %86 = trunc i64 %85 to i32
  %87 = getelementptr inbounds %struct.BitmapFileHeader, ptr %13, i32 0, i32 2
  store i32 %86, ptr %87, align 1, !tbaa !17
  %88 = getelementptr inbounds %struct.BitmapFileHeader, ptr %13, i32 0, i32 3
  store i16 0, ptr %88, align 1, !tbaa !18
  %89 = getelementptr inbounds %struct.BitmapFileHeader, ptr %13, i32 0, i32 4
  store i16 0, ptr %89, align 1, !tbaa !19
  %90 = getelementptr inbounds %struct.BitmapFileHeader, ptr %13, i32 0, i32 5
  store i32 54, ptr %90, align 1, !tbaa !20
  %91 = getelementptr inbounds %struct.BitmapInfoHeader, ptr %14, i32 0, i32 0
  store i32 40, ptr %91, align 1, !tbaa !21
  %92 = load ptr, ptr %6, align 8, !tbaa !5
  %93 = invoke noundef i32 @_ZNK7Surface8GetWidthEv(ptr noundef nonnull align 8 dereferenceable(48) %92)
          to label %94 unwind label %157

94:                                               ; preds = %82
  %95 = getelementptr inbounds %struct.BitmapInfoHeader, ptr %14, i32 0, i32 1
  store i32 %93, ptr %95, align 1, !tbaa !23
  %96 = load ptr, ptr %6, align 8, !tbaa !5
  %97 = invoke noundef i32 @_ZNK7Surface9GetHeightEv(ptr noundef nonnull align 8 dereferenceable(48) %96)
          to label %98 unwind label %157

98:                                               ; preds = %94
  %99 = getelementptr inbounds %struct.BitmapInfoHeader, ptr %14, i32 0, i32 2
  store i32 %97, ptr %99, align 1, !tbaa !24
  %100 = getelementptr inbounds %struct.BitmapInfoHeader, ptr %14, i32 0, i32 3
  store i16 1, ptr %100, align 1, !tbaa !25
  %101 = getelementptr inbounds %struct.BitmapInfoHeader, ptr %14, i32 0, i32 4
  store i16 24, ptr %101, align 1, !tbaa !26
  %102 = getelementptr inbounds %struct.BitmapInfoHeader, ptr %14, i32 0, i32 5
  store i32 0, ptr %102, align 1, !tbaa !27
  %103 = load ptr, ptr %6, align 8, !tbaa !5
  %104 = invoke noundef i32 @_ZNK7Surface9GetHeightEv(ptr noundef nonnull align 8 dereferenceable(48) %103)
          to label %105 unwind label %157

105:                                              ; preds = %98
  %106 = load ptr, ptr %6, align 8, !tbaa !5
  %107 = invoke noundef i32 @_ZNK7Surface9GetStrideEv(ptr noundef nonnull align 8 dereferenceable(48) %106)
          to label %108 unwind label %157

108:                                              ; preds = %105
  %109 = mul nsw i32 %104, %107
  %110 = getelementptr inbounds %struct.BitmapInfoHeader, ptr %14, i32 0, i32 6
  store i32 %109, ptr %110, align 1, !tbaa !28
  %111 = getelementptr inbounds %struct.BitmapInfoHeader, ptr %14, i32 0, i32 7
  store i32 300, ptr %111, align 1, !tbaa !29
  %112 = getelementptr inbounds %struct.BitmapInfoHeader, ptr %14, i32 0, i32 8
  store i32 300, ptr %112, align 1, !tbaa !30
  %113 = getelementptr inbounds %struct.BitmapInfoHeader, ptr %14, i32 0, i32 9
  store i32 0, ptr %113, align 1, !tbaa !31
  %114 = getelementptr inbounds %struct.BitmapInfoHeader, ptr %14, i32 0, i32 10
  store i32 0, ptr %114, align 1, !tbaa !32
  %115 = load ptr, ptr %4, align 8, !tbaa !5
  %116 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5writeEPKcl(ptr noundef nonnull align 8 dereferenceable(8) %115, ptr noundef %13, i64 noundef 14)
          to label %117 unwind label %157

117:                                              ; preds = %108
  %118 = load i8, ptr %5, align 1, !tbaa !9, !range !33, !noundef !34
  %119 = trunc i8 %118 to i1
  br i1 %119, label %120, label %129

120:                                              ; preds = %117
  %121 = load ptr, ptr %4, align 8, !tbaa !5
  %122 = load ptr, ptr %121, align 8, !tbaa !35
  %123 = getelementptr i8, ptr %122, i64 -24
  %124 = load i64, ptr %123, align 8
  %125 = getelementptr inbounds i8, ptr %121, i64 %124
  %126 = invoke noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEE4failEv(ptr noundef nonnull align 8 dereferenceable(264) %125)
          to label %127 unwind label %157

127:                                              ; preds = %120
  %128 = xor i1 %126, true
  br label %129

129:                                              ; preds = %127, %117
  %130 = phi i1 [ false, %117 ], [ %128, %127 ]
  %131 = zext i1 %130 to i8
  store i8 %131, ptr %5, align 1, !tbaa !9
  %132 = load ptr, ptr %4, align 8, !tbaa !5
  %133 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5writeEPKcl(ptr noundef nonnull align 8 dereferenceable(8) %132, ptr noundef %14, i64 noundef 40)
          to label %134 unwind label %157

134:                                              ; preds = %129
  %135 = load i8, ptr %5, align 1, !tbaa !9, !range !33, !noundef !34
  %136 = trunc i8 %135 to i1
  br i1 %136, label %137, label %146

137:                                              ; preds = %134
  %138 = load ptr, ptr %4, align 8, !tbaa !5
  %139 = load ptr, ptr %138, align 8, !tbaa !35
  %140 = getelementptr i8, ptr %139, i64 -24
  %141 = load i64, ptr %140, align 8
  %142 = getelementptr inbounds i8, ptr %138, i64 %141
  %143 = invoke noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEE4failEv(ptr noundef nonnull align 8 dereferenceable(264) %142)
          to label %144 unwind label %157

144:                                              ; preds = %137
  %145 = xor i1 %143, true
  br label %146

146:                                              ; preds = %144, %134
  %147 = phi i1 [ false, %134 ], [ %145, %144 ]
  %148 = zext i1 %147 to i8
  store i8 %148, ptr %5, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %149 = load ptr, ptr %6, align 8, !tbaa !5
  %150 = invoke noundef i32 @_ZNK7Surface9GetHeightEv(ptr noundef nonnull align 8 dereferenceable(48) %149)
          to label %151 unwind label %161

151:                                              ; preds = %146
  %152 = sub nsw i32 %150, 1
  store i32 %152, ptr %15, align 4, !tbaa !37
  br label %153

153:                                              ; preds = %191, %151
  %154 = load i32, ptr %15, align 4, !tbaa !37
  %155 = icmp sge i32 %154, 0
  br i1 %155, label %165, label %156

156:                                              ; preds = %153
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %194

157:                                              ; preds = %194, %137, %129, %120, %108, %105, %98, %94, %82, %79, %74
  %158 = landingpad { ptr, i32 }
          cleanup
  %159 = extractvalue { ptr, i32 } %158, 0
  store ptr %159, ptr %8, align 8
  %160 = extractvalue { ptr, i32 } %158, 1
  store i32 %160, ptr %9, align 4
  br label %199

161:                                              ; preds = %179, %173, %170, %165, %146
  %162 = landingpad { ptr, i32 }
          cleanup
  %163 = extractvalue { ptr, i32 } %162, 0
  store ptr %163, ptr %8, align 8
  %164 = extractvalue { ptr, i32 } %162, 1
  store i32 %164, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %199

165:                                              ; preds = %153
  %166 = load ptr, ptr %4, align 8, !tbaa !5
  %167 = load ptr, ptr %6, align 8, !tbaa !5
  %168 = load i32, ptr %15, align 4, !tbaa !37
  %169 = invoke noundef ptr @_ZNK7Surface11GetScanLineEi(ptr noundef nonnull align 8 dereferenceable(48) %167, i32 noundef %168)
          to label %170 unwind label %161

170:                                              ; preds = %165
  %171 = load ptr, ptr %6, align 8, !tbaa !5
  %172 = invoke noundef i32 @_ZNK7Surface9GetStrideEv(ptr noundef nonnull align 8 dereferenceable(48) %171)
          to label %173 unwind label %161

173:                                              ; preds = %170
  %174 = sext i32 %172 to i64
  %175 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5writeEPKcl(ptr noundef nonnull align 8 dereferenceable(8) %166, ptr noundef %169, i64 noundef %174)
          to label %176 unwind label %161

176:                                              ; preds = %173
  %177 = load i8, ptr %5, align 1, !tbaa !9, !range !33, !noundef !34
  %178 = trunc i8 %177 to i1
  br i1 %178, label %179, label %188

179:                                              ; preds = %176
  %180 = load ptr, ptr %4, align 8, !tbaa !5
  %181 = load ptr, ptr %180, align 8, !tbaa !35
  %182 = getelementptr i8, ptr %181, i64 -24
  %183 = load i64, ptr %182, align 8
  %184 = getelementptr inbounds i8, ptr %180, i64 %183
  %185 = invoke noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEE4failEv(ptr noundef nonnull align 8 dereferenceable(264) %184)
          to label %186 unwind label %161

186:                                              ; preds = %179
  %187 = xor i1 %185, true
  br label %188

188:                                              ; preds = %186, %176
  %189 = phi i1 [ false, %176 ], [ %187, %186 ]
  %190 = zext i1 %189 to i8
  store i8 %190, ptr %5, align 1, !tbaa !9
  br label %191

191:                                              ; preds = %188
  %192 = load i32, ptr %15, align 4, !tbaa !37
  %193 = add nsw i32 %192, -1
  store i32 %193, ptr %15, align 4, !tbaa !37
  br label %153, !llvm.loop !38

194:                                              ; preds = %156
  %195 = load ptr, ptr %6, align 8, !tbaa !5
  invoke void @_ZNK7Surface6UnLockEv(ptr noundef nonnull align 8 dereferenceable(48) %195)
          to label %196 unwind label %157

196:                                              ; preds = %194
  %197 = load i8, ptr %5, align 1, !tbaa !9, !range !33, !noundef !34
  %198 = trunc i8 %197 to i1
  call void @llvm.lifetime.end.p0(i64 40, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 14, ptr %13) #7
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #7
  ret i1 %198

199:                                              ; preds = %161, %157
  call void @llvm.lifetime.end.p0(i64 40, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 14, ptr %13) #7
  br label %200

200:                                              ; preds = %199, %58, %46, %42
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #7
  br label %201

201:                                              ; preds = %200
  %202 = load ptr, ptr %8, align 8
  %203 = load i32, ptr %9, align 4
  %204 = insertvalue { ptr, i32 } poison, ptr %202, 0
  %205 = insertvalue { ptr, i32 } %204, i32 %203, 1
  resume { ptr, i32 } %205
}

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

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

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

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

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

declare noundef zeroext i1 @_Z11BlitSurfaceN3JPH8RefConstI7SurfaceEENS_3RefIS1_EERK12BlitSettings(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(28)) #4

; 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 #6 align 2

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef, ptr noundef, i32 noundef) #6

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5writeEPKcl(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i64 noundef) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZNK7Surface11GetScanLineEi(ptr noundef nonnull align 8 dereferenceable(48), i32 noundef) #6 align 2

attributes #0 = { 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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { "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 = { 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 #6 = { 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 #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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{i64 2157433545}
!12 = !{!13, !7, i64 0}
!13 = !{!"_ZTS16BitmapFileHeader", !7, i64 0, !7, i64 1, !14, i64 2, !15, i64 6, !15, i64 8, !14, i64 10}
!14 = !{!"int", !7, i64 0}
!15 = !{!"short", !7, i64 0}
!16 = !{!13, !7, i64 1}
!17 = !{!13, !14, i64 2}
!18 = !{!13, !15, i64 6}
!19 = !{!13, !15, i64 8}
!20 = !{!13, !14, i64 10}
!21 = !{!22, !14, i64 0}
!22 = !{!"_ZTS16BitmapInfoHeader", !14, i64 0, !14, i64 4, !14, i64 8, !15, i64 12, !15, i64 14, !14, i64 16, !14, i64 20, !14, i64 24, !14, i64 28, !14, i64 32, !14, i64 36}
!23 = !{!22, !14, i64 4}
!24 = !{!22, !14, i64 8}
!25 = !{!22, !15, i64 12}
!26 = !{!22, !15, i64 14}
!27 = !{!22, !14, i64 16}
!28 = !{!22, !14, i64 20}
!29 = !{!22, !14, i64 24}
!30 = !{!22, !14, i64 28}
!31 = !{!22, !14, i64 32}
!32 = !{!22, !14, i64 36}
!33 = !{i8 0, i8 2}
!34 = !{}
!35 = !{!36, !36, i64 0}
!36 = !{!"vtable pointer", !8, i64 0}
!37 = !{!14, !14, i64 0}
!38 = distinct !{!38, !39}
!39 = !{!"llvm.loop.mustprogress"}


; 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.BlitSettings = type { i8, i8, i8, i8, i8, %"class.JPH::Color", %"class.JPH::Color", %class.ZoomSettings }
%"class.JPH::Color" = type { %union.anon.0 }
%union.anon.0 = type { i32 }
%class.ZoomSettings = type { i32, i8, float }
%"class.JPH::Ref" = type { ptr }
%"class.JPH::RefConst" = type { ptr }
%struct.BitmapFileHeader = type <{ i8, i8, i32, i16, i16, i32 }>
%struct.BitmapInfoHeader = type { i32, i32, i32, i16, i16, i32, i32, i32, i32, i32, i32 }

@_ZN12BlitSettings8sDefaultE = external global %class.BlitSettings, align 4
@.str.4 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [84 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

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
declare noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEE4failEv(ptr noundef nonnull align 8 dereferenceable(264)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH3RefI7SurfaceEC2Ev(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

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

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

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

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

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

; 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 #6 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z7SaveBMPN3JPH8RefConstI7SurfaceEERSo(ptr noundef nonnull %0, ptr noundef nonnull align 8 dereferenceable(8) %1) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.JPH::Ref", align 8
  %4 = alloca %"class.JPH::RefConst", align 8
  %5 = alloca %"class.JPH::Ref", align 8
  %6 = alloca %struct.BitmapFileHeader, align 1
  %7 = alloca %struct.BitmapInfoHeader, align 4
  %8 = tail call noundef ptr @_ZNK3JPH8RefConstI7SurfaceEcvPKS1_Ev(ptr noundef nonnull align 8 dereferenceable(8) %0)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  call void @_ZN3JPH3RefI7SurfaceEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3)
  %9 = call noundef ptr @_ZNK3JPH8RefConstI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %10 = call noundef i32 @_ZNK7Surface9GetFormatEv(ptr noundef nonnull align 8 dereferenceable(48) %9)
  %.not = icmp eq i32 %10, 9
  br i1 %.not, label %35, label %11

11:                                               ; preds = %2
  %12 = invoke noalias noundef nonnull dereferenceable(64) ptr @_Znwm(i64 noundef 64) #8
          to label %13 unwind label %26

13:                                               ; preds = %11
  %14 = call noundef ptr @_ZNK3JPH8RefConstI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %15 = call noundef i32 @_ZNK7Surface8GetWidthEv(ptr noundef nonnull align 8 dereferenceable(48) %14)
  %16 = call noundef ptr @_ZNK3JPH8RefConstI7SurfaceEptEv(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %17 = call noundef i32 @_ZNK7Surface9GetHeightEv(ptr noundef nonnull align 8 dereferenceable(48) %16)
  invoke void @_ZN15SoftwareSurfaceC1Eii14ESurfaceFormati(ptr noundef nonnull align 8 dereferenceable(64) %12, i32 noundef %15, i32 noundef %17, i32 noundef 9, i32 noundef 0)
          to label %18 unwind label %28

18:                                               ; preds = %13
  %19 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN3JPH3RefI7SurfaceEaSEPS1_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull %12)
          to label %20 unwind label %26

20:                                               ; preds = %18
  invoke void @_ZN3JPH8RefConstI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %0)
          to label %21 unwind label %26

21:                                               ; preds = %20
  invoke void @_ZN3JPH3RefI7SurfaceEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %22 unwind label %30

22:                                               ; preds = %21
  %23 = invoke noundef zeroext i1 @_Z11BlitSurfaceN3JPH8RefConstI7SurfaceEENS_3RefIS1_EERK12BlitSettings(ptr noundef nonnull %4, ptr noundef nonnull %5, ptr noundef nonnull align 4 dereferenceable(28) @_ZN12BlitSettings8sDefaultE)
          to label %24 unwind label %32

24:                                               ; preds = %22
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  call void @_ZN3JPH8RefConstI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  %25 = call noundef ptr @_ZNK3JPH3RefI7SurfaceE6GetPtrEv(ptr noundef nonnull align 8 dereferenceable(8) %3)
  br label %35

26:                                               ; preds = %41, %36, %35, %20, %18, %11
  %27 = landingpad { ptr, i32 }
          cleanup
  br label %115

28:                                               ; preds = %13
  %29 = landingpad { ptr, i32 }
          cleanup
  call void @_ZdlPvm(ptr noundef nonnull %12, i64 noundef 64) #9
  br label %115

30:                                               ; preds = %21
  %31 = landingpad { ptr, i32 }
          cleanup
  br label %34

32:                                               ; preds = %22
  %33 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  br label %34

34:                                               ; preds = %32, %30
  %.pn = phi { ptr, i32 } [ %33, %32 ], [ %31, %30 ]
  call void @_ZN3JPH8RefConstI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  br label %115

35:                                               ; preds = %24, %2
  %.030 = phi ptr [ %25, %24 ], [ %8, %2 ]
  invoke void @_ZNK7Surface4LockE16ESurfaceLockMode(ptr noundef nonnull align 8 dereferenceable(48) %.030, i32 noundef 1)
          to label %36 unwind label %26

36:                                               ; preds = %35
  %37 = invoke noundef i32 @_ZNK7Surface9GetStrideEv(ptr noundef nonnull align 8 dereferenceable(48) %.030)
          to label %38 unwind label %26

38:                                               ; preds = %36
  %39 = and i32 %37, 3
  %40 = icmp eq i32 %39, 0
  br i1 %40, label %45, label %41

41:                                               ; preds = %38
  %42 = invoke noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.5, i32 noundef 158)
          to label %43 unwind label %26

43:                                               ; preds = %41
  br i1 %42, label %44, label %45

44:                                               ; preds = %43
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #7, !srcloc !5
  br label %45

45:                                               ; preds = %44, %43, %38
  call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %7) #7
  store i8 66, ptr %6, align 1, !tbaa !6
  %46 = getelementptr inbounds i8, ptr %6, i64 1
  store i8 77, ptr %46, align 1, !tbaa !12
  %47 = call noundef i32 @_ZNK7Surface9GetHeightEv(ptr noundef nonnull align 8 dereferenceable(48) %.030)
  %48 = invoke noundef i32 @_ZNK7Surface9GetStrideEv(ptr noundef nonnull align 8 dereferenceable(48) %.030)
          to label %49 unwind label %91

49:                                               ; preds = %45
  %50 = mul nsw i32 %48, %47
  %51 = add i32 %50, 54
  %52 = getelementptr inbounds i8, ptr %6, i64 2
  store i32 %51, ptr %52, align 1, !tbaa !13
  %53 = getelementptr inbounds i8, ptr %6, i64 6
  store i16 0, ptr %53, align 1, !tbaa !14
  %54 = getelementptr inbounds i8, ptr %6, i64 8
  store i16 0, ptr %54, align 1, !tbaa !15
  %55 = getelementptr inbounds i8, ptr %6, i64 10
  store i32 54, ptr %55, align 1, !tbaa !16
  store i32 40, ptr %7, align 4, !tbaa !17
  %56 = call noundef i32 @_ZNK7Surface8GetWidthEv(ptr noundef nonnull align 8 dereferenceable(48) %.030)
  %57 = getelementptr inbounds i8, ptr %7, i64 4
  store i32 %56, ptr %57, align 4, !tbaa !19
  %58 = call noundef i32 @_ZNK7Surface9GetHeightEv(ptr noundef nonnull align 8 dereferenceable(48) %.030)
  %59 = getelementptr inbounds i8, ptr %7, i64 8
  store i32 %58, ptr %59, align 4, !tbaa !20
  %60 = getelementptr inbounds i8, ptr %7, i64 12
  store i16 1, ptr %60, align 4, !tbaa !21
  %61 = getelementptr inbounds i8, ptr %7, i64 14
  store i16 24, ptr %61, align 2, !tbaa !22
  %62 = getelementptr inbounds i8, ptr %7, i64 16
  store i32 0, ptr %62, align 4, !tbaa !23
  %63 = call noundef i32 @_ZNK7Surface9GetHeightEv(ptr noundef nonnull align 8 dereferenceable(48) %.030)
  %64 = invoke noundef i32 @_ZNK7Surface9GetStrideEv(ptr noundef nonnull align 8 dereferenceable(48) %.030)
          to label %65 unwind label %91

65:                                               ; preds = %49
  %66 = mul nsw i32 %64, %63
  %67 = getelementptr inbounds i8, ptr %7, i64 20
  store i32 %66, ptr %67, align 4, !tbaa !24
  %68 = getelementptr inbounds i8, ptr %7, i64 24
  store <4 x i32> <i32 300, i32 300, i32 0, i32 0>, ptr %68, align 4, !tbaa !25
  %69 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5writeEPKcl(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull %6, i64 noundef 14)
          to label %70 unwind label %91

70:                                               ; preds = %65
  %71 = load ptr, ptr %1, align 8, !tbaa !26
  %72 = getelementptr i8, ptr %71, i64 -24
  %73 = load i64, ptr %72, align 8
  %74 = getelementptr inbounds i8, ptr %1, i64 %73
  %75 = invoke noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEE4failEv(ptr noundef nonnull align 8 dereferenceable(264) %74)
          to label %76 unwind label %91

76:                                               ; preds = %70
  %77 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5writeEPKcl(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull %7, i64 noundef 40)
          to label %78 unwind label %91

78:                                               ; preds = %76
  br i1 %75, label %87, label %79

79:                                               ; preds = %78
  %80 = load ptr, ptr %1, align 8, !tbaa !26
  %81 = getelementptr i8, ptr %80, i64 -24
  %82 = load i64, ptr %81, align 8
  %83 = getelementptr inbounds i8, ptr %1, i64 %82
  %84 = invoke noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEE4failEv(ptr noundef nonnull align 8 dereferenceable(264) %83)
          to label %85 unwind label %91

85:                                               ; preds = %79
  %86 = xor i1 %84, true
  br label %87

87:                                               ; preds = %85, %78
  %88 = phi i1 [ false, %78 ], [ %86, %85 ]
  %89 = call noundef i32 @_ZNK7Surface9GetHeightEv(ptr noundef nonnull align 8 dereferenceable(48) %.030)
  %90 = icmp sgt i32 %89, 0
  br i1 %90, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %110, %87
  %.031.lcssa = phi i1 [ %88, %87 ], [ %111, %110 ]
  invoke void @_ZNK7Surface6UnLockEv(ptr noundef nonnull align 8 dereferenceable(48) %.030)
          to label %113 unwind label %91

91:                                               ; preds = %._crit_edge, %79, %76, %70, %65, %49, %45
  %92 = landingpad { ptr, i32 }
          cleanup
  br label %114

93:                                               ; preds = %102, %98, %96, %.lr.ph
  %94 = landingpad { ptr, i32 }
          cleanup
  br label %114

.lr.ph:                                           ; preds = %87, %110
  %.039.in = phi i32 [ %.039, %110 ], [ %89, %87 ]
  %.03138 = phi i1 [ %111, %110 ], [ %88, %87 ]
  %.039 = add nsw i32 %.039.in, -1
  %95 = invoke noundef ptr @_ZNK7Surface11GetScanLineEi(ptr noundef nonnull align 8 dereferenceable(48) %.030, i32 noundef %.039)
          to label %96 unwind label %93

96:                                               ; preds = %.lr.ph
  %97 = invoke noundef i32 @_ZNK7Surface9GetStrideEv(ptr noundef nonnull align 8 dereferenceable(48) %.030)
          to label %98 unwind label %93

98:                                               ; preds = %96
  %99 = sext i32 %97 to i64
  %100 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5writeEPKcl(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef %95, i64 noundef %99)
          to label %101 unwind label %93

101:                                              ; preds = %98
  br i1 %.03138, label %102, label %110

102:                                              ; preds = %101
  %103 = load ptr, ptr %1, align 8, !tbaa !26
  %104 = getelementptr i8, ptr %103, i64 -24
  %105 = load i64, ptr %104, align 8
  %106 = getelementptr inbounds i8, ptr %1, i64 %105
  %107 = invoke noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEE4failEv(ptr noundef nonnull align 8 dereferenceable(264) %106)
          to label %108 unwind label %93

108:                                              ; preds = %102
  %109 = xor i1 %107, true
  br label %110

110:                                              ; preds = %108, %101
  %111 = phi i1 [ false, %101 ], [ %109, %108 ]
  %112 = icmp ugt i32 %.039.in, 1
  br i1 %112, label %.lr.ph, label %._crit_edge, !llvm.loop !28

113:                                              ; preds = %._crit_edge
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %6) #7
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  ret i1 %.031.lcssa

114:                                              ; preds = %93, %91
  %.pn33 = phi { ptr, i32 } [ %94, %93 ], [ %92, %91 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %6) #7
  br label %115

115:                                              ; preds = %114, %34, %28, %26
  %.pn33.pn = phi { ptr, i32 } [ %.pn33, %114 ], [ %27, %26 ], [ %.pn, %34 ], [ %29, %28 ]
  call void @_ZN3JPH3RefI7SurfaceED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  resume { ptr, i32 } %.pn33.pn
}

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

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

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

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

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

declare noundef zeroext i1 @_Z11BlitSurfaceN3JPH8RefConstI7SurfaceEENS_3RefIS1_EERK12BlitSettings(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(28)) local_unnamed_addr #4

; 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 #6 align 2

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #6

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5writeEPKcl(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i64 noundef) local_unnamed_addr #4

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

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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { "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 = { 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 #6 = { 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 #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 = !{i64 2157433545}
!6 = !{!7, !8, i64 0}
!7 = !{!"_ZTS16BitmapFileHeader", !8, i64 0, !8, i64 1, !10, i64 2, !11, i64 6, !11, i64 8, !10, i64 10}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"short", !8, i64 0}
!12 = !{!7, !8, i64 1}
!13 = !{!7, !10, i64 2}
!14 = !{!7, !11, i64 6}
!15 = !{!7, !11, i64 8}
!16 = !{!7, !10, i64 10}
!17 = !{!18, !10, i64 0}
!18 = !{!"_ZTS16BitmapInfoHeader", !10, i64 0, !10, i64 4, !10, i64 8, !11, i64 12, !11, i64 14, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36}
!19 = !{!18, !10, i64 4}
!20 = !{!18, !10, i64 8}
!21 = !{!18, !11, i64 12}
!22 = !{!18, !11, i64 14}
!23 = !{!18, !10, i64 16}
!24 = !{!18, !10, i64 20}
!25 = !{!10, !10, i64 0}
!26 = !{!27, !27, i64 0}
!27 = !{!"vtable pointer", !9, i64 0}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}


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