// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/frontend/parser_output.c
// Function: subtilis_parser_vdu
void subtilis_parser_vdu(subtilis_parser_t *p, subtilis_token_t *t,
			 subtilis_error_t *err)
{
	subtilis_exp_t *e;
	const char *tbuf;

	/*
	 * NOTE that there is a problem with the grammar here.  We cannot
	 * allow a VDU statement to terminate with an operator otherwise
	 * we will not know whether a variable following the operator
	 * should be sent to the VDU driver or be used to assign a value to
	 * a variable, e.g,
	 *
	 * VDU 19,2,4;0;
	 * A% = 10
	 *
	 * will fail to parse.  Consequently, subtilis will allow
	 *
	 * VDU [19,2,4;0;]
	 */

	subtilis_lexer_get(p->l, t, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	if (t->type == SUBTILIS_TOKEN_OPERATOR) {
		tbuf = subtilis_token_get_text(t);
		if (strcmp(tbuf, "[") == 0) {
			prv_vdu_brackets(p, t, err);
			return;
		}
	}

	do {
		e = subtilis_parser_priority7(p, t, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;

		e = subtilis_type_if_to_int(p, e, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;

		tbuf = subtilis_token_get_text(t);
		if (t->type == SUBTILIS_TOKEN_OPERATOR) {
			if (strcmp(tbuf, ",") == 0) {
				prv_vdu_byte(p, e, err);
			} else if (strcmp(tbuf, ";") == 0) {
				prv_vdu_2bytes(p, e, err);
			} else if (strcmp(tbuf, "|") == 0) {
				prv_vdu_1byte9zeros(p, e, err);
			} else {
				subtilis_error_set_expected(
				    err, ",. ; or |", tbuf, p->l->stream->name,
				    p->l->line);
				goto cleanup;
			}
		} else {
			prv_vdu_byte(p, e, err);
		}
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;

		subtilis_exp_delete(e);
		e = NULL;

		if (t->type != SUBTILIS_TOKEN_OPERATOR)
			break;

		subtilis_lexer_get(p->l, t, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;

	} while (true);

cleanup:
	subtilis_exp_delete(e);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq (%rdi), %rdi
callq 0x12e0e
cmpl $0x0, (%rbx)
je 0x25332
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
cmpl $0x2, (%r14)
jne 0x2534f
movq %r14, %rdi
callq 0x12a25
cmpb $0x5b, (%rax)
jne 0x2534f
cmpb $0x0, 0x1(%rax)
je 0x25444
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x1dccf
cmpl $0x0, (%rbx)
jne 0x25326
movq %r15, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x347d5
cmpl $0x0, (%rbx)
jne 0x25326
movq %rax, %r12
movq %r14, %rdi
callq 0x12a25
cmpl $0x2, (%r14)
jne 0x2539e
movzbl (%rax), %ecx
cmpl $0x7c, %ecx
je 0x253f9
cmpl $0x3b, %ecx
je 0x253e3
cmpl $0x2c, %ecx
jne 0x2540f
cmpb $0x0, 0x1(%rax)
jne 0x2540f
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x255fa
cmpl $0x0, (%rbx)
jne 0x255e7
movq %r12, %rdi
callq 0x29d88
cmpl $0x2, (%r14)
jne 0x255e4
movq (%r15), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x12e0e
cmpl $0x0, (%rbx)
je 0x2534f
jmp 0x25326
cmpb $0x0, 0x1(%rax)
jne 0x2540f
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x25671
jmp 0x253ac
cmpb $0x0, 0x1(%rax)
jne 0x2540f
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x257a6
jmp 0x253ac
movq (%r15), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0x485de(%rip), %r10     # 0x6d9ff
leaq 0x485cd(%rip), %rdx     # 0x6d9f5
pushq $0x1d
popq %rsi
movq %rbx, %rdi
movq %rax, %rcx
pushq $0xfb
pushq %r10
callq 0x140cd
popq %rax
popq %rcx
jmp 0x255e7
movq (%r15), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x12e0e
cmpl $0x0, (%rbx)
jne 0x25326
jmp 0x25533
movq %r15, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x347d5
cmpl $0x0, (%rbx)
jne 0x25326
movq %rax, %r12
movq %r14, %rdi
callq 0x12a25
cmpl $0x2, (%r14)
jne 0x2554f
movzbl (%rax), %ecx
cmpl $0x2c, %ecx
je 0x254bc
cmpl $0x3b, %ecx
je 0x254d6
cmpl $0x7c, %ecx
jne 0x2557b
cmpb $0x0, 0x1(%rax)
jne 0x25586
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x257a6
jmp 0x254ee
cmpb $0x0, 0x1(%rax)
jne 0x25586
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x255fa
jmp 0x254ee
cmpb $0x0, 0x1(%rax)
jne 0x25586
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x25671
cmpl $0x0, (%rbx)
jne 0x255e7
movq %r12, %rdi
callq 0x29d88
movq (%r15), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x12e0e
cmpl $0x0, (%rbx)
jne 0x255e4
cmpl $0x2, (%r14)
jne 0x25533
movq %r14, %rdi
callq 0x12a25
cmpb $0x5d, (%rax)
jne 0x25533
cmpb $0x0, 0x1(%rax)
je 0x255cd
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x1dccf
cmpl $0x0, (%rbx)
je 0x25460
jmp 0x25326
movq (%r15), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0x4849e(%rip), %r10     # 0x6d9ff
leaq 0x484bf(%rip), %rdx     # 0x6da27
pushq $0x1d
popq %rsi
movq %rbx, %rdi
movq %rax, %rcx
pushq $0xa7
jmp 0x25436
cmpl $0x5d, %ecx
jne 0x25586
cmpb $0x0, 0x1(%rax)
je 0x255b2
movq (%r15), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0x48467(%rip), %r10     # 0x6d9ff
leaq 0x48479(%rip), %rdx     # 0x6da18
pushq $0x1d
popq %rsi
movq %rbx, %rdi
movq %rax, %rcx
pushq $0xa1
jmp 0x25436
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x255fa
cmpl $0x0, (%rbx)
jne 0x255e7
movq %r12, %rdi
callq 0x29d88
movq (%r15), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x12e0e
cmpl $0x0, (%rbx)
je 0x25326
xorl %r12d, %r12d
movq %r12, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x29d88