#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 *, long long);
int /*<<< orphan*/ scanf(char *, long long *);
int main() {
  long long int d, a;
  scanf("%lld", &d);
  if (d > 0) {
    while (d > 0) {
      a = d % 10;
      d = d / 10;
      printf("%lld\n", a);
    }
  } else if (d < 0) {
    while (d < 0) {
      a = d % 10;
      d = d / 10;
      printf("%lld\n", a);
    }
  } else
    printf("%lld", d);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmpq   $0x0,-0x10(%rbp)
jle    1198 <main+0x78>
jmp    114f <main+0x2f>
cmpq   $0x0,-0x10(%rbp)
jle    1193 <main+0x73>
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
jmp    114f <main+0x2f>
jmp    1206 <main+0xe6>
cmpq   $0x0,-0x10(%rbp)
jge    11f1 <main+0xd1>
jmp    11a8 <main+0x88>
cmpq   $0x0,-0x10(%rbp)
jge    11ec <main+0xcc>
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe23(%rip),%rdi
call   1030 <printf@plt>
jmp    11a8 <main+0x88>
jmp    1201 <main+0xe1>
mov    -0x10(%rbp),%rsi
lea    0xe04(%rip),%rdi
call   1030 <printf@plt>
jmp    1206 <main+0xe6>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%rsi
test   %rsi,%rsi
jle    117c <main+0x5c>
movabs $0xcccccccccccccccd,%r14
cc cc cc
lea    0xeb8(%rip),%rbx
nopl   (%rax)
mov    %rsi,%rax
mul    %r14
shr    $0x3,%rdx
lea    (%rdx,%rdx,1),%rax
lea    (%rax,%rax,4),%rax
sub    %rax,%rsi
mov    %rdx,(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    (%rsp),%rsi
test   %rsi,%rsi
jg     1150 <main+0x30>
jmp    11cd <main+0xad>
js     118e <main+0x6e>
lea    0xe7b(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
jmp    11cd <main+0xad>
movabs $0xcccccccccccccccd,%r14
cc cc cc
lea    0xe66(%rip),%rbx
nop
mov    %rsi,%rax
neg    %rax
mul    %r14
shr    $0x3,%rdx
lea    (%rdx,%rdx,4),%rax
lea    (%rsi,%rax,2),%rsi
neg    %rdx
mov    %rdx,(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    (%rsp),%rsi
test   %rsi,%rsi
js     11a0 <main+0x80>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%lld\00"
@.str.1 = [6 x i8] c"%lld\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %1)
%4 = load i64, i64* %1
%5 = icmp sgt i64 %4, 0
br i1 %5, label %6, label %13
6: ; preds = %0, %6
%7 = phi i64 [ %11, %6 ], [ %4, %0 ]
%8 = urem i64 %7, 10
%9 = udiv i64 %7, 10
store i64 %9, i64* %1
%10 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %8)
%11 = load i64, i64* %1
%12 = icmp sgt i64 %11, 0
br i1 %12, label %6, label %27
13: ; preds = %0
%14 = icmp slt i64 %4, 0
br i1 %14, label %15, label %25
15: ; preds = %13, %15
%16 = phi i64 [ %23, %15 ], [ %4, %13 ]
%17 = sub i64 0, %16
%18 = urem i64 %17, 10
%19 = sub nsw i64 0, %18
%20 = udiv i64 %17, 10
%21 = sub nsw i64 0, %20
store i64 %21, i64* %1
%22 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %19)
%23 = load i64, i64* %1
%24 = icmp slt i64 %23, 0
br i1 %24, label %15, label %27
25: ; preds = %13
%26 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 0)
br label %27
27: ; preds = %15, %6, %25
ret i32 0
}