; LLVM IR from kazunetakahashi/atcoder :: 2019/0602_AGC034 (A)

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

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@_Z1SB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@A = external dso_local global i32, align 4
@B = external dso_local global i32, align 4
@C = external dso_local global i32, align 4
@D = external dso_local global i32, align 4
@N = external dso_local global i32, align 4
@_ZSt3cin = external global %"class.std::basic_istream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3Yesv() #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z2Nov() #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z5solveii(i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z6solve2iiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %1 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %2 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %3 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) @A)
  %4 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 4 dereferenceable(4) @B)
  %5 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 4 dereferenceable(4) @C)
  %6 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 4 dereferenceable(4) @D)
  %7 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(32) @_Z1SB5cxx11)
  %8 = load i32, ptr @A, align 4, !tbaa !5
  %9 = add nsw i32 %8, -1
  store i32 %9, ptr @A, align 4, !tbaa !5
  %10 = load i32, ptr @B, align 4, !tbaa !5
  %11 = add nsw i32 %10, -1
  store i32 %11, ptr @B, align 4, !tbaa !5
  %12 = load i32, ptr @C, align 4, !tbaa !5
  %13 = add nsw i32 %12, -1
  store i32 %13, ptr @C, align 4, !tbaa !5
  %14 = load i32, ptr @D, align 4, !tbaa !5
  %15 = add nsw i32 %14, -1
  store i32 %15, ptr @D, align 4, !tbaa !5
  %16 = load i32, ptr @C, align 4, !tbaa !5
  %17 = load i32, ptr @D, align 4, !tbaa !5
  %18 = icmp slt i32 %16, %17
  br i1 %18, label %19, label %29

19:                                               ; preds = %0
  %20 = load i32, ptr @A, align 4, !tbaa !5
  %21 = load i32, ptr @C, align 4, !tbaa !5
  %22 = call noundef zeroext i1 @_Z5solveii(i32 noundef %20, i32 noundef %21)
  br i1 %22, label %23, label %28

23:                                               ; preds = %19
  %24 = load i32, ptr @B, align 4, !tbaa !5
  %25 = load i32, ptr @D, align 4, !tbaa !5
  %26 = call noundef zeroext i1 @_Z5solveii(i32 noundef %24, i32 noundef %25)
  br i1 %26, label %27, label %28

27:                                               ; preds = %23
  call void @_Z3Yesv()
  br label %28

28:                                               ; preds = %27, %23, %19
  call void @_Z2Nov()
  br label %29

29:                                               ; preds = %28, %0
  %30 = load i32, ptr @B, align 4, !tbaa !5
  %31 = load i32, ptr @D, align 4, !tbaa !5
  %32 = call noundef zeroext i1 @_Z5solveii(i32 noundef %30, i32 noundef %31)
  br i1 %32, label %33, label %40

33:                                               ; preds = %29
  %34 = load i32, ptr @A, align 4, !tbaa !5
  %35 = load i32, ptr @C, align 4, !tbaa !5
  %36 = load i32, ptr @B, align 4, !tbaa !5
  %37 = load i32, ptr @D, align 4, !tbaa !5
  %38 = call noundef zeroext i1 @_Z6solve2iiii(i32 noundef %34, i32 noundef %35, i32 noundef %36, i32 noundef %37)
  br i1 %38, label %39, label %40

39:                                               ; preds = %33
  call void @_Z3Yesv()
  br label %40

40:                                               ; preds = %39, %33, %29
  call void @_Z2Nov()
  %41 = load i32, ptr %1, align 4
  ret i32 %41
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) #2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #2

attributes #0 = { 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 #1 = { mustprogress norecurse 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 = { "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, !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"

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@_Z1SB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@A = external dso_local global i32, align 4
@B = external dso_local global i32, align 4
@C = external dso_local global i32, align 4
@D = external dso_local global i32, align 4
@N = external dso_local global i32, align 4
@_ZSt3cin = external global %"class.std::basic_istream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3Yesv() local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z2Nov() local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z5solveii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z6solve2iiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %2 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(4) @A)
  %3 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) @B)
  %4 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 4 dereferenceable(4) @C)
  %5 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 4 dereferenceable(4) @D)
  %6 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(32) @_Z1SB5cxx11)
  %7 = load i32, ptr @A, align 4, !tbaa !5
  %8 = add nsw i32 %7, -1
  store i32 %8, ptr @A, align 4, !tbaa !5
  %9 = load i32, ptr @B, align 4, !tbaa !5
  %10 = add nsw i32 %9, -1
  store i32 %10, ptr @B, align 4, !tbaa !5
  %11 = load i32, ptr @C, align 4, !tbaa !5
  %12 = add nsw i32 %11, -1
  store i32 %12, ptr @C, align 4, !tbaa !5
  %13 = load i32, ptr @D, align 4, !tbaa !5
  %14 = add nsw i32 %13, -1
  store i32 %14, ptr @D, align 4, !tbaa !5
  %15 = icmp slt i32 %11, %13
  br i1 %15, label %16, label %24

16:                                               ; preds = %0
  %17 = tail call noundef zeroext i1 @_Z5solveii(i32 noundef %8, i32 noundef %12)
  br i1 %17, label %18, label %23

18:                                               ; preds = %16
  %19 = load i32, ptr @B, align 4, !tbaa !5
  %20 = load i32, ptr @D, align 4, !tbaa !5
  %21 = tail call noundef zeroext i1 @_Z5solveii(i32 noundef %19, i32 noundef %20)
  br i1 %21, label %22, label %23

22:                                               ; preds = %18
  tail call void @_Z3Yesv()
  br label %23

23:                                               ; preds = %22, %18, %16
  tail call void @_Z2Nov()
  %.pre = load i32, ptr @B, align 4, !tbaa !5
  %.pre1 = load i32, ptr @D, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %23, %0
  %25 = phi i32 [ %.pre1, %23 ], [ %14, %0 ]
  %26 = phi i32 [ %.pre, %23 ], [ %10, %0 ]
  %27 = tail call noundef zeroext i1 @_Z5solveii(i32 noundef %26, i32 noundef %25)
  br i1 %27, label %28, label %35

28:                                               ; preds = %24
  %29 = load i32, ptr @A, align 4, !tbaa !5
  %30 = load i32, ptr @C, align 4, !tbaa !5
  %31 = load i32, ptr @B, align 4, !tbaa !5
  %32 = load i32, ptr @D, align 4, !tbaa !5
  %33 = tail call noundef zeroext i1 @_Z6solve2iiii(i32 noundef %29, i32 noundef %30, i32 noundef %31, i32 noundef %32)
  br i1 %33, label %34, label %35

34:                                               ; preds = %28
  tail call void @_Z3Yesv()
  br label %35

35:                                               ; preds = %34, %28, %24
  tail call void @_Z2Nov()
  ret i32 0
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InstCombinePass,SROAPass,TailCallElimPass