; LLVM IR from kazunetakahashi/atcoder :: 2020/0206_ABC144 (B)

; 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::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 }

@_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 norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  %4 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %5

5:                                                ; preds = %21, %0
  %6 = load i32, ptr %3, align 4, !tbaa !5
  %7 = icmp slt i32 %6, 10
  br i1 %7, label %9, label %8

8:                                                ; preds = %5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %24

9:                                                ; preds = %5
  %10 = load i32, ptr %2, align 4, !tbaa !5
  %11 = load i32, ptr %3, align 4, !tbaa !5
  %12 = srem i32 %10, %11
  %13 = icmp eq i32 %12, 0
  br i1 %13, label %14, label %20

14:                                               ; preds = %9
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = load i32, ptr %3, align 4, !tbaa !5
  %17 = sdiv i32 %15, %16
  %18 = icmp slt i32 %17, 10
  br i1 %18, label %19, label %20

19:                                               ; preds = %14
  call void @_Z3Yesv()
  br label %20

20:                                               ; preds = %19, %14, %9
  br label %21

21:                                               ; preds = %20
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = add nsw i32 %22, 1
  store i32 %23, ptr %3, align 4, !tbaa !5
  br label %5, !llvm.loop !9

24:                                               ; preds = %8
  call void @_Z2Nov()
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  %25 = load i32, ptr %1, align 4
  ret i32 %25
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 = { 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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; 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::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 }

@_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 norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #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) %1)
  %3 = load i32, ptr %1, align 4, !tbaa !5
  %4 = icmp slt i32 %3, 10
  br i1 %4, label %5, label %6

5:                                                ; preds = %0
  call void @_Z3Yesv()
  %.pre = load i32, ptr %1, align 4, !tbaa !5
  br label %6

6:                                                ; preds = %0, %5
  %7 = phi i32 [ %3, %0 ], [ %.pre, %5 ]
  %8 = and i32 %7, 1
  %9 = icmp eq i32 %8, 0
  %10 = icmp slt i32 %7, 20
  %or.cond = and i1 %9, %10
  br i1 %or.cond, label %11, label %12

11:                                               ; preds = %6
  call void @_Z3Yesv()
  %.pre6 = load i32, ptr %1, align 4, !tbaa !5
  br label %12

12:                                               ; preds = %11, %6
  %13 = phi i32 [ %.pre6, %11 ], [ %7, %6 ]
  %14 = srem i32 %13, 3
  %15 = icmp eq i32 %14, 0
  %16 = icmp slt i32 %13, 30
  %or.cond13 = and i1 %15, %16
  br i1 %or.cond13, label %17, label %18

17:                                               ; preds = %12
  call void @_Z3Yesv()
  %.pre7 = load i32, ptr %1, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %17, %12
  %19 = phi i32 [ %.pre7, %17 ], [ %13, %12 ]
  %20 = and i32 %19, 3
  %21 = icmp eq i32 %20, 0
  %22 = icmp slt i32 %19, 40
  %or.cond14 = and i1 %21, %22
  br i1 %or.cond14, label %23, label %24

23:                                               ; preds = %18
  call void @_Z3Yesv()
  %.pre8 = load i32, ptr %1, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %23, %18
  %25 = phi i32 [ %.pre8, %23 ], [ %19, %18 ]
  %26 = srem i32 %25, 5
  %27 = icmp eq i32 %26, 0
  %28 = icmp slt i32 %25, 50
  %or.cond15 = and i1 %27, %28
  br i1 %or.cond15, label %29, label %30

29:                                               ; preds = %24
  call void @_Z3Yesv()
  %.pre9 = load i32, ptr %1, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %29, %24
  %31 = phi i32 [ %.pre9, %29 ], [ %25, %24 ]
  %32 = srem i32 %31, 6
  %33 = icmp eq i32 %32, 0
  %34 = icmp slt i32 %31, 60
  %or.cond16 = and i1 %33, %34
  br i1 %or.cond16, label %35, label %36

35:                                               ; preds = %30
  call void @_Z3Yesv()
  %.pre10 = load i32, ptr %1, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %35, %30
  %37 = phi i32 [ %.pre10, %35 ], [ %31, %30 ]
  %38 = srem i32 %37, 7
  %39 = icmp eq i32 %38, 0
  %40 = icmp slt i32 %37, 70
  %or.cond17 = and i1 %39, %40
  br i1 %or.cond17, label %41, label %42

41:                                               ; preds = %36
  call void @_Z3Yesv()
  %.pre11 = load i32, ptr %1, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %41, %36
  %43 = phi i32 [ %.pre11, %41 ], [ %37, %36 ]
  %44 = and i32 %43, 7
  %45 = icmp eq i32 %44, 0
  %46 = icmp slt i32 %43, 80
  %or.cond18 = and i1 %45, %46
  br i1 %or.cond18, label %47, label %48

47:                                               ; preds = %42
  call void @_Z3Yesv()
  %.pre12 = load i32, ptr %1, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %47, %42
  %49 = phi i32 [ %.pre12, %47 ], [ %43, %42 ]
  %50 = srem i32 %49, 9
  %51 = icmp eq i32 %50, 0
  %52 = icmp slt i32 %49, 90
  %or.cond19 = and i1 %51, %52
  br i1 %or.cond19, label %53, label %54

53:                                               ; preds = %48
  call void @_Z3Yesv()
  br label %54

54:                                               ; preds = %53, %48
  call void @_Z2Nov()
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  ret i32 0
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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 #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 = { 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: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,SCCPPass,SROAPass,SimplifyCFGPass