// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 = (uintmax_t)(-((intmax_t)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 %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
cmpl $0x1, %edx
sete %al
cmpl $0x25, %edx
setae %cl
orb %al, %cl
movq %rdi, %r12
movq %rdi, %r15
je 0x35fcb
callq 0xb080
movl $0x16, (%rax)
movq $-0x1, %rax
jmp 0x3610c
movq %r14, %r15
movzbl (%r15), %eax
leal -0x9(%rax), %ecx
cmpl $0x5, %ecx
jae 0x35fdf
incq %r15
jmp 0x35fce
cmpl $0x20, %eax
je 0x35fda
cmpl $0x2b, %eax
je 0x35ff3
cmpl $0x2d, %eax
jne 0x35ffa
movb $0x1, %sil
jmp 0x35ff5
xorl %esi, %esi
incq %r15
jmp 0x35ffc
xorl %esi, %esi
cmpb $0x30, (%r15)
movq %rbx, 0x8(%rsp)
movl %esi, 0x14(%rsp)
jne 0x3606d
leaq 0x1(%r15), %r12
movzbl 0x1(%r15), %eax
leal -0x30(%rax), %ecx
cmpl $0x8, %ecx
jae 0x3602f
testl %edx, %edx
movl $0x8, %eax
cmovel %eax, %edx
cmpl $0x8, %edx
cmovneq %r15, %r12
jmp 0x36070
cmpl $0x58, %eax
je 0x3603d
cmpl $0x78, %eax
jne 0x3612a
movzbl 0x2(%r15), %eax
addl $-0x30, %eax
cmpl $0x36, %eax
ja 0x3606d
movabsq $0x7e0000007e03ff, %rcx # imm = 0x7E0000007E03FF
btq %rax, %rcx
jae 0x3606d
testl %edx, %edx
movl $0x10, %eax
cmovel %eax, %edx
leaq 0x2(%r15), %r12
cmpl $0x10, %edx
jmp 0x36029
movq %r15, %r12
testl %edx, %edx
movl $0xa, %ebp
cmovnel %edx, %ebp
xorl %ebx, %ebx
movb (%r12), %al
leal -0x30(%rax), %ecx
cmpb $0x9, %cl
ja 0x3608f
movzbl %cl, %edx
cmpl %edx, %ebp
ja 0x360b4
leal -0x41(%rax), %ecx
cmpb $0x19, %cl
ja 0x360a1
leal -0x37(%rax), %ecx
movzbl %cl, %edx
cmpl %edx, %ebp
ja 0x360b4
leal -0x61(%rax), %ecx
cmpb $0x19, %cl
ja 0x360ef
addb $-0x57, %al
movzbl %al, %edx
movl %eax, %ecx
cmpl %edx, %ebp
jbe 0x360ef
movzbl %cl, %eax
movq %rbx, %r13
imulq %rbp, %r13
addq %rax, %r13
cmpq %rbx, %r13
jae 0x360da
callq 0xb080
movl $0x22, (%rax)
movq $-0x1, %rax
jmp 0x360e0
incq %r12
movq %r13, %rax
cmpq %rbx, %r13
movq %rax, %rbx
jae 0x3607c
movq 0x8(%rsp), %rbx
jmp 0x3610c
movq %rbx, %rax
negq %rax
cmpb $0x0, 0x14(%rsp)
cmoveq %rbx, %rax
cmpq %r15, %r12
movq 0x8(%rsp), %rbx
je 0x35fb4
testq %rbx, %rbx
je 0x3611b
cmpq %r15, %r12
cmovneq %r12, %r14
movq %r14, (%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0x360e8