#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 */
scalar_t__ char_to_str(int /*<<< orphan*/);
int /*<<< orphan*/ my_putnbr_base(unsigned int, int, int);
char *my_select_dict(int);
char *my_strcat(int /*<<< orphan*/, scalar_t__);
int /*<<< orphan*/ str_to_char(char *);
char *my_put_big_nbr_base(unsigned int nbr, int base, int dict) {
  char *nbr_convert;
  char *tab_base = my_select_dict(dict);
  if (nbr < base) {
    return (char *)char_to_str(str_to_char(tab_base + nbr));
  } else {
    nbr_convert = my_strcat(my_putnbr_base(nbr / base, base, dict),
                            char_to_str(str_to_char(tab_base + (nbr % base))));
    return (char *)nbr_convert;
  }
}


x86 assembly (clang, -O0):
<my_put_big_nbr_base>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <my_select_dict@plt>
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jae    1198 <my_put_big_nbr_base+0x48>
mov    -0x28(%rbp),%rdi
mov    -0xc(%rbp),%eax
add    %rax,%rdi
call   1060 <str_to_char@plt>
mov    %eax,%edi
call   1070 <char_to_str@plt>
mov    %rax,-0x8(%rbp)
jmp    11e4 <my_put_big_nbr_base+0x94>
mov    -0xc(%rbp),%eax
xor    %edx,%edx
divl   -0x10(%rbp)
mov    %eax,%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <my_putnbr_base@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0xc(%rbp),%eax
xor    %edx,%edx
divl   -0x10(%rbp)
mov    %edx,%eax
add    %rax,%rdi
call   1060 <str_to_char@plt>
mov    %eax,%edi
call   1070 <char_to_str@plt>
mov    -0x2c(%rbp),%edi
mov    %rax,%rsi
call   1050 <my_strcat@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_put_big_nbr_base>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%r15d
mov    %edi,%ebp
mov    %edx,%edi
call   1040 <my_select_dict@plt>
mov    %rax,%rbx
cmp    %r15d,%ebp
jae    118c <my_put_big_nbr_base+0x3c>
mov    %ebp,%eax
add    %rax,%rbx
mov    %rbx,%rdi
call   1060 <str_to_char@plt>
mov    %eax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <char_to_str@plt>
mov    %ebp,%eax
xor    %edx,%edx
div    %r15d
mov    %edx,%ebp
mov    %eax,%edi
mov    %r15d,%esi
mov    %r14d,%edx
call   1030 <my_putnbr_base@plt>
mov    %eax,%r14d
add    %rbp,%rbx
mov    %rbx,%rdi
call   1060 <str_to_char@plt>
mov    %eax,%edi
call   1070 <char_to_str@plt>
mov    %r14d,%edi
mov    %rax,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <my_strcat@plt>

LLVM IR (-O0):
define i8* @my_put_big_nbr_base(i32 %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%10 = load i32, i32* %7
%11 = call i8* @my_select_dict(i32 %10)
store i8* %11, i8** %9
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = icmp ult i32 %12, %13
br i1 %14, label %15, label %23
15: ; preds = %3
%16 = load i8*, i8** %9
%17 = load i32, i32* %5
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = call i32 @str_to_char(i8* %19)
%21 = call i64 @char_to_str(i32 %20)
%22 = inttoptr i64 %21 to i8*
store i8* %22, i8** %4
br label %40
23: ; preds = %3
%24 = load i32, i32* %5
%25 = load i32, i32* %6
%26 = udiv i32 %24, %25
%27 = load i32, i32* %6
%28 = load i32, i32* %7
%29 = call i32 @my_putnbr_base(i32 %26, i32 %27, i32 %28)
%30 = load i8*, i8** %9
%31 = load i32, i32* %5
%32 = load i32, i32* %6
%33 = urem i32 %31, %32
%34 = zext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %30, i64 %34
%36 = call i32 @str_to_char(i8* %35)
%37 = call i64 @char_to_str(i32 %36)
%38 = call i8* @my_strcat(i32 %29, i64 %37)
store i8* %38, i8** %8
%39 = load i8*, i8** %8
store i8* %39, i8** %4
br label %40
40: ; preds = %23, %15
%41 = load i8*, i8** %4
ret i8* %41
}

LLVM IR (-O2):
define i8* @my_put_big_nbr_base(i32 %0, i32 %1, i32 %2) {
%4 = tail call i8* @my_select_dict(i32 %2)
%5 = icmp ult i32 %0, %1
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = zext i32 %0 to i64
%8 = getelementptr inbounds i8, i8* %4, i64 %7
%9 = tail call i32 @str_to_char(i8* %8)
%10 = tail call i64 @char_to_str(i32 %9)
%11 = inttoptr i64 %10 to i8*
br label %21
12: ; preds = %3
%13 = udiv i32 %0, %1
%14 = tail call i32 @my_putnbr_base(i32 %13, i32 %1, i32 %2)
%15 = urem i32 %0, %1
%16 = zext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %4, i64 %16
%18 = tail call i32 @str_to_char(i8* %17)
%19 = tail call i64 @char_to_str(i32 %18)
%20 = tail call i8* @my_strcat(i32 %14, i64 %19)
br label %21
21: ; preds = %12, %6
%22 = phi i8* [ %11, %6 ], [ %20, %12 ]
ret i8* %22
}