#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 fabs(int);
int /*<<< orphan*/ printf(char *, int);
int listnum(int num) {
  int dx, numcheck, dxy, x;
  x = 0;
  while (num != 0) {
    x = x + 1;
    dx = num % 10;
    numcheck = fabs(num);
    dxy = fabs(dx);
    if (numcheck < 10) {
      printf("\n%d", dx);
    } else if (numcheck >= 10) {
      printf("\n%d", dxy);
    }
    num = (num / 10);
  }
  return num;
}


x86 assembly (clang, -O0):
<listnum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     11b8 <listnum+0x98>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <fabs@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <fabs@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1187 <listnum+0x67>
mov    -0x8(%rbp),%esi
lea    0xe83(%rip),%rdi
call   1030 <printf@plt>
jmp    11a5 <listnum+0x85>
cmpl   $0xa,-0xc(%rbp)
jl     11a0 <listnum+0x80>
mov    -0x10(%rbp),%esi
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
jmp    11a5 <listnum+0x85>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    1132 <listnum+0x12>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<listnum>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edi,%edi
je     118e <listnum+0x6e>
mov    %edi,%ebx
lea    0xecb(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
call   1040 <fabs@plt>
mov    %eax,%r15d
movslq %ebx,%r12
imul   $0x66666667,%r12,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x22,%rbx
add    %eax,%ebx
lea    (%rbx,%rbx,1),%eax
lea    (%rax,%rax,4),%eax
mov    %r12d,%ebp
sub    %eax,%ebp
mov    %ebp,%edi
call   1040 <fabs@plt>
cmp    $0xa,%r15d
cmovge %eax,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
add    $0x9,%r12d
cmp    $0x12,%r12d
ja     1140 <listnum+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"\0A%d\00"
define i32 @listnum(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %14, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %11, %3 ], [ %0, %1 ]
%5 = srem i32 %4, 10
%6 = tail call i32 @fabs(i32 %4)
%7 = tail call i32 @fabs(i32 %5)
%8 = icmp slt i32 %6, 10
%9 = select i1 %8, i32 %5, i32 %7
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = sdiv i32 %4, 10
%12 = add i32 %4, 9
%13 = icmp ult i32 %12, 19
br i1 %13, label %14, label %3
14: ; preds = %3, %1
ret i32 0
}