// File: /workspace/github_c_makefile_star2_O1/ebiggers[P]mysh/mysh_param.c
// Function: do_insert_shell_variable
static bool
do_insert_shell_variable(struct param_trie_node *node,
			 const char *name, size_t len, char *value,
			 int value_idx)
{
	while (len--) {
		int slot = trie_get_slot(*name++);
		if (slot < 0)
			return false;
		mysh_assert(slot < ARRAY_SIZE(node->children));
		if (!node->children[slot]) {
			node->children[slot] = xzalloc(sizeof(struct param_trie_node));
			node->children[slot]->parent = node;
			node->children[slot]->parent_child_ptr = &node->children[slot];
			mysh_assert(node->num_children < ARRAY_SIZE(node->children));
			node->num_children++;
		}
		node = node->children[slot];
	}
	free(node->values[value_idx]);
	node->values[value_idx] = value;

	/* If we unset a parameter by inserting NULL, walk up the free and free
	 * any nodes that aren't needed anymore. */
	while (!node_has_values(node) && node->num_children == 0) {
		struct param_trie_node **parent_child_ptr = node->parent_child_ptr;
		struct param_trie_node *parent = node->parent;
		if (parent) {
			free(node);
			*parent_child_ptr = NULL;
			mysh_assert(parent->num_children > 0);
			parent->num_children--;
		} else {
			break;
		}
		node = parent;
	}
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, 0x4(%rsp)
movq %rdx, 0x8(%rsp)
movq %rsi, %rbx
leaq 0x6959(%rip), %r14      # 0xb2c0
xorl %eax, %eax
leaq 0x6ba0(%rip), %rcx      # 0xb510
movq %rdi, 0x10(%rsp)
movq %rax, %r13
cmpq %rax, %rbx
je 0x4a10
cmpb $0x0, 0x6c02(%rip)      # 0xb58a
je 0x4ab6
movzbl (%rdi,%r13), %eax
movsbq (%rax,%rcx), %rbp
testq %rbp, %rbp
js 0x49fe
cmpb $0x3f, %bpl
jae 0x4ad5
leaq (%r14,%rbp,8), %r15
cmpq $0x0, (%r15)
jne 0x49fb
movq %rbx, %r12
movq %rcx, %rbx
movl $0x220, %edi            # imm = 0x220
callq 0x6778
movq %rax, (%r15)
movq %r14, 0x1f8(%rax)
movq (%r15), %rax
movq %r15, 0x200(%rax)
movq 0x218(%r14), %rax
cmpq $0x3f, %rax
jae 0x4af4
incq %rax
movq %rax, 0x218(%r14)
movq %rbx, %rcx
movq %r12, %rbx
movq 0x10(%rsp), %rdi
movq (%r15), %r14
leaq 0x1(%r13), %rax
testb %bpl, %bpl
jns 0x4975
jmp 0x4aa1
movl 0x4(%rsp), %r15d
movq 0x208(%r14,%r15,8), %rdi
callq 0x2050
movq 0x8(%rsp), %rax
movq %rax, 0x208(%r14,%r15,8)
cmpq $0x0, 0x208(%r14)
jne 0x4aa1
movb $0x1, %cl
testb $0x1, %cl
je 0x4a52
movl %ecx, %eax
xorl %ecx, %ecx
cmpq $0x0, 0x210(%r14)
je 0x4a3b
testb $0x1, %al
jne 0x4aa1
cmpq $0x0, 0x218(%r14)
jne 0x4aa1
movq 0x1f8(%r14), %r15
testq %r15, %r15
je 0x4a9c
movq 0x200(%r14), %r12
movq %r14, %rdi
callq 0x2050
movq $0x0, (%r12)
movq 0x218(%r15), %rax
testq %rax, %rax
je 0x4b13
decq %rax
movq %rax, 0x218(%r15)
movq %r15, %r14
testq %r15, %r15
jne 0x4a2f
cmpq %r13, %rbx
sete %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2f32(%rip), %rdi      # 0x79ef
leaq 0x2e12(%rip), %rsi      # 0x78d6
leaq 0x2f44(%rip), %rcx      # 0x7a0f
movl $0x45, %edx
callq 0x2160
leaq 0x2e4c(%rip), %rdi      # 0x7928
leaq 0x2df3(%rip), %rsi      # 0x78d6
leaq 0x2e60(%rip), %rcx      # 0x794a
movl $0x68, %edx
callq 0x2160
leaq 0x2eab(%rip), %rdi      # 0x79a6
leaq 0x2dd4(%rip), %rsi      # 0x78d6
leaq 0x2e41(%rip), %rcx      # 0x794a
movl $0x6d, %edx
callq 0x2160
leaq 0x2ebc(%rip), %rdi      # 0x79d6
leaq 0x2db5(%rip), %rsi      # 0x78d6
leaq 0x2e22(%rip), %rcx      # 0x794a
movl $0x7d, %edx
callq 0x2160