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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movslq -0x8(%rbp),%rax
movabs $0x2540be3ff,%rcx
cmp    %rcx,%rax
jg     1210 <main+0xe0>
cmpl   $0x0,-0x8(%rbp)
jge    1184 <main+0x54>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11ee <main+0xbe>
cmpl   $0x0,-0x8(%rbp)
je     11ee <main+0xbe>
cmpl   $0x0,-0xc(%rbp)
jge    11ee <main+0xbe>
xor    %esi,%esi
sub    -0x8(%rbp),%esi
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1210 <main+0xe0>
cmpl   $0x0,-0x8(%rbp)
jne    120b <main+0xdb>
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1210 <main+0xe0>
jmp    115d <main+0x2d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
mov    $0xcccccccd,%r14d
lea    0xeb0(%rip),%rbx
jmp    1178 <main+0x48>
cs nopw 0x0(%rax,%rax,1)
add    $0x9,%eax
cmp    $0x12,%eax
jbe    11de <main+0xae>
mov    %esi,%eax
neg    %eax
cmovs  %esi,%eax
mov    %eax,0x4(%rsp)
mov    %rax,%rcx
imul   %r14,%rcx
shr    $0x23,%rcx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0x4(%rsp),%rax
imul   $0x66666667,%rax,%rsi
mov    %rsi,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rsi
add    %ecx,%esi
mov    %esi,0x4(%rsp)
cmp    $0x63,%rax
jg     1170 <main+0x40>
lea    -0xa(%rax),%ecx
cmp    $0xffffffec,%ecx
ja     1170 <main+0x40>
neg    %esi
lea    0xe43(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11ea <main+0xba>
lea    0xe55(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Enter an integer > \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"\0A%d\00"
@.str.3 = [34 x i8] c"\0A%d\0AThat's all, have a nice day!\0A\00"
@.str.4 = [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 ([20 x i8], [20 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)
br label %6
6: ; preds = %40, %0
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = icmp sle i64 %8, 9999999999
br i1 %9, label %10, label %41
10: ; preds = %6
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = load i32, i32* %2
store i32 %14, i32* %3
br label %15
15: ; preds = %13, %10
%16 = load i32, i32* %2
%17 = call i32 @abs(i32 %16)
store i32 %17, i32* %2
%18 = load i32, i32* %2
%19 = srem i32 %18, 10
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %19)
%21 = load i32, i32* %2
%22 = sdiv i32 %21, 10
store i32 %22, i32* %2
%23 = load i32, i32* %2
%24 = icmp slt i32 %23, 10
br i1 %24, label %25, label %35
25: ; preds = %15
%26 = load i32, i32* %2
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %35
28: ; preds = %25
%29 = load i32, i32* %3
%30 = icmp slt i32 %29, 0
br i1 %30, label %31, label %35
31: ; preds = %28
%32 = load i32, i32* %2
%33 = sub nsw i32 0, %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %33)
br label %41
35: ; preds = %28, %25, %15
%36 = load i32, i32* %2
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
br label %41
40: ; preds = %35
br label %6
41: ; preds = %38, %31, %6
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Enter an integer > \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"\0A%d\00"
@.str.3 = [34 x i8] c"\0A%d\0AThat's all, have a nice day!\0A\00"
@str = [30 x i8] c"\0AThat's all, have a nice day!\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 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
br label %6
6: ; preds = %20, %0
%7 = phi i32 [ %12, %20 ], [ %5, %0 ]
%8 = call i32 @llvm.abs.i32(i32 %7, i1 true)
store i32 %8, i32* %1
%9 = urem i32 %8, 10
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %1
%12 = sdiv i32 %11, 10
store i32 %12, i32* %1
%13 = icmp slt i32 %11, 100
%14 = add i32 %11, -10
%15 = icmp ult i32 %14, -19
%16 = and i1 %13, %15
br i1 %16, label %17, label %20
17: ; preds = %6
%18 = sub nsw i32 0, %12
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %18)
br label %25
20: ; preds = %6
%21 = add i32 %11, 9
%22 = icmp ult i32 %21, 19
br i1 %22, label %23, label %6
23: ; preds = %20
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
br label %25
25: ; preds = %23, %17
ret i32 0
}