// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/parser.c
// Function: parser_add_child
ParserASTNode * parser_add_child(
	ParserContext *ctx,
	ParserASTNode *node,
	ParserASTNode *child
) {
	assert(ctx);
	assert(node);
	assert(child);

	if (node->nchilds < node->szchilds) {
		node->childs[node->nchilds++] = child;
		return node;
	} else {
		int old_szchilds = node->szchilds;
		int old_size = old_szchilds * sizeof(ParserASTNode *);
		int new_szchilds = old_szchilds == 0 ? 1 : 2 * old_szchilds;
		int new_size = new_szchilds * sizeof(ParserASTNode *);

		ParserASTNode **new_childs = (ParserASTNode **)malloc(new_size);
		if (new_childs == NULL) {
			ctx->alloc_mem_error(ctx);
		}

		ParserASTNode **old_childs = node->childs;
		if (old_childs != NULL) {
			memcpy(new_childs, old_childs, old_size);
			free(old_childs);
		}

		node->childs = new_childs;
		node->childs[node->nchilds++] = child;
		node->szchilds = new_szchilds;

		return node;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xee4d
jmp 0xee6c
leaq 0x3ed0d(%rip), %rdi     # 0x4db61
leaq 0x3e870(%rip), %rsi     # 0x4d6cb
movl $0x137, %edx            # imm = 0x137
leaq 0x38549(%rip), %rcx     # 0x473b0
callq 0xa0b0
cmpq $0x0, -0x18(%rbp)
je 0xee75
jmp 0xee94
leaq 0x3c20b(%rip), %rdi     # 0x4b087
leaq 0x3e848(%rip), %rsi     # 0x4d6cb
movl $0x138, %edx            # imm = 0x138
leaq 0x38521(%rip), %rcx     # 0x473b0
callq 0xa0b0
cmpq $0x0, -0x20(%rbp)
je 0xee9d
jmp 0xeebc
leaq 0x3855f(%rip), %rdi     # 0x47403
leaq 0x3e820(%rip), %rsi     # 0x4d6cb
movl $0x139, %edx            # imm = 0x139
leaq 0x384f9(%rip), %rcx     # 0x473b0
callq 0xa0b0
movq -0x18(%rbp), %rax
movl 0x44(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x40(%rcx), %eax
jge 0xeefb
movq -0x20(%rbp), %rdx
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x18(%rbp), %rsi
movl 0x44(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x44(%rsi)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xefc8
movq -0x18(%rbp), %rax
movl 0x40(%rax), %eax
movl %eax, -0x24(%rbp)
movslq -0x24(%rbp), %rax
shlq $0x3, %rax
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0xef20
movl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xef28
movl -0x24(%rbp), %eax
shll %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x2c(%rbp)
movslq -0x2c(%rbp), %rax
shlq $0x3, %rax
movl %eax, -0x30(%rbp)
movslq -0x30(%rbp), %rdi
callq 0xa130
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0xef5b
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0xef88
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
movslq -0x28(%rbp), %rdx
callq 0xa120
movq -0x40(%rbp), %rdi
callq 0xa1b0
movq -0x38(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x20(%rbp), %rdx
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x18(%rbp), %rsi
movl 0x44(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x44(%rsi)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x2c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x40(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)