; LLVM IR from mackorone/mms :: old/v2/src/lib/tdogl/Bitmap.ll (ZN5tdogl6Bitmap18copyRectFromBitmapERKS0_jjjjjj)

; 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.tdogl::Bitmap" = type { i32, i32, i32, ptr }

@_ZTISt13runtime_error = external constant ptr
@.str.3 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [76 x i8], align 1

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

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

declare ptr @__cxa_allocate_exception(i64)

declare void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #1

declare i32 @__gxx_personality_v0(...)

declare void @__cxa_free_exception(ptr)

; Function Attrs: nounwind
declare void @_ZNSt13runtime_errorD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2

declare void @__cxa_throw(ptr, ptr, ptr)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK5tdogl6Bitmap5widthEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK5tdogl6Bitmap6heightEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z14GetPixelOffsetjjjjN5tdogl6Bitmap6FormatE(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #4

; 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) #5

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5tdogl6Bitmap18copyRectFromBitmapERKS0_jjjjjj(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, i32 noundef %7) #6 align 2 personality ptr @__gxx_personality_v0 {
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  %24 = alloca ptr, align 8
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store i32 %2, ptr %11, align 4, !tbaa !9
  store i32 %3, ptr %12, align 4, !tbaa !9
  store i32 %4, ptr %13, align 4, !tbaa !9
  store i32 %5, ptr %14, align 4, !tbaa !9
  store i32 %6, ptr %15, align 4, !tbaa !9
  store i32 %7, ptr %16, align 4, !tbaa !9
  %25 = load ptr, ptr %9, align 8
  %26 = load i32, ptr %11, align 4, !tbaa !9
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %28, label %42

28:                                               ; preds = %8
  %29 = load i32, ptr %12, align 4, !tbaa !9
  %30 = icmp eq i32 %29, 0
  br i1 %30, label %31, label %42

31:                                               ; preds = %28
  %32 = load i32, ptr %15, align 4, !tbaa !9
  %33 = icmp eq i32 %32, 0
  br i1 %33, label %34, label %42

34:                                               ; preds = %31
  %35 = load i32, ptr %16, align 4, !tbaa !9
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %37, label %42

37:                                               ; preds = %34
  %38 = load ptr, ptr %10, align 8, !tbaa !5
  %39 = call noundef i32 @_ZNK5tdogl6Bitmap5widthEv(ptr noundef nonnull align 8 dereferenceable(24) %38)
  store i32 %39, ptr %15, align 4, !tbaa !9
  %40 = load ptr, ptr %10, align 8, !tbaa !5
  %41 = call noundef i32 @_ZNK5tdogl6Bitmap6heightEv(ptr noundef nonnull align 8 dereferenceable(24) %40)
  store i32 %41, ptr %16, align 4, !tbaa !9
  br label %42

42:                                               ; preds = %37, %34, %31, %28, %8
  %43 = load i32, ptr %15, align 4, !tbaa !9
  %44 = icmp eq i32 %43, 0
  br i1 %44, label %48, label %45

45:                                               ; preds = %42
  %46 = load i32, ptr %16, align 4, !tbaa !9
  %47 = icmp eq i32 %46, 0
  br i1 %47, label %48, label %55

48:                                               ; preds = %45, %42
  %49 = call ptr @__cxa_allocate_exception(i64 16) #7
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %49, ptr noundef @.str.3)
          to label %50 unwind label %51

50:                                               ; preds = %48
  call void @__cxa_throw(ptr %49, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #8
  unreachable

51:                                               ; preds = %48
  %52 = landingpad { ptr, i32 }
          cleanup
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %17, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %18, align 4
  call void @__cxa_free_exception(ptr %49) #7
  br label %205

55:                                               ; preds = %45
  %56 = load i32, ptr %11, align 4, !tbaa !9
  %57 = load i32, ptr %15, align 4, !tbaa !9
  %58 = add i32 %56, %57
  %59 = load ptr, ptr %10, align 8, !tbaa !5
  %60 = call noundef i32 @_ZNK5tdogl6Bitmap5widthEv(ptr noundef nonnull align 8 dereferenceable(24) %59)
  %61 = icmp uge i32 %58, %60
  br i1 %61, label %69, label %62

62:                                               ; preds = %55
  %63 = load i32, ptr %12, align 4, !tbaa !9
  %64 = load i32, ptr %16, align 4, !tbaa !9
  %65 = add i32 %63, %64
  %66 = load ptr, ptr %10, align 8, !tbaa !5
  %67 = call noundef i32 @_ZNK5tdogl6Bitmap6heightEv(ptr noundef nonnull align 8 dereferenceable(24) %66)
  %68 = icmp uge i32 %65, %67
  br i1 %68, label %69, label %76

69:                                               ; preds = %62, %55
  %70 = call ptr @__cxa_allocate_exception(i64 16) #7
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %70, ptr noundef @.str.4)
          to label %71 unwind label %72

