#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 *, double);
int main(int argc, const char *argv[]) {
  int i;
  double sum = 2, prev = 2;
  for (i = 1; i < 64; i++) {
    sum += prev * 2;
    prev = prev * 2;
  }
  printf("%.0f\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xed2(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xec5(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x40,-0x14(%rbp)
jge    1188 <main+0x78>
movsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe90(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1147 <main+0x37>
movsd  -0x20(%rbp),%xmm0
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movsd  0xee7(%rip),%xmm1
mov    $0x3f,%eax
movapd %xmm1,%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
addsd  %xmm1,%xmm1
addsd  %xmm1,%xmm0
addsd  %xmm1,%xmm1
addsd  %xmm1,%xmm0
addsd  %xmm1,%xmm1
addsd  %xmm1,%xmm0
add    $0xfffffffd,%eax
jne    1130 <main+0x20>
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%.0f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca double
%8 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 2.000000e+00, double* %7
store double 2.000000e+00, double* %8
store i32 1, i32* %6
br label %9
9: ; preds = %18, %2
%10 = load i32, i32* %6
%11 = icmp slt i32 %10, 64
br i1 %11, label %12, label %21
12: ; preds = %9
%13 = load double, double* %8
%14 = load double, double* %7
%15 = call double @llvm.fmuladd.f64(double %13, double 2.000000e+00, double %14)
store double %15, double* %7
%16 = load double, double* %8
%17 = fmul double %16, 2.000000e+00
store double %17, double* %8
br label %18
18: ; preds = %12
%19 = load i32, i32* %6
%20 = add nsw i32 %19, 1
store i32 %20, i32* %6
br label %9
21: ; preds = %9
%22 = load double, double* %7
%23 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%.0f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %3, %2
%4 = phi double [ 2.000000e+00, %2 ], [ %12, %3 ]
%5 = phi double [ 2.000000e+00, %2 ], [ %11, %3 ]
%6 = phi i32 [ 1, %2 ], [ %13, %3 ]
%7 = tail call double @llvm.fmuladd.f64(double %4, double 2.000000e+00, double %5)
%8 = fmul double %4, 2.000000e+00
%9 = tail call double @llvm.fmuladd.f64(double %8, double 2.000000e+00, double %7)
%10 = fmul double %8, 2.000000e+00
%11 = tail call double @llvm.fmuladd.f64(double %10, double 2.000000e+00, double %9)
%12 = fmul double %10, 2.000000e+00
%13 = add nuw nsw i32 %6, 3
%14 = icmp eq i32 %13, 64
br i1 %14, label %15, label %3
15: ; preds = %3
%16 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %11)
ret i32 0
}