// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/frontend/array_type.c
// Function: prv_check_slice_index2
static void prv_check_slice_index2(subtilis_parser_t *p,
				   const subtilis_type_t *type,
				   subtilis_exp_t *index1,
				   subtilis_exp_t *index2, size_t ptr,
				   subtilis_ir_operand_t error_label,
				   subtilis_error_t *err)
{
	subtilis_ir_operand_t index2_ok;
	subtilis_exp_t *index2_dup = NULL;
	subtilis_exp_t *condee = NULL;
	subtilis_exp_t *max_dim = NULL;

	if ((index2->type.type == SUBTILIS_TYPE_CONST_INTEGER) &&
	    (type->params.array.dims[0] != SUBTILIS_DYNAMIC_DIMENSION)) {
		if (index2->exp.ir_op.integer >
		    type->params.array.dims[0] + 1) {
			subtilis_error_set_bad_slice(
			    err, index1->exp.ir_op.integer,
			    index2->exp.ir_op.integer, p->l->stream->name,
			    p->l->line);
			return;
		}
	} else {
		index2_ok.label = subtilis_ir_section_new_label(p->current);

		max_dim = prv_calc_max_dim(p, type, ptr, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;

		index2_dup = subtilis_type_if_dup(index2, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;

		condee = subtilis_type_if_lte(p, index2_dup, max_dim, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;
		subtilis_ir_section_add_instr_reg(
		    p->current, SUBTILIS_OP_INSTR_JMPC, condee->exp.ir_op,
		    index2_ok, error_label, err);
		subtilis_exp_delete(condee);
		if (err->type != SUBTILIS_ERROR_OK)
			return;
		subtilis_ir_section_add_label(p->current, index2_ok.label, err);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq 0x10(%rbp), %rax
movq %r9, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x5d5dc
movq -0x18(%rbp), %rax
cmpl $-0x1, 0xc(%rax)
je 0x5d5dc
movq -0x28(%rbp), %rax
movl 0x148(%rax), %eax
movq -0x18(%rbp), %rcx
movl 0xc(%rcx), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jle 0x5d5d7
movq 0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movl 0x148(%rax), %edx
movq -0x28(%rbp), %rax
movl 0x148(%rax), %ecx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %r8
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl 0x38(%rax), %r9d
movl $0x65, %esi
leaq 0x4f3bc(%rip), %rax     # 0xac97d
movq %rax, (%rsp)
movl $0x2b7, 0x8(%rsp)       # imm = 0x2B7
callq 0x157b0
jmp 0x5d6a6
jmp 0x5d6a6
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x39940
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq 0x10(%rbp), %rcx
callq 0x5d6b0
movq %rax, -0x50(%rbp)
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x5d614
jmp 0x5d6a6
movq -0x28(%rbp), %rdi
movq 0x10(%rbp), %rsi
callq 0x47d20
movq %rax, -0x40(%rbp)
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x5d630
jmp 0x5d6a6
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq 0x10(%rbp), %rcx
callq 0x49700
movq %rax, -0x48(%rbp)
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x5d654
jmp 0x5d6a6
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x48(%rbp), %rax
movq 0x10(%rbp), %r9
movq 0x148(%rax), %rdx
movq -0x38(%rbp), %rcx
movq -0x8(%rbp), %r8
movl $0x43, %esi
callq 0x38360
movq -0x48(%rbp), %rdi
callq 0x36ee0
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x5d691
jmp 0x5d6a6
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x38(%rbp), %rsi
movq 0x10(%rbp), %rdx
callq 0x39960
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)