71:                                               ; preds = %69
  call void @__cxa_throw(ptr %70, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #8
  unreachable

72:                                               ; preds = %69
  %73 = landingpad { ptr, i32 }
          cleanup
  %74 = extractvalue { ptr, i32 } %73, 0
  store ptr %74, ptr %17, align 8
  %75 = extractvalue { ptr, i32 } %73, 1
  store i32 %75, ptr %18, align 4
  call void @__cxa_free_exception(ptr %70) #7
  br label %205

76:                                               ; preds = %62
  %77 = load i32, ptr %13, align 4, !tbaa !9
  %78 = load i32, ptr %15, align 4, !tbaa !9
  %79 = add i32 %77, %78
  %80 = getelementptr inbounds %"class.tdogl::Bitmap", ptr %25, i32 0, i32 1
  %81 = load i32, ptr %80, align 4, !tbaa !11
  %82 = icmp uge i32 %79, %81
  br i1 %82, label %90, label %83

83:                                               ; preds = %76
  %84 = load i32, ptr %14, align 4, !tbaa !9
  %85 = load i32, ptr %16, align 4, !tbaa !9
  %86 = add i32 %84, %85
  %87 = getelementptr inbounds %"class.tdogl::Bitmap", ptr %25, i32 0, i32 2
  %88 = load i32, ptr %87, align 8, !tbaa !14
  %89 = icmp uge i32 %86, %88
  br i1 %89, label %90, label %97

90:                                               ; preds = %83, %76
  %91 = call ptr @__cxa_allocate_exception(i64 16) #7
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %91, ptr noundef @.str.5)
          to label %92 unwind label %93

92:                                               ; preds = %90
  call void @__cxa_throw(ptr %91, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #8
  unreachable

93:                                               ; preds = %90
  %94 = landingpad { ptr, i32 }
          cleanup
  %95 = extractvalue { ptr, i32 } %94, 0
  store ptr %95, ptr %17, align 8
  %96 = extractvalue { ptr, i32 } %94, 1
  store i32 %96, ptr %18, align 4
  call void @__cxa_free_exception(ptr %91) #7
  br label %205

97:                                               ; preds = %83
  %98 = getelementptr inbounds %"class.tdogl::Bitmap", ptr %25, i32 0, i32 3
  %99 = load ptr, ptr %98, align 8, !tbaa !15
  %100 = load ptr, ptr %10, align 8, !tbaa !5
  %101 = getelementptr inbounds %"class.tdogl::Bitmap", ptr %100, i32 0, i32 3
  %102 = load ptr, ptr %101, align 8, !tbaa !15
  %103 = icmp eq ptr %99, %102
  br i1 %103, label %104, label %119

104:                                              ; preds = %97
  %105 = load i32, ptr %11, align 4, !tbaa !9
  %106 = load i32, ptr %12, align 4, !tbaa !9
  %107 = load i32, ptr %13, align 4, !tbaa !9
  %108 = load i32, ptr %14, align 4, !tbaa !9
  %109 = load i32, ptr %15, align 4, !tbaa !9
  %110 = load i32, ptr %16, align 4, !tbaa !9
  %111 = call noundef zeroext i1 @_Z12RectsOverlapjjjjjj(i32 noundef %105, i32 noundef %106, i32 noundef %107, i32 noundef %108, i32 noundef %109, i32 noundef %110)
  br i1 %111, label %112, label %119

112:                                              ; preds = %104
  %113 = call ptr @__cxa_allocate_exception(i64 16) #7
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %113, ptr noundef @.str.6)
          to label %114 unwind label %115

114:                                              ; preds = %112
  call void @__cxa_throw(ptr %113, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #8
  unreachable

115:                                              ; preds = %112
  %116 = landingpad { ptr, i32 }
          cleanup
  %117 = extractvalue { ptr, i32 } %116, 0
  store ptr %117, ptr %17, align 8
  %118 = extractvalue { ptr, i32 } %116, 1
  store i32 %118, ptr %18, align 4
  call void @__cxa_free_exception(ptr %113) #7
  br label %205

119:                                              ; preds = %104, %97
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  store ptr null, ptr %19, align 8, !tbaa !5
  %120 = getelementptr inbounds %"class.tdogl::Bitmap", ptr %25, i32 0, i32 0
  %121 = load i32, ptr %120, align 8, !tbaa !16
  %122 = load ptr, ptr %10, align 8, !tbaa !5
  %123 = getelementptr inbounds %"class.tdogl::Bitmap", ptr %122, i32 0, i32 0
  %124 = load i32, ptr %123, align 8, !tbaa !16
  %125 = icmp ne i32 %121, %124
  br i1 %125, label %126, label %133

126:                                              ; preds = %119
  %127 = getelementptr inbounds %"class.tdogl::Bitmap", ptr %25, i32 0, i32 0
  %128 = load i32, ptr %127, align 8, !tbaa !16
  %129 = load ptr, ptr %10, align 8, !tbaa !5
  %130 = getelementptr inbounds %"class.tdogl::Bitmap", ptr %129, i32 0, i32 0
  %131 = load i32, ptr %130, align 8, !tbaa !16
  %132 = call noundef ptr @_ZL23ConverterFuncForFormatsN5tdogl6Bitmap6FormatES1_(i32 noundef %128, i32 noundef %131)
  store ptr %132, ptr %19, align 8, !tbaa !5
  br label %133

133:                                              ; preds = %126, %119
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  store i32 0, ptr %20, align 4, !tbaa !9
  br label %134

134:                                              ; preds = %201, %133
  %135 = load i32, ptr %20, align 4, !tbaa !9
  %136 = load i32, ptr %16, align 4, !tbaa !9
  %137 = icmp ult i32 %135, %136
  br i1 %137, label %139, label %138

138:                                              ; preds = %134
  store i32 2, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %204

139:                                              ; preds = %134
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  store i32 0, ptr %22, align 4, !tbaa !9
  br label %140

140:                                              ; preds = %197, %139
  %141 = load i32, ptr %22, align 4, !tbaa !9
  %142 = load i32, ptr %15, align 4, !tbaa !9
  %143 = icmp ult i32 %141, %142
  br i1 %143, label %145, label %144

144:                                              ; preds = %140
  store i32 5, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  br label %200

145:                                              ; preds = %140
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  %146 = load ptr, ptr %10, align 8, !tbaa !5
  %147 = getelementptr inbounds %"class.tdogl::Bitmap", ptr %146, i32 0, i32 3
  %148 = load ptr, ptr %147, align 8, !tbaa !15
  %149 = load i32, ptr %11, align 4, !tbaa !9
  %150 = load i32, ptr %22, align 4, !tbaa !9
  %151 = add i32 %149, %150
  %152 = load i32, ptr %12, align 4, !tbaa !9
  %153 = load i32, ptr %20, align 4, !tbaa !9
  %154 = add i32 %152, %153
  %155 = load ptr, ptr %10, align 8, !tbaa !5
  %156 = getelementptr inbounds %"class.tdogl::Bitmap", ptr %155, i32 0, i32 1
  %157 = load i32, ptr %156, align 4, !tbaa !11
  %158 = load ptr, ptr %10, align 8, !tbaa !5
  %159 = getelementptr inbounds %"class.tdogl::Bitmap", ptr %158, i32 0, i32 2
  %160 = load i32, ptr %159, align 8, !tbaa !14
  %161 = load ptr, ptr %10, align 8, !tbaa !5
  %162 = getelementptr inbounds %"class.tdogl::Bitmap", ptr %161, i32 0, i32 0
  %163 = load i32, ptr %162, align 8, !tbaa !16
  %164 = call noundef i32 @_Z14GetPixelOffsetjjjjN5tdogl6Bitmap6FormatE(i32 noundef %151, i32 noundef %154, i32 noundef %157, i32 noundef %160, i32 noundef %163)
  %165 = zext i32 %164 to i64
  %166 = getelementptr inbounds i8, ptr %148, i64 %165
  store ptr %166, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #7
  %167 = getelementptr inbounds %"class.tdogl::Bitmap", ptr %25, i32 0, i32 3
  %168 = load ptr, ptr %167, align 8, !tbaa !15
  %169 = load i32, ptr %13, align 4, !tbaa !9
  %170 = load i32, ptr %22, align 4, !tbaa !9
  %171 = add i32 %169, %170
  %172 = load i32, ptr %14, align 4, !tbaa !9
  %173 = load i32, ptr %20, align 4, !tbaa !9
  %174 = add i32 %172, %173
  %175 = getelementptr inbounds %"class.tdogl::Bitmap", ptr %25, i32 0, i32 1
  %176 = load i32, ptr %175, align 4, !tbaa !11
  %177 = getelementptr inbounds %"class.tdogl::Bitmap", ptr %25, i32 0, i32 2
  %178 = load i32, ptr %177, align 8, !tbaa !14
  %179 = getelementptr inbounds %"class.tdogl::Bitmap", ptr %25, i32 0, i32 0
  %180 = load i32, ptr %179, align 8, !tbaa !16
  %181 = call noundef i32 @_Z14GetPixelOffsetjjjjN5tdogl6Bitmap6FormatE(i32 noundef %171, i32 noundef %174, i32 noundef %176, i32 noundef %178, i32 noundef %180)
  %182 = zext i32 %181 to i64
  %183 = getelementptr inbounds i8, ptr %168, i64 %182
  store ptr %183, ptr %24, align 8, !tbaa !5
  %184 = load ptr, ptr %19, align 8, !tbaa !5
  %185 = icmp ne ptr %184, null
  br i1 %185, label %186, label %190

186:                                              ; preds = %145
  %187 = load ptr, ptr %19, align 8, !tbaa !5
  %188 = load ptr, ptr %23, align 8, !tbaa !5
  %189 = load ptr, ptr %24, align 8, !tbaa !5
  call void %187(ptr noundef %188, ptr noundef %189)
  br label %196

190:                                              ; preds = %145
  %191 = load ptr, ptr %24, align 8, !tbaa !5
  %192 = load ptr, ptr %23, align 8, !tbaa !5
  %193 = getelementptr inbounds %"class.tdogl::Bitmap", ptr %25, i32 0, i32 0
  %194 = load i32, ptr %193, align 8, !tbaa !16
  %195 = zext i32 %194 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %191, ptr align 1 %192, i64 %195, i1 false)
  br label %196

196:                                              ; preds = %190, %186
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  br label %197

197:                                              ; preds = %196
  %198 = load i32, ptr %22, align 4, !tbaa !9
  %199 = add i32 %198, 1
  store i32 %199, ptr %22, align 4, !tbaa !9
  br label %140, !llvm.loop !17

200:                                              ; preds = %144
  br label %201

201:                                              ; preds = %200
  %202 = load i32, ptr %20, align 4, !tbaa !9
  %203 = add i32 %202, 1
  store i32 %203, ptr %20, align 4, !tbaa !9
  br label %134, !llvm.loop !19

204:                                              ; preds = %138
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  ret void

205:                                              ; preds = %115, %93, %72, %51
  %206 = load ptr, ptr %17, align 8
  %207 = load i32, ptr %18, align 4
  %208 = insertvalue { ptr, i32 } poison, ptr %206, 0
  %209 = insertvalue { ptr, i32 } %208, i32 %207, 1
  resume { ptr, i32 } %209
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z12RectsOverlapjjjjjj(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #4

; Function Attrs: mustprogress uwtable
declare hidden noundef ptr @_ZL23ConverterFuncForFormatsN5tdogl6Bitmap6FormatES1_(i32 noundef, i32 noundef) #6

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 = { noreturn }

!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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 4}
!12 = !{!"_ZTSN5tdogl6BitmapE", !13, i64 0, !10, i64 4, !10, i64 8, !6, i64 16}
!13 = !{!"_ZTSN5tdogl6Bitmap6FormatE", !7, i64 0}
!14 = !{!12, !10, i64 8}
!15 = !{!12, !6, i64 16}
!16 = !{!12, !13, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}


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

