#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);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, const char *argv[]) {
  int a[100], n, i = 0;
  scanf("%d", &n);
  while (n != 0) {
    a[i] = n % 8;
    n = (n - a[i]) / 8;
    i++;
  }
  i--;
  while (i >= 0)
    printf("%d", a[i--]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1a8(%rbp)
lea    0xeb6(%rip),%rdi
lea    -0x1a4(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x1a4(%rbp)
je     11b5 <main+0x95>
mov    -0x1a4(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
movslq -0x1a8(%rbp),%rax
mov    %edx,-0x1a0(%rbp,%rax,4)
mov    -0x1a4(%rbp),%eax
movslq -0x1a8(%rbp),%rcx
sub    -0x1a0(%rbp,%rcx,4),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1a4(%rbp)
mov    -0x1a8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a8(%rbp)
jmp    1156 <main+0x36>
mov    -0x1a8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1a8(%rbp)
cmpl   $0x0,-0x1a8(%rbp)
jl     11fc <main+0xdc>
mov    -0x1a8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x1a8(%rbp)
cltq
mov    -0x1a0(%rbp,%rax,4),%esi
lea    0xe0e(%rip),%rdi
call   1030 <printf@plt>
jmp    11c4 <main+0xa4>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x1a8,%rsp
lea    0xecf(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%ecx
test   %ecx,%ecx
je     11a9 <main+0x89>
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    1150 <main+0x30>
mov    %ecx,0xc(%rsp)
test   %eax,%eax
jle    11a9 <main+0x89>
mov    %eax,%ebx
add    $0x1,%rbx
lea    0xe78(%rip),%r14
nopl   0x0(%rax,%rax,1)
lea    -0x2(%rbx),%eax
mov    0x10(%rsp,%rax,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
ja     1190 <main+0x70>
xor    %eax,%eax
add    $0x1a8,%rsp
pop    %rbx
pop    %r14
ret

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

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