#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 */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, int *);
int main(int argc, const char *argv[]) {
  int raw, rem, end;
  char put[1000];
  while (scanf("%d\n", &raw) != EOF) {
    printf("%d-->", raw);
    end = 0;
    if (raw == 0) {
      printf("0\n");
      continue;
    }
    if (raw < 0) {
      printf("-");
      raw = 0 - raw;
    }
    while (raw != 0) {
      rem = raw % 2;
      if (rem == 1) {
        put[end] = '1';
      } else {
        put[end] = '0';
      }
      raw = (raw - rem) / 2;
      end++;
    }
    put[end] = '\0';
    end--;
    while (end >= 0) {
      printf("%c", put[end]);
      end--;
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec0(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    0x2e98(%rip),%rcx
cmp    (%rcx),%rax
je     126b <main+0x14b>
mov    -0x14(%rbp),%esi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    118e <main+0x6e>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1139 <main+0x19>
cmpl   $0x0,-0x14(%rbp)
jge    11ae <main+0x8e>
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11b3 <main+0x93>
cmpl   $0x0,-0x14(%rbp)
je     1211 <main+0xf1>
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
jne    11e6 <main+0xc6>
movslq -0x1c(%rbp),%rax
movb   $0x31,-0x410(%rbp,%rax,1)
31
jmp    11f2 <main+0xd2>
movslq -0x1c(%rbp),%rax
movb   $0x30,-0x410(%rbp,%rax,1)
30
mov    -0x14(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11b3 <main+0x93>
movslq -0x1c(%rbp),%rax
movb   $0x0,-0x410(%rbp,%rax,1)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jl     1258 <main+0x138>
movslq -0x1c(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%esi
ff
lea    0xdcc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    1226 <main+0x106>
lea    0xdac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1139 <main+0x19>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x3f8,%rsp
lea    0xea8(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x2e7f(%rip),%r14
cmp    (%r14),%rax
jne    1182 <main+0x42>
xor    %eax,%eax
add    $0x3f8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe7b(%rip),%r15
lea    0xe70(%rip),%r12
lea    0xc(%rsp),%r13
jmp    11bc <main+0x7c>
nopw   0x0(%rax,%rax,1)
lea    0xe63(%rip),%rdi
call   1040 <puts@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1060 <scanf@plt>
cmp    (%r14),%rax
je     116e <main+0x2e>
mov    0xc(%rsp),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
je     11a0 <main+0x60>
jns    11ea <main+0xaa>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%eax
neg    %eax
mov    %eax,0xc(%rsp)
jae    1269 <main+0x129>
mov    $0x1,%esi
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %eax,%ebp
mov    %esi,%edx
shr    $0x1f,%eax
add    %ebp,%eax
mov    %eax,%esi
and    $0xfffffffe,%esi
mov    %ebp,%edi
sub    %esi,%edi
cmp    $0x1,%edi
sete   %bl
or     $0x30,%bl
mov    %bl,0x10(%rsp,%rcx,1)
sar    %eax
add    $0x1,%rcx
add    $0x1,%ebp
lea    0x1(%rdx),%esi
cmp    $0x2,%ebp
ja     1200 <main+0xc0>
mov    %eax,0xc(%rsp)
mov    %ecx,%eax
movb   $0x0,0x10(%rsp,%rax,1)
test   %ecx,%ecx
jle    1270 <main+0x130>
mov    %edx,%ebp
add    $0x1,%rbp
cs nopw 0x0(%rax,%rax,1)
nop
lea    -0x2(%rbp),%eax
movsbl 0x10(%rsp,%rax,1),%edi
call   1030 <putchar@plt>
add    $0xffffffffffffffff,%rbp
cmp    $0x1,%rbp
ja     1250 <main+0x110>
jmp    1270 <main+0x130>
movb   $0x0,0x10(%rsp)
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11ac <main+0x6c>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@EOF = global i64 0
@.str.1 = [6 x i8] c"%d-->\00"
@.str.2 = [3 x i8] c"0\0A\00"
@.str.3 = [2 x i8] c"-\00"
@.str.4 = [3 x i8] c"%c\00"
@.str.5 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [1000 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %10
10: ; preds = %70, %19, %2
%11 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %6)
%12 = load i64, i64* @EOF
%13 = icmp ne i64 %11, %12
br i1 %13, label %14, label %72
14: ; preds = %10
%15 = load i32, i32* %6
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %15)
store i32 0, i32* %8
%17 = load i32, i32* %6
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %14
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %10
21: ; preds = %14
%22 = load i32, i32* %6
%23 = icmp slt i32 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %21
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%26 = load i32, i32* %6
%27 = sub nsw i32 0, %26
store i32 %27, i32* %6
br label %28
28: ; preds = %24, %21
br label %29
29: ; preds = %45, %28
%30 = load i32, i32* %6
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %52
32: ; preds = %29
%33 = load i32, i32* %6
%34 = srem i32 %33, 2
store i32 %34, i32* %7
%35 = load i32, i32* %7
%36 = icmp eq i32 %35, 1
br i1 %36, label %37, label %41
37: ; preds = %32
%38 = load i32, i32* %8
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 %39
store i8 49, i8* %40
br label %45
41: ; preds = %32
%42 = load i32, i32* %8
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 %43
store i8 48, i8* %44
br label %45
45: ; preds = %41, %37
%46 = load i32, i32* %6
%47 = load i32, i32* %7
%48 = sub nsw i32 %46, %47
%49 = sdiv i32 %48, 2
store i32 %49, i32* %6
%50 = load i32, i32* %8
%51 = add nsw i32 %50, 1
store i32 %51, i32* %8
br label %29
52: ; preds = %29
%53 = load i32, i32* %8
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 %54
store i8 0, i8* %55
%56 = load i32, i32* %8
%57 = add nsw i32 %56, -1
store i32 %57, i32* %8
br label %58
58: ; preds = %61, %52
%59 = load i32, i32* %8
%60 = icmp sge i32 %59, 0
br i1 %60, label %61, label %70
61: ; preds = %58
%62 = load i32, i32* %8
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 %63
%65 = load i8, i8* %64
%66 = sext i8 %65 to i32
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %66)
%68 = load i32, i32* %8
%69 = add nsw i32 %68, -1
store i32 %69, i32* %8
br label %58
70: ; preds = %58
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %10
72: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@EOF = global i64 0
@.str.1 = [6 x i8] c"%d-->\00"
@str = [2 x i8] c"0\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca [1000 x i8]
%5 = bitcast i32* %3 to i8*
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%7 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = load i64, i64* @EOF
%9 = icmp eq i64 %7, %8
br i1 %9, label %60, label %10
10: ; preds = %2
%11 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
br label %12
12: ; preds = %10, %19
%13 = load i32, i32* %3
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %3
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %12
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %19
19: ; preds = %17, %58
%20 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %3)
%21 = load i64, i64* @EOF
%22 = icmp eq i64 %20, %21
br i1 %22, label %60, label %12
23: ; preds = %12
%24 = icmp slt i32 %15, 0
br i1 %24, label %25, label %30
25: ; preds = %23
%26 = call i32 @putchar(i32 45)
%27 = load i32, i32* %3
%28 = sub nsw i32 0, %27
store i32 %28, i32* %3
%29 = icmp eq i32 %27, 0
br i1 %29, label %32, label %30
30: ; preds = %23, %25
%31 = phi i32 [ %28, %25 ], [ %15, %23 ]
br label %33
32: ; preds = %25
store i8 0, i8* %11
br label %58
33: ; preds = %30, %33
%34 = phi i64 [ %41, %33 ], [ 0, %30 ]
%35 = phi i32 [ %40, %33 ], [ %31, %30 ]
%36 = srem i32 %35, 2
%37 = icmp eq i32 %36, 1
%38 = select i1 %37, i8 49, i8 48
%39 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 %34
store i8 %38, i8* %39
%40 = sdiv i32 %35, 2
%41 = add nuw i64 %34, 1
%42 = add i32 %35, 1
%43 = icmp ult i32 %42, 3
br i1 %43, label %44, label %33
44: ; preds = %33
%45 = trunc i64 %41 to i32
store i32 %40, i32* %3
%46 = and i64 %41, 4294967295
%47 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 %46
store i8 0, i8* %47
%48 = icmp sgt i32 %45, 0
br i1 %48, label %49, label %58
49: ; preds = %44, %49
%50 = phi i64 [ %51, %49 ], [ %46, %44 ]
%51 = add nsw i64 %50, -1
%52 = and i64 %51, 4294967295
%53 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 %52
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = call i32 @putchar(i32 %55)
%57 = icmp ugt i64 %50, 1
br i1 %57, label %49, label %58
58: ; preds = %49, %32, %44
%59 = call i32 @putchar(i32 10)
br label %19
60: ; preds = %19, %2
ret i32 0
}