#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 total;
  int days = 1;
  int n = 2;
  int sum = n;
  printf("Input the total pls:");
  scanf("%d", &total);
  while (2 * n <= total) {
    n *= 2;
    days++;
    sum += n;
  }
  printf("Money is %.2f\n", sum * 0.8 / days);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x2,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
cmp    -0x8(%rbp),%eax
jg     1190 <main+0x70>
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1161 <main+0x41>
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  0xe63(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
lea    0xe6f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeef(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%ecx
cmp    $0x4,%ecx
jge    1153 <main+0x33>
movsd  0xeaf(%rip),%xmm0
jmp    118f <main+0x6f>
mov    $0x1,%eax
mov    $0x2,%edx
mov    $0x4,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%eax
add    %esi,%edx
add    %esi,%esi
cmp    %ecx,%esi
jle    1170 <main+0x50>
cvtsi2sd %edx,%xmm0
mulsd  0xe81(%rip),%xmm0
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
lea    0xe92(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Input the total pls:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [15 x i8] c"Money is %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %3
store i32 2, i32* %4
%6 = load i32, i32* %4
store i32 %6, i32* %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, 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)
br label %9
9: ; preds = %14, %0
%10 = load i32, i32* %4
%11 = mul nsw i32 2, %10
%12 = load i32, i32* %2
%13 = icmp sle i32 %11, %12
br i1 %13, label %14, label %22
14: ; preds = %9
%15 = load i32, i32* %4
%16 = mul nsw i32 %15, 2
store i32 %16, i32* %4
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
%19 = load i32, i32* %4
%20 = load i32, i32* %5
%21 = add nsw i32 %20, %19
store i32 %21, i32* %5
br label %9
22: ; preds = %9
%23 = load i32, i32* %5
%24 = sitofp i32 %23 to double
%25 = fmul double %24, 8.000000e-01
%26 = load i32, i32* %3
%27 = sitofp i32 %26 to double
%28 = fdiv double %25, %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), double %28)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"Input the total pls:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [15 x i8] c"Money is %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 4
br i1 %6, label %20, label %7
7: ; preds = %0, %7
%8 = phi i32 [ %13, %7 ], [ 4, %0 ]
%9 = phi i32 [ %12, %7 ], [ 2, %0 ]
%10 = phi i32 [ %11, %7 ], [ 1, %0 ]
%11 = add nuw nsw i32 %10, 1
%12 = add nsw i32 %9, %8
%13 = shl nsw i32 %8, 1
%14 = icmp sgt i32 %13, %5
br i1 %14, label %15, label %7
15: ; preds = %7
%16 = sitofp i32 %12 to double
%17 = fmul double %16, 8.000000e-01
%18 = sitofp i32 %11 to double
%19 = fdiv double %17, %18
br label %20
20: ; preds = %15, %0
%21 = phi double [ %19, %15 ], [ 1.600000e+00, %0 ]
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), double %21)
ret i32 0
}