#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*/ powers_of_2(int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int set[6] = {4, 7, 17, 32, 1000, 5000};
  for (int c = 0; c < 6; c++) {
    printf("All powers of 2 up to %d:", set[c]);
    powers_of_2(set[c]);
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x6,-0x24(%rbp)
jge    11a0 <main+0x80>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edi
call   1040 <powers_of_2@plt>
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1157 <main+0x37>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x4,%edi
call   1050 <powers_of_2@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7,%edi
call   1050 <powers_of_2@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x11,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x11,%edi
call   1050 <powers_of_2@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x20,%edi
call   1050 <powers_of_2@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x3e8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x3e8,%edi
call   1050 <powers_of_2@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x1388,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1388,%edi
call   1050 <powers_of_2@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.set = [6 x i32] [i32 4, i32 7, i32 17, i32 32, i32 1000, i32 5000]
@.str = [26 x i8] c"All powers of 2 up to %d:\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [6 x i32]* %2 to i8*
store i32 0, i32* %3
br label %5
5: ; preds = %20, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 6
br i1 %7, label %8, label %23
8: ; preds = %5
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 %10
%12 = load i32, i32* %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 %15
%17 = load i32, i32* %16
%18 = call i32 @powers_of_2(i32 %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %8
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %5
23: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"All powers of 2 up to %d:\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 4)
%2 = tail call i32 @powers_of_2(i32 4)
%3 = tail call i32 @putchar(i32 10)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 7)
%5 = tail call i32 @powers_of_2(i32 7)
%6 = tail call i32 @putchar(i32 10)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 17)
%8 = tail call i32 @powers_of_2(i32 17)
%9 = tail call i32 @putchar(i32 10)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 32)
%11 = tail call i32 @powers_of_2(i32 32)
%12 = tail call i32 @putchar(i32 10)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 1000)
%14 = tail call i32 @powers_of_2(i32 1000)
%15 = tail call i32 @putchar(i32 10)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 5000)
%17 = tail call i32 @powers_of_2(i32 5000)
%18 = tail call i32 @putchar(i32 10)
ret i32 0
}