// File: /workspace/github_c_makefile_star2_O3/martincameron[P]towntalk/towntalk.c
// Function: parse_struct_declaration
static struct element* parse_struct_declaration( struct element *elem,
	struct function *func, struct variables *vars, struct statement *prev, char *message ) {
	struct string_list *field, *tail;
	struct environment *env = func->env;
	struct element *child, *next = elem->next;
	int qlen = qualify_name( func, next->str.string, next->str.length, NULL );
	struct structure *struc = calloc( 1, sizeof( struct structure ) + sizeof( char ) * ( qlen + 1 ) );
	if( struc ) {
		struc->str.reference_count = 1;
		struc->str.string = ( char * ) &struc[ 1 ];
		qualify_name( func, next->str.string, next->str.length, struc->str.string );
		struc->str.length = qlen;
		struc->str.type = STRUCT;
		tail = add_decl( &struc->str, next->line, env, message );
		if( tail ) {
			next = next->next;
			if( next && next->str.string[ 0 ] == '(' ) {
				child = next->child;
				if( child && child->next == NULL ) {
					struc->super = ( struct structure * ) find_decl( func, child->str.string, STRUCT, NULL );
				}
				if( struc->super && struc->super != struc ) {
					field = struc->super->fields;
					while( field && message[ 0 ] == 0 ) {
						if( append_string_list( &struc->fields, &struc->fields_tail, field->str ) ) {
							struc->length++;
						} else {
							strcpy( message, OUT_OF_MEMORY );
						}
						field = field->next;
					}
					next = next->next;
				} else {
					sprintf( message, "Invalid parent structure on line %d.", next->line );
				}
			}
		}
		if( message[ 0 ] == 0 ) {
			if( next && next->str.string[ 0 ] == '{' ) {
				child = next->child;
				while( child && message[ 0 ] == 0 ) {
					if( add_structure_field( struc, child, message ) ) {
						child = child->next;
						if( child && ( child->str.string[ 0 ] == ',' || child->str.string[ 0 ] == ';' ) ) {
							child = child->next;
						}
					}
				}
				next = next->next;
				if( next && next->str.string[ 0 ] == ';' ) {
					next = next->next;
				}
			} else {
				sprintf( message, "Expected '{' after 'struct' on line %d.", elem->line );
			}
		}
		unref_string( &struc->str );
	} else {
		strcpy( message, OUT_OF_MEMORY );
	}
	return next;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, 0x8(%rsp)
movq %rsi, %r13
movq 0x30(%rsi), %rax
movq %rdi, 0x10(%rsp)
movq 0x20(%rdi), %rbx
movl 0x10(%rbx), %ebp
movl %ebp, %r15d
testq %rax, %rax
je 0x942c
movl 0x10(%rax), %eax
leal (%rax,%rbp), %r15d
incl %r15d
movq 0x40(%r13), %r12
movslq %r15d, %rsi
addq $0x39, %rsi
movl $0x1, %edi
callq 0x3130
testq %rax, %rax
je 0x94f9
movq %rax, %r14
movq $0x1, (%rax)
leaq 0x38(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x8(%rbx), %rsi
movq %r13, %rdi
movl %ebp, %edx
callq 0x7e86
movl %r15d, 0x10(%r14)
movb $0x3, 0x14(%r14)
movl 0x28(%rbx), %esi
movq %r14, %rdi
movq %r12, %rdx
movq 0x8(%rsp), %r15
movq %r15, %rcx
callq 0x3edc
testq %rax, %rax
je 0x956e
movq 0x20(%rbx), %rbx
testq %rbx, %rbx
je 0x950f
movq 0x8(%rbx), %rax
cmpb $0x28, (%rax)
jne 0x956e
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x94cf
cmpq $0x0, 0x20(%rax)
jne 0x94cf
movq 0x8(%rax), %rsi
movq %r13, %rdi
movl $0x3, %edx
xorl %ecx, %ecx
callq 0x603f
movq %rax, 0x30(%r14)
movq 0x30(%r14), %rax
testq %rax, %rax
sete %cl
cmpq %r14, %rax
sete %dl
orb %cl, %dl
je 0x9520
movl 0x28(%rbx), %edx
leaq 0x967e(%rip), %rsi      # 0x12b6b
movq %r15, %rdi
xorl %eax, %eax
callq 0x3200
jmp 0x956e
movq 0xfc70(%rip), %rsi      # 0x19170
movq 0x8(%rsp), %rdi
callq 0x3070
jmp 0x96d8
xorl %ebx, %ebx
cmpb $0x0, (%r15)
jne 0x96d0
jmp 0x96b7
movq 0x20(%rax), %r12
testq %r12, %r12
je 0x956a
leaq 0x20(%r14), %r13
leaq 0x28(%r14), %rbp
cmpb $0x0, (%r15)
jne 0x956a
movq (%r12), %rdx
movq %r13, %rdi
movq %rbp, %rsi
callq 0x7f12
testq %rax, %rax
je 0x9551
incl 0x18(%r14)
jmp 0x9560
movq 0xfc18(%rip), %rsi      # 0x19170
movq %r15, %rdi
callq 0x3070
movq 0x8(%r12), %r12
testq %r12, %r12
jne 0x9531
movq 0x20(%rbx), %rbx
cmpb $0x0, (%r15)
jne 0x96d0
testq %rbx, %rbx
je 0x96b5
movq 0x8(%rbx), %rax
cmpb $0x7b, (%rax)
jne 0x96b7
movq 0x18(%rbx), %r12
testq %r12, %r12
je 0x969d
leaq 0x20(%r14), %r13
movq %r14, %rax
addq $0x28, %rax
movq %rax, 0x10(%rsp)
xorl %eax, %eax
testb %al, %al
jne 0x969d
movq %r12, %rdi
movq %r15, %rsi
callq 0x6dfd
testl %eax, %eax
je 0x966c
movq (%r13), %r15
movq 0x8(%r12), %rbp
testq %r15, %r15
je 0x95ef
movq (%r15), %rax
movq 0x8(%rax), %rdi
movq %rbp, %rsi
callq 0x3140
testl %eax, %eax
je 0x961f
movq 0x8(%r15), %r15
jmp 0x95d1
movq %rbp, %rdi
callq 0x37b3
testq %rax, %rax
je 0x963f
movq %rax, %rbp
movq %r13, %rdi
movq 0x10(%rsp), %rsi
movq %rax, %rdx
callq 0x7f12
testq %rax, %rax
movq 0x8(%rsp), %r15
je 0x9655
incl 0x18(%r14)
jmp 0x9664
movl 0x28(%r12), %ecx
movq 0x8(%rsp), %r15
movq %r15, %rdi
leaq 0x9585(%rip), %rsi      # 0x12bb8
movq %rbp, %rdx
xorl %eax, %eax
callq 0x3200
jmp 0x966c
movq 0xfb2a(%rip), %rsi      # 0x19170
movq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x3070
jmp 0x966c
movq 0xfb14(%rip), %rsi      # 0x19170
movq %r15, %rdi
callq 0x3070
movq %rbp, %rdi
callq 0x394d
movb (%r15), %al
testb %al, %al
jne 0x9694
movq 0x20(%r12), %r12
testq %r12, %r12
je 0x969d
movq 0x8(%r12), %rcx
movzbl (%rcx), %ecx
cmpl $0x3b, %ecx
je 0x968f
cmpl $0x2c, %ecx
jne 0x9694
movq 0x20(%r12), %r12
testq %r12, %r12
jne 0x95ad
movq 0x20(%rbx), %rbx
testq %rbx, %rbx
je 0x96ea
movq 0x8(%rbx), %rax
cmpb $0x3b, (%rax)
jne 0x96d0
movq 0x20(%rbx), %rbx
jmp 0x96d0
xorl %ebx, %ebx
movq 0x10(%rsp), %rax
movl 0x28(%rax), %edx
leaq 0x94ca(%rip), %rsi      # 0x12b90
movq %r15, %rdi
xorl %eax, %eax
callq 0x3200
movq %r14, %rdi
callq 0x394d
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebx, %ebx
jmp 0x96d0