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

%struct.ImVec2 = type { float, float }
%struct.ImFontAtlas = type <{ i32, [4 x i8], ptr, i32, i32, i8, [7 x i8], ptr, i8, i8, [6 x i8], ptr, ptr, i32, i32, %struct.ImVec2, %struct.ImVec2, %struct.ImVector.8, %struct.ImVector.9, %struct.ImVector.10, [64 x %struct.ImVec4], ptr, i32, i32, i32, [4 x i8] }>
%struct.ImVector.8 = type { i32, i32, ptr }
%struct.ImVector.9 = type { i32, i32, ptr }
%struct.ImVector.10 = type { i32, i32, ptr }
%struct.ImVec4 = type { float, float, float, float }
%struct.ImFontAtlasCustomRect = type { i16, i16, i16, i16, i32, float, %struct.ImVec2, ptr }

@.str.1 = external hidden unnamed_addr constant [122 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [30 x i8], align 1
@__PRETTY_FUNCTION__._ZNK11ImFontAtlas16CalcCustomRectUVEPK21ImFontAtlasCustomRectP6ImVec2S4_ = external hidden unnamed_addr constant [92 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [17 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 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #2 align 2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK11ImFontAtlas16CalcCustomRectUVEPK21ImFontAtlasCustomRectP6ImVec2S4_(ptr noundef nonnull align 8 dereferenceable(1180) %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #4 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %struct.ImVec2, align 4
  %10 = alloca %struct.ImVec2, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  %11 = load ptr, ptr %5, align 8
  %12 = getelementptr inbounds %struct.ImFontAtlas, ptr %11, i32 0, i32 13
  %13 = load i32, ptr %12, align 8, !tbaa !9
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %15, label %19

15:                                               ; preds = %4
  %16 = getelementptr inbounds %struct.ImFontAtlas, ptr %11, i32 0, i32 14
  %17 = load i32, ptr %16, align 4, !tbaa !18
  %18 = icmp sgt i32 %17, 0
  br label %19

19:                                               ; preds = %15, %4
  %20 = phi i1 [ false, %4 ], [ %18, %15 ]
  br i1 %20, label %21, label %22

21:                                               ; preds = %19
  br label %24

22:                                               ; preds = %19
  call void @__assert_fail(ptr noundef @.str.23, ptr noundef @.str.1, i32 noundef 2226, ptr noundef @__PRETTY_FUNCTION__._ZNK11ImFontAtlas16CalcCustomRectUVEPK21ImFontAtlasCustomRectP6ImVec2S4_) #5
  unreachable

23:                                               ; No predecessors!
  br label %24

24:                                               ; preds = %23, %21
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = call noundef zeroext i1 @_ZNK21ImFontAtlasCustomRect8IsPackedEv(ptr noundef nonnull align 8 dereferenceable(32) %25)
  br i1 %26, label %27, label %28

27:                                               ; preds = %24
  br label %30

28:                                               ; preds = %24
  call void @__assert_fail(ptr noundef @.str.24, ptr noundef @.str.1, i32 noundef 2227, ptr noundef @__PRETTY_FUNCTION__._ZNK11ImFontAtlas16CalcCustomRectUVEPK21ImFontAtlasCustomRectP6ImVec2S4_) #5
  unreachable

29:                                               ; No predecessors!
  br label %30

30:                                               ; preds = %29, %27
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.ImFontAtlasCustomRect, ptr %31, i32 0, i32 2
  %33 = load i16, ptr %32, align 4, !tbaa !19
  %34 = uitofp i16 %33 to float
  %35 = getelementptr inbounds %struct.ImFontAtlas, ptr %11, i32 0, i32 15
  %36 = getelementptr inbounds %struct.ImVec2, ptr %35, i32 0, i32 0
  %37 = load float, ptr %36, align 8, !tbaa !22
  %38 = fmul float %34, %37
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.ImFontAtlasCustomRect, ptr %39, i32 0, i32 3
  %41 = load i16, ptr %40, align 2, !tbaa !23
  %42 = uitofp i16 %41 to float
  %43 = getelementptr inbounds %struct.ImFontAtlas, ptr %11, i32 0, i32 15
  %44 = getelementptr inbounds %struct.ImVec2, ptr %43, i32 0, i32 1
  %45 = load float, ptr %44, align 4, !tbaa !24
  %46 = fmul float %42, %45
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %9, float noundef %38, float noundef %46)
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %47, ptr align 4 %9, i64 8, i1 false), !tbaa.struct !25
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.ImFontAtlasCustomRect, ptr %48, i32 0, i32 2
  %50 = load i16, ptr %49, align 4, !tbaa !19
  %51 = zext i16 %50 to i32
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.ImFontAtlasCustomRect, ptr %52, i32 0, i32 0
  %54 = load i16, ptr %53, align 8, !tbaa !27
  %55 = zext i16 %54 to i32
  %56 = add nsw i32 %51, %55
  %57 = sitofp i32 %56 to float
  %58 = getelementptr inbounds %struct.ImFontAtlas, ptr %11, i32 0, i32 15
  %59 = getelementptr inbounds %struct.ImVec2, ptr %58, i32 0, i32 0
  %60 = load float, ptr %59, align 8, !tbaa !22
  %61 = fmul float %57, %60
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.ImFontAtlasCustomRect, ptr %62, i32 0, i32 3
  %64 = load i16, ptr %63, align 2, !tbaa !23
  %65 = zext i16 %64 to i32
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.ImFontAtlasCustomRect, ptr %66, i32 0, i32 1
  %68 = load i16, ptr %67, align 2, !tbaa !28
  %69 = zext i16 %68 to i32
  %70 = add nsw i32 %65, %69
  %71 = sitofp i32 %70 to float
  %72 = getelementptr inbounds %struct.ImFontAtlas, ptr %11, i32 0, i32 15
  %73 = getelementptr inbounds %struct.ImVec2, ptr %72, i32 0, i32 1
  %74 = load float, ptr %73, align 4, !tbaa !24
  %75 = fmul float %71, %74
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %10, float noundef %61, float noundef %75)
  %76 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %76, ptr align 4 %10, i64 8, i1 false), !tbaa.struct !25
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK21ImFontAtlasCustomRect8IsPackedEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { noreturn nounwind }
attributes #6 = { 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, !11, i64 64}
!10 = !{!"_ZTS11ImFontAtlas", !11, i64 0, !6, i64 8, !11, i64 16, !11, i64 20, !12, i64 24, !6, i64 32, !12, i64 40, !12, i64 41, !6, i64 48, !6, i64 56, !11, i64 64, !11, i64 68, !13, i64 72, !13, i64 80, !15, i64 88, !16, i64 104, !17, i64 120, !7, i64 136, !6, i64 1160, !11, i64 1168, !11, i64 1172, !11, i64 1176}
!11 = !{!"int", !7, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!"_ZTS6ImVec2", !14, i64 0, !14, i64 4}
!14 = !{!"float", !7, i64 0}
!15 = !{!"_ZTS8ImVectorIP6ImFontE", !11, i64 0, !11, i64 4, !6, i64 8}
!16 = !{!"_ZTS8ImVectorI21ImFontAtlasCustomRectE", !11, i64 0, !11, i64 4, !6, i64 8}
!17 = !{!"_ZTS8ImVectorI12ImFontConfigE", !11, i64 0, !11, i64 4, !6, i64 8}
!18 = !{!10, !11, i64 68}
!19 = !{!20, !21, i64 4}
!20 = !{!"_ZTS21ImFontAtlasCustomRect", !21, i64 0, !21, i64 2, !21, i64 4, !21, i64 6, !11, i64 8, !14, i64 12, !13, i64 16, !6, i64 24}
!21 = !{!"short", !7, i64 0}
!22 = !{!10, !14, i64 72}
!23 = !{!20, !21, i64 6}
!24 = !{!10, !14, i64 76}
!25 = !{i64 0, i64 4, !26, i64 4, i64 4, !26}
!26 = !{!14, !14, i64 0}
!27 = !{!20, !21, i64 0}
!28 = !{!20, !21, i64 2}


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

%struct.ImVec2 = type { float, float }

@.str.1 = external hidden unnamed_addr constant [122 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [30 x i8], align 1
@__PRETTY_FUNCTION__._ZNK11ImFontAtlas16CalcCustomRectUVEPK21ImFontAtlasCustomRectP6ImVec2S4_ = external hidden unnamed_addr constant [92 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [17 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #1 align 2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZNK11ImFontAtlas16CalcCustomRectUVEPK21ImFontAtlasCustomRectP6ImVec2S4_(ptr nocapture noundef nonnull readonly align 8 dereferenceable(1180) %0, ptr noundef %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef writeonly %3) local_unnamed_addr #1 align 2 {
  %5 = alloca %struct.ImVec2, align 8
  %6 = alloca %struct.ImVec2, align 8
  %7 = getelementptr inbounds i8, ptr %0, i64 64
  %8 = load i32, ptr %7, align 8, !tbaa !5
  %9 = icmp sgt i32 %8, 0
  %10 = getelementptr inbounds i8, ptr %0, i64 68
  %11 = load i32, ptr %10, align 4
  %12 = icmp sgt i32 %11, 0
  %or.cond = select i1 %9, i1 %12, i1 false
  br i1 %or.cond, label %13, label %.critedge

.critedge:                                        ; preds = %4
  tail call void @__assert_fail(ptr noundef nonnull @.str.23, ptr noundef nonnull @.str.1, i32 noundef 2226, ptr noundef nonnull @__PRETTY_FUNCTION__._ZNK11ImFontAtlas16CalcCustomRectUVEPK21ImFontAtlasCustomRectP6ImVec2S4_) #3
  unreachable

13:                                               ; preds = %4
  %14 = tail call noundef zeroext i1 @_ZNK21ImFontAtlasCustomRect8IsPackedEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  br i1 %14, label %16, label %15

15:                                               ; preds = %13
  tail call void @__assert_fail(ptr noundef nonnull @.str.24, ptr noundef nonnull @.str.1, i32 noundef 2227, ptr noundef nonnull @__PRETTY_FUNCTION__._ZNK11ImFontAtlas16CalcCustomRectUVEPK21ImFontAtlasCustomRectP6ImVec2S4_) #3
  unreachable

16:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  %17 = getelementptr inbounds i8, ptr %1, i64 4
  %18 = load i16, ptr %17, align 4, !tbaa !17
  %19 = uitofp i16 %18 to float
  %20 = getelementptr inbounds i8, ptr %0, i64 72
  %21 = load float, ptr %20, align 8, !tbaa !20
  %22 = fmul float %21, %19
  %23 = getelementptr inbounds i8, ptr %1, i64 6
  %24 = load i16, ptr %23, align 2, !tbaa !21
  %25 = uitofp i16 %24 to float
  %26 = getelementptr inbounds i8, ptr %0, i64 76
  %27 = load float, ptr %26, align 4, !tbaa !22
  %28 = fmul float %27, %25
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %5, float noundef %22, float noundef %28)
  %29 = load i64, ptr %5, align 8
  store i64 %29, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  %30 = load i16, ptr %17, align 4, !tbaa !17
  %31 = zext i16 %30 to i32
  %32 = load i16, ptr %1, align 8, !tbaa !23
  %33 = zext i16 %32 to i32
  %34 = add nuw nsw i32 %33, %31
  %35 = uitofp nneg i32 %34 to float
  %36 = load float, ptr %20, align 8, !tbaa !20
  %37 = fmul float %36, %35
  %38 = load i16, ptr %23, align 2, !tbaa !21
  %39 = zext i16 %38 to i32
  %40 = getelementptr inbounds i8, ptr %1, i64 2
  %41 = load i16, ptr %40, align 2, !tbaa !24
  %42 = zext i16 %41 to i32
  %43 = add nuw nsw i32 %42, %39
  %44 = uitofp nneg i32 %43 to float
  %45 = load float, ptr %26, align 4, !tbaa !22
  %46 = fmul float %45, %44
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %6, float noundef %37, float noundef %46)
  %47 = load i64, ptr %6, align 8
  store i64 %47, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK21ImFontAtlasCustomRect8IsPackedEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

attributes #0 = { mustprogress 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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { noreturn nounwind }
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, !7, i64 64}
!6 = !{!"_ZTS11ImFontAtlas", !7, i64 0, !10, i64 8, !7, i64 16, !7, i64 20, !11, i64 24, !10, i64 32, !11, i64 40, !11, i64 41, !10, i64 48, !10, i64 56, !7, i64 64, !7, i64 68, !12, i64 72, !12, i64 80, !14, i64 88, !15, i64 104, !16, i64 120, !8, i64 136, !10, i64 1160, !7, i64 1168, !7, i64 1172, !7, i64 1176}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{!"_ZTS6ImVec2", !13, i64 0, !13, i64 4}
!13 = !{!"float", !8, i64 0}
!14 = !{!"_ZTS8ImVectorIP6ImFontE", !7, i64 0, !7, i64 4, !10, i64 8}
!15 = !{!"_ZTS8ImVectorI21ImFontAtlasCustomRectE", !7, i64 0, !7, i64 4, !10, i64 8}
!16 = !{!"_ZTS8ImVectorI12ImFontConfigE", !7, i64 0, !7, i64 4, !10, i64 8}
!17 = !{!18, !19, i64 4}
!18 = !{!"_ZTS21ImFontAtlasCustomRect", !19, i64 0, !19, i64 2, !19, i64 4, !19, i64 6, !7, i64 8, !13, i64 12, !12, i64 16, !10, i64 24}
!19 = !{!"short", !8, i64 0}
!20 = !{!6, !13, i64 72}
!21 = !{!18, !19, i64 6}
!22 = !{!6, !13, i64 76}
!23 = !{!18, !19, i64 0}
!24 = !{!18, !19, i64 2}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass