; LLVM IR from xhub/reshop :: gui/external/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.41, %struct.ImSpan.42, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i16, i16, float, 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, 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.43, %struct.ImGuiTableColumnSortSpecs, [4 x i8], %struct.ImVector.44, %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, i16, i16, 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.41 = type { ptr, ptr }
%struct.ImSpan.42 = type { ptr, ptr }
%struct.ImRect = type { %struct.ImVec2, %struct.ImVec2 }
%struct.ImVec2 = type { float, float }
%struct.ImGuiTextBuffer = type { %struct.ImVector.28 }
%struct.ImVector.28 = type { i32, i32, ptr }
%struct.ImGuiTableInstanceData = type { i32, float, float, float, i32, i32 }
%struct.ImVector.43 = type { i32, i32, ptr }
%struct.ImGuiTableColumnSortSpecs = type <{ i32, i16, i16, i8, [3 x i8] }>
%struct.ImVector.44 = type { i32, i32, ptr }
%struct.ImGuiTableSortSpecs = type <{ ptr, i32, i8, [3 x i8] }>
%struct.ImGuiTableColumn = type <{ i32, float, 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.1 = external hidden unnamed_addr constant [81 x i8], align 1
@.str.70 = 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(115) 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 95
  %11 = load i8, ptr %10, align 1, !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 i16, ptr %21, align 8, !tbaa !31
  %23 = sext i16 %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 i16, ptr %28, align 8, !tbaa !31
  %30 = sext i16 %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 95
  store i8 0, ptr %37, align 1, !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 i16, ptr %40, align 8, !tbaa !31
  %42 = sext i16 %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 i16, ptr %47, align 8, !tbaa !31
  %49 = sext i16 %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.44, 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 %134

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

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 = %130, %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 13
  %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 %133

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(115) 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 23
  %83 = load i16, ptr %82, align 2, !tbaa !36
  %84 = sext i16 %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 %127

87:                                               ; preds = %76
  %88 = load ptr, ptr %7, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.ImGuiTableColumn, ptr %88, i32 0, i32 23
  %90 = load i16, ptr %89, align 2, !tbaa !36
  %91 = sext i16 %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 i16, ptr %93, align 8, !tbaa !31
  %95 = sext i16 %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.70, ptr noundef @.str.1, i32 noundef 2989, 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 23
  %104 = load i16, ptr %103, align 2, !tbaa !36
  %105 = sext i16 %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 10
  %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 i16
  %114 = load ptr, ptr %8, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.ImGuiTableColumnSortSpecs, ptr %114, i32 0, i32 1
  store i16 %113, ptr %115, align 4, !tbaa !40
  %116 = load ptr, ptr %7, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.ImGuiTableColumn, ptr %116, i32 0, i32 23
  %118 = load i16, ptr %117, align 2, !tbaa !36
  %119 = load ptr, ptr %8, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.ImGuiTableColumnSortSpecs, ptr %119, i32 0, i32 2
  store i16 %118, ptr %120, align 2, !tbaa !41
  %121 = load ptr, ptr %7, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.ImGuiTableColumn, ptr %121, i32 0, i32 38
  %123 = load i8, ptr %122, align 1
  %124 = and i8 %123, 3
  %125 = load ptr, ptr %8, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.ImGuiTableColumnSortSpecs, ptr %125, i32 0, i32 3
  store i8 %124, ptr %126, align 4, !tbaa !42
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  store i32 0, ptr %6, align 4
  br label %127

127:                                              ; preds = %100, %86
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  %128 = load i32, ptr %6, align 4
  switch i32 %128, label %146 [
    i32 0, label %129
    i32 4, label %130
  ]

129:                                              ; preds = %127
  br label %130

130:                                              ; preds = %129, %127
  %131 = load i32, ptr %5, align 4, !tbaa !34
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %5, align 4, !tbaa !34
  br label %69, !llvm.loop !43

133:                                              ; preds = %75
  br label %134

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

146:                                              ; preds = %127
  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 569}
!10 = !{!"_ZTS10ImGuiTable", !11, i64 0, !11, i64 4, !6, i64 8, !6, i64 16, !12, i64 24, !13, i64 40, !14, i64 56, !6, i64 72, !6, i64 80, !6, i64 88, !11, i64 96, !11, i64 100, !11, i64 104, !11, i64 108, !11, i64 112, !11, i64 116, !15, i64 120, !15, i64 122, !16, i64 124, !16, i64 128, !16, i64 132, !16, i64 136, !16, i64 140, !16, i64 144, !11, i64 148, !11, i64 150, !11, i64 152, !7, i64 156, !11, i64 164, !11, i64 168, !16, 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, !6, i64 384, !6, i64 392, !19, i64 400, !6, i64 416, !21, i64 424, !22, i64 448, !23, i64 464, !25, i64 480, !26, i64 496, !15, i64 512, !15, i64 514, !15, i64 516, !15, i64 518, !15, i64 520, !15, i64 522, !15, i64 524, !15, i64 526, !15, i64 528, !15, i64 530, !15, i64 532, !15, i64 534, !15, i64 536, !15, i64 538, !15, i64 540, !15, i64 542, !15, i64 544, !15, i64 546, !15, i64 548, !15, i64 550, !15, i64 552, !15, i64 554, !15, i64 556, !15, i64 558, !15, i64 560, !15, i64 562, !15, i64 564, !27, i64 566, !27, i64 567, !27, i64 568, !27, i64 569, !27, i64 570, !27, i64 571, !27, i64 572, !27, i64 573, !27, i64 574, !27, i64 575, !27, i64 576, !27, i64 577, !27, i64 578, !27, i64 579, !27, i64 580, !27, i64 581, !27, i64 582, !27, i64 583, !27, i64 584, !27, i64 585}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTS6ImSpanI16ImGuiTableColumnE", !6, i64 0, !6, i64 8}
!13 = !{!"_ZTS6ImSpanIsE", !6, i64 0, !6, i64 8}
!14 = !{!"_ZTS6ImSpanI18ImGuiTableCellDataE", !6, i64 0, !6, i64 8}
!15 = !{!"short", !7, i64 0}
!16 = !{!"float", !7, 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", !11, i64 0, !11, i64 4, !6, i64 8}
!21 = !{!"_ZTS22ImGuiTableInstanceData", !11, i64 0, !16, i64 4, !16, i64 8, !16, i64 12, !11, i64 16, !11, i64 20}
!22 = !{!"_ZTS8ImVectorI22ImGuiTableInstanceDataE", !11, i64 0, !11, i64 4, !6, i64 8}
!23 = !{!"_ZTS25ImGuiTableColumnSortSpecs", !11, i64 0, !15, i64 4, !15, i64 6, !24, i64 8}
!24 = !{!"_ZTS18ImGuiSortDirection", !7, i64 0}
!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, !15, i64 512}
!32 = !{!10, !27, i64 508}
!33 = !{!10, !6, i64 488}
!34 = !{!11, !11, i64 0}
!35 = !{!10, !11, i64 108}
!36 = !{!37, !15, i64 94}
!37 = !{!"_ZTS16ImGuiTableColumn", !11, i64 0, !16, i64 4, !16, i64 8, !16, i64 12, !16, i64 16, !16, i64 20, !16, i64 24, !16, i64 28, !16, i64 32, !17, i64 36, !11, i64 52, !16, i64 56, !16, i64 60, !16, i64 64, !16, i64 68, !16, i64 72, !16, i64 76, !16, i64 80, !15, i64 84, !15, i64 86, !15, i64 88, !15, i64 90, !15, i64 92, !15, i64 94, !15, i64 96, !15, i64 98, !15, i64 100, !27, i64 102, !27, i64 103, !27, i64 104, !27, i64 105, !27, i64 106, !27, i64 107, !27, i64 108, !27, i64 109, !7, i64 110, !7, i64 111, !7, i64 112, !7, i64 113, !7, i64 113, !7, i64 113, !7, i64 114}
!38 = !{!37, !11, i64 52}
!39 = !{!23, !11, i64 0}
!40 = !{!23, !15, i64 4}
!41 = !{!23, !15, i64 6}
!42 = !{!23, !24, i64 8}
!43 = distinct !{!43, !44}
!44 = !{!"llvm.loop.mustprogress"}
!45 = !{!10, !6, i64 496}
!46 = !{!10, !11, i64 504}


; 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.1 = external hidden unnamed_addr constant [81 x i8], align 1
@.str.70 = 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(115) 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 569
  %3 = load i8, ptr %2, align 1, !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 480
  %7 = getelementptr inbounds i8, ptr %0, i64 512
  %8 = load i16, ptr %7, align 8, !tbaa !29
  %9 = icmp slt i16 %8, 2
  %narrow = select i1 %9, i16 0, i16 %8
  %spec.select = sext i16 %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 508
  store i8 1, ptr %10, align 4, !tbaa !30
  store i8 0, ptr %2, align 1, !tbaa !5
  br label %11

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

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

