#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*/ getch();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, long *);
main() {
  long int inp;
  scanf("%ld", &inp);
  int q, hst[100], i, c = 0;
  q = ((inp - (inp % 16)) / 16);
  for (i = 1; i <= 100 && q > 0; ++i) {
    hst[i] = inp % 16;
    q = ((inp - (inp % 16)) / 16);
    inp = q;
    c = c + 1;
  }
  for (i = 1; i <= c; ++i)
    printf("%d\n", hst[i]);
  getch();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x1b8(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x1c0(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x10,%ecx
cqto
idiv   %rcx
mov    -0x1c0(%rbp),%rax
sub    %rdx,%rax
mov    $0x10,%ecx
cqto
idiv   %rcx
mov    %eax,-0x14(%rbp)
movl   $0x1,-0x1b4(%rbp)
xor    %eax,%eax
cmpl   $0x64,-0x1b4(%rbp)
mov    %al,-0x1c1(%rbp)
jg     11b8 <main+0x88>
cmpl   $0x0,-0x14(%rbp)
setg   %al
mov    %al,-0x1c1(%rbp)
mov    -0x1c1(%rbp),%al
test   $0x1,%al
jne    11cb <main+0x9b>
jmp    1244 <main+0x114>
mov    -0x10(%rbp),%rax
mov    $0x10,%ecx
cqto
idiv   %rcx
mov    %edx,%ecx
movslq -0x1b4(%rbp),%rax
mov    %ecx,-0x1b0(%rbp,%rax,4)
mov    -0x10(%rbp),%rax
mov    %rax,-0x1d0(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x10,%ecx
cqto
idiv   %rcx
mov    -0x1d0(%rbp),%rax
sub    %rdx,%rax
mov    $0x10,%ecx
cqto
idiv   %rcx
mov    %eax,-0x14(%rbp)
movslq -0x14(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x1b8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b8(%rbp)
mov    -0x1b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b4(%rbp)
jmp    1196 <main+0x66>
movl   $0x1,-0x1b4(%rbp)
mov    -0x1b4(%rbp),%eax
cmp    -0x1b8(%rbp),%eax
jg     128e <main+0x15e>
movslq -0x1b4(%rbp),%rax
mov    -0x1b0(%rbp,%rax,4),%esi
lea    0xd8f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b4(%rbp)
jmp    124e <main+0x11e>
mov    $0x0,%al
call   1050 <getch@plt>
mov    -0x4(%rbp),%eax
add    $0x1d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x1a0,%rsp
lea    0xebd(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x8(%rsp),%rax
lea    0xf(%rax),%rcx
test   %rax,%rax
cmovns %rax,%rcx
shr    $0x4,%rcx
test   %ecx,%ecx
jle    11d5 <main+0xa5>
mov    $0x1,%r15d
nopl   0x0(%rax,%rax,1)
lea    0xf(%rax),%rcx
test   %rax,%rax
cmovns %rax,%rcx
mov    %r15,%rdx
sar    $0x4,%rcx
mov    %ecx,%esi
shl    $0x4,%esi
sub    %esi,%eax
mov    %eax,0x10(%rsp,%r15,4)
movslq %ecx,%rax
add    $0x1,%r15
cmp    $0x63,%rdx
ja     119f <main+0x6f>
test   %ecx,%ecx
jg     1170 <main+0x40>
mov    %rax,0x8(%rsp)
add    $0xffffffffffffffff,%r15
xor    %ebx,%ebx
lea    0xe53(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x14(%rsp,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    11c0 <main+0x90>
xor    %eax,%eax
call   1050 <getch@plt>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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