// File: /workspace/github_c_makefile_star2_O0/goodpaul6[P]generic/script.c
// Function: resolve_symbols
static void resolve_symbols(script_t* script, expr_t* exp)
{
	switch(exp->type)
	{
		case EXP_ATOMIC:
		{
			resolve_symbols(script, exp->atomx);
		} break;
		
		case EXP_DOT: case EXP_COLON:
		{
			resolve_symbols(script, exp->dotx.value);
		} break;
		
		case EXP_STRUCT_NEW:
		{
			for(int i = 0; i < exp->newx.init.length; ++i)
				resolve_symbols(script, vec_get_value(&exp->newx.init, i, expr_t*));
		} break;
		
		case EXP_STRUCT_DECL:
		{
			for(int i = 0; i < exp->struct_tag->ds.members.length; ++i)
			{
				type_tag_member_t* mem = vec_get(&exp->struct_tag->ds.members, i);
				if(mem->default_value)
					resolve_symbols(script, mem->default_value);
			}
		} break;
		
		case EXP_NULL:
		case EXP_EXTERN:
		case EXP_EXTERN_LIST:
		case EXP_NUMBER:
		case EXP_STRING:
		case EXP_CHAR:
		case EXP_BOOL: break;
	
		case EXP_VAR:
		{
			if(exp->varx.decl) return;
			exp->varx.decl = reference_variable(script, exp->varx.name);
			if(!exp->varx.decl) 
			{
				if(reference_function(script, exp->varx.name)) return;
				if(get_type_tag_from_name(script, exp->varx.name)) return;
				error_defer_e(exp, "Attempted to reference undeclared entity '%s'\n", exp->varx.name);
			}
		} break;
		
		case EXP_UNARY:
		{
			resolve_symbols(script, exp->unaryx.rhs);
		} break;
		
		case EXP_BINARY:
		{
			resolve_symbols(script, exp->binx.lhs);
			resolve_symbols(script, exp->binx.rhs);
		} break;
		
		case EXP_PAREN:
		{
			resolve_symbols(script, exp->paren);
		} break;
		
		case EXP_BLOCK:
		{
			for(int i = 0; i < exp->block.length; ++i)
				resolve_symbols(script, vec_get_value(&exp->block, i, expr_t*));
		} break;
		
		case EXP_ARRAY_INDEX:
		{
			resolve_symbols(script, exp->array_index.array);
			resolve_symbols(script, exp->array_index.index);
		} break;
		
		case EXP_ARRAY_LITERAL:
		{
			for(int i = 0; i < exp->array_literal.values.length; ++i)
				resolve_symbols(script, vec_get_value(&exp->array_literal.values, i, expr_t*));
		} break;
		
		case EXP_IF:
		{
			resolve_symbols(script, exp->ifx.cond);
			resolve_symbols(script, exp->ifx.body);
			if(exp->ifx.alt) resolve_symbols(script, exp->ifx.alt);
		} break;
		
		case EXP_WHILE:
		{
			resolve_symbols(script, exp->whilex.cond);
			resolve_symbols(script, exp->whilex.body);
		} break;
		
		case EXP_FOR:
		{
			resolve_symbols(script, exp->forx.init);
			resolve_symbols(script, exp->forx.cond);
			resolve_symbols(script, exp->forx.step);
			resolve_symbols(script, exp->forx.body);
		} break;

		case EXP_RETURN:
		{
			if(exp->retx.value)
				resolve_symbols(script, exp->retx.value);
		} break;
		
		case EXP_CALL:
		{
			for(int i = 0; i < exp->callx.args.length; ++i)
				resolve_symbols(script, vec_get_value(&exp->callx.args, i, expr_t*));
			resolve_symbols(script, exp->callx.func);
		} break;
		
		case EXP_FUNC:
		{
			resolve_symbols(script, exp->funcx.body);
		} break;
		
		case EXP_WRITE:
		{
			resolve_symbols(script, exp->write);
		} break;
		
		case EXP_LEN:
		{
			resolve_symbols(script, exp->len);
		} break;

		default:
			assert(0);
			break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x28(%rax), %eax
movq %rax, -0x38(%rbp)
subq $0x1a, %rax
ja 0xa7a5
movq -0x38(%rbp), %rax
leaq 0x8fcc(%rip), %rcx      # 0x1337c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0xa380
jmp 0xa7c4
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0xa380
jmp 0xa7c4
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x50(%rcx), %rax
jae 0xa42e
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
addq $0x8, %rdi
movslq -0x14(%rbp), %rsi
callq 0x11890
movq -0x40(%rbp), %rdi
movq (%rax), %rsi
callq 0xa380
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xa3ec
jmp 0xa7c4
movl $0x0, -0x18(%rbp)
movslq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x38(%rcx), %rcx
cmpq 0x70(%rcx), %rax
jae 0xa492
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
addq $0x28, %rdi
addq $0x38, %rdi
movslq -0x18(%rbp), %rsi
callq 0x11890
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0xa485
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0xa380
jmp 0xa487
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xa43a
jmp 0xa7c4
jmp 0xa7c4
movq -0x10(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0xa4ac
jmp 0xa7c4
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0x9f10
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x40(%rax)
jne 0xa525
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0x9cb0
cmpq $0x0, %rax
je 0xa4ef
jmp 0xa7c4
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0xa7d0
cmpq $0x0, %rax
je 0xa50b
jmp 0xa7c4
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdx
leaq 0xa288(%rip), %rsi      # 0x147a6
movb $0x0, %al
callq 0xa8e0
jmp 0xa7c4
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0xa380
jmp 0xa7c4
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0xa380
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rsi
callq 0xa380
jmp 0xa7c4
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0xa380
jmp 0xa7c4
movl $0x0, -0x24(%rbp)
movslq -0x24(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x48(%rcx), %rax
jae 0xa5c2
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
movslq -0x24(%rbp), %rsi
callq 0x11890
movq -0x48(%rbp), %rdi
movq (%rax), %rsi
callq 0xa380
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xa584
jmp 0xa7c4
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0xa380
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rsi
callq 0xa380
jmp 0xa7c4
movl $0x0, -0x28(%rbp)
movslq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x50(%rcx), %rax
jae 0xa637
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
addq $0x8, %rdi
movslq -0x28(%rbp), %rsi
callq 0x11890
movq -0x50(%rbp), %rdi
movq (%rax), %rsi
callq 0xa380
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xa5f5
jmp 0xa7c4
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0xa380
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rsi
callq 0xa380
movq -0x10(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0xa67a
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rsi
callq 0xa380
jmp 0xa7c4
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0xa380
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rsi
callq 0xa380
jmp 0xa7c4
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0xa380
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rsi
callq 0xa380
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rsi
callq 0xa380
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rsi
callq 0xa380
jmp 0xa7c4
movq -0x10(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0xa70b
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rsi
callq 0xa380
jmp 0xa7c4
movl $0x0, -0x2c(%rbp)
movslq -0x2c(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x50(%rcx), %rax
jae 0xa759
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
addq $0x8, %rdi
movslq -0x2c(%rbp), %rsi
callq 0x11890
movq -0x58(%rbp), %rdi
movq (%rax), %rsi
callq 0xa380
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xa717
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0xa380
jmp 0xa7c4
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rsi
callq 0xa380
jmp 0xa7c4
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0xa380
jmp 0xa7c4
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0xa380
jmp 0xa7c4
leaq 0x9478(%rip), %rdi      # 0x13c24
leaq 0x9473(%rip), %rsi      # 0x13c26
movl $0xc54, %edx            # imm = 0xC54
leaq 0xa016(%rip), %rcx      # 0x147d5
callq 0x20f0
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)