; 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.ImGuiTableSettings = type <{ i32, i32, float, i16, i16, i8, [3 x i8] }>
%struct.ImGuiTableColumnSettings = type <{ float, i32, i16, i16, i16, i8, i8 }>

@.str.105 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.106 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.107 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.108 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.109 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.110 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.111 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.112 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.113 = external hidden unnamed_addr constant [7 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 nounwind uwtable
declare dso_local noundef ptr @_ZN18ImGuiTableSettings17GetColumnSettingsEv(ptr noundef nonnull align 4 dereferenceable(17)) #1 align 2

declare noundef zeroext i1 @_ZN5ImGui8TreeNodeEPKvPKcz(ptr noundef, ptr noundef, ...) #2

declare void @_ZN5ImGui10BulletTextEPKcz(ptr noundef, ...) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5ImGui22DebugNodeTableSettingsEP18ImGuiTableSettings(ptr noundef %0) #3 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.ImGuiTableSettings, ptr %6, i32 0, i32 0
  %8 = load i32, ptr %7, align 4, !tbaa !9
  %9 = zext i32 %8 to i64
  %10 = inttoptr i64 %9 to ptr
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.ImGuiTableSettings, ptr %11, i32 0, i32 0
  %13 = load i32, ptr %12, align 4, !tbaa !9
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.ImGuiTableSettings, ptr %14, i32 0, i32 3
  %16 = load i16, ptr %15, align 4, !tbaa !15
  %17 = sext i16 %16 to i32
  %18 = call noundef zeroext i1 (ptr, ptr, ...) @_ZN5ImGui8TreeNodeEPKvPKcz(ptr noundef %10, ptr noundef @.str.105, i32 noundef %13, i32 noundef %17)
  br i1 %18, label %20, label %19

19:                                               ; preds = %1
  br label %110

20:                                               ; preds = %1
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.ImGuiTableSettings, ptr %21, i32 0, i32 1
  %23 = load i32, ptr %22, align 4, !tbaa !16
  call void (ptr, ...) @_ZN5ImGui10BulletTextEPKcz(ptr noundef @.str.106, i32 noundef %23)
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.ImGuiTableSettings, ptr %24, i32 0, i32 3
  %26 = load i16, ptr %25, align 4, !tbaa !15
  %27 = sext i16 %26 to i32
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.ImGuiTableSettings, ptr %28, i32 0, i32 4
  %30 = load i16, ptr %29, align 2, !tbaa !17
  %31 = sext i16 %30 to i32
  call void (ptr, ...) @_ZN5ImGui10BulletTextEPKcz(ptr noundef @.str.107, i32 noundef %27, i32 noundef %31)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 0, ptr %3, align 4, !tbaa !18
  br label %32

32:                                               ; preds = %106, %20
  %33 = load i32, ptr %3, align 4, !tbaa !18
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.ImGuiTableSettings, ptr %34, i32 0, i32 3
  %36 = load i16, ptr %35, align 4, !tbaa !15
  %37 = sext i16 %36 to i32
  %38 = icmp slt i32 %33, %37
  br i1 %38, label %40, label %39

39:                                               ; preds = %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %109

40:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %41 = load ptr, ptr %2, align 8, !tbaa !5
  %42 = call noundef ptr @_ZN18ImGuiTableSettings17GetColumnSettingsEv(ptr noundef nonnull align 4 dereferenceable(17) %41)
  %43 = load i32, ptr %3, align 4, !tbaa !18
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds %struct.ImGuiTableColumnSettings, ptr %42, i64 %44
  store ptr %45, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.ImGuiTableColumnSettings, ptr %46, i32 0, i32 4
  %48 = load i16, ptr %47, align 4, !tbaa !19
  %49 = sext i16 %48 to i32
  %50 = icmp ne i32 %49, -1
  br i1 %50, label %51, label %57

51:                                               ; preds = %40
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.ImGuiTableColumnSettings, ptr %52, i32 0, i32 5
  %54 = load i8, ptr %53, align 2
  %55 = and i8 %54, 3
  %56 = zext i8 %55 to i32
  br label %58

57:                                               ; preds = %40
  br label %58

58:                                               ; preds = %57, %51
  %59 = phi i32 [ %56, %51 ], [ 0, %57 ]
  store i32 %59, ptr %5, align 4, !tbaa !18
  %60 = load i32, ptr %3, align 4, !tbaa !18
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.ImGuiTableColumnSettings, ptr %61, i32 0, i32 3
  %63 = load i16, ptr %62, align 2, !tbaa !21
  %64 = sext i16 %63 to i32
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.ImGuiTableColumnSettings, ptr %65, i32 0, i32 4
  %67 = load i16, ptr %66, align 4, !tbaa !19
  %68 = sext i16 %67 to i32
  %69 = load i32, ptr %5, align 4, !tbaa !18
  %70 = icmp eq i32 %69, 1
  br i1 %70, label %71, label %72

71:                                               ; preds = %58
  br label %79

72:                                               ; preds = %58
  %73 = load i32, ptr %5, align 4, !tbaa !18
  %74 = icmp eq i32 %73, 2
  br i1 %74, label %75, label %76

75:                                               ; preds = %72
  br label %77

76:                                               ; preds = %72
  br label %77

77:                                               ; preds = %76, %75
  %78 = phi ptr [ @.str.110, %75 ], [ @.str.111, %76 ]
  br label %79

79:                                               ; preds = %77, %71
  %80 = phi ptr [ @.str.109, %71 ], [ %78, %77 ]
  %81 = getelementptr inbounds [4 x i8], ptr %80, i64 0, i64 0
  %82 = load ptr, ptr %4, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.ImGuiTableColumnSettings, ptr %82, i32 0, i32 5
  %84 = load i8, ptr %83, align 2
  %85 = lshr i8 %84, 2
  %86 = and i8 %85, 1
  %87 = zext i8 %86 to i32
  %88 = load ptr, ptr %4, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.ImGuiTableColumnSettings, ptr %88, i32 0, i32 5
  %90 = load i8, ptr %89, align 2
  %91 = lshr i8 %90, 3
  %92 = and i8 %91, 1
  %93 = icmp ne i8 %92, 0
  br i1 %93, label %94, label %95

94:                                               ; preds = %79
  br label %96

95:                                               ; preds = %79
  br label %96

96:                                               ; preds = %95, %94
  %97 = phi ptr [ @.str.112, %94 ], [ @.str.113, %95 ]
  %98 = getelementptr inbounds [7 x i8], ptr %97, i64 0, i64 0
  %99 = load ptr, ptr %4, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.ImGuiTableColumnSettings, ptr %99, i32 0, i32 0
  %101 = load float, ptr %100, align 4, !tbaa !22
  %102 = fpext float %101 to double
  %103 = load ptr, ptr %4, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.ImGuiTableColumnSettings, ptr %103, i32 0, i32 1
  %105 = load i32, ptr %104, align 4, !tbaa !23
  call void (ptr, ...) @_ZN5ImGui10BulletTextEPKcz(ptr noundef @.str.108, i32 noundef %60, i32 noundef %64, i32 noundef %68, ptr noundef %81, i32 noundef %87, ptr noundef %98, double noundef %102, i32 noundef %105)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  br label %106

106:                                              ; preds = %96
  %107 = load i32, ptr %3, align 4, !tbaa !18
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %3, align 4, !tbaa !18
  br label %32, !llvm.loop !24

109:                                              ; preds = %39
  call void @_ZN5ImGui7TreePopEv()
  br label %110

110:                                              ; preds = %109, %19
  ret void
}