@_ZTISt13runtime_error = external constant ptr
@.str.3 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [76 x i8], align 1

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

declare void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #0

declare i32 @__gxx_personality_v0(...)

declare void @__cxa_free_exception(ptr) local_unnamed_addr

; Function Attrs: nounwind
declare void @_ZNSt13runtime_errorD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z14GetPixelOffsetjjjjN5tdogl6Bitmap6FormatE(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress 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) #4

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5tdogl6Bitmap18copyRectFromBitmapERKS0_jjjjjj(ptr nocapture noundef nonnull readonly align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, i32 noundef %7) local_unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %9 = or i32 %3, %2
  %10 = or i32 %9, %6
  %11 = or i32 %10, %7
  %or.cond5 = icmp eq i32 %11, 0
  br i1 %or.cond5, label %12, label %15

12:                                               ; preds = %8
  %13 = tail call noundef i32 @_ZNK5tdogl6Bitmap5widthEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %14 = tail call noundef i32 @_ZNK5tdogl6Bitmap6heightEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  br label %15

15:                                               ; preds = %12, %8
  %.060 = phi i32 [ %14, %12 ], [ %7, %8 ]
  %.0 = phi i32 [ %13, %12 ], [ %6, %8 ]
  %16 = icmp eq i32 %.0, 0
  %17 = icmp eq i32 %.060, 0
  %or.cond7 = or i1 %17, %16
  br i1 %or.cond7, label %18, label %23

18:                                               ; preds = %15
  %19 = tail call ptr @__cxa_allocate_exception(i64 16) #6
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull @.str.3)
          to label %20 unwind label %21

20:                                               ; preds = %18
  tail call void @__cxa_throw(ptr nonnull %19, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #7
  unreachable

21:                                               ; preds = %18
  %22 = landingpad { ptr, i32 }
          cleanup
  br label %114

23:                                               ; preds = %15
  %24 = add i32 %.0, %2
  %25 = tail call noundef i32 @_ZNK5tdogl6Bitmap5widthEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %.not = icmp ult i32 %24, %25
  br i1 %.not, label %26, label %29

26:                                               ; preds = %23
  %27 = add i32 %.060, %3
  %28 = tail call noundef i32 @_ZNK5tdogl6Bitmap6heightEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %.not68 = icmp ult i32 %27, %28
  br i1 %.not68, label %34, label %29

29:                                               ; preds = %26, %23
  %30 = tail call ptr @__cxa_allocate_exception(i64 16) #6
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %30, ptr noundef nonnull @.str.4)
          to label %31 unwind label %32

31:                                               ; preds = %29
  tail call void @__cxa_throw(ptr nonnull %30, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #7
  unreachable

32:                                               ; preds = %29
  %33 = landingpad { ptr, i32 }
          cleanup
  br label %114

34:                                               ; preds = %26
  %35 = add i32 %.0, %4
  %36 = getelementptr inbounds i8, ptr %0, i64 4
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %.not69 = icmp ult i32 %35, %37
  br i1 %.not69, label %38, label %42

38:                                               ; preds = %34
  %39 = add i32 %.060, %5
  %40 = getelementptr inbounds i8, ptr %0, i64 8
  %41 = load i32, ptr %40, align 8, !tbaa !12
  %.not70 = icmp ult i32 %39, %41
  br i1 %.not70, label %47, label %42

42:                                               ; preds = %38, %34
  %43 = tail call ptr @__cxa_allocate_exception(i64 16) #6
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %43, ptr noundef nonnull @.str.5)
          to label %44 unwind label %45

44:                                               ; preds = %42
  tail call void @__cxa_throw(ptr nonnull %43, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #7
  unreachable

45:                                               ; preds = %42
  %46 = landingpad { ptr, i32 }
          cleanup
  br label %114

47:                                               ; preds = %38
  %48 = getelementptr inbounds i8, ptr %0, i64 16
  %49 = load ptr, ptr %48, align 8, !tbaa !13
  %50 = getelementptr inbounds i8, ptr %1, i64 16
  %51 = load ptr, ptr %50, align 8, !tbaa !13
  %52 = icmp eq ptr %49, %51
  br i1 %52, label %53, label %60

53:                                               ; preds = %47
  %54 = tail call noundef zeroext i1 @_Z12RectsOverlapjjjjjj(i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %.0, i32 noundef %.060)
  br i1 %54, label %55, label %60

55:                                               ; preds = %53
  %56 = tail call ptr @__cxa_allocate_exception(i64 16) #6
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %56, ptr noundef nonnull @.str.6)
          to label %57 unwind label %58

57:                                               ; preds = %55
  tail call void @__cxa_throw(ptr nonnull %56, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #7
  unreachable

58:                                               ; preds = %55
  %59 = landingpad { ptr, i32 }
          cleanup
  br label %114

60:                                               ; preds = %53, %47
  %61 = load i32, ptr %0, align 8, !tbaa !14
  %62 = load i32, ptr %1, align 8, !tbaa !14
  %.not71 = icmp eq i32 %61, %62
  br i1 %.not71, label %.preheader.lr.ph.split.us.thread, label %.preheader.lr.ph.split.us

.preheader.lr.ph.split.us.thread:                 ; preds = %60
  %63 = getelementptr inbounds i8, ptr %1, i64 4
  %64 = getelementptr inbounds i8, ptr %1, i64 8
  br label %.preheader.us.us.preheader

.preheader.lr.ph.split.us:                        ; preds = %60
  %65 = tail call noundef ptr @_ZL23ConverterFuncForFormatsN5tdogl6Bitmap6FormatES1_(i32 noundef %61, i32 noundef %62)
  %66 = getelementptr inbounds i8, ptr %1, i64 4
  %67 = getelementptr inbounds i8, ptr %1, i64 8
  %.not72 = icmp eq ptr %65, null
  br i1 %.not72, label %.preheader.us.us.preheader, label %.preheader.us

.preheader.us.us.preheader:                       ; preds = %.preheader.lr.ph.split.us.thread, %.preheader.lr.ph.split.us
  %68 = phi ptr [ %64, %.preheader.lr.ph.split.us.thread ], [ %67, %.preheader.lr.ph.split.us ]
  %69 = phi ptr [ %63, %.preheader.lr.ph.split.us.thread ], [ %66, %.preheader.lr.ph.split.us ]
  br label %.preheader.us.us

.preheader.us.us:                                 ; preds = %.preheader.us.us.preheader, %._crit_edge.split.us.us.us
  %.06275.us.us = phi i32 [ %92, %._crit_edge.split.us.us.us ], [ 0, %.preheader.us.us.preheader ]
  %70 = add i32 %.06275.us.us, %3
  %71 = add i32 %.06275.us.us, %5
  br label %72

72:                                               ; preds = %72, %.preheader.us.us
  %.06174.us.us.us = phi i32 [ 0, %.preheader.us.us ], [ %91, %72 ]
  %73 = load ptr, ptr %50, align 8, !tbaa !13
  %74 = add i32 %.06174.us.us.us, %2
  %75 = load i32, ptr %69, align 4, !tbaa !5
  %76 = load i32, ptr %68, align 8, !tbaa !12
  %77 = load i32, ptr %1, align 8, !tbaa !14
  %78 = tail call noundef i32 @_Z14GetPixelOffsetjjjjN5tdogl6Bitmap6FormatE(i32 noundef %74, i32 noundef %70, i32 noundef %75, i32 noundef %76, i32 noundef %77)
  %79 = zext i32 %78 to i64
  %80 = getelementptr inbounds i8, ptr %73, i64 %79
  %81 = load ptr, ptr %48, align 8, !tbaa !13
  %82 = add i32 %.06174.us.us.us, %4
  %83 = load i32, ptr %36, align 4, !tbaa !5
  %84 = load i32, ptr %40, align 8, !tbaa !12
  %85 = load i32, ptr %0, align 8, !tbaa !14
  %86 = tail call noundef i32 @_Z14GetPixelOffsetjjjjN5tdogl6Bitmap6FormatE(i32 noundef %82, i32 noundef %71, i32 noundef %83, i32 noundef %84, i32 noundef %85)
  %87 = zext i32 %86 to i64
  %88 = getelementptr inbounds i8, ptr %81, i64 %87
  %89 = load i32, ptr %0, align 8, !tbaa !14
  %90 = zext i32 %89 to i64
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %88, ptr align 1 %80, i64 %90, i1 false)
  %91 = add nuw i32 %.06174.us.us.us, 1
  %exitcond85.not = icmp eq i32 %91, %.0
  br i1 %exitcond85.not, label %._crit_edge.split.us.us.us, label %72, !llvm.loop !15

