; LLVM IR from Shah-Shishir/Codeforces-Solutions :: 630C. Lucky Numbers (main)

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

@arr = external dso_local global [56 x i64], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  store i64 1, ptr %4, align 8, !tbaa !5
  store i64 1, ptr %3, align 8, !tbaa !5
  br label %5

5:                                                ; preds = %19, %0
  %6 = load i64, ptr %3, align 8, !tbaa !5
  %7 = icmp slt i64 %6, 56
  br i1 %7, label %8, label %22

8:                                                ; preds = %5
  %9 = load i64, ptr %4, align 8, !tbaa !5
  %10 = mul nsw i64 %9, 2
  store i64 %10, ptr %4, align 8, !tbaa !5
  %11 = load i64, ptr %3, align 8, !tbaa !5
  %12 = sub nsw i64 %11, 1
  %13 = getelementptr inbounds [56 x i64], ptr @arr, i64 0, i64 %12
  %14 = load i64, ptr %13, align 8, !tbaa !5
  %15 = load i64, ptr %4, align 8, !tbaa !5
  %16 = add nsw i64 %14, %15
  %17 = load i64, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds [56 x i64], ptr @arr, i64 0, i64 %17
  store i64 %16, ptr %18, align 8, !tbaa !5
  br label %19

19:                                               ; preds = %8
  %20 = load i64, ptr %3, align 8, !tbaa !5
  %21 = add nsw i64 %20, 1
  store i64 %21, ptr %3, align 8, !tbaa !5
  br label %5, !llvm.loop !9

22:                                               ; preds = %5
  br label %23

23:                                               ; preds = %26, %22
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  %25 = icmp ne i32 %24, -1
  br i1 %25, label %26, label %31

26:                                               ; preds = %23
  %27 = load i64, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds [56 x i64], ptr @arr, i64 0, i64 %27
  %29 = load i64, ptr %28, align 8, !tbaa !5
  %30 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %29)
  br label %23, !llvm.loop !11

31:                                               ; preds = %23
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 8, 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


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

@arr = external dso_local local_unnamed_addr global [56 x i64], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nofree norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
.preheader:
  %0 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %0) #3
  %.pre = load i64, ptr @arr, align 16, !tbaa !5
  %1 = add nsw i64 %.pre, 2
  store i64 %1, ptr getelementptr inbounds (i8, ptr @arr, i64 8), align 8, !tbaa !5
  %2 = add nsw i64 %.pre, 6
  store i64 %2, ptr getelementptr inbounds (i8, ptr @arr, i64 16), align 16, !tbaa !5
  %3 = add nsw i64 %.pre, 14
  store i64 %3, ptr getelementptr inbounds (i8, ptr @arr, i64 24), align 8, !tbaa !5
  %4 = add nsw i64 %.pre, 30
  store i64 %4, ptr getelementptr inbounds (i8, ptr @arr, i64 32), align 16, !tbaa !5
  %5 = add nsw i64 %.pre, 62
  store i64 %5, ptr getelementptr inbounds (i8, ptr @arr, i64 40), align 8, !tbaa !5
  %6 = add nsw i64 %.pre, 126
  store i64 %6, ptr getelementptr inbounds (i8, ptr @arr, i64 48), align 16, !tbaa !5
  %7 = add nsw i64 %.pre, 254
  store i64 %7, ptr getelementptr inbounds (i8, ptr @arr, i64 56), align 8, !tbaa !5
  %8 = add nsw i64 %.pre, 510
  store i64 %8, ptr getelementptr inbounds (i8, ptr @arr, i64 64), align 16, !tbaa !5
  %9 = add nsw i64 %.pre, 1022
  store i64 %9, ptr getelementptr inbounds (i8, ptr @arr, i64 72), align 8, !tbaa !5
  %10 = add nsw i64 %.pre, 2046
  store i64 %10, ptr getelementptr inbounds (i8, ptr @arr, i64 80), align 16, !tbaa !5
  %11 = add nsw i64 %.pre, 4094
  store i64 %11, ptr getelementptr inbounds (i8, ptr @arr, i64 88), align 8, !tbaa !5
  %12 = add nsw i64 %.pre, 8190
  store i64 %12, ptr getelementptr inbounds (i8, ptr @arr, i64 96), align 16, !tbaa !5
  %13 = add nsw i64 %.pre, 16382
  store i64 %13, ptr getelementptr inbounds (i8, ptr @arr, i64 104), align 8, !tbaa !5
  %14 = add nsw i64 %.pre, 32766
  store i64 %14, ptr getelementptr inbounds (i8, ptr @arr, i64 112), align 16, !tbaa !5
  %15 = add nsw i64 %.pre, 65534
  store i64 %15, ptr getelementptr inbounds (i8, ptr @arr, i64 120), align 8, !tbaa !5
  %16 = add nsw i64 %.pre, 131070
  store i64 %16, ptr getelementptr inbounds (i8, ptr @arr, i64 128), align 16, !tbaa !5
  %17 = add nsw i64 %.pre, 262142
  store i64 %17, ptr getelementptr inbounds (i8, ptr @arr, i64 136), align 8, !tbaa !5
  %18 = add nsw i64 %.pre, 524286
  store i64 %18, ptr getelementptr inbounds (i8, ptr @arr, i64 144), align 16, !tbaa !5
  %19 = add nsw i64 %.pre, 1048574
  store i64 %19, ptr getelementptr inbounds (i8, ptr @arr, i64 152), align 8, !tbaa !5
  %20 = add nsw i64 %.pre, 2097150
  store i64 %20, ptr getelementptr inbounds (i8, ptr @arr, i64 160), align 16, !tbaa !5
  %21 = add nsw i64 %.pre, 4194302
  store i64 %21, ptr getelementptr inbounds (i8, ptr @arr, i64 168), align 8, !tbaa !5
  %22 = add nsw i64 %.pre, 8388606
  store i64 %22, ptr getelementptr inbounds (i8, ptr @arr, i64 176), align 16, !tbaa !5
  %23 = add nsw i64 %.pre, 16777214
  store i64 %23, ptr getelementptr inbounds (i8, ptr @arr, i64 184), align 8, !tbaa !5
  %24 = add nsw i64 %.pre, 33554430
  store i64 %24, ptr getelementptr inbounds (i8, ptr @arr, i64 192), align 16, !tbaa !5
  %25 = add nsw i64 %.pre, 67108862
  store i64 %25, ptr getelementptr inbounds (i8, ptr @arr, i64 200), align 8, !tbaa !5
  %26 = add nsw i64 %.pre, 134217726
  store i64 %26, ptr getelementptr inbounds (i8, ptr @arr, i64 208), align 16, !tbaa !5
  %27 = add nsw i64 %.pre, 268435454
  store i64 %27, ptr getelementptr inbounds (i8, ptr @arr, i64 216), align 8, !tbaa !5
  %28 = add nsw i64 %.pre, 536870910
  store i64 %28, ptr getelementptr inbounds (i8, ptr @arr, i64 224), align 16, !tbaa !5
  %29 = add nsw i64 %.pre, 1073741822
  store i64 %29, ptr getelementptr inbounds (i8, ptr @arr, i64 232), align 8, !tbaa !5
  %30 = add nsw i64 %.pre, 2147483646
  store i64 %30, ptr getelementptr inbounds (i8, ptr @arr, i64 240), align 16, !tbaa !5
  %31 = add nsw i64 %.pre, 4294967294
  store i64 %31, ptr getelementptr inbounds (i8, ptr @arr, i64 248), align 8, !tbaa !5
  %32 = add nsw i64 %.pre, 8589934590
  store i64 %32, ptr getelementptr inbounds (i8, ptr @arr, i64 256), align 16, !tbaa !5
  %33 = add nsw i64 %.pre, 17179869182
  store i64 %33, ptr getelementptr inbounds (i8, ptr @arr, i64 264), align 8, !tbaa !5
  %34 = add nsw i64 %.pre, 34359738366
  store i64 %34, ptr getelementptr inbounds (i8, ptr @arr, i64 272), align 16, !tbaa !5
  %35 = add nsw i64 %.pre, 68719476734
  store i64 %35, ptr getelementptr inbounds (i8, ptr @arr, i64 280), align 8, !tbaa !5
  %36 = add nsw i64 %.pre, 137438953470
  store i64 %36, ptr getelementptr inbounds (i8, ptr @arr, i64 288), align 16, !tbaa !5
  %37 = add nsw i64 %.pre, 274877906942
  store i64 %37, ptr getelementptr inbounds (i8, ptr @arr, i64 296), align 8, !tbaa !5
  %38 = add nsw i64 %.pre, 549755813886
  store i64 %38, ptr getelementptr inbounds (i8, ptr @arr, i64 304), align 16, !tbaa !5
  %39 = add nsw i64 %.pre, 1099511627774
  store i64 %39, ptr getelementptr inbounds (i8, ptr @arr, i64 312), align 8, !tbaa !5
  %40 = add nsw i64 %.pre, 2199023255550
  store i64 %40, ptr getelementptr inbounds (i8, ptr @arr, i64 320), align 16, !tbaa !5
  %41 = add nsw i64 %.pre, 4398046511102
  store i64 %41, ptr getelementptr inbounds (i8, ptr @arr, i64 328), align 8, !tbaa !5
  %42 = add nsw i64 %.pre, 8796093022206
  store i64 %42, ptr getelementptr inbounds (i8, ptr @arr, i64 336), align 16, !tbaa !5
  %43 = add nsw i64 %.pre, 17592186044414
  store i64 %43, ptr getelementptr inbounds (i8, ptr @arr, i64 344), align 8, !tbaa !5
  %44 = add nsw i64 %.pre, 35184372088830
  store i64 %44, ptr getelementptr inbounds (i8, ptr @arr, i64 352), align 16, !tbaa !5
  %45 = add nsw i64 %.pre, 70368744177662
  store i64 %45, ptr getelementptr inbounds (i8, ptr @arr, i64 360), align 8, !tbaa !5
  %46 = add nsw i64 %.pre, 140737488355326
  store i64 %46, ptr getelementptr inbounds (i8, ptr @arr, i64 368), align 16, !tbaa !5
  %47 = add nsw i64 %.pre, 281474976710654
  store i64 %47, ptr getelementptr inbounds (i8, ptr @arr, i64 376), align 8, !tbaa !5
  %48 = add nsw i64 %.pre, 562949953421310
  store i64 %48, ptr getelementptr inbounds (i8, ptr @arr, i64 384), align 16, !tbaa !5
  %49 = add nsw i64 %.pre, 1125899906842622
  store i64 %49, ptr getelementptr inbounds (i8, ptr @arr, i64 392), align 8, !tbaa !5
  %50 = add nsw i64 %.pre, 2251799813685246
  store i64 %50, ptr getelementptr inbounds (i8, ptr @arr, i64 400), align 16, !tbaa !5
  %51 = add nsw i64 %.pre, 4503599627370494
  store i64 %51, ptr getelementptr inbounds (i8, ptr @arr, i64 408), align 8, !tbaa !5
  %52 = add nsw i64 %.pre, 9007199254740990
  store i64 %52, ptr getelementptr inbounds (i8, ptr @arr, i64 416), align 16, !tbaa !5
  %53 = add nsw i64 %.pre, 18014398509481982
  store i64 %53, ptr getelementptr inbounds (i8, ptr @arr, i64 424), align 8, !tbaa !5
  %54 = add nsw i64 %.pre, 36028797018963966
  store i64 %54, ptr getelementptr inbounds (i8, ptr @arr, i64 432), align 16, !tbaa !5
  %55 = add nsw i64 %.pre, 72057594037927934
  store i64 %55, ptr getelementptr inbounds (i8, ptr @arr, i64 440), align 8, !tbaa !5
  %56 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %0)
  %.not9 = icmp eq i32 %56, -1
  br i1 %.not9, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %57 = load i64, ptr %0, align 8, !tbaa !5
  %58 = getelementptr inbounds [56 x i64], ptr @arr, i64 0, i64 %57
  %59 = load i64, ptr %58, align 8, !tbaa !5
  %60 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %59)
  %61 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %0)
  %.not = icmp eq i32 %61, -1
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %.preheader
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %0) #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 = !{!"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,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass