#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 *, long *);
int main() {
  long int x, c, j, i;
  long int a[100000];
  scanf("%ld", &x);
  if (x == 0)
    printf("0\n");
  else {
    c = 0;
    for (i = x; (i / 2 != 0) || (i == 1); i = i / 2) {
      a[c] = i % 2;
      c++;
    }
    for (j = c - 1; j > 0; j--) {
      printf("%ld", a[j]);
    }
    printf("%ld\n", a[0]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc3540,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmpq   $0x0,-0x10(%rbp)
jne    1160 <main+0x40>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1248 <main+0x128>
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0xc3531(%rbp)
jne    11a1 <main+0x81>
cmpq   $0x1,-0x28(%rbp)
sete   %al
mov    %al,-0xc3531(%rbp)
mov    -0xc3531(%rbp),%al
test   $0x1,%al
jne    11b4 <main+0x94>
jmp    11f1 <main+0xd1>
mov    -0x28(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    -0x18(%rbp),%rax
mov    %rdx,-0xc3530(%rbp,%rax,8)
ff
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x28(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    %rax,-0x28(%rbp)
jmp    1170 <main+0x50>
mov    -0x18(%rbp),%rax
sub    $0x1,%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jle    1233 <main+0x113>
mov    -0x20(%rbp),%rax
mov    -0xc3530(%rbp,%rax,8),%rsi
ff
lea    0xde5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
jmp    11fd <main+0xdd>
mov    -0xc3530(%rbp),%rsi
lea    0xdc6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xc3540,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xc3518,%rsp
lea    0xebf(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x8(%rsp),%rax
test   %rax,%rax
je     11dd <main+0xad>
lea    -0x1(%rax),%rcx
cmp    $0xfffffffffffffffd,%rcx
ja     11c8 <main+0x98>
mov    $0x1,%ebx
nopl   0x0(%rax,%rax,1)
mov    %rax,%rcx
shr    $0x3f,%rcx
add    %rax,%rcx
mov    %rcx,%rdx
sar    %rdx
and    $0xfffffffffffffffe,%rcx
sub    %rcx,%rax
mov    %rax,0x8(%rsp,%rbx,8)
lea    -0x1(%rdx),%rcx
add    $0x1,%rbx
mov    %rdx,%rax
cmp    $0xfffffffffffffffe,%rcx
jb     1170 <main+0x40>
cmp    $0x2,%rbx
je     11c8 <main+0x98>
lea    0xe56(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    (%rsp,%rbx,8),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x2,%rbx
ja     11b0 <main+0x80>
mov    0x10(%rsp),%rsi
lea    0xe30(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11e9 <main+0xb9>
lea    0xe25(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0xc3518,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%ld\00"
@.str.1 = [3 x i8] c"0\0A\00"
@.str.2 = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca [100000 x i64]
store i32 0, i32* %1
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %2)
%8 = load i64, i64* %2
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %51
12: ; preds = %0
store i64 0, i64* %3
%13 = load i64, i64* %2
store i64 %13, i64* %5
br label %14
14: ; preds = %30, %12
%15 = load i64, i64* %5
%16 = sdiv i64 %15, 2
%17 = icmp ne i64 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %14
%19 = load i64, i64* %5
%20 = icmp eq i64 %19, 1
br label %21
21: ; preds = %18, %14
%22 = phi i1 [ true, %14 ], [ %20, %18 ]
br i1 %22, label %23, label %33
23: ; preds = %21
%24 = load i64, i64* %5
%25 = srem i64 %24, 2
%26 = load i64, i64* %3
%27 = getelementptr inbounds [100000 x i64], [100000 x i64]* %6, i64 0, i64 %26
store i64 %25, i64* %27
%28 = load i64, i64* %3
%29 = add nsw i64 %28, 1
store i64 %29, i64* %3
br label %30
30: ; preds = %23
%31 = load i64, i64* %5
%32 = sdiv i64 %31, 2
store i64 %32, i64* %5
br label %14
33: ; preds = %21
%34 = load i64, i64* %3
%35 = sub nsw i64 %34, 1
store i64 %35, i64* %4
br label %36
36: ; preds = %44, %33
%37 = load i64, i64* %4
%38 = icmp sgt i64 %37, 0
br i1 %38, label %39, label %47
39: ; preds = %36
%40 = load i64, i64* %4
%41 = getelementptr inbounds [100000 x i64], [100000 x i64]* %6, i64 0, i64 %40
%42 = load i64, i64* %41
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %42)
br label %44
44: ; preds = %39
%45 = load i64, i64* %4
%46 = add nsw i64 %45, -1
store i64 %46, i64* %4
br label %36
47: ; preds = %36
%48 = getelementptr inbounds [100000 x i64], [100000 x i64]* %6, i64 0, i64 0
%49 = load i64, i64* %48
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 %49)
br label %51
51: ; preds = %47, %10
ret i32 0
}

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