; LLVM IR from kazunetakahashi/atcoder :: 2017/0422_arc072/D.ll (Z2okv)

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

@X = external dso_local global i64, align 8
@Y = external dso_local global i64, align 8

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z2okv() #0 {
  %1 = alloca i1, align 1
  %2 = load i64, ptr @X, align 8, !tbaa !5
  %3 = load i64, ptr @Y, align 8, !tbaa !5
  %4 = icmp slt i64 %2, %3
  br i1 %4, label %5, label %6

5:                                                ; preds = %0
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) @X, ptr noundef nonnull align 8 dereferenceable(8) @Y) #2
  br label %6

6:                                                ; preds = %5, %0
  %7 = load i64, ptr @X, align 8, !tbaa !5
  %8 = icmp sle i64 %7, 1
  br i1 %8, label %9, label %10

9:                                                ; preds = %6
  store i1 false, ptr %1, align 1
  br label %27

10:                                               ; preds = %6
  %11 = load i64, ptr @Y, align 8, !tbaa !5
  %12 = icmp eq i64 %11, 0
  br i1 %12, label %13, label %14

13:                                               ; preds = %10
  store i1 true, ptr %1, align 1
  br label %27

14:                                               ; preds = %10
  %15 = load i64, ptr @X, align 8, !tbaa !5
  %16 = icmp eq i64 %15, 2
  br i1 %16, label %17, label %21

17:                                               ; preds = %14
  %18 = load i64, ptr @Y, align 8, !tbaa !5
  %19 = icmp eq i64 %18, 1
  br i1 %19, label %20, label %21

20:                                               ; preds = %17
  store i1 false, ptr %1, align 1
  br label %27

21:                                               ; preds = %17, %14
  %22 = load i64, ptr @X, align 8, !tbaa !5
  %23 = load i64, ptr @Y, align 8, !tbaa !5
  %24 = icmp eq i64 %22, %23
  br i1 %24, label %25, label %26

25:                                               ; preds = %21
  store i1 false, ptr %1, align 1
  br label %27

26:                                               ; preds = %21
  store i1 true, ptr %1, align 1
  br label %27

27:                                               ; preds = %26, %25, %20, %13, %9
  %28 = load i1, ptr %1, align 1
  ret i1 %28
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #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 = { 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 = { 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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

@X = external dso_local global i64, align 8
@Y = external dso_local global i64, align 8

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z2okv() local_unnamed_addr #0 {
  %1 = load i64, ptr @X, align 8, !tbaa !5
  %2 = load i64, ptr @Y, align 8, !tbaa !5
  %3 = icmp slt i64 %1, %2
  br i1 %3, label %4, label %5

4:                                                ; preds = %0
  tail call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) @X, ptr noundef nonnull align 8 dereferenceable(8) @Y) #2
  %.pr = load i64, ptr @X, align 8, !tbaa !5
  br label %5

5:                                                ; preds = %4, %0
  %6 = phi i64 [ %.pr, %4 ], [ %1, %0 ]
  %7 = icmp slt i64 %6, 2
  br i1 %7, label %15, label %8

8:                                                ; preds = %5
  %9 = load i64, ptr @Y, align 8
  %10 = icmp eq i64 %9, 0
  br i1 %10, label %15, label %11

11:                                               ; preds = %8
  %12 = icmp ne i64 %6, 2
  %13 = icmp ne i64 %9, 1
  %or.cond.not = or i1 %12, %13
  %14 = icmp ne i64 %6, %9
  %spec.select = and i1 %or.cond.not, %14
  br label %15

15:                                               ; preds = %11, %8, %5
  %.0 = phi i1 [ false, %5 ], [ true, %8 ], [ %spec.select, %11 ]
  ret i1 %.0
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) 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 = { 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 = { 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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