// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/frontend/symbol_table.c
// Function: subtilis_symbol_table_insert_reg
const subtilis_symbol_t *
subtilis_symbol_table_insert_reg(subtilis_symbol_table_t *st, const char *key,
				 const subtilis_type_t *id_type, size_t reg_num,
				 subtilis_error_t *err)
{
	subtilis_symbol_t *sym;
	size_t size;
	char *key_dup = NULL;

	sym = subtilis_hashtable_find(st->h, key);
	if (sym)
		return sym;

	key_dup = malloc(strlen(key) + 1);
	if (!key_dup) {
		subtilis_error_set_oom(err);
		goto on_error;
	}
	(void)strcpy(key_dup, key);

	size = subtilis_type_if_size(id_type, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto on_error;
	sym = prv_symbol_new(key_dup, reg_num, id_type, NULL, size, true, false,
			     err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto on_error;

	prv_ensure_symbol_level(st, st->level, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto on_error;
	st->levels[st->level].symbols[st->levels[st->level].size++] = sym;

	(void)subtilis_hashtable_insert(st->h, key_dup, sym, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto on_error;

	return sym;

on_error:
	free(key_dup);
	prv_symbol_delete(sym);
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x300(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x3baf0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x3cc70
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3cdca
movq -0x18(%rbp), %rdi
callq 0x120d0
movq %rax, %rdi
addq $0x1, %rdi
callq 0x121b0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x3ccaf
movq -0x30(%rbp), %rdi
movl $0x1, %esi
leaq 0x6e676(%rip), %rdx     # 0xab316
movl $0x195, %ecx            # imm = 0x195
callq 0x158e0
jmp 0x3cdb0
movq -0x48(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x12060
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x47420
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x3ccdb
jmp 0x3cdb0
movq -0x48(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x40(%rbp), %r8
movq -0x30(%rbp), %rax
xorl %ecx, %ecx
movl $0x1, %r9d
xorl %r10d, %r10d
movl $0x0, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x3cde0
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x3cd1d
jmp 0x3cdb0
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x318(%rax), %rsi
movq -0x30(%rbp), %rdx
callq 0x3cf50
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x3cd40
jmp 0x3cdb0
movq -0x38(%rbp), %rdx
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rcx
imulq $0x18, 0x318(%rcx), %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rcx
imulq $0x18, 0x318(%rcx), %rcx
addq %rcx, %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movq 0x300(%rax), %rdi
movq -0x48(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x30(%rbp), %rcx
callq 0x3bbf0
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x3cda6
jmp 0x3cdb0
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3cdca
movq -0x48(%rbp), %rdi
callq 0x12290
movq -0x38(%rbp), %rdi
callq 0x3c260
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)