// File: /workspace/github_c_makefile_star2_O1/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
subq $0x18, %rsp
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 0x12eda
cmpl $0x0, (%r14)
jne 0x1f3e7
movq %r12, 0x8(%rsp)
movq %r13, %rdi
callq 0x12ad0
movl (%r13), %r12d
cmpl $0x2, %r12d
jne 0x1f32e
movq %rax, %rbp
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x12160
testl %eax, %eax
je 0x1f3e7
cmpl $0x2, %r12d
jne 0x1f32e
leaq 0x545fb(%rip), %rsi     # 0x73919
movq %rbp, %rdi
callq 0x12160
testl %eax, %eax
je 0x1f3f8
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1e874
movq %rax, (%rbx)
cmpl $0x0, (%r14)
jne 0x1f3e7
movq %r15, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x3691f
movq %rax, (%rbx)
cmpl $0x0, (%r14)
jne 0x1f3e7
movq %r13, %rdi
callq 0x12ad0
movq %rax, %rbp
movl (%r13), %r12d
cmpl $0x2, %r12d
jne 0x1f3a3
movq %rbp, %rdi
movq 0x8(%rsp), %rsi
callq 0x12160
testl %eax, %eax
je 0x1f407
cmpl $0x2, %r12d
jne 0x1f3a3
leaq 0x54582(%rip), %rsi     # 0x73919
movq %rbp, %rdi
callq 0x12160
testl %eax, %eax
je 0x1f40e
movq (%r15), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0x544f7(%rip), %rax     # 0x738ac
leaq 0x5455d(%rip), %rdx     # 0x73919
movq %r14, %rdi
movl $0x1d, %esi
movq %rbp, %rcx
pushq $0x4e9                  # imm = 0x4E9
pushq %rax
callq 0x1442a
addq $0x10, %rsp
movq 0x8(%rbx), %rdi
callq 0x2b4c3
movq (%rbx), %rdi
callq 0x2b4c3
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %edi, %edi
movq %r14, %rsi
callq 0x2bb29
jmp 0x1f357
movl $0x1, %eax
jmp 0x1f3e9
movq (%r15), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x12eda
cmpl $0x0, (%r14)
jne 0x1f3d6
movq %r13, %rdi
callq 0x12ad0
cmpl $0x2, (%r13)
movq 0x8(%rsp), %r12
jne 0x1f449
movq %rax, %rdi
movq %r12, %rsi
callq 0x12160
testl %eax, %eax
je 0x1f4d6
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1e874
movq %rax, 0x8(%rbx)
cmpl $0x0, (%r14)
jne 0x1f3e7
movq %r15, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x3691f
movq %rax, 0x8(%rbx)
cmpl $0x0, (%r14)
jne 0x1f3e7
movq %r13, %rdi
callq 0x12ad0
movq %rax, %rbp
cmpl $0x2, (%r13)
jne 0x1f49e
movq %rbp, %rdi
movq %r12, %rsi
callq 0x12160
testl %eax, %eax
je 0x1f4f3
movb (%r12), %al
leaq 0x15(%rsp), %rdx
movb %al, (%rdx)
movw $0x20, 0x1(%rdx)
movq (%r15), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0x543eb(%rip), %rax     # 0x738ac
movq %r14, %rdi
movl $0x1d, %esi
movq %rbp, %rcx
pushq $0x50e                  # imm = 0x50E
jmp 0x1f3cc
movq (%rbx), %rax
cmpl $0x1, (%rax)
jne 0x1f4eb
cmpl $0x0, 0x148(%rax)
je 0x1f3e7
movq $0x0, 0x8(%rbx)
movl $0x2, %eax
jmp 0x1f3e9