#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;
  while (num != 0) {
    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);
  }
}


x86 assembly (clang, -O0):
<listnum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     11a8 <listnum+0x88>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <fabs@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <fabs@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xa,-0x10(%rbp)
jge    1177 <listnum+0x57>
mov    -0xc(%rbp),%esi
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
jmp    1195 <listnum+0x75>
cmpl   $0xa,-0x10(%rbp)
jl     1190 <listnum+0x70>
mov    -0x14(%rbp),%esi
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
jmp    1195 <listnum+0x75>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    112b <listnum+0xb>
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>
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* %3
br label %7
7: ; preds = %29, %1
%8 = load i32, i32* %3
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %32
10: ; preds = %7
%11 = load i32, i32* %3
%12 = srem i32 %11, 10
store i32 %12, i32* %4
%13 = load i32, i32* %3
%14 = call i32 @fabs(i32 %13)
store i32 %14, i32* %5
%15 = load i32, i32* %4
%16 = call i32 @fabs(i32 %15)
store i32 %16, i32* %6
%17 = load i32, i32* %5
%18 = icmp slt i32 %17, 10
br i1 %18, label %19, label %22
19: ; preds = %10
%20 = load i32, i32* %4
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %20)
br label %29
22: ; preds = %10
%23 = load i32, i32* %5
%24 = icmp sge i32 %23, 10
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = load i32, i32* %6
%27 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %25, %22
br label %29
29: ; preds = %28, %19
%30 = load i32, i32* %3
%31 = sdiv i32 %30, 10
store i32 %31, i32* %3
br label %7
32: ; preds = %7
%33 = load i32, i32* %2
ret i32 %33
}

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 undef
}