; LLVM IR from achilles288/robot-monitor-graphics :: src/base/font.ll (ZN3rmg4FontC2EPNS_7ContextEPKct)

; 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.rmg::Bitmap" = type { i16, i16, i8, ptr }
%"class.rmg::internal::Pending" = type { ptr, ptr }
%"class.rmg::Font" = type <{ ptr, i32, [4 x i8], ptr, %"class.rmg::internal::SpriteTexture", %"class.rmg::internal::Pending", i16, [256 x %"struct.rmg::GlyphMetrics"], [6 x i8] }>
%"class.rmg::internal::SpriteTexture" = type <{ ptr, i32, [4 x i8] }>
%"struct.rmg::GlyphMetrics" = type { i16, i16, %"struct.rmg::Vec2i", i16 }
%"struct.rmg::Vec2i" = type { i16, i16 }
%struct.FT_FaceRec_ = type { i64, i64, i64, i64, i64, ptr, ptr, i32, ptr, i32, ptr, %struct.FT_Generic_, %struct.FT_BBox_, i16, i16, i16, i16, i16, i16, i16, i16, ptr, ptr, ptr, ptr, ptr, ptr, %struct.FT_ListRec_, %struct.FT_Generic_, ptr, ptr }
%struct.FT_BBox_ = type { i64, i64, i64, i64 }
%struct.FT_ListRec_ = type { ptr, ptr }
%struct.FT_Generic_ = type { ptr, ptr }
%struct.FT_GlyphSlotRec_ = type { ptr, ptr, ptr, i32, %struct.FT_Generic_, %struct.FT_Glyph_Metrics_, i64, i64, %struct.FT_Vector_, i32, %struct.FT_Bitmap_, i32, i32, %struct.FT_Outline_, i32, ptr, ptr, i64, i64, i64, ptr, ptr }
%struct.FT_Glyph_Metrics_ = type { i64, i64, i64, i64, i64, i64, i64, i64 }
%struct.FT_Vector_ = type { i64, i64 }
%struct.FT_Bitmap_ = type { i32, i32, i32, ptr, i16, i8, i8, ptr }
%struct.FT_Outline_ = type { i16, i16, ptr, ptr, ptr, i32 }

@_ZN3rmg4Font6lastIDE = external dso_local global i32, align 4
@_ZTVN3rmg4FontE = external dso_local unnamed_addr constant { [4 x ptr] }, align 8
@.str = external hidden unnamed_addr constant [24 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [60 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3rmg4FontC2EPNS_7ContextEPKct(ptr noundef nonnull align 8 dereferenceable(2618) %0, ptr noundef %1, ptr noundef %2, i16 noundef zeroext %3) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i16, align 2
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca %"class.rmg::Bitmap", align 8
  %15 = alloca i32, align 4
  %16 = alloca i16, align 2
  %17 = alloca i16, align 2
  %18 = alloca %"class.rmg::Bitmap", align 8
  %19 = alloca i8, align 1
  %20 = alloca i8, align 1
  %21 = alloca ptr, align 8
  %22 = alloca %"class.rmg::internal::Pending", 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
  store i16 %3, ptr %8, align 2, !tbaa !9
  %23 = load ptr, ptr %5, align 8
  store ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr] }, ptr @_ZTVN3rmg4FontE, i32 0, i32 0, i32 2), ptr %23, align 8, !tbaa !11
  %24 = getelementptr inbounds %"class.rmg::Font", ptr %23, i32 0, i32 4
  call void @_ZN3rmg8internal13SpriteTextureC1Ev(ptr noundef nonnull align 8 dereferenceable(12) %24)
  %25 = getelementptr inbounds %"class.rmg::Font", ptr %23, i32 0, i32 5
  call void @_ZN3rmg8internal7PendingC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %25) #8
  %26 = getelementptr inbounds %"class.rmg::Font", ptr %23, i32 0, i32 7
  %27 = getelementptr inbounds [256 x %"struct.rmg::GlyphMetrics"], ptr %26, i32 0, i32 0
  %28 = getelementptr inbounds %"struct.rmg::GlyphMetrics", ptr %27, i64 256
  br label %29

29:                                               ; preds = %31, %4
  %30 = phi ptr [ %27, %4 ], [ %32, %31 ]
  invoke void @_ZN3rmg12GlyphMetricsC2Ev(ptr noundef nonnull align 2 dereferenceable(10) %30)
          to label %31 unwind label %43

31:                                               ; preds = %29
  %32 = getelementptr inbounds %"struct.rmg::GlyphMetrics", ptr %30, i64 1
  %33 = icmp eq ptr %32, %28
  br i1 %33, label %34, label %29

34:                                               ; preds = %31
  %35 = load i32, ptr @_ZN3rmg4Font6lastIDE, align 4, !tbaa !13
  %36 = add i32 %35, 1
  store i32 %36, ptr @_ZN3rmg4Font6lastIDE, align 4, !tbaa !13
  %37 = getelementptr inbounds %"class.rmg::Font", ptr %23, i32 0, i32 1
  store i32 %36, ptr %37, align 8, !tbaa !15
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = getelementptr inbounds %"class.rmg::Font", ptr %23, i32 0, i32 3
  store ptr %38, ptr %39, align 8, !tbaa !19
  %40 = load ptr, ptr %7, align 8, !tbaa !5
  %41 = icmp eq ptr %40, null
  br i1 %41, label %42, label %47

42:                                               ; preds = %34
  store ptr @.str, ptr %7, align 8, !tbaa !5
  br label %47

43:                                               ; preds = %29
  %44 = landingpad { ptr, i32 }
          cleanup
  %45 = extractvalue { ptr, i32 } %44, 0
  store ptr %45, ptr %9, align 8
  %46 = extractvalue { ptr, i32 } %44, 1
  store i32 %46, ptr %10, align 4
  br label %301

47:                                               ; preds = %42, %34
  %48 = load i16, ptr %8, align 2, !tbaa !9
  %49 = getelementptr inbounds %"class.rmg::Font", ptr %23, i32 0, i32 6
  store i16 %48, ptr %49, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  %50 = invoke i32 @FT_Init_FreeType(ptr noundef %11)
          to label %51 unwind label %56

51:                                               ; preds = %47
  %52 = icmp ne i32 %50, 0
  br i1 %52, label %53, label %60

53:                                               ; preds = %51
  %54 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.1)
          to label %55 unwind label %56

55:                                               ; preds = %53
  store i32 1, ptr %12, align 4
  br label %277

56:                                               ; preds = %53, %47
  %57 = landingpad { ptr, i32 }
          cleanup
  %58 = extractvalue { ptr, i32 } %57, 0
  store ptr %58, ptr %9, align 8
  %59 = extractvalue { ptr, i32 } %57, 1
  store i32 %59, ptr %10, align 4
  br label %300

60:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  %61 = load ptr, ptr %11, align 8, !tbaa !5
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  %63 = invoke i32 @FT_New_Face(ptr noundef %61, ptr noundef %62, i64 noundef 0, ptr noundef %13)
          to label %64 unwind label %70

64:                                               ; preds = %60
  %65 = icmp ne i32 %63, 0
  br i1 %65, label %66, label %74

66:                                               ; preds = %64
  %67 = load ptr, ptr %7, align 8, !tbaa !5
  %68 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.2, ptr noundef %67)
          to label %69 unwind label %70

69:                                               ; preds = %66
  store i32 1, ptr %12, align 4
  br label %276

70:                                               ; preds = %74, %66, %60
  %71 = landingpad { ptr, i32 }
          cleanup
  %72 = extractvalue { ptr, i32 } %71, 0
  store ptr %72, ptr %9, align 8
  %73 = extractvalue { ptr, i32 } %71, 1
  store i32 %73, ptr %10, align 4
  br label %299

74:                                               ; preds = %64
  %75 = load ptr, ptr %13, align 8, !tbaa !5
  %76 = getelementptr inbounds %"class.rmg::Font", ptr %23, i32 0, i32 6
  %77 = load i16, ptr %76, align 8, !tbaa !20
  %78 = zext i16 %77 to i32
  %79 = invoke i32 @FT_Set_Pixel_Sizes(ptr noundef %75, i32 noundef 0, i32 noundef %78)
          to label %80 unwind label %70

80:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #8
  %81 = getelementptr inbounds %"class.rmg::Font", ptr %23, i32 0, i32 6
  %82 = load i16, ptr %81, align 8, !tbaa !20
  %83 = zext i16 %82 to i32
  %84 = mul nsw i32 16, %83
  %85 = trunc i32 %84 to i16
  %86 = getelementptr inbounds %"class.rmg::Font", ptr %23, i32 0, i32 6
  %87 = load i16, ptr %86, align 8, !tbaa !20
  %88 = zext i16 %87 to i32
  %89 = mul nsw i32 16, %88
  %90 = trunc i32 %89 to i16
  invoke void @_ZN3rmg6BitmapC1Etth(ptr noundef nonnull align 8 dereferenceable(16) %14, i16 noundef zeroext %85, i16 noundef zeroext %90, i8 noundef zeroext 1)
          to label %91 unwind label %96

91:                                               ; preds = %80
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  store i32 0, ptr %15, align 4, !tbaa !13
  br label %92

92:                                               ; preds = %251, %91
  %93 = load i32, ptr %15, align 4, !tbaa !13
  %94 = icmp slt i32 %93, 256
  br i1 %94, label %100, label %95

95:                                               ; preds = %92
  store i32 2, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  br label %261

96:                                               ; preds = %80
  %97 = landingpad { ptr, i32 }
          cleanup
  %98 = extractvalue { ptr, i32 } %97, 0
  store ptr %98, ptr %9, align 8
  %99 = extractvalue { ptr, i32 } %97, 1
  store i32 %99, ptr %10, align 4
  br label %298

100:                                              ; preds = %92
  %101 = load ptr, ptr %13, align 8, !tbaa !5
  %102 = load i32, ptr %15, align 4, !tbaa !13
  %103 = sext i32 %102 to i64
  %104 = invoke i32 @FT_Load_Char(ptr noundef %101, i64 noundef %103, i32 noundef 4)
          to label %105 unwind label %108

105:                                              ; preds = %100
  %106 = icmp ne i32 %104, 0
  br i1 %106, label %107, label %112

107:                                              ; preds = %105
  br label %251

108:                                              ; preds = %100
  %109 = landingpad { ptr, i32 }
          cleanup
  %110 = extractvalue { ptr, i32 } %109, 0
  store ptr %110, ptr %9, align 8
  %111 = extractvalue { ptr, i32 } %109, 1
  store i32 %111, ptr %10, align 4
  br label %260

112:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 2, ptr %16) #8
  %113 = load ptr, ptr %13, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.FT_FaceRec_, ptr %113, i32 0, i32 21
  %115 = load ptr, ptr %114, align 8, !tbaa !21
  %116 = getelementptr inbounds %struct.FT_GlyphSlotRec_, ptr %115, i32 0, i32 10
  %117 = getelementptr inbounds %struct.FT_Bitmap_, ptr %116, i32 0, i32 1
  %118 = load i32, ptr %117, align 4, !tbaa !27
  %119 = trunc i32 %118 to i16
  store i16 %119, ptr %16, align 2, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 2, ptr %17) #8
  %120 = load ptr, ptr %13, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.FT_FaceRec_, ptr %120, i32 0, i32 21
  %122 = load ptr, ptr %121, align 8, !tbaa !21
  %123 = getelementptr inbounds %struct.FT_GlyphSlotRec_, ptr %122, i32 0, i32 10
  %124 = getelementptr inbounds %struct.FT_Bitmap_, ptr %123, i32 0, i32 0
  %125 = load i32, ptr %124, align 8, !tbaa !34
  %126 = trunc i32 %125 to i16
  store i16 %126, ptr %17, align 2, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #8
  %127 = load i16, ptr %16, align 2, !tbaa !9
  %128 = load i16, ptr %17, align 2, !tbaa !9
  %129 = load ptr, ptr %13, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.FT_FaceRec_, ptr %129, i32 0, i32 21
  %131 = load ptr, ptr %130, align 8, !tbaa !21
  %132 = getelementptr inbounds %struct.FT_GlyphSlotRec_, ptr %131, i32 0, i32 10
  %133 = getelementptr inbounds %struct.FT_Bitmap_, ptr %132, i32 0, i32 3
  %134 = load ptr, ptr %133, align 8, !tbaa !35
  invoke void @_ZN3rmg6BitmapC1EtthPh(ptr noundef nonnull align 8 dereferenceable(16) %18, i16 noundef zeroext %127, i16 noundef zeroext %128, i8 noundef zeroext 1, ptr noundef %134)
          to label %135 unwind label %159

135:                                              ; preds = %112
  %136 = load i16, ptr %16, align 2, !tbaa !9
  %137 = zext i16 %136 to i32
  %138 = getelementptr inbounds %"class.rmg::Font", ptr %23, i32 0, i32 6
  %139 = load i16, ptr %138, align 8, !tbaa !20
  %140 = zext i16 %139 to i32
  %141 = icmp sgt i32 %137, %140
  br i1 %141, label %149, label %142

142:                                              ; preds = %135
  %143 = load i16, ptr %17, align 2, !tbaa !9
  %144 = zext i16 %143 to i32
  %145 = getelementptr inbounds %"class.rmg::Font", ptr %23, i32 0, i32 6
  %146 = load i16, ptr %145, align 8, !tbaa !20
  %147 = zext i16 %146 to i32
  %148 = icmp sgt i32 %144, %147
  br i1 %148, label %149, label %181

149:                                              ; preds = %142, %135
  %150 = load i16, ptr %16, align 2, !tbaa !9
  %151 = zext i16 %150 to i32
  %152 = getelementptr inbounds %"class.rmg::Font", ptr %23, i32 0, i32 6
  %153 = load i16, ptr %152, align 8, !tbaa !20
  %154 = zext i16 %153 to i32
  %155 = icmp sgt i32 %151, %154
  br i1 %155, label %156, label %163

156:                                              ; preds = %149
  %157 = getelementptr inbounds %"class.rmg::Font", ptr %23, i32 0, i32 6
  %158 = load i16, ptr %157, align 8, !tbaa !20
  store i16 %158, ptr %16, align 2, !tbaa !9
  br label %163

159:                                              ; preds = %112
  %160 = landingpad { ptr, i32 }
          cleanup
  %161 = extractvalue { ptr, i32 } %160, 0
  store ptr %161, ptr %9, align 8
  %162 = extractvalue { ptr, i32 } %160, 1
  store i32 %162, ptr %10, align 4
  br label %259

163:                                              ; preds = %156, %149
  %164 = load i16, ptr %17, align 2, !tbaa !9
  %165 = zext i16 %164 to i32
  %166 = getelementptr inbounds %"class.rmg::Font", ptr %23, i32 0, i32 6
  %167 = load i16, ptr %166, align 8, !tbaa !20
  %168 = zext i16 %167 to i32
  %169 = icmp sgt i32 %165, %168
  br i1 %169, label %170, label %173

170:                                              ; preds = %163
  %171 = getelementptr inbounds %"class.rmg::Font", ptr %23, i32 0, i32 6
  %172 = load i16, ptr %171, align 8, !tbaa !20
  store i16 %172, ptr %17, align 2, !tbaa !9
  br label %173

173:                                              ; preds = %170, %163
  %174 = load i16, ptr %16, align 2, !tbaa !9
  %175 = load i16, ptr %17, align 2, !tbaa !9
  invoke void @_ZN3rmg6Bitmap4cropEsstt(ptr noundef nonnull align 8 dereferenceable(16) %18, i16 noundef signext 0, i16 noundef signext 0, i16 noundef zeroext %174, i16 noundef zeroext %175)
          to label %176 unwind label %177

176:                                              ; preds = %173
  br label %181

177:                                              ; preds = %173
  %178 = landingpad { ptr, i32 }
          cleanup
  %179 = extractvalue { ptr, i32 } %178, 0
  store ptr %179, ptr %9, align 8
  %180 = extractvalue { ptr, i32 } %178, 1
  store i32 %180, ptr %10, align 4
  br label %258

181:                                              ; preds = %176, %142
  call void @llvm.lifetime.start.p0(i64 1, ptr %19) #8
  %182 = load i32, ptr %15, align 4, !tbaa !13
  %183 = srem i32 %182, 16
  %184 = trunc i32 %183 to i8
  store i8 %184, ptr %19, align 1, !tbaa !36
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #8
  %185 = load i32, ptr %15, align 4, !tbaa !13
  %186 = sdiv i32 %185, 16
  %187 = trunc i32 %186 to i8
  store i8 %187, ptr %20, align 1, !tbaa !36
  %188 = load i8, ptr %19, align 1, !tbaa !36
  %189 = zext i8 %188 to i32
  %190 = getelementptr inbounds %"class.rmg::Font", ptr %23, i32 0, i32 6
  %191 = load i16, ptr %190, align 8, !tbaa !20
  %192 = zext i16 %191 to i32
  %193 = mul nsw i32 %189, %192
  %194 = trunc i32 %193 to i16
  %195 = load i8, ptr %20, align 1, !tbaa !36
  %196 = zext i8 %195 to i32
  %197 = getelementptr inbounds %"class.rmg::Font", ptr %23, i32 0, i32 6
  %198 = load i16, ptr %197, align 8, !tbaa !20
  %199 = zext i16 %198 to i32
  %200 = mul nsw i32 %196, %199
  %201 = trunc i32 %200 to i16
  invoke void @_ZN3rmg6Bitmap5pasteERKS0_ss(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(16) %18, i16 noundef signext %194, i16 noundef signext %201)
          to label %202 unwind label %254

202:                                              ; preds = %181
  %203 = load i16, ptr %16, align 2, !tbaa !9
  %204 = getelementptr inbounds %"class.rmg::Font", ptr %23, i32 0, i32 7
  %205 = load i32, ptr %15, align 4, !tbaa !13
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds [256 x %"struct.rmg::GlyphMetrics"], ptr %204, i64 0, i64 %206
  %208 = getelementptr inbounds %"struct.rmg::GlyphMetrics", ptr %207, i32 0, i32 0
  store i16 %203, ptr %208, align 2, !tbaa !37
  %209 = load i16, ptr %17, align 2, !tbaa !9
  %210 = getelementptr inbounds %"class.rmg::Font", ptr %23, i32 0, i32 7
  %211 = load i32, ptr %15, align 4, !tbaa !13
  %212 = sext i32 %211 to i64
  %213 = getelementptr inbounds [256 x %"struct.rmg::GlyphMetrics"], ptr %210, i64 0, i64 %212
  %214 = getelementptr inbounds %"struct.rmg::GlyphMetrics", ptr %213, i32 0, i32 1
  store i16 %209, ptr %214, align 2, !tbaa !40
  %215 = load ptr, ptr %13, align 8, !tbaa !5
  %216 = getelementptr inbounds %struct.FT_FaceRec_, ptr %215, i32 0, i32 21
  %217 = load ptr, ptr %216, align 8, !tbaa !21
  %218 = getelementptr inbounds %struct.FT_GlyphSlotRec_, ptr %217, i32 0, i32 11
  %219 = load i32, ptr %218, align 8, !tbaa !41
  %220 = trunc i32 %219 to i16
  %221 = getelementptr inbounds %"class.rmg::Font", ptr %23, i32 0, i32 7
  %222 = load i32, ptr %15, align 4, !tbaa !13
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds [256 x %"struct.rmg::GlyphMetrics"], ptr %221, i64 0, i64 %223
  %225 = getelementptr inbounds %"struct.rmg::GlyphMetrics", ptr %224, i32 0, i32 2
  %226 = getelementptr inbounds %"struct.rmg::Vec2i", ptr %225, i32 0, i32 0
  store i16 %220, ptr %226, align 2, !tbaa !42
  %227 = load ptr, ptr %13, align 8, !tbaa !5
  %228 = getelementptr inbounds %struct.FT_FaceRec_, ptr %227, i32 0, i32 21
  %229 = load ptr, ptr %228, align 8, !tbaa !21
  %230 = getelementptr inbounds %struct.FT_GlyphSlotRec_, ptr %229, i32 0, i32 12
  %231 = load i32, ptr %230, align 4, !tbaa !43
  %232 = trunc i32 %231 to i16
  %233 = getelementptr inbounds %"class.rmg::Font", ptr %23, i32 0, i32 7
  %234 = load i32, ptr %15, align 4, !tbaa !13
  %235 = sext i32 %234 to i64
  %236 = getelementptr inbounds [256 x %"struct.rmg::GlyphMetrics"], ptr %233, i64 0, i64 %235
  %237 = getelementptr inbounds %"struct.rmg::GlyphMetrics", ptr %236, i32 0, i32 2
  %238 = getelementptr inbounds %"struct.rmg::Vec2i", ptr %237, i32 0, i32 1
  store i16 %232, ptr %238, align 2, !tbaa !44
  %239 = load ptr, ptr %13, align 8, !tbaa !5
  %240 = getelementptr inbounds %struct.FT_FaceRec_, ptr %239, i32 0, i32 21
  %241 = load ptr, ptr %240, align 8, !tbaa !21
  %242 = getelementptr inbounds %struct.FT_GlyphSlotRec_, ptr %241, i32 0, i32 8
  %243 = getelementptr inbounds %struct.FT_Vector_, ptr %242, i32 0, i32 0
  %244 = load i64, ptr %243, align 8, !tbaa !45
  %245 = trunc i64 %244 to i16
  %246 = getelementptr inbounds %"class.rmg::Font", ptr %23, i32 0, i32 7
  %247 = load i32, ptr %15, align 4, !tbaa !13
  %248 = sext i32 %247 to i64
  %249 = getelementptr inbounds [256 x %"struct.rmg::GlyphMetrics"], ptr %246, i64 0, i64 %248
  %250 = getelementptr inbounds %"struct.rmg::GlyphMetrics", ptr %249, i32 0, i32 3
  store i16 %245, ptr %250, align 2, !tbaa !46
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #8
  call void @_ZN3rmg6BitmapD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %18) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 2, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 2, ptr %16) #8
  br label %251

251:                                              ; preds = %202, %107
  %252 = load i32, ptr %15, align 4, !tbaa !13
  %253 = add nsw i32 %252, 1
  store i32 %253, ptr %15, align 4, !tbaa !13
  br label %92, !llvm.loop !47

254:                                              ; preds = %181
  %255 = landingpad { ptr, i32 }
          cleanup
  %256 = extractvalue { ptr, i32 } %255, 0
  store ptr %256, ptr %9, align 8
  %257 = extractvalue { ptr, i32 } %255, 1
  store i32 %257, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #8
  br label %258

258:                                              ; preds = %254, %177
  call void @_ZN3rmg6BitmapD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %18) #8
  br label %259

259:                                              ; preds = %258, %159
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 2, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 2, ptr %16) #8
  br label %260

260:                                              ; preds = %259, %108
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  br label %297

261:                                              ; preds = %95
  %262 = load ptr, ptr %13, align 8, !tbaa !5
  %263 = invoke i32 @FT_Done_Face(ptr noundef %262)
          to label %264 unwind label %280

264:                                              ; preds = %261
  %265 = load ptr, ptr %11, align 8, !tbaa !5
  %266 = invoke i32 @FT_Done_FreeType(ptr noundef %265)
          to label %267 unwind label %280

267:                                              ; preds = %264
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #8
  %268 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 40) #9
          to label %269 unwind label %284

269:                                              ; preds = %267
  %270 = getelementptr inbounds %"class.rmg::Font", ptr %23, i32 0, i32 4
  invoke void @_ZN3rmg8internal10SpriteLoadC1EPNS0_13SpriteTextureERKNS_6BitmapE(ptr noundef nonnull align 8 dereferenceable(36) %268, ptr noundef %270, ptr noundef nonnull align 8 dereferenceable(16) %14)
          to label %271 unwind label %288

271:                                              ; preds = %269
  store ptr %268, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %22) #8
  %272 = load ptr, ptr %21, align 8, !tbaa !5
  invoke void @_ZN3rmg8internal7PendingC1EPNS0_11ContextLoadE(ptr noundef nonnull align 8 dereferenceable(16) %22, ptr noundef %272)
          to label %273 unwind label %292

273:                                              ; preds = %271
  %274 = getelementptr inbounds %"class.rmg::Font", ptr %23, i32 0, i32 5
  %275 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN3rmg8internal7PendingaSEOS1_(ptr noundef nonnull align 8 dereferenceable(16) %274, ptr noundef nonnull align 8 dereferenceable(16) %22) #8
  call void @_ZN3rmg8internal7PendingD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %22) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %22) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  call void @_ZN3rmg6BitmapD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %14) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #8
  store i32 0, ptr %12, align 4
  br label %276

276:                                              ; preds = %273, %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %277

277:                                              ; preds = %276, %55
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  %278 = load i32, ptr %12, align 4
  switch i32 %278, label %307 [
    i32 0, label %279
    i32 1, label %279
  ]

279:                                              ; preds = %277, %277
  ret void

280:                                              ; preds = %264, %261
  %281 = landingpad { ptr, i32 }
          cleanup
  %282 = extractvalue { ptr, i32 } %281, 0
  store ptr %282, ptr %9, align 8
  %283 = extractvalue { ptr, i32 } %281, 1
  store i32 %283, ptr %10, align 4
  br label %297

284:                                              ; preds = %267
  %285 = landingpad { ptr, i32 }
          cleanup
  %286 = extractvalue { ptr, i32 } %285, 0
  store ptr %286, ptr %9, align 8
  %287 = extractvalue { ptr, i32 } %285, 1
  store i32 %287, ptr %10, align 4
  br label %296

288:                                              ; preds = %269
  %289 = landingpad { ptr, i32 }
          cleanup
  %290 = extractvalue { ptr, i32 } %289, 0
  store ptr %290, ptr %9, align 8
  %291 = extractvalue { ptr, i32 } %289, 1
  store i32 %291, ptr %10, align 4
  call void @_ZdlPvm(ptr noundef %268, i64 noundef 40) #10
  br label %296

292:                                              ; preds = %271
  %293 = landingpad { ptr, i32 }
          cleanup
  %294 = extractvalue { ptr, i32 } %293, 0
  store ptr %294, ptr %9, align 8
  %295 = extractvalue { ptr, i32 } %293, 1
  store i32 %295, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %22) #8
  br label %296

296:                                              ; preds = %292, %288, %284
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  br label %297

297:                                              ; preds = %296, %280, %260
  call void @_ZN3rmg6BitmapD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %14) #8
  br label %298

298:                                              ; preds = %297, %96
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #8
  br label %299

299:                                              ; preds = %298, %70
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %300

300:                                              ; preds = %299, %56
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  br label %301

301:                                              ; preds = %300, %43
  call void @_ZN3rmg8internal7PendingD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %25) #8
  call void @_ZN3rmg8internal13SpriteTextureD1Ev(ptr noundef nonnull align 8 dereferenceable(12) %24) #8
  br label %302

302:                                              ; preds = %301
  %303 = load ptr, ptr %9, align 8
  %304 = load i32, ptr %10, align 4
  %305 = insertvalue { ptr, i32 } poison, ptr %303, 0
  %306 = insertvalue { ptr, i32 } %305, i32 %304, 1
  resume { ptr, i32 } %306

307:                                              ; preds = %277
  unreachable
}

declare void @_ZN3rmg8internal13SpriteTextureC1Ev(ptr noundef nonnull align 8 dereferenceable(12)) unnamed_addr #1

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

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

declare i32 @__gxx_personality_v0(...)

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

declare i32 @FT_Init_FreeType(ptr noundef) #1

declare i32 @printf(ptr noundef, ...) #1

declare i32 @FT_New_Face(ptr noundef, ptr noundef, i64 noundef, ptr noundef) #1

declare i32 @FT_Set_Pixel_Sizes(ptr noundef, i32 noundef, i32 noundef) #1

declare void @_ZN3rmg6BitmapC1Etth(ptr noundef nonnull align 8 dereferenceable(16), i16 noundef zeroext, i16 noundef zeroext, i8 noundef zeroext) unnamed_addr #1

declare i32 @FT_Load_Char(ptr noundef, i64 noundef, i32 noundef) #1

declare void @_ZN3rmg6BitmapC1EtthPh(ptr noundef nonnull align 8 dereferenceable(16), i16 noundef zeroext, i16 noundef zeroext, i8 noundef zeroext, ptr noundef) unnamed_addr #1

declare void @_ZN3rmg6Bitmap4cropEsstt(ptr noundef nonnull align 8 dereferenceable(16), i16 noundef signext, i16 noundef signext, i16 noundef zeroext, i16 noundef zeroext) #1

declare void @_ZN3rmg6Bitmap5pasteERKS0_ss(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16), i16 noundef signext, i16 noundef signext) #1

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

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

declare i32 @FT_Done_Face(ptr noundef) #1

declare i32 @FT_Done_FreeType(ptr noundef) #1

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

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

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

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

; Function Attrs: nounwind
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZN3rmg8internal7PendingaSEOS1_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #5

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

; Function Attrs: nounwind
declare void @_ZN3rmg8internal13SpriteTextureD1Ev(ptr noundef nonnull align 8 dereferenceable(12)) unnamed_addr #5

attributes #0 = { 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 #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 = { 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 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = { 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 #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, !10, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !14, i64 8}
!16 = !{!"_ZTSN3rmg4FontE", !14, i64 8, !6, i64 16, !17, i64 24, !18, i64 40, !10, i64 56, !7, i64 58}
!17 = !{!"_ZTSN3rmg8internal13SpriteTextureE", !14, i64 8}
!18 = !{!"_ZTSN3rmg8internal7PendingE", !6, i64 0, !6, i64 8}
!19 = !{!16, !6, i64 16}
!20 = !{!16, !10, i64 56}
!21 = !{!22, !6, i64 152}
!22 = !{!"_ZTS11FT_FaceRec_", !23, i64 0, !23, i64 8, !23, i64 16, !23, i64 24, !23, i64 32, !6, i64 40, !6, i64 48, !14, i64 56, !6, i64 64, !14, i64 72, !6, i64 80, !24, i64 88, !25, i64 104, !10, i64 136, !10, i64 138, !10, i64 140, !10, i64 142, !10, i64 144, !10, i64 146, !10, i64 148, !10, i64 150, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !26, i64 200, !24, i64 216, !6, i64 232, !6, i64 240}
!23 = !{!"long", !7, i64 0}
!24 = !{!"_ZTS11FT_Generic_", !6, i64 0, !6, i64 8}
!25 = !{!"_ZTS8FT_BBox_", !23, i64 0, !23, i64 8, !23, i64 16, !23, i64 24}
!26 = !{!"_ZTS11FT_ListRec_", !6, i64 0, !6, i64 8}
!27 = !{!28, !14, i64 156}
!28 = !{!"_ZTS16FT_GlyphSlotRec_", !6, i64 0, !6, i64 8, !6, i64 16, !14, i64 24, !24, i64 32, !29, i64 48, !23, i64 112, !23, i64 120, !30, i64 128, !31, i64 144, !32, i64 152, !14, i64 192, !14, i64 196, !33, i64 200, !14, i64 240, !6, i64 248, !6, i64 256, !23, i64 264, !23, i64 272, !23, i64 280, !6, i64 288, !6, i64 296}
!29 = !{!"_ZTS17FT_Glyph_Metrics_", !23, i64 0, !23, i64 8, !23, i64 16, !23, i64 24, !23, i64 32, !23, i64 40, !23, i64 48, !23, i64 56}
!30 = !{!"_ZTS10FT_Vector_", !23, i64 0, !23, i64 8}
!31 = !{!"_ZTS16FT_Glyph_Format_", !7, i64 0}
!32 = !{!"_ZTS10FT_Bitmap_", !14, i64 0, !14, i64 4, !14, i64 8, !6, i64 16, !10, i64 24, !7, i64 26, !7, i64 27, !6, i64 32}
!33 = !{!"_ZTS11FT_Outline_", !10, i64 0, !10, i64 2, !6, i64 8, !6, i64 16, !6, i64 24, !14, i64 32}
!34 = !{!28, !14, i64 152}
!35 = !{!28, !6, i64 168}
!36 = !{!7, !7, i64 0}
!37 = !{!38, !10, i64 0}
!38 = !{!"_ZTSN3rmg12GlyphMetricsE", !10, i64 0, !10, i64 2, !39, i64 4, !10, i64 8}
!39 = !{!"_ZTSN3rmg5Vec2iE", !10, i64 0, !10, i64 2}
!40 = !{!38, !10, i64 2}
!41 = !{!28, !14, i64 192}
!42 = !{!38, !10, i64 4}
!43 = !{!28, !14, i64 196}
!44 = !{!38, !10, i64 6}
!45 = !{!28, !23, i64 128}
!46 = !{!38, !10, i64 8}
!47 = distinct !{!47, !48}
!48 = !{!"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.rmg::Bitmap" = type { i16, i16, i8, ptr }
%"class.rmg::internal::Pending" = type { ptr, ptr }
%"struct.rmg::GlyphMetrics" = type { i16, i16, %"struct.rmg::Vec2i", i16 }
%"struct.rmg::Vec2i" = type { i16, i16 }

@_ZN3rmg4Font6lastIDE = external dso_local local_unnamed_addr global i32, align 4
@_ZTVN3rmg4FontE = external dso_local unnamed_addr constant { [4 x ptr] }, align 8
@.str = external hidden unnamed_addr constant [24 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [60 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3rmg4FontC2EPNS_7ContextEPKct(ptr noundef nonnull align 8 dereferenceable(2618) %0, ptr noundef %1, ptr noundef %2, i16 noundef zeroext %3) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %"class.rmg::Bitmap", align 8
  %8 = alloca %"class.rmg::Bitmap", align 8
  %9 = alloca %"class.rmg::internal::Pending", align 8
  store ptr getelementptr inbounds inrange(-16, 16) (i8, ptr @_ZTVN3rmg4FontE, i64 16), ptr %0, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void @_ZN3rmg8internal13SpriteTextureC1Ev(ptr noundef nonnull align 8 dereferenceable(12) %10)
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  tail call void @_ZN3rmg8internal7PendingC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %11) #9
  %.ptr47 = getelementptr inbounds i8, ptr %0, i64 58
  br label %12

12:                                               ; preds = %13, %4
  %.idx = phi i64 [ 58, %4 ], [ %.add, %13 ]
  %.ptr = getelementptr inbounds i8, ptr %0, i64 %.idx
  invoke void @_ZN3rmg12GlyphMetricsC2Ev(ptr noundef nonnull align 2 dereferenceable(10) %.ptr)
          to label %13 unwind label %23

13:                                               ; preds = %12
  %.add = add nuw nsw i64 %.idx, 10
  %14 = icmp eq i64 %.add, 2618
  br i1 %14, label %15, label %12

15:                                               ; preds = %13
  %16 = load i32, ptr @_ZN3rmg4Font6lastIDE, align 4, !tbaa !8
  %17 = add i32 %16, 1
  store i32 %17, ptr @_ZN3rmg4Font6lastIDE, align 4, !tbaa !8
  %18 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %17, ptr %18, align 8, !tbaa !11
  %19 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr %1, ptr %19, align 8, !tbaa !17
  %20 = icmp eq ptr %2, null
  %spec.store.select = select i1 %20, ptr @.str, ptr %2
  %21 = getelementptr inbounds i8, ptr %0, i64 56
  store i16 %3, ptr %21, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #9
  %22 = invoke i32 @FT_Init_FreeType(ptr noundef nonnull %5)
          to label %25 unwind label %28

23:                                               ; preds = %12
  %24 = landingpad { ptr, i32 }
          cleanup
  br label %130

25:                                               ; preds = %15
  %.not = icmp eq i32 %22, 0
  br i1 %.not, label %30, label %26

26:                                               ; preds = %25
  %27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %117

28:                                               ; preds = %15
  %29 = landingpad { ptr, i32 }
          cleanup
  br label %129

30:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #9
  %31 = load ptr, ptr %5, align 8, !tbaa !19
  %32 = invoke i32 @FT_New_Face(ptr noundef %31, ptr noundef nonnull %spec.store.select, i64 noundef 0, ptr noundef nonnull %6)
          to label %33 unwind label %36

33:                                               ; preds = %30
  %.not48 = icmp eq i32 %32, 0
  br i1 %.not48, label %38, label %34

34:                                               ; preds = %33
  %35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef nonnull %spec.store.select)
  br label %116

36:                                               ; preds = %38, %30
  %37 = landingpad { ptr, i32 }
          cleanup
  br label %128

38:                                               ; preds = %33
  %39 = load ptr, ptr %6, align 8, !tbaa !19
  %40 = load i16, ptr %21, align 8, !tbaa !18
  %41 = zext i16 %40 to i32
  %42 = invoke i32 @FT_Set_Pixel_Sizes(ptr noundef %39, i32 noundef 0, i32 noundef %41)
          to label %43 unwind label %36

43:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #9
  %44 = load i16, ptr %21, align 8, !tbaa !18
  %45 = shl i16 %44, 4
  invoke void @_ZN3rmg6BitmapC1Etth(ptr noundef nonnull align 8 dereferenceable(16) %7, i16 noundef zeroext %45, i16 noundef zeroext %45, i8 noundef zeroext 1)
          to label %.preheader unwind label %49

46:                                               ; preds = %102
  %47 = load ptr, ptr %6, align 8, !tbaa !19
  %48 = invoke i32 @FT_Done_Face(ptr noundef %47)
          to label %107 unwind label %118

49:                                               ; preds = %43
  %50 = landingpad { ptr, i32 }
          cleanup
  br label %127

.preheader:                                       ; preds = %43, %102
  %indvars.iv = phi i64 [ %indvars.iv.next, %102 ], [ 0, %43 ]
  %51 = load ptr, ptr %6, align 8, !tbaa !19
  %52 = invoke i32 @FT_Load_Char(ptr noundef %51, i64 noundef %indvars.iv, i32 noundef 4)
          to label %53 unwind label %54

53:                                               ; preds = %.preheader
  %.not50 = icmp eq i32 %52, 0
  br i1 %.not50, label %56, label %102

54:                                               ; preds = %.preheader
  %55 = landingpad { ptr, i32 }
          cleanup
  br label %126

56:                                               ; preds = %53
  %57 = load ptr, ptr %6, align 8, !tbaa !19
  %58 = getelementptr inbounds i8, ptr %57, i64 152
  %59 = load ptr, ptr %58, align 8, !tbaa !20
  %60 = getelementptr inbounds i8, ptr %59, i64 152
  %61 = getelementptr inbounds i8, ptr %59, i64 156
  %62 = load i32, ptr %61, align 4, !tbaa !26
  %63 = trunc i32 %62 to i16
  %64 = load i32, ptr %60, align 8, !tbaa !33
  %65 = trunc i32 %64 to i16
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #9
  %66 = getelementptr inbounds i8, ptr %59, i64 168
  %67 = load ptr, ptr %66, align 8, !tbaa !34
  invoke void @_ZN3rmg6BitmapC1EtthPh(ptr noundef nonnull align 8 dereferenceable(16) %8, i16 noundef zeroext %63, i16 noundef zeroext %65, i8 noundef zeroext 1, ptr noundef %67)
          to label %68 unwind label %76

68:                                               ; preds = %56
  %69 = and i32 %62, 65535
  %70 = load i16, ptr %21, align 8, !tbaa !18
  %71 = zext i16 %70 to i32
  %72 = icmp ugt i32 %69, %71
  %73 = and i32 %64, 65535
  %74 = icmp ugt i32 %73, %71
  %or.cond = or i1 %72, %74
  br i1 %or.cond, label %75, label %80

75:                                               ; preds = %68
  %spec.select = select i1 %72, i16 %70, i16 %63
  %.039 = select i1 %74, i16 %70, i16 %65
  invoke void @_ZN3rmg6Bitmap4cropEsstt(ptr noundef nonnull align 8 dereferenceable(16) %8, i16 noundef signext 0, i16 noundef signext 0, i16 noundef zeroext %spec.select, i16 noundef zeroext %.039)
          to label %._crit_edge unwind label %78

._crit_edge:                                      ; preds = %75
  %.pre = load i16, ptr %21, align 8, !tbaa !18
  br label %80

76:                                               ; preds = %56
  %77 = landingpad { ptr, i32 }
          cleanup
  br label %106

78:                                               ; preds = %75
  %79 = landingpad { ptr, i32 }
          cleanup
  br label %105

80:                                               ; preds = %._crit_edge, %68
  %81 = phi i16 [ %.pre, %._crit_edge ], [ %70, %68 ]
  %.142 = phi i16 [ %spec.select, %._crit_edge ], [ %63, %68 ]
  %.140 = phi i16 [ %.039, %._crit_edge ], [ %65, %68 ]
  %82 = trunc i64 %indvars.iv to i16
  %83 = and i16 %82, 15
  %84 = mul i16 %81, %83
  %85 = lshr i64 %indvars.iv, 4
  %86 = trunc i64 %85 to i16
  %87 = mul i16 %81, %86
  invoke void @_ZN3rmg6Bitmap5pasteERKS0_ss(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(16) %8, i16 noundef signext %84, i16 noundef signext %87)
          to label %88 unwind label %103

88:                                               ; preds = %80
  %89 = getelementptr inbounds [256 x %"struct.rmg::GlyphMetrics"], ptr %.ptr47, i64 0, i64 %indvars.iv
  store i16 %.142, ptr %89, align 2, !tbaa !35
  %90 = getelementptr inbounds i8, ptr %89, i64 2
  store i16 %.140, ptr %90, align 2, !tbaa !38
  %91 = load ptr, ptr %6, align 8, !tbaa !19
  %92 = getelementptr inbounds i8, ptr %91, i64 152
  %93 = load ptr, ptr %92, align 8, !tbaa !20
  %94 = getelementptr inbounds i8, ptr %93, i64 192
  %95 = getelementptr inbounds i8, ptr %89, i64 4
  %96 = load <2 x i32>, ptr %94, align 8, !tbaa !8
  %97 = trunc <2 x i32> %96 to <2 x i16>
  store <2 x i16> %97, ptr %95, align 2, !tbaa !39
  %98 = getelementptr inbounds i8, ptr %93, i64 128
  %99 = load i64, ptr %98, align 8, !tbaa !40
  %100 = trunc i64 %99 to i16
  %101 = getelementptr inbounds i8, ptr %89, i64 8
  store i16 %100, ptr %101, align 2, !tbaa !41
  call void @_ZN3rmg6BitmapD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #9
  br label %102

102:                                              ; preds = %53, %88
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 256
  br i1 %exitcond.not, label %46, label %.preheader, !llvm.loop !42

103:                                              ; preds = %80
  %104 = landingpad { ptr, i32 }
          cleanup
  br label %105

105:                                              ; preds = %103, %78
  %.pn51 = phi { ptr, i32 } [ %104, %103 ], [ %79, %78 ]
  call void @_ZN3rmg6BitmapD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #9
  br label %106

106:                                              ; preds = %105, %76
  %.pn51.pn = phi { ptr, i32 } [ %.pn51, %105 ], [ %77, %76 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #9
  br label %126

107:                                              ; preds = %46
  %108 = load ptr, ptr %5, align 8, !tbaa !19
  %109 = invoke i32 @FT_Done_FreeType(ptr noundef %108)
          to label %110 unwind label %118

110:                                              ; preds = %107
  %111 = invoke noalias noundef nonnull dereferenceable(40) ptr @_Znwm(i64 noundef 40) #10
          to label %112 unwind label %120

112:                                              ; preds = %110
  invoke void @_ZN3rmg8internal10SpriteLoadC1EPNS0_13SpriteTextureERKNS_6BitmapE(ptr noundef nonnull align 8 dereferenceable(36) %111, ptr noundef nonnull %10, ptr noundef nonnull align 8 dereferenceable(16) %7)
          to label %113 unwind label %122

113:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #9
  invoke void @_ZN3rmg8internal7PendingC1EPNS0_11ContextLoadE(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull %111)
          to label %114 unwind label %124

114:                                              ; preds = %113
  %115 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN3rmg8internal7PendingaSEOS1_(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 8 dereferenceable(16) %9) #9
  call void @_ZN3rmg8internal7PendingD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #9
  call void @_ZN3rmg6BitmapD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #9
  br label %116

116:                                              ; preds = %114, %34
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #9
  br label %117

117:                                              ; preds = %116, %26
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #9
  ret void

118:                                              ; preds = %107, %46
  %119 = landingpad { ptr, i32 }
          cleanup
  br label %126

120:                                              ; preds = %110
  %121 = landingpad { ptr, i32 }
          cleanup
  br label %126

122:                                              ; preds = %112
  %123 = landingpad { ptr, i32 }
          cleanup
  call void @_ZdlPvm(ptr noundef nonnull %111, i64 noundef 40) #11
  br label %126

124:                                              ; preds = %113
  %125 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #9
  br label %126

126:                                              ; preds = %120, %122, %124, %54, %106, %118
  %.pn51.pn.pn.pn = phi { ptr, i32 } [ %119, %118 ], [ %.pn51.pn, %106 ], [ %55, %54 ], [ %125, %124 ], [ %123, %122 ], [ %121, %120 ]
  call void @_ZN3rmg6BitmapD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #9
  br label %127

127:                                              ; preds = %126, %49
  %.pn51.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn51.pn.pn.pn, %126 ], [ %50, %49 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #9
  br label %128

128:                                              ; preds = %127, %36
  %.pn51.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn51.pn.pn.pn.pn, %127 ], [ %37, %36 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #9
  br label %129

129:                                              ; preds = %128, %28
  %.pn51.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn51.pn.pn.pn.pn.pn, %128 ], [ %29, %28 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #9
  br label %130

130:                                              ; preds = %129, %23
  %.pn51.pn.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn51.pn.pn.pn.pn.pn.pn, %129 ], [ %24, %23 ]
  call void @_ZN3rmg8internal7PendingD1Ev(ptr noundef nonnull align 8 dereferenceable(16) %11) #9
  call void @_ZN3rmg8internal13SpriteTextureD1Ev(ptr noundef nonnull align 8 dereferenceable(12) %10) #9
  resume { ptr, i32 } %.pn51.pn.pn.pn.pn.pn.pn.pn
}

declare void @_ZN3rmg8internal13SpriteTextureC1Ev(ptr noundef nonnull align 8 dereferenceable(12)) unnamed_addr #1

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

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

declare i32 @__gxx_personality_v0(...)

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

declare i32 @FT_Init_FreeType(ptr noundef) local_unnamed_addr #1

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

declare i32 @FT_New_Face(ptr noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #1

declare i32 @FT_Set_Pixel_Sizes(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

declare void @_ZN3rmg6BitmapC1Etth(ptr noundef nonnull align 8 dereferenceable(16), i16 noundef zeroext, i16 noundef zeroext, i8 noundef zeroext) unnamed_addr #1

declare i32 @FT_Load_Char(ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #1

declare void @_ZN3rmg6BitmapC1EtthPh(ptr noundef nonnull align 8 dereferenceable(16), i16 noundef zeroext, i16 noundef zeroext, i8 noundef zeroext, ptr noundef) unnamed_addr #1

declare void @_ZN3rmg6Bitmap4cropEsstt(ptr noundef nonnull align 8 dereferenceable(16), i16 noundef signext, i16 noundef signext, i16 noundef zeroext, i16 noundef zeroext) local_unnamed_addr #1

declare void @_ZN3rmg6Bitmap5pasteERKS0_ss(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16), i16 noundef signext, i16 noundef signext) local_unnamed_addr #1

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

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

declare i32 @FT_Done_Face(ptr noundef) local_unnamed_addr #1

declare i32 @FT_Done_FreeType(ptr noundef) local_unnamed_addr #1

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

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

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

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

; Function Attrs: nounwind
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZN3rmg8internal7PendingaSEOS1_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #6

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

; Function Attrs: nounwind
declare void @_ZN3rmg8internal13SpriteTextureD1Ev(ptr noundef nonnull align 8 dereferenceable(12)) unnamed_addr #6

attributes #0 = { 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 #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 = { 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 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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 = { 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 #8 = { 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 #9 = { nounwind }
attributes #10 = { builtin allocsize(0) }
attributes #11 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !9, i64 8}
!12 = !{!"_ZTSN3rmg4FontE", !9, i64 8, !13, i64 16, !14, i64 24, !15, i64 40, !16, i64 56, !10, i64 58}
!13 = !{!"any pointer", !10, i64 0}
!14 = !{!"_ZTSN3rmg8internal13SpriteTextureE", !9, i64 8}
!15 = !{!"_ZTSN3rmg8internal7PendingE", !13, i64 0, !13, i64 8}
!16 = !{!"short", !10, i64 0}
!17 = !{!12, !13, i64 16}
!18 = !{!12, !16, i64 56}
!19 = !{!13, !13, i64 0}
!20 = !{!21, !13, i64 152}
!21 = !{!"_ZTS11FT_FaceRec_", !22, i64 0, !22, i64 8, !22, i64 16, !22, i64 24, !22, i64 32, !13, i64 40, !13, i64 48, !9, i64 56, !13, i64 64, !9, i64 72, !13, i64 80, !23, i64 88, !24, i64 104, !16, i64 136, !16, i64 138, !16, i64 140, !16, i64 142, !16, i64 144, !16, i64 146, !16, i64 148, !16, i64 150, !13, i64 152, !13, i64 160, !13, i64 168, !13, i64 176, !13, i64 184, !13, i64 192, !25, i64 200, !23, i64 216, !13, i64 232, !13, i64 240}
!22 = !{!"long", !10, i64 0}
!23 = !{!"_ZTS11FT_Generic_", !13, i64 0, !13, i64 8}
!24 = !{!"_ZTS8FT_BBox_", !22, i64 0, !22, i64 8, !22, i64 16, !22, i64 24}
!25 = !{!"_ZTS11FT_ListRec_", !13, i64 0, !13, i64 8}
!26 = !{!27, !9, i64 156}
!27 = !{!"_ZTS16FT_GlyphSlotRec_", !13, i64 0, !13, i64 8, !13, i64 16, !9, i64 24, !23, i64 32, !28, i64 48, !22, i64 112, !22, i64 120, !29, i64 128, !30, i64 144, !31, i64 152, !9, i64 192, !9, i64 196, !32, i64 200, !9, i64 240, !13, i64 248, !13, i64 256, !22, i64 264, !22, i64 272, !22, i64 280, !13, i64 288, !13, i64 296}
!28 = !{!"_ZTS17FT_Glyph_Metrics_", !22, i64 0, !22, i64 8, !22, i64 16, !22, i64 24, !22, i64 32, !22, i64 40, !22, i64 48, !22, i64 56}
!29 = !{!"_ZTS10FT_Vector_", !22, i64 0, !22, i64 8}
!30 = !{!"_ZTS16FT_Glyph_Format_", !10, i64 0}
!31 = !{!"_ZTS10FT_Bitmap_", !9, i64 0, !9, i64 4, !9, i64 8, !13, i64 16, !16, i64 24, !10, i64 26, !10, i64 27, !13, i64 32}
!32 = !{!"_ZTS11FT_Outline_", !16, i64 0, !16, i64 2, !13, i64 8, !13, i64 16, !13, i64 24, !9, i64 32}
!33 = !{!27, !9, i64 152}
!34 = !{!27, !13, i64 168}
!35 = !{!36, !16, i64 0}
!36 = !{!"_ZTSN3rmg12GlyphMetricsE", !16, i64 0, !16, i64 2, !37, i64 4, !16, i64 8}
!37 = !{!"_ZTSN3rmg5Vec2iE", !16, i64 0, !16, i64 2}
!38 = !{!36, !16, i64 2}
!39 = !{!16, !16, i64 0}
!40 = !{!27, !22, i64 128}
!41 = !{!36, !16, i64 8}
!42 = distinct !{!42, !43}
!43 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass