#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 X, Num, NewNum;
  printf("Enter an integer > \n");
  scanf("%d", &Num);
  while (Num) {
    X = Num % 10;
    NewNum = (Num - X) / 10.0;
    if (abs(Num) >= 10) {
      printf("%d\n", abs(X));
    }
    if (abs(Num) < 10) {
      printf("%d\n", X);
    }
    Num = NewNum;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec9(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
je     11e8 <main+0xb8>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xe79(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <abs@plt>
cmp    $0xa,%eax
jl     11bb <main+0x8b>
mov    -0x8(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,%esi
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%edi
call   1030 <abs@plt>
cmp    $0xa,%eax
jge    11dd <main+0xad>
mov    -0x8(%rbp),%esi
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    115d <main+0x2d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
lea    0xebf(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
je     11ed <main+0xbd>
lea    0xea5(%rip),%rbx
jmp    118a <main+0x5a>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cvttsd2si 0x10(%rsp),%eax
mov    %eax,0xc(%rsp)
test   %eax,%eax
je     11ed <main+0xbd>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
mov    %eax,%ebp
sub    %ecx,%ebp
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
divsd  0xe48(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %eax,%ecx
neg    %ecx
cmovs  %eax,%ecx
cmp    $0xa,%ecx
jb     1170 <main+0x40>
mov    %ebp,%esi
neg    %esi
cmovs  %ebp,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%eax
mov    %eax,%ecx
neg    %ecx
cmovs  %eax,%ecx
cmp    $0x9,%ecx
jbe    1170 <main+0x40>
jmp    117c <main+0x4c>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Enter an integer > \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
br label %7
7: ; preds = %33, %0
%8 = load i32, i32* %3
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %35
10: ; preds = %7
%11 = load i32, i32* %3
%12 = srem i32 %11, 10
store i32 %12, i32* %2
%13 = load i32, i32* %3
%14 = load i32, i32* %2
%15 = sub nsw i32 %13, %14
%16 = sitofp i32 %15 to double
%17 = fdiv double %16, 1.000000e+01
%18 = fptosi double %17 to i32
store i32 %18, i32* %4
%19 = load i32, i32* %3
%20 = call i32 @abs(i32 %19)
%21 = icmp sge i32 %20, 10
br i1 %21, label %22, label %26
22: ; preds = %10
%23 = load i32, i32* %2
%24 = call i32 @abs(i32 %23)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %22, %10
%27 = load i32, i32* %3
%28 = call i32 @abs(i32 %27)
%29 = icmp slt i32 %28, 10
br i1 %29, label %30, label %33
30: ; preds = %26
%31 = load i32, i32* %2
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %31)
br label %33
33: ; preds = %30, %26
%34 = load i32, i32* %4
store i32 %34, i32* %3
br label %7
35: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@str = [20 x i8] c"Enter an integer > \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(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 = load i32, i32* %1
%6 = icmp eq i32 %5, 0
br i1 %6, label %26, label %7
7: ; preds = %0, %24
%8 = phi i32 [ %13, %24 ], [ %5, %0 ]
%9 = srem i32 %8, 10
%10 = sub nsw i32 %8, %9
%11 = sitofp i32 %10 to double
%12 = fdiv double %11, 1.000000e+01
%13 = fptosi double %12 to i32
%14 = call i32 @llvm.abs.i32(i32 %8, i1 true)
%15 = icmp ugt i32 %14, 9
br i1 %15, label %16, label %22
16: ; preds = %7
%17 = call i32 @llvm.abs.i32(i32 %9, i1 true)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %1
%20 = call i32 @llvm.abs.i32(i32 %19, i1 true)
%21 = icmp ult i32 %20, 10
br i1 %21, label %22, label %24
22: ; preds = %7, %16
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %9)
br label %24
24: ; preds = %22, %16
store i32 %13, i32* %1
%25 = icmp eq i32 %13, 0
br i1 %25, label %26, label %7
26: ; preds = %24, %0
ret i32 0
}