; LLVM IR from tangjz/acm-icpc :: luogu (1089)

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

@save = external dso_local global i32, align 4
@hand = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = 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
  %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) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %4

4:                                                ; preds = %24, %0
  %5 = load i32, ptr %2, align 4, !tbaa !5
  %6 = icmp sle i32 %5, 12
  br i1 %6, label %7, label %27

7:                                                ; preds = %4
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3)
  %9 = load i32, ptr %3, align 4, !tbaa !5
  %10 = sub nsw i32 300, %9
  %11 = load i32, ptr @hand, align 4, !tbaa !5
  %12 = add nsw i32 %11, %10
  store i32 %12, ptr @hand, align 4, !tbaa !5
  %13 = load i32, ptr @hand, align 4, !tbaa !5
  %14 = icmp slt i32 %13, 0
  br i1 %14, label %15, label %16

15:                                               ; preds = %7
  br label %27

16:                                               ; preds = %7
  %17 = load i32, ptr @hand, align 4, !tbaa !5
  %18 = sdiv i32 %17, 100
  %19 = mul nsw i32 %18, 100
  %20 = load i32, ptr @save, align 4, !tbaa !5
  %21 = add nsw i32 %20, %19
  store i32 %21, ptr @save, align 4, !tbaa !5
  %22 = load i32, ptr @hand, align 4, !tbaa !5
  %23 = srem i32 %22, 100
  store i32 %23, ptr @hand, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %16
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr %2, align 4, !tbaa !5
  br label %4, !llvm.loop !9

27:                                               ; preds = %15, %4
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = icmp sle i32 %28, 12
  br i1 %29, label %30, label %33

30:                                               ; preds = %27
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %31)
  br label %41

33:                                               ; preds = %27
  %34 = load i32, ptr @hand, align 4, !tbaa !5
  %35 = load i32, ptr @save, align 4, !tbaa !5
  %36 = add nsw i32 %34, %35
  %37 = load i32, ptr @save, align 4, !tbaa !5
  %38 = sdiv i32 %37, 5
  %39 = add nsw i32 %36, %38
  %40 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %39)
  br label %41

41:                                               ; preds = %33, %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #3
  ret i32 0
}

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

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

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

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

@save = external dso_local local_unnamed_addr global i32, align 4
@hand = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = 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 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #3
  %2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %3 = load i32, ptr %1, align 4, !tbaa !5
  %4 = load i32, ptr @hand, align 4, !tbaa !5
  %reass.sub = sub i32 %4, %3
  %reass.sub.fr = freeze i32 %reass.sub
  %5 = add i32 %reass.sub.fr, 300
  store i32 %5, ptr @hand, align 4, !tbaa !5
  %6 = icmp slt i32 %5, 0
  br i1 %6, label %125, label %7

7:                                                ; preds = %0
  %8 = urem i32 %5, 100
  %9 = sub nuw nsw i32 %5, %8
  %10 = load i32, ptr @save, align 4, !tbaa !5
  %11 = add nsw i32 %9, %10
  store i32 %11, ptr @save, align 4, !tbaa !5
  store i32 %8, ptr @hand, align 4, !tbaa !5
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %13 = load i32, ptr %1, align 4, !tbaa !5
  %14 = load i32, ptr @hand, align 4, !tbaa !5
  %reass.sub.1 = sub i32 %14, %13
  %reass.sub.fr.1 = freeze i32 %reass.sub.1
  %15 = add i32 %reass.sub.fr.1, 300
  store i32 %15, ptr @hand, align 4, !tbaa !5
  %16 = icmp slt i32 %15, 0
  br i1 %16, label %125, label %17

17:                                               ; preds = %7
  %18 = urem i32 %15, 100
  %19 = sub nuw nsw i32 %15, %18
  %20 = load i32, ptr @save, align 4, !tbaa !5
  %21 = add nsw i32 %19, %20
  store i32 %21, ptr @save, align 4, !tbaa !5
  store i32 %18, ptr @hand, align 4, !tbaa !5
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %23 = load i32, ptr %1, align 4, !tbaa !5
  %24 = load i32, ptr @hand, align 4, !tbaa !5
  %reass.sub.2 = sub i32 %24, %23
  %reass.sub.fr.2 = freeze i32 %reass.sub.2
  %25 = add i32 %reass.sub.fr.2, 300
  store i32 %25, ptr @hand, align 4, !tbaa !5
  %26 = icmp slt i32 %25, 0
  br i1 %26, label %125, label %27

27:                                               ; preds = %17
  %28 = urem i32 %25, 100
  %29 = sub nuw nsw i32 %25, %28
  %30 = load i32, ptr @save, align 4, !tbaa !5
  %31 = add nsw i32 %29, %30
  store i32 %31, ptr @save, align 4, !tbaa !5
  store i32 %28, ptr @hand, align 4, !tbaa !5
  %32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %33 = load i32, ptr %1, align 4, !tbaa !5
  %34 = load i32, ptr @hand, align 4, !tbaa !5
  %reass.sub.3 = sub i32 %34, %33
  %reass.sub.fr.3 = freeze i32 %reass.sub.3
  %35 = add i32 %reass.sub.fr.3, 300
  store i32 %35, ptr @hand, align 4, !tbaa !5
  %36 = icmp slt i32 %35, 0
  br i1 %36, label %125, label %37

37:                                               ; preds = %27
  %38 = urem i32 %35, 100
  %39 = sub nuw nsw i32 %35, %38
  %40 = load i32, ptr @save, align 4, !tbaa !5
  %41 = add nsw i32 %39, %40
  store i32 %41, ptr @save, align 4, !tbaa !5
  store i32 %38, ptr @hand, align 4, !tbaa !5
  %42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %43 = load i32, ptr %1, align 4, !tbaa !5
  %44 = load i32, ptr @hand, align 4, !tbaa !5
  %reass.sub.4 = sub i32 %44, %43
  %reass.sub.fr.4 = freeze i32 %reass.sub.4
  %45 = add i32 %reass.sub.fr.4, 300
  store i32 %45, ptr @hand, align 4, !tbaa !5
  %46 = icmp slt i32 %45, 0
  br i1 %46, label %125, label %47

47:                                               ; preds = %37
  %48 = urem i32 %45, 100
  %49 = sub nuw nsw i32 %45, %48
  %50 = load i32, ptr @save, align 4, !tbaa !5
  %51 = add nsw i32 %49, %50
  store i32 %51, ptr @save, align 4, !tbaa !5
  store i32 %48, ptr @hand, align 4, !tbaa !5
  %52 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %53 = load i32, ptr %1, align 4, !tbaa !5
  %54 = load i32, ptr @hand, align 4, !tbaa !5
  %reass.sub.5 = sub i32 %54, %53
  %reass.sub.fr.5 = freeze i32 %reass.sub.5
  %55 = add i32 %reass.sub.fr.5, 300
  store i32 %55, ptr @hand, align 4, !tbaa !5
  %56 = icmp slt i32 %55, 0
  br i1 %56, label %125, label %57

57:                                               ; preds = %47
  %58 = urem i32 %55, 100
  %59 = sub nuw nsw i32 %55, %58
  %60 = load i32, ptr @save, align 4, !tbaa !5
  %61 = add nsw i32 %59, %60
  store i32 %61, ptr @save, align 4, !tbaa !5
  store i32 %58, ptr @hand, align 4, !tbaa !5
  %62 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %63 = load i32, ptr %1, align 4, !tbaa !5
  %64 = load i32, ptr @hand, align 4, !tbaa !5
  %reass.sub.6 = sub i32 %64, %63
  %reass.sub.fr.6 = freeze i32 %reass.sub.6
  %65 = add i32 %reass.sub.fr.6, 300
  store i32 %65, ptr @hand, align 4, !tbaa !5
  %66 = icmp slt i32 %65, 0
  br i1 %66, label %125, label %67

67:                                               ; preds = %57
  %68 = urem i32 %65, 100
  %69 = sub nuw nsw i32 %65, %68
  %70 = load i32, ptr @save, align 4, !tbaa !5
  %71 = add nsw i32 %69, %70
  store i32 %71, ptr @save, align 4, !tbaa !5
  store i32 %68, ptr @hand, align 4, !tbaa !5
  %72 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %73 = load i32, ptr %1, align 4, !tbaa !5
  %74 = load i32, ptr @hand, align 4, !tbaa !5
  %reass.sub.7 = sub i32 %74, %73
  %reass.sub.fr.7 = freeze i32 %reass.sub.7
  %75 = add i32 %reass.sub.fr.7, 300
  store i32 %75, ptr @hand, align 4, !tbaa !5
  %76 = icmp slt i32 %75, 0
  br i1 %76, label %125, label %77

