// File: /workspace/github_c_makefile_star2_O1/martincameron[P]towntalk/towntalk.c
// Function: parse_expression
struct element* parse_expression( struct element *elem,
	struct function *func, struct variables *vars, struct expression *prev, char *message ) {
	struct element *next = elem->next;
	char *value = elem->str.string, chr = value[ 0 ];
	struct local_variable *local;
	enum reference_type type = 0;
	struct operator *oper;
	struct string *decl;
	if( ( chr >= '0' && chr <= '9' ) || ( chr == '-' && ( value[ 1 ] >= '0' && value[ 1 ] <= '9' ) ) ) {
		/* Number literal. */
		next = parse_number_literal_expression( elem, prev, message );
	} else if( chr == '"' ) {
		/* String literal. */
		next = parse_string_literal_expression( elem, prev, message );
	} else if( chr == '$' && value[ 1 ] == 0 ) {
		/* Element literal. */
		next = parse_element_literal_expression( elem, func->env, prev, message );
	} else if( ( chr == '`' || chr == '\'' ) && value[ 1 ] == 0 ) {
		/* Infix operator.*/
		next = parse_infix_expression( elem, func, vars, prev, message );
	} else if( chr == '\'' && value[ 1 ] ) {
		/* Character literal. */
		next = parse_character_literal_expression( elem, prev, message );
	} else if( chr == '\\' && value[ 1 ] == 0 && elem->next && elem->next->str.string[ 0 ] == '"' ) {
		/* Escaped character literal. */
		next = parse_character_literal_expression( elem->next, prev, message );
	} else if( chr == '[' ) {
		/* Array index operator. */
		next = parse_index_expression( elem, func, vars, prev, message );
	} else if( elem->str.length > 128 ) {
		sprintf( message, "Invalid expression '%.64s' on line %d.", value, elem->line );
	} else if( chr == '@' ) {
		if( value[ 1 ] ) {
			/* Function reference operator. */
			next = parse_func_ref_expression( elem, func, prev, message );
		} else {
			/* Recursive function call. */
			next = parse_call_expression( elem, func, vars, func, prev, message );
		}
	} else if( value[ 0 ] == ':' ) {
		if( value[ 1 ] == 0 ) {
			/* Function reference call. */
			next = parse_refcall_expression( elem, func, vars, prev, message );
		} else {
			/* Member function call. */
			next = parse_thiscall_expression( elem, func, vars, prev, message );
		}
	} else {
		local = get_local_variable( func->variable_decls, value, "+-.:" );
		if( local ) {
			/* Local variable reference.*/
			next = parse_local_expression( elem, func, vars, local, prev, message );
		} else {
			local = NULL;
			if( vars ) {
				local = get_local_variable( vars->func->variable_decls, value, ".:" );
			}
			if( local ) {
				/* Captured local variable. */
				next = parse_capture_expression( elem, func, vars, local, prev, message );
			} else {
				oper = get_operator( value, func->env->operators_index[ hash_code( value, 0 ) ] );
				if( oper ) {
					/* Operator. */
					next = parse_operator_expression( elem, oper, func, vars, prev, message );
				} else {
					decl = find_decl( func, value, 0, "!.:" );
					if( decl ) {
						type = decl->type;
					}
					switch( type ) {
						case CONST: case GLOBAL:
							/* Global variable reference.*/
							next = parse_global_expression( elem, func, vars, ( struct global_variable * ) decl, prev, message );
							break;
						case FUNCTION:
							/* Function call.*/
							next = parse_call_expression( elem, func, vars, ( struct function * ) decl, prev, message );
							break;
						case STRUCT:
							/* Structure. */
							next = parse_struct_expression( elem, func, vars, ( struct structure * ) decl, prev, message );
							break;
						default:
							sprintf( message, "Unhandled expression '%.64s' on line %d.", value, elem->line );
							break;
					}
				}
			}
		}
	}
	if( message[ 0 ] == 0 && next && next->str.string[ 0 ] == '(' ) {
		sprintf( message, "Unexpected '(' after expression on line %d.", next->line );
	}
	if( message[ 0 ] ) {
		dispose_expressions( prev->next );
		prev->next = NULL;
	}
	return next;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %r14
movq %rcx, %rbx
movq %rdi, %r15
movq 0x8(%rdi), %r13
movb (%r13), %bpl
leal -0x30(%rbp), %eax
cmpb $0xa, %al
jae 0x5016
movl $0x1, %edi
movl $0x30, %esi
callq 0x3130
testq %rax, %rax
je 0x52d0
movq %rax, %r12
movq %rax, 0x10(%rbx)
movl 0x28(%r15), %eax
movl %eax, (%r12)
movq %r12, %rsi
addq $0x28, %rsi
movq %r13, %rdi
callq 0x4d7d
testl %eax, %eax
je 0x5042
movl 0x28(%r12), %eax
movl %eax, 0x4(%r12)
leaq -0x1542(%rip), %rax     # 0x3aca
movq %rax, 0x18(%r12)
jmp 0x52df
movq %rsi, %r8
movq 0x20(%r15), %r12
movzbl %bpl, %eax
cmpl $0x2c, %eax
jle 0x5079
cmpl $0x5b, %eax
jg 0x513c
cmpl $0x2d, %eax
je 0x5060
cmpl $0x5b, %eax
je 0x51a8
jmp 0x5237
movq 0x8(%r15), %rdx
movl 0x28(%r15), %ecx
leaq 0xd4c3(%rip), %rsi      # 0x12514
movq %r14, %rdi
xorl %eax, %eax
callq 0x3200
jmp 0x52df
movb 0x1(%r13), %cl
addb $-0x30, %cl
cmpb $0x9, %cl
jbe 0x4fc1
cmpl $0x5a, %eax
jg 0x5137
cmpl $0x22, %eax
je 0x5091
cmpl $0x24, %eax
je 0x50ba
cmpl $0x27, %eax
je 0x514a
jmp 0x5237
movq %r13, %rdi
callq 0x419c
testq %rax, %rax
je 0x52d0
movl 0x28(%r15), %esi
movq %rax, %rdi
movq %r14, %rdx
callq 0x81f5
movq %rax, 0x10(%rbx)
jmp 0x52df
cmpb $0x0, 0x1(%r13)
je 0x50d1
cmpl $0x5b, %eax
jg 0x513c
cmpl $0x27, %eax
jne 0x5034
jmp 0x514a
testq %r12, %r12
je 0x5127
movq 0x8(%r12), %rax
cmpb $0x7b, (%rax)
jne 0x5127
movq 0x18(%r12), %rdi
testq %rdi, %rdi
je 0x55da
movq 0x40(%r8), %rax
cmpq $0x0, 0x3a0(%rax)
je 0x5620
callq 0x8253
movq %rax, %rdi
testq %rax, %rax
jne 0x5623
movq 0x14058(%rip), %rsi     # 0x19170
movq %r14, %rdi
callq 0x3070
xorl %edi, %edi
jmp 0x5623
movl 0x28(%r15), %edx
leaq 0xd40d(%rip), %rsi      # 0x1253f
jmp 0x543c
cmpl $0x5b, %eax
je 0x51a8
cmpl $0x5c, %eax
je 0x516d
cmpl $0x60, %eax
jne 0x5237
cmpb $0x0, 0x1(%r13)
je 0x5337
cmpl $0x5c, %eax
je 0x516d
cmpl $0x5b, %eax
je 0x51a8
cmpl $0x27, %eax
jne 0x5237
movq %r15, %rdi
jmp 0x518e
cmpb $0x0, 0x1(%r13)
setne %cl
testq %r12, %r12
sete %sil
orb %cl, %sil
jne 0x519e
movq 0x8(%r12), %rcx
cmpb $0x22, (%rcx)
jne 0x519e
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x570b
jmp 0x55d2
cmpb $0x5b, %bpl
jne 0x5237
movq %rbx, %r13
movq %rdx, %rbx
movq %r8, %rbp
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movl $0x1, %edi
movl $0x20, %esi
callq 0x3130
testq %rax, %rax
je 0x541a
movq %rax, %r12
movq %r13, %rcx
movq %rax, 0x10(%r13)
movl 0x28(%r15), %eax
movl %eax, (%r12)
movq 0x18(%r15), %rdi
movq %r14, (%rsp)
leaq 0x20(%rsp), %r13
leaq 0x1c(%rsp), %r9
movq %rbp, %rsi
movq %rbx, %rdx
movq %rcx, %rbx
xorl %ecx, %ecx
movq %r13, %r8
callq 0x8314
movq 0x10(%r13), %rax
movq %rax, 0x8(%r12)
cmpb $0x0, (%r14)
jne 0x52df
cmpl $0x2, 0x1c(%rsp)
jne 0x54ae
leaq -0x794(%rip), %rax      # 0x4a9e
jmp 0x500c
cmpl $0x81, 0x10(%r15)
jl 0x525e
movl 0x28(%r15), %ecx
leaq 0xd01f(%rip), %rsi      # 0x1226b
movq %r14, %rdi
movq %r13, %rdx
xorl %eax, %eax
callq 0x3200
jmp 0x52e3
cmpl $0x3a, %eax
je 0x544b
cmpl $0x40, %eax
jne 0x546c
cmpb $0x0, 0x1(%r13)
je 0x54c8
movq %r8, %rbp
movl $0x1, %edi
movl $0x28, %esi
callq 0x3130
testq %rax, %rax
je 0x52d0
movq %rax, %r12
incq %r13
movq %rax, 0x10(%rbx)
movl 0x28(%r15), %eax
movl %eax, (%r12)
movq %rbp, %rdi
movq %r13, %rsi
movl $0x6, %edx
xorl %ecx, %ecx
callq 0x6103
movq %rax, 0x20(%r12)
testq %rax, %rax
je 0x552e
leaq 0x313b(%rip), %rax      # 0x8406
jmp 0x500c
movq 0x13e99(%rip), %rsi     # 0x19170
movq %r14, %rdi
callq 0x3070
movq 0x20(%r15), %r12
cmpb $0x0, (%r14)
jne 0x530e
testq %r12, %r12
je 0x530e
movq 0x8(%r12), %rax
cmpb $0x28, (%rax)
jne 0x530e
movl 0x28(%r12), %edx
leaq 0xcfc0(%rip), %rsi      # 0x122c4
movq %r14, %rdi
xorl %eax, %eax
callq 0x3200
cmpb $0x0, (%r14)
je 0x5325
movq 0x10(%rbx), %rdi
callq 0x3b29
movq $0x0, 0x10(%rbx)
movq %r12, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %r12, %r12
je 0x5431
movq 0x8(%r12), %rax
cmpb $0x28, (%rax)
jne 0x5431
cmpq $0x0, 0x18(%r12)
je 0x5431
movq %rdx, 0x10(%rsp)
movq %r8, %rbp
movl 0x10(%r12), %edi
callq 0x36a0
testq %rax, %rax
je 0x551a
movq %rax, %r13
movl 0x28(%r12), %eax
movl %eax, 0x28(%r13)
movq 0x8(%r13), %rdi
movq 0x8(%r12), %rsi
callq 0x3070
movq 0x18(%r12), %rdi
callq 0x8253
movq %rax, 0x18(%r13)
testq %rax, %rax
je 0x560c
movq 0x40(%rbp), %rcx
leaq 0xd0fc(%rip), %rdi      # 0x124ad
movq %rax, %rsi
movq %r12, %rdx
movq %r14, %r8
callq 0x66f3
cmpb $0x0, (%r14)
jne 0x56bd
testq %rax, %rax
je 0x569f
movq %rax, 0x8(%rsp)
movq 0x8(%rax), %rdi
movq 0x8(%r15), %rsi
callq 0x3140
testl %eax, %eax
je 0x569f
movq 0x18(%r13), %rcx
movq %rbp, %rsi
movq 0x10(%rsp), %rdx
movq 0x8(%rsp), %rdi
movq %rcx, %rax
movq 0x20(%rcx), %rcx
cmpq %rdi, %rcx
jne 0x53fd
movq 0x20(%rdi), %rcx
movq %rcx, 0x20(%rax)
movq %r13, 0x20(%rdi)
jmp 0x56aa
movq 0x13d4f(%rip), %rsi     # 0x19170
movq %r14, %rdi
callq 0x3070
movq %r13, %rbx
jmp 0x52df
movl 0x28(%r15), %edx
leaq 0xd44a(%rip), %rsi      # 0x12886
movq %r14, %rdi
xorl %eax, %eax
callq 0x3200
jmp 0x52e3
cmpb $0x0, 0x1(%r13)
je 0x54e1
movq %r15, %rdi
movq %r8, %rsi
movq %rbx, %rcx
movq %r14, %r8
callq 0x59c5
jmp 0x55d2
movq %rdx, 0x10(%rsp)
movq 0x48(%r8), %rdi
leaq 0xce16(%rip), %rdx      # 0x12292
movq %r13, %rsi
movq %r8, 0x8(%rsp)
callq 0x5cf3
testq %rax, %rax
je 0x54f7
movq %r15, %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rax, %rcx
movq %rbx, %r8
movq %r14, %r9
callq 0x5d52
jmp 0x55d2
movl 0x28(%r15), %edx
leaq 0xd0d7(%rip), %rsi      # 0x12590
movq %r14, %rdi
xorl %eax, %eax
callq 0x3200
jmp 0x52df
movq %r15, %rdi
movq %r8, %rsi
movq %r8, %rcx
movq %rbx, %r8
movq %r14, %r9
callq 0x57c0
jmp 0x55d2
movq %r15, %rdi
movq %r8, %rsi
movq %rbx, %rcx
movq %r14, %r8
callq 0x58cf
jmp 0x55d2
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x5544
movq 0x18(%rax), %rax
movq 0x48(%rax), %rdi
leaq 0xcd88(%rip), %rdx      # 0x12298
movq %r13, %rsi
callq 0x5cf3
jmp 0x5546
movq 0x13c4f(%rip), %rsi     # 0x19170
movq %r14, %rdi
callq 0x3070
jmp 0x52e3
movl 0x28(%r15), %ecx
leaq 0xd0a6(%rip), %rsi      # 0x125df
movq %r14, %rdi
movq %r13, %rdx
jmp 0x5054
xorl %eax, %eax
movq 0x8(%rsp), %rsi
testq %rax, %rax
je 0x5568
movq %r15, %rdi
movq 0x10(%rsp), %rdx
movq %rax, %rcx
movq %rbx, %r8
movq %r14, %r9
callq 0x5eb7
jmp 0x55d2
movq 0x40(%rsi), %rax
xorl %ecx, %ecx
testb %bpl, %bpl
je 0x558b
leaq 0x1(%r13), %rdx
movzbl %bpl, %esi
xorl %esi, %ecx
movb (%rdx), %bpl
incq %rdx
testb %bpl, %bpl
jne 0x5577
andl $0x1f, %ecx
movq 0x180(%rax,%rcx,8), %rbp
testq %rbp, %rbp
je 0x55ae
movq (%rbp), %rdi
movq %r13, %rsi
callq 0x3140
testl %eax, %eax
je 0x55ae
movq 0x18(%rbp), %rbp
jmp 0x5593
testq %rbp, %rbp
je 0x563a
movq %r15, %rdi
movq %rbp, %rsi
movq 0x8(%rsp), %rdx
movq 0x10(%rsp), %rcx
movq %rbx, %r8
movq %r14, %r9
callq 0x5fe2
movq %rax, %r12
jmp 0x52e3
movl $0x1, %edi
movl $0x30, %esi
callq 0x3130
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x5686
movl 0x28(%r15), %ecx
movl %ecx, (%rax)
leaq -0x1b39(%rip), %rcx     # 0x3aca
movq %rcx, 0x18(%rax)
jmp 0x5695
movq 0x13b5d(%rip), %rsi     # 0x19170
movq %r14, %rdi
callq 0x3070
jmp 0x56bd
incq (%rdi)
testq %rdi, %rdi
je 0x5695
movl 0x28(%r15), %esi
movq %r14, %rdx
callq 0x81f5
movq %rax, 0x10(%rbx)
jmp 0x5695
leaq 0xcc56(%rip), %rcx      # 0x12297
xorl %ebp, %ebp
movq 0x8(%rsp), %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x6103
testq %rax, %rax
je 0x565b
movsbl 0x14(%rax), %ebp
leal -0x4(%rbp), %ecx
cmpl $0x2, %ecx
movq 0x10(%rsp), %rdx
jb 0x56ca
cmpl $0x3, %ebp
movq 0x8(%rsp), %rsi
je 0x56e5
cmpl $0x6, %ebp
jne 0x56fb
movq %r15, %rdi
movq %rax, %rcx
jmp 0x54d1
movq 0x13ae3(%rip), %rsi     # 0x19170
movq %r14, %rdi
callq 0x3070
movq 0x20(%r12), %r12
jmp 0x52e3
movq %r13, %rdi
movq %rbp, %rsi
movq 0x10(%rsp), %rdx
movq %rdi, %r13
movq %rbx, %rcx
movq %r14, %r8
callq 0x4f9b
movq 0x20(%r12), %r12
movq %r13, %rdi
callq 0x3b6f
jmp 0x52e3
movq %r15, %rdi
movq 0x8(%rsp), %rsi
movq %rax, %rcx
movq %rbx, %r8
movq %r14, %r9
callq 0x62a7
jmp 0x55d2
movq %r15, %rdi
movq %rax, %rcx
movq %rbx, %r8
movq %r14, %r9
callq 0x642c
jmp 0x55d2
movl 0x28(%r15), %ecx
leaq 0xcb95(%rip), %rsi      # 0x1229b
jmp 0x524c