._crit_edge.split.us.us.us:                       ; preds = %72
  %92 = add nuw i32 %.06275.us.us, 1
  %exitcond86.not = icmp eq i32 %92, %.060
  br i1 %exitcond86.not, label %._crit_edge76, label %.preheader.us.us, !llvm.loop !17

.preheader.us:                                    ; preds = %.preheader.lr.ph.split.us, %._crit_edge.split.us78
  %.06275.us = phi i32 [ %113, %._crit_edge.split.us78 ], [ 0, %.preheader.lr.ph.split.us ]
  %93 = add i32 %.06275.us, %3
  %94 = add i32 %.06275.us, %5
  br label %95

95:                                               ; preds = %.preheader.us, %95
  %.06174.us77 = phi i32 [ 0, %.preheader.us ], [ %112, %95 ]
  %96 = load ptr, ptr %50, align 8, !tbaa !13
  %97 = add i32 %.06174.us77, %2
  %98 = load i32, ptr %66, align 4, !tbaa !5
  %99 = load i32, ptr %67, align 8, !tbaa !12
  %100 = load i32, ptr %1, align 8, !tbaa !14
  %101 = tail call noundef i32 @_Z14GetPixelOffsetjjjjN5tdogl6Bitmap6FormatE(i32 noundef %97, i32 noundef %93, i32 noundef %98, i32 noundef %99, i32 noundef %100)
  %102 = zext i32 %101 to i64
  %103 = getelementptr inbounds i8, ptr %96, i64 %102
  %104 = load ptr, ptr %48, align 8, !tbaa !13
  %105 = add i32 %.06174.us77, %4
  %106 = load i32, ptr %36, align 4, !tbaa !5
  %107 = load i32, ptr %40, align 8, !tbaa !12
  %108 = load i32, ptr %0, align 8, !tbaa !14
  %109 = tail call noundef i32 @_Z14GetPixelOffsetjjjjN5tdogl6Bitmap6FormatE(i32 noundef %105, i32 noundef %94, i32 noundef %106, i32 noundef %107, i32 noundef %108)
  %110 = zext i32 %109 to i64
  %111 = getelementptr inbounds i8, ptr %104, i64 %110
  tail call void %65(ptr noundef %103, ptr noundef %111)
  %112 = add nuw i32 %.06174.us77, 1
  %exitcond.not = icmp eq i32 %112, %.0
  br i1 %exitcond.not, label %._crit_edge.split.us78, label %95, !llvm.loop !15

._crit_edge.split.us78:                           ; preds = %95
  %113 = add nuw i32 %.06275.us, 1
  %exitcond84.not = icmp eq i32 %113, %.060
  br i1 %exitcond84.not, label %._crit_edge76, label %.preheader.us, !llvm.loop !17

._crit_edge76:                                    ; preds = %._crit_edge.split.us78, %._crit_edge.split.us.us.us
  ret void

114:                                              ; preds = %58, %45, %32, %21
  %.sink = phi ptr [ %56, %58 ], [ %43, %45 ], [ %30, %32 ], [ %19, %21 ]
  %.pn = phi { ptr, i32 } [ %59, %58 ], [ %46, %45 ], [ %33, %32 ], [ %22, %21 ]
  tail call void @__cxa_free_exception(ptr %.sink) #6
  resume { ptr, i32 } %.pn
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z12RectsOverlapjjjjjj(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare hidden noundef ptr @_ZL23ConverterFuncForFormatsN5tdogl6Bitmap6FormatES1_(i32 noundef, i32 noundef) local_unnamed_addr #5

attributes #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 #1 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 = { 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { nounwind }
attributes #7 = { noreturn }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !10, i64 4}
!6 = !{!"_ZTSN5tdogl6BitmapE", !7, i64 0, !10, i64 4, !10, i64 8, !11, i64 16}
!7 = !{!"_ZTSN5tdogl6Bitmap6FormatE", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!6, !10, i64 8}
!13 = !{!6, !11, i64 16}
!14 = !{!6, !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass