; LLVM IR from BrunoLevy/learn-fpga :: LiteX/software/Tagl/Lib/gport.ll (ZN11GraphicPort14ScaleBuffer256EPhii)

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

%struct.Pixel24.1 = type { i8, i8, i8 }

@_ZN16GraphicComponent16_bytes_per_pixelE = external global i32, align 4
@_ZN16GraphicComponent10_graph_memE = external global ptr, align 8
@_ZN16GraphicComponent15_bytes_per_lineE = external global i32, align 4
@_ZN16GraphicComponent7_heightE = external global i32, align 4
@_ZN16GraphicComponent6_widthE = external global i32, align 4
@_ZN16GraphicComponent9_colormapE = external global [256 x i8], align 16
@_ZN16GraphicComponent13_truecolormapE = external global [256 x i32], align 16
@.str.7 = external hidden unnamed_addr constant [35 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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11GraphicPort14ScaleBuffer256EPhii(ptr noundef nonnull align 8 dereferenceable(14128) %0, ptr noundef %1, i32 noundef %2, i32 noundef %3) unnamed_addr #3 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %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 ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !9
  %21 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %22, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %23 = load ptr, ptr @_ZN16GraphicComponent10_graph_memE, align 8, !tbaa !5
  store ptr %23, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %24 = load i32, ptr %7, align 4, !tbaa !9
  %25 = shl i32 %24, 1
  %26 = load i32, ptr @_ZN16GraphicComponent6_widthE, align 4, !tbaa !9
  %27 = sub nsw i32 %25, %26
  store i32 %27, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %28 = load i32, ptr %8, align 4, !tbaa !9
  %29 = shl i32 %28, 1
  %30 = load i32, ptr @_ZN16GraphicComponent7_heightE, align 4, !tbaa !9
  %31 = sub nsw i32 %29, %30
  store i32 %31, ptr %16, align 4, !tbaa !9
  %32 = load i32, ptr @_ZN16GraphicComponent16_bytes_per_pixelE, align 4, !tbaa !9
  switch i32 %32, label %297 [
    i32 1, label %33
    i32 2, label %99
    i32 3, label %166
    i32 4, label %231
  ]

33:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %91, %33
  %35 = load i32, ptr %12, align 4, !tbaa !9
  %36 = load i32, ptr @_ZN16GraphicComponent7_heightE, align 4, !tbaa !9
  %37 = icmp slt i32 %35, %36
  br i1 %37, label %38, label %98

38:                                               ; preds = %34
  %39 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %39, ptr %15, align 4, !tbaa !9
  %40 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %40, ptr %17, align 8, !tbaa !5
  %41 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %41, ptr %9, align 8, !tbaa !5
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %42

42:                                               ; preds = %68, %38
  %43 = load i32, ptr %13, align 4, !tbaa !9
  %44 = load i32, ptr @_ZN16GraphicComponent6_widthE, align 4, !tbaa !9
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %46, label %73

46:                                               ; preds = %42
  %47 = load ptr, ptr %9, align 8, !tbaa !5
  %48 = load i8, ptr %47, align 1, !tbaa !11
  %49 = zext i8 %48 to i64
  %50 = getelementptr inbounds [256 x i8], ptr @_ZN16GraphicComponent9_colormapE, i64 0, i64 %49
  %51 = load i8, ptr %50, align 1, !tbaa !11
  %52 = load ptr, ptr %17, align 8, !tbaa !5
  store i8 %51, ptr %52, align 1, !tbaa !11
  br label %53

53:                                               ; preds = %56, %46
  %54 = load i32, ptr %15, align 4, !tbaa !9
  %55 = icmp sge i32 %54, 0
  br i1 %55, label %56, label %63

56:                                               ; preds = %53
  %57 = load ptr, ptr %9, align 8, !tbaa !5
  %58 = getelementptr inbounds i8, ptr %57, i32 1
  store ptr %58, ptr %9, align 8, !tbaa !5
  %59 = load i32, ptr @_ZN16GraphicComponent6_widthE, align 4, !tbaa !9
  %60 = shl i32 %59, 1
  %61 = load i32, ptr %15, align 4, !tbaa !9
  %62 = sub nsw i32 %61, %60
  store i32 %62, ptr %15, align 4, !tbaa !9
  br label %53, !llvm.loop !12

63:                                               ; preds = %53
  %64 = load i32, ptr %7, align 4, !tbaa !9
  %65 = shl i32 %64, 1
  %66 = load i32, ptr %15, align 4, !tbaa !9
  %67 = add nsw i32 %66, %65
  store i32 %67, ptr %15, align 4, !tbaa !9
  br label %68

68:                                               ; preds = %63
  %69 = load i32, ptr %13, align 4, !tbaa !9
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %13, align 4, !tbaa !9
  %71 = load ptr, ptr %17, align 8, !tbaa !5
  %72 = getelementptr inbounds i8, ptr %71, i32 1
  store ptr %72, ptr %17, align 8, !tbaa !5
  br label %42, !llvm.loop !14

73:                                               ; preds = %42
  br label %74

74:                                               ; preds = %77, %73
  %75 = load i32, ptr %16, align 4, !tbaa !9
  %76 = icmp sge i32 %75, 0
  br i1 %76, label %77, label %86

77:                                               ; preds = %74
  %78 = load i32, ptr %7, align 4, !tbaa !9
  %79 = load ptr, ptr %10, align 8, !tbaa !5
  %80 = sext i32 %78 to i64
  %81 = getelementptr inbounds i8, ptr %79, i64 %80
  store ptr %81, ptr %10, align 8, !tbaa !5
  %82 = load i32, ptr @_ZN16GraphicComponent7_heightE, align 4, !tbaa !9
  %83 = shl i32 %82, 1
  %84 = load i32, ptr %16, align 4, !tbaa !9
  %85 = sub nsw i32 %84, %83
  store i32 %85, ptr %16, align 4, !tbaa !9
  br label %74, !llvm.loop !15

86:                                               ; preds = %74
  %87 = load i32, ptr %8, align 4, !tbaa !9
  %88 = shl i32 %87, 1
  %89 = load i32, ptr %16, align 4, !tbaa !9
  %90 = add nsw i32 %89, %88
  store i32 %90, ptr %16, align 4, !tbaa !9
  br label %91

91:                                               ; preds = %86
  %92 = load i32, ptr %12, align 4, !tbaa !9
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %12, align 4, !tbaa !9
  %94 = load i32, ptr @_ZN16GraphicComponent15_bytes_per_lineE, align 4, !tbaa !9
  %95 = load ptr, ptr %11, align 8, !tbaa !5
  %96 = sext i32 %94 to i64
  %97 = getelementptr inbounds i8, ptr %95, i64 %96
  store ptr %97, ptr %11, align 8, !tbaa !5
  br label %34, !llvm.loop !16

98:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  br label %300

99:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %100

100:                                              ; preds = %158, %99
  %101 = load i32, ptr %12, align 4, !tbaa !9
  %102 = load i32, ptr @_ZN16GraphicComponent7_heightE, align 4, !tbaa !9
  %103 = icmp slt i32 %101, %102
  br i1 %103, label %104, label %165

104:                                              ; preds = %100
  %105 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %105, ptr %15, align 4, !tbaa !9
  %106 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %106, ptr %18, align 8, !tbaa !5
  %107 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %107, ptr %9, align 8, !tbaa !5
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %108

108:                                              ; preds = %135, %104
  %109 = load i32, ptr %13, align 4, !tbaa !9
  %110 = load i32, ptr @_ZN16GraphicComponent6_widthE, align 4, !tbaa !9
  %111 = icmp slt i32 %109, %110
  br i1 %111, label %112, label %140

112:                                              ; preds = %108
  %113 = load ptr, ptr %9, align 8, !tbaa !5
  %114 = load i8, ptr %113, align 1, !tbaa !11
  %115 = zext i8 %114 to i64
  %116 = getelementptr inbounds [256 x i32], ptr @_ZN16GraphicComponent13_truecolormapE, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !9
  %118 = trunc i32 %117 to i16
  %119 = load ptr, ptr %18, align 8, !tbaa !5
  store i16 %118, ptr %119, align 2, !tbaa !17
  br label %120

120:                                              ; preds = %123, %112
  %121 = load i32, ptr %15, align 4, !tbaa !9
  %122 = icmp sge i32 %121, 0
  br i1 %122, label %123, label %130

123:                                              ; preds = %120
  %124 = load ptr, ptr %9, align 8, !tbaa !5
  %125 = getelementptr inbounds i8, ptr %124, i32 1
  store ptr %125, ptr %9, align 8, !tbaa !5
  %126 = load i32, ptr @_ZN16GraphicComponent6_widthE, align 4, !tbaa !9
  %127 = shl i32 %126, 1
  %128 = load i32, ptr %15, align 4, !tbaa !9
  %129 = sub nsw i32 %128, %127
  store i32 %129, ptr %15, align 4, !tbaa !9
  br label %120, !llvm.loop !19

130:                                              ; preds = %120
  %131 = load i32, ptr %7, align 4, !tbaa !9
  %132 = shl i32 %131, 1
  %133 = load i32, ptr %15, align 4, !tbaa !9
  %134 = add nsw i32 %133, %132
  store i32 %134, ptr %15, align 4, !tbaa !9
  br label %135

135:                                              ; preds = %130
  %136 = load i32, ptr %13, align 4, !tbaa !9
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %13, align 4, !tbaa !9
  %138 = load ptr, ptr %18, align 8, !tbaa !5
  %139 = getelementptr inbounds i16, ptr %138, i32 1
  store ptr %139, ptr %18, align 8, !tbaa !5
  br label %108, !llvm.loop !20

140:                                              ; preds = %108
  br label %141

141:                                              ; preds = %144, %140
  %142 = load i32, ptr %16, align 4, !tbaa !9
  %143 = icmp sge i32 %142, 0
  br i1 %143, label %144, label %153

144:                                              ; preds = %141
  %145 = load i32, ptr %7, align 4, !tbaa !9
  %146 = load ptr, ptr %10, align 8, !tbaa !5
  %147 = sext i32 %145 to i64
  %148 = getelementptr inbounds i8, ptr %146, i64 %147
  store ptr %148, ptr %10, align 8, !tbaa !5
  %149 = load i32, ptr @_ZN16GraphicComponent7_heightE, align 4, !tbaa !9
  %150 = shl i32 %149, 1
  %151 = load i32, ptr %16, align 4, !tbaa !9
  %152 = sub nsw i32 %151, %150
  store i32 %152, ptr %16, align 4, !tbaa !9
  br label %141, !llvm.loop !21

153:                                              ; preds = %141
  %154 = load i32, ptr %8, align 4, !tbaa !9
  %155 = shl i32 %154, 1
  %156 = load i32, ptr %16, align 4, !tbaa !9
  %157 = add nsw i32 %156, %155
  store i32 %157, ptr %16, align 4, !tbaa !9
  br label %158

158:                                              ; preds = %153
  %159 = load i32, ptr %12, align 4, !tbaa !9
  %160 = add nsw i32 %159, 1
  store i32 %160, ptr %12, align 4, !tbaa !9
  %161 = load i32, ptr @_ZN16GraphicComponent15_bytes_per_lineE, align 4, !tbaa !9
  %162 = load ptr, ptr %11, align 8, !tbaa !5
  %163 = sext i32 %161 to i64
  %164 = getelementptr inbounds i8, ptr %162, i64 %163
  store ptr %164, ptr %11, align 8, !tbaa !5
  br label %100, !llvm.loop !22

165:                                              ; preds = %100
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  br label %300

166:                                              ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %167

167:                                              ; preds = %223, %166
  %168 = load i32, ptr %12, align 4, !tbaa !9
  %169 = load i32, ptr @_ZN16GraphicComponent7_heightE, align 4, !tbaa !9
  %170 = icmp slt i32 %168, %169
  br i1 %170, label %171, label %230

171:                                              ; preds = %167
  %172 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %172, ptr %15, align 4, !tbaa !9
  %173 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %173, ptr %19, align 8, !tbaa !5
  %174 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %174, ptr %9, align 8, !tbaa !5
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %175

175:                                              ; preds = %200, %171
  %176 = load i32, ptr %13, align 4, !tbaa !9
  %177 = load i32, ptr @_ZN16GraphicComponent6_widthE, align 4, !tbaa !9
  %178 = icmp slt i32 %176, %177
  br i1 %178, label %179, label %205

179:                                              ; preds = %175
  %180 = load ptr, ptr %9, align 8, !tbaa !5
  %181 = load i8, ptr %180, align 1, !tbaa !11
  %182 = zext i8 %181 to i64
  %183 = getelementptr inbounds [256 x i32], ptr @_ZN16GraphicComponent13_truecolormapE, i64 0, i64 %182
  %184 = load ptr, ptr %19, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %184, ptr align 4 %183, i64 3, i1 false), !tbaa.struct !23
  br label %185

185:                                              ; preds = %188, %179
  %186 = load i32, ptr %15, align 4, !tbaa !9
  %187 = icmp sge i32 %186, 0
  br i1 %187, label %188, label %195

188:                                              ; preds = %185
  %189 = load ptr, ptr %9, align 8, !tbaa !5
  %190 = getelementptr inbounds i8, ptr %189, i32 1
  store ptr %190, ptr %9, align 8, !tbaa !5
  %191 = load i32, ptr @_ZN16GraphicComponent6_widthE, align 4, !tbaa !9
  %192 = shl i32 %191, 1
  %193 = load i32, ptr %15, align 4, !tbaa !9
  %194 = sub nsw i32 %193, %192
  store i32 %194, ptr %15, align 4, !tbaa !9
  br label %185, !llvm.loop !24

195:                                              ; preds = %185
  %196 = load i32, ptr %7, align 4, !tbaa !9
  %197 = shl i32 %196, 1
  %198 = load i32, ptr %15, align 4, !tbaa !9
  %199 = add nsw i32 %198, %197
  store i32 %199, ptr %15, align 4, !tbaa !9
  br label %200

200:                                              ; preds = %195
  %201 = load i32, ptr %13, align 4, !tbaa !9
  %202 = add nsw i32 %201, 1
  store i32 %202, ptr %13, align 4, !tbaa !9
  %203 = load ptr, ptr %19, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.Pixel24.1, ptr %203, i32 1
  store ptr %204, ptr %19, align 8, !tbaa !5
  br label %175, !llvm.loop !25

205:                                              ; preds = %175
  br label %206

206:                                              ; preds = %209, %205
  %207 = load i32, ptr %16, align 4, !tbaa !9
  %208 = icmp sge i32 %207, 0
  br i1 %208, label %209, label %218

209:                                              ; preds = %206
  %210 = load i32, ptr %7, align 4, !tbaa !9
  %211 = load ptr, ptr %10, align 8, !tbaa !5
  %212 = sext i32 %210 to i64
  %213 = getelementptr inbounds i8, ptr %211, i64 %212
  store ptr %213, ptr %10, align 8, !tbaa !5
  %214 = load i32, ptr @_ZN16GraphicComponent7_heightE, align 4, !tbaa !9
  %215 = shl i32 %214, 1
  %216 = load i32, ptr %16, align 4, !tbaa !9
  %217 = sub nsw i32 %216, %215
  store i32 %217, ptr %16, align 4, !tbaa !9
  br label %206, !llvm.loop !26

218:                                              ; preds = %206
  %219 = load i32, ptr %8, align 4, !tbaa !9
  %220 = shl i32 %219, 1
  %221 = load i32, ptr %16, align 4, !tbaa !9
  %222 = add nsw i32 %221, %220
  store i32 %222, ptr %16, align 4, !tbaa !9
  br label %223

223:                                              ; preds = %218
  %224 = load i32, ptr %12, align 4, !tbaa !9
  %225 = add nsw i32 %224, 1
  store i32 %225, ptr %12, align 4, !tbaa !9
  %226 = load i32, ptr @_ZN16GraphicComponent15_bytes_per_lineE, align 4, !tbaa !9
  %227 = load ptr, ptr %11, align 8, !tbaa !5
  %228 = sext i32 %226 to i64
  %229 = getelementptr inbounds i8, ptr %227, i64 %228
  store ptr %229, ptr %11, align 8, !tbaa !5
  br label %167, !llvm.loop !27

230:                                              ; preds = %167
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  br label %300

231:                                              ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %232

232:                                              ; preds = %289, %231
  %233 = load i32, ptr %12, align 4, !tbaa !9
  %234 = load i32, ptr @_ZN16GraphicComponent7_heightE, align 4, !tbaa !9
  %235 = icmp slt i32 %233, %234
  br i1 %235, label %236, label %296

236:                                              ; preds = %232
  %237 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %237, ptr %15, align 4, !tbaa !9
  %238 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %238, ptr %20, align 8, !tbaa !5
  %239 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %239, ptr %9, align 8, !tbaa !5
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %240

240:                                              ; preds = %266, %236
  %241 = load i32, ptr %13, align 4, !tbaa !9
  %242 = load i32, ptr @_ZN16GraphicComponent6_widthE, align 4, !tbaa !9
  %243 = icmp slt i32 %241, %242
  br i1 %243, label %244, label %271

244:                                              ; preds = %240
  %245 = load ptr, ptr %9, align 8, !tbaa !5
  %246 = load i8, ptr %245, align 1, !tbaa !11
  %247 = zext i8 %246 to i64
  %248 = getelementptr inbounds [256 x i32], ptr @_ZN16GraphicComponent13_truecolormapE, i64 0, i64 %247
  %249 = load i32, ptr %248, align 4, !tbaa !9
  %250 = load ptr, ptr %20, align 8, !tbaa !5
  store i32 %249, ptr %250, align 4, !tbaa !9
  br label %251

251:                                              ; preds = %254, %244
  %252 = load i32, ptr %15, align 4, !tbaa !9
  %253 = icmp sge i32 %252, 0
  br i1 %253, label %254, label %261

254:                                              ; preds = %251
  %255 = load ptr, ptr %9, align 8, !tbaa !5
  %256 = getelementptr inbounds i8, ptr %255, i32 1
  store ptr %256, ptr %9, align 8, !tbaa !5
  %257 = load i32, ptr @_ZN16GraphicComponent6_widthE, align 4, !tbaa !9
  %258 = shl i32 %257, 1
  %259 = load i32, ptr %15, align 4, !tbaa !9
  %260 = sub nsw i32 %259, %258
  store i32 %260, ptr %15, align 4, !tbaa !9
  br label %251, !llvm.loop !28

261:                                              ; preds = %251
  %262 = load i32, ptr %7, align 4, !tbaa !9
  %263 = shl i32 %262, 1
  %264 = load i32, ptr %15, align 4, !tbaa !9
  %265 = add nsw i32 %264, %263
  store i32 %265, ptr %15, align 4, !tbaa !9
  br label %266

266:                                              ; preds = %261
  %267 = load i32, ptr %13, align 4, !tbaa !9
  %268 = add nsw i32 %267, 1
  store i32 %268, ptr %13, align 4, !tbaa !9
  %269 = load ptr, ptr %20, align 8, !tbaa !5
  %270 = getelementptr inbounds i32, ptr %269, i32 1
  store ptr %270, ptr %20, align 8, !tbaa !5
  br label %240, !llvm.loop !29

271:                                              ; preds = %240
  br label %272

272:                                              ; preds = %275, %271
  %273 = load i32, ptr %16, align 4, !tbaa !9
  %274 = icmp sge i32 %273, 0
  br i1 %274, label %275, label %284

275:                                              ; preds = %272
  %276 = load i32, ptr %7, align 4, !tbaa !9
  %277 = load ptr, ptr %10, align 8, !tbaa !5
  %278 = sext i32 %276 to i64
  %279 = getelementptr inbounds i8, ptr %277, i64 %278
  store ptr %279, ptr %10, align 8, !tbaa !5
  %280 = load i32, ptr @_ZN16GraphicComponent7_heightE, align 4, !tbaa !9
  %281 = shl i32 %280, 1
  %282 = load i32, ptr %16, align 4, !tbaa !9
  %283 = sub nsw i32 %282, %281
  store i32 %283, ptr %16, align 4, !tbaa !9
  br label %272, !llvm.loop !30

284:                                              ; preds = %272
  %285 = load i32, ptr %8, align 4, !tbaa !9
  %286 = shl i32 %285, 1
  %287 = load i32, ptr %16, align 4, !tbaa !9
  %288 = add nsw i32 %287, %286
  store i32 %288, ptr %16, align 4, !tbaa !9
  br label %289

289:                                              ; preds = %284
  %290 = load i32, ptr %12, align 4, !tbaa !9
  %291 = add nsw i32 %290, 1
  store i32 %291, ptr %12, align 4, !tbaa !9
  %292 = load i32, ptr @_ZN16GraphicComponent15_bytes_per_lineE, align 4, !tbaa !9
  %293 = load ptr, ptr %11, align 8, !tbaa !5
  %294 = sext i32 %292 to i64
  %295 = getelementptr inbounds i8, ptr %293, i64 %294
  store ptr %295, ptr %11, align 8, !tbaa !5
  br label %232, !llvm.loop !31

296:                                              ; preds = %232
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  br label %300

297:                                              ; preds = %4
  %298 = call noundef nonnull align 8 dereferenceable(8624) ptr @_ZN16GraphicComponentixEi(ptr noundef nonnull align 8 dereferenceable(8624) %21, i32 noundef 1)
  %299 = call noundef nonnull align 8 dereferenceable(8624) ptr @_ZN16GraphicComponentlsEPKc(ptr noundef nonnull align 8 dereferenceable(8624) %298, ptr noundef @.str.7)
  br label %300

