#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 */
double pow(double, int);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int arr[8] = {1, 1, 1, 1, 1, 1, 1, 1};
  int arrPowerOfTwo[8];
  int k;
  for (k = 0; k <= 8; k++) {
    arrPowerOfTwo[k] = ((double)arr[k]) * pow(2.0, k);
  }
  k = 0;
  do {
    printf("%d -> %d\n", k, arrPowerOfTwo[k]);
  } while (k++ < 8);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed1(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x54(%rbp)
cmpl   $0x8,-0x54(%rbp)
jg     11b1 <main+0x91>
movslq -0x54(%rbp),%rax
cvtsi2sdl -0x30(%rbp,%rax,4),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x54(%rbp),%edi
movsd  0xe7a(%rip),%xmm0
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
movslq -0x54(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1162 <main+0x42>
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%esi
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edx
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
mov    -0x54(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x54(%rbp)
cmp    $0x8,%eax
jl     11b8 <main+0x98>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movsd  0xeca(%rip),%xmm0
xor    %edi,%edi
call   1040 <pow@plt>
cvttsd2si %xmm0,%eax
mov    %eax,0x14(%rsp)
movsd  0xeb3(%rip),%xmm0
mov    $0x1,%edi
call   1040 <pow@plt>
cvttsd2si %xmm0,%eax
mov    %eax,0x10(%rsp)
movsd  0xe99(%rip),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
cvttsd2si %xmm0,%eax
mov    %eax,0xc(%rsp)
movsd  0xe7f(%rip),%xmm0
mov    $0x3,%edi
call   1040 <pow@plt>
cvttsd2si %xmm0,%r13d
movsd  0xe68(%rip),%xmm0
mov    $0x4,%edi
call   1040 <pow@plt>
cvttsd2si %xmm0,%ebx
movsd  0xe52(%rip),%xmm0
mov    $0x5,%edi
call   1040 <pow@plt>
cvttsd2si %xmm0,%ebp
movsd  0xe3c(%rip),%xmm0
mov    $0x6,%edi
call   1040 <pow@plt>
cvttsd2si %xmm0,%r14d
movsd  0xe25(%rip),%xmm0
mov    $0x7,%edi
call   1040 <pow@plt>
cvttsd2si %xmm0,%r15d
movsd  0xe0e(%rip),%xmm0
mov    $0x8,%edi
call   1040 <pow@plt>
lea    0xe05(%rip),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    0x14(%rsp),%edx
call   1030 <printf@plt>
mov    %r12,%rdi
mov    $0x1,%esi
mov    0x10(%rsp),%edx
call   1030 <printf@plt>
mov    %r12,%rdi
mov    $0x2,%esi
mov    0xc(%rsp),%edx
call   1030 <printf@plt>
mov    %r12,%rdi
mov    $0x3,%esi
mov    %r13d,%edx
call   1030 <printf@plt>
mov    %r12,%rdi
mov    $0x4,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
mov    %r12,%rdi
mov    $0x5,%esi
mov    %ebp,%edx
call   1030 <printf@plt>
mov    %r12,%rdi
mov    $0x6,%esi
mov    %r14d,%edx
call   1030 <printf@plt>
mov    %r12,%rdi
mov    $0x7,%esi
mov    %r15d,%edx
call   1030 <printf@plt>
mov    %r12,%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.arr = [8 x i32] [i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1]
@.str = [10 x i8] c"%d -> %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i32]
%3 = alloca [8 x i32]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [8 x i32]* %2 to i8*
store i32 0, i32* %4
br label %6
6: ; preds = %22, %0
%7 = load i32, i32* %4
%8 = icmp sle i32 %7, 8
br i1 %8, label %9, label %25
9: ; preds = %6
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 %11
%13 = load i32, i32* %12
%14 = sitofp i32 %13 to double
%15 = load i32, i32* %4
%16 = call double @pow(double 2.000000e+00, i32 %15)
%17 = fmul double %14, %16
%18 = fptosi double %17 to i32
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 %20
store i32 %18, i32* %21
br label %22
22: ; preds = %9
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
br label %6
25: ; preds = %6
store i32 0, i32* %4
br label %26
26: ; preds = %33, %25
%27 = load i32, i32* %4
%28 = load i32, i32* %4
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 %29
%31 = load i32, i32* %30
%32 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %27, i32 %31)
br label %33
33: ; preds = %26
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 1
store i32 %35, i32* %4
%36 = icmp slt i32 %34, 8
br i1 %36, label %26, label %37
37: ; preds = %33
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"%d -> %d\0A\00"
define i32 @main() {
%1 = tail call double @pow(double 2.000000e+00, i32 0)
%2 = fptosi double %1 to i32
%3 = tail call double @pow(double 2.000000e+00, i32 1)
%4 = fptosi double %3 to i32
%5 = tail call double @pow(double 2.000000e+00, i32 2)
%6 = fptosi double %5 to i32
%7 = tail call double @pow(double 2.000000e+00, i32 3)
%8 = fptosi double %7 to i32
%9 = tail call double @pow(double 2.000000e+00, i32 4)
%10 = fptosi double %9 to i32
%11 = tail call double @pow(double 2.000000e+00, i32 5)
%12 = fptosi double %11 to i32
%13 = tail call double @pow(double 2.000000e+00, i32 6)
%14 = fptosi double %13 to i32
%15 = tail call double @pow(double 2.000000e+00, i32 7)
%16 = fptosi double %15 to i32
%17 = tail call double @pow(double 2.000000e+00, i32 8)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 0, i32 %2)
%19 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 1, i32 %4)
%20 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 2, i32 %6)
%21 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 3, i32 %8)
%22 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 4, i32 %10)
%23 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 5, i32 %12)
%24 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 6, i32 %14)
%25 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 7, i32 %16)
%26 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 8, i32 poison)
ret i32 0
}