#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 /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
void main() {
  int number, i;
  int result[64];
  int count = 0;
  printf("Enter a number:");
  scanf("%d", &number);
  while (number != 0) {
    result[count++] = number % 2;
    number /= 2;
  }
  for (i = count - 1; i >= 0; i--) {
    printf("%d", result[i]);
  }
  system("pause");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x114(%rbp)
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x4(%rbp)
je     11a5 <main+0x75>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x114(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x114(%rbp)
cltq
mov    %edx,-0x110(%rbp,%rax,4)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    1163 <main+0x33>
mov    -0x114(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     11e2 <main+0xb2>
movslq -0x8(%rbp),%rax
mov    -0x110(%rbp,%rax,4),%esi
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    11b1 <main+0x81>
lea    0xe2a(%rip),%rdi
call   1030 <system@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x118,%rsp
lea    0xebf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec1(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%ecx
test   %ecx,%ecx
je     11cb <main+0x9b>
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ecx,%edx
shr    $0x1f,%ecx
add    %edx,%ecx
mov    %ecx,%esi
and    $0xfffffffe,%esi
mov    %edx,%edi
sub    %esi,%edi
mov    %edi,0x10(%rsp,%rax,4)
add    $0x1,%rax
sar    %ecx
add    $0x1,%edx
cmp    $0x3,%edx
jae    1170 <main+0x40>
mov    %ecx,0xc(%rsp)
test   %eax,%eax
jle    11cb <main+0x9b>
mov    %eax,%ebx
add    $0x1,%rbx
lea    0xe69(%rip),%r14
nopw   0x0(%rax,%rax,1)
lea    -0x2(%rbx),%eax
mov    0x10(%rsp,%rax,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
ja     11b0 <main+0x80>
lea    0xe41(%rip),%rdi
call   1030 <system@plt>
add    $0x118,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [16 x i8] c"Enter a number:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c"pause\00"
define void @main() {
%1 = alloca i32
%2 = alloca [64 x i32]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [64 x i32]* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = icmp eq i32 %7, 0
br i1 %8, label %31, label %14
9: ; preds = %14
%10 = trunc i64 %18 to i32
store i32 %20, i32* %1
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %31
12: ; preds = %9
%13 = and i64 %18, 4294967295
br label %23
14: ; preds = %0, %14
%15 = phi i64 [ %18, %14 ], [ 0, %0 ]
%16 = phi i32 [ %20, %14 ], [ %7, %0 ]
%17 = srem i32 %16, 2
%18 = add nuw i64 %15, 1
%19 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 %15
store i32 %17, i32* %19
%20 = sdiv i32 %16, 2
%21 = add i32 %16, 1
%22 = icmp ult i32 %21, 3
br i1 %22, label %9, label %14
23: ; preds = %12, %23
%24 = phi i64 [ %13, %12 ], [ %25, %23 ]
%25 = add nsw i64 %24, -1
%26 = and i64 %25, 4294967295
%27 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 %26
%28 = load i32, i32* %27
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = icmp ugt i64 %24, 1
br i1 %30, label %23, label %31
31: ; preds = %23, %0, %9
%32 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret void
}