// File: /workspace/github_c_makefile_star2_O3/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 0x12edc
cmpl $0x0, (%r14)
jne 0x1f441
movq %r13, %rdi
callq 0x12ad0
cmpl $0x2, (%r13)
jne 0x1f39e
movq %rax, %rbp
movq %rax, %rdi
movq %r12, %rsi
callq 0x12160
testl %eax, %eax
je 0x1f441
cmpb $0x3a, (%rbp)
jne 0x1f39e
cmpb $0x0, 0x1(%rbp)
je 0x1f452
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1e938
movq %rax, (%rbx)
cmpl $0x0, (%r14)
jne 0x1f441
movq %r15, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x367cf
movq %rax, (%rbx)
cmpl $0x0, (%r14)
jne 0x1f441
movq %r13, %rdi
callq 0x12ad0
movq %rax, %rbp
cmpl $0x2, (%r13)
jne 0x1f3fd
movq %rbp, %rdi
movq %r12, %rsi
callq 0x12160
testl %eax, %eax
je 0x1f461
cmpb $0x3a, (%rbp)
jne 0x1f3fd
cmpb $0x0, 0x1(%rbp)
je 0x1f468
movq (%r15), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0x544d1(%rip), %rax     # 0x738e0
leaq 0x54525(%rip), %rdx     # 0x7393b
movq %r14, %rdi
movl $0x1d, %esi
movq %rbp, %rcx
pushq $0x4e9                  # imm = 0x4E9
pushq %rax
callq 0x143da
addq $0x10, %rsp
movq 0x8(%rbx), %rdi
callq 0x2b166
movq (%rbx), %rdi
callq 0x2b166
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 0x2b7af
jmp 0x1f3c7
movl $0x1, %eax
jmp 0x1f443
movq (%r15), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x12edc
cmpl $0x0, (%r14)
jne 0x1f430
movq %r13, %rdi
callq 0x12ad0
cmpl $0x2, (%r13)
jne 0x1f49e
movq %rax, %rdi
movq %r12, %rsi
callq 0x12160
testl %eax, %eax
je 0x1f52b
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1e938
movq %rax, 0x8(%rbx)
cmpl $0x0, (%r14)
jne 0x1f441
movq %r15, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x367cf
movq %rax, 0x8(%rbx)
cmpl $0x0, (%r14)
jne 0x1f441
movq %r13, %rdi
callq 0x12ad0
movq %rax, %rbp
cmpl $0x2, (%r13)
jne 0x1f4f3
movq %rbp, %rdi
movq %r12, %rsi
callq 0x12160
testl %eax, %eax
je 0x1f548
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 0x543ca(%rip), %rax     # 0x738e0
movq %r14, %rdi
movl $0x1d, %esi
movq %rbp, %rcx
pushq $0x50e                  # imm = 0x50E
jmp 0x1f426
movq (%rbx), %rax
cmpl $0x1, (%rax)
jne 0x1f540
cmpl $0x0, 0x148(%rax)
je 0x1f441
movq $0x0, 0x8(%rbx)
movl $0x2, %eax
jmp 0x1f443