// File: /workspace/github_c_makefile_star2_O1/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:
leaq -0x1(%rdi), %r8
xorl %ecx, %ecx
movl $0x0, %eax
cmpq $0x9, %r8
jb 0x2770
movl $0x13, %eax
movabsq $-0x7538dcfb76180000, %r8 # imm = 0x8AC7230489E80000
cmpq %r8, %rdi
jae 0x2770
movabsq $-0xde0b6b3a7640000, %r8 # imm = 0xF21F494C589C0000
addq %rdi, %r8
movl $0x12, %eax
movabsq $0x7ce66c50e2840000, %r9 # imm = 0x7CE66C50E2840000
cmpq %r9, %r8
jb 0x2770
movabsq $-0x16345785d8a0000, %r8 # imm = 0xFE9CBA87A2760000
addq %rdi, %r8
movl $0x11, %eax
movabsq $0xc7d713b49da0000, %r9 # imm = 0xC7D713B49DA0000
cmpq %r9, %r8
jb 0x2770
movabsq $-0x2386f26fc10000, %r8 # imm = 0xFFDC790D903F0000
addq %rdi, %r8
movl $0x10, %eax
movabsq $0x13fbe85edc90000, %r9 # imm = 0x13FBE85EDC90000
cmpq %r9, %r8
jb 0x2770
movabsq $-0x38d7ea4c68000, %r8  # imm = 0xFFFC72815B398000
addq %rdi, %r8
movl $0xf, %eax
movabsq $0x1ff973cafa8000, %r9  # imm = 0x1FF973CAFA8000
cmpq %r9, %r8
jb 0x2770
movabsq $-0x5af3107a4000, %r8   # imm = 0xFFFFA50CEF85C000
addq %rdi, %r8
movl $0xe, %eax
movabsq $0x3328b944c4000, %r9   # imm = 0x3328B944C4000
cmpq %r9, %r8
jb 0x2770
movabsq $-0x9184e72a000, %r8    # imm = 0xFFFFF6E7B18D6000
addq %rdi, %r8
movl $0xd, %eax
movabsq $0x51dac207a000, %r9    # imm = 0x51DAC207A000
cmpq %r9, %r8
jb 0x2770
movabsq $-0xe8d4a51000, %r8     # imm = 0xFFFFFF172B5AF000
addq %rdi, %r8
movl $0xc, %eax
movabsq $0x82f79cd9000, %r9     # imm = 0x82F79CD9000
cmpq %r9, %r8
jb 0x2770
movabsq $-0x174876e800, %r8     # imm = 0xFFFFFFE8B7891800
addq %rdi, %r8
shrq $0xb, %r8
movl $0xb, %eax
cmpq $0x1a3185c5, %r8        # imm = 0x1A3185C5
jb 0x2770
movabsq $-0x2540be400, %r8      # imm = 0xFFFFFFFDABF41C00
addq %rdi, %r8
shrq $0xa, %r8
movl $0xa, %eax
cmpq $0x53d1ac1, %r8         # imm = 0x53D1AC1
jb 0x2770
leaq -0x3b9aca00(%rdi), %r8
shrq $0x9, %r8
movl $0x9, %eax
cmpq $0x10c388d, %r8         # imm = 0x10C388D
jb 0x2770
leaq -0x5f5e100(%rdi), %r8
movl $0x8, %eax
cmpq $0x35a4e900, %r8        # imm = 0x35A4E900
jb 0x2770
leaq -0x989680(%rdi), %r8
movl $0x7, %eax
cmpq $0x55d4a80, %r8         # imm = 0x55D4A80
jb 0x2770
leaq -0xf4240(%rdi), %r8
movl $0x6, %eax
cmpq $0x895440, %r8          # imm = 0x895440
jb 0x2770
leaq -0x186a0(%rdi), %r8
movl $0x5, %eax
cmpq $0xdbba0, %r8           # imm = 0xDBBA0
jb 0x2770
leaq -0x2710(%rdi), %r8
movl $0x4, %eax
cmpq $0x15f90, %r8           # imm = 0x15F90
jb 0x2770
leaq -0x3e8(%rdi), %r8
movl $0x3, %eax
cmpq $0x2328, %r8            # imm = 0x2328
jb 0x2770
leaq -0x64(%rdi), %r8
movl $0x2, %eax
cmpq $0x384, %r8             # imm = 0x384
jb 0x2770
leaq -0xa(%rdi), %r8
xorl %eax, %eax
cmpq $0x5a, %r8
setb %al
leal 0x2(%rax), %r8d
cmpq %rdx, %r8
ja 0x27b8
movl %eax, %r8d
leaq (%r8,%rsi), %rcx
incq %rcx
movb $0x0, (%rcx)
incq %r8
movabsq $-0x3333333333333333, %r9 # imm = 0xCCCCCCCCCCCCCCCD
movq %rdi, %rax
mulq %r9
shrq $0x3, %rdx
leal (%rdx,%rdx), %eax
leal (%rax,%rax,4), %eax
subl %eax, %edi
orb $0x30, %dil
movb %dil, -0x1(%rsi,%r8)
movq %rdx, %rdi
decq %r8
jg 0x2793
subl %esi, %ecx
movl %ecx, %eax
retq