declare void @_ZN5ImGui7TreePopEv() #2

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 = { "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, !11, i64 0}
!10 = !{!"_ZTS18ImGuiTableSettings", !11, i64 0, !11, i64 4, !12, i64 8, !13, i64 12, !13, i64 14, !14, i64 16}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!10, !13, i64 12}
!16 = !{!10, !11, i64 4}
!17 = !{!10, !13, i64 14}
!18 = !{!11, !11, i64 0}
!19 = !{!20, !13, i64 12}
!20 = !{!"_ZTS24ImGuiTableColumnSettings", !12, i64 0, !11, i64 4, !13, i64 8, !13, i64 10, !13, i64 12, !7, i64 14, !7, i64 14, !7, i64 14}
!21 = !{!20, !13, i64 10}
!22 = !{!20, !12, i64 0}
!23 = !{!20, !11, i64 4}
!24 = distinct !{!24, !25}
!25 = !{!"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"

%struct.ImGuiTableColumnSettings = type <{ float, i32, i16, i16, i16, i8, i8 }>

@.str.105 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.106 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.107 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.108 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.109 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.110 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.111 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.112 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.113 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN18ImGuiTableSettings17GetColumnSettingsEv(ptr noundef nonnull align 4 dereferenceable(17)) local_unnamed_addr #0 align 2

declare noundef zeroext i1 @_ZN5ImGui8TreeNodeEPKvPKcz(ptr noundef, ptr noundef, ...) local_unnamed_addr #1

declare void @_ZN5ImGui10BulletTextEPKcz(ptr noundef, ...) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5ImGui22DebugNodeTableSettingsEP18ImGuiTableSettings(ptr noundef %0) local_unnamed_addr #2 {
  %2 = load i32, ptr %0, align 4, !tbaa !5
  %3 = zext i32 %2 to i64
  %4 = inttoptr i64 %3 to ptr
  %5 = getelementptr inbounds i8, ptr %0, i64 12
  %6 = load i16, ptr %5, align 4, !tbaa !13
  %7 = sext i16 %6 to i32
  %8 = tail call noundef zeroext i1 (ptr, ptr, ...) @_ZN5ImGui8TreeNodeEPKvPKcz(ptr noundef %4, ptr noundef nonnull @.str.105, i32 noundef %2, i32 noundef %7)
  br i1 %8, label %9, label %44

9:                                                ; preds = %1
  %10 = getelementptr inbounds i8, ptr %0, i64 4
  %11 = load i32, ptr %10, align 4, !tbaa !14
  tail call void (ptr, ...) @_ZN5ImGui10BulletTextEPKcz(ptr noundef nonnull @.str.106, i32 noundef %11)
  %12 = load i16, ptr %5, align 4, !tbaa !13
  %13 = sext i16 %12 to i32
  %14 = getelementptr inbounds i8, ptr %0, i64 14
  %15 = load i16, ptr %14, align 2, !tbaa !15
  %16 = sext i16 %15 to i32
  tail call void (ptr, ...) @_ZN5ImGui10BulletTextEPKcz(ptr noundef nonnull @.str.107, i32 noundef %13, i32 noundef %16)
  %17 = load i16, ptr %5, align 4, !tbaa !13
  %18 = icmp sgt i16 %17, 0
  br i1 %18, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.thread24, %9
  tail call void @_ZN5ImGui7TreePopEv()
  br label %44

.lr.ph:                                           ; preds = %9, %.thread24
  %indvars.iv = phi i64 [ %indvars.iv.next, %.thread24 ], [ 0, %9 ]
  %19 = tail call noundef ptr @_ZN18ImGuiTableSettings17GetColumnSettingsEv(ptr noundef nonnull align 4 dereferenceable(17) %0)
  %20 = getelementptr inbounds %struct.ImGuiTableColumnSettings, ptr %19, i64 %indvars.iv
  %21 = getelementptr inbounds i8, ptr %20, i64 12
  %22 = load i16, ptr %21, align 4, !tbaa !16
  %.not = icmp eq i16 %22, -1
  %.phi.trans.insert = getelementptr inbounds i8, ptr %20, i64 14
  %.pre = load i8, ptr %.phi.trans.insert, align 2
  %.fr27 = freeze i8 %.pre
  br i1 %.not, label %.thread24, label %23

23:                                               ; preds = %.lr.ph
  %24 = and i8 %.fr27, 3
  %25 = sext i16 %22 to i32
  %26 = icmp eq i8 %24, 1
  %27 = icmp eq i8 %24, 2
  %.str.110..str.111 = select i1 %27, ptr @.str.110, ptr @.str.111
  %spec.select = select i1 %26, ptr @.str.109, ptr %.str.110..str.111
  br label %.thread24

.thread24:                                        ; preds = %.lr.ph, %23
  %28 = phi i32 [ %25, %23 ], [ -1, %.lr.ph ]
  %29 = phi ptr [ %spec.select, %23 ], [ @.str.111, %.lr.ph ]
  %.in.in = getelementptr inbounds i8, ptr %20, i64 10
  %.in = load i16, ptr %.in.in, align 2, !tbaa !18
  %30 = sext i16 %.in to i32
  %31 = lshr i8 %.fr27, 2
  %32 = and i8 %31, 1
  %33 = zext nneg i8 %32 to i32
  %34 = and i8 %.fr27, 8
  %.not21 = icmp eq i8 %34, 0
  %35 = select i1 %.not21, ptr @.str.113, ptr @.str.112
  %36 = load float, ptr %20, align 4, !tbaa !19
  %37 = fpext float %36 to double
  %38 = getelementptr inbounds i8, ptr %20, i64 4
  %39 = load i32, ptr %38, align 4, !tbaa !20
  %40 = trunc nuw nsw i64 %indvars.iv to i32
  tail call void (ptr, ...) @_ZN5ImGui10BulletTextEPKcz(ptr noundef nonnull @.str.108, i32 noundef %40, i32 noundef %30, i32 noundef %28, ptr noundef nonnull %29, i32 noundef %33, ptr noundef nonnull %35, double noundef %37, i32 noundef %39)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %41 = load i16, ptr %5, align 4, !tbaa !13
  %42 = sext i16 %41 to i64
  %43 = icmp slt i64 %indvars.iv.next, %42
  br i1 %43, label %.lr.ph, label %._crit_edge, !llvm.loop !21

44:                                               ; preds = %1, %._crit_edge
  ret void
}

declare void @_ZN5ImGui7TreePopEv() local_unnamed_addr #1

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 = { "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, !7, i64 0}
!6 = !{!"_ZTS18ImGuiTableSettings", !7, i64 0, !7, i64 4, !10, i64 8, !11, i64 12, !11, i64 14, !12, i64 16}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!"short", !8, i64 0}
!12 = !{!"bool", !8, i64 0}
!13 = !{!6, !11, i64 12}
!14 = !{!6, !7, i64 4}
!15 = !{!6, !11, i64 14}
!16 = !{!17, !11, i64 12}
!17 = !{!"_ZTS24ImGuiTableColumnSettings", !10, i64 0, !7, i64 4, !11, i64 8, !11, i64 10, !11, i64 12, !8, i64 14, !8, i64 14, !8, i64 14}
!18 = !{!17, !11, i64 10}
!19 = !{!17, !10, i64 0}
!20 = !{!17, !7, i64 4}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass