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

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

@n = external dso_local global i32, align 4
@buf = external dso_local global [400001 x i8], align 16
@out = external dso_local global [400001 x i8], align 16
@.str = external hidden unnamed_addr constant [5 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
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %7 = call i64 @time(ptr noundef null) #6
  %8 = trunc i64 %7 to i32
  call void @srand(i32 noundef %8) #6
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @buf)
  br label %10

10:                                               ; preds = %169, %0
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %11

11:                                               ; preds = %86, %10
  %12 = load i32, ptr %4, align 4, !tbaa !5
  %13 = load i32, ptr @n, align 4, !tbaa !5
  %14 = icmp slt i32 %12, %13
  br i1 %14, label %16, label %15

15:                                               ; preds = %11
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %89

16:                                               ; preds = %11
  %17 = load i32, ptr %4, align 4, !tbaa !5
  %18 = add nsw i32 %17, 1
  %19 = load i32, ptr @n, align 4, !tbaa !5
  %20 = icmp slt i32 %18, %19
  br i1 %20, label %21, label %64

21:                                               ; preds = %16
  %22 = call i32 @rand() #6
  %23 = and i32 %22, 1
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %25, label %64

25:                                               ; preds = %21
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [400001 x i8], ptr @buf, i64 0, i64 %27
  %29 = load i8, ptr %28, align 1, !tbaa !9
  %30 = sext i8 %29 to i32
  %31 = sub nsw i32 %30, 48
  %32 = mul nsw i32 %31, 10
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = add nsw i32 %33, 1
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [400001 x i8], ptr @buf, i64 0, i64 %35
  %37 = load i8, ptr %36, align 1, !tbaa !9
  %38 = sext i8 %37 to i32
  %39 = sub nsw i32 %38, 48
  %40 = add nsw i32 %32, %39
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = add nsw i32 %41, %40
  store i32 %42, ptr %3, align 4, !tbaa !5
  %43 = load i32, ptr %4, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %4, align 4, !tbaa !5
  %45 = sext i32 %43 to i64
  %46 = getelementptr inbounds [400001 x i8], ptr @buf, i64 0, i64 %45
  %47 = load i8, ptr %46, align 1, !tbaa !9
  %48 = load i32, ptr %2, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %2, align 4, !tbaa !5
  %50 = sext i32 %48 to i64
  %51 = getelementptr inbounds [400001 x i8], ptr @out, i64 0, i64 %50
  store i8 %47, ptr %51, align 1, !tbaa !9
  %52 = load i32, ptr %4, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [400001 x i8], ptr @buf, i64 0, i64 %53
  %55 = load i8, ptr %54, align 1, !tbaa !9
  %56 = load i32, ptr %2, align 4, !tbaa !5
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %2, align 4, !tbaa !5
  %58 = sext i32 %56 to i64
  %59 = getelementptr inbounds [400001 x i8], ptr @out, i64 0, i64 %58
  store i8 %55, ptr %59, align 1, !tbaa !9
  %60 = load i32, ptr %2, align 4, !tbaa !5
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %2, align 4, !tbaa !5
  %62 = sext i32 %60 to i64
  %63 = getelementptr inbounds [400001 x i8], ptr @out, i64 0, i64 %62
  store i8 43, ptr %63, align 1, !tbaa !9
  br label %85

64:                                               ; preds = %21, %16
  %65 = load i32, ptr %4, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [400001 x i8], ptr @buf, i64 0, i64 %66
  %68 = load i8, ptr %67, align 1, !tbaa !9
  %69 = sext i8 %68 to i32
  %70 = sub nsw i32 %69, 48
  %71 = load i32, ptr %3, align 4, !tbaa !5
  %72 = add nsw i32 %71, %70
  store i32 %72, ptr %3, align 4, !tbaa !5
  %73 = load i32, ptr %4, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [400001 x i8], ptr @buf, i64 0, i64 %74
  %76 = load i8, ptr %75, align 1, !tbaa !9
  %77 = load i32, ptr %2, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %2, align 4, !tbaa !5
  %79 = sext i32 %77 to i64
  %80 = getelementptr inbounds [400001 x i8], ptr @out, i64 0, i64 %79
  store i8 %76, ptr %80, align 1, !tbaa !9
  %81 = load i32, ptr %2, align 4, !tbaa !5
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %2, align 4, !tbaa !5
  %83 = sext i32 %81 to i64
  %84 = getelementptr inbounds [400001 x i8], ptr @out, i64 0, i64 %83
  store i8 43, ptr %84, align 1, !tbaa !9
  br label %85

85:                                               ; preds = %64, %25
  br label %86

86:                                               ; preds = %85
  %87 = load i32, ptr %4, align 4, !tbaa !5
  %88 = add nsw i32 %87, 1
  store i32 %88, ptr %4, align 4, !tbaa !5
  br label %11, !llvm.loop !10

89:                                               ; preds = %15
  %90 = load i32, ptr %2, align 4, !tbaa !5
  %91 = add nsw i32 %90, -1
  store i32 %91, ptr %2, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [400001 x i8], ptr @out, i64 0, i64 %92
  store i8 0, ptr %93, align 1, !tbaa !9
  %94 = load i32, ptr %3, align 4, !tbaa !5
  %95 = call noundef i32 @_Z4calci(i32 noundef %94)
  %96 = call noundef i32 @_Z4calci(i32 noundef %95)
  %97 = icmp slt i32 %96, 10
  br i1 %97, label %98, label %166

98:                                               ; preds = %89
  %99 = call i32 @puts(ptr noundef @out)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %100 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %100, ptr %5, align 4, !tbaa !5
  store i32 0, ptr %3, align 4, !tbaa !5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %101

101:                                              ; preds = %105, %98
  %102 = load i32, ptr %5, align 4, !tbaa !5
  %103 = icmp sgt i32 %102, 0
  br i1 %103, label %104, label %124

104:                                              ; preds = %101
  br label %105

105:                                              ; preds = %104
  %106 = load i32, ptr %2, align 4, !tbaa !5
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr %2, align 4, !tbaa !5
  %108 = sext i32 %106 to i64
  %109 = getelementptr inbounds [400001 x i8], ptr @out, i64 0, i64 %108
  store i8 43, ptr %109, align 1, !tbaa !9
  %110 = load i32, ptr %5, align 4, !tbaa !5
  %111 = srem i32 %110, 10
  %112 = add nsw i32 48, %111
  %113 = trunc i32 %112 to i8
  %114 = load i32, ptr %2, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %2, align 4, !tbaa !5
  %116 = sext i32 %114 to i64
  %117 = getelementptr inbounds [400001 x i8], ptr @out, i64 0, i64 %116
  store i8 %113, ptr %117, align 1, !tbaa !9
  %118 = load i32, ptr %5, align 4, !tbaa !5
  %119 = srem i32 %118, 10
  %120 = load i32, ptr %3, align 4, !tbaa !5
  %121 = add nsw i32 %120, %119
  store i32 %121, ptr %3, align 4, !tbaa !5
  %122 = load i32, ptr %5, align 4, !tbaa !5
  %123 = sdiv i32 %122, 10
  store i32 %123, ptr %5, align 4, !tbaa !5
  br label %101, !llvm.loop !12

124:                                              ; preds = %101
  %125 = load i32, ptr %2, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds i8, ptr @out, i64 %126
  call void @_ZSt7reverseIPcEvT_S1_(ptr noundef @out, ptr noundef %127)
  %128 = load i32, ptr %2, align 4, !tbaa !5
  %129 = add nsw i32 %128, -1
  store i32 %129, ptr %2, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [400001 x i8], ptr @out, i64 0, i64 %130
  store i8 0, ptr %131, align 1, !tbaa !9
  %132 = call i32 @puts(ptr noundef @out)
  %133 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %133, ptr %5, align 4, !tbaa !5
  store i32 0, ptr %3, align 4, !tbaa !5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %134

134:                                              ; preds = %138, %124
  %135 = load i32, ptr %5, align 4, !tbaa !5
  %136 = icmp sgt i32 %135, 0
  br i1 %136, label %137, label %157

137:                                              ; preds = %134
  br label %138

138:                                              ; preds = %137
  %139 = load i32, ptr %2, align 4, !tbaa !5
  %140 = add nsw i32 %139, 1
  store i32 %140, ptr %2, align 4, !tbaa !5
  %141 = sext i32 %139 to i64
  %142 = getelementptr inbounds [400001 x i8], ptr @out, i64 0, i64 %141
  store i8 43, ptr %142, align 1, !tbaa !9
  %143 = load i32, ptr %5, align 4, !tbaa !5
  %144 = srem i32 %143, 10
  %145 = add nsw i32 48, %144
  %146 = trunc i32 %145 to i8
  %147 = load i32, ptr %2, align 4, !tbaa !5
  %148 = add nsw i32 %147, 1
  store i32 %148, ptr %2, align 4, !tbaa !5
  %149 = sext i32 %147 to i64
  %150 = getelementptr inbounds [400001 x i8], ptr @out, i64 0, i64 %149
  store i8 %146, ptr %150, align 1, !tbaa !9
  %151 = load i32, ptr %5, align 4, !tbaa !5
  %152 = srem i32 %151, 10
  %153 = load i32, ptr %3, align 4, !tbaa !5
  %154 = add nsw i32 %153, %152
  store i32 %154, ptr %3, align 4, !tbaa !5
  %155 = load i32, ptr %5, align 4, !tbaa !5
  %156 = sdiv i32 %155, 10
  store i32 %156, ptr %5, align 4, !tbaa !5
  br label %134, !llvm.loop !13

157:                                              ; preds = %134
  %158 = load i32, ptr %2, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds i8, ptr @out, i64 %159
  call void @_ZSt7reverseIPcEvT_S1_(ptr noundef @out, ptr noundef %160)
  %161 = load i32, ptr %2, align 4, !tbaa !5
  %162 = add nsw i32 %161, -1
  store i32 %162, ptr %2, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [400001 x i8], ptr @out, i64 0, i64 %163
  store i8 0, ptr %164, align 1, !tbaa !9
  %165 = call i32 @puts(ptr noundef @out)
  store i32 3, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %167

166:                                              ; preds = %89
  store i32 0, ptr %6, align 4
  br label %167

167:                                              ; preds = %166, %157
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %168 = load i32, ptr %6, align 4
  switch i32 %168, label %171 [
    i32 0, label %169
    i32 3, label %170
  ]

169:                                              ; preds = %167
  br label %10, !llvm.loop !14

170:                                              ; preds = %167
  ret i32 0

171:                                              ; preds = %167
  unreachable
}

; Function Attrs: nounwind
declare void @srand(i32 noundef) #1

; Function Attrs: nounwind
declare i64 @time(ptr noundef) #1

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

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

; Function Attrs: nounwind
declare i32 @rand() #1

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4calci(i32 noundef) #4

declare i32 @puts(ptr noundef) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt7reverseIPcEvT_S1_(ptr noundef, ptr noundef) #5

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 = { 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { inlinehint 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 #5 = { inlinehint 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 #6 = { 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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}


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

@n = external dso_local global i32, align 4
@buf = external dso_local global [400001 x i8], align 16
@out = external dso_local global [400001 x i8], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call i64 @time(ptr noundef null) #5
  %2 = trunc i64 %1 to i32
  tail call void @srand(i32 noundef %2) #5
  %3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @buf)
  br label %4

4:                                                ; preds = %._crit_edge, %0
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %52, %4
  %.044.lcssa = phi i32 [ 0, %4 ], [ %.145, %52 ]
  %.042.lcssa = phi i32 [ 0, %4 ], [ %.143, %52 ]
  %7 = add nsw i32 %.044.lcssa, -1
  %8 = sext i32 %7 to i64
  %9 = getelementptr inbounds [400001 x i8], ptr @out, i64 0, i64 %8
  store i8 0, ptr %9, align 1, !tbaa !9
  %10 = tail call noundef i32 @_Z4calci(i32 noundef %.042.lcssa)
  %11 = tail call noundef i32 @_Z4calci(i32 noundef %10)
  %12 = icmp slt i32 %11, 10
  br i1 %12, label %55, label %4

.lr.ph:                                           ; preds = %4, %52
  %13 = phi i32 [ %53, %52 ], [ %5, %4 ]
  %.04054 = phi i32 [ %.pre-phi, %52 ], [ 0, %4 ]
  %.04253 = phi i32 [ %.143, %52 ], [ 0, %4 ]
  %.04452 = phi i32 [ %.145, %52 ], [ 0, %4 ]
  %14 = add nsw i32 %.04054, 1
  %15 = icmp slt i32 %14, %13
  br i1 %15, label %16, label %40

16:                                               ; preds = %.lr.ph
  %17 = tail call i32 @rand() #5
  %18 = and i32 %17, 1
  %.not = icmp eq i32 %18, 0
  br i1 %.not, label %40, label %19

19:                                               ; preds = %16
  %20 = sext i32 %.04054 to i64
  %21 = getelementptr inbounds [400001 x i8], ptr @buf, i64 0, i64 %20
  %22 = load i8, ptr %21, align 1, !tbaa !9
  %23 = sext i8 %22 to i32
  %24 = mul nsw i32 %23, 10
  %25 = sext i32 %14 to i64
  %26 = getelementptr inbounds [400001 x i8], ptr @buf, i64 0, i64 %25
  %27 = load i8, ptr %26, align 1, !tbaa !9
  %28 = sext i8 %27 to i32
  %29 = add nsw i32 %28, -528
  %30 = add nsw i32 %29, %24
  %31 = add nsw i32 %.04452, 1
  %32 = sext i32 %.04452 to i64
  %33 = getelementptr inbounds [400001 x i8], ptr @out, i64 0, i64 %32
  store i8 %22, ptr %33, align 1, !tbaa !9
  %34 = add nsw i32 %.04452, 2
  %35 = sext i32 %31 to i64
  %36 = getelementptr inbounds [400001 x i8], ptr @out, i64 0, i64 %35
  store i8 %27, ptr %36, align 1, !tbaa !9
  %37 = add nsw i32 %.04452, 3
  %38 = sext i32 %34 to i64
  %39 = getelementptr inbounds [400001 x i8], ptr @out, i64 0, i64 %38
  store i8 43, ptr %39, align 1, !tbaa !9
  %.pre = add nsw i32 %.04054, 2
  br label %52

40:                                               ; preds = %16, %.lr.ph
  %41 = sext i32 %.04054 to i64
  %42 = getelementptr inbounds [400001 x i8], ptr @buf, i64 0, i64 %41
  %43 = load i8, ptr %42, align 1, !tbaa !9
  %44 = sext i8 %43 to i32
  %45 = add nsw i32 %44, -48
  %46 = add nsw i32 %.04452, 1
  %47 = sext i32 %.04452 to i64
  %48 = getelementptr inbounds [400001 x i8], ptr @out, i64 0, i64 %47
  store i8 %43, ptr %48, align 1, !tbaa !9
  %49 = add nsw i32 %.04452, 2
  %50 = sext i32 %46 to i64
  %51 = getelementptr inbounds [400001 x i8], ptr @out, i64 0, i64 %50
  store i8 43, ptr %51, align 1, !tbaa !9
  br label %52

52:                                               ; preds = %19, %40
  %.pre-phi = phi i32 [ %.pre, %19 ], [ %14, %40 ]
  %.145 = phi i32 [ %37, %19 ], [ %49, %40 ]
  %.pn = phi i32 [ %30, %19 ], [ %45, %40 ]
  %.143 = add nsw i32 %.pn, %.04253
  %53 = load i32, ptr @n, align 4, !tbaa !5
  %54 = icmp slt i32 %.pre-phi, %53
  br i1 %54, label %.lr.ph, label %._crit_edge, !llvm.loop !10

55:                                               ; preds = %._crit_edge
  %56 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @out)
  %57 = icmp sgt i32 %.042.lcssa, 0
  br i1 %57, label %.lr.ph60, label %._crit_edge61

.lr.ph60:                                         ; preds = %55, %.lr.ph60
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph60 ], [ 0, %55 ]
  %.03958 = phi i32 [ %65, %.lr.ph60 ], [ %.042.lcssa, %55 ]
  %.257 = phi i32 [ %64, %.lr.ph60 ], [ 0, %55 ]
  %58 = or disjoint i64 %indvars.iv, 1
  %59 = getelementptr inbounds [400001 x i8], ptr @out, i64 0, i64 %indvars.iv
  store i8 43, ptr %59, align 2, !tbaa !9
  %60 = urem i32 %.03958, 10
  %61 = trunc nuw nsw i32 %60 to i8
  %62 = or disjoint i8 %61, 48
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 2
  %63 = getelementptr inbounds [400001 x i8], ptr @out, i64 0, i64 %58
  store i8 %62, ptr %63, align 1, !tbaa !9
  %64 = add nuw nsw i32 %60, %.257
  %65 = udiv i32 %.03958, 10
  %.not70 = icmp ult i32 %.03958, 10
  br i1 %.not70, label %._crit_edge61.loopexit, label %.lr.ph60, !llvm.loop !12

._crit_edge61.loopexit:                           ; preds = %.lr.ph60
  %66 = trunc nuw i64 %indvars.iv.next to i32
  br label %._crit_edge61

._crit_edge61:                                    ; preds = %._crit_edge61.loopexit, %55
  %.246.lcssa = phi i32 [ 0, %55 ], [ %66, %._crit_edge61.loopexit ]
  %.2.lcssa = phi i32 [ 0, %55 ], [ %64, %._crit_edge61.loopexit ]
  %67 = zext nneg i32 %.246.lcssa to i64
  %68 = getelementptr inbounds i8, ptr @out, i64 %67
  tail call void @_ZSt7reverseIPcEvT_S1_(ptr noundef nonnull @out, ptr noundef nonnull %68)
  %69 = add nsw i32 %.246.lcssa, -1
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [400001 x i8], ptr @out, i64 0, i64 %70
  store i8 0, ptr %71, align 1, !tbaa !9
  %72 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @out)
  %73 = icmp sgt i32 %.2.lcssa, 0
  br i1 %73, label %.lr.ph67, label %._crit_edge68

.lr.ph67:                                         ; preds = %._crit_edge61, %.lr.ph67
  %indvars.iv75 = phi i64 [ %indvars.iv.next76, %.lr.ph67 ], [ 0, %._crit_edge61 ]
  %.165 = phi i32 [ %80, %.lr.ph67 ], [ %.2.lcssa, %._crit_edge61 ]
  %74 = or disjoint i64 %indvars.iv75, 1
  %75 = getelementptr inbounds [400001 x i8], ptr @out, i64 0, i64 %indvars.iv75
  store i8 43, ptr %75, align 2, !tbaa !9
  %76 = urem i32 %.165, 10
  %77 = trunc nuw nsw i32 %76 to i8
  %78 = or disjoint i8 %77, 48
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 2
  %79 = getelementptr inbounds [400001 x i8], ptr @out, i64 0, i64 %74
  store i8 %78, ptr %79, align 1, !tbaa !9
  %80 = udiv i32 %.165, 10
  %.not71 = icmp ult i32 %.165, 10
  br i1 %.not71, label %._crit_edge68.loopexit, label %.lr.ph67, !llvm.loop !13

._crit_edge68.loopexit:                           ; preds = %.lr.ph67
  %81 = trunc nuw i64 %indvars.iv.next76 to i32
  br label %._crit_edge68

._crit_edge68:                                    ; preds = %._crit_edge68.loopexit, %._crit_edge61
  %.347.lcssa = phi i32 [ 0, %._crit_edge61 ], [ %81, %._crit_edge68.loopexit ]
  %82 = zext nneg i32 %.347.lcssa to i64
  %83 = getelementptr inbounds i8, ptr @out, i64 %82
  tail call void @_ZSt7reverseIPcEvT_S1_(ptr noundef nonnull @out, ptr noundef nonnull %83)
  %84 = add nsw i32 %.347.lcssa, -1
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [400001 x i8], ptr @out, i64 0, i64 %85
  store i8 0, ptr %86, align 1, !tbaa !9
  %87 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @out)
  ret i32 0
}

; Function Attrs: nounwind
declare void @srand(i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4calci(i32 noundef) local_unnamed_addr #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt7reverseIPcEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #4

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 = { 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 #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 = { inlinehint 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 #4 = { inlinehint 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 #5 = { 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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass