// File: /workspace/github_c_makefile_star2_O3/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
movl $0x16, %ebp
je 0x3d438
movq %r14, %r12
movq %r14, %r15
jmp 0x3d55e
leaq 0x1(%r14), %r15
movb -0x1(%r15), %al
movzbl %al, %ecx
leal -0x9(%rcx), %esi
cmpl $0x5, %esi
jae 0x3d450
incq %r15
jmp 0x3d43c
cmpl $0x20, %ecx
je 0x3d44b
cmpl $0x2b, %ecx
je 0x3d463
cmpl $0x2d, %ecx
jne 0x3d46a
movb $0x1, %cl
jmp 0x3d465
xorl %ecx, %ecx
movb (%r15), %al
jmp 0x3d46f
decq %r15
xorl %ecx, %ecx
cmpb $0x30, %al
jne 0x3d4d5
leaq 0x1(%r15), %rsi
movzbl 0x1(%r15), %eax
leal -0x30(%rax), %edi
cmpl $0x8, %edi
jae 0x3d497
testl %edx, %edx
movl $0x8, %eax
cmovel %eax, %edx
cmpl $0x8, %edx
cmovneq %r15, %rsi
jmp 0x3d4d8
cmpl $0x58, %eax
je 0x3d4a5
cmpl $0x78, %eax
jne 0x3d587
movzbl 0x2(%r15), %eax
addl $-0x30, %eax
cmpl $0x36, %eax
ja 0x3d4d5
movabsq $0x7e0000007e03ff, %rsi # imm = 0x7E0000007E03FF
btq %rax, %rsi
jae 0x3d4d5
testl %edx, %edx
movl $0x10, %eax
cmovel %eax, %edx
leaq 0x2(%r15), %rsi
cmpl $0x10, %edx
jmp 0x3d491
movq %r15, %rsi
testl %edx, %edx
movl $0xa, %eax
cmovnel %edx, %eax
xorl %edx, %edx
movb (%rsi), %dil
leal -0x30(%rdi), %r8d
cmpb $0x9, %r8b
ja 0x3d4fb
movzbl %r8b, %edi
cmpl %edi, %eax
ja 0x3d525
jmp 0x3d540
leal -0x41(%rdi), %r8d
cmpb $0x19, %r8b
ja 0x3d50b
addb $-0x37, %dil
jmp 0x3d519
leal -0x61(%rdi), %r8d
cmpb $0x19, %r8b
ja 0x3d540
addb $-0x57, %dil
movzbl %dil, %r9d
movl %edi, %r8d
cmpl %r9d, %eax
jbe 0x3d540
movzbl %r8b, %r8d
movq %rdx, %rdi
imulq %rax, %rdi
addq %r8, %rdi
cmpq %rdx, %rdi
jb 0x3d556
incq %rsi
movq %rdi, %rdx
jmp 0x3d4e4
movq %rdx, %rax
negq %rax
testb %cl, %cl
cmoveq %rdx, %rax
movq %r15, %r12
cmpq %r15, %rsi
jne 0x3d56f
jmp 0x3d55e
movl $0x22, %ebp
movq %rsi, %r12
callq 0x100a0
movl %ebp, (%rax)
movq $-0x1, %rax
movq %r12, %rsi
testq %rbx, %rbx
je 0x3d57e
cmpq %r15, %rsi
cmovneq %rsi, %r14
movq %r14, (%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0x3d56f