// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/deps/jemalloc/src/ctl.c
// Function: ctl_lookup
static int
ctl_lookup(tsdn_t *tsdn, const char *name, ctl_node_t const **nodesp,
    size_t *mibp, size_t *depthp)
{
	int ret;
	const char *elm, *tdot, *dot;
	size_t elen, i, j;
	const ctl_named_node_t *node;

	elm = name;
	/* Equivalent to strchrnul(). */
	dot = ((tdot = strchr(elm, '.')) != NULL) ? tdot : strchr(elm, '\0');
	elen = (size_t)((uintptr_t)dot - (uintptr_t)elm);
	if (elen == 0) {
		ret = ENOENT;
		goto label_return;
	}
	node = super_root_node;
	for (i = 0; i < *depthp; i++) {
		assert(node);
		assert(node->nchildren > 0);
		if (ctl_named_node(node->children) != NULL) {
			const ctl_named_node_t *pnode = node;

			/* Children are named. */
			for (j = 0; j < node->nchildren; j++) {
				const ctl_named_node_t *child =
				    ctl_named_children(node, j);
				if (strlen(child->name) == elen &&
				    strncmp(elm, child->name, elen) == 0) {
					node = child;
					if (nodesp != NULL)
						nodesp[i] =
						    (const ctl_node_t *)node;
					mibp[i] = j;
					break;
				}
			}
			if (node == pnode) {
				ret = ENOENT;
				goto label_return;
			}
		} else {
			uintmax_t index;
			const ctl_indexed_node_t *inode;

			/* Children are indexed. */
			index = malloc_strtoumax(elm, NULL, 10);
			if (index == UINTMAX_MAX || index > SIZE_T_MAX) {
				ret = ENOENT;
				goto label_return;
			}

			inode = ctl_indexed_node(node->children);
			node = inode->index(tsdn, mibp, *depthp, (size_t)index);
			if (node == NULL) {
				ret = ENOENT;
				goto label_return;
			}

			if (nodesp != NULL)
				nodesp[i] = (const ctl_node_t *)node;
			mibp[i] = (size_t)index;
		}

		if (node->ctl != NULL) {
			/* Terminal node. */
			if (*dot != '\0') {
				/*
				 * The name contains more elements than are
				 * in this path through the tree.
				 */
				ret = ENOENT;
				goto label_return;
			}
			/* Complete lookup successful. */
			*depthp = i + 1;
			break;
		}

		/* Update elm. */
		if (*dot == '\0') {
			/* No more elements. */
			ret = ENOENT;
			goto label_return;
		}
		elm = &dot[1];
		dot = ((tdot = strchr(elm, '.')) != NULL) ? tdot :
		    strchr(elm, '\0');
		elen = (size_t)((uintptr_t)dot - (uintptr_t)elm);
	}

	ret = 0;
label_return:
	return (ret);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %r14
movq %rcx, (%rsp)
movq %rdx, 0x10(%rsp)
movq %rsi, %rbx
movq %rdi, 0x30(%rsp)
movq %rsi, %rdi
movl $0x2e, %esi
callq 0xb1b0
movq %rax, %r15
testq %rax, %rax
jne 0x27bc5
movq %rbx, %rdi
callq 0xb190
movq %rax, %r15
addq %rbx, %r15
movq %r15, %rcx
movl $0x2, %eax
subq %rbx, %rcx
movq %rcx, 0x28(%rsp)
je 0x27d8d
cmpq $0x0, (%r14)
je 0x27d8b
leaq 0x226f4(%rip), %r13     # 0x4a2e0
xorl %r12d, %r12d
movq %r14, 0x38(%rsp)
movq %rbx, 0x20(%rsp)
movq 0x18(%r13), %rax
cmpb $0x1, (%rax)
jne 0x27cb6
movq %r12, 0x18(%rsp)
movq %r15, 0x40(%rsp)
cmpl $0x0, 0x10(%r13)
movq %r13, 0x8(%rsp)
je 0x27c9b
xorl %ebx, %ebx
movq 0x8(%rsp), %r13
xorl %r12d, %r12d
movq 0x18(%r13), %rax
cmpb $0x0, (%rax)
jne 0x27c31
xorl %eax, %eax
leaq (%rax,%rbx), %r15
testq %rax, %rax
cmoveq %rax, %r15
movq 0x8(%r15), %r14
movq %r14, %rdi
callq 0xb190
movb $0x1, %bpl
movq 0x28(%rsp), %rdx
cmpq %rdx, %rax
jne 0x27c86
movq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0xb0b0
testl %eax, %eax
jne 0x27c86
movq 0x10(%rsp), %rax
testq %rax, %rax
movq 0x18(%rsp), %rcx
je 0x27c79
movq %r15, (%rax,%rcx,8)
movq (%rsp), %rax
movq %r12, (%rax,%rcx,8)
xorl %ebp, %ebp
movq %r15, %r13
testb %bpl, %bpl
je 0x27c9b
incq %r12
movl 0x10(%r13), %eax
addq $0x28, %rbx
cmpq %rax, %r12
jb 0x27c26
cmpq 0x8(%rsp), %r13
movq 0x38(%rsp), %r14
movq 0x40(%rsp), %r15
movq 0x18(%rsp), %r12
jne 0x27d25
jmp 0x27d75
movq %r13, %rbp
xorl %ebx, %ebx
movq 0x20(%rsp), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x35f8a
cmpq $-0x1, %rax
je 0x27d19
movq %rax, %r13
movq 0x18(%rbp), %rax
xorl %ebx, %ebx
cmpb $0x0, (%rax)
cmovneq %rbx, %rax
movq (%r14), %rdx
movq 0x30(%rsp), %rdi
movq (%rsp), %rsi
movq %r13, %rcx
callq *0x8(%rax)
testq %rax, %rax
je 0x27d1e
movq %rax, %rcx
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x27d0a
movq %rcx, (%rax,%r12,8)
movq (%rsp), %rax
movq %r13, (%rax,%r12,8)
movb $0x1, %bl
movq %rcx, %r13
jmp 0x27d21
movq %rbp, %r13
jmp 0x27d21
xorl %r13d, %r13d
testb %bl, %bl
je 0x27d75
cmpq $0x0, 0x20(%r13)
movb (%r15), %al
jne 0x27d7c
testb %al, %al
je 0x27d75
movq %r15, %rbx
incq %rbx
movq %rbx, %rdi
movl $0x2e, %esi
callq 0xb1b0
movq %rax, %r15
testq %rax, %rax
jne 0x27d5c
movq %rbx, %rdi
callq 0xb190
movq %rax, %r15
addq %rbx, %r15
movq %r15, %rax
subq %rbx, %rax
movq %rax, 0x28(%rsp)
incq %r12
cmpq (%r14), %r12
jb 0x27bf4
jmp 0x27d8b
movl $0x2, %eax
jmp 0x27d8d
testb %al, %al
movl $0x2, %eax
jne 0x27d8d
incq %r12
movq %r12, (%r14)
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq