#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 number = 0, i = 0, store = 0, state = 1;
  printf("\nEnter an integer > ");
  scanf("%d", &number);
  printf("\n");
  while (i < 9) {
    if (number < 0) {
      number = number * -1;
      state = -1;
    }
    store = number % 10;
    if (number <= 9) {
      store = number * state;
    }
    printf("%d\n", store);
    number = number / 10;
    i++;
    if (number == 0) {
      printf("That's all, have a nice day!\n");
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x9,-0xc(%rbp)
jge    1205 <main+0xe5>
cmpl   $0x0,-0x8(%rbp)
jge    1199 <main+0x79>
imul   $0xffffffff,-0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0xffffffff,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
cmpl   $0x9,-0x8(%rbp)
jg     11bb <main+0x9b>
mov    -0x8(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1200 <main+0xe0>
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1205 <main+0xe5>
jmp    1177 <main+0x57>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xeaa(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb1(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    $0xa,%ebp
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%ebx
lea    0xe8f(%rip),%r15
mov    $0xcccccccd,%r14d
jmp    11e0 <main+0xa0>
cs nopw 0x0(%rax,%rax,1)
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    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movslq 0x4(%rsp),%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
mov    %ecx,0x4(%rsp)
add    $0x9,%eax
cmp    $0x12,%eax
jbe    1215 <main+0xd5>
add    $0xffffffff,%ebp
je     1221 <main+0xe1>
mov    0x4(%rsp),%esi
test   %esi,%esi
js     1200 <main+0xc0>
cmp    $0xa,%esi
jae    11a0 <main+0x60>
jmp    1210 <main+0xd0>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
neg    %esi
mov    %esi,0x4(%rsp)
mov    $0xffffffff,%ebx
cmp    $0xa,%esi
jae    11a0 <main+0x60>
imul   %ebx,%esi
jmp    11b1 <main+0x71>
lea    0xe00(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
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 = [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
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 1, i32* %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %9
9: ; preds = %38, %0
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 9
br i1 %11, label %12, label %39
12: ; preds = %9
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i32, i32* %2
%17 = mul nsw i32 %16, -1
store i32 %17, i32* %2
store i32 -1, i32* %5
br label %18
18: ; preds = %15, %12
%19 = load i32, i32* %2
%20 = srem i32 %19, 10
store i32 %20, i32* %4
%21 = load i32, i32* %2
%22 = icmp sle i32 %21, 9
br i1 %22, label %23, label %27
23: ; preds = %18
%24 = load i32, i32* %2
%25 = load i32, i32* %5
%26 = mul nsw i32 %24, %25
store i32 %26, i32* %4
br label %27
27: ; preds = %23, %18
%28 = load i32, i32* %4
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %2
%31 = sdiv i32 %30, 10
store i32 %31, i32* %2
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
%34 = load i32, i32* %2
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %27
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
br label %39
38: ; preds = %27
br label %9
39: ; preds = %36, %9
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 = [29 x i8] c"That's all, have a nice day!\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%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)
br label %6
6: ; preds = %15, %0
%7 = phi i32 [ 0, %0 ], [ %25, %15 ]
%8 = phi i32 [ 1, %0 ], [ %17, %15 ]
%9 = icmp eq i32 %7, 9
br i1 %9, label %30, label %10
10: ; preds = %6
%11 = load i32, i32* %1
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = sub nsw i32 0, %11
store i32 %14, i32* %1
br label %15
15: ; preds = %13, %10
%16 = phi i32 [ %14, %13 ], [ %11, %10 ]
%17 = phi i32 [ -1, %13 ], [ %8, %10 ]
%18 = urem i32 %16, 10
%19 = icmp ult i32 %16, 10
%20 = mul nsw i32 %16, %17
%21 = select i1 %19, i32 %20, i32 %18
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %1
%24 = sdiv i32 %23, 10
store i32 %24, i32* %1
%25 = add nuw nsw i32 %7, 1
%26 = add i32 %23, 9
%27 = icmp ult i32 %26, 19
br i1 %27, label %28, label %6
28: ; preds = %15
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
br label %30
30: ; preds = %6, %28
ret i32 0
}