// File: /workspace/github_c_makefile_star2_O2/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, %r14
movq %rsi, %r15
movq %rdi, %r12
pushq $0x2e
popq %rsi
callq 0x101e0
testq %rax, %rax
jne 0x2a0ca
movq %r12, %rdi
callq 0x101c0
addq %r12, %rax
movq %rax, %r13
pushq $0x2
popq %rbp
subq %r12, %r13
je 0x2a275
movq %r12, 0x8(%rsp)
leaq 0x2839b(%rip), %rcx     # 0x52480
xorl %r12d, %r12d
movq %rbx, 0x18(%rsp)
movq %r14, 0x38(%rsp)
movq %r15, 0x30(%rsp)
cmpq (%rbx), %r12
jae 0x2a290
movq %rax, 0x20(%rsp)
movq %r12, 0x28(%rsp)
movq %rcx, %rax
movq 0x18(%rcx), %rcx
cmpb $0x1, (%rcx)
jne 0x2a17c
movq %rax, 0x40(%rsp)
movl 0x10(%rax), %eax
movq %rax, 0x10(%rsp)
xorl %r12d, %r12d
xorl %ebx, %ebx
cmpq %rbx, 0x10(%rsp)
je 0x2a272
movq %r12, %rax
sarq $0x20, %rax
imulq $0x28, %rax, %rbp
movq %rcx, %r15
movq 0x8(%rcx,%rbp), %r14
movq %r14, %rdi
callq 0x101c0
cmpq %r13, %rax
jne 0x2a167
movq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x100c0
testl %eax, %eax
je 0x2a1dc
incq %rbx
movabsq $0x100000000, %rax      # imm = 0x100000000
addq %rax, %r12
movq %r15, %rcx
jmp 0x2a128
movq %rax, %r13
movq 0x8(%rsp), %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x37d81
cmpq $-0x1, %rax
je 0x2a275
movq %rax, %r12
movq 0x18(%r13), %rax
cmpb $0x0, (%rax)
movl $0x0, %ecx
cmoveq %rax, %rcx
movq (%rbx), %rsi
movq %r14, %rdi
movq %r12, %rdx
callq *0x8(%rcx)
testq %rax, %rax
je 0x2a275
testq %r15, %r15
movq 0x28(%rsp), %rcx
je 0x2a1ce
movq %rax, (%r15,%rcx,8)
movq %r12, (%r14,%rcx,8)
movq %rcx, %r12
movq 0x20(%rsp), %rcx
jmp 0x2a212
movq %r15, %rax
addq %rbp, %rax
movq 0x30(%rsp), %r15
testq %r15, %r15
movq 0x28(%rsp), %r12
je 0x2a1f5
movq %rax, (%r15,%r12,8)
movq 0x38(%rsp), %r14
movq %rbx, (%r14,%r12,8)
cmpq 0x40(%rsp), %rax
movq 0x18(%rsp), %rbx
pushq $0x2
popq %rbp
movq 0x20(%rsp), %rcx
je 0x2a275
cmpq $0x0, 0x20(%rax)
movb (%rcx), %dl
jne 0x2a286
testb %dl, %dl
je 0x2a275
movq %rax, 0x10(%rsp)
movl %ebp, %ebx
movq %r14, %rbp
movq %r15, %r14
movq %rcx, %r15
incq %r15
movq %r15, %rdi
pushq $0x2e
popq %rsi
callq 0x101e0
testq %rax, %rax
jne 0x2a24d
movq %r15, %rdi
callq 0x101c0
addq %r15, %rax
movq %rax, %r13
movq %r15, 0x8(%rsp)
subq %r15, %r13
incq %r12
movq 0x10(%rsp), %rcx
movq %r14, %r15
movq %rbp, %r14
movl %ebx, %ebp
movq 0x18(%rsp), %rbx
jmp 0x2a0f7
pushq $0x2
popq %rbp
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testb %dl, %dl
jne 0x2a275
incq %r12
movq %r12, (%rbx)
xorl %ebp, %ebp
jmp 0x2a275