#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 - rem) / 10;
    }
    number = number - 2 * number;
    printf("%d\nThat's all, have a nice day!\n", number);
  } else {
    while (number != 0) {
      rem = number % 10;
      printf("%d\n", rem);
      number = (number - rem) / 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    11e3 <main+0xb3>
mov    -0x8(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jle    11bf <main+0x8f>
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
sub    -0xc(%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    0xe45(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1235 <main+0x105>
jmp    11e8 <main+0xb8>
cmpl   $0x0,-0x8(%rbp)
je     1227 <main+0xf7>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    11e8 <main+0xb8>
lea    0xdf1(%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   %rbx
sub    $0x10,%rsp
lea    0xeb0(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
js     11f1 <main+0xb1>
je     11e3 <main+0xa3>
lea    0xe95(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movslq %eax,%rbx
imul   $0x66666667,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%eax
sub    %ebx,%eax
movslq %eax,%rcx
imul   $0x66666667,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rax
add    %edx,%eax
mov    %eax,0xc(%rsp)
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1190 <main+0x50>
lea    0xe53(%rip),%rdi
call   1040 <puts@plt>
jmp    1268 <main+0x128>
mov    %eax,%ebx
neg    %ebx
mov    %ebx,0xc(%rsp)
cmp    $0xfffffff5,%eax
ja     1252 <main+0x112>
mov    $0xcccccccd,%r15d
lea    0xe0d(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %ebx,%eax
imul   %r15,%rax
shr    $0x23,%rax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%eax
sub    %ebx,%eax
cltq
imul   $0x66666667,%rax,%rbx
mov    %rbx,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rbx
add    %ecx,%ebx
mov    %ebx,0xc(%rsp)
cmp    $0x6d,%eax
jg     1210 <main+0xd0>
neg    %ebx
mov    %ebx,0xc(%rsp)
lea    0xdbd(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
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 = [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 %31
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 %24
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 = load i32, i32* %3
%22 = sub nsw i32 %20, %21
%23 = sdiv i32 %22, 10
store i32 %23, i32* %2
br label %12
24: ; preds = %12
%25 = load i32, i32* %2
%26 = load i32, i32* %2
%27 = mul nsw i32 2, %26
%28 = sub nsw i32 %25, %27
store i32 %28, i32* %2
%29 = load i32, i32* %2
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 %29)
br label %46
31: ; preds = %0
br label %32
32: ; preds = %35, %31
%33 = load i32, i32* %2
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %44
35: ; preds = %32
%36 = load i32, i32* %2
%37 = srem i32 %36, 10
store i32 %37, i32* %3
%38 = load i32, i32* %3
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %2
%41 = load i32, i32* %3
%42 = sub nsw i32 %40, %41
%43 = sdiv i32 %42, 10
store i32 %43, i32* %2
br label %32
44: ; preds = %32
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
br label %46
46: ; preds = %44, %24
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 %10, label %8
8: ; preds = %0
%9 = icmp eq i32 %6, 0
br i1 %9, label %34, label %25
10: ; preds = %0
%11 = sub nsw i32 0, %6
store i32 %11, i32* %1
%12 = icmp ult i32 %6, -10
br i1 %12, label %13, label %21
13: ; preds = %10, %13
%14 = phi i32 [ %19, %13 ], [ %11, %10 ]
%15 = urem i32 %14, 10
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %15)
%17 = load i32, i32* %1
%18 = sub nsw i32 %17, %15
%19 = sdiv i32 %18, 10
store i32 %19, i32* %1
%20 = icmp sgt i32 %18, 109
br i1 %20, label %13, label %21
21: ; preds = %13, %10
%22 = phi i32 [ %11, %10 ], [ %19, %13 ]
%23 = sub nsw i32 0, %22
store i32 %23, i32* %1
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 %23)
br label %36
25: ; preds = %8, %25
%26 = phi i32 [ %31, %25 ], [ %6, %8 ]
%27 = srem i32 %26, 10
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %1
%30 = sub nsw i32 %29, %27
%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 %25
34: ; preds = %25, %8
%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 = %34, %21
ret i32 0
}