// File: /workspace/github_c_makefile_star2_O3/martincameron[P]towntalk/towntalk.c
// Function: validate_syntax
struct element* validate_syntax( char *syntax, struct element *elem,
	struct element *prev, struct environment *env, char *message ) {
	int idx = 1, chr = syntax[ 0 ];
	struct element *next;
	while( message[ 0 ] == 0 ) {
		switch( chr ) {
			case 0:
				return elem;
			case '0': /* List end. */
				if( elem ) {
					sprintf( message, "Unexpected '%.64s' after '%.64s' on line %d.", elem->str.string, prev->str.string, elem->line );
				}
				break;
			case '"': case ',': case ';': case '=': case '{':
				/* Strings, separators or blocks. */
				if( elem && elem->str.string[ 0 ] == chr ) {
					prev = elem;
					elem = elem->next;
				} else {
					sprintf( message, "Expected '%c' after '%.64s' on line %d.", chr, prev->str.string, prev->line );
				}
				break;
			case '(': /* Bracketed function parameter list. */
				if( elem && elem->str.string[ 0 ] == '(' ) {
					if( elem->child ) {
						validate_syntax( "P0", elem->child, elem, env, message );
					}
					prev = elem;
					elem = elem->next;
				} else {
					sprintf( message, "Expected '(' after '%.64s' on line %d.", prev->str.string, prev->line );
				}
				break;
			case '[': /* Index expression. */
				if( elem && elem->str.string[ 0 ] == '[' ) {
					if( elem->child ) {
						validate_syntax( "xx0", elem->child, elem, env, message );
						prev = elem;
						elem = elem->next;
					} else {
						sprintf( message, "Invalid index expression after '%.64s' on line %d.", prev->str.string, elem->line );
					}
				} else {
					sprintf( message, "Expected '[' after '%.64s' on line %d.", prev->str.string, prev->line );
				}
				break;
			case 'c': /* Catch or finally. */
				if( elem && ( is_keyword( elem->str.string, "catch" ) || is_keyword( elem->str.string, "finally" ) ) ) {
					chr = elem->str.string[ 0 ];
					prev = elem;
					elem = elem->next;
					if( strchr( "Cc", chr ) ) {
						if( elem && elem->str.string[ 0 ] == '(' ) {
							validate_syntax( "n0", elem->child, elem, env, message );
							prev = elem->child;
							elem = elem->next;
						}
						if( message[ 0 ] == 0 ) {
							next = validate_syntax( "n", elem, prev, env, message );
							prev = elem;
							elem = next;
						}
					}
					if( message[ 0 ] == 0 ) {
						next = validate_syntax( "{", elem, prev, env, message );
						prev = elem;
						elem = next;
						if( message[ 0 ] == 0 && elem
						&& ( is_keyword( elem->str.string, "catch" ) || is_keyword( elem->str.string, "finally" ) ) ) {
							prev = elem;
							elem = validate_syntax( "c", elem, prev, env, message );
						}
					}
				} else {
					sprintf( message, "Expected 'catch' or 'finally' after '%.64s' on line %d.", prev->str.string, prev->line );
				}
				break;
			case 'f': /* From. */
				if( elem && is_keyword( elem->str.string, "from" ) ) {
					prev = elem;
					elem = elem->next;
				} else {
					sprintf( message, "Expected 'from' after '%.64s' on line %d.", prev->str.string, prev->line );
				}
				break;
			case 'n': /* Name. */
				if( elem && elem->str.string[ 0 ] != ';' ) {
					validate_name( elem, message );
					prev = elem;
					elem = elem->next;
				} else {
					sprintf( message, "Expected name after '%.64s' on line %d.", prev->str.string, prev->line );
				}
				break;
			case 'P': /* Function parameter list. */
				while( message[ 0 ] == 0 && elem ) {
					if( elem && elem->str.string[ 0 ] == '(' ) {
						validate_syntax( "n0", elem->child, elem, env, message );
						prev = elem->child;
						elem = elem->next;
					}
					if( message[ 0 ] == 0 ) {
						next = validate_syntax( "n", elem, prev, env, message );
						prev = elem;
						elem = next;
						if( elem && elem->str.string[ 0 ] == ',' && elem->next ) {
							prev = elem;
							elem = elem->next;
						}
					}
				}
				break;
			case 'x': /* Expression. */
				if( elem && strchr( ",;({", elem->str.string[ 0 ] ) == NULL ) {
					if( elem->str.string[ 0 ] == '[' ) {
						validate_syntax( "[", elem, prev, env, message );
					} else if( elem->str.string[ 0 ] == '\\' && elem->str.string[ 1 ] == 0 ) {
						prev = elem;
						elem = elem->next;
						validate_syntax( "\"", elem, prev, env, message );
					} else if( elem->str.string[ 0 ] == '$' && elem->str.string[ 1 ] == 0 ) {
						prev = elem;
						elem = elem->next;
						validate_syntax( "{", elem, prev, env, message );
					} else if( elem->next && elem->next->str.string[ 0 ] == '(' ) {
						prev = elem;
						elem = elem->next;
					}
					if( elem ) {
						prev = elem;
						elem = elem->next;
						if( syntax[ idx ] == 'x' && elem && elem->str.string[ 0 ] == ',' ) {
							prev = elem;
							elem = elem->next;
						}
					}
				} else {
					sprintf( message, "Expected expression after '%.64s' on line %d.", prev->str.string, prev->line );
				}
				break;
			case 'X': /* Expression list, terminated by '{' or NULL. */
				next = NULL;
				while( message[ 0 ] == 0 && elem && elem->str.string[ 0 ] != '{' ) {
					if( next && elem->str.string[ 0 ] == ',' ) {
						prev = elem;
						elem = elem->next;
					}
					next = validate_syntax( "x", elem, prev, env, message );
					prev = elem;
					elem = next;
				}
				break;
			case 'v': /* Variable declaration. */
				if( elem && elem->str.string[ 0 ] == '(' ) {
					validate_syntax( "n0", elem->child, elem, env, message );
					prev = elem->child;
					elem = elem->next;
				}
				if( message[ 0 ] == 0 ) {
					if( elem && elem->str.string[ 0 ] == '[' ) {
						validate_syntax( "nx0", elem->child, elem, env, message );
						prev = elem->child;
						elem = elem->next;
					} else {
						next = validate_syntax( "n", elem, prev, env, message );
						prev = elem;
						elem = next;
						if( message[ 0 ] == 0 && elem && elem->str.string[ 0 ] == '=' ) {
							prev = elem;
							elem = validate_syntax( "x", elem->next, prev, env, message );
						}
					}
				}
				break;
			case 'V': /* Variable declaration list, terminated by ';' or NULL. */
				next = NULL;
				while( message[ 0 ] == 0 && elem && elem->str.string[ 0 ] != ';' ) {
					if( next && elem->str.string[ 0 ] == ',' ) {
						prev = elem;
						elem = elem->next;
					}
					next = validate_syntax( "v", elem, prev, env, message );
					prev = elem;
					elem = next;
				}
				break;
			case 'A': /* Variable assignment list, terminated by ';' or NULL. */
				next = NULL;
				while( message[ 0 ] == 0 && elem && elem->str.string[ 0 ] != ';' ) {
					if( next && elem->str.string[ 0 ] == ',' ) {
						prev = elem;
						elem = elem->next;
					}
					next = validate_syntax( "x=x", elem, prev, env, message );
					prev = elem;
					elem = next;
				}
				break;
			default: /* Internal error. */
				sprintf( message, "Internal error. Unknown specifier '%c' while parsing line %d.", chr, ( elem ? elem : prev )->line );
		}
		chr = syntax[ idx++ ];
	}
	return elem;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbp
cmpb $0x0, (%r8)
je 0x661d
movq %rbp, %r13
jmp 0x6deb
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r12
movl $0x1, %r15d
movq %rdi, 0x10(%rsp)
movq %rdi, %rcx
movzbl (%rcx), %eax
movsbl %al, %edx
cmpl $0x55, %eax
jle 0x666d
cmpl $0x65, %eax
jle 0x66c0
cmpl $0x75, %eax
jle 0x6928
cmpl $0x76, %eax
je 0x6a06
cmpl $0x78, %eax
je 0x6ad1
cmpl $0x7b, %eax
je 0x68ef
jmp 0x6c6d
cmpl $0x3a, %eax
jg 0x673f
cmpl $0x2b, %eax
jg 0x68b5
cmpl $0x22, %eax
je 0x68ef
cmpl $0x28, %eax
jne 0x6c65
testq %rbp, %rbp
je 0x6b65
movq 0x8(%rbp), %rax
cmpb $0x28, (%rax)
jne 0x6b65
movq 0x18(%rbp), %rsi
testq %rsi, %rsi
je 0x68fc
leaq 0xbc92(%rip), %rdi      # 0x1234d
jmp 0x69f3
cmpl $0x5a, %eax
jg 0x675f
cmpl $0x56, %eax
je 0x6965
cmpl $0x58, %eax
jne 0x6c6d
testq %rbp, %rbp
je 0x6dd1
xorl %ecx, %ecx
movq 0x8(%rbp), %rax
movb (%rax), %al
cmpb $0x7b, %al
je 0x6dd3
cmpb $0x2c, %al
setne %al
notb %cl
orb %al, %cl
testb $0x1, %cl
jne 0x670b
movq 0x20(%rbp), %r12
movq %rbp, %rdx
jmp 0x6711
movq %r12, %rdx
movq %rbp, %r12
leaq 0xbd9a(%rip), %rdi      # 0x124b2
movq %r12, %rsi
movq %r14, %rcx
movq %rbx, %r8
callq 0x65fe
movq %rax, %rbp
movb (%rbx), %al
testb %al, %al
jne 0x6dd5
movb $0x1, %cl
testq %rbp, %rbp
jne 0x66e6
jmp 0x6dd5
cmpl $0x40, %eax
jg 0x680c
cmpl $0x3b, %eax
je 0x68ef
cmpl $0x3d, %eax
je 0x68ef
jmp 0x6c6d
cmpl $0x5b, %eax
je 0x69c9
cmpl $0x63, %eax
jne 0x6c6d
testq %rbp, %rbp
je 0x6b7e
movq 0x8(%rbp), %r13
movq %r13, %rdi
leaq 0xbc4d(%rip), %rsi      # 0x123d5
callq 0x65ba
testl %eax, %eax
jne 0x67a8
movq %r13, %rdi
leaq 0xbc40(%rip), %rsi      # 0x123db
callq 0x65ba
testl %eax, %eax
je 0x6b7e
movzbl (%r13), %eax
movq 0x20(%rbp), %r12
testl %eax, %eax
je 0x67c3
cmpl $0x63, %eax
je 0x67c3
cmpl $0x43, %eax
jne 0x6cc2
testq %r12, %r12
je 0x6c90
movq 0x8(%r12), %rax
cmpb $0x28, (%rax)
jne 0x6c95
movq 0x18(%r12), %rsi
leaq 0xbbfd(%rip), %rdi      # 0x123e3
movq %r12, %rdx
movq %r14, %rcx
movq %rbx, %r8
callq 0x65fe
movq 0x20(%r12), %r13
cmpb $0x0, (%rbx)
jne 0x6deb
movq 0x18(%r12), %rbp
jmp 0x6c98
cmpl $0x41, %eax
je 0x6a6d
cmpl $0x50, %eax
jne 0x6c6d
testq %rbp, %rbp
je 0x6dd1
movq 0x8(%rbp), %rax
cmpb $0x28, (%rax)
jne 0x6856
movq 0x18(%rbp), %rsi
leaq 0xbba8(%rip), %rdi      # 0x123e3
movq %rbp, %rdx
movq %r14, %rcx
movq %rbx, %r8
callq 0x65fe
movq 0x18(%rbp), %r12
movq 0x20(%rbp), %rbp
cmpb $0x0, (%rbx)
jne 0x689d
leaq 0xc6ab(%rip), %rdi      # 0x12f08
movq %rbp, %rsi
movq %r12, %rdx
movq %r14, %rcx
movq %rbx, %r8
callq 0x65fe
testq %rax, %rax
je 0x6dce
movq 0x8(%rax), %rcx
cmpb $0x2c, (%rcx)
jne 0x6897
movq 0x20(%rax), %rcx
testq %rcx, %rcx
cmovneq %rax, %rbp
cmoveq %rax, %rcx
movq %rbp, %r12
movq %rcx, %rbp
jmp 0x689d
movq %rbp, %r12
movq %rax, %rbp
movb (%rbx), %al
testb %al, %al
jne 0x6dd5
testq %rbp, %rbp
jne 0x6827
jmp 0x6dd5
cmpl $0x2c, %eax
je 0x68ef
cmpl $0x30, %eax
jne 0x6c6d
testq %rbp, %rbp
je 0x6dd1
movq 0x8(%rbp), %rdx
movq 0x8(%r12), %rcx
movl 0x28(%rbp), %r8d
movq %rbx, %rdi
leaq 0xba15(%rip), %rsi      # 0x122f8
xorl %eax, %eax
callq 0x3200
jmp 0x6dd3
testq %rbp, %rbp
je 0x6908
movq 0x8(%rbp), %rcx
cmpb %al, (%rcx)
jne 0x6908
movq %rbp, %r12
movq 0x20(%rbp), %rbp
jmp 0x6dd3
movq 0x8(%r12), %rcx
movl 0x28(%r12), %r8d
movq %rbx, %rdi
leaq 0xba09(%rip), %rsi      # 0x12325
xorl %eax, %eax
callq 0x3200
jmp 0x6dd3
cmpl $0x66, %eax
je 0x6b16
cmpl $0x6e, %eax
jne 0x6c6d
testq %rbp, %rbp
je 0x694c
movq 0x8(%rbp), %rax
cmpb $0x3b, (%rax)
jne 0x6bc9
movq 0x8(%r12), %rdx
movl 0x28(%r12), %ecx
movq %rbx, %rdi
leaq 0xbaed(%rip), %rsi      # 0x1244d
jmp 0x6d53
testq %rbp, %rbp
je 0x6dd1
xorl %ecx, %ecx
movq 0x8(%rbp), %rax
movb (%rax), %al
cmpb $0x3b, %al
je 0x6dd3
cmpb $0x2c, %al
setne %al
notb %cl
orb %al, %cl
testb $0x1, %cl
jne 0x6995
movq 0x20(%rbp), %r12
movq %rbp, %rdx
jmp 0x699b
movq %r12, %rdx
movq %rbp, %r12
leaq 0xc5a5(%rip), %rdi      # 0x12f47
movq %r12, %rsi
movq %r14, %rcx
movq %rbx, %r8
callq 0x65fe
movq %rax, %rbp
movb (%rbx), %al
testb %al, %al
jne 0x6dd5
movb $0x1, %cl
testq %rbp, %rbp
jne 0x6970
jmp 0x6dd5
testq %rbp, %rbp
je 0x6b4c
movq 0x8(%rbp), %rax
cmpb $0x5b, (%rax)
jne 0x6b4c
movq 0x18(%rbp), %rsi
testq %rsi, %rsi
je 0x6d41
leaq 0xb984(%rip), %rdi      # 0x12377
movq %rbp, %rdx
movq %r14, %rcx
movq %rbx, %r8
callq 0x65fe
jmp 0x68fc
testq %rbp, %rbp
je 0x6a4b
movq 0x8(%rbp), %rax
cmpb $0x28, (%rax)
jne 0x6b97
movq 0x18(%rbp), %rsi
leaq 0xb9c0(%rip), %rdi      # 0x123e3
movq %rbp, %rdx
movq %r14, %rcx
movq %rbx, %r8
callq 0x65fe
movq 0x20(%rbp), %r13
cmpb $0x0, (%rbx)
jne 0x6deb
movq 0x18(%rbp), %r12
testq %r13, %r13
jne 0x6b9a
leaq 0xc4b6(%rip), %rdi      # 0x12f08
xorl %esi, %esi
movq %r12, %rdx
movq %r14, %rcx
movq %rbx, %r8
callq 0x65fe
movq %rax, %rbp
xorl %r13d, %r13d
jmp 0x6bf4
testq %rbp, %rbp
je 0x6dd1
xorl %ecx, %ecx
movq 0x8(%rbp), %rax
movb (%rax), %al
cmpb $0x3b, %al
je 0x6dd3
cmpb $0x2c, %al
setne %al
notb %cl
orb %al, %cl
testb $0x1, %cl
jne 0x6a9d
movq 0x20(%rbp), %r12
movq %rbp, %rdx
jmp 0x6aa3
movq %r12, %rdx
movq %rbp, %r12
leaq 0xba06(%rip), %rdi      # 0x124b0
movq %r12, %rsi
movq %r14, %rcx
movq %rbx, %r8
callq 0x65fe
movq %rax, %rbp
movb (%rbx), %al
testb %al, %al
jne 0x6dd5
movb $0x1, %cl
testq %rbp, %rbp
jne 0x6a78
jmp 0x6dd5
testq %rbp, %rbp
je 0x6afd
movq 0x8(%rbp), %r13
movsbl (%r13), %esi
movl $0x5, %edx
leaq 0xb98a(%rip), %rdi      # 0x12475
movl %esi, 0xc(%rsp)
callq 0x3110
testq %rax, %rax
je 0x6c20
movq 0x8(%r12), %rdx
movl 0x28(%r12), %ecx
movq %rbx, %rdi
leaq 0xb96d(%rip), %rsi      # 0x1247e
jmp 0x6d53
testq %rbp, %rbp
je 0x6b33
movq 0x8(%rbp), %rdi
leaq 0xb8f8(%rip), %rsi      # 0x1241e
callq 0x65ba
testl %eax, %eax
jne 0x68fc
movq 0x8(%r12), %rdx
movl 0x28(%r12), %ecx
movq %rbx, %rdi
leaq 0xb8dc(%rip), %rsi      # 0x12423
jmp 0x6d53
movq 0x8(%r12), %rdx
movl 0x28(%r12), %ecx
movq %rbx, %rdi
leaq 0xb84e(%rip), %rsi      # 0x123ae
jmp 0x6d53
movq 0x8(%r12), %rdx
movl 0x28(%r12), %ecx
movq %rbx, %rdi
leaq 0xb7d7(%rip), %rsi      # 0x12350
jmp 0x6d53
movq 0x8(%r12), %rdx
movl 0x28(%r12), %ecx
movq %rbx, %rdi
leaq 0xb854(%rip), %rsi      # 0x123e6
jmp 0x6d53
movq %rbp, %r13
movq 0x8(%r13), %rax
cmpb $0x5b, (%rax)
jne 0x6bd9
movq 0x18(%r13), %rsi
leaq 0xb8fe(%rip), %rdi      # 0x124ac
movq %r13, %rdx
movq %r14, %rcx
movq %rbx, %r8
callq 0x65fe
movq 0x18(%r13), %r12
movq 0x20(%r13), %rbp
jmp 0x6dd3
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x6dfd
jmp 0x68fc
leaq 0xc328(%rip), %rdi      # 0x12f08
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
movq %rbx, %r8
callq 0x65fe
movq %rax, %rbp
movb (%rbx), %al
testb %al, %al
jne 0x6c18
testq %rbp, %rbp
je 0x6c18
movq 0x8(%rbp), %rax
cmpb $0x3d, (%rax)
jne 0x6c5d
movq 0x20(%rbp), %rsi
leaq 0xb89f(%rip), %rdi      # 0x124b2
jmp 0x6d28
movq %r13, %r12
jmp 0x6dd5
movzbl 0xc(%rsp), %eax
cmpl $0x24, %eax
je 0x6da6
cmpl $0x5c, %eax
je 0x6d5c
cmpl $0x5b, %eax
jne 0x6d6a
leaq 0xb833(%rip), %rdi      # 0x1247a
movq %rbp, %rsi
movq %r12, %rdx
movq %r14, %rcx
movq %rbx, %r8
callq 0x65fe
jmp 0x6d7e
movq %r13, %r12
jmp 0x6dd3
testl %eax, %eax
je 0x6615
testq %rbp, %rbp
movq %rbp, %rax
cmoveq %r12, %rax
movl 0x28(%rax), %ecx
movq %rbx, %rdi
leaq 0xb830(%rip), %rsi      # 0x124b4
xorl %eax, %eax
callq 0x3200
jmp 0x6dd3
xorl %r13d, %r13d
jmp 0x6c98
movq %r12, %r13
leaq 0xc269(%rip), %rdi      # 0x12f08
movq %r13, %rsi
movq %rbp, %rdx
movq %r14, %rcx
movq %rbx, %r8
callq 0x65fe
movq %rax, %r12
cmpb $0x0, (%rbx)
movq %r13, %rbp
movq %rax, %r13
jne 0x6deb
leaq 0xb7af(%rip), %rdi      # 0x12478
movq %r12, %rsi
movq %rbp, %rdx
movq %r14, %rcx
movq %rbx, %r8
callq 0x65fe
movq %rax, %rbp
movb (%rbx), %al
testb %al, %al
jne 0x6dd5
testq %rbp, %rbp
je 0x6dd5
movq 0x8(%rbp), %r13
movq %r13, %rdi
leaq 0xb6d7(%rip), %rsi      # 0x123d5
callq 0x65ba
testl %eax, %eax
jne 0x6d1e
movq %r13, %rdi
leaq 0xb6ca(%rip), %rsi      # 0x123db
callq 0x65ba
testl %eax, %eax
je 0x6dd3
leaq 0xbfb9(%rip), %rdi      # 0x12cde
movq %rbp, %rsi
movq %rbp, %rdx
movq %r14, %rcx
movq %rbx, %r8
callq 0x65fe
movq %rbp, %r12
movq %rax, %rbp
jmp 0x6dd3
movq 0x8(%r12), %rdx
movl 0x28(%rbp), %ecx
movq %rbx, %rdi
leaq 0xb628(%rip), %rsi      # 0x1237b
xorl %eax, %eax
callq 0x3200
jmp 0x6dd3
cmpb $0x0, 0x1(%r13)
leaq 0xb714(%rip), %rdi      # 0x1247c
je 0x6db4
movq 0x20(%rbp), %rax
testq %rax, %rax
je 0x6d7e
movq 0x8(%rax), %rcx
cmpb $0x28, (%rcx)
cmoveq %rax, %rbp
movq %rbp, %r12
movq 0x20(%r12), %rbp
movq 0x10(%rsp), %rax
cmpb $0x78, (%rax,%r15)
jne 0x6dd3
testq %rbp, %rbp
je 0x6dd3
movq 0x8(%rbp), %rax
cmpb $0x2c, (%rax)
je 0x68fc
jmp 0x6dd3
cmpb $0x0, 0x1(%r13)
leaq 0xb6c6(%rip), %rdi      # 0x12478
jne 0x6d6a
movq 0x20(%rbp), %r12
movq %r12, %rsi
movq %rbp, %rdx
movq %r14, %rcx
movq %rbx, %r8
callq 0x65fe
testq %r12, %r12
jne 0x6d81
movq %rbp, %r12
xorl %ebp, %ebp
movb (%rbx), %al
movq 0x10(%rsp), %rcx
addq %r15, %rcx
incq %r15
movq %rbp, %r13
testb %al, %al
je 0x6634
movq %r13, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq