#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*/ abs(int);
int floor(int /*<<< orphan*/);
int /*<<< orphan*/ log10(int /*<<< orphan*/);
scalar_t__ pow(int, int);
int /*<<< orphan*/ printf(char *, int);
void parImpar(int num) {
  int digitos = floor(log10(abs(num))) + 1;
  for (int i = digitos - 1; i >= 0; i--) {
    int div = num / (int)pow(10, i);
    num = num % (int)pow(10, i);
    printf(div % 2 == 0 ? "\n%d eh Par" : "\n%d eh Impar", div);
  }
}


x86 assembly (clang, -O0):
<parImpar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,%edi
call   1060 <log10@plt>
mov    %eax,%edi
call   1070 <floor@plt>
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     11fe <parImpar+0xae>
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%esi
mov    $0xa,%edi
call   1050 <pow@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%esi
mov    $0xa,%edi
call   1050 <pow@plt>
mov    %rax,%rcx
mov    -0x14(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
lea    0xe31(%rip),%rdi
lea    0xe1f(%rip),%rax
cmp    $0x0,%edx
cmove  %rax,%rdi
mov    -0x10(%rbp),%esi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1180 <parImpar+0x30>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parImpar>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edi,%r14d
neg    %edi
cmovs  %r14d,%edi
call   1050 <log10@plt>
mov    %eax,%edi
call   1060 <floor@plt>
test   %eax,%eax
js     11c5 <parImpar+0x85>
mov    %eax,%ebp
lea    0xe96(%rip),%r15
lea    0xe9a(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
mov    %ebp,%esi
call   1040 <pow@plt>
mov    %rax,%rcx
mov    %r14d,%eax
cltd
idiv   %ecx
mov    %eax,%ebx
mov    $0xa,%edi
mov    %ebp,%esi
call   1040 <pow@plt>
mov    %rax,%rcx
mov    %r14d,%eax
cltd
idiv   %ecx
test   $0x1,%bl
mov    %r12,%rdi
cmove  %r15,%rdi
mov    %edx,%r14d
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0xffffffff,%ebp
jb     1180 <parImpar+0x40>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [11 x i8] c"\0A%d eh Par\00"
@.str.1 = [13 x i8] c"\0A%d eh Impar\00"
define void @parImpar(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%3 = tail call i32 @log10(i32 %2)
%4 = tail call i32 @floor(i32 %3)
%5 = icmp sgt i32 %4, -1
br i1 %5, label %7, label %6
6: ; preds = %7, %1
ret void
7: ; preds = %1, %7
%8 = phi i32 [ %15, %7 ], [ %0, %1 ]
%9 = phi i32 [ %20, %7 ], [ %4, %1 ]
%10 = tail call i64 @pow(i32 10, i32 %9)
%11 = trunc i64 %10 to i32
%12 = sdiv i32 %8, %11
%13 = tail call i64 @pow(i32 10, i32 %9)
%14 = trunc i64 %13 to i32
%15 = srem i32 %8, %14
%16 = and i32 %12, 1
%17 = icmp eq i32 %16, 0
%18 = select i1 %17, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0)
%19 = tail call i32 @printf(i8* %18, i32 %12)
%20 = add nsw i32 %9, -1
%21 = icmp eq i32 %9, 0
br i1 %21, label %6, label %7
}