300:                                              ; preds = %297, %296, %230, %165, %98
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { 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 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
!17 = !{!18, !18, i64 0}
!18 = !{!"short", !7, i64 0}
!19 = distinct !{!19, !13}
!20 = distinct !{!20, !13}
!21 = distinct !{!21, !13}
!22 = distinct !{!22, !13}
!23 = !{i64 0, i64 1, !11, i64 1, i64 1, !11, i64 2, i64 1, !11}
!24 = distinct !{!24, !13}
!25 = distinct !{!25, !13}
!26 = distinct !{!26, !13}
!27 = distinct !{!27, !13}
!28 = distinct !{!28, !13}
!29 = distinct !{!29, !13}
!30 = distinct !{!30, !13}
!31 = distinct !{!31, !13}


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

@_ZN16GraphicComponent16_bytes_per_pixelE = external local_unnamed_addr global i32, align 4
@_ZN16GraphicComponent10_graph_memE = external local_unnamed_addr global ptr, align 8
@_ZN16GraphicComponent15_bytes_per_lineE = external local_unnamed_addr global i32, align 4
@_ZN16GraphicComponent7_heightE = external local_unnamed_addr global i32, align 4
@_ZN16GraphicComponent6_widthE = external local_unnamed_addr global i32, align 4
@_ZN16GraphicComponent9_colormapE = external local_unnamed_addr global [256 x i8], align 16
@_ZN16GraphicComponent13_truecolormapE = external local_unnamed_addr global [256 x i32], align 16
@.str.7 = external hidden unnamed_addr constant [35 x i8], align 1

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11GraphicPort14ScaleBuffer256EPhii(ptr noundef nonnull align 8 dereferenceable(14128) %0, ptr nocapture noundef readonly %1, i32 noundef %2, i32 noundef %3) unnamed_addr #2 align 2 {
  %5 = load ptr, ptr @_ZN16GraphicComponent10_graph_memE, align 8, !tbaa !5
  %6 = shl i32 %2, 1
  %7 = load i32, ptr @_ZN16GraphicComponent6_widthE, align 4, !tbaa !9
  %8 = sub nsw i32 %6, %7
  %9 = shl i32 %3, 1
  %10 = load i32, ptr @_ZN16GraphicComponent7_heightE, align 4
  %11 = sub nsw i32 %9, %10
  %12 = load i32, ptr @_ZN16GraphicComponent16_bytes_per_pixelE, align 4, !tbaa !9
  switch i32 %12, label %152 [
    i32 1, label %.preheader132
    i32 2, label %.preheader135
    i32 3, label %.preheader139
    i32 4, label %.preheader143
  ]

.preheader143:                                    ; preds = %4
  %13 = icmp sgt i32 %10, 0
  br i1 %13, label %.preheader142.lr.ph, label %.loopexit

.preheader142.lr.ph:                              ; preds = %.preheader143
  %14 = sext i32 %2 to i64
  %15 = icmp sgt i32 %7, 0
  br i1 %15, label %.preheader142, label %.loopexit

.preheader139:                                    ; preds = %4
  %16 = icmp sgt i32 %10, 0
  br i1 %16, label %.preheader138.lr.ph, label %.loopexit

.preheader138.lr.ph:                              ; preds = %.preheader139
  %17 = sext i32 %2 to i64
  %18 = icmp sgt i32 %7, 0
  br i1 %18, label %.preheader138, label %.loopexit

.preheader135:                                    ; preds = %4
  %19 = icmp sgt i32 %10, 0
  br i1 %19, label %.preheader134.lr.ph, label %.loopexit

.preheader134.lr.ph:                              ; preds = %.preheader135
  %20 = icmp sgt i32 %7, 0
  %21 = shl i32 %7, 1
  %22 = sext i32 %2 to i64
  %23 = shl nuw i32 %10, 1
  %24 = load i32, ptr @_ZN16GraphicComponent15_bytes_per_lineE, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  br i1 %20, label %.preheader134.us.preheader, label %.loopexit

.preheader134.us.preheader:                       ; preds = %.preheader134.lr.ph
  %xtraiter = and i32 %7, 1
  %26 = icmp eq i32 %7, 1
  %unroll_iter = and i32 %7, 2147483646
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br label %.preheader134.us

.preheader134.us:                                 ; preds = %.preheader134.us.preheader, %._crit_edge200.us
  %.2206.us = phi i32 [ %27, %._crit_edge200.us ], [ %11, %.preheader134.us.preheader ]
  %.1116205.us = phi i32 [ %28, %._crit_edge200.us ], [ 0, %.preheader134.us.preheader ]
  %.1120204.us = phi ptr [ %29, %._crit_edge200.us ], [ %5, %.preheader134.us.preheader ]
  %.2125203.us = phi ptr [ %.3126.lcssa.us, %._crit_edge200.us ], [ %1, %.preheader134.us.preheader ]
  br i1 %26, label %..preheader133_crit_edge.us.unr-lcssa, label %.preheader134.us.new

._crit_edge200.us:                                ; preds = %.lr.ph199.us, %..preheader133_crit_edge.us
  %.3126.lcssa.us = phi ptr [ %.2125203.us, %..preheader133_crit_edge.us ], [ %30, %.lr.ph199.us ]
  %.3.lcssa.us = phi i32 [ %.2206.us, %..preheader133_crit_edge.us ], [ %31, %.lr.ph199.us ]
  %27 = add nsw i32 %.3.lcssa.us, %9
  %28 = add nuw nsw i32 %.1116205.us, 1
  %29 = getelementptr inbounds i8, ptr %.1120204.us, i64 %25
  %exitcond256.not = icmp eq i32 %28, %10
  br i1 %exitcond256.not, label %.loopexit, label %.preheader134.us, !llvm.loop !11

.lr.ph199.us:                                     ; preds = %..preheader133_crit_edge.us, %.lr.ph199.us
  %.3198.us = phi i32 [ %31, %.lr.ph199.us ], [ %.2206.us, %..preheader133_crit_edge.us ]
  %.3126197.us = phi ptr [ %30, %.lr.ph199.us ], [ %.2125203.us, %..preheader133_crit_edge.us ]
  %30 = getelementptr inbounds i8, ptr %.3126197.us, i64 %22
  %31 = sub nsw i32 %.3198.us, %23
  %32 = icmp sgt i32 %31, -1
  br i1 %32, label %.lr.ph199.us, label %._crit_edge200.us, !llvm.loop !13

.preheader134.us.new:                             ; preds = %.preheader134.us, %._crit_edge189.us.1
  %.092195.us = phi ptr [ %51, %._crit_edge189.us.1 ], [ %.1120204.us, %.preheader134.us ]
  %.297194.us = phi i32 [ %50, %._crit_edge189.us.1 ], [ %8, %.preheader134.us ]
  %.2105193.us = phi ptr [ %.3106.lcssa.us.1, %._crit_edge189.us.1 ], [ %.2125203.us, %.preheader134.us ]
  %niter = phi i32 [ %niter.next.1, %._crit_edge189.us.1 ], [ 0, %.preheader134.us ]
  %33 = load i8, ptr %.2105193.us, align 1, !tbaa !14
  %34 = zext i8 %33 to i64
  %35 = getelementptr inbounds [256 x i32], ptr @_ZN16GraphicComponent13_truecolormapE, i64 0, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !9
  %37 = trunc i32 %36 to i16
  store i16 %37, ptr %.092195.us, align 2, !tbaa !15
  %38 = icmp sgt i32 %.297194.us, -1
  br i1 %38, label %.lr.ph188.us, label %._crit_edge189.us

._crit_edge189.us:                                ; preds = %.lr.ph188.us, %.preheader134.us.new
  %.3106.lcssa.us = phi ptr [ %.2105193.us, %.preheader134.us.new ], [ %52, %.lr.ph188.us ]
  %.398.lcssa.us = phi i32 [ %.297194.us, %.preheader134.us.new ], [ %53, %.lr.ph188.us ]
  %39 = add nsw i32 %.398.lcssa.us, %6
  %40 = getelementptr inbounds i8, ptr %.092195.us, i64 2
  %41 = load i8, ptr %.3106.lcssa.us, align 1, !tbaa !14
  %42 = zext i8 %41 to i64
  %43 = getelementptr inbounds [256 x i32], ptr @_ZN16GraphicComponent13_truecolormapE, i64 0, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !9
  %45 = trunc i32 %44 to i16
  store i16 %45, ptr %40, align 2, !tbaa !15
  %46 = icmp sgt i32 %39, -1
  br i1 %46, label %.lr.ph188.us.1, label %._crit_edge189.us.1

.lr.ph188.us.1:                                   ; preds = %._crit_edge189.us, %.lr.ph188.us.1
  %.398186.us.1 = phi i32 [ %48, %.lr.ph188.us.1 ], [ %39, %._crit_edge189.us ]
  %.3106185.us.1 = phi ptr [ %47, %.lr.ph188.us.1 ], [ %.3106.lcssa.us, %._crit_edge189.us ]
  %47 = getelementptr inbounds i8, ptr %.3106185.us.1, i64 1
  %48 = sub nsw i32 %.398186.us.1, %21
  %49 = icmp sgt i32 %48, -1
  br i1 %49, label %.lr.ph188.us.1, label %._crit_edge189.us.1, !llvm.loop !17

._crit_edge189.us.1:                              ; preds = %.lr.ph188.us.1, %._crit_edge189.us
  %.3106.lcssa.us.1 = phi ptr [ %.3106.lcssa.us, %._crit_edge189.us ], [ %47, %.lr.ph188.us.1 ]
  %.398.lcssa.us.1 = phi i32 [ %39, %._crit_edge189.us ], [ %48, %.lr.ph188.us.1 ]
  %50 = add nsw i32 %.398.lcssa.us.1, %6
  %51 = getelementptr inbounds i8, ptr %.092195.us, i64 4
  %niter.next.1 = add i32 %niter, 2
  %niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %..preheader133_crit_edge.us.unr-lcssa, label %.preheader134.us.new, !llvm.loop !18

.lr.ph188.us:                                     ; preds = %.preheader134.us.new, %.lr.ph188.us
  %.398186.us = phi i32 [ %53, %.lr.ph188.us ], [ %.297194.us, %.preheader134.us.new ]
  %.3106185.us = phi ptr [ %52, %.lr.ph188.us ], [ %.2105193.us, %.preheader134.us.new ]
  %52 = getelementptr inbounds i8, ptr %.3106185.us, i64 1
  %53 = sub nsw i32 %.398186.us, %21
  %54 = icmp sgt i32 %53, -1
  br i1 %54, label %.lr.ph188.us, label %._crit_edge189.us, !llvm.loop !17

..preheader133_crit_edge.us.unr-lcssa:            ; preds = %._crit_edge189.us.1, %.preheader134.us
  %.092195.us.unr = phi ptr [ %.1120204.us, %.preheader134.us ], [ %51, %._crit_edge189.us.1 ]
  %.297194.us.unr = phi i32 [ %8, %.preheader134.us ], [ %50, %._crit_edge189.us.1 ]
  %.2105193.us.unr = phi ptr [ %.2125203.us, %.preheader134.us ], [ %.3106.lcssa.us.1, %._crit_edge189.us.1 ]
  br i1 %lcmp.mod.not, label %..preheader133_crit_edge.us, label %.epil.preheader

.epil.preheader:                                  ; preds = %..preheader133_crit_edge.us.unr-lcssa
  %55 = load i8, ptr %.2105193.us.unr, align 1, !tbaa !14
  %56 = zext i8 %55 to i64
  %57 = getelementptr inbounds [256 x i32], ptr @_ZN16GraphicComponent13_truecolormapE, i64 0, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !9
  %59 = trunc i32 %58 to i16
  store i16 %59, ptr %.092195.us.unr, align 2, !tbaa !15
  %60 = icmp sgt i32 %.297194.us.unr, -1
  br i1 %60, label %.lr.ph188.us.epil, label %..preheader133_crit_edge.us

.lr.ph188.us.epil:                                ; preds = %.epil.preheader, %.lr.ph188.us.epil
  %.398186.us.epil = phi i32 [ %61, %.lr.ph188.us.epil ], [ %.297194.us.unr, %.epil.preheader ]
  %61 = sub nsw i32 %.398186.us.epil, %21
  %62 = icmp sgt i32 %61, -1
  br i1 %62, label %.lr.ph188.us.epil, label %..preheader133_crit_edge.us, !llvm.loop !17

..preheader133_crit_edge.us:                      ; preds = %.epil.preheader, %.lr.ph188.us.epil, %..preheader133_crit_edge.us.unr-lcssa
  %63 = icmp sgt i32 %.2206.us, -1
  br i1 %63, label %.lr.ph199.us, label %._crit_edge200.us

.preheader132:                                    ; preds = %4
  %64 = icmp sgt i32 %10, 0
  br i1 %64, label %.preheader131.lr.ph, label %.loopexit

.preheader131.lr.ph:                              ; preds = %.preheader132
  %65 = sext i32 %2 to i64
  br label %.preheader131

.preheader131:                                    ; preds = %.preheader131.lr.ph, %._crit_edge222
  %.pre261266 = phi i32 [ %10, %.preheader131.lr.ph ], [ %.pre261, %._crit_edge222 ]
  %66 = phi i32 [ %7, %.preheader131.lr.ph ], [ %68, %._crit_edge222 ]
  %.094228 = phi i32 [ %11, %.preheader131.lr.ph ], [ %89, %._crit_edge222 ]
  %.0115227 = phi i32 [ 0, %.preheader131.lr.ph ], [ %90, %._crit_edge222 ]
  %.0119226 = phi ptr [ %5, %.preheader131.lr.ph ], [ %93, %._crit_edge222 ]
  %.0123225 = phi ptr [ %1, %.preheader131.lr.ph ], [ %.1124.lcssa, %._crit_edge222 ]
  %67 = icmp sgt i32 %66, 0
  br i1 %67, label %.lr.ph218, label %.preheader

.preheader.loopexit:                              ; preds = %._crit_edge211
  %.pre261.pre = load i32, ptr @_ZN16GraphicComponent7_heightE, align 4, !tbaa !9
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit, %.preheader131
  %.pre261 = phi i32 [ %.pre261.pre, %.preheader.loopexit ], [ %.pre261266, %.preheader131 ]
  %68 = phi i32 [ %.pre260, %.preheader.loopexit ], [ %66, %.preheader131 ]
  %69 = icmp sgt i32 %.094228, -1
  br i1 %69, label %.lr.ph221, label %._crit_edge222

.lr.ph221:                                        ; preds = %.preheader
  %70 = shl i32 %.pre261, 1
  br label %85

.lr.ph218:                                        ; preds = %.preheader131, %._crit_edge211
  %.093217 = phi ptr [ %83, %._crit_edge211 ], [ %.0119226, %.preheader131 ]
  %.095216 = phi i32 [ %81, %._crit_edge211 ], [ %8, %.preheader131 ]
  %.0103215 = phi ptr [ %.1104.lcssa, %._crit_edge211 ], [ %.0123225, %.preheader131 ]
  %.0111214 = phi i32 [ %82, %._crit_edge211 ], [ 0, %.preheader131 ]
  %71 = load i8, ptr %.0103215, align 1, !tbaa !14
  %72 = zext i8 %71 to i64
  %73 = getelementptr inbounds [256 x i8], ptr @_ZN16GraphicComponent9_colormapE, i64 0, i64 %72
  %74 = load i8, ptr %73, align 1, !tbaa !14
  store i8 %74, ptr %.093217, align 1, !tbaa !14
  %75 = icmp sgt i32 %.095216, -1
  %.pre260 = load i32, ptr @_ZN16GraphicComponent6_widthE, align 4, !tbaa !9
  br i1 %75, label %.lr.ph210, label %._crit_edge211

.lr.ph210:                                        ; preds = %.lr.ph218
  %76 = shl i32 %.pre260, 1
  br label %77

77:                                               ; preds = %.lr.ph210, %77
  %.196208 = phi i32 [ %.095216, %.lr.ph210 ], [ %79, %77 ]
  %.1104207 = phi ptr [ %.0103215, %.lr.ph210 ], [ %78, %77 ]
  %78 = getelementptr inbounds i8, ptr %.1104207, i64 1
  %79 = sub nsw i32 %.196208, %76
  %80 = icmp sgt i32 %79, -1
  br i1 %80, label %77, label %._crit_edge211, !llvm.loop !19

._crit_edge211:                                   ; preds = %77, %.lr.ph218
  %.1104.lcssa = phi ptr [ %.0103215, %.lr.ph218 ], [ %78, %77 ]
  %.196.lcssa = phi i32 [ %.095216, %.lr.ph218 ], [ %79, %77 ]
  %81 = add nsw i32 %.196.lcssa, %6
  %82 = add nuw nsw i32 %.0111214, 1
  %83 = getelementptr inbounds i8, ptr %.093217, i64 1
  %84 = icmp slt i32 %82, %.pre260
  br i1 %84, label %.lr.ph218, label %.preheader.loopexit, !llvm.loop !20

85:                                               ; preds = %.lr.ph221, %85
  %.1220 = phi i32 [ %.094228, %.lr.ph221 ], [ %87, %85 ]
  %.1124219 = phi ptr [ %.0123225, %.lr.ph221 ], [ %86, %85 ]
  %86 = getelementptr inbounds i8, ptr %.1124219, i64 %65
  %87 = sub nsw i32 %.1220, %70
  %88 = icmp sgt i32 %87, -1
  br i1 %88, label %85, label %._crit_edge222, !llvm.loop !21

._crit_edge222:                                   ; preds = %85, %.preheader
  %.1124.lcssa = phi ptr [ %.0123225, %.preheader ], [ %86, %85 ]
  %.1.lcssa = phi i32 [ %.094228, %.preheader ], [ %87, %85 ]
  %89 = add nsw i32 %.1.lcssa, %9
  %90 = add nuw nsw i32 %.0115227, 1
  %91 = load i32, ptr @_ZN16GraphicComponent15_bytes_per_lineE, align 4, !tbaa !9
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds i8, ptr %.0119226, i64 %92
  %94 = icmp slt i32 %90, %.pre261
  br i1 %94, label %.preheader131, label %.loopexit, !llvm.loop !22

.preheader138:                                    ; preds = %.preheader138.lr.ph, %._crit_edge178
  %.pre259264 = phi i32 [ %.pre259, %._crit_edge178 ], [ %10, %.preheader138.lr.ph ]
  %95 = phi i32 [ %97, %._crit_edge178 ], [ %7, %.preheader138.lr.ph ]
  %.4184 = phi i32 [ %117, %._crit_edge178 ], [ %11, %.preheader138.lr.ph ]
  %.2117183 = phi i32 [ %118, %._crit_edge178 ], [ 0, %.preheader138.lr.ph ]
  %.2121182 = phi ptr [ %121, %._crit_edge178 ], [ %5, %.preheader138.lr.ph ]
  %.4127181 = phi ptr [ %.5128.lcssa, %._crit_edge178 ], [ %1, %.preheader138.lr.ph ]
  %96 = icmp sgt i32 %95, 0
  br i1 %96, label %.lr.ph174, label %.preheader137

.preheader137.loopexit:                           ; preds = %._crit_edge167
  %.pre259.pre = load i32, ptr @_ZN16GraphicComponent7_heightE, align 4, !tbaa !9
  br label %.preheader137

.preheader137:                                    ; preds = %.preheader137.loopexit, %.preheader138
  %.pre259 = phi i32 [ %.pre259.pre, %.preheader137.loopexit ], [ %.pre259264, %.preheader138 ]
  %97 = phi i32 [ %.pre258, %.preheader137.loopexit ], [ %95, %.preheader138 ]
  %98 = icmp sgt i32 %.4184, -1
  br i1 %98, label %.lr.ph177, label %._crit_edge178

.lr.ph177:                                        ; preds = %.preheader137
  %99 = shl i32 %.pre259, 1
  br label %113

.lr.ph174:                                        ; preds = %.preheader138, %._crit_edge167
  %.091173 = phi ptr [ %111, %._crit_edge167 ], [ %.2121182, %.preheader138 ]
  %.499172 = phi i32 [ %109, %._crit_edge167 ], [ %8, %.preheader138 ]
  %.4107171 = phi ptr [ %.5108.lcssa, %._crit_edge167 ], [ %.4127181, %.preheader138 ]
  %.2113170 = phi i32 [ %110, %._crit_edge167 ], [ 0, %.preheader138 ]
  %100 = load i8, ptr %.4107171, align 1, !tbaa !14
  %101 = zext i8 %100 to i64
  %102 = getelementptr inbounds [256 x i32], ptr @_ZN16GraphicComponent13_truecolormapE, i64 0, i64 %101
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(3) %.091173, ptr noundef nonnull align 4 dereferenceable(3) %102, i64 3, i1 false), !tbaa.struct !23
  %103 = icmp sgt i32 %.499172, -1
  %.pre258 = load i32, ptr @_ZN16GraphicComponent6_widthE, align 4, !tbaa !9
  br i1 %103, label %.lr.ph166, label %._crit_edge167

.lr.ph166:                                        ; preds = %.lr.ph174
  %104 = shl i32 %.pre258, 1
  br label %105

105:                                              ; preds = %.lr.ph166, %105
  %.5100164 = phi i32 [ %.499172, %.lr.ph166 ], [ %107, %105 ]
  %.5108163 = phi ptr [ %.4107171, %.lr.ph166 ], [ %106, %105 ]
  %106 = getelementptr inbounds i8, ptr %.5108163, i64 1
  %107 = sub nsw i32 %.5100164, %104
  %108 = icmp sgt i32 %107, -1
  br i1 %108, label %105, label %._crit_edge167, !llvm.loop !24

._crit_edge167:                                   ; preds = %105, %.lr.ph174
  %.5108.lcssa = phi ptr [ %.4107171, %.lr.ph174 ], [ %106, %105 ]
  %.5100.lcssa = phi i32 [ %.499172, %.lr.ph174 ], [ %107, %105 ]
  %109 = add nsw i32 %.5100.lcssa, %6
  %110 = add nuw nsw i32 %.2113170, 1
  %111 = getelementptr inbounds i8, ptr %.091173, i64 3
  %112 = icmp slt i32 %110, %.pre258
  br i1 %112, label %.lr.ph174, label %.preheader137.loopexit, !llvm.loop !25

