// File: /workspace/github_c_makefile_star2_O3/martincameron[P]towntalk/ttasm.c
// Function: parse_instructions
static int parse_instructions( struct element *elem, struct function *func, struct instruction *output, struct label *labels, char *message ) {
	int count = 0;
	while( elem ) {
		if( elem->str.string[ elem->str.length - 1 ] == ':' ) {
			if( output == NULL ) {
				labels->next = new_label( elem, count, message );
				labels = labels->next;
				if( labels == NULL ) {
					break;
				}
			}
		} else if( strcmp( elem->str.string, "//" ) ) {
			if( is_keyword( elem->str.string, "let" ) ) {
				if( output ) {
					elem = parse_let( elem, func, &output[ count ], message );
				} else {
					elem = validate_let( elem, message );
				}
				if( elem == NULL ) {
					break;
				}
			} else if( is_keyword( elem->str.string, "jump" ) ) {
				if( output ) {
					elem = parse_jump( elem, func, labels->next, &output[ count ], message );
				} else {
					elem = validate_jump( elem, message );
				}
				if( elem == NULL ) {
					break;
				}
			} else if( is_keyword( elem->str.string, "halt" ) ) {
				if( output ) {
					output[ count ].opcode = HALT;
				}
			} else {
				sprintf( message, "Unrecognized opcode '%.64s' on line %d.", elem->str.string, elem->line );
				break;
			}
			if( elem->next && strcmp( ";", elem->next->str.string ) == 0 ) {
				elem = elem->next;
				count++;
			} else {
				sprintf( message, "Expected ';' after '%.64s' on line %d.", elem->str.string, elem->line );
				break;
			}
		}
		elem = elem->next;
	}
	if( message[ 0 ] ) {
		count = 0;
	} else {
		if( output ) {
			output[ count ].opcode = HALT;
		}
		count++;
	}
	return count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r8, %r14
movq %rcx, 0x28(%rsp)
movq %rdx, %rbp
movq %rsi, 0x10(%rsp)
movl $0x0, %ebx
testq %rdi, %rdi
je 0x1149d
movq %rdi, %r13
xorl %ebx, %ebx
movq %rbp, 0x8(%rsp)
movq 0x8(%r13), %r15
movslq 0x10(%r13), %r12
cmpb $0x3a, -0x1(%r15,%r12)
jne 0x10a67
testq %rbp, %rbp
jne 0x112cf
leaq -0x1(%r12), %rbp
movq %r15, %rdi
movl %ebp, %esi
callq 0x11b9b
testl %eax, %eax
je 0x11385
addq $0x18, %r12
movq %r12, %rdi
callq 0x31b0
testq %rax, %rax
je 0x1139f
movq %rax, %r12
movl %ebx, (%rax)
movq %rax, %rdi
addq $0x18, %rdi
movq %rdi, 0x8(%rax)
movq %r15, %rsi
movq %rbp, %rdx
callq 0x3050
movb $0x0, 0x18(%r12,%rbp)
movq $0x0, 0x10(%r12)
movq 0x28(%rsp), %rax
movq %r12, 0x10(%rax)
movq %r12, 0x28(%rsp)
movq 0x8(%rsp), %rbp
jmp 0x112cf
cmpb $0x2f, (%r15)
jne 0x10a7f
cmpb $0x2f, 0x1(%r15)
jne 0x10a7f
cmpb $0x0, 0x2(%r15)
je 0x112cf
movq %r15, %rdi
leaq 0x21e9(%rip), %rsi      # 0x12c72
callq 0x65ba
testl %eax, %eax
je 0x10b69
testq %rbp, %rbp
je 0x10bda
movslq %ebx, %rax
leaq (%rbp,%rax,8), %rbp
movq 0x20(%r13), %r13
movq 0x8(%r13), %rax
cmpb $0x5b, (%rax)
jne 0x10c7c
movq 0x18(%r13), %r15
testq %r15, %r15
je 0x1134d
movq 0x20(%r15), %rax
testq %rax, %rax
je 0x1134d
cmpq $0x0, 0x20(%rax)
jne 0x1134d
movq 0x10(%rsp), %rax
movq 0x48(%rax), %rdi
movq %r15, %rsi
leaq 0x1566(%rip), %rdx      # 0x12056
movq %r14, %rcx
callq 0x11c1f
testl %eax, %eax
js 0x11466
movb %al, 0x1(%rbp)
movq 0x20(%r15), %rsi
movq 0x8(%rsi), %rdi
movb (%rdi), %al
cmpb $0x2d, %al
setne %cl
addb $-0x30, %al
cmpb $0xa, %al
setae %al
testb %al, %cl
jne 0x10ef0
leaq 0x4(%rbp), %rsi
callq 0x4d47
testl %eax, %eax
je 0x1144a
movq 0x20(%r13), %rax
movq 0x20(%rax), %r13
movq 0x10(%rsp), %rax
movq 0x48(%rax), %rdi
movq %r13, %rsi
leaq 0x1509(%rip), %rdx      # 0x12056
movq %r14, %rcx
callq 0x11c1f
testl %eax, %eax
js 0x11466
movb $0xd, (%rbp)
movb %al, 0x3(%rbp)
jmp 0x1129d
movq 0x8(%r13), %rdi
leaq 0x28bc(%rip), %rsi      # 0x13430
callq 0x65ba
testl %eax, %eax
je 0x10d43
testq %rbp, %rbp
je 0x10e64
movq %rbx, %rax
movq %r14, 0x18(%rsp)
movq 0x28(%rsp), %rcx
movq 0x10(%rcx), %rbp
movq %rbx, 0x20(%rsp)
movslq %eax, %r12
movq 0x20(%r13), %r13
movq 0x8(%r13), %r15
leaq 0x815e(%rip), %r14      # 0x18d10
leaq 0x22fd(%rip), %rsi      # 0x12eb6
movq %r15, %rdi
callq 0x3140
testl %eax, %eax
je 0x10f4f
movq (%r14), %rsi
addq $0x10, %r14
testq %rsi, %rsi
jne 0x10bb9
jmp 0x112e1
movq 0x20(%r13), %rax
testq %rax, %rax
je 0x113fd
movq 0x8(%rax), %rcx
movzbl (%rcx), %ecx
movl %ecx, %edx
andb $-0x21, %dl
addb $-0x41, %dl
cmpb $0x1a, %dl
jb 0x10c08
cmpl $0x5b, %ecx
je 0x10c08
testl %ecx, %ecx
jne 0x113fd
movq 0x20(%rax), %rcx
testq %rcx, %rcx
je 0x11367
movq 0x8(%rcx), %rsi
movzbl (%rsi), %edx
subl $0x3d, %edx
jne 0x10c25
movzbl 0x1(%rsi), %edx
negl %edx
testl %edx, %edx
jne 0x11367
movq 0x20(%rcx), %r13
testq %r13, %r13
je 0x11376
movq 0x8(%r13), %rax
cmpb $0x3b, (%rax)
je 0x11376
movq 0x20(%r13), %rax
testq %rax, %rax
je 0x112ab
movq 0x8(%rax), %rdx
movzbl (%rdx), %ecx
subl $0x28, %ecx
jne 0x10c6f
movzbl 0x1(%rdx), %ecx
subl $0x29, %ecx
jne 0x10c6f
movzbl 0x2(%rdx), %ecx
negl %ecx
testl %ecx, %ecx
cmoveq %rax, %r13
jmp 0x112ab
movq 0x20(%r13), %rax
movq 0x20(%rax), %rcx
movq 0x8(%rcx), %rax
movb (%rax), %al
cmpb $0x5b, %al
jne 0x10d71
movq 0x10(%rsp), %rax
movq 0x48(%rax), %rdi
movq %r13, %rsi
leaq 0x13b1(%rip), %rdx      # 0x12056
movq %r14, %rcx
callq 0x11c1f
testl %eax, %eax
js 0x11466
movb %al, 0x1(%rbp)
movq 0x20(%r13), %rax
movq 0x20(%rax), %r13
movq 0x18(%r13), %r15
testq %r15, %r15
je 0x1134d
movq 0x20(%r15), %rax
testq %rax, %rax
je 0x1134d
cmpq $0x0, 0x20(%rax)
jne 0x1134d
movq 0x10(%rsp), %rax
movq 0x48(%rax), %rdi
movq %r15, %rsi
leaq 0x135e(%rip), %rdx      # 0x12056
movq %r14, %rcx
callq 0x11c1f
testl %eax, %eax
js 0x11466
movb %al, 0x2(%rbp)
movq 0x20(%r15), %rsi
movq 0x8(%rsi), %rdi
movb (%rdi), %al
cmpb $0x2d, %al
setne %cl
addb $-0x30, %al
cmpb $0xa, %al
setae %al
testb %al, %cl
jne 0x1106c
leaq 0x4(%rbp), %rsi
callq 0x4d47
testl %eax, %eax
je 0x1144a
movb $0x9, (%rbp)
jmp 0x11204
movq 0x8(%r13), %rdi
leaq 0x26e7(%rip), %rsi      # 0x13435
callq 0x65ba
testl %eax, %eax
je 0x11436
testq %rbp, %rbp
je 0x112ab
movslq %ebx, %rax
movb $0x0, (%rbp,%rax,8)
jmp 0x112ab
movq 0x20(%rcx), %rcx
movq 0x8(%rcx), %rcx
cmpb $0x28, (%rcx)
jne 0x10ffd
movq 0x10(%rsp), %rax
movq 0x48(%rax), %rdi
movq %r13, %rsi
leaq 0x12c1(%rip), %rdx      # 0x12056
movq %r14, %rcx
callq 0x11c1f
testl %eax, %eax
js 0x11466
movb %al, 0x1(%rbp)
movq 0x20(%r13), %rax
movq 0x20(%rax), %r15
movq 0x20(%r15), %rax
testq %rax, %rax
je 0x11419
movq 0x18(%rax), %r13
testq %r13, %r13
je 0x11419
movq 0x20(%r13), %rax
testq %rax, %rax
je 0x11419
cmpq $0x0, 0x20(%rax)
jne 0x11419
movq 0x10(%rsp), %rax
movq 0x48(%rax), %rdi
movq %r13, %rsi
leaq 0x1261(%rip), %rdx      # 0x12056
movq %r14, %rcx
callq 0x11c1f
testl %eax, %eax
js 0x11466
movb %al, 0x2(%rbp)
movq 0x20(%r13), %rsi
movq 0x8(%rsi), %rdx
movb (%rdx), %al
cmpb $0x2d, %al
setne %cl
addb $-0x30, %al
cmpb $0xa, %al
setae %al
testb %al, %cl
movq %r15, 0x18(%rsp)
jne 0x11181
movq %rdx, 0x30(%rsp)
movq 0x8(%r15), %r15
leaq 0x7c45(%rip), %r12      # 0x18a80
leaq 0x269c(%rip), %rsi      # 0x134de
movq %r15, %rdi
callq 0x3140
testl %eax, %eax
je 0x1120e
movq (%r12), %rsi
addq $0x10, %r12
testq %rsi, %rsi
jne 0x10e42
jmp 0x113cf
movq 0x20(%r13), %rcx
testq %rcx, %rcx
je 0x1146d
movq 0x20(%rcx), %rax
testq %rax, %rax
je 0x1142a
movq 0x8(%rax), %rsi
movzbl (%rsi), %edx
subl $0x28, %edx
jne 0x10e97
movzbl 0x1(%rsi), %edx
subl $0x29, %edx
jne 0x10e97
movzbl 0x2(%rsi), %edx
negl %edx
testl %edx, %edx
jne 0x1142a
movq 0x18(%rax), %rcx
testq %rcx, %rcx
je 0x1140d
movq 0x20(%rcx), %rcx
testq %rcx, %rcx
je 0x1140d
cmpq $0x0, 0x20(%rcx)
jne 0x1140d
movq 0x20(%rax), %r13
testq %r13, %r13
je 0x11489
movq 0x8(%r13), %r15
movl 0x10(%r13), %esi
movq %r15, %rdi
callq 0x11b9b
testl %eax, %eax
jne 0x112ab
jmp 0x114c8
movq 0x10(%rsp), %r12
movq 0x48(%r12), %rdi
leaq 0x1155(%rip), %rdx      # 0x12056
xorl %ecx, %ecx
callq 0x11c1f
testl %eax, %eax
js 0x110b4
movb %al, 0x2(%rbp)
movq 0x20(%r13), %rax
movq 0x20(%rax), %r13
movq 0x8(%r13), %rdi
movb (%rdi), %al
cmpb $0x2d, %al
setne %cl
addb $-0x30, %al
cmpb $0xa, %al
setae %al
testb %al, %cl
jne 0x1110a
leaq 0x4(%rbp), %rsi
callq 0x4d47
testl %eax, %eax
je 0x114e3
movb $0xc, (%rbp)
jmp 0x11204
movb -0x8(%r14), %al
movq 0x8(%rsp), %rcx
movb %al, (%rcx,%r12,8)
movq 0x20(%r13), %r15
movq 0x18(%r15), %rsi
movq 0x10(%rsp), %r14
movq 0x48(%r14), %rdi
leaq 0x10e2(%rip), %rbx      # 0x12056
movq %rbx, %rdx
movq 0x18(%rsp), %r13
movq %r13, %rcx
callq 0x11c1f
testl %eax, %eax
js 0x1147a
movq 0x8(%rsp), %rcx
movb %al, 0x2(%rcx,%r12,8)
movq 0x18(%r15), %rax
movq 0x20(%rax), %rsi
movq 0x48(%r14), %rdi
movq %rbx, %rdx
movq %r13, %r14
movq %r13, %rcx
callq 0x11c1f
testl %eax, %eax
movq 0x20(%rsp), %rbx
js 0x11466
movq 0x8(%rsp), %rcx
movb %al, 0x3(%rcx,%r12,8)
movq 0x20(%r15), %r13
movq 0x8(%r13), %r15
testq %rbp, %rbp
je 0x11326
movq %r12, %rbx
movq 0x8(%rbp), %rsi
movq %r15, %rdi
callq 0x3140
testl %eax, %eax
je 0x11095
movq 0x10(%rbp), %rbp
testq %rbp, %rbp
jne 0x10fdb
jmp 0x11326
movq %rbx, %r12
cmpb $0x2d, %al
movq %r14, %rcx
setne %r14b
addb $-0x30, %al
cmpb $0xa, %al
setae %r15b
movq 0x10(%rsp), %rax
movq 0x48(%rax), %rdi
movq %r13, %rsi
leaq 0x1032(%rip), %rdx      # 0x12056
movq %rcx, %rbx
callq 0x11c1f
testb %r15b, %r14b
jne 0x11139
testl %eax, %eax
js 0x114de
movb %al, 0x1(%rbp)
movq 0x20(%r13), %rax
movq 0x20(%rax), %r13
movq 0x8(%r13), %rdi
leaq 0x4(%rbp), %rsi
callq 0x4d47
testl %eax, %eax
movq %rbx, %r14
je 0x114f0
movb $0x7, (%rbp)
movq %r12, %rbx
jmp 0x11204
movq 0x10(%rsp), %r12
movq 0x48(%r12), %rdi
leaq 0xfd9(%rip), %rdx       # 0x12056
xorl %ecx, %ecx
callq 0x11c1f
testl %eax, %eax
js 0x111dd
movb $0xa, (%rbp)
jmp 0x11201
movl (%rbp), %eax
movq 0x8(%rsp), %rbp
movl %eax, 0x4(%rbp,%rbx,8)
testq %r13, %r13
movq 0x20(%rsp), %rbx
jne 0x112ab
jmp 0x1149d
movq 0x20(%r15), %rsi
movq 0x48(%r12), %rdi
leaq 0x2419(%rip), %rdx      # 0x134dd
movq %r14, %rcx
callq 0x11c1f
testl %eax, %eax
js 0x11466
movb %al, 0x2(%rbp)
movq 0x20(%r13), %rax
movq 0x20(%rax), %r13
movq 0x48(%r12), %rdi
movq %r13, %rsi
leaq 0xf68(%rip), %rdx       # 0x12056
movq %r14, %rcx
callq 0x11c1f
testl %eax, %eax
js 0x11466
movb %al, 0x3(%rbp)
movb $0xf, (%rbp)
jmp 0x1129d
movq 0x10(%rsp), %rax
movq 0x48(%rax), %rdi
movq %r13, %rsi
leaq 0xf39(%rip), %rdx       # 0x12056
movq %r14, %rcx
callq 0x11c1f
testl %eax, %eax
js 0x11466
movb %al, 0x3(%rbp)
movb $0xe, (%rbp)
jmp 0x11204
testl %eax, %eax
js 0x114de
movb %al, 0x1(%rbp)
movq 0x20(%r13), %rax
movq 0x20(%rax), %r13
movq 0x10(%rsp), %rax
movq 0x48(%rax), %rdi
movq %r13, %rsi
leaq 0xef7(%rip), %rdx       # 0x12056
movq %rbx, %r14
movq %rbx, %rcx
callq 0x11c1f
testl %eax, %eax
js 0x11509
movb %al, 0x2(%rbp)
movb $0x8, (%rbp)
movq %r12, %rbx
jmp 0x1129d
movq 0x10(%rsp), %r12
movq 0x48(%r12), %rdi
leaq 0xec4(%rip), %rdx       # 0x12056
xorl %ecx, %ecx
callq 0x11c1f
testl %eax, %eax
js 0x11230
movl %eax, %r15d
movq 0x18(%rsp), %rax
movq 0x8(%rax), %r13
leaq 0x79ec(%rip), %r12      # 0x18ba0
leaq 0x2323(%rip), %rsi      # 0x134de
movq %r13, %rdi
callq 0x3140
testl %eax, %eax
je 0x11288
movq (%r12), %rsi
addq $0x10, %r12
testq %rsi, %rsi
jne 0x111bb
jmp 0x113e6
movq 0x20(%r15), %rsi
movq 0x48(%r12), %rdi
leaq 0x22f0(%rip), %rdx      # 0x134dd
movq %r14, %rcx
callq 0x11c1f
testl %eax, %eax
js 0x11466
movb $0xb, (%rbp)
movb %al, 0x3(%rbp)
movq 0x8(%rsp), %rbp
jmp 0x112ab
movb -0x8(%r12), %al
movb %al, (%rbp)
addq $0x4, %rbp
movq 0x30(%rsp), %rdi
movq %rbp, %rsi
callq 0x4d47
testl %eax, %eax
jne 0x11294
jmp 0x11511
movq 0x20(%r13), %rsi
movq 0x48(%r12), %rdi
leaq 0x229d(%rip), %rdx      # 0x134dd
movq %r14, %rcx
callq 0x11c1f
testl %eax, %eax
js 0x11466
movl %eax, %r15d
movq 0x18(%rsp), %rax
movq 0x8(%rax), %r13
leaq 0x7a5d(%rip), %r12      # 0x18cc0
leaq 0x1c7d(%rip), %rsi      # 0x12ee7
movq %r13, %rdi
callq 0x3140
testl %eax, %eax
je 0x11288
movq (%r12), %rsi
addq $0x10, %r12
testq %rsi, %rsi
jne 0x1126a
jmp 0x113e6
movb -0x8(%r12), %al
movb %al, (%rbp)
movb %r15b, 0x3(%rbp)
movq 0x18(%rsp), %rax
movq 0x20(%rax), %r13
movq 0x8(%rsp), %rbp
testq %r13, %r13
je 0x1149d
movq 0x20(%r13), %rax
testq %rax, %rax
je 0x11308
movq 0x8(%rax), %rdx
movzbl (%rdx), %ecx
subl $0x3b, %ecx
jne 0x112c4
movzbl 0x1(%rdx), %ecx
negl %ecx
testl %ecx, %ecx
jne 0x11308
incl %ebx
movq %rax, %r13
movq 0x20(%r13), %r13
testq %r13, %r13
jne 0x109e0
jmp 0x1149d
movl 0x28(%r13), %ecx
leaq 0x2327(%rip), %rsi      # 0x13613
movq 0x18(%rsp), %r14
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x3200
movq 0x20(%rsp), %rbx
jmp 0x11466
movq 0x8(%r13), %rdx
movl 0x28(%r13), %ecx
leaq 0x214b(%rip), %rsi      # 0x13462
movq %r14, %rdi
xorl %eax, %eax
callq 0x3200
jmp 0x1149d
movl 0x28(%r13), %ecx
leaq 0x22b8(%rip), %rsi      # 0x135e9
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x3200
movq 0x8(%rsp), %rbp
movq 0x20(%rsp), %rbx
jmp 0x1149d
movl 0x28(%r13), %edx
leaq 0x123d(%rip), %rsi      # 0x12595
movq %r14, %rdi
xorl %eax, %eax
callq 0x3200
jmp 0x11466
movl 0x28(%rax), %edx
leaq 0x2221(%rip), %rsi      # 0x13592
jmp 0x11493
movl 0x28(%rcx), %edx
leaq 0x21ed(%rip), %rsi      # 0x1356d
jmp 0x11493
movl 0x28(%r13), %ecx
leaq 0x20f9(%rip), %rsi      # 0x13489
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x3200
jmp 0x113b1
leaq 0x7dca(%rip), %rax      # 0x19170
movq (%rax), %rsi
movq %r14, %rdi
callq 0x3070
movq 0x28(%rsp), %rax
movq $0x0, 0x10(%rax)
xorl %eax, %eax
cmpb $0x0, (%r14)
jne 0x114b9
jmp 0x114b5
movq 0x18(%rsp), %rax
movl 0x28(%rax), %ecx
leaq 0x212d(%rip), %rsi      # 0x1350b
movq %r14, %rdi
movq %r15, %rdx
jmp 0x1145f
movq 0x18(%rsp), %rax
movl 0x28(%rax), %ecx
leaq 0x2116(%rip), %rsi      # 0x1350b
movq %r14, %rdi
movq %r13, %rdx
jmp 0x1145f
movl 0x28(%r13), %edx
leaq 0x21b5(%rip), %rsi      # 0x135bd
jmp 0x11493
movl 0x28(%rax), %edx
leaq 0x227e(%rip), %rsi      # 0x13695
jmp 0x11493
movq 0x8(%r15), %rdx
movl 0x28(%r15), %ecx
leaq 0x2108(%rip), %rsi      # 0x13530
jmp 0x1145c
movl 0x28(%rcx), %edx
leaq 0x2284(%rip), %rsi      # 0x136b8
jmp 0x11493
movq 0x8(%r13), %rdx
movl 0x28(%r13), %ecx
leaq 0x1ff5(%rip), %rsi      # 0x1343a
jmp 0x11317
movq 0x20(%r15), %rax
movq 0x8(%rax), %rdx
movl 0x28(%rax), %ecx
leaq 0x205b(%rip), %rsi      # 0x134b7
movq %r14, %rdi
xorl %eax, %eax
callq 0x3200
movq 0x8(%rsp), %rbp
jmp 0x1149d
movl 0x28(%r13), %edx
leaq 0x226e(%rip), %rsi      # 0x136e6
jmp 0x11493
movq 0x20(%rsp), %rbx
movq 0x8(%rsp), %rbp
movq %r13, %r14
jmp 0x1149d
movl 0x28(%rax), %edx
leaq 0x21d2(%rip), %rsi      # 0x13665
movq %r14, %rdi
xorl %eax, %eax
callq 0x3200
cmpb $0x0, (%r14)
movl $0x0, %eax
jne 0x114b9
testq %rbp, %rbp
je 0x114b5
movslq %ebx, %rax
movb $0x0, (%rbp,%rax,8)
incl %ebx
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x28(%r13), %ecx
leaq 0x216b(%rip), %rsi      # 0x1363e
movq %r14, %rdi
movq %r15, %rdx
jmp 0x1131a
movq %rbx, %r14
jmp 0x11509
movq 0x8(%r13), %rdx
movl 0x28(%r13), %ecx
jmp 0x11455
movq 0x8(%r13), %rdx
movl 0x28(%r13), %ecx
leaq 0x1fb8(%rip), %rsi      # 0x134b7
movq %r14, %rdi
xorl %eax, %eax
callq 0x3200
movq %r12, %rbx
jmp 0x11466
movq 0x20(%r13), %rax
jmp 0x1144e