77:                                               ; preds = %67
  %78 = urem i32 %75, 100
  %79 = sub nuw nsw i32 %75, %78
  %80 = load i32, ptr @save, align 4, !tbaa !5
  %81 = add nsw i32 %79, %80
  store i32 %81, ptr @save, align 4, !tbaa !5
  store i32 %78, ptr @hand, align 4, !tbaa !5
  %82 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %83 = load i32, ptr %1, align 4, !tbaa !5
  %84 = load i32, ptr @hand, align 4, !tbaa !5
  %reass.sub.8 = sub i32 %84, %83
  %reass.sub.fr.8 = freeze i32 %reass.sub.8
  %85 = add i32 %reass.sub.fr.8, 300
  store i32 %85, ptr @hand, align 4, !tbaa !5
  %86 = icmp slt i32 %85, 0
  br i1 %86, label %125, label %87

87:                                               ; preds = %77
  %88 = urem i32 %85, 100
  %89 = sub nuw nsw i32 %85, %88
  %90 = load i32, ptr @save, align 4, !tbaa !5
  %91 = add nsw i32 %89, %90
  store i32 %91, ptr @save, align 4, !tbaa !5
  store i32 %88, ptr @hand, align 4, !tbaa !5
  %92 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %93 = load i32, ptr %1, align 4, !tbaa !5
  %94 = load i32, ptr @hand, align 4, !tbaa !5
  %reass.sub.9 = sub i32 %94, %93
  %reass.sub.fr.9 = freeze i32 %reass.sub.9
  %95 = add i32 %reass.sub.fr.9, 300
  store i32 %95, ptr @hand, align 4, !tbaa !5
  %96 = icmp slt i32 %95, 0
  br i1 %96, label %125, label %97

97:                                               ; preds = %87
  %98 = urem i32 %95, 100
  %99 = sub nuw nsw i32 %95, %98
  %100 = load i32, ptr @save, align 4, !tbaa !5
  %101 = add nsw i32 %99, %100
  store i32 %101, ptr @save, align 4, !tbaa !5
  store i32 %98, ptr @hand, align 4, !tbaa !5
  %102 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %103 = load i32, ptr %1, align 4, !tbaa !5
  %104 = load i32, ptr @hand, align 4, !tbaa !5
  %reass.sub.10 = sub i32 %104, %103
  %reass.sub.fr.10 = freeze i32 %reass.sub.10
  %105 = add i32 %reass.sub.fr.10, 300
  store i32 %105, ptr @hand, align 4, !tbaa !5
  %106 = icmp slt i32 %105, 0
  br i1 %106, label %125, label %107

107:                                              ; preds = %97
  %108 = urem i32 %105, 100
  %109 = sub nuw nsw i32 %105, %108
  %110 = load i32, ptr @save, align 4, !tbaa !5
  %111 = add nsw i32 %109, %110
  store i32 %111, ptr @save, align 4, !tbaa !5
  store i32 %108, ptr @hand, align 4, !tbaa !5
  %112 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %113 = load i32, ptr %1, align 4, !tbaa !5
  %114 = load i32, ptr @hand, align 4, !tbaa !5
  %reass.sub.11 = sub i32 %114, %113
  %reass.sub.fr.11 = freeze i32 %reass.sub.11
  %115 = add i32 %reass.sub.fr.11, 300
  store i32 %115, ptr @hand, align 4, !tbaa !5
  %116 = icmp slt i32 %115, 0
  br i1 %116, label %125, label %.critedge

.critedge:                                        ; preds = %107
  %117 = urem i32 %115, 100
  %118 = sub nuw nsw i32 %115, %117
  %119 = load i32, ptr @save, align 4, !tbaa !5
  %120 = add nsw i32 %118, %119
  store i32 %120, ptr @save, align 4, !tbaa !5
  store i32 %117, ptr @hand, align 4, !tbaa !5
  %121 = add i32 %115, %119
  %122 = sdiv i32 %120, 5
  %123 = add nsw i32 %121, %122
  %124 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %123)
  br label %127

125:                                              ; preds = %107, %97, %87, %77, %67, %57, %47, %37, %27, %17, %7, %0
  %.06.lcssa = phi i32 [ 1, %0 ], [ 2, %7 ], [ 3, %17 ], [ 4, %27 ], [ 5, %37 ], [ 6, %47 ], [ 7, %57 ], [ 8, %67 ], [ 9, %77 ], [ 10, %87 ], [ 11, %97 ], [ 12, %107 ]
  %126 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.06.lcssa)
  br label %127

127:                                              ; preds = %.critedge, %125
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #3
  ret i32 0
}

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

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

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

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