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

    switch(n) {
    case 1ULL ... 9ULL:
	i = 0;
	break;

    case 10ULL ... 99ULL:
	i = 1;
	break;

    case 100ULL ... 999ULL:
	i = 2;
	break;

    case 1000ULL ... 9999ULL:
	i = 3;
	break;

    case 10000ULL ... 99999ULL:
	i = 4;
	break;

    case 100000ULL ... 999999ULL:
	i = 5;
	break;

    case 1000000ULL ... 9999999ULL:
	i = 6;
	break;

    case 10000000ULL ... 99999999ULL:
	i = 7;
	break;

    case 100000000ULL ... 999999999ULL:
	i = 8;
	break;

    case 1000000000ULL ... 9999999999ULL:
	i = 9;
	break;

    case 10000000000ULL ... 99999999999ULL:
	i = 10;
	break;

    case 100000000000ULL ... 999999999999ULL:
	i = 11;
	break;

    case 1000000000000ULL ... 9999999999999ULL:
	i = 12;
	break;

    case 10000000000000ULL ... 99999999999999ULL:
	i = 13;
	break;

    case 100000000000000ULL ... 999999999999999ULL:
	i = 14;
	break;

    case 1000000000000000ULL ... 9999999999999999ULL:
	i = 15;
	break;

    case 10000000000000000ULL ... 99999999999999999ULL:
	i = 16;
	break;

    case 100000000000000000ULL ... 999999999999999999ULL:
	i = 17;
	break;

    case 1000000000000000000ULL ... 9999999999999999999ULL:
	i = 18;
	break;

    case 10000000000000000000ULL ... ULLONG_MAX:
	i = 19;
	break;
    }
    if (i + 2 > size) // (i + 1) + '\0'
	return 0;  // too long
    res = dst + i + 1;
    *res = '\0';
    for (; i >= 0; i--) {
	dst[i] = n % 10ULL + '0';
	n /= 10ULL;
    }
    return res - dst;
}

// Assembly:
movq %rdi, %rax
leaq -0x1(%rdi), %r8
xorl %ecx, %ecx
movl $0x0, %edi
cmpq $0x9, %r8
jb 0x2744
movabsq $-0x7538dcfb76180000, %rdi # imm = 0x8AC7230489E80000
cmpq %rdi, %rax
jb 0x256a
pushq $0x13
jmp 0x2743
movabsq $-0xde0b6b3a7640000, %rdi # imm = 0xF21F494C589C0000
addq %rax, %rdi
movabsq $0x7ce66c50e2840000, %r8 # imm = 0x7CE66C50E2840000
cmpq %r8, %rdi
jae 0x258d
pushq $0x12
jmp 0x2743
movabsq $-0x16345785d8a0000, %rdi # imm = 0xFE9CBA87A2760000
addq %rax, %rdi
movabsq $0xc7d713b49da0000, %r8 # imm = 0xC7D713B49DA0000
cmpq %r8, %rdi
jae 0x25b0
pushq $0x11
jmp 0x2743
movabsq $-0x2386f26fc10000, %rdi # imm = 0xFFDC790D903F0000
addq %rax, %rdi
movabsq $0x13fbe85edc90000, %r8 # imm = 0x13FBE85EDC90000
cmpq %r8, %rdi
jae 0x25d3
pushq $0x10
jmp 0x2743
movabsq $-0x38d7ea4c68000, %rdi # imm = 0xFFFC72815B398000
addq %rax, %rdi
movabsq $0x1ff973cafa8000, %r8  # imm = 0x1FF973CAFA8000
cmpq %r8, %rdi
jae 0x25f6
pushq $0xf
jmp 0x2743
movabsq $-0x5af3107a4000, %rdi  # imm = 0xFFFFA50CEF85C000
addq %rax, %rdi
movabsq $0x3328b944c4000, %r8   # imm = 0x3328B944C4000
cmpq %r8, %rdi
jae 0x2619
pushq $0xe
jmp 0x2743
movabsq $-0x9184e72a000, %rdi   # imm = 0xFFFFF6E7B18D6000
addq %rax, %rdi
movabsq $0x51dac207a000, %r8    # imm = 0x51DAC207A000
cmpq %r8, %rdi
jae 0x263c
pushq $0xd
jmp 0x2743
movabsq $-0xe8d4a51000, %rdi    # imm = 0xFFFFFF172B5AF000
addq %rax, %rdi
movabsq $0x82f79cd9000, %r8     # imm = 0x82F79CD9000
cmpq %r8, %rdi
jae 0x265f
pushq $0xc
jmp 0x2743
movabsq $-0x174876e800, %rdi    # imm = 0xFFFFFFE8B7891800
addq %rax, %rdi
shrq $0xb, %rdi
cmpq $0x1a3185c5, %rdi       # imm = 0x1A3185C5
jae 0x2680
pushq $0xb
jmp 0x2743
movabsq $-0x2540be400, %rdi     # imm = 0xFFFFFFFDABF41C00
addq %rax, %rdi
shrq $0xa, %rdi
cmpq $0x53d1ac1, %rdi        # imm = 0x53D1AC1
jae 0x26a1
pushq $0xa
jmp 0x2743
leaq -0x3b9aca00(%rax), %rdi
shrq $0x9, %rdi
cmpq $0x10c388d, %rdi        # imm = 0x10C388D
jae 0x26bc
pushq $0x9
jmp 0x2743
leaq -0x5f5e100(%rax), %rdi
cmpq $0x35a4e900, %rdi       # imm = 0x35A4E900
jae 0x26d0
pushq $0x8
jmp 0x2743
leaq -0x989680(%rax), %rdi
cmpq $0x55d4a80, %rdi        # imm = 0x55D4A80
jae 0x26e4
pushq $0x7
jmp 0x2743
leaq -0xf4240(%rax), %rdi
cmpq $0x895440, %rdi         # imm = 0x895440
jae 0x26f8
pushq $0x6
jmp 0x2743
leaq -0x186a0(%rax), %rdi
cmpq $0xdbba0, %rdi          # imm = 0xDBBA0
jae 0x270c
pushq $0x5
jmp 0x2743
leaq -0x2710(%rax), %rdi
cmpq $0x15f90, %rdi          # imm = 0x15F90
jae 0x2720
pushq $0x4
jmp 0x2743
leaq -0x3e8(%rax), %rdi
cmpq $0x2328, %rdi           # imm = 0x2328
jae 0x2734
pushq $0x3
jmp 0x2743
leaq -0x64(%rax), %rdi
cmpq $0x384, %rdi            # imm = 0x384
jae 0x2778
pushq $0x2
popq %rdi
leal 0x2(%rdi), %r8d
cmpq %rdx, %r8
ja 0x2775
movl %edi, %ecx
addq %rsi, %rcx
incq %rcx
movb $0x0, (%rcx)
pushq $0xa
popq %r8
testl %edi, %edi
js 0x2773
xorl %edx, %edx
divq %r8
orb $0x30, %dl
movl %edi, %r9d
movb %dl, (%rsi,%r9)
decl %edi
jmp 0x275c
subl %esi, %ecx
movl %ecx, %eax
retq
leaq -0xa(%rax), %r8
xorl %edi, %edi
cmpq $0x5a, %r8
setb %dil
jmp 0x2744