#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int nDays;
  int n;
  int i;
  printf("Input how many days pls:");
  scanf("%d", &nDays);
  printf("Input how many remained pls:");
  scanf("%d", &n);
  for (i = 1; i < nDays; i++)
    n = (n + 1) * 2;
  printf("the total is %d \n", n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1198 <main+0x78>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1172 <main+0x52>
mov    -0xc(%rbp),%esi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedf(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xece(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%esi
cmp    $0x2,%edx
jl     11be <main+0x9e>
lea    -0x1(%rdx),%ecx
add    $0xfffffffe,%edx
mov    %ecx,%eax
and    $0x7,%eax
cmp    $0x7,%edx
jb     119e <main+0x7e>
and    $0xfffffff8,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
shl    $0x8,%esi
add    $0x1fe,%esi
add    $0xfffffff8,%ecx
jne    1190 <main+0x70>
test   %eax,%eax
je     11ba <main+0x9a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    %esi,%esi
add    $0x2,%esi
add    $0xffffffff,%eax
jne    11b0 <main+0x90>
mov    %esi,0x8(%rsp)
lea    0xe74(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Input how many days pls:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [29 x i8] c"Input how many remained pls:\00"
@.str.3 = [18 x i8] c"the total is %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
store i32 1, i32* %4
br label %9
9: ; preds = %17, %0
%10 = load i32, i32* %4
%11 = load i32, i32* %2
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %20
13: ; preds = %9
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
%16 = mul nsw i32 %15, 2
store i32 %16, i32* %3
br label %17
17: ; preds = %13
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %9
20: ; preds = %9
%21 = load i32, i32* %3
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"Input how many days pls:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [29 x i8] c"Input how many remained pls:\00"
@.str.3 = [18 x i8] c"the total is %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = icmp sgt i32 %9, 1
br i1 %11, label %12, label %39
12: ; preds = %0
%13 = add i32 %9, -1
%14 = add i32 %9, -2
%15 = and i32 %13, 7
%16 = icmp ult i32 %14, 7
br i1 %16, label %26, label %17
17: ; preds = %12
%18 = and i32 %13, -8
br label %19
19: ; preds = %19, %17
%20 = phi i32 [ %10, %17 ], [ %23, %19 ]
%21 = phi i32 [ 0, %17 ], [ %24, %19 ]
%22 = shl i32 %20, 8
%23 = add i32 %22, 510
%24 = add i32 %21, 8
%25 = icmp eq i32 %24, %18
br i1 %25, label %26, label %19
26: ; preds = %19, %12
%27 = phi i32 [ undef, %12 ], [ %23, %19 ]
%28 = phi i32 [ %10, %12 ], [ %23, %19 ]
%29 = icmp eq i32 %15, 0
br i1 %29, label %37, label %30
30: ; preds = %26, %30
%31 = phi i32 [ %34, %30 ], [ %28, %26 ]
%32 = phi i32 [ %35, %30 ], [ 0, %26 ]
%33 = shl i32 %31, 1
%34 = add i32 %33, 2
%35 = add i32 %32, 1
%36 = icmp eq i32 %35, %15
br i1 %36, label %37, label %30
37: ; preds = %30, %26
%38 = phi i32 [ %27, %26 ], [ %34, %30 ]
store i32 %38, i32* %2
br label %39
39: ; preds = %37, %0
%40 = phi i32 [ %38, %37 ], [ %10, %0 ]
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %40)
ret i32 0
}