#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);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ system(char *);
int main(void) {
  int p[32];
  int t = 0;
  int n = 18;
  while (n != 0) {
    p[t++] = n % 2;
    n = n / 2;
  }
  while (t != 0)
    printf("%d", p[--t]);
  putchar('\n');
  system("pause");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x94(%rbp)
movl   $0x12,-0x98(%rbp)
cmpl   $0x0,-0x98(%rbp)
je     11a4 <main+0x74>
mov    -0x98(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x94(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x94(%rbp)
cltq
mov    %edx,-0x90(%rbp,%rax,4)
mov    -0x98(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x98(%rbp)
jmp    1156 <main+0x26>
jmp    11a9 <main+0x79>
cmpl   $0x0,-0x94(%rbp)
je     11df <main+0xaf>
mov    -0x94(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x94(%rbp)
cltq
mov    -0x90(%rbp,%rax,4),%esi
lea    0xe2b(%rip),%rdi
call   1050 <printf@plt>
jmp    11a9 <main+0x79>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe13(%rip),%rdi
call   1040 <system@plt>
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1050 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1050 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe82(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [32 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 18, i32* %4
br label %5
5: ; preds = %8, %0
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = load i32, i32* %4
%10 = srem i32 %9, 2
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
%13 = sext i32 %11 to i64
%14 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 %13
store i32 %10, i32* %14
%15 = load i32, i32* %4
%16 = sdiv i32 %15, 2
store i32 %16, i32* %4
br label %5
17: ; preds = %5
br label %18
18: ; preds = %21, %17
%19 = load i32, i32* %3
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %28
21: ; preds = %18
%22 = load i32, i32* %3
%23 = add nsw i32 %22, -1
store i32 %23, i32* %3
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %26)
br label %18
28: ; preds = %18
%29 = call i32 @putchar(i8 signext 10)
%30 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%31 = load i32, i32* %1
ret i32 %31
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 0)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 1)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 0)
%6 = tail call i32 @putchar(i8 signext 10)
%7 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}