#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 x, a, b, c, y;
  printf("Enter an integer > ");
  scanf(" %d", &b);
  a = b / 10;
  c = b % 10;
  if (c > 0) {
    printf("\n%d\n", c);
  } else if (c < 0) {
    y = c * (-1);
    printf("%d\n", y);
  }
  if (a > 0 && a < 10) {
    printf("%d\nThat's all, have a nice day!\n", a);
    return 0;
  }
  if (a > 0) {
    while (a > 0) {
      x = a % 10;
      a = a / 10;
      printf("%d\n", x);
      if (a < 10) {
        printf("%d\nThat's all, have a nice day!\n", a);
        return 0;
      }
    }
  } else if (a < 0) {
    a = a * (-1);
    while (a > 0) {
      x = a % 10;
      a = a / 10;
      printf("%d\n", x);
      if (a < 10) {
        a = a * (-1);
        printf("%d\nThat's all, have a nice day!\n", a);
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1189 <main+0x69>
mov    -0x14(%rbp),%esi
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b0 <main+0x90>
cmpl   $0x0,-0x14(%rbp)
jge    11ab <main+0x8b>
imul   $0xffffffff,-0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b0 <main+0x90>
cmpl   $0x0,-0xc(%rbp)
jle    11e1 <main+0xc1>
cmpl   $0xa,-0xc(%rbp)
jge    11e1 <main+0xc1>
mov    -0xc(%rbp),%esi
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12d8 <main+0x1b8>
cmpl   $0x0,-0xc(%rbp)
jle    1258 <main+0x138>
jmp    11f0 <main+0xd0>
cmpl   $0x0,-0xc(%rbp)
jle    1253 <main+0x133>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0xa,-0xc(%rbp)
jge    124e <main+0x12e>
mov    -0xc(%rbp),%esi
lea    0xde2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12d8 <main+0x1b8>
jmp    11f0 <main+0xd0>
jmp    12d1 <main+0x1b1>
cmpl   $0x0,-0xc(%rbp)
jge    12cc <main+0x1ac>
imul   $0xffffffff,-0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    12c7 <main+0x1a7>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
lea    0xd80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0xa,-0xc(%rbp)
jge    12c2 <main+0x1a2>
imul   $0xffffffff,-0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xd62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1269 <main+0x149>
jmp    12cc <main+0x1ac>
jmp    12d1 <main+0x1b1>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xed2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movslq 0x4(%rsp),%r14
imul   $0x66666667,%r14,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x22,%rbx
add    %eax,%ebx
lea    (%rbx,%rbx,1),%eax
lea    (%rax,%rax,4),%eax
mov    %r14d,%esi
sub    %eax,%esi
test   %esi,%esi
jle    117e <main+0x5e>
lea    0xea3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1184 <main+0x64>
js     1234 <main+0x114>
lea    -0xa(%r14),%eax
cmp    $0x5a,%eax
jb     1217 <main+0xf7>
cmp    $0xa,%r14d
jl     11d4 <main+0xb4>
lea    0xe7b(%rip),%r14
xchg   %ax,%ax
movslq %ebx,%r15
imul   $0x66666667,%r15,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x22,%rbx
add    %eax,%ebx
lea    (%rbx,%rbx,1),%eax
lea    (%rax,%rax,4),%eax
mov    %r15d,%esi
sub    %eax,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0x64,%r15d
jge    11a0 <main+0x80>
jmp    1217 <main+0xf7>
cmp    $0xfffffff6,%r14d
jg     1227 <main+0x107>
neg    %ebx
mov    $0xcccccccd,%r15d
lea    0xe30(%rip),%r14
nopl   0x0(%rax)
mov    %ebx,%ebp
mov    %ebx,%ebx
imul   %r15,%rbx
shr    $0x23,%rbx
lea    (%rbx,%rbx,1),%eax
lea    (%rax,%rax,4),%eax
mov    %ebp,%esi
sub    %eax,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0x63,%ebp
ja     11f0 <main+0xd0>
neg    %ebx
lea    0xdff(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
neg    %esi
lea    0xddc(%rip),%rdi
jmp    1175 <main+0x55>

LLVM IR (-O0):
@.str = [20 x i8] c"Enter an integer > \00"
@.str.1 = [4 x i8] c" %d\00"
@.str.2 = [5 x i8] c"\0A%d\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"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%9 = load i32, i32* %4
%10 = sdiv i32 %9, 10
store i32 %10, i32* %3
%11 = load i32, i32* %4
%12 = srem i32 %11, 10
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %0
%16 = load i32, i32* %5
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %16)
br label %27
18: ; preds = %0
%19 = load i32, i32* %5
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %26
21: ; preds = %18
%22 = load i32, i32* %5
%23 = mul nsw i32 %22, -1
store i32 %23, i32* %6
%24 = load i32, i32* %6
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %21, %18
br label %27
27: ; preds = %26, %15
%28 = load i32, i32* %3
%29 = icmp sgt i32 %28, 0
br i1 %29, label %30, label %36
30: ; preds = %27
%31 = load i32, i32* %3
%32 = icmp slt i32 %31, 10
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = load i32, i32* %3
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 %34)
store i32 0, i32* %1
br label %84
36: ; preds = %30, %27
%37 = load i32, i32* %3
%38 = icmp sgt i32 %37, 0
br i1 %38, label %39, label %57
39: ; preds = %36
br label %40
40: ; preds = %55, %39
%41 = load i32, i32* %3
%42 = icmp sgt i32 %41, 0
br i1 %42, label %43, label %56
43: ; preds = %40
%44 = load i32, i32* %3
%45 = srem i32 %44, 10
store i32 %45, i32* %2
%46 = load i32, i32* %3
%47 = sdiv i32 %46, 10
store i32 %47, i32* %3
%48 = load i32, i32* %2
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %48)
%50 = load i32, i32* %3
%51 = icmp slt i32 %50, 10
br i1 %51, label %52, label %55
52: ; preds = %43
%53 = load i32, i32* %3
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 %53)
store i32 0, i32* %1
br label %84
55: ; preds = %43
br label %40
56: ; preds = %40
br label %83
57: ; preds = %36
%58 = load i32, i32* %3
%59 = icmp slt i32 %58, 0
br i1 %59, label %60, label %82
60: ; preds = %57
%61 = load i32, i32* %3
%62 = mul nsw i32 %61, -1
store i32 %62, i32* %3
br label %63
63: ; preds = %80, %60
%64 = load i32, i32* %3
%65 = icmp sgt i32 %64, 0
br i1 %65, label %66, label %81
66: ; preds = %63
%67 = load i32, i32* %3
%68 = srem i32 %67, 10
store i32 %68, i32* %2
%69 = load i32, i32* %3
%70 = sdiv i32 %69, 10
store i32 %70, i32* %3
%71 = load i32, i32* %2
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %71)
%73 = load i32, i32* %3
%74 = icmp slt i32 %73, 10
br i1 %74, label %75, label %80
75: ; preds = %66
%76 = load i32, i32* %3
%77 = mul nsw i32 %76, -1
store i32 %77, i32* %3
%78 = load i32, i32* %3
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 %78)
br label %80
80: ; preds = %75, %66
br label %63
81: ; preds = %63
br label %82
82: ; preds = %81, %57
br label %83
83: ; preds = %82, %56
store i32 0, i32* %1
br label %84
84: ; preds = %83, %52, %33
%85 = load i32, i32* %1
ret i32 %85
}

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