#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 *, char, ...);
void decBase(int num, int base) {
  char tablaConv[] = "0123456789ABCDEF";
  int resto;
  int cociente;
  printf("El resultado de convertir %d a la base %d es:\n", num, base);
  cociente = num / base;
  resto = num % base;
  if (cociente >= (base))
    decBase(cociente, base);
  else
    printf("%c", tablaConv[cociente]);
  printf("%c", tablaConv[resto]);
}


x86 assembly (clang, -O0):
<decBase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec8(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec6(%rip),%al
mov    %al,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%edx
lea    0xeb7(%rip),%rdi
movsbl %al,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,-0x28(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0x24(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     1194 <decBase+0x74>
mov    -0x28(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <decBase@plt>
jmp    11ab <decBase+0x8b>
movslq -0x28(%rbp),%rax
lea    0xea1(%rip),%rdi
movsbl -0x20(%rbp,%rax,1),%esi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x24(%rbp),%rax
lea    0xe8a(%rip),%rdi
movsbl -0x20(%rbp,%rax,1),%esi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decBase>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
movsbl %bl,%esi
lea    0xee0(%rip),%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
cltd
idiv   %ebp
mov    %edx,%ebx
cmp    %ebp,%eax
jge    1162 <decBase+0x42>
cltq
lea    0xeb2(%rip),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xee7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    116b <decBase+0x4b>
mov    %eax,%edi
mov    %ebp,%esi
call   1030 <decBase@plt>
movslq %ebx,%rax
lea    0xe8b(%rip),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xec0(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@__const.decBase.tablaConv = [17 x i8] c"0123456789ABCDEF\00"
@.str = [47 x i8] c"El resultado de convertir %d a la base %d es:\0A\00"
@.str.1 = [3 x i8] c"%c\00"
define void @decBase(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [17 x i8]
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%8 = bitcast [17 x i8]* %5 to i8*
%9 = load i32, i32* %3
%10 = trunc i32 %9 to i8
%11 = load i32, i32* %4
%12 = call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8 signext %10, i32 %11)
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = sdiv i32 %13, %14
store i32 %15, i32* %7
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = srem i32 %16, %17
store i32 %18, i32* %6
%19 = load i32, i32* %7
%20 = load i32, i32* %4
%21 = icmp sge i32 %19, %20
br i1 %21, label %22, label %25
22: ; preds = %2
%23 = load i32, i32* %7
%24 = load i32, i32* %4
br label %31
25: ; preds = %2
%26 = load i32, i32* %7
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [17 x i8], [17 x i8]* %5, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %29)
br label %31
31: ; preds = %25, %22
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [17 x i8], [17 x i8]* %5, i64 0, i64 %33
%35 = load i8, i8* %34
%36 = call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %35)
ret void
}

LLVM IR (-O2):
@__const.decBase.tablaConv = [17 x i8] c"0123456789ABCDEF\00"
@.str = [47 x i8] c"El resultado de convertir %d a la base %d es:\0A\00"
@.str.1 = [3 x i8] c"%c\00"
define void @decBase(i32 %0, i32 %1) {
%3 = trunc i32 %0 to i8
%4 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8 signext %3, i32 %1)
%5 = sdiv i32 %0, %1
%6 = srem i32 %0, %1
%7 = icmp slt i32 %5, %1
br i1 %7, label %9, label %8
8: ; preds = %2
tail call void @decBase(i32 %5, i32 %1)
br label %14
9: ; preds = %2
%10 = sext i32 %5 to i64
%11 = getelementptr inbounds [17 x i8], [17 x i8]* @__const.decBase.tablaConv, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %12)
br label %14
14: ; preds = %9, %8
%15 = sext i32 %6 to i64
%16 = getelementptr inbounds [17 x i8], [17 x i8]* @__const.decBase.tablaConv, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %17)
ret void
}