#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*/ xmvsprintf_add(char **, unsigned int *, unsigned int *,
                                  char const);
size_t xmvsprintf_do_div(long *, int);
void xmvsprintf_number(char **buf, unsigned int *bufsize,
                       unsigned int *position, long num, int base, int size,
                       int precision, int type) {
  char c, sign, tmp[66];
  const char *digits = "0123456789abcdefghijklmnopqrstuvwxyz";
  int i;
  if (type & 64)
    digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  if (type & 16)
    type &= ~1;
  if (base < 2 || base > 36)
    return;
  c = (type & 1) ? '0' : ' ';
  sign = 0;
  if (type & 2) {
    if (num < 0) {
      sign = '-';
      num = -num;
      size--;
    } else if (type & 4) {
      sign = '+';
      size--;
    } else if (type & 8) {
      sign = ' ';
      size--;
    }
  }
  if (type & 32) {
    if (base == 16)
      size -= 2;
    else if (base == 8)
      size--;
  }
  i = 0;
  if (num == 0)
    tmp[i++] = '0';
  else
    while (num != 0)
      tmp[i++] = digits[xmvsprintf_do_div(&num, base)];
  if (i > precision)
    precision = i;
  size -= precision;
  if (!(type & (1 + 16)))
    while (size-- > 0)
      xmvsprintf_add(buf, bufsize, position, ' ');
  if (sign)
    xmvsprintf_add(buf, bufsize, position, sign);
  if (type & 32) {
    if (base == 8)
      xmvsprintf_add(buf, bufsize, position, '0');
    else if (base == 16) {
      xmvsprintf_add(buf, bufsize, position, '0');
      xmvsprintf_add(buf, bufsize, position, digits[33]);
    }
  }
  if (!(type & 16))
    while (size-- > 0)
      xmvsprintf_add(buf, bufsize, position, c);
  while (i < precision--)
    xmvsprintf_add(buf, bufsize, position, '0');
  while (i-- > 0)
    xmvsprintf_add(buf, bufsize, position, tmp[i]);
  while (size-- > 0)
    xmvsprintf_add(buf, bufsize, position, ' ');
}


x86 assembly (clang, -O0):
<xmvsprintf_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
lea    0xeb0(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    0x18(%rbp),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     116e <xmvsprintf_number+0x4e>
lea    0xebb(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    0x18(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     1186 <xmvsprintf_number+0x66>
mov    0x18(%rbp),%eax
and    $0xfffffffe,%eax
mov    %eax,0x18(%rbp)
cmpl   $0x2,-0x24(%rbp)
jl     119a <xmvsprintf_number+0x7a>
cmpl   $0x24,-0x24(%rbp)
jle    119f <xmvsprintf_number+0x7f>
jmp    14de <xmvsprintf_number+0x3be>
mov    0x18(%rbp),%edx
and    $0x1,%edx
mov    $0x20,%eax
mov    $0x30,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,-0x29(%rbp)
movb   $0x0,-0x2a(%rbp)
mov    0x18(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     123e <xmvsprintf_number+0x11e>
cmpq   $0x0,-0x20(%rbp)
jge    11f2 <xmvsprintf_number+0xd2>
movb   $0x2d,-0x2a(%rbp)
xor    %eax,%eax
sub    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    1239 <xmvsprintf_number+0x119>
mov    0x18(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     1213 <xmvsprintf_number+0xf3>
movb   $0x2b,-0x2a(%rbp)
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    1234 <xmvsprintf_number+0x114>
mov    0x18(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     122f <xmvsprintf_number+0x10f>
movb   $0x20,-0x2a(%rbp)
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    1234 <xmvsprintf_number+0x114>
jmp    1239 <xmvsprintf_number+0x119>
jmp    123e <xmvsprintf_number+0x11e>
mov    0x18(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     1282 <xmvsprintf_number+0x162>
cmpl   $0x10,-0x24(%rbp)
jne    1265 <xmvsprintf_number+0x145>
mov    -0x28(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x28(%rbp)
jmp    127d <xmvsprintf_number+0x15d>
cmpl   $0x8,-0x24(%rbp)
jne    1278 <xmvsprintf_number+0x158>
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    127d <xmvsprintf_number+0x15d>
jmp    1282 <xmvsprintf_number+0x162>
movl   $0x0,-0x7c(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    12ab <xmvsprintf_number+0x18b>
mov    -0x7c(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x7c(%rbp)
cltq
movb   $0x30,-0x70(%rbp,%rax,1)
jmp    12fa <xmvsprintf_number+0x1da>
jmp    12b0 <xmvsprintf_number+0x190>
cmpq   $0x0,-0x20(%rbp)
je     12f5 <xmvsprintf_number+0x1d5>
mov    -0x78(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x24(%rbp),%esi
lea    -0x20(%rbp),%rdi
call   1040 <xmvsprintf_do_div@plt>
mov    %rax,%rcx
mov    -0x88(%rbp),%rax
mov    (%rax,%rcx,1),%cl
mov    -0x7c(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x7c(%rbp)
cltq
mov    %cl,-0x70(%rbp,%rax,1)
jmp    12b0 <xmvsprintf_number+0x190>
jmp    12fa <xmvsprintf_number+0x1da>
mov    -0x7c(%rbp),%eax
cmp    0x10(%rbp),%eax
jle    130c <xmvsprintf_number+0x1ec>
mov    -0x7c(%rbp),%eax
mov    %eax,0x10(%rbp)
mov    0x10(%rbp),%ecx
mov    -0x28(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x28(%rbp)
mov    0x18(%rbp),%eax
and    $0x11,%eax
cmp    $0x0,%eax
jne    135f <xmvsprintf_number+0x23f>
jmp    132b <xmvsprintf_number+0x20b>
mov    -0x28(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x28(%rbp)
cmp    $0x0,%eax
jle    135a <xmvsprintf_number+0x23a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0x20,%ecx
call   1030 <xmvsprintf_add@plt>
jmp    132b <xmvsprintf_number+0x20b>
jmp    135f <xmvsprintf_number+0x23f>
cmpb   $0x0,-0x2a(%rbp)
je     137e <xmvsprintf_number+0x25e>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
movsbl -0x2a(%rbp),%ecx
call   1030 <xmvsprintf_add@plt>
mov    0x18(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     13f5 <xmvsprintf_number+0x2d5>
cmpl   $0x8,-0x24(%rbp)
jne    13b2 <xmvsprintf_number+0x292>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0x30,%ecx
call   1030 <xmvsprintf_add@plt>
jmp    13f0 <xmvsprintf_number+0x2d0>
cmpl   $0x10,-0x24(%rbp)
jne    13eb <xmvsprintf_number+0x2cb>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0x30,%ecx
call   1030 <xmvsprintf_add@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x78(%rbp),%rax
movsbl 0x21(%rax),%ecx
call   1030 <xmvsprintf_add@plt>
jmp    13f0 <xmvsprintf_number+0x2d0>
jmp    13f5 <xmvsprintf_number+0x2d5>
mov    0x18(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
jne    143c <xmvsprintf_number+0x31c>
jmp    1409 <xmvsprintf_number+0x2e9>
mov    -0x28(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x28(%rbp)
cmp    $0x0,%eax
jle    1437 <xmvsprintf_number+0x317>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
movsbl -0x29(%rbp),%ecx
call   1030 <xmvsprintf_add@plt>
jmp    1409 <xmvsprintf_number+0x2e9>
jmp    143c <xmvsprintf_number+0x31c>
jmp    1441 <xmvsprintf_number+0x321>
mov    -0x7c(%rbp),%eax
mov    0x10(%rbp),%ecx
mov    %ecx,%edx
add    $0xffffffff,%edx
mov    %edx,0x10(%rbp)
cmp    %ecx,%eax
jge    1472 <xmvsprintf_number+0x352>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0x30,%ecx
call   1030 <xmvsprintf_add@plt>
jmp    1441 <xmvsprintf_number+0x321>
jmp    1477 <xmvsprintf_number+0x357>
mov    -0x7c(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x7c(%rbp)
cmp    $0x0,%eax
jle    14aa <xmvsprintf_number+0x38a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
movslq -0x7c(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%ecx
call   1030 <xmvsprintf_add@plt>
jmp    1477 <xmvsprintf_number+0x357>
jmp    14af <xmvsprintf_number+0x38f>
mov    -0x28(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x28(%rbp)
cmp    $0x0,%eax
jle    14de <xmvsprintf_number+0x3be>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0x20,%ecx
call   1030 <xmvsprintf_add@plt>
jmp    14af <xmvsprintf_number+0x38f>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmvsprintf_number>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %r8d,%ebx
mov    %rsi,0x20(%rsp)
mov    0xc8(%rsp),%esi
mov    %rcx,0x30(%rsp)
test   $0x40,%sil
lea    0xeb0(%rip),%rax
lea    0xece(%rip),%r14
cmove  %rax,%r14
mov    %esi,%r15d
and    $0xfffffffe,%r15d
test   $0x10,%sil
cmove  %esi,%r15d
lea    -0x25(%rbx),%eax
cmp    $0xffffffdd,%eax
jb     146d <xmvsprintf_number+0x34d>
mov    $0x1,%al
test   $0x2,%r15b
jne    118e <xmvsprintf_number+0x6e>
movl   $0x0,0x10(%rsp)
test   $0x20,%r15b
je     11dd <xmvsprintf_number+0xbd>
jmp    11c9 <xmvsprintf_number+0xa9>
test   %rcx,%rcx
js     11a7 <xmvsprintf_number+0x87>
test   $0x4,%r15b
jne    11b7 <xmvsprintf_number+0x97>
test   $0x8,%r15b
je     117e <xmvsprintf_number+0x5e>
add    $0xffffffff,%r9d
mov    $0x20,%al
jmp    11bd <xmvsprintf_number+0x9d>
neg    %rcx
mov    %rcx,0x30(%rsp)
add    $0xffffffff,%r9d
mov    $0x2d,%al
jmp    11bd <xmvsprintf_number+0x9d>
add    $0xffffffff,%r9d
mov    $0x2b,%al
mov    %eax,0x10(%rsp)
xor    %eax,%eax
test   $0x20,%r15b
je     11dd <xmvsprintf_number+0xbd>
cmp    $0x8,%ebx
je     11d9 <xmvsprintf_number+0xb9>
cmp    $0x10,%ebx
jne    11dd <xmvsprintf_number+0xbd>
add    $0xfffffffe,%r9d
jmp    11dd <xmvsprintf_number+0xbd>
add    $0xffffffff,%r9d
mov    0xc0(%rsp),%r12d
test   %rcx,%rcx
mov    %rdx,0x18(%rsp)
mov    %rdi,0x28(%rsp)
mov    %rbx,0x38(%rsp)
je     123b <xmvsprintf_number+0x11b>
mov    %eax,0x14(%rsp)
mov    %r9d,0xc(%rsp)
xor    %r13d,%r13d
lea    0x30(%rsp),%rbp
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    %ebx,%esi
call   1040 <xmvsprintf_do_div@plt>
movzbl (%r14,%rax,1),%eax
mov    %al,0x40(%rsp,%r13,1)
add    $0x1,%r13
cmpq   $0x0,0x30(%rsp)
jne    1210 <xmvsprintf_number+0xf0>
mov    0xc(%rsp),%r9d
mov    0x14(%rsp),%eax
jmp    1246 <xmvsprintf_number+0x126>
movb   $0x30,0x40(%rsp)
mov    $0x1,%r13d
cmp    %r12d,%r13d
mov    %r12d,%r14d
cmovg  %r13d,%r14d
mov    %r9d,%r12d
sub    %r14d,%r12d
test   $0x11,%r15b
je     126f <xmvsprintf_number+0x14f>
test   %al,%al
je     12ca <xmvsprintf_number+0x1aa>
test   $0x20,%r15b
jne    12e9 <xmvsprintf_number+0x1c9>
jmp    135e <xmvsprintf_number+0x23e>
test   %r12d,%r12d
jle    147f <xmvsprintf_number+0x35f>
mov    %eax,0x14(%rsp)
mov    %r15d,0xc(%rsp)
mov    %r14d,%ebx
sub    %r9d,%ebx
mov    0x18(%rsp),%r12
mov    0x28(%rsp),%r15
mov    0x20(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
mov    $0x20,%ecx
call   1030 <xmvsprintf_add@plt>
inc    %ebx
jne    12a0 <xmvsprintf_number+0x180>
mov    $0xffffffff,%r12d
mov    0xc(%rsp),%r15d
mov    0x14(%rsp),%eax
test   %al,%al
jne    1260 <xmvsprintf_number+0x140>
movzbl 0x10(%rsp),%ecx
mov    0x28(%rsp),%rdi
mov    0x20(%rsp),%rsi
mov    0x18(%rsp),%rdx
call   1030 <xmvsprintf_add@plt>
test   $0x20,%r15b
je     135e <xmvsprintf_number+0x23e>
mov    0x38(%rsp),%rax
cmp    $0x8,%eax
je     1335 <xmvsprintf_number+0x215>
cmp    $0x10,%eax
jne    135e <xmvsprintf_number+0x23e>
mov    %r15d,0xc(%rsp)
mov    0xc8(%rsp),%eax
test   $0x40,%al
sete   %bl
mov    0x28(%rsp),%r15
mov    %r15,%rdi
mov    0x20(%rsp),%rbp
mov    %rbp,%rsi
mov    0x18(%rsp),%rdx
mov    $0x30,%ecx
call   1030 <xmvsprintf_add@plt>
mov    0x18(%rsp),%rdx
shl    $0x5,%bl
or     $0x58,%bl
jmp    134b <xmvsprintf_number+0x22b>
mov    %r15d,0xc(%rsp)
mov    $0x30,%bl
mov    0x18(%rsp),%rdx
mov    0x28(%rsp),%r15
mov    0x20(%rsp),%rbp
movzbl %bl,%ecx
mov    %r15,%rdi
mov    %rbp,%rsi
call   1030 <xmvsprintf_add@plt>
mov    0xc(%rsp),%r15d
test   $0x10,%r15b
jne    13b3 <xmvsprintf_number+0x293>
test   %r12d,%r12d
jle    13ba <xmvsprintf_number+0x29a>
and    $0x1,%r15b
shl    $0x4,%r15b
or     $0x20,%r15b
movzbl %r15b,%eax
mov    %eax,0x14(%rsp)
mov    0x18(%rsp),%rbx
mov    0x20(%rsp),%r15
mov    0x28(%rsp),%rbp
nopl   0x0(%rax)
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    0x14(%rsp),%ecx
call   1030 <xmvsprintf_add@plt>
add    $0xffffffff,%r12d
jne    1390 <xmvsprintf_number+0x270>
mov    %r15,%rbx
mov    $0xffffffff,%r12d
jmp    13c3 <xmvsprintf_number+0x2a3>
mov    0x20(%rsp),%rbx
jmp    13c3 <xmvsprintf_number+0x2a3>
mov    0x20(%rsp),%rbx
add    $0xffffffff,%r12d
cmp    0xc0(%rsp),%r13d
mov    0x18(%rsp),%r15
mov    0x28(%rsp),%rbp
jge    13fc <xmvsprintf_number+0x2dc>
nopw   0x0(%rax,%rax,1)
add    $0xffffffff,%r14d
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    $0x30,%ecx
call   1030 <xmvsprintf_add@plt>
cmp    %r14d,%r13d
jl     13e0 <xmvsprintf_number+0x2c0>
mov    %rbp,%rcx
lea    0x1(%r13),%ebp
add    $0xffffffff,%r13d
mov    %rbx,%rax
lea    (%rsp,%r13,1),%rbx
add    $0x40,%rbx
mov    %r15,%r14
mov    %rax,%r15
mov    %rcx,%r13
nopl   0x0(%rax,%rax,1)
movsbl (%rbx),%ecx
mov    %r13,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <xmvsprintf_add@plt>
add    $0xffffffff,%ebp
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%ebp
jg     1420 <xmvsprintf_number+0x300>
test   %r12d,%r12d
jle    146d <xmvsprintf_number+0x34d>
add    $0x1,%r12d
cs nopw 0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
mov    $0x20,%ecx
call   1030 <xmvsprintf_add@plt>
add    $0xffffffff,%r12d
cmp    $0x1,%r12d
ja     1450 <xmvsprintf_number+0x330>
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
add    $0xffffffff,%r12d
test   %al,%al
jne    1260 <xmvsprintf_number+0x140>
jmp    12ca <xmvsprintf_number+0x1aa>

LLVM IR (-O0):
@.str = [37 x i8] c"0123456789abcdefghijklmnopqrstuvwxyz\00"
@.str.1 = [37 x i8] c"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\00"
define void @xmvsprintf_number(i8** %0, i32* %1, i32* %2, i64 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = alloca i8**
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i64
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8
%18 = alloca i8
%19 = alloca [66 x i8]
%20 = alloca i8*
%21 = alloca i32
store i8** %0, i8*** %9
store i32* %1, i32** %10
store i32* %2, i32** %11
store i64 %3, i64* %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i32 %6, i32* %15
store i32 %7, i32* %16
store i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8** %20
%22 = load i32, i32* %16
%23 = and i32 %22, 64
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %8
store i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8** %20
br label %26
26: ; preds = %25, %8
%27 = load i32, i32* %16
%28 = and i32 %27, 16
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %26
%31 = load i32, i32* %16
%32 = and i32 %31, -2
store i32 %32, i32* %16
br label %33
33: ; preds = %30, %26
%34 = load i32, i32* %13
%35 = icmp slt i32 %34, 2
br i1 %35, label %39, label %36
36: ; preds = %33
%37 = load i32, i32* %13
%38 = icmp sgt i32 %37, 36
br i1 %38, label %39, label %40
39: ; preds = %36, %33
br label %229
40: ; preds = %36
%41 = load i32, i32* %16
%42 = and i32 %41, 1
%43 = icmp ne i32 %42, 0
%44 = zext i1 %43 to i64
%45 = select i1 %43, i32 48, i32 32
%46 = trunc i32 %45 to i8
store i8 %46, i8* %17
store i8 0, i8* %18
%47 = load i32, i32* %16
%48 = and i32 %47, 2
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %75
50: ; preds = %40
%51 = load i64, i64* %12
%52 = icmp slt i64 %51, 0
br i1 %52, label %53, label %58
53: ; preds = %50
store i8 45, i8* %18
%54 = load i64, i64* %12
%55 = sub nsw i64 0, %54
store i64 %55, i64* %12
%56 = load i32, i32* %14
%57 = add nsw i32 %56, -1
store i32 %57, i32* %14
br label %74
58: ; preds = %50
%59 = load i32, i32* %16
%60 = and i32 %59, 4
%61 = icmp ne i32 %60, 0
br i1 %61, label %62, label %65
62: ; preds = %58
store i8 43, i8* %18
%63 = load i32, i32* %14
%64 = add nsw i32 %63, -1
store i32 %64, i32* %14
br label %73
65: ; preds = %58
%66 = load i32, i32* %16
%67 = and i32 %66, 8
%68 = icmp ne i32 %67, 0
br i1 %68, label %69, label %72
69: ; preds = %65
store i8 32, i8* %18
%70 = load i32, i32* %14
%71 = add nsw i32 %70, -1
store i32 %71, i32* %14
br label %72
72: ; preds = %69, %65
br label %73
73: ; preds = %72, %62
br label %74
74: ; preds = %73, %53
br label %75
75: ; preds = %74, %40
%76 = load i32, i32* %16
%77 = and i32 %76, 32
%78 = icmp ne i32 %77, 0
br i1 %78, label %79, label %93
79: ; preds = %75
%80 = load i32, i32* %13
%81 = icmp eq i32 %80, 16
br i1 %81, label %82, label %85
82: ; preds = %79
%83 = load i32, i32* %14
%84 = sub nsw i32 %83, 2
store i32 %84, i32* %14
br label %92
85: ; preds = %79
%86 = load i32, i32* %13
%87 = icmp eq i32 %86, 8
br i1 %87, label %88, label %91
88: ; preds = %85
%89 = load i32, i32* %14
%90 = add nsw i32 %89, -1
store i32 %90, i32* %14
br label %91
91: ; preds = %88, %85
br label %92
92: ; preds = %91, %82
br label %93
93: ; preds = %92, %75
store i32 0, i32* %21
%94 = load i64, i64* %12
%95 = icmp eq i64 %94, 0
br i1 %95, label %96, label %101
96: ; preds = %93
%97 = load i32, i32* %21
%98 = add nsw i32 %97, 1
store i32 %98, i32* %21
%99 = sext i32 %97 to i64
%100 = getelementptr inbounds [66 x i8], [66 x i8]* %19, i64 0, i64 %99
store i8 48, i8* %100
br label %116
101: ; preds = %93
br label %102
102: ; preds = %105, %101
%103 = load i64, i64* %12
%104 = icmp ne i64 %103, 0
br i1 %104, label %105, label %115
105: ; preds = %102
%106 = load i8*, i8** %20
%107 = load i32, i32* %13
%108 = call i64 @xmvsprintf_do_div(i64* %12, i32 %107)
%109 = getelementptr inbounds i8, i8* %106, i64 %108
%110 = load i8, i8* %109
%111 = load i32, i32* %21
%112 = add nsw i32 %111, 1
store i32 %112, i32* %21
%113 = sext i32 %111 to i64
%114 = getelementptr inbounds [66 x i8], [66 x i8]* %19, i64 0, i64 %113
store i8 %110, i8* %114
br label %102
115: ; preds = %102
br label %116
116: ; preds = %115, %96
%117 = load i32, i32* %21
%118 = load i32, i32* %15
%119 = icmp sgt i32 %117, %118
br i1 %119, label %120, label %122
120: ; preds = %116
%121 = load i32, i32* %21
store i32 %121, i32* %15
br label %122
122: ; preds = %120, %116
%123 = load i32, i32* %15
%124 = load i32, i32* %14
%125 = sub nsw i32 %124, %123
store i32 %125, i32* %14
%126 = load i32, i32* %16
%127 = and i32 %126, 17
%128 = icmp ne i32 %127, 0
br i1 %128, label %140, label %129
129: ; preds = %122
br label %130
130: ; preds = %134, %129
%131 = load i32, i32* %14
%132 = add nsw i32 %131, -1
store i32 %132, i32* %14
%133 = icmp sgt i32 %131, 0
br i1 %133, label %134, label %139
134: ; preds = %130
%135 = load i8**, i8*** %9
%136 = load i32*, i32** %10
%137 = load i32*, i32** %11
%138 = call i32 @xmvsprintf_add(i8** %135, i32* %136, i32* %137, i8 signext 32)
br label %130
139: ; preds = %130
br label %140
140: ; preds = %139, %122
%141 = load i8, i8* %18
%142 = icmp ne i8 %141, 0
br i1 %142, label %143, label %149
143: ; preds = %140
%144 = load i8**, i8*** %9
%145 = load i32*, i32** %10
%146 = load i32*, i32** %11
%147 = load i8, i8* %18
%148 = call i32 @xmvsprintf_add(i8** %144, i32* %145, i32* %146, i8 signext %147)
br label %149
149: ; preds = %143, %140
%150 = load i32, i32* %16
%151 = and i32 %150, 32
%152 = icmp ne i32 %151, 0
br i1 %152, label %153, label %178
153: ; preds = %149
%154 = load i32, i32* %13
%155 = icmp eq i32 %154, 8
br i1 %155, label %156, label %161
156: ; preds = %153
%157 = load i8**, i8*** %9
%158 = load i32*, i32** %10
%159 = load i32*, i32** %11
%160 = call i32 @xmvsprintf_add(i8** %157, i32* %158, i32* %159, i8 signext 48)
br label %177
161: ; preds = %153
%162 = load i32, i32* %13
%163 = icmp eq i32 %162, 16
br i1 %163, label %164, label %176
164: ; preds = %161
%165 = load i8**, i8*** %9
%166 = load i32*, i32** %10
%167 = load i32*, i32** %11
%168 = call i32 @xmvsprintf_add(i8** %165, i32* %166, i32* %167, i8 signext 48)
%169 = load i8**, i8*** %9
%170 = load i32*, i32** %10
%171 = load i32*, i32** %11
%172 = load i8*, i8** %20
%173 = getelementptr inbounds i8, i8* %172, i64 33
%174 = load i8, i8* %173
%175 = call i32 @xmvsprintf_add(i8** %169, i32* %170, i32* %171, i8 signext %174)
br label %176
176: ; preds = %164, %161
br label %177
177: ; preds = %176, %156
br label %178
178: ; preds = %177, %149
%179 = load i32, i32* %16
%180 = and i32 %179, 16
%181 = icmp ne i32 %180, 0
br i1 %181, label %194, label %182
182: ; preds = %178
br label %183
183: ; preds = %187, %182
%184 = load i32, i32* %14
%185 = add nsw i32 %184, -1
store i32 %185, i32* %14
%186 = icmp sgt i32 %184, 0
br i1 %186, label %187, label %193
187: ; preds = %183
%188 = load i8**, i8*** %9
%189 = load i32*, i32** %10
%190 = load i32*, i32** %11
%191 = load i8, i8* %17
%192 = call i32 @xmvsprintf_add(i8** %188, i32* %189, i32* %190, i8 signext %191)
br label %183
193: ; preds = %183
br label %194
194: ; preds = %193, %178
br label %195
195: ; preds = %200, %194
%196 = load i32, i32* %21
%197 = load i32, i32* %15
%198 = add nsw i32 %197, -1
store i32 %198, i32* %15
%199 = icmp slt i32 %196, %197
br i1 %199, label %200, label %205
200: ; preds = %195
%201 = load i8**, i8*** %9
%202 = load i32*, i32** %10
%203 = load i32*, i32** %11
%204 = call i32 @xmvsprintf_add(i8** %201, i32* %202, i32* %203, i8 signext 48)
br label %195
205: ; preds = %195
br label %206
206: ; preds = %210, %205
%207 = load i32, i32* %21
%208 = add nsw i32 %207, -1
store i32 %208, i32* %21
%209 = icmp sgt i32 %207, 0
br i1 %209, label %210, label %219
210: ; preds = %206
%211 = load i8**, i8*** %9
%212 = load i32*, i32** %10
%213 = load i32*, i32** %11
%214 = load i32, i32* %21
%215 = sext i32 %214 to i64
%216 = getelementptr inbounds [66 x i8], [66 x i8]* %19, i64 0, i64 %215
%217 = load i8, i8* %216
%218 = call i32 @xmvsprintf_add(i8** %211, i32* %212, i32* %213, i8 signext %217)
br label %206
219: ; preds = %206
br label %220
220: ; preds = %224, %219
%221 = load i32, i32* %14
%222 = add nsw i32 %221, -1
store i32 %222, i32* %14
%223 = icmp sgt i32 %221, 0
br i1 %223, label %224, label %229
224: ; preds = %220
%225 = load i8**, i8*** %9
%226 = load i32*, i32** %10
%227 = load i32*, i32** %11
%228 = call i32 @xmvsprintf_add(i8** %225, i32* %226, i32* %227, i8 signext 32)
br label %220
229: ; preds = %39, %220
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"0123456789abcdefghijklmnopqrstuvwxyz\00"
@.str.1 = [37 x i8] c"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\00"
define void @xmvsprintf_number(i8** %0, i32* %1, i32* %2, i64 %3, i32 %4, i32 %5, i32 %6, i32 %7) {
%9 = alloca i64
%10 = alloca [66 x i8]
store i64 %3, i64* %9
%11 = getelementptr inbounds [66 x i8], [66 x i8]* %10, i64 0, i64 0
%12 = and i32 %7, 64
%13 = icmp eq i32 %12, 0
%14 = select i1 %13, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0)
%15 = and i32 %7, 16
%16 = icmp eq i32 %15, 0
%17 = and i32 %7, -2
%18 = select i1 %16, i32 %7, i32 %17
%19 = add i32 %4, -37
%20 = icmp ult i32 %19, -35
br i1 %20, label %133, label %21
21: ; preds = %8
%22 = and i32 %18, 1
%23 = icmp eq i32 %22, 0
%24 = select i1 %23, i8 32, i8 48
%25 = and i32 %18, 2
%26 = icmp eq i32 %25, 0
br i1 %26, label %42, label %27
27: ; preds = %21
%28 = icmp slt i64 %3, 0
br i1 %28, label %29, label %32
29: ; preds = %27
%30 = sub nsw i64 0, %3
store i64 %30, i64* %9
%31 = add nsw i32 %5, -1
br label %42
32: ; preds = %27
%33 = and i32 %18, 4
%34 = icmp eq i32 %33, 0
br i1 %34, label %37, label %35
35: ; preds = %32
%36 = add nsw i32 %5, -1
br label %42
37: ; preds = %32
%38 = and i32 %18, 8
%39 = icmp eq i32 %38, 0
br i1 %39, label %42, label %40
40: ; preds = %37
%41 = add nsw i32 %5, -1
br label %42
42: ; preds = %29, %37, %40, %35, %21
%43 = phi i64 [ %30, %29 ], [ %3, %35 ], [ %3, %40 ], [ %3, %37 ], [ %3, %21 ]
%44 = phi i32 [ %31, %29 ], [ %36, %35 ], [ %41, %40 ], [ %5, %37 ], [ %5, %21 ]
%45 = phi i1 [ false, %29 ], [ false, %35 ], [ false, %40 ], [ true, %37 ], [ true, %21 ]
%46 = phi i8 [ 45, %29 ], [ 43, %35 ], [ 32, %40 ], [ 0, %37 ], [ 0, %21 ]
%47 = and i32 %18, 32
%48 = icmp eq i32 %47, 0
br i1 %48, label %54, label %49
49: ; preds = %42
switch i32 %4, label %54 [
i32 16, label %50
i32 8, label %52
]
50: ; preds = %49
%51 = add nsw i32 %44, -2
br label %54
52: ; preds = %49
%53 = add nsw i32 %44, -1
br label %54
54: ; preds = %49, %50, %52, %42
%55 = phi i32 [ %51, %50 ], [ %53, %52 ], [ %44, %42 ], [ %44, %49 ]
%56 = icmp eq i64 %43, 0
br i1 %56, label %57, label %58
57: ; preds = %54
store i8 48, i8* %11
br label %69
58: ; preds = %54, %58
%59 = phi i64 [ %63, %58 ], [ 0, %54 ]
%60 = call i64 @xmvsprintf_do_div(i64* %9, i32 %4)
%61 = getelementptr inbounds i8, i8* %14, i64 %60
%62 = load i8, i8* %61
%63 = add nuw i64 %59, 1
%64 = getelementptr inbounds [66 x i8], [66 x i8]* %10, i64 0, i64 %59
store i8 %62, i8* %64
%65 = load i64, i64* %9
%66 = icmp eq i64 %65, 0
br i1 %66, label %67, label %58
67: ; preds = %58
%68 = trunc i64 %63 to i32
br label %69
69: ; preds = %67, %57
%70 = phi i32 [ 1, %57 ], [ %68, %67 ]
%71 = icmp sgt i32 %70, %6
%72 = select i1 %71, i32 %70, i32 %6
%73 = sub nsw i32 %55, %72
%74 = and i32 %18, 17
%75 = icmp eq i32 %74, 0
br i1 %75, label %76, label %84
76: ; preds = %69
%77 = add nsw i32 %73, -1
%78 = icmp sgt i32 %73, 0
br i1 %78, label %79, label %84
79: ; preds = %76, %79
%80 = phi i32 [ %82, %79 ], [ %77, %76 ]
%81 = call i32 @xmvsprintf_add(i8** %0, i32* %1, i32* %2, i8 signext 32)
%82 = add nsw i32 %80, -1
%83 = icmp eq i32 %80, 0
br i1 %83, label %84, label %79
84: ; preds = %79, %76, %69
%85 = phi i32 [ %73, %69 ], [ %77, %76 ], [ -1, %79 ]
br i1 %45, label %88, label %86
86: ; preds = %84
%87 = call i32 @xmvsprintf_add(i8** %0, i32* %1, i32* %2, i8 signext %46)
br label %88
88: ; preds = %86, %84
br i1 %48, label %96, label %89
89: ; preds = %88
switch i32 %4, label %96 [
i32 8, label %93
i32 16, label %90
]
90: ; preds = %89
%91 = call i32 @xmvsprintf_add(i8** %0, i32* %1, i32* %2, i8 signext 48)
%92 = select i1 %13, i8 120, i8 88
br label %93
93: ; preds = %89, %90
%94 = phi i8 [ %92, %90 ], [ 48, %89 ]
%95 = call i32 @xmvsprintf_add(i8** %0, i32* %1, i32* %2, i8 signext %94)
br label %96
96: ; preds = %93, %89, %88
%97 = and i32 %18, 16
%98 = icmp eq i32 %97, 0
br i1 %98, label %99, label %107
99: ; preds = %96
%100 = add nsw i32 %85, -1
%101 = icmp sgt i32 %85, 0
br i1 %101, label %102, label %107
102: ; preds = %99, %102
%103 = phi i32 [ %105, %102 ], [ %100, %99 ]
%104 = call i32 @xmvsprintf_add(i8** %0, i32* %1, i32* %2, i8 signext %24)
%105 = add nsw i32 %103, -1
%106 = icmp eq i32 %103, 0
br i1 %106, label %107, label %102
107: ; preds = %102, %99, %96
%108 = phi i32 [ %85, %96 ], [ %100, %99 ], [ -1, %102 ]
%109 = icmp slt i32 %70, %6
br i1 %109, label %112, label %110
110: ; preds = %112, %107
%111 = zext i32 %70 to i64
br label %119
112: ; preds = %107, %112
%113 = phi i32 [ %114, %112 ], [ %72, %107 ]
%114 = add nsw i32 %113, -1
%115 = call i32 @xmvsprintf_add(i8** %0, i32* %1, i32* %2, i8 signext 48)
%116 = icmp slt i32 %70, %114
br i1 %116, label %112, label %110
117: ; preds = %119
%118 = icmp sgt i32 %108, 0
br i1 %118, label %128, label %133
119: ; preds = %110, %119
%120 = phi i64 [ %111, %110 ], [ %121, %119 ]
%121 = add nsw i64 %120, -1
%122 = and i64 %121, 4294967295
%123 = getelementptr inbounds [66 x i8], [66 x i8]* %10, i64 0, i64 %122
%124 = load i8, i8* %123
%125 = call i32 @xmvsprintf_add(i8** %0, i32* %1, i32* %2, i8 signext %124)
%126 = trunc i64 %120 to i32
%127 = icmp sgt i32 %126, 1
br i1 %127, label %119, label %117
128: ; preds = %117, %128
%129 = phi i32 [ %130, %128 ], [ %108, %117 ]
%130 = add nsw i32 %129, -1
%131 = call i32 @xmvsprintf_add(i8** %0, i32* %1, i32* %2, i8 signext 32)
%132 = icmp ugt i32 %129, 1
br i1 %132, label %128, label %133
133: ; preds = %128, %117, %8
ret void
}