// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/deps/jemalloc/src/ctl.c
// Function: ctl_lookup
static int
ctl_lookup(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(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 %rcx, %rbx
movq %rdx, %r15
movq %rsi, 0x8(%rsp)
movq %rdi, %r12
movl $0x2e, %esi
callq 0x101e0
movq %rax, %rcx
testq %rax, %rax
jne 0x2f76a
movq %r12, %rdi
callq 0x101c0
movq %rax, %rcx
addq %r12, %rcx
movq %rcx, %rbp
subq %r12, %rbp
je 0x2f910
cmpq $0x0, (%rbx)
je 0x2f926
leaq 0x26cf9(%rip), %rdx     # 0x56480
xorl %r13d, %r13d
movq %rbx, 0x28(%rsp)
movq %r15, 0x20(%rsp)
movq %r12, 0x10(%rsp)
movq 0x18(%rdx), %rax
movq %rax, 0x18(%rsp)
cmpb $0x1, (%rax)
jne 0x2f81d
movl 0x10(%rdx), %r12d
testq %r12, %r12
je 0x2f910
movq %rdx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %r13, 0x40(%rsp)
xorl %r13d, %r13d
xorl %r14d, %r14d
movq %r13, %rax
sarq $0x20, %rax
leaq (%rax,%rax,4), %rbx
movq 0x18(%rsp), %rax
movq 0x8(%rax,%rbx,8), %r15
movq %r15, %rdi
callq 0x101c0
cmpq %rbp, %rax
jne 0x2f803
movq 0x10(%rsp), %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x100c0
testl %eax, %eax
je 0x2f886
incq %r14
movabsq $0x100000000, %rax      # imm = 0x100000000
addq %rax, %r13
cmpq %r14, %r12
jne 0x2f7c9
jmp 0x2f910
movq %rdx, %r14
movq %rcx, %r12
movq %r13, %rbp
movq 0x10(%rsp), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x3d40a
cmpq $-0x1, %rax
je 0x2f910
movq %rax, %r13
movq 0x18(%r14), %rax
cmpb $0x0, (%rax)
movl $0x0, %ecx
cmoveq %rax, %rcx
movq (%rbx), %rsi
movq %r15, %r14
movq %r15, %rdi
movq %r13, %rdx
callq *0x8(%rcx)
testq %rax, %rax
je 0x2f910
movq %rax, %r15
movq 0x8(%rsp), %rdx
testq %rdx, %rdx
je 0x2f87d
movq %r15, (%rdx,%rbp,8)
movq %r13, (%r14,%rbp,8)
movq %rbp, %r13
jmp 0x2f8bf
movq 0x18(%rsp), %rax
leaq (%rax,%rbx,8), %r15
movq 0x8(%rsp), %rdx
testq %rdx, %rdx
movq 0x40(%rsp), %r13
je 0x2f8a2
movq %r15, (%rdx,%r13,8)
movq 0x20(%rsp), %rax
movq %r14, (%rax,%r13,8)
movq %rax, %r14
cmpq 0x30(%rsp), %r15
movq 0x28(%rsp), %rbx
movq 0x38(%rsp), %r12
je 0x2f910
cmpq $0x0, 0x20(%r15)
movb (%r12), %cl
jne 0x2f917
testb %cl, %cl
je 0x2f910
incq %r12
movq %r12, %rdi
movl $0x2e, %esi
callq 0x101e0
movq %rax, %rcx
testq %rax, %rax
jne 0x2f8f4
movq %r12, %rdi
callq 0x101c0
movq %rax, %rcx
addq %r12, %rcx
movq %rcx, %rbp
subq %r12, %rbp
incq %r13
xorl %eax, %eax
movq %r15, %rdx
cmpq (%rbx), %r13
movq %r14, %r15
jb 0x2f794
jmp 0x2f928
movl $0x2, %eax
jmp 0x2f928
movl $0x2, %eax
testb %cl, %cl
jne 0x2f928
incq %r13
movq %r13, (%rbx)
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq