// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/frontend/parser_exp.c
// Function: prv_slice_have_b
static size_t prv_slice_have_b(subtilis_parser_t *p, subtilis_token_t *t,
			       const char *b, subtilis_exp_t **ee,
			       subtilis_error_t *err)
{
	const char *tbuf;
	char expected[3];

	ee[0] = NULL;
	ee[1] = NULL;

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

	tbuf = subtilis_token_get_text(t);
	if ((t->type == SUBTILIS_TOKEN_OPERATOR) && !strcmp(tbuf, b))
		return 0;

	if ((t->type == SUBTILIS_TOKEN_OPERATOR) && !strcmp(tbuf, ":")) {
		ee[0] = subtilis_exp_new_int32(0, err);
	} else {
		ee[0] = subtilis_parser_priority7(p, t, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return 0;

		ee[0] = subtilis_type_if_to_int(p, ee[0], err);
	}
	if (err->type != SUBTILIS_ERROR_OK)
		return 0;

	tbuf = subtilis_token_get_text(t);
	if ((t->type == SUBTILIS_TOKEN_OPERATOR) && !strcmp(tbuf, b))
		return 1;

	if ((t->type != SUBTILIS_TOKEN_OPERATOR) || strcmp(tbuf, ":")) {
		subtilis_error_set_expected(err, ":", tbuf, p->l->stream->name,
					    p->l->line);
		goto cleanup;
	}

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

	tbuf = subtilis_token_get_text(t);
	if ((t->type == SUBTILIS_TOKEN_OPERATOR) && !strcmp(tbuf, b)) {
		/*
		 * If ee[0] is constant 0, either because the programmer
		 * specified 0 or omitted the first slice parameter, there's no
		 * point in slicing the vector.  We want to return 0 to indicate
		 * that we should take a vector reference instead.
		 */
		if ((ee[0]->type.type == SUBTILIS_TYPE_CONST_INTEGER) &&
		    (ee[0]->exp.ir_op.integer == 0))
			return 0;
		ee[1] = NULL;
		return 2;
	}

	ee[1] = subtilis_parser_priority7(p, t, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return 0;

	ee[1] = subtilis_type_if_to_int(p, ee[1], err);
	if (err->type != SUBTILIS_ERROR_OK)
		return 0;

	tbuf = subtilis_token_get_text(t);
	if ((t->type != SUBTILIS_TOKEN_OPERATOR) || strcmp(tbuf, b)) {
		expected[0] = b[0];
		expected[1] = ' ';
		expected[2] = 0;
		subtilis_error_set_expected(err, expected, tbuf,
					    p->l->stream->name, p->l->line);
		goto cleanup;
	}

	return 2;

cleanup:
	subtilis_exp_delete(ee[1]);
	subtilis_exp_delete(ee[0]);

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r14
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %r15
xorps %xmm0, %xmm0
movups %xmm0, (%rcx)
movq (%rdi), %rdi
movq %r8, %rdx
callq 0x12e0e
cmpl $0x0, (%r14)
jne 0x1e77b
movq %r13, %rdi
callq 0x12a25
cmpl $0x2, (%r13)
jne 0x1e6dc
movq %rax, %rbp
movq %rax, %rdi
movq %r12, %rsi
callq 0x12160
testl %eax, %eax
je 0x1e77b
cmpb $0x3a, (%rbp)
jne 0x1e6dc
cmpb $0x0, 0x1(%rbp)
je 0x1e78c
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1dccf
movq %rax, (%rbx)
cmpl $0x0, (%r14)
jne 0x1e77b
movq %r15, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x347d5
movq %rax, (%rbx)
cmpl $0x0, (%r14)
jne 0x1e77b
movq %r13, %rdi
callq 0x12a25
movq %rax, %rbp
cmpl $0x2, (%r13)
jne 0x1e73b
movq %rbp, %rdi
movq %r12, %rsi
callq 0x12160
testl %eax, %eax
je 0x1e79b
cmpb $0x3a, (%rbp)
jne 0x1e73b
cmpb $0x0, 0x1(%rbp)
je 0x1e7a0
movq (%r15), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0x4f14f(%rip), %rax     # 0x6d89c
leaq 0x4f1a3(%rip), %rdx     # 0x6d8f7
pushq $0x1d
popq %rsi
movq %r14, %rdi
movq %rbp, %rcx
pushq $0x4e9                  # imm = 0x4E9
pushq %rax
callq 0x140cd
popq %rax
popq %rcx
movq 0x8(%rbx), %rdi
callq 0x29d88
movq (%rbx), %rdi
callq 0x29d88
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %edi, %edi
movq %r14, %rsi
callq 0x2a369
jmp 0x1e705
pushq $0x1
popq %rax
jmp 0x1e77d
movq (%r15), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x12e0e
cmpl $0x0, (%r14)
jne 0x1e76a
movq %r13, %rdi
callq 0x12a25
cmpl $0x2, (%r13)
jne 0x1e7d6
movq %rax, %rdi
movq %r12, %rsi
callq 0x12160
testl %eax, %eax
je 0x1e861
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1dccf
movq %rax, 0x8(%rbx)
cmpl $0x0, (%r14)
jne 0x1e77b
movq %r15, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x347d5
movq %rax, 0x8(%rbx)
cmpl $0x0, (%r14)
jne 0x1e77b
movq %r13, %rdi
callq 0x12a25
movq %rax, %rbp
cmpl $0x2, (%r13)
jne 0x1e82b
movq %rbp, %rdi
movq %r12, %rsi
callq 0x12160
testl %eax, %eax
je 0x1e87b
movb (%r12), %al
leaq 0x5(%rsp), %rdx
movb %al, (%rdx)
movw $0x20, 0x1(%rdx)
movq (%r15), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0x4f04e(%rip), %rax     # 0x6d89c
pushq $0x1d
popq %rsi
movq %r14, %rdi
movq %rbp, %rcx
pushq $0x50e                  # imm = 0x50E
jmp 0x1e762
movq (%rbx), %rax
cmpl $0x1, (%rax)
jne 0x1e876
cmpl $0x0, 0x148(%rax)
je 0x1e77b
andq $0x0, 0x8(%rbx)
pushq $0x2
jmp 0x1e79d