#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*/ printf(char *, int);
void num_inverso(int n) {
  while (n / 10 != 0) {
    printf("%d", n % 10);
    n = n / 10;
  }
  printf("%d", n % 10);
}


x86 assembly (clang, -O0):
<num_inverso>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%eax
je     115b <num_inverso+0x4b>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    111b <num_inverso+0xb>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<num_inverso>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edi,%r15d
lea    0x9(%r15),%eax
cmp    $0x13,%eax
jb     1166 <num_inverso+0x56>
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
movslq %r15d,%rsi
imul   $0x66666667,%rsi,%rbx
mov    %rbx,%r12
shr    $0x3f,%r12
sar    $0x22,%rbx
lea    (%rbx,%r12,1),%r15d
lea    (%r15,%r15,1),%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
lea    (%rbx,%r12,1),%eax
add    $0x9,%eax
cmp    $0x12,%eax
ja     1130 <num_inverso+0x20>
movsbl %r15b,%eax
imul   $0x67,%eax,%eax
movzwl %ax,%eax
movswl %ax,%ecx
shr    $0xf,%eax
shr    $0xa,%ecx
add    %al,%cl
movzbl %cl,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %al,%r15b
movsbl %r15b,%esi
lea    0xe6f(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define void @num_inverso(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %7, %1
%4 = load i32, i32* %2
%5 = sdiv i32 %4, 10
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = load i32, i32* %2
%9 = srem i32 %8, 10
%10 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %2
%12 = sdiv i32 %11, 10
store i32 %12, i32* %2
br label %3
13: ; preds = %3
%14 = load i32, i32* %2
%15 = srem i32 %14, 10
%16 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %15)
ret void
}

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