; LLVM IR from eyangch/competitive-programming :: USACOcontests/silver/2018.12/convention2.ll (Z2c1St5arrayIiLm3EES0_)

; 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.std::array" = type { [3 x i32] }

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z2c1St5arrayIiLm3EES0_(i64 %0, i32 %1, i64 %2, i32 %3) #0 {
  %5 = alloca i1, align 1
  %6 = alloca %"struct.std::array", align 4
  %7 = alloca { i64, i32 }, align 4
  %8 = alloca %"struct.std::array", align 4
  %9 = alloca { i64, i32 }, align 4
  %10 = getelementptr inbounds { i64, i32 }, ptr %7, i32 0, i32 0
  store i64 %0, ptr %10, align 4
  %11 = getelementptr inbounds { i64, i32 }, ptr %7, i32 0, i32 1
  store i32 %1, ptr %11, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %6, ptr align 4 %7, i64 12, i1 false)
  %12 = getelementptr inbounds { i64, i32 }, ptr %9, i32 0, i32 0
  store i64 %2, ptr %12, align 4
  %13 = getelementptr inbounds { i64, i32 }, ptr %9, i32 0, i32 1
  store i32 %3, ptr %13, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 4 %9, i64 12, i1 false)
  %14 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12) %6, i64 noundef 1) #2
  %15 = load i32, ptr %14, align 4, !tbaa !5
  %16 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12) %8, i64 noundef 1) #2
  %17 = load i32, ptr %16, align 4, !tbaa !5
  %18 = icmp eq i32 %15, %17
  br i1 %18, label %19, label %25

19:                                               ; preds = %4
  %20 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12) %6, i64 noundef 0) #2
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12) %8, i64 noundef 0) #2
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = icmp sgt i32 %21, %23
  store i1 %24, ptr %5, align 1
  br label %31

25:                                               ; preds = %4
  %26 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12) %6, i64 noundef 1) #2
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %28 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12) %8, i64 noundef 1) #2
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = icmp slt i32 %27, %29
  store i1 %30, ptr %5, align 1
  br label %31

31:                                               ; preds = %25, %19
  %32 = load i1, ptr %5, align 1
  ret i1 %32
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12), i64 noundef) #0 align 2

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !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"

%"struct.std::array" = type { [3 x i32] }

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z2c1St5arrayIiLm3EES0_(i64 %0, i32 %1, i64 %2, i32 %3) local_unnamed_addr #0 {
  %5 = alloca %"struct.std::array", align 8
  %6 = alloca %"struct.std::array", align 8
  store i64 %0, ptr %5, align 8
  %.sroa.22.0..sroa_idx = getelementptr inbounds i8, ptr %5, i64 8
  store i32 %1, ptr %.sroa.22.0..sroa_idx, align 8
  store i64 %2, ptr %6, align 8
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %6, i64 8
  store i32 %3, ptr %.sroa.2.0..sroa_idx, align 8
  %7 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12) %5, i64 noundef 1) #1
  %8 = load i32, ptr %7, align 4, !tbaa !5
  %9 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12) %6, i64 noundef 1) #1
  %10 = load i32, ptr %9, align 4, !tbaa !5
  %11 = icmp eq i32 %8, %10
  br i1 %11, label %12, label %18

12:                                               ; preds = %4
  %13 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12) %5, i64 noundef 0) #1
  %14 = load i32, ptr %13, align 4, !tbaa !5
  %15 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12) %6, i64 noundef 0) #1
  %16 = load i32, ptr %15, align 4, !tbaa !5
  %17 = icmp sgt i32 %14, %16
  br label %24

18:                                               ; preds = %4
  %19 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12) %5, i64 noundef 1) #1
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12) %6, i64 noundef 1) #1
  %22 = load i32, ptr %21, align 4, !tbaa !5
  %23 = icmp slt i32 %20, %22
  br label %24

24:                                               ; preds = %18, %12
  %.0 = phi i1 [ %17, %12 ], [ %23, %18 ]
  ret i1 %.0
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12), i64 noundef) local_unnamed_addr #0 align 2

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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,SROAPass