#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*/ ft_putchar(size_t);
void ft_putnbr_base(size_t n, size_t base) {
  if (n >= base) {
    ft_putnbr_base(n / base, base);
    ft_putnbr_base(n % base, base);
  } else {
    if (n < 10)
      ft_putchar(n + '0');
    else
      ft_putchar(n - 10 + 'a');
  }
}


x86 assembly (clang, -O0):
<ft_putnbr_base>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jb     1173 <ft_putnbr_base+0x53>
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
mov    %rax,%rdi
mov    -0x10(%rbp),%rsi
call   1040 <ft_putnbr_base@plt>
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
mov    %rdx,%rdi
mov    -0x10(%rbp),%rsi
call   1040 <ft_putnbr_base@plt>
jmp    11a6 <ft_putnbr_base+0x86>
cmpq   $0xa,-0x8(%rbp)
jae    1190 <ft_putnbr_base+0x70>
mov    -0x8(%rbp),%rdi
add    $0x30,%rdi
call   1030 <ft_putchar@plt>
jmp    11a1 <ft_putnbr_base+0x81>
mov    -0x8(%rbp),%rdi
sub    $0xa,%rdi
add    $0x61,%rdi
call   1030 <ft_putchar@plt>
jmp    11a6 <ft_putnbr_base+0x86>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putnbr_base>:
push   %rbx
mov    %rdi,%rbx
cmp    %rsi,%rdi
jb     1152 <ft_putnbr_base+0x32>
mov    %rbx,%rax
or     %rsi,%rax
shr    $0x20,%rax
je     1142 <ft_putnbr_base+0x22>
mov    %rbx,%rax
xor    %edx,%edx
div    %rsi
mov    %rdx,%rbx
jmp    114a <ft_putnbr_base+0x2a>
mov    %ebx,%eax
xor    %edx,%edx
div    %esi
mov    %edx,%ebx
mov    %rax,%rdi
call   1040 <ft_putnbr_base@plt>
lea    0x57(%rbx),%rdi
lea    0x30(%rbx),%rax
cmp    $0xa,%rbx
cmovb  %rax,%rdi
pop    %rbx
jmp    1030 <ft_putchar@plt>

LLVM IR (-O0):
define void @ft_putnbr_base(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp uge i64 %5, %6
br i1 %7, label %8, label %17
8: ; preds = %2
%9 = load i64, i64* %3
%10 = load i64, i64* %4
%11 = udiv i64 %9, %10
%12 = load i64, i64* %4
%13 = load i64, i64* %3
%14 = load i64, i64* %4
%15 = urem i64 %13, %14
%16 = load i64, i64* %4
br label %30
17: ; preds = %2
%18 = load i64, i64* %3
%19 = icmp ult i64 %18, 10
br i1 %19, label %20, label %24
20: ; preds = %17
%21 = load i64, i64* %3
%22 = add i64 %21, 48
%23 = call i32 @ft_putchar(i64 %22)
br label %29
24: ; preds = %17
%25 = load i64, i64* %3
%26 = sub i64 %25, 10
%27 = add i64 %26, 97
%28 = call i32 @ft_putchar(i64 %27)
br label %29
29: ; preds = %24, %20
br label %30
30: ; preds = %29, %8
ret void
}

LLVM IR (-O2):
define void @ft_putnbr_base(i64 %0, i64 %1) {
%3 = icmp ult i64 %0, %1
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = udiv i64 %0, %1
tail call void @ft_putnbr_base(i64 %5, i64 %1)
%6 = urem i64 %0, %1
br label %7
7: ; preds = %4, %2
%8 = phi i64 [ %0, %2 ], [ %6, %4 ]
%9 = icmp ult i64 %8, 10
%10 = select i1 %9, i64 48, i64 87
%11 = add i64 %8, %10
%12 = tail call i32 @ft_putchar(i64 %11)
ret void
}