; LLVM IR from tangjz/acm-icpc :: lydsy (2056)

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

@t = external dso_local global i32, align 4
@x = external dso_local global i32, align 4
@i = external dso_local global i64, align 8
@ans = external dso_local global i64, align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.3 = 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
  store i32 0, ptr %1, align 4
  %2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %3

3:                                                ; preds = %67, %0
  %4 = load i32, ptr @t, align 4, !tbaa !5
  %5 = add nsw i32 %4, -1
  store i32 %5, ptr @t, align 4, !tbaa !5
  %6 = icmp ne i32 %4, 0
  br i1 %6, label %7, label %68

7:                                                ; preds = %3
  store i64 0, ptr @ans, align 8, !tbaa !9
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @x)
  %9 = load i32, ptr @x, align 4, !tbaa !5
  %10 = zext i32 %9 to i64
  %11 = shl i64 1, %10
  %12 = load i64, ptr @ans, align 8, !tbaa !9
  %13 = add i64 %12, %11
  store i64 %13, ptr @ans, align 8, !tbaa !9
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @x)
  %15 = load i32, ptr @x, align 4, !tbaa !5
  %16 = zext i32 %15 to i64
  %17 = shl i64 1, %16
  %18 = load i64, ptr @ans, align 8, !tbaa !9
  %19 = add i64 %18, %17
  store i64 %19, ptr @ans, align 8, !tbaa !9
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @x)
  %21 = load i32, ptr @x, align 4, !tbaa !5
  %22 = zext i32 %21 to i64
  %23 = shl i64 1, %22
  %24 = load i64, ptr @ans, align 8, !tbaa !9
  %25 = add i64 %24, %23
  store i64 %25, ptr @ans, align 8, !tbaa !9
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @x)
  %27 = load i32, ptr @x, align 4, !tbaa !5
  %28 = zext i32 %27 to i64
  %29 = shl i64 1, %28
  %30 = load i64, ptr @ans, align 8, !tbaa !9
  %31 = add i64 %30, %29
  store i64 %31, ptr @ans, align 8, !tbaa !9
  %32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @x)
  %33 = load i32, ptr @x, align 4, !tbaa !5
  %34 = zext i32 %33 to i64
  %35 = shl i64 1, %34
  %36 = load i64, ptr @ans, align 8, !tbaa !9
  %37 = add i64 %36, %35
  store i64 %37, ptr @ans, align 8, !tbaa !9
  %38 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @x)
  %39 = load i32, ptr @x, align 4, !tbaa !5
  %40 = zext i32 %39 to i64
  %41 = shl i64 1, %40
  %42 = load i64, ptr @ans, align 8, !tbaa !9
  %43 = add i64 %42, %41
  store i64 %43, ptr @ans, align 8, !tbaa !9
  %44 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @x)
  %45 = load i32, ptr @x, align 4, !tbaa !5
  %46 = zext i32 %45 to i64
  %47 = shl i64 1, %46
  %48 = load i64, ptr @ans, align 8, !tbaa !9
  %49 = add i64 %48, %47
  store i64 %49, ptr @ans, align 8, !tbaa !9
  %50 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @x)
  %51 = load i32, ptr @x, align 4, !tbaa !5
  %52 = zext i32 %51 to i64
  %53 = shl i64 1, %52
  %54 = load i64, ptr @ans, align 8, !tbaa !9
  %55 = add i64 %54, %53
  store i64 %55, ptr @ans, align 8, !tbaa !9
  %56 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @i)
  %57 = load i64, ptr @i, align 8, !tbaa !9
  %58 = load i64, ptr @ans, align 8, !tbaa !9
  %59 = add i64 %58, %57
  store i64 %59, ptr @ans, align 8, !tbaa !9
  %60 = load i64, ptr @ans, align 8, !tbaa !9
  %61 = icmp ne i64 %60, 0
  br i1 %61, label %64, label %62

62:                                               ; preds = %7
  %63 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  br label %67

64:                                               ; preds = %7
  %65 = load i64, ptr @ans, align 8, !tbaa !9
  %66 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i64 noundef %65)
  br label %67

67:                                               ; preds = %64, %62
  br label %3, !llvm.loop !11

68:                                               ; preds = %3
  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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"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"

@t = external dso_local global i32, align 4
@x = external dso_local global i32, align 4
@i = external dso_local global i64, align 8
@ans = external dso_local local_unnamed_addr global i64, align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.3 = 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 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %2 = load i32, ptr @t, align 4, !tbaa !5
  %3 = add nsw i32 %2, -1
  store i32 %3, ptr @t, align 4, !tbaa !5
  %.not2 = icmp eq i32 %2, 0
  br i1 %.not2, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %0, %60
  store i64 0, ptr @ans, align 8, !tbaa !9
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @x)
  %5 = load i32, ptr @x, align 4, !tbaa !5
  %6 = zext nneg i32 %5 to i64
  %7 = shl nuw i64 1, %6
  %8 = load i64, ptr @ans, align 8, !tbaa !9
  %9 = add i64 %7, %8
  store i64 %9, ptr @ans, align 8, !tbaa !9
  %10 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @x)
  %11 = load i32, ptr @x, align 4, !tbaa !5
  %12 = zext nneg i32 %11 to i64
  %13 = shl nuw i64 1, %12
  %14 = load i64, ptr @ans, align 8, !tbaa !9
  %15 = add i64 %13, %14
  store i64 %15, ptr @ans, align 8, !tbaa !9
  %16 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @x)
  %17 = load i32, ptr @x, align 4, !tbaa !5
  %18 = zext nneg i32 %17 to i64
  %19 = shl nuw i64 1, %18
  %20 = load i64, ptr @ans, align 8, !tbaa !9
  %21 = add i64 %19, %20
  store i64 %21, ptr @ans, align 8, !tbaa !9
  %22 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @x)
  %23 = load i32, ptr @x, align 4, !tbaa !5
  %24 = zext nneg i32 %23 to i64
  %25 = shl nuw i64 1, %24
  %26 = load i64, ptr @ans, align 8, !tbaa !9
  %27 = add i64 %25, %26
  store i64 %27, ptr @ans, align 8, !tbaa !9
  %28 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @x)
  %29 = load i32, ptr @x, align 4, !tbaa !5
  %30 = zext nneg i32 %29 to i64
  %31 = shl nuw i64 1, %30
  %32 = load i64, ptr @ans, align 8, !tbaa !9
  %33 = add i64 %31, %32
  store i64 %33, ptr @ans, align 8, !tbaa !9
  %34 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @x)
  %35 = load i32, ptr @x, align 4, !tbaa !5
  %36 = zext nneg i32 %35 to i64
  %37 = shl nuw i64 1, %36
  %38 = load i64, ptr @ans, align 8, !tbaa !9
  %39 = add i64 %37, %38
  store i64 %39, ptr @ans, align 8, !tbaa !9
  %40 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @x)
  %41 = load i32, ptr @x, align 4, !tbaa !5
  %42 = zext nneg i32 %41 to i64
  %43 = shl nuw i64 1, %42
  %44 = load i64, ptr @ans, align 8, !tbaa !9
  %45 = add i64 %43, %44
  store i64 %45, ptr @ans, align 8, !tbaa !9
  %46 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @x)
  %47 = load i32, ptr @x, align 4, !tbaa !5
  %48 = zext nneg i32 %47 to i64
  %49 = shl nuw i64 1, %48
  %50 = load i64, ptr @ans, align 8, !tbaa !9
  %51 = add i64 %49, %50
  store i64 %51, ptr @ans, align 8, !tbaa !9
  %52 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @i)
  %53 = load i64, ptr @i, align 8, !tbaa !9
  %54 = load i64, ptr @ans, align 8, !tbaa !9
  %55 = add i64 %54, %53
  store i64 %55, ptr @ans, align 8, !tbaa !9
  %.not1 = icmp eq i64 %55, 0
  br i1 %.not1, label %56, label %58

56:                                               ; preds = %.lr.ph
  %57 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %60

58:                                               ; preds = %.lr.ph
  %59 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %55)
  br label %60

60:                                               ; preds = %58, %56
  %61 = load i32, ptr @t, align 4, !tbaa !5
  %62 = add nsw i32 %61, -1
  store i32 %62, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %61, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !11

._crit_edge:                                      ; preds = %60, %0
  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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass