// File: /workspace/github_c_makefile_star2_O3/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, 0xc(%rsp)
movq %rdx, 0x10(%rsp)
testq %rsi, %rsi
je 0x4910
movq %rsi, %r14
movq %rdi, %r15
leaq 0x6a49(%rip), %r12      # 0xb2c0
movb 0x6d0d(%rip), %al       # 0xb58a
xorl %r13d, %r13d
leaq 0x6c89(%rip), %rbx      # 0xb510
testb %al, %al
je 0x49b5
movzbl (%r15,%r13), %ecx
movsbq (%rcx,%rbx), %rcx
testq %rcx, %rcx
js 0x49a2
cmpb $0x3f, %cl
jae 0x49d4
movq (%r12,%rcx,8), %rbp
testq %rbp, %rbp
jne 0x48ff
leaq (%r12,%rcx,8), %rbp
movl $0x220, %edi            # imm = 0x220
callq 0x6564
movq %rax, (%rbp)
movq %r12, 0x1f8(%rax)
movq (%rbp), %rax
movq %rbp, 0x200(%rax)
movq 0x218(%r12), %rcx
cmpq $0x3f, %rcx
jae 0x49f3
movb 0x6c9a(%rip), %al       # 0xb58a
incq %rcx
movq %rcx, 0x218(%r12)
movq (%rbp), %rbp
incq %r13
movq %rbp, %r12
cmpq %r13, %r14
jne 0x4887
jmp 0x4917
leaq 0x69a9(%rip), %rbp      # 0xb2c0
movl 0xc(%rsp), %ebx
movq 0x208(%rbp,%rbx,8), %rdi
callq 0x2050
movq 0x10(%rsp), %rax
movq %rax, 0x208(%rbp,%rbx,8)
movb $0x1, %bl
cmpq $0x0, 0x208(%rbp)
jne 0x49a4
jmp 0x4996
cmpq $0x0, 0x218(%rbp)
jne 0x49a4
movq 0x1f8(%rbp), %r14
testq %r14, %r14
je 0x49a4
movq 0x200(%rbp), %r15
movq %rbp, %rdi
callq 0x2050
movq $0x0, (%r15)
movq 0x218(%r14), %rax
testq %rax, %rax
je 0x4a12
decq %rax
movq %rax, 0x218(%r14)
cmpq $0x0, 0x208(%r14)
movq %r14, %rbp
jne 0x49a4
cmpq $0x0, 0x210(%rbp)
je 0x4943
jmp 0x49a4
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3033(%rip), %rdi      # 0x79ef
leaq 0x2f13(%rip), %rsi      # 0x78d6
leaq 0x3045(%rip), %rcx      # 0x7a0f
movl $0x45, %edx
callq 0x2160
leaq 0x2f4d(%rip), %rdi      # 0x7928
leaq 0x2ef4(%rip), %rsi      # 0x78d6
leaq 0x2f61(%rip), %rcx      # 0x794a
movl $0x68, %edx
callq 0x2160
leaq 0x2fac(%rip), %rdi      # 0x79a6
leaq 0x2ed5(%rip), %rsi      # 0x78d6
leaq 0x2f42(%rip), %rcx      # 0x794a
movl $0x6d, %edx
callq 0x2160
leaq 0x2fbd(%rip), %rdi      # 0x79d6
leaq 0x2eb6(%rip), %rsi      # 0x78d6
leaq 0x2f23(%rip), %rcx      # 0x794a
movl $0x7d, %edx
callq 0x2160