; LLVM IR from lzyrapx/Competitive-Programming :: Retired_code/CDQ Divide and Conquer/HDU 4742（三维偏序）.ll (Z4cmpx5QueryS_)

; 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.Query = type { i32, i32, i32, i32, i32, i32 }

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z4cmpx5QueryS_(ptr noundef byval(%struct.Query) align 8 %0, ptr noundef byval(%struct.Query) align 8 %1) #0 {
  %3 = alloca i1, align 1
  %4 = getelementptr inbounds %struct.Query, ptr %0, i32 0, i32 0
  %5 = load i32, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds %struct.Query, ptr %1, i32 0, i32 0
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %8 = icmp eq i32 %5, %7
  br i1 %8, label %9, label %21

9:                                                ; preds = %2
  %10 = getelementptr inbounds %struct.Query, ptr %0, i32 0, i32 1
  %11 = load i32, ptr %10, align 4, !tbaa !10
  %12 = getelementptr inbounds %struct.Query, ptr %1, i32 0, i32 1
  %13 = load i32, ptr %12, align 4, !tbaa !10
  %14 = icmp eq i32 %11, %13
  br i1 %14, label %15, label %21

15:                                               ; preds = %9
  %16 = getelementptr inbounds %struct.Query, ptr %0, i32 0, i32 2
  %17 = load i32, ptr %16, align 8, !tbaa !11
  %18 = getelementptr inbounds %struct.Query, ptr %1, i32 0, i32 2
  %19 = load i32, ptr %18, align 8, !tbaa !11
  %20 = icmp slt i32 %17, %19
  store i1 %20, ptr %3, align 1
  br label %40

21:                                               ; preds = %9, %2
  %22 = getelementptr inbounds %struct.Query, ptr %0, i32 0, i32 0
  %23 = load i32, ptr %22, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.Query, ptr %1, i32 0, i32 0
  %25 = load i32, ptr %24, align 8, !tbaa !5
  %26 = icmp eq i32 %23, %25
  br i1 %26, label %27, label %33

27:                                               ; preds = %21
  %28 = getelementptr inbounds %struct.Query, ptr %0, i32 0, i32 1
  %29 = load i32, ptr %28, align 4, !tbaa !10
  %30 = getelementptr inbounds %struct.Query, ptr %1, i32 0, i32 1
  %31 = load i32, ptr %30, align 4, !tbaa !10
  %32 = icmp slt i32 %29, %31
  store i1 %32, ptr %3, align 1
  br label %40

33:                                               ; preds = %21
  br label %34

34:                                               ; preds = %33
  %35 = getelementptr inbounds %struct.Query, ptr %0, i32 0, i32 0
  %36 = load i32, ptr %35, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.Query, ptr %1, i32 0, i32 0
  %38 = load i32, ptr %37, align 8, !tbaa !5
  %39 = icmp slt i32 %36, %38
  store i1 %39, ptr %3, align 1
  br label %40

40:                                               ; preds = %34, %27, %15
  %41 = load i1, ptr %3, align 1
  ret i1 %41
}

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

!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 = !{!"_ZTS5Query", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 4}
!11 = !{!6, !7, i64 8}


; 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.Query = type { i32, i32, i32, i32, i32, i32 }

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local noundef zeroext i1 @_Z4cmpx5QueryS_(ptr nocapture noundef readonly byval(%struct.Query) align 8 %0, ptr nocapture noundef readonly byval(%struct.Query) align 8 %1) local_unnamed_addr #0 {
  %3 = load i32, ptr %0, align 8, !tbaa !5
  %4 = load i32, ptr %1, align 8, !tbaa !5
  %5 = icmp eq i32 %3, %4
  br i1 %5, label %6, label %20

6:                                                ; preds = %2
  %7 = getelementptr inbounds i8, ptr %0, i64 4
  %8 = load i32, ptr %7, align 4, !tbaa !10
  %9 = getelementptr inbounds i8, ptr %1, i64 4
  %10 = load i32, ptr %9, align 4, !tbaa !10
  %11 = icmp eq i32 %8, %10
  br i1 %11, label %12, label %18

12:                                               ; preds = %6
  %13 = getelementptr inbounds i8, ptr %0, i64 8
  %14 = load i32, ptr %13, align 8, !tbaa !11
  %15 = getelementptr inbounds i8, ptr %1, i64 8
  %16 = load i32, ptr %15, align 8, !tbaa !11
  %17 = icmp slt i32 %14, %16
  br label %22

18:                                               ; preds = %6
  %19 = icmp slt i32 %8, %10
  br label %22

20:                                               ; preds = %2
  %21 = icmp slt i32 %3, %4
  br label %22

22:                                               ; preds = %20, %18, %12
  %.0 = phi i1 [ %17, %12 ], [ %19, %18 ], [ %21, %20 ]
  ret i1 %.0
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) 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 = !{!"_ZTS5Query", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 4}
!11 = !{!6, !7, i64 8}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass