; LLVM IR from lzyrapx/Competitive-Programming :: HDUOJ (2070)

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

@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca [51 x i64], align 16
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 408, ptr %2) #4
  call void @llvm.memset.p0.i64(ptr align 16 %2, i8 0, i64 408, i1 false)
  %5 = getelementptr inbounds <{ i64, i64, [49 x i64] }>, ptr %2, i32 0, i32 1
  store i64 1, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 2, ptr %3, align 4, !tbaa !5
  br label %6

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

9:                                                ; preds = %6
  %10 = load i32, ptr %3, align 4, !tbaa !5
  %11 = sub nsw i32 %10, 2
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds [51 x i64], ptr %2, i64 0, i64 %12
  %14 = load i64, ptr %13, align 8, !tbaa !9
  %15 = load i32, ptr %3, align 4, !tbaa !5
  %16 = sub nsw i32 %15, 1
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [51 x i64], ptr %2, i64 0, i64 %17
  %19 = load i64, ptr %18, align 8, !tbaa !9
  %20 = add nsw i64 %14, %19
  %21 = load i32, ptr %3, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [51 x i64], ptr %2, i64 0, i64 %22
  store i64 %20, ptr %23, align 8, !tbaa !9
  br label %24

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

27:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  br label %28

28:                                               ; preds = %36, %27
  %29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %4)
  %30 = icmp ne i32 %29, 0
  br i1 %30, label %31, label %34

31:                                               ; preds = %28
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = icmp ne i32 %32, -1
  br label %34

34:                                               ; preds = %31, %28
  %35 = phi i1 [ false, %28 ], [ %33, %31 ]
  br i1 %35, label %36, label %42

36:                                               ; preds = %34
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [51 x i64], ptr %2, i64 0, i64 %38
  %40 = load i64, ptr %39, align 8, !tbaa !9
  %41 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %40)
  br label %28, !llvm.loop !13

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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

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

; 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


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

@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress nofree norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca [51 x i64], align 16
  %2 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 408, ptr nonnull %1) #4
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(408) %1, i8 0, i64 408, i1 false)
  %3 = getelementptr inbounds i8, ptr %1, i64 8
  store i64 1, ptr %3, align 8
  %4 = getelementptr inbounds i8, ptr %1, i64 16
  store i64 1, ptr %4, align 16, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %1, i64 24
  store i64 2, ptr %5, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %1, i64 32
  store i64 3, ptr %6, align 16, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %1, i64 40
  store i64 5, ptr %7, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %1, i64 48
  store i64 8, ptr %8, align 16, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %1, i64 56
  store i64 13, ptr %9, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %1, i64 64
  store i64 21, ptr %10, align 16, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %1, i64 72
  store i64 34, ptr %11, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %1, i64 80
  store i64 55, ptr %12, align 16, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %1, i64 88
  store i64 89, ptr %13, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %1, i64 96
  store i64 144, ptr %14, align 16, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %1, i64 104
  store i64 233, ptr %15, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %1, i64 112
  store i64 377, ptr %16, align 16, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %1, i64 120
  store i64 610, ptr %17, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %1, i64 128
  store i64 987, ptr %18, align 16, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %1, i64 136
  store i64 1597, ptr %19, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %1, i64 144
  store i64 2584, ptr %20, align 16, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %1, i64 152
  store i64 4181, ptr %21, align 8, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %1, i64 160
  store i64 6765, ptr %22, align 16, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %1, i64 168
  store i64 10946, ptr %23, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %1, i64 176
  store i64 17711, ptr %24, align 16, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %1, i64 184
  store i64 28657, ptr %25, align 8, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %1, i64 192
  store i64 46368, ptr %26, align 16, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %1, i64 200
  store i64 75025, ptr %27, align 8, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %1, i64 208
  store i64 121393, ptr %28, align 16, !tbaa !5
  %29 = getelementptr inbounds i8, ptr %1, i64 216
  store i64 196418, ptr %29, align 8, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %1, i64 224
  store i64 317811, ptr %30, align 16, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %1, i64 232
  store i64 514229, ptr %31, align 8, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %1, i64 240
  store i64 832040, ptr %32, align 16, !tbaa !5
  %33 = getelementptr inbounds i8, ptr %1, i64 248
  store i64 1346269, ptr %33, align 8, !tbaa !5
  %34 = getelementptr inbounds i8, ptr %1, i64 256
  store i64 2178309, ptr %34, align 16, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %1, i64 264
  store i64 3524578, ptr %35, align 8, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %1, i64 272
  store i64 5702887, ptr %36, align 16, !tbaa !5
  %37 = getelementptr inbounds i8, ptr %1, i64 280
  store i64 9227465, ptr %37, align 8, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %1, i64 288
  store i64 14930352, ptr %38, align 16, !tbaa !5
  %39 = getelementptr inbounds i8, ptr %1, i64 296
  store i64 24157817, ptr %39, align 8, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %1, i64 304
  store i64 39088169, ptr %40, align 16, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %1, i64 312
  store i64 63245986, ptr %41, align 8, !tbaa !5
  %42 = getelementptr inbounds i8, ptr %1, i64 320
  store i64 102334155, ptr %42, align 16, !tbaa !5
  %43 = getelementptr inbounds i8, ptr %1, i64 328
  store i64 165580141, ptr %43, align 8, !tbaa !5
  %44 = getelementptr inbounds i8, ptr %1, i64 336
  store i64 267914296, ptr %44, align 16, !tbaa !5
  %45 = getelementptr inbounds i8, ptr %1, i64 344
  store i64 433494437, ptr %45, align 8, !tbaa !5
  %46 = getelementptr inbounds i8, ptr %1, i64 352
  store i64 701408733, ptr %46, align 16, !tbaa !5
  %47 = getelementptr inbounds i8, ptr %1, i64 360
  store i64 1134903170, ptr %47, align 8, !tbaa !5
  %48 = getelementptr inbounds i8, ptr %1, i64 368
  store i64 1836311903, ptr %48, align 16, !tbaa !5
  %49 = getelementptr inbounds i8, ptr %1, i64 376
  store i64 2971215073, ptr %49, align 8, !tbaa !5
  %50 = getelementptr inbounds i8, ptr %1, i64 384
  store i64 4807526976, ptr %50, align 16, !tbaa !5
  %51 = getelementptr inbounds i8, ptr %1, i64 392
  store i64 7778742049, ptr %51, align 8, !tbaa !5
  %52 = getelementptr inbounds i8, ptr %1, i64 400
  store i64 12586269025, ptr %52, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  %53 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2)
  %54 = icmp ne i32 %53, 0
  %55 = load i32, ptr %2, align 4
  %56 = icmp ne i32 %55, -1
  %57 = select i1 %54, i1 %56, i1 false
  br i1 %57, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %0, %.lr.ph
  %58 = phi i32 [ %65, %.lr.ph ], [ %55, %0 ]
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [51 x i64], ptr %1, i64 0, i64 %59
  %61 = load i64, ptr %60, align 8, !tbaa !5
  %62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %61)
  %63 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2)
  %64 = icmp ne i32 %63, 0
  %65 = load i32, ptr %2, align 4
  %66 = icmp ne i32 %65, -1
  %67 = select i1 %64, i1 %66, i1 false
  br i1 %67, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 408, 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) #1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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) #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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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 #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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass