; LLVM IR from Samson-Mano/EM_Propogation_simulation :: EM_Propogation_simulation/src/ImGui (imgui_draw)

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

; 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: mustprogress nounwind uwtable
define dso_local void @_Z34ImFontAtlasBuildMultiplyRectAlpha8PKhPhiiiii(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6) #1 {
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store i32 %2, ptr %10, align 4, !tbaa !9
  store i32 %3, ptr %11, align 4, !tbaa !9
  store i32 %4, ptr %12, align 4, !tbaa !9
  store i32 %5, ptr %13, align 4, !tbaa !9
  store i32 %6, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #2
  %19 = load ptr, ptr %9, align 8, !tbaa !5
  %20 = load i32, ptr %10, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds i8, ptr %19, i64 %21
  %23 = load i32, ptr %11, align 4, !tbaa !9
  %24 = load i32, ptr %14, align 4, !tbaa !9
  %25 = mul nsw i32 %23, %24
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds i8, ptr %22, i64 %26
  store ptr %27, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #2
  %28 = load i32, ptr %13, align 4, !tbaa !9
  store i32 %28, ptr %16, align 4, !tbaa !9
  br label %29

29:                                               ; preds = %53, %7
  %30 = load i32, ptr %16, align 4, !tbaa !9
  %31 = icmp sgt i32 %30, 0
  br i1 %31, label %33, label %32

32:                                               ; preds = %29
  store i32 2, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #2
  br label %62

33:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #2
  %34 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %34, ptr %18, align 4, !tbaa !9
  br label %35

35:                                               ; preds = %47, %33
  %36 = load i32, ptr %18, align 4, !tbaa !9
  %37 = icmp sgt i32 %36, 0
  br i1 %37, label %39, label %38

38:                                               ; preds = %35
  store i32 5, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #2
  br label %52

39:                                               ; preds = %35
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = load ptr, ptr %15, align 8, !tbaa !5
  %42 = load i8, ptr %41, align 1, !tbaa !11
  %43 = zext i8 %42 to i64
  %44 = getelementptr inbounds i8, ptr %40, i64 %43
  %45 = load i8, ptr %44, align 1, !tbaa !11
  %46 = load ptr, ptr %15, align 8, !tbaa !5
  store i8 %45, ptr %46, align 1, !tbaa !11
  br label %47

47:                                               ; preds = %39
  %48 = load i32, ptr %18, align 4, !tbaa !9
  %49 = add nsw i32 %48, -1
  store i32 %49, ptr %18, align 4, !tbaa !9
  %50 = load ptr, ptr %15, align 8, !tbaa !5
  %51 = getelementptr inbounds i8, ptr %50, i32 1
  store ptr %51, ptr %15, align 8, !tbaa !5
  br label %35, !llvm.loop !12

52:                                               ; preds = %38
  br label %53

53:                                               ; preds = %52
  %54 = load i32, ptr %16, align 4, !tbaa !9
  %55 = add nsw i32 %54, -1
  store i32 %55, ptr %16, align 4, !tbaa !9
  %56 = load i32, ptr %14, align 4, !tbaa !9
  %57 = load i32, ptr %12, align 4, !tbaa !9
  %58 = sub nsw i32 %56, %57
  %59 = load ptr, ptr %15, align 8, !tbaa !5
  %60 = sext i32 %58 to i64
  %61 = getelementptr inbounds i8, ptr %59, i64 %60
  store ptr %61, ptr %15, align 8, !tbaa !5
  br label %29, !llvm.loop !14

62:                                               ; preds = %32
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #2
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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}


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

; Function Attrs: mustprogress nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @_Z34ImFontAtlasBuildMultiplyRectAlpha8PKhPhiiiii(ptr nocapture noundef readonly %0, ptr nocapture noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6) local_unnamed_addr #0 {
  %8 = icmp sgt i32 %5, 0
  br i1 %8, label %.preheader.lr.ph, label %._crit_edge22

.preheader.lr.ph:                                 ; preds = %7
  %9 = icmp sgt i32 %4, 0
  %10 = sub nsw i32 %6, %4
  %11 = sext i32 %10 to i64
  br i1 %9, label %.preheader.us.preheader, label %._crit_edge22

.preheader.us.preheader:                          ; preds = %.preheader.lr.ph
  %12 = sext i32 %2 to i64
  %13 = getelementptr inbounds i8, ptr %1, i64 %12
  %14 = mul nsw i32 %6, %3
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds i8, ptr %13, i64 %15
  %xtraiter = and i32 %4, 3
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  %17 = icmp ult i32 %4, 4
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge.us
  %.01621.us = phi i32 [ %46, %._crit_edge.us ], [ %5, %.preheader.us.preheader ]
  %.01720.us = phi ptr [ %47, %._crit_edge.us ], [ %16, %.preheader.us.preheader ]
  br i1 %lcmp.mod.not, label %.prol.loopexit, label %.prol.preheader

.prol.preheader:                                  ; preds = %.preheader.us, %.prol.preheader
  %.019.us.prol = phi i32 [ %22, %.prol.preheader ], [ %4, %.preheader.us ]
  %.118.us.prol = phi ptr [ %23, %.prol.preheader ], [ %.01720.us, %.preheader.us ]
  %prol.iter = phi i32 [ %prol.iter.next, %.prol.preheader ], [ 0, %.preheader.us ]
  %18 = load i8, ptr %.118.us.prol, align 1, !tbaa !5
  %19 = zext i8 %18 to i64
  %20 = getelementptr inbounds i8, ptr %0, i64 %19
  %21 = load i8, ptr %20, align 1, !tbaa !5
  store i8 %21, ptr %.118.us.prol, align 1, !tbaa !5
  %22 = add nsw i32 %.019.us.prol, -1
  %23 = getelementptr inbounds i8, ptr %.118.us.prol, i64 1
  %prol.iter.next = add i32 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i32 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %.prol.loopexit, label %.prol.preheader, !llvm.loop !8

.prol.loopexit:                                   ; preds = %.prol.preheader, %.preheader.us
  %.019.us.unr = phi i32 [ %4, %.preheader.us ], [ %22, %.prol.preheader ]
  %.118.us.unr = phi ptr [ %.01720.us, %.preheader.us ], [ %23, %.prol.preheader ]
  %.lcssa.unr = phi ptr [ poison, %.preheader.us ], [ %23, %.prol.preheader ]
  br i1 %17, label %._crit_edge.us, label %.preheader.us.new

.preheader.us.new:                                ; preds = %.prol.loopexit, %.preheader.us.new
  %.019.us = phi i32 [ %43, %.preheader.us.new ], [ %.019.us.unr, %.prol.loopexit ]
  %.118.us = phi ptr [ %44, %.preheader.us.new ], [ %.118.us.unr, %.prol.loopexit ]
  %24 = load i8, ptr %.118.us, align 1, !tbaa !5
  %25 = zext i8 %24 to i64
  %26 = getelementptr inbounds i8, ptr %0, i64 %25
  %27 = load i8, ptr %26, align 1, !tbaa !5
  store i8 %27, ptr %.118.us, align 1, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %.118.us, i64 1
  %29 = load i8, ptr %28, align 1, !tbaa !5
  %30 = zext i8 %29 to i64
  %31 = getelementptr inbounds i8, ptr %0, i64 %30
  %32 = load i8, ptr %31, align 1, !tbaa !5
  store i8 %32, ptr %28, align 1, !tbaa !5
  %33 = getelementptr inbounds i8, ptr %.118.us, i64 2
  %34 = load i8, ptr %33, align 1, !tbaa !5
  %35 = zext i8 %34 to i64
  %36 = getelementptr inbounds i8, ptr %0, i64 %35
  %37 = load i8, ptr %36, align 1, !tbaa !5
  store i8 %37, ptr %33, align 1, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %.118.us, i64 3
  %39 = load i8, ptr %38, align 1, !tbaa !5
  %40 = zext i8 %39 to i64
  %41 = getelementptr inbounds i8, ptr %0, i64 %40
  %42 = load i8, ptr %41, align 1, !tbaa !5
  store i8 %42, ptr %38, align 1, !tbaa !5
  %43 = add nsw i32 %.019.us, -4
  %44 = getelementptr inbounds i8, ptr %.118.us, i64 4
  %45 = icmp sgt i32 %.019.us, 4
  br i1 %45, label %.preheader.us.new, label %._crit_edge.us, !llvm.loop !10

._crit_edge.us:                                   ; preds = %.preheader.us.new, %.prol.loopexit
  %.lcssa = phi ptr [ %.lcssa.unr, %.prol.loopexit ], [ %44, %.preheader.us.new ]
  %46 = add nsw i32 %.01621.us, -1
  %47 = getelementptr inbounds i8, ptr %.lcssa, i64 %11
  %48 = icmp sgt i32 %.01621.us, 1
  br i1 %48, label %.preheader.us, label %._crit_edge22, !llvm.loop !12

._crit_edge22:                                    ; preds = %._crit_edge.us, %.preheader.lr.ph, %7
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.unroll.disable"}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}


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