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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec2(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jg     1236 <main+0x106>
cmpl   $0x0,-0x10(%rbp)
jne    11a3 <main+0x73>
mov    -0x10(%rbp),%esi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    123d <main+0x10d>
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,%esi
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
cmpl   $0xfffffff6,-0xc(%rbp)
jle    1216 <main+0xe6>
cmpl   $0x0,-0xc(%rbp)
jge    1216 <main+0xe6>
mov    -0xc(%rbp),%esi
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    123d <main+0x10d>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1164 <main+0x34>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec6(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    $0xb,%ebp
mov    0xc(%rsp),%eax
lea    0xeab(%rip),%rbx
nopw   0x0(%rax,%rax,1)
test   %eax,%eax
je     11d2 <main+0xa2>
movslq %eax,%rcx
imul   $0x66666667,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,%esi
neg    %esi
cmovs  %eax,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0xc(%rsp),%rcx
imul   $0x66666667,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rax
add    %edx,%eax
add    $0x63,%ecx
cmp    $0x5a,%ecx
jb     11cf <main+0x9f>
mov    %eax,0xc(%rsp)
add    $0xffffffff,%ebp
jne    1170 <main+0x40>
jmp    11ef <main+0xbf>
mov    %eax,%r14d
lea    0xe3c(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe2f(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
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 = [4 x i8] c"\0A%d\00"
@.str.3 = [31 x i8] c"\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
store i32 0, i32* %1
%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* %4)
store i32 0, i32* %2
br label %8
8: ; preds = %35, %0
%9 = load i32, i32* %2
%10 = icmp sle i32 %9, 10
br i1 %10, label %11, label %41
11: ; preds = %8
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = load i32, i32* %4
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %1
br label %42
18: ; preds = %11
%19 = load i32, i32* %4
%20 = srem i32 %19, 10
store i32 %20, i32* %3
%21 = load i32, i32* %3
%22 = call i32 @abs(i32 %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %4
%25 = sdiv i32 %24, 10
store i32 %25, i32* %3
%26 = load i32, i32* %3
%27 = icmp sgt i32 %26, -10
br i1 %27, label %28, label %35
28: ; preds = %18
%29 = load i32, i32* %3
%30 = icmp slt i32 %29, 0
br i1 %30, label %31, label %35
31: ; preds = %28
%32 = load i32, i32* %3
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %1
br label %42
35: ; preds = %28, %18
%36 = load i32, i32* %3
store i32 %36, i32* %5
%37 = load i32, i32* %4
store i32 %37, i32* %3
%38 = load i32, i32* %5
store i32 %38, i32* %4
%39 = load i32, i32* %2
%40 = add nsw i32 %39, 1
store i32 %40, i32* %2
br label %8
41: ; preds = %8
store i32 0, i32* %1
br label %42
42: ; preds = %41, %31, %14
%43 = load i32, i32* %1
ret i32 %43
}

LLVM IR (-O2):
@.str = [21 x i8] c"\0AEnter an integer > \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"\0A%d\00"
@str.4 = [30 x i8] c"\0AThat'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 = load i32, i32* %1
br label %6
6: ; preds = %0, %18
%7 = phi i32 [ %5, %0 ], [ %15, %18 ]
%8 = phi i32 [ 0, %0 ], [ %19, %18 ]
%9 = icmp eq i32 %7, 0
br i1 %9, label %21, label %10
10: ; preds = %6
%11 = srem i32 %7, 10
%12 = call i32 @llvm.abs.i32(i32 %11, i1 true)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %1
%15 = sdiv i32 %14, 10
%16 = add i32 %14, 99
%17 = icmp ult i32 %16, 90
br i1 %17, label %21, label %18
18: ; preds = %10
store i32 %15, i32* %1
%19 = add nuw nsw i32 %8, 1
%20 = icmp eq i32 %19, 11
br i1 %20, label %26, label %6
21: ; preds = %10, %6
%22 = phi i32 [ 0, %6 ], [ %15, %10 ]
%23 = phi i8* [ getelementptr inbounds ([30 x i8], [30 x i8]* @str.4, i64 0, i64 0), %6 ], [ getelementptr inbounds ([30 x i8], [30 x i8]* @str.4, i64 0, i64 0), %10 ]
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%25 = call i32 @puts(i8* dereferenceable(1) %23)
br label %26
26: ; preds = %18, %21
ret i32 0
}