#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*/ my_putchar(char);
int my_put_unsigned_int_base(unsigned int ui, int base, int capitalized) {
  if (ui >= (unsigned int)base) {
    my_put_unsigned_int_base(ui / base, base, capitalized);
    my_put_unsigned_int_base(ui % base, base, capitalized);
  } else if (ui <= 9) {
    my_putchar(ui + '0');
  } else {
    my_putchar((capitalized == 1 ? 'A' : 'a') + ui - 10);
  }
  return (0);
}


x86 assembly (clang, -O0):
<my_put_unsigned_int_base>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jb     116c <my_put_unsigned_int_base+0x4c>
mov    -0x4(%rbp),%eax
xor    %edx,%edx
divl   -0x8(%rbp)
mov    %eax,%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <my_put_unsigned_int_base@plt>
mov    -0x4(%rbp),%eax
xor    %edx,%edx
divl   -0x8(%rbp)
mov    %edx,%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <my_put_unsigned_int_base@plt>
jmp    11af <my_put_unsigned_int_base+0x8f>
cmpl   $0x9,-0x4(%rbp)
ja     1189 <my_put_unsigned_int_base+0x69>
mov    -0x4(%rbp),%eax
add    $0x30,%eax
movsbl %al,%edi
call   1040 <my_putchar@plt>
jmp    11aa <my_put_unsigned_int_base+0x8a>
mov    -0xc(%rbp),%edx
mov    $0x61,%eax
mov    $0x41,%ecx
cmp    $0x1,%edx
cmove  %ecx,%eax
add    -0x4(%rbp),%eax
sub    $0xa,%eax
movsbl %al,%edi
call   1040 <my_putchar@plt>
jmp    11af <my_put_unsigned_int_base+0x8f>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_put_unsigned_int_base>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %edi,%ebx
cmp    %esi,%edi
jb     113c <my_put_unsigned_int_base+0x1c>
mov    %ebx,%eax
xor    %edx,%edx
div    %esi
mov    %edx,%ebx
mov    %eax,%edi
mov    %ebp,%edx
call   1030 <my_put_unsigned_int_base@plt>
xor    %eax,%eax
cmp    $0x1,%ebp
setne  %al
shl    $0x5,%eax
or     $0x41,%eax
xor    %ecx,%ecx
cmp    $0xa,%ebx
cmovb  %ecx,%eax
mov    $0x30,%ecx
mov    $0xf6,%edx
cmovb  %ecx,%edx
add    %ebx,%eax
add    %dl,%al
movsbl %al,%edi
call   1040 <my_putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @my_put_unsigned_int_base(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = icmp uge i32 %7, %8
br i1 %9, label %10, label %23
10: ; preds = %3
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = udiv i32 %11, %12
%14 = load i32, i32* %5
%15 = load i32, i32* %6
%16 = call i32 @my_put_unsigned_int_base(i32 %13, i32 %14, i32 %15)
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = urem i32 %17, %18
%20 = load i32, i32* %5
%21 = load i32, i32* %6
%22 = call i32 @my_put_unsigned_int_base(i32 %19, i32 %20, i32 %21)
br label %42
23: ; preds = %3
%24 = load i32, i32* %4
%25 = icmp ule i32 %24, 9
br i1 %25, label %26, label %31
26: ; preds = %23
%27 = load i32, i32* %4
%28 = add i32 %27, 48
%29 = trunc i32 %28 to i8
%30 = call i32 @my_putchar(i8 signext %29)
br label %41
31: ; preds = %23
%32 = load i32, i32* %6
%33 = icmp eq i32 %32, 1
%34 = zext i1 %33 to i64
%35 = select i1 %33, i32 65, i32 97
%36 = load i32, i32* %4
%37 = add i32 %35, %36
%38 = sub i32 %37, 10
%39 = trunc i32 %38 to i8
%40 = call i32 @my_putchar(i8 signext %39)
br label %41
41: ; preds = %31, %26
br label %42
42: ; preds = %41, %10
ret i32 0
}

LLVM IR (-O2):
define i32 @my_put_unsigned_int_base(i32 %0, i32 %1, i32 %2) {
%4 = icmp ult i32 %0, %1
br i1 %4, label %9, label %5
5: ; preds = %3
%6 = udiv i32 %0, %1
%7 = tail call i32 @my_put_unsigned_int_base(i32 %6, i32 %1, i32 %2)
%8 = urem i32 %0, %1
br label %9
9: ; preds = %5, %3
%10 = phi i32 [ %0, %3 ], [ %8, %5 ]
%11 = icmp ult i32 %10, 10
%12 = icmp eq i32 %2, 1
%13 = select i1 %12, i32 65, i32 97
%14 = select i1 %11, i32 0, i32 %13
%15 = add i32 %10, %14
%16 = select i1 %11, i8 48, i8 -10
%17 = trunc i32 %15 to i8
%18 = add i8 %16, %17
%19 = tail call i32 @my_putchar(i8 signext %18)
ret i32 0
}