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

; 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.ImGuiTable = type <{ i32, i32, ptr, ptr, %struct.ImSpan, %struct.ImSpan.35, %struct.ImSpan.36, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i16, i16, float, float, float, float, float, i32, i32, [2 x i32], i32, i32, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, %struct.ImRect, %struct.ImRect, %struct.ImRect, %struct.ImRect, %struct.ImRect, %struct.ImRect, %struct.ImRect, %struct.ImRect, %struct.ImRect, ptr, ptr, %struct.ImGuiTextBuffer, ptr, %struct.ImGuiTableInstanceData, %struct.ImVector.37, %struct.ImGuiTableColumnSortSpecs, [4 x i8], %struct.ImVector.38, %struct.ImGuiTableSortSpecs, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, [5 x i8] }>
%struct.ImSpan = type { ptr, ptr }
%struct.ImSpan.35 = type { ptr, ptr }
%struct.ImSpan.36 = type { ptr, ptr }
%struct.ImRect = type { %struct.ImVec2, %struct.ImVec2 }
%struct.ImVec2 = type { float, float }
%struct.ImGuiTextBuffer = type { %struct.ImVector.24 }
%struct.ImVector.24 = type { i32, i32, ptr }
%struct.ImGuiTableInstanceData = type { i32, float, float, float }
%struct.ImVector.37 = type { i32, i32, ptr }
%struct.ImGuiTableColumnSortSpecs = type <{ i32, i16, i16, i8, [3 x i8] }>
%struct.ImVector.38 = type { i32, i32, ptr }
%struct.ImGuiTableSortSpecs = type <{ ptr, i32, i8, [3 x i8] }>
%struct.ImGuiTableColumn = type <{ i32, float, float, float, float, float, float, float, %struct.ImRect, i32, float, float, float, float, float, float, float, i16, i16, i16, i16, i16, i16, i16, i16, i16, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 }>

