#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, a, b, c, d, e;
  printf("Enter a number between 0 and 32767: ");
  scanf("%d", &num);
  e = num % 8;
  num /= 8;
  d = num % 8;
  num /= 8;
  c = num % 8;
  num /= 8;
  b = num % 8;
  num /= 8;
  a = num % 8;
  printf("%d%d%d%d%d\n", a, b, c, d, e);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%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    %edx,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%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    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
lea    0x7(%r9),%r8d
test   %r9d,%r9d
cmovns %r9d,%r8d
mov    %r8d,%eax
and    $0xfffffff8,%eax
sub    %eax,%r9d
sar    $0x3,%r8d
lea    0x7(%r8),%eax
test   %r8d,%r8d
cmovns %r8d,%eax
and    $0xfffffff8,%eax
sub    %eax,%r8d
sar    $0x6,%ecx
lea    0x7(%rcx),%eax
test   %ecx,%ecx
cmovns %ecx,%eax
and    $0xfffffff8,%eax
sub    %eax,%ecx
sar    $0x9,%edx
lea    0x7(%rdx),%eax
test   %edx,%edx
cmovns %edx,%eax
and    $0xfffffff8,%eax
sub    %eax,%edx
sar    $0xc,%esi
mov    %esi,0x4(%rsp)
lea    0x7(%rsi),%eax
test   %esi,%esi
cmovns %esi,%eax
and    $0xfffffff8,%eax
sub    %eax,%esi
lea    0xe58(%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 = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"%d%d%d%d%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = srem i32 %10, 8
store i32 %11, i32* %7
%12 = load i32, i32* %2
%13 = sdiv i32 %12, 8
store i32 %13, i32* %2
%14 = load i32, i32* %2
%15 = srem i32 %14, 8
store i32 %15, i32* %6
%16 = load i32, i32* %2
%17 = sdiv i32 %16, 8
store i32 %17, i32* %2
%18 = load i32, i32* %2
%19 = srem i32 %18, 8
store i32 %19, i32* %5
%20 = load i32, i32* %2
%21 = sdiv i32 %20, 8
store i32 %21, i32* %2
%22 = load i32, i32* %2
%23 = srem i32 %22, 8
store i32 %23, i32* %4
%24 = load i32, i32* %2
%25 = sdiv i32 %24, 8
store i32 %25, i32* %2
%26 = load i32, i32* %2
%27 = srem i32 %26, 8
store i32 %27, i32* %3
%28 = load i32, i32* %3
%29 = load i32, i32* %4
%30 = load i32, i32* %5
%31 = load i32, i32* %6
%32 = load i32, i32* %7
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %28, i32 %29, i32 %30, i32 %31, i32 %32)
ret i32 0
}

LLVM IR (-O2):
@.str = [37 x i8] c"Enter a number between 0 and 32767: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"%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 ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = srem i32 %5, 8
%7 = sdiv i32 %5, 8
%8 = srem i32 %7, 8
%9 = sdiv i32 %5, 64
%10 = srem i32 %9, 8
%11 = sdiv i32 %5, 512
%12 = srem i32 %11, 8
%13 = sdiv i32 %5, 4096
store i32 %13, i32* %1
%14 = srem i32 %13, 8
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %14, i32 %12, i32 %10, i32 %8, i32 %6)
ret i32 0
}