16:                                               ; preds = %11
  %17 = getelementptr inbounds i8, ptr %0, i64 488
  %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 108
  %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, %47
  %.041 = phi i32 [ 0, %.lr.ph ], [ %48, %47 ]
  %27 = tail call noundef nonnull align 4 dereferenceable(115) ptr @_ZN6ImSpanI16ImGuiTableColumnEixEi(ptr noundef nonnull align 8 dereferenceable(16) %25, i32 noundef %.041)
  %28 = getelementptr inbounds i8, ptr %27, i64 94
  %29 = load i16, ptr %28, align 2, !tbaa !33
  %30 = icmp eq i16 %29, -1
  br i1 %30, label %47, label %31

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

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

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

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

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

.thread:                                          ; preds = %.thread.loopexit, %.preheader, %11, %19
  %51 = phi i16 [ %13, %19 ], [ %13, %11 ], [ %13, %.preheader ], [ %.pre, %.thread.loopexit ]
  %52 = phi ptr [ %20, %19 ], [ null, %11 ], [ %20, %.preheader ], [ %20, %.thread.loopexit ]
  %53 = getelementptr inbounds i8, ptr %0, i64 496
  store ptr %52, ptr %53, align 8, !tbaa !42
  %54 = sext i16 %51 to i32
  %55 = getelementptr inbounds i8, ptr %0, i64 504
  store i32 %54, ptr %55, align 8, !tbaa !43
  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 569}
!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, !15, i64 144, !7, i64 148, !7, i64 150, !7, i64 152, !8, i64 156, !7, i64 164, !7, 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, !15, i64 232, !15, i64 236, !16, i64 240, !16, i64 256, !16, i64 272, !16, i64 288, !16, i64 304, !16, i64 320, !16, i64 336, !16, i64 352, !16, i64 368, !10, i64 384, !10, i64 392, !18, i64 400, !10, i64 416, !20, i64 424, !21, i64 448, !22, i64 464, !24, i64 480, !25, i64 496, !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, !14, i64 546, !14, i64 548, !14, i64 550, !14, i64 552, !14, i64 554, !14, i64 556, !14, i64 558, !14, i64 560, !14, i64 562, !14, i64 564, !26, i64 566, !26, i64 567, !26, i64 568, !26, i64 569, !26, i64 570, !26, i64 571, !26, i64 572, !26, i64 573, !26, i64 574, !26, i64 575, !26, i64 576, !26, i64 577, !26, i64 578, !26, i64 579, !26, i64 580, !26, i64 581, !26, i64 582, !26, i64 583, !26, i64 584, !26, i64 585}
!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, !7, i64 16, !7, i64 20}
!21 = !{!"_ZTS8ImVectorI22ImGuiTableInstanceDataE", !7, i64 0, !7, i64 4, !10, i64 8}
!22 = !{!"_ZTS25ImGuiTableColumnSortSpecs", !7, i64 0, !14, i64 4, !14, i64 6, !23, i64 8}
!23 = !{!"_ZTS18ImGuiSortDirection", !8, i64 0}
!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, !14, i64 512}
!30 = !{!6, !26, i64 508}
!31 = !{!6, !10, i64 488}
!32 = !{!6, !7, i64 108}
!33 = !{!34, !14, i64 94}
!34 = !{!"_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, !15, i64 32, !16, i64 36, !7, i64 52, !15, i64 56, !15, i64 60, !15, i64 64, !15, i64 68, !15, i64 72, !15, i64 76, !15, i64 80, !14, i64 84, !14, i64 86, !14, i64 88, !14, i64 90, !14, i64 92, !14, i64 94, !14, i64 96, !14, i64 98, !14, i64 100, !26, i64 102, !26, i64 103, !26, i64 104, !26, i64 105, !26, i64 106, !26, i64 107, !26, i64 108, !26, i64 109, !8, i64 110, !8, i64 111, !8, i64 112, !8, i64 113, !8, i64 113, !8, i64 113, !8, i64 114}
!35 = !{!34, !7, i64 52}
!36 = !{!22, !7, i64 0}
!37 = !{!22, !14, i64 4}
!38 = !{!22, !14, i64 6}
!39 = !{!22, !23, i64 8}
!40 = distinct !{!40, !41}
!41 = !{!"llvm.loop.mustprogress"}
!42 = !{!6, !10, i64 496}
!43 = !{!6, !7, i64 504}


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