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

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(111) ptr @_ZN6ImSpanI16ImGuiTableColumnEixEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5ImGui26TableSetColumnWidthAutoAllEP10ImGuiTable(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %6

6:                                                ; preds = %37, %1
  %7 = load i32, ptr %3, align 4, !tbaa !9
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.ImGuiTable, ptr %8, i32 0, i32 13
  %10 = load i32, ptr %9, align 4, !tbaa !11
  %11 = icmp slt i32 %7, %10
  br i1 %11, label %13, label %12

12:                                               ; preds = %6
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  br label %40

13:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.ImGuiTable, ptr %14, i32 0, i32 4
  %16 = load i32, ptr %3, align 4, !tbaa !9
  %17 = call noundef nonnull align 4 dereferenceable(111) ptr @_ZN6ImSpanI16ImGuiTableColumnEixEi(ptr noundef nonnull align 8 dereferenceable(16) %15, i32 noundef %16)
  store ptr %17, ptr %5, align 8, !tbaa !5
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.ImGuiTableColumn, ptr %18, i32 0, i32 26
  %20 = load i8, ptr %19, align 2, !tbaa !28, !range !30, !noundef !31
  %21 = trunc i8 %20 to i1
  br i1 %21, label %29, label %22

22:                                               ; preds = %13
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.ImGuiTableColumn, ptr %23, i32 0, i32 0
  %25 = load i32, ptr %24, align 4, !tbaa !32
  %26 = and i32 %25, 8
  %27 = icmp ne i32 %26, 0
  br i1 %27, label %29, label %28

28:                                               ; preds = %22
  store i32 4, ptr %4, align 4
  br label %34

29:                                               ; preds = %22, %13
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.ImGuiTableColumn, ptr %30, i32 0, i32 36
  store i8 1, ptr %31, align 4, !tbaa !33
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.ImGuiTableColumn, ptr %32, i32 0, i32 35
  store i8 2, ptr %33, align 1, !tbaa !34
  store i32 0, ptr %4, align 4
  br label %34

34:                                               ; preds = %29, %28
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  %35 = load i32, ptr %4, align 4
  switch i32 %35, label %41 [
    i32 0, label %36
    i32 4, label %37
  ]

36:                                               ; preds = %34
  br label %37

37:                                               ; preds = %36, %34
  %38 = load i32, ptr %3, align 4, !tbaa !9
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %3, align 4, !tbaa !9
  br label %6, !llvm.loop !35

40:                                               ; preds = %12
  ret void

41:                                               ; preds = %34
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
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" }
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, !10, i64 108}
!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 = !{!29, !27, i64 98}
!29 = !{!"_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}
!30 = !{i8 0, i8 2}
!31 = !{}
!32 = !{!29, !10, i64 0}
!33 = !{!29, !7, i64 108}
!34 = !{!29, !7, i64 107}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}


; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(111) ptr @_ZN6ImSpanI16ImGuiTableColumnEixEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN5ImGui26TableSetColumnWidthAutoAllEP10ImGuiTable(ptr noundef %0) local_unnamed_addr #1 {
  %2 = getelementptr inbounds i8, ptr %0, i64 108
  %3 = load i32, ptr %2, align 4, !tbaa !5
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 24
  br label %6

._crit_edge:                                      ; preds = %17, %1
  ret void

6:                                                ; preds = %.lr.ph, %17
  %.08 = phi i32 [ 0, %.lr.ph ], [ %18, %17 ]
  %7 = tail call noundef nonnull align 4 dereferenceable(111) ptr @_ZN6ImSpanI16ImGuiTableColumnEixEi(ptr noundef nonnull align 8 dereferenceable(16) %5, i32 noundef %.08)
  %8 = getelementptr inbounds i8, ptr %7, i64 98
  %9 = load i8, ptr %8, align 2, !tbaa !26, !range !28, !noundef !29
  %10 = trunc nuw i8 %9 to i1
  br i1 %10, label %14, label %11

11:                                               ; preds = %6
  %12 = load i32, ptr %7, align 4, !tbaa !30
  %13 = and i32 %12, 8
  %.not = icmp eq i32 %13, 0
  br i1 %.not, label %17, label %14

14:                                               ; preds = %11, %6
  %15 = getelementptr inbounds i8, ptr %7, i64 108
  store i8 1, ptr %15, align 4, !tbaa !31
  %16 = getelementptr inbounds i8, ptr %7, i64 107
  store i8 2, ptr %16, align 1, !tbaa !32
  br label %17

17:                                               ; preds = %11, %14
  %18 = add nuw nsw i32 %.08, 1
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = icmp slt i32 %18, %19
  br i1 %20, label %6, label %._crit_edge, !llvm.loop !33
}

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

!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 108}
!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 = !{!27, !25, i64 98}
!27 = !{!"_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}
!28 = !{i8 0, i8 2}
!29 = !{}
!30 = !{!27, !7, i64 0}
!31 = !{!27, !8, i64 108}
!32 = !{!27, !8, i64 107}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass