// File: /workspace/github_c_makefile_star2_O2/martincameron[P]towntalk/towntalk.c
// Function: parse_variable_declaration
static struct element* parse_variable_declaration( struct element *elem, struct function *func, struct variables *vars, struct statement *prev,
	int (*add)( struct element *elem, struct function *func, struct structure *type, struct expression *initializer, struct statement *prev, char *message ),
	char *message ) {
	struct structure *type = NULL;
	struct expression expr = { 0 }, *array_expr;
	struct element *next;
	while( elem && elem->str.string[ 0 ] != ';' && elem->str.string[ 0 ] != '{' && message[ 0 ] == 0 ) {
		if( prev && prev->next ) {
			prev = prev->next;
		}
		if( elem->str.string[ 0 ] == '(' ) {
			type = ( struct structure * ) find_decl( func, elem->child->str.string, STRUCT, NULL );
			if( type ) {
				elem = elem->next;
			} else {
				sprintf( message, "Structure '%.64s' not declared on line %d.", elem->child->str.string, elem->child->line );
			}
		}
		if( message[ 0 ] == 0 ) {
			if( elem->str.string[ 0 ] == '[' ) {
				parse_expression( elem->child->next, func, vars, &expr, message );
				if( message[ 0 ] == 0 ) {
					array_expr = calloc( 1, sizeof( struct expression ) );
					if( array_expr ) {
						array_expr->line = elem->line;
						array_expr->parameters = expr.next;
						array_expr->evaluate = evaluate_array_expression;
						if( add( elem->child, func, type, array_expr, prev, message ) ) {
							elem = elem->next;
						} else {
							dispose_expressions( array_expr );
						}
					} else {
						strcpy( message, OUT_OF_MEMORY );
					}
				}
			} else if( elem->next->str.string[ 0 ] == '=' ) {
				next = parse_expression( elem->next->next, func, vars, &expr, message );
				if( message[ 0 ] == 0 ) {
					if( add( elem, func, type, expr.next, prev, message ) ) {
						elem = next;
					} else {
						dispose_expressions( expr.next );
					}
				}
			} else {
				if( add( elem, func, type, NULL, prev, message ) ) {
					elem = elem->next;
				}
			}
		}
		if( elem && elem->str.string[ 0 ] == ',' && message[ 0 ] == 0 ) {
			elem = elem->next;
		}
	}
	if( elem && elem->str.string[ 0 ] == ';' && message[ 0 ] == 0 ) {
		elem = elem->next;
	}
	return elem;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r9, %rbx
movq %r8, 0x8(%rsp)
movq %rcx, %r13
movq %rdx, 0x10(%rsp)
movq %rsi, %r12
movq %rdi, %r15
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rax
movaps %xmm0, 0x10(%rax)
movaps %xmm0, (%rax)
xorl %ebp, %ebp
testq %r15, %r15
je 0x919c
movq 0x8(%r15), %rax
movzbl (%rax), %eax
cmpl $0x3b, %eax
je 0x91a1
cmpl $0x7b, %eax
je 0x91aa
cmpb $0x0, (%rbx)
jne 0x91aa
testq %r13, %r13
je 0x8ffc
movq 0x20(%r13), %rcx
testq %rcx, %rcx
cmovneq %rcx, %r13
jmp 0x8fff
xorl %r13d, %r13d
cmpb $0x28, %al
jne 0x9044
movq 0x18(%r15), %rax
movq 0x8(%rax), %rsi
movq %r12, %rdi
pushq $0x3
popq %rdx
xorl %ecx, %ecx
callq 0x5f5b
testq %rax, %rax
je 0x9026
movq %rax, %rbp
movq 0x20(%r15), %r15
jmp 0x9044
movq 0x18(%r15), %rax
movq 0x8(%rax), %rdx
movl 0x28(%rax), %ecx
movq %rbx, %rdi
leaq 0x88e3(%rip), %rsi      # 0x1191e
xorl %eax, %eax
callq 0x3200
xorl %ebp, %ebp
cmpb $0x0, (%rbx)
je 0x9060
movq %r15, %r14
movl $0x0, %r15d
testq %r14, %r14
jne 0x9177
jmp 0x8fbf
movq 0x8(%r15), %rax
cmpb $0x5b, (%rax)
jne 0x90e1
movq 0x18(%r15), %rax
movq 0x20(%rax), %rdi
movq %r12, %rsi
movq 0x10(%rsp), %rdx
leaq 0x20(%rsp), %rcx
movq %rbx, %r8
callq 0x4d6c
cmpb $0x0, (%rbx)
jne 0x9174
pushq $0x1
popq %rdi
pushq $0x20
popq %rsi
callq 0x3130
testq %rax, %rax
je 0x9165
movq %rax, %r14
movl 0x28(%r15), %eax
movl %eax, (%r14)
movq 0x30(%rsp), %rax
movq %rax, 0x8(%r14)
leaq 0x164(%rip), %rax       # 0x9221
movq %rax, 0x18(%r14)
movq 0x18(%r15), %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq %r14, %rcx
movq %r13, %r8
movq %rbx, %r9
callq *0x8(%rsp)
testl %eax, %eax
jne 0x9159
movq %r14, %rdi
jmp 0x9139
movq 0x20(%r15), %rax
movq 0x8(%rax), %rcx
cmpb $0x3d, (%rcx)
jne 0x9140
movq 0x20(%rax), %rdi
movq %r12, %rsi
movq 0x10(%rsp), %rdx
leaq 0x20(%rsp), %rcx
movq %rbx, %r8
callq 0x4d6c
cmpb $0x0, (%rbx)
jne 0x9174
movq %rax, %r14
movq 0x30(%rsp), %rcx
movq %r15, %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq %rcx, 0x18(%rsp)
movq %r13, %r8
movq %rbx, %r9
callq *0x8(%rsp)
testl %eax, %eax
jne 0x904c
movq 0x18(%rsp), %rdi
callq 0x3a26
jmp 0x9174
movq %r15, %rdi
movq %r12, %rsi
movq %rbp, %rdx
xorl %ecx, %ecx
movq %r13, %r8
movq %rbx, %r9
callq *0x8(%rsp)
testl %eax, %eax
je 0x9174
addq $0x20, %r15
movq (%r15), %r14
jmp 0x904c
movq 0xf004(%rip), %rsi      # 0x18170
movq %rbx, %rdi
callq 0x3070
movq %r15, %r14
movq 0x8(%r14), %rax
cmpb $0x2c, (%rax)
movq %r14, %r15
jne 0x8fbf
cmpb $0x0, (%rbx)
movq %r14, %r15
jne 0x8fbf
movq 0x20(%r14), %r15
jmp 0x8fbf
xorl %r15d, %r15d
jmp 0x91aa
cmpb $0x0, (%rbx)
jne 0x91aa
movq 0x20(%r15), %r15
movq %r15, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq