// File: /workspace/github_c_makefile_star2_O1/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 0x2951
movq %rdi, %rcx
shrq $0x3c, %rcx
movl $0xf, %ecx
jne 0x2951
movabsq $-0x100000000000000, %r8 # imm = 0xFF00000000000000
addq %rdi, %r8
shrq $0x38, %r8
movl $0xe, %ecx
cmpl $0xf, %r8d
jb 0x2951
movabsq $-0x10000000000000, %r8 # imm = 0xFFF0000000000000
addq %rdi, %r8
shrq $0x34, %r8
movl $0xd, %ecx
cmpl $0xf, %r8d
jb 0x2951
movabsq $-0x1000000000000, %r8  # imm = 0xFFFF000000000000
addq %rdi, %r8
shrq $0x30, %r8
movl $0xc, %ecx
cmpl $0xf, %r8d
jb 0x2951
movabsq $-0x100000000000, %r8   # imm = 0xFFFFF00000000000
addq %rdi, %r8
shrq $0x2c, %r8
movl $0xb, %ecx
cmpl $0xf, %r8d
jb 0x2951
movabsq $-0x10000000000, %r8    # imm = 0xFFFFFF0000000000
addq %rdi, %r8
shrq $0x28, %r8
movl $0xa, %ecx
cmpl $0xf, %r8d
jb 0x2951
movabsq $-0x1000000000, %r8     # imm = 0xFFFFFFF000000000
addq %rdi, %r8
shrq $0x24, %r8
movl $0x9, %ecx
cmpl $0xf, %r8d
jb 0x2951
movabsq $-0x100000000, %r8      # imm = 0xFFFFFFFF00000000
addq %rdi, %r8
shrq $0x20, %r8
movl $0x8, %ecx
cmpl $0xf, %r8d
jb 0x2951
leaq -0x10000000(%rdi), %r8
shrq $0x1c, %r8
movl $0x7, %ecx
cmpq $0xf, %r8
jb 0x2951
leaq -0x1000000(%rdi), %r8
movl $0x6, %ecx
cmpq $0xf000000, %r8         # imm = 0xF000000
jb 0x2951
leaq -0x100000(%rdi), %r8
movl $0x5, %ecx
cmpq $0xf00000, %r8          # imm = 0xF00000
jb 0x2951
leaq -0x10000(%rdi), %r8
movl $0x4, %ecx
cmpq $0xf0000, %r8           # imm = 0xF0000
jb 0x2951
leaq -0x1000(%rdi), %r8
movl $0x3, %ecx
cmpq $0xf000, %r8            # imm = 0xF000
jb 0x2951
leaq -0x100(%rdi), %r8
movl $0x2, %ecx
cmpq $0xf00, %r8             # imm = 0xF00
jb 0x2951
leaq -0x10(%rdi), %r8
xorl %ecx, %ecx
cmpq $0xf0, %r8
setb %cl
leal 0x2(%rcx), %r8d
cmpq %rdx, %r8
ja 0x298b
movl %ecx, %ecx
leaq (%rcx,%rsi), %rax
incq %rax
movb $0x0, (%rax)
incq %rcx
leaq 0x6762(%rip), %rdx      # 0x90d2
movl %edi, %r8d
andl $0xf, %r8d
movb (%r8,%rdx), %r8b
movb %r8b, -0x1(%rsi,%rcx)
shrq $0x4, %rdi
decq %rcx
jg 0x2970
subl %esi, %eax
retq