// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl 0x28(%rdx), %eax
testl %ecx, %ecx
jle 0x8d54
movl %esi, %r12d
movq %rdi, %r15
movl %eax, 0xc(%rsp)
movq %r8, 0x18(%rsp)
movq %rdx, 0x40(%rsp)
leaq 0x18(%rdx), %rax
movq %rax, 0x38(%rsp)
decl %ecx
movl %ecx, 0x2c(%rsp)
movq $0x0, 0x20(%rsp)
xorl %ebp, %ebp
movq $0x0, 0x10(%rsp)
movl %esi, %r13d
movq %rdi, 0x30(%rsp)
leal 0x1(%r13), %ebx
movslq %r13d, %rax
movsbl (%r15,%rax), %r14d
cmpl $0x21, %r14d
jl 0x8b33
cmpb $0x30, %r14b
setae %al
movl %r14d, %ecx
andl $0x1f, %ecx
cmpl $0x1b, %ecx
setb %cl
testb %cl, %al
jne 0x8bd1
movl $0xc, %edx
leaq 0x9f3f(%rip), %rdi      # 0x12a5c
movl %r14d, %esi
callq 0x3110
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0x8bc8
testl %ebp, %ebp
jle 0x8b85
movl %ebp, %edi
callq 0x3690
movq %rax, %r15
movq 0x10(%rsp), %rcx
leaq 0x20(%rcx), %rax
testq %rcx, %rcx
cmoveq 0x38(%rsp), %rax
movq %r15, (%rax)
testq %r15, %r15
je 0x8d7c
movl 0xc(%rsp), %eax
movl %eax, 0x28(%r15)
movq 0x8(%r15), %rdi
movslq %r12d, %rsi
movq 0x30(%rsp), %r12
addq %r12, %rsi
movl %ebp, %edx
callq 0x3180
movq %r15, 0x10(%rsp)
movq %r12, %r15
movzbl %r14b, %eax
cmpl $0x22, %eax
jle 0x8b9a
cmpl $0x28, %eax
jg 0x8be7
cmpl $0x23, %eax
je 0x8b9f
jmp 0x8c02
cmpl $0xa, %eax
jne 0x8c02
movslq %ebx, %rax
addq %r15, %rax
testb %r14b, %r14b
je 0x8bbd
movzbl %r14b, %ecx
cmpl $0xa, %ecx
je 0x8bbd
movb (%rax), %r14b
incl %ebx
incq %rax
jmp 0x8ba5
incl 0xc(%rsp)
xorl %ebp, %ebp
movl %ebx, %r12d
jmp 0x8bd6
movq $0x0, 0x20(%rsp)
incl %ebp
movb $0x22, %r14b
movl %ebx, %r13d
testb %r14b, %r14b
jne 0x8ae4
jmp 0x8d92
cmpl $0x29, %eax
je 0x8d6e
cmpl $0x5d, %eax
je 0x8d6e
cmpl $0x7d, %eax
je 0x8d6e
xorl %ebp, %ebp
cmpb $0x21, %r14b
jl 0x8bc3
movl $0x2, %eax
cmpb $0x22, %r14b
jne 0x8c36
movq %r15, %rdi
movl %r13d, %esi
xorl %edx, %edx
movl 0xc(%rsp), %ecx
movq 0x18(%rsp), %r8
callq 0x8dbf
testl %eax, %eax
js 0x8da3
subl %r13d, %eax
movl %eax, %edi
callq 0x3690
movq %rax, %r12
movq 0x10(%rsp), %rcx
leaq 0x20(%rcx), %rax
testq %rcx, %rcx
cmoveq 0x38(%rsp), %rax
movq %r12, (%rax)
testq %r12, %r12
je 0x8d7c
movl 0xc(%rsp), %ecx
movl %ecx, 0x28(%r12)
cmpb $0x22, %r14b
jne 0x8c9c
movq 0x8(%r12), %rdx
movq %r15, %rdi
movl %r13d, %esi
movq 0x18(%rsp), %r8
callq 0x8dbf
movl %eax, %ebx
movb $0x22, %r14b
movq %r12, 0x10(%rsp)
movl %eax, %r12d
testl %eax, %eax
jns 0x8bd6
jmp 0x8d92
cmpb $0x28, %r14b
setne %al
movl %r14d, %ecx
andb $0x5f, %cl
cmpb $0x5b, %cl
setne %cl
testb %cl, %al
jne 0x8d2d
movq 0x20(%rsp), %r13
movb (%r13), %al
movq 0x8(%r12), %rcx
movb %al, (%rcx)
movb 0x1(%r13), %al
movq 0x8(%r12), %rcx
movb %al, 0x1(%rcx)
movq %r15, %rdi
movl %ebx, %esi
movq %r12, %rdx
movl 0x2c(%rsp), %ecx
movq %r15, %r14
movq 0x18(%rsp), %r15
movq %r15, %r8
callq 0x8a8c
movl %eax, %ebx
testl %eax, %eax
jle 0x8d92
movl 0x28(%r12), %edx
movl 0xc(%rsp), %eax
movl %eax, 0x28(%r12)
movl %ebx, %eax
movb -0x1(%r14,%rax), %al
movb $0x22, %r14b
cmpb 0x1(%r13), %al
jne 0x8da7
movq %r12, 0x10(%rsp)
movl %ebx, %r12d
movl %edx, 0xc(%rsp)
movq 0x30(%rsp), %r15
jmp 0x8bd6
movq 0x8(%r12), %rax
movb %r14b, (%rax)
movq 0x8(%r12), %rax
movb $0x0, 0x1(%rax)
movl $0x1, 0x10(%r12)
movb $0x22, %r14b
movq %r12, 0x10(%rsp)
jmp 0x8bc3
leaq 0x9cd6(%rip), %rsi      # 0x12a31
movq %r8, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x3200
movl $0xfffffffb, %ebx       # imm = 0xFFFFFFFB
jmp 0x8d92
movq 0x40(%rsp), %rax
movl 0xc(%rsp), %ecx
movl %ecx, 0x28(%rax)
jmp 0x8d92
movq 0x103ed(%rip), %rsi     # 0x19170
movq 0x18(%rsp), %rdi
callq 0x3070
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %ebx
jmp 0x8d92
leaq 0x9cba(%rip), %rsi      # 0x12a68
movq %r15, %rdi
xorl %eax, %eax
callq 0x3200
movl $0xfffffffe, %ebx       # imm = 0xFFFFFFFE
jmp 0x8d92