; LLVM IR from l1mey112/yr11-physics-applied :: cimgui/imgui/imgui_tables.ll (ZN5ImGui19TableSortSpecsBuildEP10ImGuiTable)

; 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, i64, i64, i64, i64, 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, [4 x i8], %struct.ImVector.37, %struct.ImGuiTableColumnSortSpecs, [4 x i8], %struct.ImVector.38, %struct.ImGuiTableSortSpecs, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, [6 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 { 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, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 }>

@.str.2 = external hidden unnamed_addr constant [93 x i8], align 1
@.str.72 = external hidden unnamed_addr constant [42 x i8], align 1
@__PRETTY_FUNCTION__._ZN5ImGui19TableSortSpecsBuildEP10ImGuiTable = external hidden unnamed_addr constant [46 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5ImGui19TableSortSpecsBuildEP10ImGuiTable(ptr noundef %0) #3 {
  %2 = alloca ptr, align 8
  %3 = alloca i8, align 1
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #5
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.ImGuiTable, ptr %9, i32 0, i32 93
  %11 = load i8, ptr %10, align 4, !tbaa !9, !range !28, !noundef !29
  %12 = trunc i8 %11 to i1
  %13 = zext i1 %12 to i8
  store i8 %13, ptr %3, align 1, !tbaa !30
  %14 = load i8, ptr %3, align 1, !tbaa !30, !range !28, !noundef !29
  %15 = trunc i8 %14 to i1
  br i1 %15, label %16, label %38

16:                                               ; preds = %1
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_ZN5ImGui22TableSortSpecsSanitizeEP10ImGuiTable(ptr noundef %17)
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.ImGuiTable, ptr %18, i32 0, i32 63
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.ImGuiTable, ptr %20, i32 0, i32 65
  %22 = load i8, ptr %21, align 8, !tbaa !31
  %23 = sext i8 %22 to i32
  %24 = icmp sle i32 %23, 1
  br i1 %24, label %25, label %26

25:                                               ; preds = %16
  br label %31

26:                                               ; preds = %16
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.ImGuiTable, ptr %27, i32 0, i32 65
  %29 = load i8, ptr %28, align 8, !tbaa !31
  %30 = sext i8 %29 to i32
  br label %31

31:                                               ; preds = %26, %25
  %32 = phi i32 [ 0, %25 ], [ %30, %26 ]
  call void @_ZN8ImVectorI25ImGuiTableColumnSortSpecsE6resizeEi(ptr noundef nonnull align 8 dereferenceable(16) %19, i32 noundef %32)
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.ImGuiTable, ptr %33, i32 0, i32 64
  %35 = getelementptr inbounds %struct.ImGuiTableSortSpecs, ptr %34, i32 0, i32 2
  store i8 1, ptr %35, align 4, !tbaa !32
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.ImGuiTable, ptr %36, i32 0, i32 93
  store i8 0, ptr %37, align 4, !tbaa !9
  br label %38

38:                                               ; preds = %31, %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.ImGuiTable, ptr %39, i32 0, i32 65
  %41 = load i8, ptr %40, align 8, !tbaa !31
  %42 = sext i8 %41 to i32
  %43 = icmp eq i32 %42, 0
  br i1 %43, label %44, label %45

44:                                               ; preds = %38
  br label %61

45:                                               ; preds = %38
  %46 = load ptr, ptr %2, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.ImGuiTable, ptr %46, i32 0, i32 65
  %48 = load i8, ptr %47, align 8, !tbaa !31
  %49 = sext i8 %48 to i32
  %50 = icmp eq i32 %49, 1
  br i1 %50, label %51, label %54

51:                                               ; preds = %45
  %52 = load ptr, ptr %2, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.ImGuiTable, ptr %52, i32 0, i32 61
  br label %59

54:                                               ; preds = %45
  %55 = load ptr, ptr %2, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.ImGuiTable, ptr %55, i32 0, i32 63
  %57 = getelementptr inbounds %struct.ImVector.38, ptr %56, i32 0, i32 2
  %58 = load ptr, ptr %57, align 8, !tbaa !33
  br label %59

59:                                               ; preds = %54, %51
  %60 = phi ptr [ %53, %51 ], [ %58, %54 ]
  br label %61

61:                                               ; preds = %59, %44
  %62 = phi ptr [ null, %44 ], [ %60, %59 ]
  store ptr %62, ptr %4, align 8, !tbaa !5
  %63 = load i8, ptr %3, align 1, !tbaa !30, !range !28, !noundef !29
  %64 = trunc i8 %63 to i1
  br i1 %64, label %65, label %138

65:                                               ; preds = %61
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = icmp ne ptr %66, null
  br i1 %67, label %68, label %138

68:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !34
  br label %69

69:                                               ; preds = %134, %68
  %70 = load i32, ptr %5, align 4, !tbaa !34
  %71 = load ptr, ptr %2, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.ImGuiTable, ptr %71, i32 0, i32 14
  %73 = load i32, ptr %72, align 4, !tbaa !35
  %74 = icmp slt i32 %70, %73
  br i1 %74, label %76, label %75

75:                                               ; preds = %69
  store i32 2, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %137

76:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %77 = load ptr, ptr %2, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.ImGuiTable, ptr %77, i32 0, i32 4
  %79 = load i32, ptr %5, align 4, !tbaa !34
  %80 = call noundef nonnull align 4 dereferenceable(103) ptr @_ZN6ImSpanI16ImGuiTableColumnEixEi(ptr noundef nonnull align 8 dereferenceable(16) %78, i32 noundef %79)
  store ptr %80, ptr %7, align 8, !tbaa !5
  %81 = load ptr, ptr %7, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.ImGuiTableColumn, ptr %81, i32 0, i32 22
  %83 = load i8, ptr %82, align 2, !tbaa !36
  %84 = sext i8 %83 to i32
  %85 = icmp eq i32 %84, -1
  br i1 %85, label %86, label %87

86:                                               ; preds = %76
  store i32 4, ptr %6, align 4
  br label %131

87:                                               ; preds = %76
  %88 = load ptr, ptr %7, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.ImGuiTableColumn, ptr %88, i32 0, i32 22
  %90 = load i8, ptr %89, align 2, !tbaa !36
  %91 = sext i8 %90 to i32
  %92 = load ptr, ptr %2, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.ImGuiTable, ptr %92, i32 0, i32 65
  %94 = load i8, ptr %93, align 8, !tbaa !31
  %95 = sext i8 %94 to i32
  %96 = icmp slt i32 %91, %95
  br i1 %96, label %97, label %98

97:                                               ; preds = %87
  br label %100

98:                                               ; preds = %87
  call void @__assert_fail(ptr noundef @.str.72, ptr noundef @.str.2, i32 noundef 2805, ptr noundef @__PRETTY_FUNCTION__._ZN5ImGui19TableSortSpecsBuildEP10ImGuiTable) #6
  unreachable

99:                                               ; No predecessors!
  br label %100

100:                                              ; preds = %99, %97
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %101 = load ptr, ptr %4, align 8, !tbaa !5
  %102 = load ptr, ptr %7, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.ImGuiTableColumn, ptr %102, i32 0, i32 22
  %104 = load i8, ptr %103, align 2, !tbaa !36
  %105 = sext i8 %104 to i64
  %106 = getelementptr inbounds %struct.ImGuiTableColumnSortSpecs, ptr %101, i64 %105
  store ptr %106, ptr %8, align 8, !tbaa !5
  %107 = load ptr, ptr %7, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.ImGuiTableColumn, ptr %107, i32 0, i32 9
  %109 = load i32, ptr %108, align 4, !tbaa !38
  %110 = load ptr, ptr %8, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.ImGuiTableColumnSortSpecs, ptr %110, i32 0, i32 0
  store i32 %109, ptr %111, align 4, !tbaa !39
  %112 = load i32, ptr %5, align 4, !tbaa !34
  %113 = trunc i32 %112 to i8
  %114 = sext i8 %113 to i16
  %115 = load ptr, ptr %8, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.ImGuiTableColumnSortSpecs, ptr %115, i32 0, i32 1
  store i16 %114, ptr %116, align 4, !tbaa !40
  %117 = load ptr, ptr %7, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.ImGuiTableColumn, ptr %117, i32 0, i32 22
  %119 = load i8, ptr %118, align 2, !tbaa !36
  %120 = sext i8 %119 to i16
  %121 = load ptr, ptr %8, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.ImGuiTableColumnSortSpecs, ptr %121, i32 0, i32 2
  store i16 %120, ptr %122, align 2, !tbaa !41
  %123 = load ptr, ptr %7, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.ImGuiTableColumn, ptr %123, i32 0, i32 37
  %125 = load i8, ptr %124, align 1
  %126 = and i8 %125, 3
  %127 = zext i8 %126 to i32
  %128 = load ptr, ptr %8, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.ImGuiTableColumnSortSpecs, ptr %128, i32 0, i32 3
  %130 = trunc i32 %127 to i8
  store i8 %130, ptr %129, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  store i32 0, ptr %6, align 4
  br label %131

131:                                              ; preds = %100, %86
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  %132 = load i32, ptr %6, align 4
  switch i32 %132, label %150 [
    i32 0, label %133
    i32 4, label %134
  ]

133:                                              ; preds = %131
  br label %134

134:                                              ; preds = %133, %131
  %135 = load i32, ptr %5, align 4, !tbaa !34
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr %5, align 4, !tbaa !34
  br label %69, !llvm.loop !42

137:                                              ; preds = %75
  br label %138

138:                                              ; preds = %137, %65, %61
  %139 = load ptr, ptr %4, align 8, !tbaa !5
  %140 = load ptr, ptr %2, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.ImGuiTable, ptr %140, i32 0, i32 64
  %142 = getelementptr inbounds %struct.ImGuiTableSortSpecs, ptr %141, i32 0, i32 0
  store ptr %139, ptr %142, align 8, !tbaa !44
  %143 = load ptr, ptr %2, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.ImGuiTable, ptr %143, i32 0, i32 65
  %145 = load i8, ptr %144, align 8, !tbaa !31
  %146 = sext i8 %145 to i32
  %147 = load ptr, ptr %2, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.ImGuiTable, ptr %147, i32 0, i32 64
  %149 = getelementptr inbounds %struct.ImGuiTableSortSpecs, ptr %148, i32 0, i32 1
  store i32 %146, ptr %149, align 8, !tbaa !45
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #5
  ret void

150:                                              ; preds = %131
  unreachable
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5ImGui22TableSortSpecsSanitizeEP10ImGuiTable(ptr noundef) #3

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 = { inlinehint 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 = { nounwind }
attributes #6 = { noreturn 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, !27, i64 532}
!10 = !{!"_ZTS10ImGuiTable", !11, i64 0, !11, i64 4, !6, i64 8, !6, i64 16, !12, i64 24, !13, i64 40, !14, i64 56, !15, i64 72, !15, i64 80, !15, i64 88, !15, i64 96, !11, i64 104, !11, i64 108, !11, i64 112, !11, i64 116, !11, i64 120, !11, i64 124, !16, i64 128, !16, i64 130, !17, i64 132, !17, i64 136, !17, i64 140, !17, i64 144, !17, i64 148, !11, i64 152, !11, i64 154, !11, i64 156, !7, i64 160, !11, i64 168, !11, 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, !17, i64 232, !17, i64 236, !18, i64 240, !18, i64 256, !18, i64 272, !18, i64 288, !18, i64 304, !18, i64 320, !18, i64 336, !18, i64 352, !18, i64 368, !6, i64 384, !6, i64 392, !20, i64 400, !6, i64 416, !22, i64 424, !23, i64 440, !24, i64 456, !25, i64 472, !26, i64 488, !7, i64 504, !7, i64 505, !7, i64 506, !7, i64 507, !7, i64 508, !7, i64 509, !7, i64 510, !7, i64 511, !7, i64 512, !7, i64 513, !7, i64 514, !7, i64 515, !7, i64 516, !7, i64 517, !7, i64 518, !7, i64 519, !7, i64 520, !7, i64 521, !7, i64 522, !7, i64 523, !7, i64 524, !7, i64 525, !7, i64 526, !7, i64 527, !7, i64 528, !27, i64 529, !27, i64 530, !27, i64 531, !27, i64 532, !27, i64 533, !27, i64 534, !27, i64 535, !27, i64 536, !27, i64 537, !27, i64 538, !27, i64 539, !27, i64 540, !27, i64 541, !27, i64 542, !27, i64 543, !27, i64 544, !27, i64 545}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTS6ImSpanI16ImGuiTableColumnE", !6, i64 0, !6, i64 8}
!13 = !{!"_ZTS6ImSpanIaE", !6, i64 0, !6, i64 8}
!14 = !{!"_ZTS6ImSpanI18ImGuiTableCellDataE", !6, i64 0, !6, i64 8}
!15 = !{!"long long", !7, i64 0}
!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", !11, i64 0, !11, i64 4, !6, i64 8}
!22 = !{!"_ZTS22ImGuiTableInstanceData", !17, i64 0, !17, i64 4, !17, i64 8}
!23 = !{!"_ZTS8ImVectorI22ImGuiTableInstanceDataE", !11, i64 0, !11, i64 4, !6, i64 8}
!24 = !{!"_ZTS25ImGuiTableColumnSortSpecs", !11, i64 0, !16, i64 4, !16, i64 6, !11, i64 8}
!25 = !{!"_ZTS8ImVectorI25ImGuiTableColumnSortSpecsE", !11, i64 0, !11, i64 4, !6, i64 8}
!26 = !{!"_ZTS19ImGuiTableSortSpecs", !6, i64 0, !11, i64 8, !27, i64 12}
!27 = !{!"bool", !7, i64 0}
!28 = !{i8 0, i8 2}
!29 = !{}
!30 = !{!27, !27, i64 0}
!31 = !{!10, !7, i64 504}
!32 = !{!10, !27, i64 500}
!33 = !{!10, !6, i64 480}
!34 = !{!11, !11, i64 0}
!35 = !{!10, !11, i64 116}
!36 = !{!37, !7, i64 86}
!37 = !{!"_ZTS16ImGuiTableColumn", !11, 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, !11, 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, !7, i64 82, !7, i64 83, !7, i64 84, !7, i64 85, !7, i64 86, !7, i64 87, !7, i64 88, !7, i64 89, !27, i64 90, !27, i64 91, !27, i64 92, !27, i64 93, !27, i64 94, !27, i64 95, !27, i64 96, !27, i64 97, !7, i64 98, !7, i64 99, !7, i64 100, !7, i64 101, !7, i64 101, !7, i64 101, !7, i64 102}
!38 = !{!37, !11, i64 48}
!39 = !{!24, !11, i64 0}
!40 = !{!24, !16, i64 4}
!41 = !{!24, !16, i64 6}
!42 = distinct !{!42, !43}
!43 = !{!"llvm.loop.mustprogress"}
!44 = !{!10, !6, i64 488}
!45 = !{!10, !11, i64 496}


; 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.ImGuiTableColumnSortSpecs = type <{ i32, i16, i16, i8, [3 x i8] }>

@.str.2 = external hidden unnamed_addr constant [93 x i8], align 1
@.str.72 = external hidden unnamed_addr constant [42 x i8], align 1
@__PRETTY_FUNCTION__._ZN5ImGui19TableSortSpecsBuildEP10ImGuiTable = external hidden unnamed_addr constant [46 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5ImGui19TableSortSpecsBuildEP10ImGuiTable(ptr noundef %0) local_unnamed_addr #2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 532
  %3 = load i8, ptr %2, align 4, !tbaa !5, !range !27, !noundef !28
  %4 = trunc nuw i8 %3 to i1
  br i1 %4, label %5, label %11

5:                                                ; preds = %1
  tail call void @_ZN5ImGui22TableSortSpecsSanitizeEP10ImGuiTable(ptr noundef nonnull %0)
  %6 = getelementptr inbounds i8, ptr %0, i64 472
  %7 = getelementptr inbounds i8, ptr %0, i64 504
  %8 = load i8, ptr %7, align 8, !tbaa !29
  %9 = icmp slt i8 %8, 2
  %narrow = select i1 %9, i8 0, i8 %8
  %spec.select = sext i8 %narrow to i32
  tail call void @_ZN8ImVectorI25ImGuiTableColumnSortSpecsE6resizeEi(ptr noundef nonnull align 8 dereferenceable(16) %6, i32 noundef %spec.select)
  %10 = getelementptr inbounds i8, ptr %0, i64 500
  store i8 1, ptr %10, align 4, !tbaa !30
  store i8 0, ptr %2, align 4, !tbaa !5
  br label %11

11:                                               ; preds = %5, %1
  %12 = getelementptr inbounds i8, ptr %0, i64 504
  %13 = load i8, ptr %12, align 8, !tbaa !29
  switch i8 %13, label %16 [
    i8 0, label %.thread
    i8 1, label %14
  ]

14:                                               ; preds = %11
  %15 = getelementptr inbounds i8, ptr %0, i64 456
  br label %19

16:                                               ; preds = %11
  %17 = getelementptr inbounds i8, ptr %0, i64 480
  %18 = load ptr, ptr %17, align 8, !tbaa !31
  br label %19

19:                                               ; preds = %14, %16
  %20 = phi ptr [ %15, %14 ], [ %18, %16 ]
  %21 = icmp ne ptr %20, null
  %or.cond = select i1 %4, i1 %21, i1 false
  br i1 %or.cond, label %.preheader, label %.thread

.preheader:                                       ; preds = %19
  %22 = getelementptr inbounds i8, ptr %0, i64 116
  %23 = load i32, ptr %22, align 4, !tbaa !32
  %24 = icmp sgt i32 %23, 0
  br i1 %24, label %.lr.ph, label %.thread

.lr.ph:                                           ; preds = %.preheader
  %25 = getelementptr inbounds i8, ptr %0, i64 24
  br label %26

26:                                               ; preds = %.lr.ph, %49
  %.041 = phi i32 [ 0, %.lr.ph ], [ %50, %49 ]
  %27 = tail call noundef nonnull align 4 dereferenceable(103) ptr @_ZN6ImSpanI16ImGuiTableColumnEixEi(ptr noundef nonnull align 8 dereferenceable(16) %25, i32 noundef %.041)
  %28 = getelementptr inbounds i8, ptr %27, i64 86
  %29 = load i8, ptr %28, align 2, !tbaa !33
  %30 = icmp eq i8 %29, -1
  br i1 %30, label %49, label %31

31:                                               ; preds = %26
  %32 = load i8, ptr %12, align 8, !tbaa !29
  %33 = icmp slt i8 %29, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %31
  tail call void @__assert_fail(ptr noundef nonnull @.str.72, ptr noundef nonnull @.str.2, i32 noundef 2805, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN5ImGui19TableSortSpecsBuildEP10ImGuiTable) #4
  unreachable

35:                                               ; preds = %31
  %36 = sext i8 %29 to i64
  %37 = getelementptr inbounds %struct.ImGuiTableColumnSortSpecs, ptr %20, i64 %36
  %38 = getelementptr inbounds i8, ptr %27, i64 48
  %39 = load i32, ptr %38, align 4, !tbaa !35
  store i32 %39, ptr %37, align 4, !tbaa !36
  %40 = trunc i32 %.041 to i16
  %sext = shl i16 %40, 8
  %41 = ashr exact i16 %sext, 8
  %42 = getelementptr inbounds i8, ptr %37, i64 4
  store i16 %41, ptr %42, align 4, !tbaa !37
  %43 = sext i8 %29 to i16
  %44 = getelementptr inbounds i8, ptr %37, i64 6
  store i16 %43, ptr %44, align 2, !tbaa !38
  %45 = getelementptr inbounds i8, ptr %27, i64 101
  %46 = load i8, ptr %45, align 1
  %47 = and i8 %46, 3
  %48 = getelementptr inbounds i8, ptr %37, i64 8
  store i8 %47, ptr %48, align 4
  br label %49

49:                                               ; preds = %26, %35
  %50 = add nuw nsw i32 %.041, 1
  %51 = load i32, ptr %22, align 4, !tbaa !32
  %52 = icmp slt i32 %50, %51
  br i1 %52, label %26, label %.thread.loopexit, !llvm.loop !39

.thread.loopexit:                                 ; preds = %49
  %.pre = load i8, ptr %12, align 8, !tbaa !29
  br label %.thread

.thread:                                          ; preds = %.thread.loopexit, %.preheader, %11, %19
  %53 = phi i8 [ %13, %19 ], [ %13, %11 ], [ %13, %.preheader ], [ %.pre, %.thread.loopexit ]
  %54 = phi ptr [ %20, %19 ], [ null, %11 ], [ %20, %.preheader ], [ %20, %.thread.loopexit ]
  %55 = getelementptr inbounds i8, ptr %0, i64 488
  store ptr %54, ptr %55, align 8, !tbaa !41
  %56 = sext i8 %53 to i32
  %57 = getelementptr inbounds i8, ptr %0, i64 496
  store i32 %56, ptr %57, align 8, !tbaa !42
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5ImGui22TableSortSpecsSanitizeEP10ImGuiTable(ptr noundef) local_unnamed_addr #2

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

attributes #0 = { 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 #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 = { inlinehint 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 = { noreturn 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, !26, i64 532}
!6 = !{!"_ZTS10ImGuiTable", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 16, !11, i64 24, !12, i64 40, !13, i64 56, !14, i64 72, !14, i64 80, !14, i64 88, !14, i64 96, !7, i64 104, !7, i64 108, !7, i64 112, !7, i64 116, !7, i64 120, !7, i64 124, !15, i64 128, !15, i64 130, !16, i64 132, !16, i64 136, !16, i64 140, !16, i64 144, !16, i64 148, !7, i64 152, !7, i64 154, !7, i64 156, !8, i64 160, !7, i64 168, !7, i64 172, !16, i64 176, !16, i64 180, !16, i64 184, !16, i64 188, !16, i64 192, !16, i64 196, !16, i64 200, !16, i64 204, !16, i64 208, !16, i64 212, !16, i64 216, !16, i64 220, !16, i64 224, !16, i64 228, !16, i64 232, !16, i64 236, !17, i64 240, !17, i64 256, !17, i64 272, !17, i64 288, !17, i64 304, !17, i64 320, !17, i64 336, !17, i64 352, !17, i64 368, !10, i64 384, !10, i64 392, !19, i64 400, !10, i64 416, !21, i64 424, !22, i64 440, !23, i64 456, !24, i64 472, !25, i64 488, !8, i64 504, !8, i64 505, !8, i64 506, !8, i64 507, !8, i64 508, !8, i64 509, !8, i64 510, !8, i64 511, !8, i64 512, !8, i64 513, !8, i64 514, !8, i64 515, !8, i64 516, !8, i64 517, !8, i64 518, !8, i64 519, !8, i64 520, !8, i64 521, !8, i64 522, !8, i64 523, !8, i64 524, !8, i64 525, !8, i64 526, !8, i64 527, !8, i64 528, !26, i64 529, !26, i64 530, !26, i64 531, !26, i64 532, !26, i64 533, !26, i64 534, !26, i64 535, !26, i64 536, !26, i64 537, !26, i64 538, !26, i64 539, !26, i64 540, !26, i64 541, !26, i64 542, !26, i64 543, !26, i64 544, !26, i64 545}
!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 = !{!"_ZTS6ImSpanIaE", !10, i64 0, !10, i64 8}
!13 = !{!"_ZTS6ImSpanI18ImGuiTableCellDataE", !10, i64 0, !10, i64 8}
!14 = !{!"long long", !8, i64 0}
!15 = !{!"short", !8, i64 0}
!16 = !{!"float", !8, i64 0}
!17 = !{!"_ZTS6ImRect", !18, i64 0, !18, i64 8}
!18 = !{!"_ZTS6ImVec2", !16, i64 0, !16, i64 4}
!19 = !{!"_ZTS15ImGuiTextBuffer", !20, i64 0}
!20 = !{!"_ZTS8ImVectorIcE", !7, i64 0, !7, i64 4, !10, i64 8}
!21 = !{!"_ZTS22ImGuiTableInstanceData", !16, i64 0, !16, i64 4, !16, i64 8}
!22 = !{!"_ZTS8ImVectorI22ImGuiTableInstanceDataE", !7, i64 0, !7, i64 4, !10, i64 8}
!23 = !{!"_ZTS25ImGuiTableColumnSortSpecs", !7, i64 0, !15, i64 4, !15, i64 6, !7, i64 8}
!24 = !{!"_ZTS8ImVectorI25ImGuiTableColumnSortSpecsE", !7, i64 0, !7, i64 4, !10, i64 8}
!25 = !{!"_ZTS19ImGuiTableSortSpecs", !10, i64 0, !7, i64 8, !26, i64 12}
!26 = !{!"bool", !8, i64 0}
!27 = !{i8 0, i8 2}
!28 = !{}
!29 = !{!6, !8, i64 504}
!30 = !{!6, !26, i64 500}
!31 = !{!6, !10, i64 480}
!32 = !{!6, !7, i64 116}
!33 = !{!34, !8, i64 86}
!34 = !{!"_ZTS16ImGuiTableColumn", !7, i64 0, !16, i64 4, !16, i64 8, !16, i64 12, !16, i64 16, !16, i64 20, !16, i64 24, !16, i64 28, !17, i64 32, !7, i64 48, !16, i64 52, !16, i64 56, !16, i64 60, !16, i64 64, !16, i64 68, !16, i64 72, !16, i64 76, !15, i64 80, !8, i64 82, !8, i64 83, !8, i64 84, !8, i64 85, !8, i64 86, !8, i64 87, !8, i64 88, !8, i64 89, !26, i64 90, !26, i64 91, !26, i64 92, !26, i64 93, !26, i64 94, !26, i64 95, !26, i64 96, !26, i64 97, !8, i64 98, !8, i64 99, !8, i64 100, !8, i64 101, !8, i64 101, !8, i64 101, !8, i64 102}
!35 = !{!34, !7, i64 48}
!36 = !{!23, !7, i64 0}
!37 = !{!23, !15, i64 4}
!38 = !{!23, !15, i64 6}
!39 = distinct !{!39, !40}
!40 = !{!"llvm.loop.mustprogress"}
!41 = !{!6, !10, i64 488}
!42 = !{!6, !7, i64 496}


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