113:                                              ; preds = %.lr.ph177, %113
  %.5176 = phi i32 [ %.4184, %.lr.ph177 ], [ %115, %113 ]
  %.5128175 = phi ptr [ %.4127181, %.lr.ph177 ], [ %114, %113 ]
  %114 = getelementptr inbounds i8, ptr %.5128175, i64 %17
  %115 = sub nsw i32 %.5176, %99
  %116 = icmp sgt i32 %115, -1
  br i1 %116, label %113, label %._crit_edge178, !llvm.loop !26

._crit_edge178:                                   ; preds = %113, %.preheader137
  %.5128.lcssa = phi ptr [ %.4127181, %.preheader137 ], [ %114, %113 ]
  %.5.lcssa = phi i32 [ %.4184, %.preheader137 ], [ %115, %113 ]
  %117 = add nsw i32 %.5.lcssa, %9
  %118 = add nuw nsw i32 %.2117183, 1
  %119 = load i32, ptr @_ZN16GraphicComponent15_bytes_per_lineE, align 4, !tbaa !9
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds i8, ptr %.2121182, i64 %120
  %122 = icmp slt i32 %118, %.pre259
  br i1 %122, label %.preheader138, label %.loopexit, !llvm.loop !27

.preheader142:                                    ; preds = %.preheader142.lr.ph, %._crit_edge156
  %.pre257262 = phi i32 [ %.pre257, %._crit_edge156 ], [ %10, %.preheader142.lr.ph ]
  %123 = phi i32 [ %125, %._crit_edge156 ], [ %7, %.preheader142.lr.ph ]
  %.6162 = phi i32 [ %146, %._crit_edge156 ], [ %11, %.preheader142.lr.ph ]
  %.3118161 = phi i32 [ %147, %._crit_edge156 ], [ 0, %.preheader142.lr.ph ]
  %.3122160 = phi ptr [ %150, %._crit_edge156 ], [ %5, %.preheader142.lr.ph ]
  %.6129159 = phi ptr [ %.7130.lcssa, %._crit_edge156 ], [ %1, %.preheader142.lr.ph ]
  %124 = icmp sgt i32 %123, 0
  br i1 %124, label %.lr.ph152, label %.preheader141

