// File: /workspace/github_c_makefile_star2_O0/goodpaul6[P]generic/script.c
// Function: parse_type_tag
static type_tag_t* parse_type_tag(script_t* script)
{
	type_tag_t* tag = get_type_tag_from_name(script, g_lexeme);
	if(!tag) error_exit_p("Invalid type tag '%s'\n", g_lexeme);
	get_next_token();

	switch(tag->type)
	{
		case TAG_FUNC: // parse argument types and return type
		{
			if(g_cur_tok != TOK_OPENPAREN) error_exit_p("Expected '(' after 'func' in type definition but received '%s'\n", g_token_names[g_cur_tok]);
			get_next_token();
			
			while(g_cur_tok != TOK_CLOSEPAREN)
			{
				type_tag_t* arg_tag = parse_type_tag(script);
				vec_push_back(&tag->func.arg_types, &arg_tag);
				if(g_cur_tok == TOK_COMMA) get_next_token();
				else if(g_cur_tok != TOK_CLOSEPAREN) error_exit_p("Expected ')' at the end of function argument list '%s'\n", g_token_names[g_cur_tok]);
			}
			get_next_token();
			
			if(g_cur_tok != TOK_MINUS) error_exit_p("Expected '-' after ')' but received '%s'\n", g_token_names[g_cur_tok]);
			get_next_token();
			
			tag->func.return_type = parse_type_tag(script);
		} break;
		
		case TAG_ARRAY: // parse contained type
		{
			if(g_cur_tok != TOK_MINUS) error_exit_p("Expected '-' after 'array' but received '%s'\n", g_token_names[g_cur_tok]);
			get_next_token();
			
			tag->contained = parse_type_tag(script);
		} break;
		
		default: break;
	}

	return tag;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
leaq 0xb669(%rip), %rsi      # 0x1a5c0
callq 0xa7d0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xef7c
leaq 0x616e(%rip), %rdi      # 0x150dc
leaq 0xb64b(%rip), %rsi      # 0x1a5c0
movb $0x0, %al
callq 0xa0e0
callq 0xd640
movq -0x10(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x1c(%rbp)
subl $0x6, %eax
je 0xefa3
jmp 0xef92
movl -0x1c(%rbp), %eax
subl $0x7, %eax
je 0xf07e
jmp 0xf0c2
cmpl $0x19, 0xb606(%rip)     # 0x1a5b0
je 0xefcc
movslq 0xb5fd(%rip), %rcx      # 0x1a5b0
leaq 0xb266(%rip), %rax      # 0x1a220
movq (%rax,%rcx,8), %rsi
leaq 0x612e(%rip), %rdi      # 0x150f3
movb $0x0, %al
callq 0xa0e0
callq 0xd640
cmpl $0x1a, 0xb5d8(%rip)     # 0x1a5b0
je 0xf035
movq -0x8(%rbp), %rdi
callq 0xef40
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
leaq -0x18(%rbp), %rsi
callq 0x11960
cmpl $0x1f, 0xb5b1(%rip)     # 0x1a5b0
jne 0xf008
callq 0xd640
jmp 0xf033
cmpl $0x1a, 0xb5a1(%rip)     # 0x1a5b0
je 0xf031
movslq 0xb598(%rip), %rcx      # 0x1a5b0
leaq 0xb201(%rip), %rax      # 0x1a220
movq (%rax,%rcx,8), %rsi
leaq 0x6109(%rip), %rdi      # 0x15133
movb $0x0, %al
callq 0xa0e0
jmp 0xf033
jmp 0xefd1
callq 0xd640
cmpl $0x26, 0xb56f(%rip)     # 0x1a5b0
je 0xf063
movslq 0xb566(%rip), %rcx      # 0x1a5b0
leaq 0xb1cf(%rip), %rax      # 0x1a220
movq (%rax,%rcx,8), %rsi
leaq 0x610f(%rip), %rdi      # 0x1516b
movb $0x0, %al
callq 0xa0e0
callq 0xd640
movq -0x8(%rbp), %rdi
callq 0xef40
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x48(%rax)
jmp 0xf0c4
cmpl $0x26, 0xb52b(%rip)     # 0x1a5b0
je 0xf0a7
movslq 0xb522(%rip), %rcx      # 0x1a5b0
leaq 0xb18b(%rip), %rax      # 0x1a220
movq (%rax,%rcx,8), %rsi
leaq 0x60f5(%rip), %rdi      # 0x15195
movb $0x0, %al
callq 0xa0e0
callq 0xd640
movq -0x8(%rbp), %rdi
callq 0xef40
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
jmp 0xf0c4
jmp 0xf0c4
movq -0x10(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nop