// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x12110
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x133f0
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2ee26
jmp 0x2f078
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x24a80
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2ee49
jmp 0x2f078
movq -0x10(%rbp), %rdi
callq 0x12d70
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x2ee74
movq -0x48(%rbp), %rdi
leaq 0x7b73f(%rip), %rsi     # 0xaa5a9
callq 0x12140
cmpl $0x0, %eax
je 0x2eebe
movq -0x40(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rsi
xorl %edi, %edi
callq 0x37800
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2ee99
jmp 0x2f04d
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x47c10
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2eebc
jmp 0x2f04d
jmp 0x2ef05
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x133f0
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2eee0
jmp 0x2f04d
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x24a80
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2ef03
jmp 0x2f04d
jmp 0x2ef05
movq -0x10(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x2effa
movq -0x10(%rbp), %rax
cmpl $0x85, 0x8(%rax)
jne 0x2effa
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
jne 0x2ef7c
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %r8
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0x38(%rax), %r9d
movl $0x13, %esi
leaq 0x7baa0(%rip), %rdx     # 0xaa9f8
leaq 0x7c317(%rip), %rcx     # 0xab276
leaq 0x7baa6(%rip), %rax     # 0xaaa0c
movq %rax, (%rsp)
movl $0x1de, 0x8(%rsp)       # imm = 0x1DE
callq 0x156d0
jmp 0x2f04d
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x133f0
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2ef9e
jmp 0x2f04d
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x24a80
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2efc1
jmp 0x2f04d
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x40(%rbp), %rdx
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rax
movq -0x18(%rbp), %r9
movq 0x148(%rdx), %rdx
movq 0x148(%rcx), %rcx
movq 0x148(%rax), %r8
movl $0x58, %esi
callq 0x38360
jmp 0x2f026
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x40(%rbp), %rcx
movq -0x38(%rbp), %rax
movq -0x18(%rbp), %r8
movq 0x148(%rcx), %rdx
movq 0x148(%rax), %rcx
movl $0x57, %esi
callq 0x385a0
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2f031
jmp 0x2f04d
movq -0x8(%rbp), %rax
testb $0x1, 0xb9(%rax)
jne 0x2f04b
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x36ce0
jmp 0x2f04d
movq $0x0, -0x20(%rbp)
cmpq $0x3, -0x20(%rbp)
jae 0x2f078
movq -0x20(%rbp), %rax
movq -0x40(%rbp,%rax,8), %rdi
callq 0x36ee0
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x2f055
addq $0x60, %rsp
popq %rbp
retq
nop