.preheader141.loopexit:                           ; preds = %._crit_edge
  %.pre257.pre = load i32, ptr @_ZN16GraphicComponent7_heightE, align 4, !tbaa !9
  br label %.preheader141

.preheader141:                                    ; preds = %.preheader141.loopexit, %.preheader142
  %.pre257 = phi i32 [ %.pre257.pre, %.preheader141.loopexit ], [ %.pre257262, %.preheader142 ]
  %125 = phi i32 [ %.pre, %.preheader141.loopexit ], [ %123, %.preheader142 ]
  %126 = icmp sgt i32 %.6162, -1
  br i1 %126, label %.lr.ph155, label %._crit_edge156

.lr.ph155:                                        ; preds = %.preheader141
  %127 = shl i32 %.pre257, 1
  br label %142

.lr.ph152:                                        ; preds = %.preheader142, %._crit_edge
  %.0151 = phi ptr [ %140, %._crit_edge ], [ %.3122160, %.preheader142 ]
  %.6101150 = phi i32 [ %138, %._crit_edge ], [ %8, %.preheader142 ]
  %.6109149 = phi ptr [ %.7110.lcssa, %._crit_edge ], [ %.6129159, %.preheader142 ]
  %.3114148 = phi i32 [ %139, %._crit_edge ], [ 0, %.preheader142 ]
  %128 = load i8, ptr %.6109149, align 1, !tbaa !14
  %129 = zext i8 %128 to i64
  %130 = getelementptr inbounds [256 x i32], ptr @_ZN16GraphicComponent13_truecolormapE, i64 0, i64 %129
  %131 = load i32, ptr %130, align 4, !tbaa !9
  store i32 %131, ptr %.0151, align 4, !tbaa !9
  %132 = icmp sgt i32 %.6101150, -1
  %.pre = load i32, ptr @_ZN16GraphicComponent6_widthE, align 4, !tbaa !9
  br i1 %132, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph152
  %133 = shl i32 %.pre, 1
  br label %134

134:                                              ; preds = %.lr.ph, %134
  %.7102146 = phi i32 [ %.6101150, %.lr.ph ], [ %136, %134 ]
  %.7110145 = phi ptr [ %.6109149, %.lr.ph ], [ %135, %134 ]
  %135 = getelementptr inbounds i8, ptr %.7110145, i64 1
  %136 = sub nsw i32 %.7102146, %133
  %137 = icmp sgt i32 %136, -1
  br i1 %137, label %134, label %._crit_edge, !llvm.loop !29

._crit_edge:                                      ; preds = %134, %.lr.ph152
  %.7110.lcssa = phi ptr [ %.6109149, %.lr.ph152 ], [ %135, %134 ]
  %.7102.lcssa = phi i32 [ %.6101150, %.lr.ph152 ], [ %136, %134 ]
  %138 = add nsw i32 %.7102.lcssa, %6
  %139 = add nuw nsw i32 %.3114148, 1
  %140 = getelementptr inbounds i8, ptr %.0151, i64 4
  %141 = icmp slt i32 %139, %.pre
  br i1 %141, label %.lr.ph152, label %.preheader141.loopexit, !llvm.loop !30

142:                                              ; preds = %.lr.ph155, %142
  %.7154 = phi i32 [ %.6162, %.lr.ph155 ], [ %144, %142 ]
  %.7130153 = phi ptr [ %.6129159, %.lr.ph155 ], [ %143, %142 ]
  %143 = getelementptr inbounds i8, ptr %.7130153, i64 %14
  %144 = sub nsw i32 %.7154, %127
  %145 = icmp sgt i32 %144, -1
  br i1 %145, label %142, label %._crit_edge156, !llvm.loop !31

._crit_edge156:                                   ; preds = %142, %.preheader141
  %.7130.lcssa = phi ptr [ %.6129159, %.preheader141 ], [ %143, %142 ]
  %.7.lcssa = phi i32 [ %.6162, %.preheader141 ], [ %144, %142 ]
  %146 = add nsw i32 %.7.lcssa, %9
  %147 = add nuw nsw i32 %.3118161, 1
  %148 = load i32, ptr @_ZN16GraphicComponent15_bytes_per_lineE, align 4, !tbaa !9
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds i8, ptr %.3122160, i64 %149
  %151 = icmp slt i32 %147, %.pre257
  br i1 %151, label %.preheader142, label %.loopexit, !llvm.loop !32

152:                                              ; preds = %4
  %153 = tail call noundef nonnull align 8 dereferenceable(8624) ptr @_ZN16GraphicComponentixEi(ptr noundef nonnull align 8 dereferenceable(8624) %0, i32 noundef 1)
  %154 = tail call noundef nonnull align 8 dereferenceable(8624) ptr @_ZN16GraphicComponentlsEPKc(ptr noundef nonnull align 8 dereferenceable(8624) %153, ptr noundef nonnull @.str.7)
  br label %.loopexit

.loopexit:                                        ; preds = %._crit_edge156, %._crit_edge178, %._crit_edge200.us, %._crit_edge222, %.preheader134.lr.ph, %.preheader138.lr.ph, %.preheader142.lr.ph, %.preheader143, %.preheader139, %.preheader135, %.preheader132, %152
  ret void
}

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

!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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!7, !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"short", !7, i64 0}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}
!23 = !{i64 0, i64 1, !14, i64 1, i64 1, !14, i64 2, i64 1, !14}
!24 = distinct !{!24, !12}
!25 = distinct !{!25, !12}
!26 = distinct !{!26, !12}
!27 = distinct !{!27, !12, !28}
!28 = !{!"llvm.loop.unswitch.partial.disable"}
!29 = distinct !{!29, !12}
!30 = distinct !{!30, !12}
!31 = distinct !{!31, !12}
!32 = distinct !{!32, !12, !28}


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