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

; 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.0 = 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 @_ZN11GraphicPort13CopyBuffer256EPh(ptr noundef nonnull align 8 dereferenceable(14128) %0, ptr noundef %1) unnamed_addr #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %16 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %17, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %18 = load i32, ptr @_ZN16GraphicComponent16_bytes_per_pixelE, align 4, !tbaa !9
  switch i32 %18, label %151 [
    i32 1, label %19
    i32 2, label %52
    i32 3, label %86
    i32 4, label %118
  ]

19:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %20 = load ptr, ptr @_ZN16GraphicComponent10_graph_memE, align 8, !tbaa !5
  store ptr %20, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %21

21:                                               ; preds = %44, %19
  %22 = load i32, ptr %7, align 4, !tbaa !9
  %23 = load i32, ptr @_ZN16GraphicComponent7_heightE, align 4, !tbaa !9
  %24 = icmp slt i32 %22, %23
  br i1 %24, label %25, label %51

25:                                               ; preds = %21
  store i32 0, ptr %6, align 4, !tbaa !9
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %26, ptr %9, align 8, !tbaa !5
  br label %27

27:                                               ; preds = %40, %25
  %28 = load i32, ptr %6, align 4, !tbaa !9
  %29 = load i32, ptr @_ZN16GraphicComponent6_widthE, align 4, !tbaa !9
  %30 = icmp slt i32 %28, %29
  br i1 %30, label %31, label %43

31:                                               ; preds = %27
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds i8, ptr %32, i32 1
  store ptr %33, ptr %5, align 8, !tbaa !5
  %34 = load i8, ptr %32, align 1, !tbaa !11
  %35 = zext i8 %34 to i64
  %36 = getelementptr inbounds [256 x i8], ptr @_ZN16GraphicComponent9_colormapE, i64 0, i64 %35
  %37 = load i8, ptr %36, align 1, !tbaa !11
  %38 = load ptr, ptr %9, align 8, !tbaa !5
  %39 = getelementptr inbounds i8, ptr %38, i32 1
  store ptr %39, ptr %9, align 8, !tbaa !5
  store i8 %37, ptr %38, align 1, !tbaa !11
  br label %40

40:                                               ; preds = %31
  %41 = load i32, ptr %6, align 4, !tbaa !9
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %6, align 4, !tbaa !9
  br label %27, !llvm.loop !12

43:                                               ; preds = %27
  br label %44

44:                                               ; preds = %43
  %45 = load i32, ptr %7, align 4, !tbaa !9
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %7, align 4, !tbaa !9
  %47 = load i32, ptr @_ZN16GraphicComponent15_bytes_per_lineE, align 4, !tbaa !9
  %48 = load ptr, ptr %8, align 8, !tbaa !5
  %49 = sext i32 %47 to i64
  %50 = getelementptr inbounds i8, ptr %48, i64 %49
  store ptr %50, ptr %8, align 8, !tbaa !5
  br label %21, !llvm.loop !14

51:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %154

52:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %53 = load ptr, ptr @_ZN16GraphicComponent10_graph_memE, align 8, !tbaa !5
  store ptr %53, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %54

54:                                               ; preds = %78, %52
  %55 = load i32, ptr %7, align 4, !tbaa !9
  %56 = load i32, ptr @_ZN16GraphicComponent7_heightE, align 4, !tbaa !9
  %57 = icmp slt i32 %55, %56
  br i1 %57, label %58, label %85

58:                                               ; preds = %54
  store i32 0, ptr %6, align 4, !tbaa !9
  %59 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %59, ptr %11, align 8, !tbaa !5
  br label %60

60:                                               ; preds = %74, %58
  %61 = load i32, ptr %6, align 4, !tbaa !9
  %62 = load i32, ptr @_ZN16GraphicComponent6_widthE, align 4, !tbaa !9
  %63 = icmp slt i32 %61, %62
  br i1 %63, label %64, label %77

64:                                               ; preds = %60
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds i8, ptr %65, i32 1
  store ptr %66, ptr %5, align 8, !tbaa !5
  %67 = load i8, ptr %65, align 1, !tbaa !11
  %68 = zext i8 %67 to i64
  %69 = getelementptr inbounds [256 x i32], ptr @_ZN16GraphicComponent13_truecolormapE, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !9
  %71 = trunc i32 %70 to i16
  %72 = load ptr, ptr %11, align 8, !tbaa !5
  %73 = getelementptr inbounds i16, ptr %72, i32 1
  store ptr %73, ptr %11, align 8, !tbaa !5
  store i16 %71, ptr %72, align 2, !tbaa !15
  br label %74

