// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/deps/jemalloc/src/util.c
// Function: je_malloc_strtoumax
uintmax_t
malloc_strtoumax(const char *restrict nptr, char **restrict endptr, int base)
{
	uintmax_t ret, digit;
	unsigned b;
	bool neg;
	const char *p, *ns;

	p = nptr;
	if (base < 0 || base == 1 || base > 36) {
		ns = p;
		set_errno(EINVAL);
		ret = UINTMAX_MAX;
		goto label_return;
	}
	b = base;

	/* Swallow leading whitespace and get sign, if any. */
	neg = false;
	while (true) {
		switch (*p) {
		case '\t': case '\n': case '\v': case '\f': case '\r': case ' ':
			p++;
			break;
		case '-':
			neg = true;
			/* Fall through. */
		case '+':
			p++;
			/* Fall through. */
		default:
			goto label_prefix;
		}
	}

	/* Get prefix, if any. */
	label_prefix:
	/*
	 * Note where the first non-whitespace/sign character is so that it is
	 * possible to tell whether any digits are consumed (e.g., "  0" vs.
	 * "  -x").
	 */
	ns = p;
	if (*p == '0') {
		switch (p[1]) {
		case '0': case '1': case '2': case '3': case '4': case '5':
		case '6': case '7':
			if (b == 0)
				b = 8;
			if (b == 8)
				p++;
			break;
		case 'X': case 'x':
			switch (p[2]) {
			case '0': case '1': case '2': case '3': case '4':
			case '5': case '6': case '7': case '8': case '9':
			case 'A': case 'B': case 'C': case 'D': case 'E':
			case 'F':
			case 'a': case 'b': case 'c': case 'd': case 'e':
			case 'f':
				if (b == 0)
					b = 16;
				if (b == 16)
					p += 2;
				break;
			default:
				break;
			}
			break;
		default:
			p++;
			ret = 0;
			goto label_return;
		}
	}
	if (b == 0)
		b = 10;

	/* Convert. */
	ret = 0;
	while ((*p >= '0' && *p <= '9' && (digit = *p - '0') < b)
	    || (*p >= 'A' && *p <= 'Z' && (digit = 10 + *p - 'A') < b)
	    || (*p >= 'a' && *p <= 'z' && (digit = 10 + *p - 'a') < b)) {
		uintmax_t pret = ret;
		ret *= b;
		ret += digit;
		if (ret < pret) {
			/* Overflow. */
			set_errno(ERANGE);
			ret = UINTMAX_MAX;
			goto label_return;
		}
		p++;
	}
	if (neg)
		ret = -ret;

	if (p == ns) {
		/* No conversion performed. */
		set_errno(EINVAL);
		ret = UINTMAX_MAX;
		goto label_return;
	}

label_return:
	if (endptr != NULL) {
		if (p == ns) {
			/* No characters were converted. */
			*endptr = (char *)nptr;
		} else
			*endptr = (char *)p;
	}
	return (ret);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
cmpl $0x1, %edx
sete %al
cmpl $0x25, %edx
setae %cl
orb %al, %cl
pushq $0x16
popq %rbp
je 0x37dad
movq %r14, %r12
movq %r14, %r15
jmp 0x37ece
leaq 0x1(%r14), %r15
movb -0x1(%r15), %al
movzbl %al, %ecx
leal -0x9(%rcx), %esi
cmpl $0x5, %esi
jae 0x37dc5
incq %r15
jmp 0x37db1
cmpl $0x20, %ecx
je 0x37dc0
cmpl $0x2b, %ecx
je 0x37dd8
cmpl $0x2d, %ecx
jne 0x37ddf
movb $0x1, %cl
jmp 0x37dda
xorl %ecx, %ecx
movb (%r15), %al
jmp 0x37de4
decq %r15
xorl %ecx, %ecx
cmpb $0x30, %al
jne 0x37e46
leaq 0x1(%r15), %rsi
movzbl 0x1(%r15), %eax
leal -0x30(%rax), %edi
cmpl $0x8, %edi
jae 0x37e0a
testl %edx, %edx
pushq $0x8
popq %rax
cmovel %eax, %edx
cmpl $0x8, %edx
cmovneq %r15, %rsi
jmp 0x37e49
cmpl $0x58, %eax
je 0x37e18
cmpl $0x78, %eax
jne 0x37ef3
movzbl 0x2(%r15), %eax
addl $-0x30, %eax
cmpl $0x36, %eax
ja 0x37e46
movabsq $0x7e0000007e03ff, %rsi # imm = 0x7E0000007E03FF
btq %rax, %rsi
jae 0x37e46
testl %edx, %edx
pushq $0x10
popq %rax
cmovel %eax, %edx
leaq 0x2(%r15), %rsi
cmpl $0x10, %edx
jmp 0x37e04
movq %r15, %rsi
testl %edx, %edx
pushq $0xa
popq %rax
cmovnel %edx, %eax
xorl %edx, %edx
pushq $0x22
popq %rdi
movb (%rsi), %r8b
leal -0x30(%r8), %r9d
cmpb $0x9, %r9b
ja 0x37e6e
movzbl %r9b, %r8d
cmpl %r8d, %eax
ja 0x37e98
jmp 0x37eb3
leal -0x41(%r8), %r9d
cmpb $0x19, %r9b
ja 0x37e7e
addb $-0x37, %r8b
jmp 0x37e8c
leal -0x61(%r8), %r9d
cmpb $0x19, %r9b
ja 0x37eb3
addb $-0x57, %r8b
movzbl %r8b, %r10d
movl %r8d, %r9d
cmpl %r10d, %eax
jbe 0x37eb3
movzbl %r9b, %r9d
movq %rdx, %r8
imulq %rax, %r8
addq %r9, %r8
cmpq %rdx, %r8
jb 0x37ec9
incq %rsi
movq %r8, %rdx
jmp 0x37e56
movq %rdx, %rax
negq %rax
testb %cl, %cl
cmoveq %rdx, %rax
movq %r15, %r12
cmpq %r15, %rsi
jne 0x37edb
jmp 0x37ece
movl %edi, %ebp
movq %rsi, %r12
callq 0x100a0
movl %ebp, (%rax)
pushq $-0x1
popq %rax
movq %r12, %rsi
testq %rbx, %rbx
je 0x37eea
cmpq %r15, %rsi
cmovneq %rsi, %r14
movq %r14, (%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0x37edb