#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 /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int input, display;
  printf("Enter an integer > ");
  scanf("%d", &input);
  printf("\n");
  if (input < 0) {
    input = input * (-1);
    while ((input / 10) >= 1) {
      display = input % 10;
      printf("%d\n", display);
      input = input / 10;
    }
    printf("-%d\n", input % 10);
    printf("That's all, have a nice day!\n");
    return 0;
  }
  while ((input % 10) >= 1) {
    display = input % 10;
    printf("%d\n", display);
    input = input / 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    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xee4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
jge    11e7 <main+0xc7>
imul   $0xffffffff,-0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x1,%eax
jl     11b2 <main+0x92>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    116c <main+0x4c>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1247 <main+0x127>
jmp    11ec <main+0xcc>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jl     1232 <main+0x112>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    11ec <main+0xcc>
lea    0xde3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%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    0xebb(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
js     11ee <main+0xae>
mov    %esi,%eax
mov    $0xcccccccd,%ecx
imul   %rax,%rcx
shr    $0x23,%rcx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%eax
sub    %eax,%esi
je     127c <main+0x13c>
lea    0xe80(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movslq 0x4(%rsp),%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
mov    %eax,0x4(%rsp)
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
test   %esi,%esi
jg     11a0 <main+0x60>
jmp    127c <main+0x13c>
mov    %esi,%eax
neg    %eax
mov    %eax,0x4(%rsp)
cmp    $0xfffffff6,%esi
ja     1250 <main+0x110>
mov    $0xcccccccd,%r14d
lea    0xe10(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %eax,%ecx
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   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)
cmp    $0x63,%rcx
jg     1210 <main+0xd0>
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
lea    0xda2(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd99(%rip),%rdi
call   1040 <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 = [2 x i8] c"\0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@.str.4 = [5 x i8] c"-%d\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 ([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)
%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 %28
9: ; preds = %0
%10 = load i32, i32* %2
%11 = mul nsw i32 %10, -1
store i32 %11, i32* %2
br label %12
12: ; preds = %16, %9
%13 = load i32, i32* %2
%14 = sdiv i32 %13, 10
%15 = icmp sge i32 %14, 1
br i1 %15, label %16, label %23
16: ; preds = %12
%17 = load i32, i32* %2
%18 = srem i32 %17, 10
store i32 %18, i32* %3
%19 = load i32, i32* %3
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %19)
%21 = load i32, i32* %2
%22 = sdiv i32 %21, 10
store i32 %22, i32* %2
br label %12
23: ; preds = %12
%24 = load i32, i32* %2
%25 = srem i32 %24, 10
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %25)
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %1
br label %42
28: ; preds = %0
br label %29
29: ; preds = %33, %28
%30 = load i32, i32* %2
%31 = srem i32 %30, 10
%32 = icmp sge i32 %31, 1
br i1 %32, label %33, label %40
33: ; preds = %29
%34 = load i32, i32* %2
%35 = srem i32 %34, 10
store i32 %35, i32* %3
%36 = load i32, i32* %3
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %36)
%38 = load i32, i32* %2
%39 = sdiv i32 %38, 10
store i32 %39, i32* %2
br label %29
40: ; preds = %29
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %1
br label %42
42: ; preds = %40, %23
%43 = load i32, i32* %1
ret i32 %43
}

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