74:                                               ; preds = %64
  %75 = load i32, ptr %6, align 4, !tbaa !9
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %6, align 4, !tbaa !9
  br label %60, !llvm.loop !17

77:                                               ; preds = %60
  br label %78

78:                                               ; preds = %77
  %79 = load i32, ptr %7, align 4, !tbaa !9
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %7, align 4, !tbaa !9
  %81 = load i32, ptr @_ZN16GraphicComponent15_bytes_per_lineE, align 4, !tbaa !9
  %82 = load ptr, ptr %10, align 8, !tbaa !5
  %83 = sext i32 %81 to i64
  %84 = getelementptr inbounds i8, ptr %82, i64 %83
  store ptr %84, ptr %10, align 8, !tbaa !5
  br label %54, !llvm.loop !18

85:                                               ; preds = %54
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %154

86:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %87 = load ptr, ptr @_ZN16GraphicComponent10_graph_memE, align 8, !tbaa !5
  store ptr %87, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %88

88:                                               ; preds = %110, %86
  %89 = load i32, ptr %7, align 4, !tbaa !9
  %90 = load i32, ptr @_ZN16GraphicComponent7_heightE, align 4, !tbaa !9
  %91 = icmp slt i32 %89, %90
  br i1 %91, label %92, label %117

92:                                               ; preds = %88
  store i32 0, ptr %6, align 4, !tbaa !9
  %93 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %93, ptr %13, align 8, !tbaa !5
  br label %94

94:                                               ; preds = %106, %92
  %95 = load i32, ptr %6, align 4, !tbaa !9
  %96 = load i32, ptr @_ZN16GraphicComponent6_widthE, align 4, !tbaa !9
  %97 = icmp slt i32 %95, %96
  br i1 %97, label %98, label %109

98:                                               ; preds = %94
  %99 = load ptr, ptr %5, align 8, !tbaa !5
  %100 = getelementptr inbounds i8, ptr %99, i32 1
  store ptr %100, ptr %5, align 8, !tbaa !5
  %101 = load i8, ptr %99, align 1, !tbaa !11
  %102 = zext i8 %101 to i64
  %103 = getelementptr inbounds [256 x i32], ptr @_ZN16GraphicComponent13_truecolormapE, i64 0, i64 %102
  %104 = load ptr, ptr %13, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.Pixel24.0, ptr %104, i32 1
  store ptr %105, ptr %13, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %104, ptr align 4 %103, i64 3, i1 false), !tbaa.struct !19
  br label %106

106:                                              ; preds = %98
  %107 = load i32, ptr %6, align 4, !tbaa !9
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %6, align 4, !tbaa !9
  br label %94, !llvm.loop !20

109:                                              ; preds = %94
  br label %110

110:                                              ; preds = %109
  %111 = load i32, ptr %7, align 4, !tbaa !9
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr %7, align 4, !tbaa !9
  %113 = load i32, ptr @_ZN16GraphicComponent15_bytes_per_lineE, align 4, !tbaa !9
  %114 = load ptr, ptr %12, align 8, !tbaa !5
  %115 = sext i32 %113 to i64
  %116 = getelementptr inbounds i8, ptr %114, i64 %115
  store ptr %116, ptr %12, align 8, !tbaa !5
  br label %88, !llvm.loop !21

117:                                              ; preds = %88
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %154

118:                                              ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %119 = load ptr, ptr @_ZN16GraphicComponent10_graph_memE, align 8, !tbaa !5
  store ptr %119, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %120

120:                                              ; preds = %143, %118
  %121 = load i32, ptr %7, align 4, !tbaa !9
  %122 = load i32, ptr @_ZN16GraphicComponent7_heightE, align 4, !tbaa !9
  %123 = icmp slt i32 %121, %122
  br i1 %123, label %124, label %150

124:                                              ; preds = %120
  store i32 0, ptr %6, align 4, !tbaa !9
  %125 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %125, ptr %15, align 8, !tbaa !5
  br label %126

126:                                              ; preds = %139, %124
  %127 = load i32, ptr %6, align 4, !tbaa !9
  %128 = load i32, ptr @_ZN16GraphicComponent6_widthE, align 4, !tbaa !9
  %129 = icmp slt i32 %127, %128
  br i1 %129, label %130, label %142

130:                                              ; preds = %126
  %131 = load ptr, ptr %5, align 8, !tbaa !5
  %132 = getelementptr inbounds i8, ptr %131, i32 1
  store ptr %132, ptr %5, align 8, !tbaa !5
  %133 = load i8, ptr %131, align 1, !tbaa !11
  %134 = zext i8 %133 to i64
  %135 = getelementptr inbounds [256 x i32], ptr @_ZN16GraphicComponent13_truecolormapE, i64 0, i64 %134
  %136 = load i32, ptr %135, align 4, !tbaa !9
  %137 = load ptr, ptr %15, align 8, !tbaa !5
  %138 = getelementptr inbounds i32, ptr %137, i32 1
  store ptr %138, ptr %15, align 8, !tbaa !5
  store i32 %136, ptr %137, align 4, !tbaa !9
  br label %139

139:                                              ; preds = %130
  %140 = load i32, ptr %6, align 4, !tbaa !9
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr %6, align 4, !tbaa !9
  br label %126, !llvm.loop !22

142:                                              ; preds = %126
  br label %143

143:                                              ; preds = %142
  %144 = load i32, ptr %7, align 4, !tbaa !9
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %7, align 4, !tbaa !9
  %146 = load i32, ptr @_ZN16GraphicComponent15_bytes_per_lineE, align 4, !tbaa !9
  %147 = load ptr, ptr %14, align 8, !tbaa !5
  %148 = sext i32 %146 to i64
  %149 = getelementptr inbounds i8, ptr %147, i64 %148
  store ptr %149, ptr %14, align 8, !tbaa !5
  br label %120, !llvm.loop !23

150:                                              ; preds = %120
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  br label %154

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

154:                                              ; preds = %151, %150, %117, %85, %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #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 = !{!16, !16, i64 0}
!16 = !{!"short", !7, i64 0}
!17 = distinct !{!17, !13}
!18 = distinct !{!18, !13}
!19 = !{i64 0, i64 1, !11, i64 1, i64 1, !11, i64 2, i64 1, !11}
!20 = distinct !{!20, !13}
!21 = distinct !{!21, !13}
!22 = distinct !{!22, !13}
!23 = distinct !{!23, !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 @_ZN11GraphicPort13CopyBuffer256EPh(ptr noundef nonnull align 8 dereferenceable(14128) %0, ptr nocapture noundef readonly %1) unnamed_addr #2 align 2 {
  %3 = load i32, ptr @_ZN16GraphicComponent16_bytes_per_pixelE, align 4, !tbaa !5
  switch i32 %3, label %124 [
    i32 1, label %4
    i32 2, label %29
    i32 3, label %75
    i32 4, label %99
  ]

4:                                                ; preds = %2
  %5 = load i32, ptr @_ZN16GraphicComponent7_heightE, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.preheader.lr.ph, label %.loopexit

.preheader.lr.ph:                                 ; preds = %4
  %7 = load i32, ptr @_ZN16GraphicComponent6_widthE, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.preheader.preheader, label %.loopexit

.preheader.preheader:                             ; preds = %.preheader.lr.ph
  %9 = load ptr, ptr @_ZN16GraphicComponent10_graph_memE, align 8, !tbaa !9
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge83
  %10 = phi i32 [ %22, %._crit_edge83 ], [ %5, %.preheader.preheader ]
  %11 = phi i32 [ %23, %._crit_edge83 ], [ %7, %.preheader.preheader ]
  %.03987 = phi ptr [ %27, %._crit_edge83 ], [ %9, %.preheader.preheader ]
  %.04086 = phi i32 [ %24, %._crit_edge83 ], [ 0, %.preheader.preheader ]
  %.04585 = phi ptr [ %.146.lcssa, %._crit_edge83 ], [ %1, %.preheader.preheader ]
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph82, label %._crit_edge83

.lr.ph82:                                         ; preds = %.preheader, %.lr.ph82
  %.03881 = phi ptr [ %18, %.lr.ph82 ], [ %.03987, %.preheader ]
  %.04180 = phi i32 [ %19, %.lr.ph82 ], [ 0, %.preheader ]
  %.14679 = phi ptr [ %13, %.lr.ph82 ], [ %.04585, %.preheader ]
  %13 = getelementptr inbounds i8, ptr %.14679, i64 1
  %14 = load i8, ptr %.14679, align 1, !tbaa !11
  %15 = zext i8 %14 to i64
  %16 = getelementptr inbounds [256 x i8], ptr @_ZN16GraphicComponent9_colormapE, i64 0, i64 %15
  %17 = load i8, ptr %16, align 1, !tbaa !11
  %18 = getelementptr inbounds i8, ptr %.03881, i64 1
  store i8 %17, ptr %.03881, align 1, !tbaa !11
  %19 = add nuw nsw i32 %.04180, 1
  %20 = load i32, ptr @_ZN16GraphicComponent6_widthE, align 4, !tbaa !5
  %21 = icmp slt i32 %19, %20
  br i1 %21, label %.lr.ph82, label %._crit_edge83.loopexit, !llvm.loop !12

._crit_edge83.loopexit:                           ; preds = %.lr.ph82
  %.pre100 = load i32, ptr @_ZN16GraphicComponent7_heightE, align 4, !tbaa !5
  br label %._crit_edge83

._crit_edge83:                                    ; preds = %._crit_edge83.loopexit, %.preheader
  %22 = phi i32 [ %10, %.preheader ], [ %.pre100, %._crit_edge83.loopexit ]
  %23 = phi i32 [ %11, %.preheader ], [ %20, %._crit_edge83.loopexit ]
  %.146.lcssa = phi ptr [ %.04585, %.preheader ], [ %13, %._crit_edge83.loopexit ]
  %24 = add nuw nsw i32 %.04086, 1
  %25 = load i32, ptr @_ZN16GraphicComponent15_bytes_per_lineE, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds i8, ptr %.03987, i64 %26
  %28 = icmp slt i32 %24, %22
  br i1 %28, label %.preheader, label %.loopexit, !llvm.loop !14

29:                                               ; preds = %2
  %30 = load i32, ptr @_ZN16GraphicComponent7_heightE, align 4, !tbaa !5
  %31 = icmp sgt i32 %30, 0
  br i1 %31, label %.preheader49.lr.ph, label %.loopexit

.preheader49.lr.ph:                               ; preds = %29
  %32 = load i32, ptr @_ZN16GraphicComponent6_widthE, align 4, !tbaa !5
  %33 = icmp sgt i32 %32, 0
  %34 = load i32, ptr @_ZN16GraphicComponent15_bytes_per_lineE, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  br i1 %33, label %.preheader49.us.preheader, label %.loopexit

.preheader49.us.preheader:                        ; preds = %.preheader49.lr.ph
  %36 = load ptr, ptr @_ZN16GraphicComponent10_graph_memE, align 8, !tbaa !9
  %xtraiter = and i32 %32, 3
  %37 = icmp ult i32 %32, 4
  %unroll_iter = and i32 %32, 2147483644
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br label %.preheader49.us

.preheader49.us:                                  ; preds = %.preheader49.us.preheader, %._crit_edge74.us
  %.03778.us = phi ptr [ %74, %._crit_edge74.us ], [ %36, %.preheader49.us.preheader ]
  %.177.us = phi i32 [ %73, %._crit_edge74.us ], [ 0, %.preheader49.us.preheader ]
  %.24776.us = phi ptr [ %.lcssa121, %._crit_edge74.us ], [ %1, %.preheader49.us.preheader ]
  br i1 %37, label %._crit_edge74.us.unr-lcssa, label %.preheader49.us.new

.preheader49.us.new:                              ; preds = %.preheader49.us, %.preheader49.us.new
  %.03672.us = phi ptr [ %65, %.preheader49.us.new ], [ %.03778.us, %.preheader49.us ]
  %.34870.us = phi ptr [ %59, %.preheader49.us.new ], [ %.24776.us, %.preheader49.us ]
  %niter = phi i32 [ %niter.next.3, %.preheader49.us.new ], [ 0, %.preheader49.us ]
  %38 = getelementptr inbounds i8, ptr %.34870.us, i64 1
  %39 = load i8, ptr %.34870.us, align 1, !tbaa !11
  %40 = zext i8 %39 to i64
  %41 = getelementptr inbounds [256 x i32], ptr @_ZN16GraphicComponent13_truecolormapE, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = trunc i32 %42 to i16
  %44 = getelementptr inbounds i8, ptr %.03672.us, i64 2
  store i16 %43, ptr %.03672.us, align 2, !tbaa !16
  %45 = getelementptr inbounds i8, ptr %.34870.us, i64 2
  %46 = load i8, ptr %38, align 1, !tbaa !11
  %47 = zext i8 %46 to i64
  %48 = getelementptr inbounds [256 x i32], ptr @_ZN16GraphicComponent13_truecolormapE, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = trunc i32 %49 to i16
  %51 = getelementptr inbounds i8, ptr %.03672.us, i64 4
  store i16 %50, ptr %44, align 2, !tbaa !16
  %52 = getelementptr inbounds i8, ptr %.34870.us, i64 3
  %53 = load i8, ptr %45, align 1, !tbaa !11
  %54 = zext i8 %53 to i64
  %55 = getelementptr inbounds [256 x i32], ptr @_ZN16GraphicComponent13_truecolormapE, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = trunc i32 %56 to i16
  %58 = getelementptr inbounds i8, ptr %.03672.us, i64 6
  store i16 %57, ptr %51, align 2, !tbaa !16
  %59 = getelementptr inbounds i8, ptr %.34870.us, i64 4
  %60 = load i8, ptr %52, align 1, !tbaa !11
  %61 = zext i8 %60 to i64
  %62 = getelementptr inbounds [256 x i32], ptr @_ZN16GraphicComponent13_truecolormapE, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = trunc i32 %63 to i16
  %65 = getelementptr inbounds i8, ptr %.03672.us, i64 8
  store i16 %64, ptr %58, align 2, !tbaa !16
  %niter.next.3 = add i32 %niter, 4
  %niter.ncmp.3 = icmp eq i32 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge74.us.unr-lcssa, label %.preheader49.us.new, !llvm.loop !18

._crit_edge74.us.unr-lcssa:                       ; preds = %.preheader49.us.new, %.preheader49.us
  %.lcssa121.ph = phi ptr [ poison, %.preheader49.us ], [ %59, %.preheader49.us.new ]
  %.03672.us.unr = phi ptr [ %.03778.us, %.preheader49.us ], [ %65, %.preheader49.us.new ]
  %.34870.us.unr = phi ptr [ %.24776.us, %.preheader49.us ], [ %59, %.preheader49.us.new ]
  br i1 %lcmp.mod.not, label %._crit_edge74.us, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge74.us.unr-lcssa, %.epil.preheader
  %.03672.us.epil = phi ptr [ %72, %.epil.preheader ], [ %.03672.us.unr, %._crit_edge74.us.unr-lcssa ]
  %.34870.us.epil = phi ptr [ %66, %.epil.preheader ], [ %.34870.us.unr, %._crit_edge74.us.unr-lcssa ]
  %epil.iter = phi i32 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge74.us.unr-lcssa ]
  %66 = getelementptr inbounds i8, ptr %.34870.us.epil, i64 1
  %67 = load i8, ptr %.34870.us.epil, align 1, !tbaa !11
  %68 = zext i8 %67 to i64
  %69 = getelementptr inbounds [256 x i32], ptr @_ZN16GraphicComponent13_truecolormapE, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = trunc i32 %70 to i16
  %72 = getelementptr inbounds i8, ptr %.03672.us.epil, i64 2
  store i16 %71, ptr %.03672.us.epil, align 2, !tbaa !16
  %epil.iter.next = add i32 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge74.us, label %.epil.preheader, !llvm.loop !19

._crit_edge74.us:                                 ; preds = %.epil.preheader, %._crit_edge74.us.unr-lcssa
  %.lcssa121 = phi ptr [ %.lcssa121.ph, %._crit_edge74.us.unr-lcssa ], [ %66, %.epil.preheader ]
  %73 = add nuw nsw i32 %.177.us, 1
  %74 = getelementptr inbounds i8, ptr %.03778.us, i64 %35
  %exitcond98.not = icmp eq i32 %73, %30
  br i1 %exitcond98.not, label %.loopexit, label %.preheader49.us, !llvm.loop !21

75:                                               ; preds = %2
  %76 = load i32, ptr @_ZN16GraphicComponent7_heightE, align 4, !tbaa !5
  %77 = icmp sgt i32 %76, 0
  br i1 %77, label %.preheader51.lr.ph, label %.loopexit

.preheader51.lr.ph:                               ; preds = %75
  %78 = load i32, ptr @_ZN16GraphicComponent6_widthE, align 4, !tbaa !5
  %79 = icmp sgt i32 %78, 0
  br i1 %79, label %.preheader51.preheader, label %.loopexit

.preheader51.preheader:                           ; preds = %.preheader51.lr.ph
  %80 = load ptr, ptr @_ZN16GraphicComponent10_graph_memE, align 8, !tbaa !9
  br label %.preheader51

.preheader51:                                     ; preds = %.preheader51.preheader, %._crit_edge65
  %81 = phi i32 [ %92, %._crit_edge65 ], [ %76, %.preheader51.preheader ]
  %82 = phi i32 [ %93, %._crit_edge65 ], [ %78, %.preheader51.preheader ]
  %.03569 = phi ptr [ %97, %._crit_edge65 ], [ %80, %.preheader51.preheader ]
  %.268 = phi i32 [ %94, %._crit_edge65 ], [ 0, %.preheader51.preheader ]
  %.467 = phi ptr [ %.5.lcssa, %._crit_edge65 ], [ %1, %.preheader51.preheader ]
  %83 = icmp sgt i32 %82, 0
  br i1 %83, label %.lr.ph64, label %._crit_edge65

.lr.ph64:                                         ; preds = %.preheader51, %.lr.ph64
  %.03463 = phi ptr [ %88, %.lr.ph64 ], [ %.03569, %.preheader51 ]
  %.24362 = phi i32 [ %89, %.lr.ph64 ], [ 0, %.preheader51 ]
  %.561 = phi ptr [ %84, %.lr.ph64 ], [ %.467, %.preheader51 ]
  %84 = getelementptr inbounds i8, ptr %.561, i64 1
  %85 = load i8, ptr %.561, align 1, !tbaa !11
  %86 = zext i8 %85 to i64
  %87 = getelementptr inbounds [256 x i32], ptr @_ZN16GraphicComponent13_truecolormapE, i64 0, i64 %86
  %88 = getelementptr inbounds i8, ptr %.03463, i64 3
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(3) %.03463, ptr noundef nonnull align 4 dereferenceable(3) %87, i64 3, i1 false), !tbaa.struct !22
  %89 = add nuw nsw i32 %.24362, 1
  %90 = load i32, ptr @_ZN16GraphicComponent6_widthE, align 4, !tbaa !5
  %91 = icmp slt i32 %89, %90
  br i1 %91, label %.lr.ph64, label %._crit_edge65.loopexit, !llvm.loop !23

._crit_edge65.loopexit:                           ; preds = %.lr.ph64
  %.pre99 = load i32, ptr @_ZN16GraphicComponent7_heightE, align 4, !tbaa !5
  br label %._crit_edge65

._crit_edge65:                                    ; preds = %._crit_edge65.loopexit, %.preheader51
  %92 = phi i32 [ %81, %.preheader51 ], [ %.pre99, %._crit_edge65.loopexit ]
  %93 = phi i32 [ %82, %.preheader51 ], [ %90, %._crit_edge65.loopexit ]
  %.5.lcssa = phi ptr [ %.467, %.preheader51 ], [ %84, %._crit_edge65.loopexit ]
  %94 = add nuw nsw i32 %.268, 1
  %95 = load i32, ptr @_ZN16GraphicComponent15_bytes_per_lineE, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds i8, ptr %.03569, i64 %96
  %98 = icmp slt i32 %94, %92
  br i1 %98, label %.preheader51, label %.loopexit, !llvm.loop !24

99:                                               ; preds = %2
  %100 = load i32, ptr @_ZN16GraphicComponent7_heightE, align 4, !tbaa !5
  %101 = icmp sgt i32 %100, 0
  br i1 %101, label %.preheader53.lr.ph, label %.loopexit

.preheader53.lr.ph:                               ; preds = %99
  %102 = load i32, ptr @_ZN16GraphicComponent6_widthE, align 4, !tbaa !5
  %103 = icmp sgt i32 %102, 0
  br i1 %103, label %.preheader53.preheader, label %.loopexit

.preheader53.preheader:                           ; preds = %.preheader53.lr.ph
  %104 = load ptr, ptr @_ZN16GraphicComponent10_graph_memE, align 8, !tbaa !9
  br label %.preheader53

.preheader53:                                     ; preds = %.preheader53.preheader, %._crit_edge
  %105 = phi i32 [ %117, %._crit_edge ], [ %100, %.preheader53.preheader ]
  %106 = phi i32 [ %118, %._crit_edge ], [ %102, %.preheader53.preheader ]
  %.03360 = phi ptr [ %122, %._crit_edge ], [ %104, %.preheader53.preheader ]
  %.359 = phi i32 [ %119, %._crit_edge ], [ 0, %.preheader53.preheader ]
  %.658 = phi ptr [ %.7.lcssa, %._crit_edge ], [ %1, %.preheader53.preheader ]
  %107 = icmp sgt i32 %106, 0
  br i1 %107, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader53, %.lr.ph
  %.057 = phi ptr [ %113, %.lr.ph ], [ %.03360, %.preheader53 ]
  %.34456 = phi i32 [ %114, %.lr.ph ], [ 0, %.preheader53 ]
  %.755 = phi ptr [ %108, %.lr.ph ], [ %.658, %.preheader53 ]
  %108 = getelementptr inbounds i8, ptr %.755, i64 1
  %109 = load i8, ptr %.755, align 1, !tbaa !11
  %110 = zext i8 %109 to i64
  %111 = getelementptr inbounds [256 x i32], ptr @_ZN16GraphicComponent13_truecolormapE, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = getelementptr inbounds i8, ptr %.057, i64 4
  store i32 %112, ptr %.057, align 4, !tbaa !5
  %114 = add nuw nsw i32 %.34456, 1
  %115 = load i32, ptr @_ZN16GraphicComponent6_widthE, align 4, !tbaa !5
  %116 = icmp slt i32 %114, %115
  br i1 %116, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !25

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load i32, ptr @_ZN16GraphicComponent7_heightE, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader53
  %117 = phi i32 [ %105, %.preheader53 ], [ %.pre, %._crit_edge.loopexit ]
  %118 = phi i32 [ %106, %.preheader53 ], [ %115, %._crit_edge.loopexit ]
  %.7.lcssa = phi ptr [ %.658, %.preheader53 ], [ %108, %._crit_edge.loopexit ]
  %119 = add nuw nsw i32 %.359, 1
  %120 = load i32, ptr @_ZN16GraphicComponent15_bytes_per_lineE, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds i8, ptr %.03360, i64 %121
  %123 = icmp slt i32 %119, %117
  br i1 %123, label %.preheader53, label %.loopexit, !llvm.loop !26

124:                                              ; preds = %2
  %125 = tail call noundef nonnull align 8 dereferenceable(8624) ptr @_ZN16GraphicComponentixEi(ptr noundef nonnull align 8 dereferenceable(8624) %0, i32 noundef 1)
  %126 = tail call noundef nonnull align 8 dereferenceable(8624) ptr @_ZN16GraphicComponentlsEPKc(ptr noundef nonnull align 8 dereferenceable(8624) %125, ptr noundef nonnull @.str.7)
  br label %.loopexit

.loopexit:                                        ; preds = %._crit_edge, %._crit_edge65, %._crit_edge74.us, %._crit_edge83, %.preheader53.lr.ph, %.preheader51.lr.ph, %.preheader49.lr.ph, %.preheader.lr.ph, %99, %75, %29, %4, %124
  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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13, !15}
!15 = !{!"llvm.loop.unswitch.partial.disable"}
!16 = !{!17, !17, i64 0}
!17 = !{!"short", !7, i64 0}
!18 = distinct !{!18, !13}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.unroll.disable"}
!21 = distinct !{!21, !13}
!22 = !{i64 0, i64 1, !11, i64 1, i64 1, !11, i64 2, i64 1, !11}
!23 = distinct !{!23, !13}
!24 = distinct !{!24, !13, !15}
!25 = distinct !{!25, !13}
!26 = distinct !{!26, !13, !15}


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