; LLVM IR from tangjz/acm-icpc :: codeforces/complete (816A)

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

@hh = external dso_local global i32, align 4
@mm = external dso_local global i32, align 4
@ans = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @hh, ptr noundef @mm)
  br label %3

3:                                                ; preds = %22, %0
  %4 = load i32, ptr @hh, align 4, !tbaa !5
  %5 = sdiv i32 %4, 10
  %6 = load i32, ptr @hh, align 4, !tbaa !5
  %7 = srem i32 %6, 10
  %8 = mul nsw i32 %7, 10
  %9 = add nsw i32 %5, %8
  %10 = load i32, ptr @mm, align 4, !tbaa !5
  %11 = icmp ne i32 %9, %10
  br i1 %11, label %12, label %26

12:                                               ; preds = %3
  br label %13

13:                                               ; preds = %12
  %14 = load i32, ptr @mm, align 4, !tbaa !5
  %15 = add nsw i32 %14, 1
  store i32 %15, ptr @mm, align 4, !tbaa !5
  %16 = icmp eq i32 %15, 60
  br i1 %16, label %17, label %22

17:                                               ; preds = %13
  store i32 0, ptr @mm, align 4, !tbaa !5
  %18 = load i32, ptr @hh, align 4, !tbaa !5
  %19 = add nsw i32 %18, 1
  store i32 %19, ptr @hh, align 4, !tbaa !5
  %20 = icmp eq i32 %19, 24
  br i1 %20, label %21, label %22

21:                                               ; preds = %17
  store i32 0, ptr @hh, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %21, %17, %13
  %23 = phi i1 [ false, %17 ], [ false, %13 ], [ false, %21 ]
  %24 = load i32, ptr @ans, align 4, !tbaa !5
  %25 = add nsw i32 %24, 1
  store i32 %25, ptr @ans, align 4, !tbaa !5
  br label %3, !llvm.loop !9

26:                                               ; preds = %3
  %27 = load i32, ptr @ans, align 4, !tbaa !5
  %28 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %27)
  ret i32 0
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #1

declare i32 @printf(ptr noundef, ...) #1

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

@hh = external dso_local global i32, align 4
@mm = external dso_local global i32, align 4
@ans = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nofree norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @hh, ptr noundef nonnull @mm)
  %hh.promoted = load i32, ptr @hh, align 4
  %mm.promoted = load i32, ptr @mm, align 4, !tbaa !5
  %ans.promoted = load i32, ptr @ans, align 4, !tbaa !5
  %2 = sdiv i32 %hh.promoted, 10
  %3 = srem i32 %hh.promoted, 10
  %4 = mul nsw i32 %3, 10
  %5 = add nsw i32 %4, %2
  %.not3 = icmp eq i32 %5, %mm.promoted
  br i1 %.not3, label %20, label %.lr.ph

.lr.ph:                                           ; preds = %0, %13
  %spec.store.select24 = phi i32 [ %spec.store.select1, %13 ], [ %hh.promoted, %0 ]
  %6 = phi i32 [ %14, %13 ], [ %mm.promoted, %0 ]
  %7 = phi i32 [ %15, %13 ], [ %ans.promoted, %0 ]
  %8 = add nsw i32 %6, 1
  %9 = icmp eq i32 %8, 60
  br i1 %9, label %10, label %13

10:                                               ; preds = %.lr.ph
  %11 = add nsw i32 %spec.store.select24, 1
  %12 = icmp eq i32 %11, 24
  %spec.store.select = select i1 %12, i32 0, i32 %11
  store i32 %spec.store.select, ptr @hh, align 4
  br label %13

13:                                               ; preds = %10, %.lr.ph
  %14 = phi i32 [ 0, %10 ], [ %8, %.lr.ph ]
  %spec.store.select1 = phi i32 [ %spec.store.select, %10 ], [ %spec.store.select24, %.lr.ph ]
  %15 = add nsw i32 %7, 1
  %16 = sdiv i32 %spec.store.select1, 10
  %17 = srem i32 %spec.store.select1, 10
  %18 = mul nsw i32 %17, 10
  %19 = add nsw i32 %18, %16
  %.not = icmp eq i32 %19, %14
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %13
  store i32 %14, ptr @mm, align 4, !tbaa !5
  store i32 %15, ptr @ans, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %._crit_edge, %0
  %21 = phi i32 [ %15, %._crit_edge ], [ %ans.promoted, %0 ]
  %22 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %21)
  ret i32 0
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

attributes #0 = { mustprogress nofree norecurse 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 = { nofree nounwind "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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass