#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 main() {
  int ch[10000];
  int a, i = 0, j = 0;
  scanf("%d", &a);
  while (a) {
    ch[i] = a % 2;
    a /= 2;
    i++;
  }
  for (j = i - 1; j >= 0; j--) {
    printf("%d", ch[j]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x9c60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x9c58(%rbp)
movl   $0x0,-0x9c5c(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x9c54(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x9c54(%rbp)
je     11aa <main+0x8a>
mov    -0x9c54(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
movslq -0x9c58(%rbp),%rax
mov    %edx,-0x9c50(%rbp,%rax,4)
mov    -0x9c54(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x9c54(%rbp)
mov    -0x9c58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c58(%rbp)
jmp    1159 <main+0x39>
mov    -0x9c58(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x9c5c(%rbp)
cmpl   $0x0,-0x9c5c(%rbp)
jl     11f6 <main+0xd6>
movslq -0x9c5c(%rbp),%rax
mov    -0x9c50(%rbp,%rax,4),%esi
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x9c5c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x9c5c(%rbp)
jmp    11b9 <main+0x99>
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x9c60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x9c58,%rsp
lea    0xebf(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%ecx
test   %ecx,%ecx
je     11bb <main+0x8b>
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nop
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)
sar    %ecx
add    $0x1,%rax
add    $0x1,%edx
cmp    $0x3,%edx
jae    1160 <main+0x30>
mov    %ecx,0xc(%rsp)
test   %eax,%eax
jle    11bb <main+0x8b>
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     11a0 <main+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x9c58,%rsp
pop    %rbx
pop    %r14
ret

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

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