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

	memset(&e, 0, sizeof(e));

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

	e[0] = subtilis_parser_int_var_expression(p, t, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	tbuf = subtilis_token_get_text(t);
	if ((t->type != SUBTILIS_TOKEN_OPERATOR) || strcmp(tbuf, ",")) {
		e[1] = e[0];
		e[0] = subtilis_exp_new_int32(0, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;
		e[0] = subtilis_type_if_exp_to_var(p, e[0], err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;
	} else {
		subtilis_lexer_get(p->l, t, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;

		e[1] = subtilis_parser_int_var_expression(p, t, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;
	}

	if ((t->type == SUBTILIS_TOKEN_KEYWORD) &&
	    (t->tok.keyword.type == SUBTILIS_KEYWORD_TINT)) {
		if (!(p->backend.caps & SUBTILIS_BACKEND_HAVE_TINT)) {
			subtilis_error_set_not_supported(
			    err, "TINT on this target", p->l->stream->name,
			    p->l->line);
			goto cleanup;
		}
		subtilis_lexer_get(p->l, t, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;

		e[2] = subtilis_parser_int_var_expression(p, t, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;
		subtilis_ir_section_add_instr_reg(
		    p->current, SUBTILIS_OP_INSTR_GCOL_TINT, e[0]->exp.ir_op,
		    e[1]->exp.ir_op, e[2]->exp.ir_op, err);
	} else {
		subtilis_ir_section_add_instr_no_reg2(
		    p->current, SUBTILIS_OP_INSTR_GCOL, e[0]->exp.ir_op,
		    e[1]->exp.ir_op, err);
	}
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	if (!p->settings.ignore_graphics_errors)
		subtilis_exp_handle_errors(p, err);

cleanup:
	for (i = 0; i < 3; i++)
		subtilis_exp_delete(e[i]);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
andq $0x0, 0x10(%rsp)
movq (%rdi), %rdi
callq 0x12e0e
cmpl $0x0, (%rbx)
jne 0x246c0
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x1e00b
movq %rax, (%rsp)
cmpl $0x0, (%rbx)
je 0x246ce
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %r12
movq %r15, %rdi
callq 0x12a25
cmpl $0x2, (%r15)
jne 0x246ee
cmpb $0x2c, (%rax)
jne 0x246ee
cmpb $0x0, 0x1(%rax)
je 0x247b8
movq %r12, 0x8(%rsp)
xorl %edi, %edi
movq %rbx, %rsi
callq 0x2a369
movq %rax, (%rsp)
cmpl $0x0, (%rbx)
jne 0x24813
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x3415f
movq %rax, (%rsp)
cmpl $0x0, (%rbx)
jne 0x24813
movq %r12, %r13
movq %rax, %r12
cmpl $0x1, (%r15)
jne 0x2477e
cmpl $0x85, 0x8(%r15)
jne 0x2477e
testb $0x40, 0x8(%r14)
movq (%r14), %rdi
jne 0x247eb
movq 0x30(%rdi), %r8
movl 0x38(%rdi), %r9d
leaq 0x4924c(%rip), %rax     # 0x6d9a4
leaq 0x49231(%rip), %rdx     # 0x6d990
leaq 0x4965f(%rip), %rcx     # 0x6ddc5
pushq $0x13
popq %rsi
movq %rbx, %rdi
pushq $0x1de                  # imm = 0x1DE
pushq %rax
callq 0x140cd
popq %rax
popq %rcx
jmp 0x24813
movq 0x48(%r14), %rdi
movq 0x148(%r12), %rdx
movq 0x148(%r13), %rcx
pushq $0x57
popq %rsi
movq %rbx, %r8
callq 0x2a9a4
cmpl $0x0, (%rbx)
jne 0x24813
cmpb $0x0, 0xb9(%r14)
jne 0x24813
movq %r14, %rdi
movq %rbx, %rsi
callq 0x29c49
jmp 0x24813
movq (%r14), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x12e0e
cmpl $0x0, (%rbx)
jne 0x24813
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x1e00b
movq %rax, 0x8(%rsp)
cmpl $0x0, (%rbx)
jne 0x24813
movq %rax, %r13
jmp 0x2472b
movq %r15, %rsi
movq %rbx, %rdx
callq 0x12e0e
cmpl $0x0, (%rbx)
jne 0x24813
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x1e00b
movq %rax, 0x10(%rsp)
cmpl $0x0, (%rbx)
je 0x2482d
xorl %ebx, %ebx
cmpq $0x3, %rbx
je 0x246c0
movq (%rsp,%rbx,8), %rdi
callq 0x29d88
incq %rbx
jmp 0x24815
movq 0x48(%r14), %rdi
movq 0x148(%r12), %rdx
movq 0x148(%r13), %rcx
movq 0x148(%rax), %r8
pushq $0x58
popq %rsi
movq %rbx, %r9
callq 0x2a8c1
jmp 0x2479c