#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*/ digit_to_char_strange_4(int);
int /*<<< orphan*/ strcat(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
void convert_base_4_to_base_4_strange_internal(int num, char *result) {
  if (num < 10 && num >= 0) {
    strcpy(result, digit_to_char_strange_4(num));
    return;
  }
  convert_base_4_to_base_4_strange_internal(num / 10, result);
  strcat(result, digit_to_char_strange_4(num % 10));
}


x86 assembly (clang, -O0):
<convert_base_4_to_base_4_strange_internal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    1183 <convert_base_4_to_base_4_strange_internal+0x43>
cmpl   $0x0,-0x4(%rbp)
jl     1183 <convert_base_4_to_base_4_strange_internal+0x43>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <digit_to_char_strange_4@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
jmp    11be <convert_base_4_to_base_4_strange_internal+0x7e>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
call   1060 <convert_base_4_to_base_4_strange_internal@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1040 <digit_to_char_strange_4@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1050 <strcat@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_base_4_to_base_4_strange_internal>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
cmp    $0x9,%edi
ja     1163 <convert_base_4_to_base_4_strange_internal+0x23>
mov    %ebp,%edi
call   1040 <digit_to_char_strange_4@plt>
mov    %r14,%rdi
mov    %eax,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <strcpy@plt>
movslq %ebp,%rax
imul   $0x66666667,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x22,%rbx
add    %eax,%ebx
mov    %ebx,%edi
mov    %r14,%rsi
call   1060 <convert_base_4_to_base_4_strange_internal@plt>
add    %ebx,%ebx
lea    (%rbx,%rbx,4),%eax
sub    %eax,%ebp
mov    %ebp,%edi
call   1040 <digit_to_char_strange_4@plt>
mov    %r14,%rdi
mov    %eax,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <strcat@plt>

LLVM IR (-O0):
define void @convert_base_4_to_base_4_strange_internal(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %15
7: ; preds = %2
%8 = load i32, i32* %3
%9 = icmp sge i32 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %7
%11 = load i8*, i8** %4
%12 = load i32, i32* %3
%13 = call i32 @digit_to_char_strange_4(i32 %12)
%14 = call i32 @strcpy(i8* %11, i32 %13)
br label %24
15: ; preds = %7, %2
%16 = load i32, i32* %3
%17 = sdiv i32 %16, 10
%18 = load i8*, i8** %4
%19 = load i8*, i8** %4
%20 = load i32, i32* %3
%21 = srem i32 %20, 10
%22 = call i32 @digit_to_char_strange_4(i32 %21)
%23 = call i32 @strcat(i8* %19, i32 %22)
br label %24
24: ; preds = %15, %10
ret void
}

LLVM IR (-O2):
define void @convert_base_4_to_base_4_strange_internal(i32 %0, i8* %1) {
%3 = icmp ult i32 %0, 10
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = tail call i32 @digit_to_char_strange_4(i32 %0)
%6 = tail call i32 @strcpy(i8* %1, i32 %5)
br label %7
7: ; preds = %4, %8
ret void
8: ; preds = %2
%9 = sdiv i32 %0, 10
tail call void @convert_base_4_to_base_4_strange_internal(i32 %9, i8* %1)
%10 = srem i32 %0, 10
%11 = tail call i32 @digit_to_char_strange_4(i32 %10)
%12 = tail call i32 @strcat(i8* %1, i32 %11)
br label %7
}