// File: /workspace/github_c_makefile_star2_O3/xemul[P]cylang/list.c
// Function: eval_list_cut
static int eval_list_cut(struct cy_token *t, struct cy_file *f)
{
	int i, from, to;
	struct cy_token lht, ct;
	struct cy_list_value *lv;

	if (cy_eval_next_x(f, &lht, CY_V_LIST) <= 0)
		return -1;

	if (cy_eval_next_x(f, &ct, CY_V_NUMBER) <= 0)
		return -1;

	if (t->typ->priv == OP_CUT_BOTH) {
		struct cy_token ct2;

		if (cy_eval_next_x(f, &ct2, CY_V_NUMBER) <= 0)
			return -1;

		from = ct.v.v_i;
		to = ct2.v.v_i;
	} else if (t->typ->priv == OP_CUT_HEAD) {
		from = ct.v.v_i;
		to = 0x7fffffff;
	} else {
		from = 0;
		to = ct.v.v_i;
	}

	make_list(&t->v);

	i = 0;
	list_for_each_entry(lv, &lht.v.v_list->h, l) {
		struct cy_list_value *nv;

		if (i < from) {
			i++;
			continue;
		}

		if (i >= to)
			break;

		nv = malloc(sizeof(*lv));
		nv->v = lv->v;
		list_add_tail(&nv->l, &t->v.v_list->h);
		i++;
	}

	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %r15
movq %rdi, %r14
leaq 0x50(%rsp), %rsi
movq %r15, %rdi
callq 0x42c4
testl %eax, %eax
js 0x5840
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
je 0x571e
movq 0x58(%rsp), %rcx
movq 0x8(%rcx), %rcx
testq %rcx, %rcx
je 0x5695
leaq 0x50(%rsp), %rdi
movq %r15, %rsi
callq *%rcx
cmpl $0x1, %eax
jne 0x56b5
cmpl $0x3, 0x68(%rsp)
je 0x56b7
movl $0x3, %edi
callq 0x3bbc
movq %rax, %r14
leaq 0x50(%rsp), %r15
jmp 0x56fe
jl 0x571e
movq %rsp, %rsi
movq %r15, %rdi
callq 0x42c4
testl %eax, %eax
js 0x5845
je 0x571e
movq 0x8(%rsp), %rcx
movq 0x8(%rcx), %rcx
testq %rcx, %rcx
je 0x56e2
movq %rsp, %rdi
movq %r15, %rsi
callq *%rcx
cmpl $0x1, %eax
jne 0x572f
cmpl $0x1, 0x18(%rsp)
je 0x5731
movl $0x1, %edi
callq 0x3bbc
movq %rax, %r14
movq %rsp, %r15
movl 0x18(%r15), %edi
callq 0x3bbc
leaq 0x2a41(%rip), %rsi      # 0x814f
movq %r15, %rdi
movq %r14, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x3240
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jl 0x571e
movq 0x8(%r14), %rax
movq 0x10(%rax), %rax
cmpq $0x1, %rax
je 0x5797
cmpq $0x3, %rax
jne 0x57a3
leaq 0x28(%rsp), %rsi
movq %r15, %rdi
callq 0x42c4
testl %eax, %eax
js 0x584a
je 0x571e
movq 0x30(%rsp), %rcx
movq 0x8(%rcx), %rcx
testq %rcx, %rcx
je 0x5774
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
callq *%rcx
cmpl $0x1, %eax
jne 0x57ac
cmpl $0x1, 0x40(%rsp)
je 0x57b2
movl $0x1, %edi
callq 0x3bbc
movq %rax, %r14
leaq 0x28(%rsp), %r15
jmp 0x56fe
movl 0x20(%rsp), %ebp
movl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
jmp 0x57bb
movl 0x20(%rsp), %r15d
xorl %ebp, %ebp
jmp 0x57bb
jl 0x571e
movl 0x20(%rsp), %ebp
movl 0x48(%rsp), %r15d
movl $0x3, 0x18(%r14)
movl $0x10, %edi
callq 0x3180
movq %rax, 0x20(%r14)
movq %rax, 0x8(%rax)
movq %rax, (%rax)
movq 0x70(%rsp), %rax
movq 0x8(%rax), %r12
movl $0x1, %ebx
cmpq %rax, %r12
je 0x571e
xorl %r13d, %r13d
cmpl %ebp, %r13d
jl 0x582e
cmpl %r15d, %r13d
jge 0x571e
movl $0x20, %edi
callq 0x3180
movups 0x10(%r12), %xmm0
movups %xmm0, 0x10(%rax)
movq 0x20(%r14), %rcx
movq (%rcx), %rdx
movq %rax, (%rcx)
movq %rcx, 0x8(%rax)
movq %rdx, (%rax)
movq %rax, 0x8(%rdx)
movq 0x70(%rsp), %rax
incl %r13d
movq 0x8(%r12), %r12
cmpq %rax, %r12
jne 0x57f2
jmp 0x571e
callq 0x360a
callq 0x35e5
callq 0x35c0