#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(void) {
  int number, rem;
  printf("\nEnter an integer > ");
  scanf("%d", &number);
  printf("\n");
  if (number < 0) {
    number = abs(number);
    while (number > 10) {
      rem = number % 10;
      printf("%d\n", rem);
      number = number / 10;
    }
    number = number - 2 * number;
    printf("%d\nThat's all, have a nice day!\n", number);
  } else if (number == 0) {
    printf("%d\nThat's all, have a nice day!\n", number);
  } else {
    while (number != 0) {
      rem = number % 10;
      printf("%d\n", rem);
      number = number / 10;
    }
    printf("That'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    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
jge    11e0 <main+0xb0>
mov    -0x8(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jle    11bc <main+0x8c>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1180 <main+0x50>
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1254 <main+0x124>
cmpl   $0x0,-0x8(%rbp)
jne    1200 <main+0xd0>
mov    -0x8(%rbp),%esi
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    124f <main+0x11f>
jmp    1205 <main+0xd5>
cmpl   $0x0,-0x8(%rbp)
je     1241 <main+0x111>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xdf1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1205 <main+0xd5>
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1254 <main+0x124>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xebc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
js     11ee <main+0xae>
je     125d <main+0x11d>
lea    0xe96(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movslq %eax,%rsi
imul   $0x66666667,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movslq 0x4(%rsp),%rcx
imul   $0x66666667,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rax
add    %edx,%eax
mov    %eax,0x4(%rsp)
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1190 <main+0x50>
lea    0xe59(%rip),%rdi
call   1040 <puts@plt>
jmp    126d <main+0x12d>
mov    %eax,%esi
neg    %esi
mov    %esi,0x4(%rsp)
cmp    $0xfffffff5,%eax
ja     124e <main+0x10e>
mov    $0xcccccccd,%r14d
lea    0xe10(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %esi,%eax
imul   %r14,%rax
shr    $0x23,%rax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <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    $0x6d,%rax
jg     1210 <main+0xd0>
neg    %esi
mov    %esi,0x4(%rsp)
lea    0xdc1(%rip),%rdi
jmp    1266 <main+0x126>
lea    0xdb8(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [21 x i8] c"\0AEnter an integer > \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@.str.4 = [33 x i8] c"%d\0AThat's all, have a nice day!\0A\00"
@str = [29 x i8] c"That'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 ([21 x i8], [21 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 = call i32 @putchar(i32 10)
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %22
8: ; preds = %0
%9 = sub nsw i32 0, %6
store i32 %9, i32* %1
%10 = icmp ult i32 %6, -10
br i1 %10, label %11, label %18
11: ; preds = %8, %11
%12 = phi i32 [ %16, %11 ], [ %9, %8 ]
%13 = urem i32 %12, 10
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %1
%16 = sdiv i32 %15, 10
store i32 %16, i32* %1
%17 = icmp sgt i32 %15, 109
br i1 %17, label %11, label %18
18: ; preds = %11, %8
%19 = phi i32 [ %9, %8 ], [ %16, %11 ]
%20 = sub nsw i32 0, %19
store i32 %20, i32* %1
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 %20)
br label %36
22: ; preds = %0
%23 = icmp eq i32 %6, 0
br i1 %23, label %24, label %26
24: ; preds = %22
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 0)
br label %36
26: ; preds = %22, %26
%27 = phi i32 [ %31, %26 ], [ %6, %22 ]
%28 = srem i32 %27, 10
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %1
%31 = sdiv i32 %30, 10
store i32 %31, i32* %1
%32 = add i32 %30, 9
%33 = icmp ult i32 %32, 19
br i1 %33, label %34, label %26
34: ; preds = %26
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
br label %36
36: ; preds = %24, %34, %18
ret i32 0
}