// File: /workspace/github_c_makefile_star2_O2/wtarreau[P]httpterm/httpterm.c
// Function: ulltox
int ulltox(unsigned long long n, char *dst, size_t size)
{
    int i = 0;
    char *res;

    switch(n) {
    case 0x1ULL ... 0xFULL:
	i = 0;
	break;

    case 0x10ULL ... 0xFFULL:
	i = 1;
	break;

    case 0x100ULL ... 0xFFFULL:
	i = 2;
	break;

    case 0x1000ULL ... 0xFFFFULL:
	i = 3;
	break;

    case 0x10000ULL ... 0xFFFFFULL:
	i = 4;
	break;

    case 0x100000ULL ... 0xFFFFFFULL:
	i = 5;
	break;

    case 0x1000000ULL ... 0xFFFFFFFULL:
	i = 6;
	break;

    case 0x10000000ULL ... 0xFFFFFFFFULL:
	i = 7;
	break;

    case 0x100000000ULL ... 0xFFFFFFFFFULL:
	i = 8;
	break;

    case 0x1000000000ULL ... 0xFFFFFFFFFFULL:
	i = 9;
	break;

    case 0x10000000000ULL ... 0xFFFFFFFFFFFULL:
	i = 10;
	break;

    case 0x100000000000ULL ... 0xFFFFFFFFFFFFULL:
	i = 11;
	break;

    case 0x1000000000000ULL ... 0xFFFFFFFFFFFFFULL:
	i = 12;
	break;

    case 0x10000000000000ULL ... 0xFFFFFFFFFFFFFFULL:
	i = 13;
	break;

    case 0x100000000000000ULL ... 0xFFFFFFFFFFFFFFFULL:
	i = 14;
	break;

    case 0x1000000000000000ULL ... 0xFFFFFFFFFFFFFFFFULL:
	i = 15;
	break;
    }
    if (i + 2 > size) // (i + 1) + '\0'
	return 0;  // too long
    res = dst + i + 1;
    *res = '\0';
    for (; i >= 0; i--) {
	dst[i] = "0123456789ABCDEF"[n & 15];
	n >>= 4;
    }
    return res - dst;
}

// Assembly:
leaq -0x1(%rdi), %r8
xorl %eax, %eax
movl $0x0, %ecx
cmpq $0xf, %r8
jb 0x28ed
movq %rdi, %rcx
shrq $0x3c, %rcx
je 0x27ad
pushq $0xf
jmp 0x28ec
movabsq $-0x100000000000000, %rcx # imm = 0xFF00000000000000
addq %rdi, %rcx
shrq $0x38, %rcx
cmpl $0xf, %ecx
jae 0x27ca
pushq $0xe
jmp 0x28ec
movabsq $-0x10000000000000, %rcx # imm = 0xFFF0000000000000
addq %rdi, %rcx
shrq $0x34, %rcx
cmpl $0xf, %ecx
jae 0x27e7
pushq $0xd
jmp 0x28ec
movabsq $-0x1000000000000, %rcx # imm = 0xFFFF000000000000
addq %rdi, %rcx
shrq $0x30, %rcx
cmpl $0xf, %ecx
jae 0x2804
pushq $0xc
jmp 0x28ec
movabsq $-0x100000000000, %rcx  # imm = 0xFFFFF00000000000
addq %rdi, %rcx
shrq $0x2c, %rcx
cmpl $0xf, %ecx
jae 0x2821
pushq $0xb
jmp 0x28ec
movabsq $-0x10000000000, %rcx   # imm = 0xFFFFFF0000000000
addq %rdi, %rcx
shrq $0x28, %rcx
cmpl $0xf, %ecx
jae 0x283e
pushq $0xa
jmp 0x28ec
movabsq $-0x1000000000, %rcx    # imm = 0xFFFFFFF000000000
addq %rdi, %rcx
shrq $0x24, %rcx
cmpl $0xf, %ecx
jae 0x285b
pushq $0x9
jmp 0x28ec
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
addq %rdi, %rcx
shrq $0x20, %rcx
cmpl $0xf, %ecx
jae 0x2875
pushq $0x8
jmp 0x28ec
leaq -0x10000000(%rdi), %rcx
shrq $0x1c, %rcx
cmpq $0xf, %rcx
jae 0x288a
pushq $0x7
jmp 0x28ec
leaq -0x1000000(%rdi), %rcx
cmpq $0xf000000, %rcx        # imm = 0xF000000
jae 0x289e
pushq $0x6
jmp 0x28ec
leaq -0x100000(%rdi), %rcx
cmpq $0xf00000, %rcx         # imm = 0xF00000
jae 0x28b2
pushq $0x5
jmp 0x28ec
leaq -0x10000(%rdi), %rcx
cmpq $0xf0000, %rcx          # imm = 0xF0000
jae 0x28c6
pushq $0x4
jmp 0x28ec
leaq -0x1000(%rdi), %rcx
cmpq $0xf000, %rcx           # imm = 0xF000
jae 0x28da
pushq $0x3
jmp 0x28ec
leaq -0x100(%rdi), %rcx
cmpq $0xf00, %rcx            # imm = 0xF00
jae 0x2929
pushq $0x2
popq %rcx
leal 0x2(%rcx), %r8d
cmpq %rdx, %r8
ja 0x2928
movl %ecx, %eax
addq %rsi, %rax
incq %rax
movb $0x0, (%rax)
leaq 0x67ca(%rip), %rdx      # 0x90d2
testl %ecx, %ecx
js 0x2926
movl %edi, %r8d
andl $0xf, %r8d
movb (%r8,%rdx), %r8b
movl %ecx, %r9d
movb %r8b, (%rsi,%r9)
shrq $0x4, %rdi
decl %ecx
jmp 0x2908
subl %esi, %eax
retq
leaq -0x10(%rdi), %r8
xorl %ecx, %ecx
cmpq $0xf0, %r8
setb %cl
jmp 0x28ed