#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;
  scanf("%d", &a);
  while (a) {
    ch[i] = a % 8;
    a /= 8;
    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)
lea    0xebd(%rip),%rdi
lea    -0x9c54(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x9c54(%rbp)
je     11a0 <main+0x80>
mov    -0x9c54(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
movslq -0x9c58(%rbp),%rax
mov    %edx,-0x9c50(%rbp,%rax,4)
mov    -0x9c54(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x9c54(%rbp)
mov    -0x9c58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c58(%rbp)
jmp    114f <main+0x2f>
mov    -0x9c58(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x9c5c(%rbp)
cmpl   $0x0,-0x9c5c(%rbp)
jl     11ec <main+0xcc>
movslq -0x9c5c(%rbp),%rax
mov    -0x9c50(%rbp,%rax,4),%esi
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x9c5c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x9c5c(%rbp)
jmp    11af <main+0x8f>
lea    0xe10(%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
lea    0x7(%rcx),%edx
test   %ecx,%ecx
mov    %ecx,%esi
cmovs  %edx,%esi
mov    %esi,%edi
and    $0xfffffff8,%edi
sub    %edi,%ecx
mov    %ecx,0x10(%rsp,%rax,4)
mov    %esi,%ecx
sar    $0x3,%ecx
add    $0x1,%rax
cmp    $0xf,%edx
jae    1160 <main+0x30>
mov    %ecx,0xc(%rsp)
test   %eax,%eax
jle    11bb <main+0x8b>
mov    %eax,%ebx
add    $0x1,%rbx
lea    0xe68(%rip),%r14
nopl   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
%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, 8
%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, 8
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, 8
%17 = getelementptr inbounds [10000 x i32], [10000 x i32]* %1, i64 0, i64 %14
store i32 %16, i32* %17
%18 = sdiv i32 %15, 8
%19 = add nuw i64 %14, 1
%20 = add i32 %15, 7
%21 = icmp ult i32 %20, 15
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
}