#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(void) {
  int num;
  printf("Enter a number between 0 and 32767: ");
  scanf("%5d", &num);
  printf("The octal of your number is: %d%d%d%d%d\n",
         ((((num / 8) / 8) / 8) / 8) % 8, (((num / 8) / 8) / 8) % 8,
         ((num / 8) / 8) % 8, (num / 8) % 8, num % 8);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
mov    -0x8(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    -0x8(%rbp),%eax
mov    $0x8,%edi
cltd
idiv   %edi
mov    $0x8,%edi
cltd
idiv   %edi
mov    %edx,%r8d
mov    -0x8(%rbp),%eax
mov    $0x8,%edi
cltd
idiv   %edi
mov    %edx,%r9d
mov    -0xc(%rbp),%edx
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeef(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%r9d
lea    0x7(%r9),%eax
test   %r9d,%r9d
cmovns %r9d,%eax
lea    0xfff(%r9),%esi
test   %r9d,%r9d
cmovns %r9d,%esi
lea    0x1ff(%r9),%edx
test   %r9d,%r9d
cmovns %r9d,%edx
lea    0x3f(%r9),%ecx
test   %r9d,%r9d
cmovns %r9d,%ecx
sar    $0x6,%ecx
sar    $0x9,%edx
sar    $0xc,%esi
lea    0x7(%rsi),%edi
test   %esi,%esi
cmovns %esi,%edi
and    $0xfffffff8,%edi
sub    %edi,%esi
lea    0x7(%rdx),%edi
test   %edx,%edx
cmovns %edx,%edi
and    $0xfffffff8,%edi
sub    %edi,%edx
lea    0x7(%rcx),%edi
test   %ecx,%ecx
cmovns %ecx,%edi
and    $0xfffffff8,%edi
sub    %edi,%ecx
mov    %eax,%r8d
sar    $0x3,%r8d
lea    0x7(%r8),%edi
test   %r8d,%r8d
cmovns %r8d,%edi
and    $0xfffffff8,%edi
sub    %edi,%r8d
and    $0xfffffff8,%eax
sub    %eax,%r9d
lea    0xe5d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Enter a number between 0 and 32767: \00"
@.str.1 = [4 x i8] c"%5d\00"
@.str.2 = [41 x i8] c"The octal of your number is: %d%d%d%d%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = sdiv i32 %5, 8
%7 = sdiv i32 %6, 8
%8 = sdiv i32 %7, 8
%9 = sdiv i32 %8, 8
%10 = srem i32 %9, 8
%11 = load i32, i32* %2
%12 = sdiv i32 %11, 8
%13 = sdiv i32 %12, 8
%14 = sdiv i32 %13, 8
%15 = srem i32 %14, 8
%16 = load i32, i32* %2
%17 = sdiv i32 %16, 8
%18 = sdiv i32 %17, 8
%19 = srem i32 %18, 8
%20 = load i32, i32* %2
%21 = sdiv i32 %20, 8
%22 = srem i32 %21, 8
%23 = load i32, i32* %2
%24 = srem i32 %23, 8
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 %10, i32 %15, i32 %19, i32 %22, i32 %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [37 x i8] c"Enter a number between 0 and 32767: \00"
@.str.1 = [4 x i8] c"%5d\00"
@.str.2 = [41 x i8] c"The octal of your number is: %d%d%d%d%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = sdiv i32 %5, 8
%7 = sdiv i32 %5, 64
%8 = sdiv i32 %5, 512
%9 = sdiv i32 %5, 4096
%10 = srem i32 %9, 8
%11 = srem i32 %8, 8
%12 = srem i32 %7, 8
%13 = srem i32 %6, 8
%14 = srem i32 %5, 8
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 %10, i32 %11, i32 %12, i32 %13, i32 %14)
ret i32 0
}