// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
decq %rax
subq $0xe, %rax
ja 0x2b92
jmp 0x295e
movl $0x0, -0x24(%rbp)
jmp 0x2bb4
movl $0x1, -0x24(%rbp)
jmp 0x2bb4
movq -0x38(%rbp), %rax
subq $0x10, %rax
cmpq $0xef, %rax
jbe 0x296a
jmp 0x2bb4
movl $0x2, -0x24(%rbp)
jmp 0x2bb4
movq -0x38(%rbp), %rax
subq $0x100, %rax            # imm = 0x100
cmpq $0xeff, %rax            # imm = 0xEFF
jbe 0x298b
jmp 0x2976
movl $0x3, -0x24(%rbp)
jmp 0x2bb4
movq -0x38(%rbp), %rax
subq $0x1000, %rax           # imm = 0x1000
cmpq $0xefff, %rax           # imm = 0xEFFF
jbe 0x29ab
jmp 0x2997
movl $0x4, -0x24(%rbp)
jmp 0x2bb4
movq -0x38(%rbp), %rax
subq $0x10000, %rax          # imm = 0x10000
cmpq $0xeffff, %rax          # imm = 0xEFFFF
jbe 0x29cb
jmp 0x29b7
movl $0x5, -0x24(%rbp)
jmp 0x2bb4
movq -0x38(%rbp), %rax
subq $0x100000, %rax         # imm = 0x100000
cmpq $0xefffff, %rax         # imm = 0xEFFFFF
jbe 0x29eb
jmp 0x29d7
movl $0x6, -0x24(%rbp)
jmp 0x2bb4
movq -0x38(%rbp), %rax
subq $0x1000000, %rax        # imm = 0x1000000
cmpq $0xeffffff, %rax        # imm = 0xEFFFFFF
jbe 0x2a0b
jmp 0x29f7
movl $0x7, -0x24(%rbp)
jmp 0x2bb4
movq -0x38(%rbp), %rax
subq $0x10000000, %rax       # imm = 0x10000000
movl $0xefffffff, %ecx       # imm = 0xEFFFFFFF
cmpq %rcx, %rax
jbe 0x2a2b
jmp 0x2a17
movl $0x8, -0x24(%rbp)
jmp 0x2bb4
movq -0x38(%rbp), %rax
movabsq $0x100000000, %rcx      # imm = 0x100000000
subq %rcx, %rax
movabsq $0xeffffffff, %rcx      # imm = 0xEFFFFFFFF
cmpq %rcx, %rax
jbe 0x2a4d
jmp 0x2a37
movl $0x9, -0x24(%rbp)
jmp 0x2bb4
movq -0x38(%rbp), %rax
movabsq $0x1000000000, %rcx     # imm = 0x1000000000
subq %rcx, %rax
movabsq $0xefffffffff, %rcx     # imm = 0xEFFFFFFFFF
cmpq %rcx, %rax
jbe 0x2a7b
jmp 0x2a59
movl $0xa, -0x24(%rbp)
jmp 0x2bb4
movq -0x38(%rbp), %rax
movabsq $0x10000000000, %rcx    # imm = 0x10000000000
subq %rcx, %rax
movabsq $0xeffffffffff, %rcx    # imm = 0xEFFFFFFFFFF
cmpq %rcx, %rax
jbe 0x2aa9
jmp 0x2a87
movl $0xb, -0x24(%rbp)
jmp 0x2bb4
movq -0x38(%rbp), %rax
movabsq $0x100000000000, %rcx   # imm = 0x100000000000
subq %rcx, %rax
movabsq $0xefffffffffff, %rcx   # imm = 0xEFFFFFFFFFFF
cmpq %rcx, %rax
jbe 0x2ad7
jmp 0x2ab5
movl $0xc, -0x24(%rbp)
jmp 0x2bb4
movq -0x38(%rbp), %rax
movabsq $0x1000000000000, %rcx  # imm = 0x1000000000000
subq %rcx, %rax
movabsq $0xeffffffffffff, %rcx  # imm = 0xEFFFFFFFFFFFF
cmpq %rcx, %rax
jbe 0x2b05
jmp 0x2ae3
movl $0xd, -0x24(%rbp)
jmp 0x2bb4
movq -0x38(%rbp), %rax
movabsq $0x10000000000000, %rcx # imm = 0x10000000000000
subq %rcx, %rax
movabsq $0xefffffffffffff, %rcx # imm = 0xEFFFFFFFFFFFFF
cmpq %rcx, %rax
jbe 0x2b33
jmp 0x2b11
movl $0xe, -0x24(%rbp)
jmp 0x2bb4
movq -0x38(%rbp), %rax
movabsq $0x100000000000000, %rcx # imm = 0x100000000000000
subq %rcx, %rax
movabsq $0xeffffffffffffff, %rcx # imm = 0xEFFFFFFFFFFFFFF
cmpq %rcx, %rax
jbe 0x2b5e
jmp 0x2b3c
movl $0xf, -0x24(%rbp)
jmp 0x2bb4
movq -0x38(%rbp), %rax
movabsq $0x1000000000000000, %rcx # imm = 0x1000000000000000
subq %rcx, %rax
movabsq $-0x1000000000000001, %rcx # imm = 0xEFFFFFFFFFFFFFFF
cmpq %rcx, %rax
jbe 0x2b89
jmp 0x2b67
movl -0x24(%rbp), %eax
addl $0x2, %eax
cltq
cmpq -0x20(%rbp), %rax
jbe 0x2bcb
movl $0x0, -0x4(%rbp)
jmp 0x2c2d
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
addq %rcx, %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb $0x0, (%rax)
cmpl $0x0, -0x24(%rbp)
jl 0x2c1f
movq -0x10(%rbp), %rcx
andq $0xf, %rcx
leaq 0xa5a8(%rip), %rax      # 0xd1a2
movb (%rax,%rcx), %dl
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
movb %dl, (%rax,%rcx)
movq -0x10(%rbp), %rax
shrq $0x4, %rax
movq %rax, -0x10(%rbp)
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2be5
movq -0x30(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)