#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 != 0) {
      sep(&num, &dig);
      printf("\n%d", dig);
    }
  } else if (num < 0) {
    while (num != 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    11ae <main+0x6e>
jmp    117c <main+0x3c>
cmpl   $0x0,-0x8(%rbp)
je     11a9 <main+0x69>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <sep@plt>
mov    -0xc(%rbp),%esi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    117c <main+0x3c>
jmp    1239 <main+0xf9>
cmpl   $0x0,-0x8(%rbp)
jge    120f <main+0xcf>
jmp    11bd <main+0x7d>
cmpl   $0x0,-0x8(%rbp)
je     120a <main+0xca>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <sep@plt>
cmpl   $0x0,-0x8(%rbp)
jne    11f4 <main+0xb4>
mov    -0xc(%rbp),%esi
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1205 <main+0xc5>
mov    -0xc(%rbp),%esi
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11bd <main+0x7d>
jmp    1234 <main+0xf4>
mov    -0x8(%rbp),%edi
call   1030 <ceil@plt>
cmp    $0x0,%rax
jne    122f <main+0xef>
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1234 <main+0xf4>
jmp    1239 <main+0xf9>
lea    0xde1(%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>
cmpl   $0x0,(%rsp)
jle    11c9 <main+0x79>
mov    %rsp,%r14
lea    0x4(%rsp),%r15
lea    0xe8b(%rip),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1070 <sep@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmpl   $0x0,(%rsp)
jne    1190 <main+0x40>
lea    0xe6b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
js     11e7 <main+0x97>
xor    %edi,%edi
call   1040 <ceil@plt>
test   %rax,%rax
jne    11af <main+0x5f>
lea    0xe40(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11af <main+0x5f>
mov    %rsp,%r14
lea    0x4(%rsp),%r15
lea    0xe23(%rip),%r12
lea    0xe18(%rip),%rbx
nopl   (%rax)
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>
cmpl   $0x0,(%rsp)
jne    1200 <main+0xb0>
jmp    11af <main+0x5f>

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 %17
8: ; preds = %0
br label %9
9: ; preds = %12, %8
%10 = load i32, i32* %2
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = call i32 @sep(i32* %2, i32* %3)
%14 = load i32, i32* %3
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %14)
br label %9
16: ; preds = %9
br label %44
17: ; preds = %0
%18 = load i32, i32* %2
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %36
20: ; preds = %17
br label %21
21: ; preds = %34, %20
%22 = load i32, i32* %2
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %35
24: ; preds = %21
%25 = call i32 @sep(i32* %2, i32* %3)
%26 = load i32, i32* %2
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %24
%29 = load i32, i32* %3
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %29)
br label %34
31: ; preds = %24
%32 = load i32, i32* %3
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %31, %28
br label %21
35: ; preds = %21
br label %43
36: ; preds = %17
%37 = load i32, i32* %2
%38 = call i64 @ceil(i32 %37)
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %42
42: ; preds = %40, %36
br label %43
43: ; preds = %42, %35
br label %44
44: ; preds = %43, %16
%45 = 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 %15
9: ; preds = %0, %9
%10 = call i32 @sep(i32* %1, i32* %2)
%11 = load i32, i32* %2
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %1
%14 = icmp eq i32 %13, 0
br i1 %14, label %31, label %9
15: ; preds = %0
%16 = icmp slt i32 %7, 0
br i1 %16, label %17, label %26
17: ; preds = %15, %17
%18 = call i32 @sep(i32* %1, i32* %2)
%19 = load i32, i32* %1
%20 = icmp eq i32 %19, 0
%21 = load i32, i32* %2
%22 = select i1 %20, 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)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %22, i32 %21)
%24 = load i32, i32* %1
%25 = icmp eq i32 %24, 0
br i1 %25, label %31, label %17
26: ; preds = %15
%27 = call i64 @ceil(i32 0)
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %31
31: ; preds = %17, %9, %29, %26
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
ret i32 0
}