#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 */
scalar_t__ ceil(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ sep(int *, int *);
int main() {
  int num, dig;
  printf("\nEnter an integer > ");
  scanf("%d", &num);
  if (num > 0) {
    while ((num % 10) != 0) {
      sep(&num, &dig);
      printf("\n%d", dig);
    }
  } else if (num < 0) {
    while ((num % 10) != 0) {
      sep(&num, &dig);
      if (num == 0)
        printf("\n-%d", dig);
      else
        printf("\n%d", dig);
    }
  } else if (ceil(num) == 0) {
    printf("\n0");
  }
  printf("\nThat's all, have a nice day!\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    11b8 <main+0x78>
jmp    117c <main+0x3c>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11b3 <main+0x73>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <sep@plt>
mov    -0xc(%rbp),%esi
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    117c <main+0x3c>
jmp    124d <main+0x10d>
cmpl   $0x0,-0x8(%rbp)
jge    1223 <main+0xe3>
jmp    11c7 <main+0x87>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     121e <main+0xde>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <sep@plt>
cmpl   $0x0,-0x8(%rbp)
jne    1208 <main+0xc8>
mov    -0xc(%rbp),%esi
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1219 <main+0xd9>
mov    -0xc(%rbp),%esi
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11c7 <main+0x87>
jmp    1248 <main+0x108>
mov    -0x8(%rbp),%edi
call   1030 <ceil@plt>
cmp    $0x0,%rax
jne    1243 <main+0x103>
lea    0xde2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1248 <main+0x108>
jmp    124d <main+0x10d>
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xea1(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xea9(%rip),%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
mov    (%rsp),%eax
test   %eax,%eax
jle    11d3 <main+0x83>
imul   $0xcccccccd,%eax,%eax
ror    %eax
cmp    $0x1999999a,%eax
jb     1256 <main+0x106>
mov    %rsp,%r14
lea    0x4(%rsp),%r15
lea    0xe77(%rip),%rbx
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r15,%rsi
call   1070 <sep@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
imul   $0xcccccccd,(%rsp),%eax
add    $0x19999998,%eax
ror    %eax
cmp    $0x19999999,%eax
jae    11a0 <main+0x50>
jmp    1256 <main+0x106>
js     11f1 <main+0xa1>
xor    %edi,%edi
call   1040 <ceil@plt>
test   %rax,%rax
jne    1256 <main+0x106>
lea    0xe36(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1256 <main+0x106>
neg    %eax
imul   $0xcccccccd,%eax,%eax
ror    %eax
cmp    $0x1999999a,%eax
jb     1256 <main+0x106>
mov    %rsp,%r14
lea    0x4(%rsp),%r15
lea    0xe08(%rip),%r12
lea    0xdfd(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1070 <sep@plt>
cmpl   $0x0,(%rsp)
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
cmove  %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
imul   $0xcccccccd,(%rsp),%eax
add    $0x19999998,%eax
ror    %eax
cmp    $0x19999999,%eax
jae    1220 <main+0xd0>
lea    0xdc4(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [21 x i8] c"\0AEnter an integer > \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"\0A%d\00"
@.str.3 = [5 x i8] c"\0A-%d\00"
@.str.4 = [3 x i8] c"\0A0\00"
@.str.5 = [31 x i8] c"\0AThat's all, have a nice day!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %18
8: ; preds = %0
br label %9
9: ; preds = %13, %8
%10 = load i32, i32* %2
%11 = srem i32 %10, 10
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = call i32 @sep(i32* %2, i32* %3)
%15 = load i32, i32* %3
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %15)
br label %9
17: ; preds = %9
br label %46
18: ; preds = %0
%19 = load i32, i32* %2
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %38
21: ; preds = %18
br label %22
22: ; preds = %36, %21
%23 = load i32, i32* %2
%24 = srem i32 %23, 10
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %37
26: ; preds = %22
%27 = call i32 @sep(i32* %2, i32* %3)
%28 = load i32, i32* %2
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %26
%31 = load i32, i32* %3
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %31)
br label %36
33: ; preds = %26
%34 = load i32, i32* %3
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %33, %30
br label %22
37: ; preds = %22
br label %45
38: ; preds = %18
%39 = load i32, i32* %2
%40 = call i64 @ceil(i32 %39)
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %38
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %44
44: ; preds = %42, %38
br label %45
45: ; preds = %44, %37
br label %46
46: ; preds = %45, %17
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"\0AEnter an integer > \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"\0A%d\00"
@.str.3 = [5 x i8] c"\0A-%d\00"
@.str.4 = [3 x i8] c"\0A0\00"
@str = [30 x i8] c"\0AThat's all, have a nice day!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %0
%10 = urem i32 %7, 10
%11 = icmp eq i32 %10, 0
br i1 %11, label %40, label %12
12: ; preds = %9, %12
%13 = call i32 @sep(i32* %1, i32* %2)
%14 = load i32, i32* %2
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %1
%17 = srem i32 %16, 10
%18 = icmp eq i32 %17, 0
br i1 %18, label %40, label %12
19: ; preds = %0
%20 = icmp slt i32 %7, 0
br i1 %20, label %21, label %35
21: ; preds = %19
%22 = sub i32 0, %7
%23 = urem i32 %22, 10
%24 = icmp eq i32 %23, 0
br i1 %24, label %40, label %25
25: ; preds = %21, %25
%26 = call i32 @sep(i32* %1, i32* %2)
%27 = load i32, i32* %1
%28 = icmp eq i32 %27, 0
%29 = load i32, i32* %2
%30 = select i1 %28, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %30, i32 %29)
%32 = load i32, i32* %1
%33 = srem i32 %32, 10
%34 = icmp eq i32 %33, 0
br i1 %34, label %40, label %25
35: ; preds = %19
%36 = call i64 @ceil(i32 0)
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %40
40: ; preds = %25, %12, %21, %9, %38, %35
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
ret i32 0
}