// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $-0x1, %rcx
movq %rcx, -0x20(%rbp)
cmpq $0x0, %rax
je 0x5bd8
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movsbl (%rax), %edi
callq 0x6b80
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
jge 0x5aee
movb $0x0, -0x1(%rbp)
jmp 0x5cc7
movslq -0x30(%rbp), %rax
cmpq $0x3f, %rax
jae 0x5afa
jmp 0x5b19
leaq 0x4feb(%rip), %rdi      # 0xaaec
leaq 0x4f92(%rip), %rsi      # 0xaa9a
movl $0x68, %edx
leaq 0x4ffa(%rip), %rcx      # 0xab0e
callq 0x2160
movq -0x10(%rbp), %rax
movslq -0x30(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0x5bc3
movl $0x220, %edi            # imm = 0x220
callq 0x8ea0
movq %rax, %rdx
movq -0x10(%rbp), %rax
movslq -0x30(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x10(%rbp), %rcx
movq -0x10(%rbp), %rax
movslq -0x30(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, 0x1f8(%rax)
movq -0x10(%rbp), %rcx
movslq -0x30(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rcx
movq -0x10(%rbp), %rax
movslq -0x30(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, 0x200(%rax)
movq -0x10(%rbp), %rax
cmpq $0x3f, 0x218(%rax)
jae 0x5b8e
jmp 0x5bad
leaq 0x4fd5(%rip), %rdi      # 0xab6a
leaq 0x4efe(%rip), %rsi      # 0xaa9a
movl $0x6d, %edx
leaq 0x4f66(%rip), %rcx      # 0xab0e
callq 0x2160
movq -0x10(%rbp), %rax
movq 0x218(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x218(%rax)
movq -0x10(%rbp), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x10(%rbp)
jmp 0x5aac
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq 0x208(%rax,%rcx,8), %rdi
callq 0x2050
movq -0x28(%rbp), %rdx
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq %rdx, 0x208(%rax,%rcx,8)
movq -0x10(%rbp), %rdi
callq 0x6be0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x41(%rbp)
jne 0x5c28
movq -0x10(%rbp), %rax
cmpq $0x0, 0x218(%rax)
sete %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0x5c34
jmp 0x5cc3
movq -0x10(%rbp), %rax
movq 0x200(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x1f8(%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x5cb4
movq -0x10(%rbp), %rdi
callq 0x2050
movq -0x38(%rbp), %rax
movq $0x0, (%rax)
movq -0x40(%rbp), %rax
cmpq $0x0, 0x218(%rax)
jbe 0x5c7d
jmp 0x5c9c
leaq 0x4f16(%rip), %rdi      # 0xab9a
leaq 0x4e0f(%rip), %rsi      # 0xaa9a
movl $0x7d, %edx
leaq 0x4e77(%rip), %rcx      # 0xab0e
callq 0x2160
movq -0x40(%rbp), %rax
movq 0x218(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x218(%rax)
jmp 0x5cb6
jmp 0x5cc3
movq -0x40(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x5c01
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)