// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/frontend/parser_file.c
// Function: prv_block_operation_prep
static bool prv_block_operation_prep(subtilis_parser_t *p, subtilis_token_t *t,
				     subtilis_ir_operand_t *handle,
				     subtilis_ir_operand_t *array_size,
				     size_t *val_reg, bool *cow, bool *arg1_tmp,
				     size_t *el_size, subtilis_error_t *err)

{
	const char *tbuf;
	bool scalar_ref;
	bool check_dims = false;
	subtilis_exp_t *val = NULL;
	subtilis_type_t el_type;

	*handle = prv_parse_handle(p, t, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return false;

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

	val = subtilis_parser_expression(p, t, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return false;

	scalar_ref = subtilis_type_if_is_serializable_ref(&val->type, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return false;
	if (!scalar_ref) {
		subtilis_type_diag_expected_error(
		    p, "string or array of scalar types", &val->type,
		    p->l->stream->name, p->l->line, err);
		goto cleanup;
	}

	subtilis_type_if_element_type(p, &val->type, &el_type, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	*el_size = subtilis_type_if_size(&el_type, err);
	subtilis_type_free(&el_type);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;
	*arg1_tmp = val->temporary;
	*cow = val->type.type == SUBTILIS_TYPE_STRING;

	array_size->reg =
	    subtilis_reference_type_get_size(p, val->exp.ir_op.reg, 0, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	check_dims = (val->type.type == SUBTILIS_TYPE_STRING) ||
		     subtilis_type_if_is_vector(&val->type);

	*val_reg = val->exp.ir_op.reg;

cleanup:

	subtilis_exp_delete(val);

	return check_dims;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1c0, %rsp            # imm = 0x1C0
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movb $0x0, -0x42(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x1a8(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq 0x20(%rbp), %rdx
callq 0x27b50
movq %rax, %rcx
movq -0x1a8(%rbp), %rax
movq %rcx, -0x1a0(%rbp)
movq -0x1a0(%rbp), %rcx
movq %rcx, (%rax)
movq 0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x28584
movb $0x0, -0x1(%rbp)
jmp 0x28782
movq -0x18(%rbp), %rdi
callq 0x12d70
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x285af
movq -0x40(%rbp), %rdi
leaq 0x82004(%rip), %rsi     # 0xaa5a9
callq 0x12140
cmpl $0x0, %eax
je 0x285fa
movq 0x20(%rbp), %rdi
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %r8
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl 0x38(%rax), %r9d
movl $0x1d, %esi
leaq 0x81fd0(%rip), %rdx     # 0xaa5a9
leaq 0x8237b(%rip), %rax     # 0xaa95b
movq %rax, (%rsp)
movl $0x133, 0x8(%rsp)       # imm = 0x133
callq 0x156d0
movb $0x0, -0x1(%rbp)
jmp 0x28782
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq 0x20(%rbp), %rdx
callq 0x24a20
movq %rax, -0x50(%rbp)
movq 0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x28621
movb $0x0, -0x1(%rbp)
jmp 0x28782
movq -0x50(%rbp), %rdi
movq 0x20(%rbp), %rsi
callq 0x4a200
andb $0x1, %al
movb %al, -0x41(%rbp)
movq 0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x28645
movb $0x0, -0x1(%rbp)
jmp 0x28782
testb $0x1, -0x41(%rbp)
jne 0x2867e
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rdx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %rcx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl 0x38(%rax), %r8d
movq 0x20(%rbp), %r9
leaq 0x82316(%rip), %rsi     # 0xaa98a
callq 0x4a5e0
jmp 0x28771
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq 0x20(%rbp), %rcx
leaq -0x198(%rbp), %rdx
callq 0x47b70
movq 0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x286a4
jmp 0x28771
movq 0x20(%rbp), %rsi
leaq -0x198(%rbp), %rdi
callq 0x47420
movq %rax, %rcx
movq 0x18(%rbp), %rax
movq %rcx, (%rax)
leaq -0x198(%rbp), %rdi
callq 0x3e100
movq 0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x286d8
jmp 0x28771
movq -0x50(%rbp), %rax
cmpq $0x0, 0x158(%rax)
setne %cl
movq 0x10(%rbp), %rax
andb $0x1, %cl
movb %cl, (%rax)
movq -0x50(%rbp), %rax
cmpl $0x7, (%rax)
sete %cl
movq -0x38(%rbp), %rax
andb $0x1, %cl
movb %cl, (%rax)
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rax
movq 0x148(%rax), %rsi
movq 0x20(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
callq 0x6dc00
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq 0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x28734
jmp 0x28771
movq -0x50(%rbp), %rcx
movb $0x1, %al
cmpl $0x7, (%rcx)
movb %al, -0x1a9(%rbp)
je 0x28754
movq -0x50(%rbp), %rdi
callq 0x4a040
movb %al, -0x1a9(%rbp)
movb -0x1a9(%rbp), %al
andb $0x1, %al
movb %al, -0x42(%rbp)
movq -0x50(%rbp), %rax
movq 0x148(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x50(%rbp), %rdi
callq 0x36ee0
movb -0x42(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbp
retq