@.str.41 = external hidden unnamed_addr constant [1 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: mustprogress uwtable
define dso_local noundef ptr @_ZN5ImGui18TableGetColumnNameEPK10ImGuiTablei(ptr noundef %0, i32 noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.ImGuiTable, ptr %8, i32 0, i32 88
  %10 = load i8, ptr %9, align 2, !tbaa !11, !range !28, !noundef !29
  %11 = trunc i8 %10 to i1
  %12 = zext i1 %11 to i32
  %13 = icmp eq i32 %12, 0
  br i1 %13, label %14, label %22

14:                                               ; preds = %2
  %15 = load i32, ptr %5, align 4, !tbaa !9
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.ImGuiTable, ptr %16, i32 0, i32 66
  %18 = load i16, ptr %17, align 2, !tbaa !30
  %19 = sext i16 %18 to i32
  %20 = icmp sge i32 %15, %19
  br i1 %20, label %21, label %22

21:                                               ; preds = %14
  store ptr @.str.41, ptr %3, align 8
  br label %43

22:                                               ; preds = %14, %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.ImGuiTable, ptr %23, i32 0, i32 4
  %25 = load i32, ptr %5, align 4, !tbaa !9
  %26 = call noundef nonnull align 4 dereferenceable(111) ptr @_ZNK6ImSpanI16ImGuiTableColumnEixEi(ptr noundef nonnull align 8 dereferenceable(16) %24, i32 noundef %25)
  store ptr %26, ptr %6, align 8, !tbaa !5
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.ImGuiTableColumn, ptr %27, i32 0, i32 17
  %29 = load i16, ptr %28, align 4, !tbaa !31
  %30 = sext i16 %29 to i32
  %31 = icmp eq i32 %30, -1
  br i1 %31, label %32, label %33

32:                                               ; preds = %22
  store ptr @.str.41, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %42

33:                                               ; preds = %22
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.ImGuiTable, ptr %34, i32 0, i32 55
  %36 = getelementptr inbounds %struct.ImGuiTextBuffer, ptr %35, i32 0, i32 0
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.ImGuiTableColumn, ptr %37, i32 0, i32 17
  %39 = load i16, ptr %38, align 4, !tbaa !31
  %40 = sext i16 %39 to i32
  %41 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNK8ImVectorIcEixEi(ptr noundef nonnull align 8 dereferenceable(16) %36, i32 noundef %40)
  store ptr %41, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %42

42:                                               ; preds = %33, %32
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  br label %43

43:                                               ; preds = %42, %21
  %44 = load ptr, ptr %3, align 8
  ret ptr %44
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(111) ptr @_ZNK6ImSpanI16ImGuiTableColumnEixEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZNK8ImVectorIcEixEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { inlinehint 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 = { 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 = !{!12, !27, i64 546}
!12 = !{!"_ZTS10ImGuiTable", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16, !13, i64 24, !14, i64 40, !15, i64 56, !6, i64 72, !6, i64 80, !6, i64 88, !10, i64 96, !10, i64 100, !10, i64 104, !10, i64 108, !10, i64 112, !10, i64 116, !16, i64 120, !16, i64 122, !17, i64 124, !17, i64 128, !17, i64 132, !17, i64 136, !17, i64 140, !10, i64 144, !10, i64 146, !10, i64 148, !7, i64 152, !10, i64 160, !10, i64 164, !17, i64 168, !17, i64 172, !17, i64 176, !17, i64 180, !17, i64 184, !17, i64 188, !17, i64 192, !17, i64 196, !17, i64 200, !17, i64 204, !17, i64 208, !17, i64 212, !17, i64 216, !17, i64 220, !17, i64 224, !17, i64 228, !18, i64 232, !18, i64 248, !18, i64 264, !18, i64 280, !18, i64 296, !18, i64 312, !18, i64 328, !18, i64 344, !18, i64 360, !6, i64 376, !6, i64 384, !20, i64 392, !6, i64 408, !22, i64 416, !23, i64 432, !24, i64 448, !25, i64 464, !26, i64 480, !16, i64 496, !16, i64 498, !16, i64 500, !16, i64 502, !16, i64 504, !16, i64 506, !16, i64 508, !16, i64 510, !16, i64 512, !16, i64 514, !16, i64 516, !16, i64 518, !16, i64 520, !16, i64 522, !16, i64 524, !16, i64 526, !16, i64 528, !16, i64 530, !16, i64 532, !16, i64 534, !16, i64 536, !16, i64 538, !16, i64 540, !16, i64 542, !16, i64 544, !27, i64 546, !27, i64 547, !27, i64 548, !27, i64 549, !27, i64 550, !27, i64 551, !27, i64 552, !27, i64 553, !27, i64 554, !27, i64 555, !27, i64 556, !27, i64 557, !27, i64 558, !27, i64 559, !27, i64 560, !27, i64 561, !27, i64 562}
!13 = !{!"_ZTS6ImSpanI16ImGuiTableColumnE", !6, i64 0, !6, i64 8}
!14 = !{!"_ZTS6ImSpanIsE", !6, i64 0, !6, i64 8}
!15 = !{!"_ZTS6ImSpanI18ImGuiTableCellDataE", !6, i64 0, !6, i64 8}
!16 = !{!"short", !7, i64 0}
!17 = !{!"float", !7, i64 0}
!18 = !{!"_ZTS6ImRect", !19, i64 0, !19, i64 8}
!19 = !{!"_ZTS6ImVec2", !17, i64 0, !17, i64 4}
!20 = !{!"_ZTS15ImGuiTextBuffer", !21, i64 0}
!21 = !{!"_ZTS8ImVectorIcE", !10, i64 0, !10, i64 4, !6, i64 8}
!22 = !{!"_ZTS22ImGuiTableInstanceData", !10, i64 0, !17, i64 4, !17, i64 8, !17, i64 12}
!23 = !{!"_ZTS8ImVectorI22ImGuiTableInstanceDataE", !10, i64 0, !10, i64 4, !6, i64 8}
!24 = !{!"_ZTS25ImGuiTableColumnSortSpecs", !10, i64 0, !16, i64 4, !16, i64 6, !10, i64 8}
!25 = !{!"_ZTS8ImVectorI25ImGuiTableColumnSortSpecsE", !10, i64 0, !10, i64 4, !6, i64 8}
!26 = !{!"_ZTS19ImGuiTableSortSpecs", !6, i64 0, !10, i64 8, !27, i64 12}
!27 = !{!"bool", !7, i64 0}
!28 = !{i8 0, i8 2}
!29 = !{}
!30 = !{!12, !16, i64 502}
!31 = !{!32, !16, i64 80}
!32 = !{!"_ZTS16ImGuiTableColumn", !10, i64 0, !17, i64 4, !17, i64 8, !17, i64 12, !17, i64 16, !17, i64 20, !17, i64 24, !17, i64 28, !18, i64 32, !10, i64 48, !17, i64 52, !17, i64 56, !17, i64 60, !17, i64 64, !17, i64 68, !17, i64 72, !17, i64 76, !16, i64 80, !16, i64 82, !16, i64 84, !16, i64 86, !16, i64 88, !16, i64 90, !16, i64 92, !16, i64 94, !16, i64 96, !27, i64 98, !27, i64 99, !27, i64 100, !27, i64 101, !27, i64 102, !27, i64 103, !27, i64 104, !27, i64 105, !7, i64 106, !7, i64 107, !7, i64 108, !7, i64 109, !7, i64 109, !7, i64 109, !7, i64 110}


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

@.str.41 = external hidden unnamed_addr constant [1 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef nonnull ptr @_ZN5ImGui18TableGetColumnNameEPK10ImGuiTablei(ptr noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 546
  %4 = load i8, ptr %3, align 2, !tbaa !5, !range !26, !noundef !27
  %5 = icmp eq i8 %4, 0
  br i1 %5, label %6, label %10

6:                                                ; preds = %2
  %7 = getelementptr inbounds i8, ptr %0, i64 502
  %8 = load i16, ptr %7, align 2, !tbaa !28
  %9 = sext i16 %8 to i32
  %.not = icmp sgt i32 %9, %1
  br i1 %.not, label %10, label %20

10:                                               ; preds = %6, %2
  %11 = getelementptr inbounds i8, ptr %0, i64 24
  %12 = tail call noundef nonnull align 4 dereferenceable(111) ptr @_ZNK6ImSpanI16ImGuiTableColumnEixEi(ptr noundef nonnull align 8 dereferenceable(16) %11, i32 noundef %1)
  %13 = getelementptr inbounds i8, ptr %12, i64 80
  %14 = load i16, ptr %13, align 4, !tbaa !29
  %15 = icmp eq i16 %14, -1
  br i1 %15, label %20, label %16

16:                                               ; preds = %10
  %17 = sext i16 %14 to i32
  %18 = getelementptr inbounds i8, ptr %0, i64 392
  %19 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNK8ImVectorIcEixEi(ptr noundef nonnull align 8 dereferenceable(16) %18, i32 noundef %17)
  br label %20

20:                                               ; preds = %16, %10, %6
  %.1 = phi ptr [ @.str.41, %6 ], [ %19, %16 ], [ @.str.41, %10 ]
  ret ptr %.1
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(111) ptr @_ZNK6ImSpanI16ImGuiTableColumnEixEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #1 align 2

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

attributes #0 = { 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 #1 = { inlinehint 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" }

!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, !25, i64 546}
!6 = !{!"_ZTS10ImGuiTable", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 16, !11, i64 24, !12, i64 40, !13, i64 56, !10, i64 72, !10, i64 80, !10, i64 88, !7, i64 96, !7, i64 100, !7, i64 104, !7, i64 108, !7, i64 112, !7, i64 116, !14, i64 120, !14, i64 122, !15, i64 124, !15, i64 128, !15, i64 132, !15, i64 136, !15, i64 140, !7, i64 144, !7, i64 146, !7, i64 148, !8, i64 152, !7, i64 160, !7, i64 164, !15, i64 168, !15, i64 172, !15, i64 176, !15, i64 180, !15, i64 184, !15, i64 188, !15, i64 192, !15, i64 196, !15, i64 200, !15, i64 204, !15, i64 208, !15, i64 212, !15, i64 216, !15, i64 220, !15, i64 224, !15, i64 228, !16, i64 232, !16, i64 248, !16, i64 264, !16, i64 280, !16, i64 296, !16, i64 312, !16, i64 328, !16, i64 344, !16, i64 360, !10, i64 376, !10, i64 384, !18, i64 392, !10, i64 408, !20, i64 416, !21, i64 432, !22, i64 448, !23, i64 464, !24, i64 480, !14, i64 496, !14, i64 498, !14, i64 500, !14, i64 502, !14, i64 504, !14, i64 506, !14, i64 508, !14, i64 510, !14, i64 512, !14, i64 514, !14, i64 516, !14, i64 518, !14, i64 520, !14, i64 522, !14, i64 524, !14, i64 526, !14, i64 528, !14, i64 530, !14, i64 532, !14, i64 534, !14, i64 536, !14, i64 538, !14, i64 540, !14, i64 542, !14, i64 544, !25, i64 546, !25, i64 547, !25, i64 548, !25, i64 549, !25, i64 550, !25, i64 551, !25, i64 552, !25, i64 553, !25, i64 554, !25, i64 555, !25, i64 556, !25, i64 557, !25, i64 558, !25, i64 559, !25, i64 560, !25, i64 561, !25, i64 562}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"_ZTS6ImSpanI16ImGuiTableColumnE", !10, i64 0, !10, i64 8}
!12 = !{!"_ZTS6ImSpanIsE", !10, i64 0, !10, i64 8}
!13 = !{!"_ZTS6ImSpanI18ImGuiTableCellDataE", !10, i64 0, !10, i64 8}
!14 = !{!"short", !8, i64 0}
!15 = !{!"float", !8, i64 0}
!16 = !{!"_ZTS6ImRect", !17, i64 0, !17, i64 8}
!17 = !{!"_ZTS6ImVec2", !15, i64 0, !15, i64 4}
!18 = !{!"_ZTS15ImGuiTextBuffer", !19, i64 0}
!19 = !{!"_ZTS8ImVectorIcE", !7, i64 0, !7, i64 4, !10, i64 8}
!20 = !{!"_ZTS22ImGuiTableInstanceData", !7, i64 0, !15, i64 4, !15, i64 8, !15, i64 12}
!21 = !{!"_ZTS8ImVectorI22ImGuiTableInstanceDataE", !7, i64 0, !7, i64 4, !10, i64 8}
!22 = !{!"_ZTS25ImGuiTableColumnSortSpecs", !7, i64 0, !14, i64 4, !14, i64 6, !7, i64 8}
!23 = !{!"_ZTS8ImVectorI25ImGuiTableColumnSortSpecsE", !7, i64 0, !7, i64 4, !10, i64 8}
!24 = !{!"_ZTS19ImGuiTableSortSpecs", !10, i64 0, !7, i64 8, !25, i64 12}
!25 = !{!"bool", !8, i64 0}
!26 = !{i8 0, i8 2}
!27 = !{}
!28 = !{!6, !14, i64 502}
!29 = !{!30, !14, i64 80}
!30 = !{!"_ZTS16ImGuiTableColumn", !7, i64 0, !15, i64 4, !15, i64 8, !15, i64 12, !15, i64 16, !15, i64 20, !15, i64 24, !15, i64 28, !16, i64 32, !7, i64 48, !15, i64 52, !15, i64 56, !15, i64 60, !15, i64 64, !15, i64 68, !15, i64 72, !15, i64 76, !14, i64 80, !14, i64 82, !14, i64 84, !14, i64 86, !14, i64 88, !14, i64 90, !14, i64 92, !14, i64 94, !14, i64 96, !25, i64 98, !25, i64 99, !25, i64 100, !25, i64 101, !25, i64 102, !25, i64 103, !25, i64 104, !25, i64 105, !8, i64 106, !8, i64 107, !8, i64 108, !8, i64 109, !8, i64 109, !8, i64 109, !8, i64 110}


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