#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*/ binString(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, unsigned short, int, int);
int /*<<< orphan*/ putchar(char);
int main() {
  int twos = 1;
  int x, r;
  unsigned short int v = 0;
  for (x = 0; x < 16; x++) {
    r = v | twos;
    printf("0x%04X | %6d = 0x%04X or ", v, twos, r);
    binString(r);
    putchar('\n');
    twos <<= 1;
  }
  exit(56234);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movw   $0x0,-0x12(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    11b9 <main+0x79>
movzwl -0x12(%rbp),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x12(%rbp),%ax
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe78(%rip),%rdi
movzwl %ax,%esi
call   1040 <printf@plt>
mov    -0x10(%rbp),%edi
call   1050 <binString@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1163 <main+0x23>
mov    $0xdbaa,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x1,%ebx
mov    $0x10,%ebp
lea    0xeab(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
xor    %esi,%esi
mov    %ebx,%edx
mov    %ebx,%ecx
call   1040 <printf@plt>
mov    %ebx,%edi
call   1050 <binString@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    %ebx,%ebx
add    $0xffffffff,%ebp
jne    1160 <main+0x20>
mov    $0xdbaa,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"0x%04X | %6d = 0x%04X or \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i16
store i32 0, i32* %1
store i32 1, i32* %2
store i16 0, i16* %5
store i32 0, i32* %3
br label %6
6: ; preds = %23, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 16
br i1 %8, label %9, label %26
9: ; preds = %6
%10 = load i16, i16* %5
%11 = zext i16 %10 to i32
%12 = load i32, i32* %2
%13 = or i32 %11, %12
store i32 %13, i32* %4
%14 = load i16, i16* %5
%15 = load i32, i32* %2
%16 = load i32, i32* %4
%17 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i16 zeroext %14, i32 %15, i32 %16)
%18 = load i32, i32* %4
%19 = call i32 @binString(i32 %18)
%20 = call i32 @putchar(i8 signext 10)
%21 = load i32, i32* %2
%22 = shl i32 %21, 1
store i32 %22, i32* %2
br label %23
23: ; preds = %9
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %6
26: ; preds = %6
%27 = call i32 @exit(i32 56234)
unreachable
}

LLVM IR (-O2):
@.str = [26 x i8] c"0x%04X | %6d = 0x%04X or \00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 1, %0 ], [ %7, %1 ]
%3 = phi i32 [ 0, %0 ], [ %8, %1 ]
%4 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i16 zeroext 0, i32 %2, i32 %2)
%5 = tail call i32 @binString(i32 %2)
%6 = tail call i32 @putchar(i8 signext 10)
%7 = shl i32 %2, 1
%8 = add nuw nsw i32 %3, 1
%9 = icmp eq i32 %8, 16
br i1 %9, label %10, label %1
10: ; preds = %1
%11 = tail call i32 @exit(i32 56234)
unreachable
}