// File: /workspace/github_c_makefile_star2_O3/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 %r8, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
testq %rdi, %rdi
je 0x9943
movq %r9, %r14
movq %rcx, %rbp
movq %rsi, %r13
movq %rdi, %r12
xorl %r15d, %r15d
movq 0x8(%r12), %rax
movzbl (%rax), %eax
cmpl $0x3b, %eax
je 0x9958
cmpl $0x7b, %eax
je 0x9946
cmpb $0x0, (%r14)
jne 0x9946
testq %rbp, %rbp
je 0x978f
movq 0x20(%rbp), %rcx
testq %rcx, %rcx
cmovneq %rcx, %rbp
jmp 0x9791
xorl %ebp, %ebp
cmpb $0x28, %al
jne 0x97dc
movq 0x18(%r12), %rax
movq 0x8(%rax), %rsi
movq %r13, %rdi
movl $0x3, %edx
xorl %ecx, %ecx
callq 0x603f
testq %rax, %rax
je 0x97bc
movq %rax, %r15
movq 0x20(%r12), %r12
jmp 0x97dc
movq 0x18(%r12), %rax
movq 0x8(%rax), %rdx
movl 0x28(%rax), %ecx
movq %r14, %rdi
leaq 0x910c(%rip), %rsi      # 0x128de
xorl %eax, %eax
callq 0x3200
xorl %r15d, %r15d
cmpb $0x0, (%r14)
je 0x9814
movq %r12, %rbx
movq %rbx, %r12
testq %rbx, %rbx
je 0x9943
movq 0x8(%r12), %rax
cmpb $0x2c, (%rax)
jne 0x9806
cmpb $0x0, (%r14)
jne 0x9806
movq 0x20(%r12), %r12
testq %r12, %r12
jne 0x9759
jmp 0x9943
movq 0x8(%r12), %rax
cmpb $0x5b, (%rax)
jne 0x989d
movq 0x18(%r12), %rax
movq 0x20(%rax), %rdi
movq %r13, %rsi
movq 0x10(%rsp), %rdx
leaq 0x20(%rsp), %rcx
movq %r14, %r8
callq 0x4f62
cmpb $0x0, (%r14)
jne 0x97f1
movl $0x1, %edi
movl $0x20, %esi
callq 0x3130
testq %rax, %rax
je 0x992f
movq %rax, %rbx
movl 0x28(%r12), %eax
movl %eax, (%rbx)
movq 0x30(%rsp), %rax
movq %rax, 0x8(%rbx)
leaq 0x156(%rip), %rax       # 0x99ca
movq %rax, 0x18(%rbx)
movq 0x18(%r12), %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
movq %rbp, %r8
movq %r14, %r9
callq *0x8(%rsp)
testl %eax, %eax
jne 0x9922
movq %rbx, %rdi
jmp 0x98fb
movq 0x20(%r12), %rax
movq 0x8(%rax), %rcx
cmpb $0x3d, (%rcx)
jne 0x9905
movq 0x20(%rax), %rdi
movq %r13, %rsi
movq 0x10(%rsp), %rdx
leaq 0x20(%rsp), %rcx
movq %r14, %r8
callq 0x4f62
cmpb $0x0, (%r14)
jne 0x97f1
movq %rax, %rbx
movq 0x30(%rsp), %rcx
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rcx, 0x18(%rsp)
movq %rbp, %r8
movq %r14, %r9
callq *0x8(%rsp)
testl %eax, %eax
jne 0x97e5
movq 0x18(%rsp), %rdi
callq 0x3af9
jmp 0x97f1
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
movq %rbp, %r8
movq %r14, %r9
callq *0x8(%rsp)
testl %eax, %eax
je 0x97f1
addq $0x20, %r12
movq (%r12), %rbx
jmp 0x97e5
movq 0xf83a(%rip), %rsi      # 0x19170
movq %r14, %rdi
callq 0x3070
jmp 0x97f1
xorl %r12d, %r12d
movq %r12, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x0, (%r14)
jne 0x9946
movq 0x20(%r12), %r12
jmp 0x9946