// File: /workspace/github_c_makefile_star2_O0/martincameron[P]towntalk/towntalk.c
// Function: parse_child_element
static int parse_child_element( char *buffer, int idx, struct element *parent, int depth, char *message ) {
	struct element *elem = NULL;
	int offset = idx, length = 0, line = parent->line, len;
	char *bracket = NULL, chr = '\n';
	if( depth < 1 ) {
		sprintf( message, "Maximum element depth exceeded on line %d.", line );
		return -5;
	}
	while( chr ) {
		chr = buffer[ idx++ ];
		if( chr <= 32 || ( ( chr < '0' || ( chr & 0x1F ) > 26 ) && ( bracket = strchr( "\"#(),;=[]{}", chr ) ) ) ) {
			if( length > 0 ) {
				if( elem == NULL ) {
					elem = new_element( length );
					parent->child = elem;
				} else {
					elem->next = new_element( length );
					elem = elem->next;
				}
				if( elem ) {
					elem->line = line;
					memcpy( elem->str.string, &buffer[ offset ], sizeof( char ) * length );
					/*printf("%d %d %c :%s\n",offset,length,chr,elem->str.string);*/
				} else {
					strcpy( message, OUT_OF_MEMORY );
					return -1;
				}
			}
			if( chr == '\n' || chr == '#' ) {
				while( chr && chr != '\n' ) {
					chr = buffer[ idx++ ];
				}
				line++;
			} else if( chr == ')' || chr == ']' || chr == '}' ) {
				parent->line = line;
				return idx;
			} else if( chr > 32 ) {
				if( chr == '"' ) {
					len = parse_string( buffer, idx - 1, NULL, line, message );
					if( len < 0 ) {
						return len;
					} else {
						len = len - idx + 1;
					}
				} else {
					len = 2;
				}
				if( elem == NULL ) {
					elem = new_element( len );
					parent->child = elem;
				} else {
					elem->next = new_element( len );
					elem = elem->next;
				}
				if( elem ) {
					elem->line = line;
					if( chr == '"' ) {
						idx = parse_string( buffer, idx - 1, elem->str.string, line, message );
						if( idx < 0 ) {
							return idx;
						}
					} else if( chr == '(' || chr == '[' || chr == '{' ) {
						elem->str.string[ 0 ] = bracket[ 0 ];
						elem->str.string[ 1 ] = bracket[ 1 ];
						idx = parse_child_element( buffer, idx, elem, depth - 1, message );
						if( idx > 0 ) {
							/* Exchange line and elem->line. */
							len = elem->line;
							elem->line = line;
							line = len;
							if( buffer[ idx - 1 ] != bracket[ 1 ] ) {
								sprintf( message, "Unclosed element on line %d.", line );
								return -2;
							}
						} else {
							return idx;
						}
					} else {
						elem->str.string[ 0 ] = chr;
						elem->str.string[ 1 ] = 0;
						elem->str.length = 1;
					}
				} else {
					strcpy( message, OUT_OF_MEMORY );
					return -1;
				}
			}
			offset = idx;
			length = 0;
		} else {
			length++;
		}
	}
	return idx;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq %r8, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
movq -0x20(%rbp), %rax
movl 0x28(%rax), %eax
movl %eax, -0x44(%rbp)
movq $0x0, -0x50(%rbp)
movb $0xa, -0x51(%rbp)
cmpl $0x1, -0x24(%rbp)
jge 0xbafc
movq -0x30(%rbp), %rdi
movl -0x44(%rbp), %edx
leaq 0x10415(%rip), %rsi     # 0x1befe
movb $0x0, %al
callq 0x31f0
movl $0xfffffffb, -0x4(%rbp) # imm = 0xFFFFFFFB
jmp 0xbea8
jmp 0xbafe
cmpb $0x0, -0x51(%rbp)
je 0xbea2
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x14(%rbp)
movslq %ecx, %rcx
movb (%rax,%rcx), %al
movb %al, -0x51(%rbp)
movsbl -0x51(%rbp), %eax
cmpl $0x20, %eax
jle 0xbb60
movsbl -0x51(%rbp), %eax
cmpl $0x30, %eax
jl 0xbb42
movsbl -0x51(%rbp), %eax
andl $0x1f, %eax
cmpl $0x1a, %eax
jle 0xbe94
movsbl -0x51(%rbp), %esi
leaq 0x103dc(%rip), %rdi     # 0x1bf29
callq 0x30d0
movq %rax, -0x50(%rbp)
cmpq $0x0, %rax
je 0xbe94
cmpl $0x0, -0x40(%rbp)
jle 0xbbfb
cmpq $0x0, -0x38(%rbp)
jne 0xbb8b
movl -0x40(%rbp), %edi
callq 0x3780
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
jmp 0xbbaa
movl -0x40(%rbp), %edi
callq 0x3780
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0xbbdd
movl -0x44(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x28(%rax)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rsi
movslq -0x3c(%rbp), %rax
addq %rax, %rsi
movslq -0x40(%rbp), %rdx
shlq $0x0, %rdx
callq 0x3170
jmp 0xbbf9
movq -0x30(%rbp), %rdi
movq 0x15578(%rip), %rsi     # 0x21160
callq 0x3070
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xbea8
jmp 0xbbfb
movsbl -0x51(%rbp), %eax
cmpl $0xa, %eax
je 0xbc0d
movsbl -0x51(%rbp), %eax
cmpl $0x23, %eax
jne 0xbc5b
jmp 0xbc0f
movsbl -0x51(%rbp), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x52(%rbp)
je 0xbc2a
movsbl -0x51(%rbp), %eax
cmpl $0xa, %eax
setne %al
movb %al, -0x52(%rbp)
movb -0x52(%rbp), %al
testb $0x1, %al
jne 0xbc33
jmp 0xbc4d
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x14(%rbp)
movslq %ecx, %rcx
movb (%rax,%rcx), %al
movb %al, -0x51(%rbp)
jmp 0xbc0f
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xbe85
movsbl -0x51(%rbp), %eax
cmpl $0x29, %eax
je 0xbc76
movsbl -0x51(%rbp), %eax
cmpl $0x5d, %eax
je 0xbc76
movsbl -0x51(%rbp), %eax
cmpl $0x7d, %eax
jne 0xbc8b
movl -0x44(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x28(%rax)
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xbea8
movsbl -0x51(%rbp), %eax
cmpl $0x20, %eax
jle 0xbe81
movsbl -0x51(%rbp), %eax
cmpl $0x22, %eax
jne 0xbcdd
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
subl $0x1, %esi
movl -0x44(%rbp), %ecx
movq -0x30(%rbp), %r8
xorl %eax, %eax
movl %eax, %edx
callq 0xbec0
movl %eax, -0x48(%rbp)
cmpl $0x0, -0x48(%rbp)
jge 0xbccf
movl -0x48(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xbea8
movl -0x48(%rbp), %eax
subl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0xbce4
movl $0x2, -0x48(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0xbd05
movl -0x48(%rbp), %edi
callq 0x3780
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
jmp 0xbd24
movl -0x48(%rbp), %edi
callq 0x3780
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0xbe66
movl -0x44(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x28(%rax)
movsbl -0x51(%rbp), %eax
cmpl $0x22, %eax
jne 0xbd79
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
subl $0x1, %esi
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdx
movl -0x44(%rbp), %ecx
movq -0x30(%rbp), %r8
callq 0xbec0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0xbd74
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xbea8
jmp 0xbe64
movsbl -0x51(%rbp), %eax
cmpl $0x28, %eax
je 0xbd98
movsbl -0x51(%rbp), %eax
cmpl $0x5b, %eax
je 0xbd98
movsbl -0x51(%rbp), %eax
cmpl $0x7b, %eax
jne 0xbe3e
movq -0x50(%rbp), %rax
movb (%rax), %cl
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movb %cl, (%rax)
movq -0x50(%rbp), %rax
movb 0x1(%rax), %cl
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movb %cl, 0x1(%rax)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x38(%rbp), %rdx
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
movq -0x30(%rbp), %r8
callq 0xba90
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jle 0xbe34
movq -0x38(%rbp), %rax
movl 0x28(%rax), %eax
movl %eax, -0x48(%rbp)
movl -0x44(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x28(%rax)
movl -0x48(%rbp), %eax
movl %eax, -0x44(%rbp)
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
movq -0x50(%rbp), %rcx
movsbl 0x1(%rcx), %ecx
cmpl %ecx, %eax
je 0xbe32
movq -0x30(%rbp), %rdi
movl -0x44(%rbp), %edx
leaq 0x10113(%rip), %rsi     # 0x1bf35
movb $0x0, %al
callq 0x31f0
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0xbea8
jmp 0xbe3c
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xbea8
jmp 0xbe62
movb -0x51(%rbp), %cl
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movb %cl, (%rax)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movb $0x0, 0x1(%rax)
movq -0x38(%rbp), %rax
movl $0x1, 0x10(%rax)
jmp 0xbe64
jmp 0xbe7f
movq -0x30(%rbp), %rdi
movq 0x152ef(%rip), %rsi     # 0x21160
callq 0x3070
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xbea8
jmp 0xbe81
jmp 0xbe83
jmp 0xbe85
movl -0x14(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
jmp 0xbe9d
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0xbafe
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)