// File: /workspace/github_c_makefile_star2_O3/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 0x12edc
cmpl $0x0, (%rbx)
je 0x26432
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
cmpl $0x2, (%r14)
jne 0x2644f
movq %r14, %rdi
callq 0x12ad0
cmpb $0x5b, (%rax)
jne 0x2644f
cmpb $0x0, 0x1(%rax)
je 0x26548
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x1e938
cmpl $0x0, (%rbx)
jne 0x26426
movq %r15, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x367cf
cmpl $0x0, (%rbx)
jne 0x26426
movq %rax, %r12
movq %r14, %rdi
callq 0x12ad0
cmpl $0x2, (%r14)
jne 0x2649e
movzbl (%rax), %ecx
cmpl $0x7c, %ecx
je 0x264f9
cmpl $0x3b, %ecx
je 0x264e3
cmpl $0x2c, %ecx
jne 0x2650f
cmpb $0x0, 0x1(%rax)
jne 0x2650f
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x2670b
cmpl $0x0, (%rbx)
jne 0x266f8
movq %r12, %rdi
callq 0x2b166
cmpl $0x2, (%r14)
jne 0x266f5
movq (%r15), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x12edc
cmpl $0x0, (%rbx)
je 0x2644f
jmp 0x26426
cmpb $0x0, 0x1(%rax)
jne 0x2650f
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x2678b
jmp 0x264ac
cmpb $0x0, 0x1(%rax)
jne 0x2650f
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x268d2
jmp 0x264ac
movq (%r15), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0x4d526(%rip), %r10     # 0x73a47
leaq 0x4d515(%rip), %rdx     # 0x73a3d
movq %rbx, %rdi
movl $0x1d, %esi
movq %rax, %rcx
pushq $0xfb
pushq %r10
callq 0x143da
addq $0x10, %rsp
jmp 0x266f8
movq (%r15), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x12edc
cmpl $0x0, (%rbx)
jne 0x26426
jmp 0x26640
movq %r15, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x367cf
cmpl $0x0, (%rbx)
jne 0x26426
movq %rax, %r12
movq %r14, %rdi
callq 0x12ad0
cmpl $0x2, (%r14)
jne 0x2665c
movzbl (%rax), %ecx
cmpl $0x5c, %ecx
jg 0x265c0
cmpl $0x2c, %ecx
je 0x265e3
cmpl $0x3b, %ecx
jne 0x26695
cmpb $0x0, 0x1(%rax)
jne 0x26695
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x2678b
jmp 0x265fb
cmpl $0x7c, %ecx
jne 0x2668a
cmpb $0x0, 0x1(%rax)
jne 0x26695
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x268d2
jmp 0x265fb
cmpb $0x0, 0x1(%rax)
jne 0x26695
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x2670b
cmpl $0x0, (%rbx)
jne 0x266f8
movq %r12, %rdi
callq 0x2b166
movq (%r15), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x12edc
cmpl $0x0, (%rbx)
jne 0x266f5
cmpl $0x2, (%r14)
jne 0x26640
movq %r14, %rdi
callq 0x12ad0
cmpb $0x5d, (%rax)
jne 0x26640
cmpb $0x0, 0x1(%rax)
je 0x266de
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x1e938
cmpl $0x0, (%rbx)
je 0x26564
jmp 0x26426
movq (%r15), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0x4d3d9(%rip), %r10     # 0x73a47
leaq 0x4d3fa(%rip), %rdx     # 0x73a6f
movq %rbx, %rdi
movl $0x1d, %esi
movq %rax, %rcx
pushq $0xa7
jmp 0x26538
cmpl $0x5d, %ecx
jne 0x26695
cmpb $0x0, 0x1(%rax)
je 0x266c3
movq (%r15), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0x4d3a0(%rip), %r10     # 0x73a47
leaq 0x4d3b2(%rip), %rdx     # 0x73a60
movq %rbx, %rdi
movl $0x1d, %esi
movq %rax, %rcx
pushq $0xa1
jmp 0x26538
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x2670b
cmpl $0x0, (%rbx)
jne 0x266f8
movq %r12, %rdi
callq 0x2b166
movq (%r15), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x12edc
cmpl $0x0, (%rbx)
je 0x26426
xorl %r12d, %r12d
movq %r12, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2b166