// File: /workspace/github_c_makefile_star2_O1/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, %r14
movq %rdi, %rbx
leaq 0x28(%rsp), %rsi
movq %r14, %rdi
callq 0x42fd
testl %eax, %eax
js 0x59cb
je 0x57bf
movq 0x30(%rsp), %rcx
movq 0x8(%rcx), %rcx
testq %rcx, %rcx
je 0x57c1
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
callq *%rcx
jmp 0x57c1
xorl %eax, %eax
cmpl $0x1, %eax
jne 0x580a
movl $0x1, %eax
cmpl $0x3, 0x40(%rsp)
je 0x580a
movl $0x3, %edi
callq 0x3bfc
movq %rax, %r15
leaq 0x28(%rsp), %r12
movl 0x18(%r12), %edi
callq 0x3bfc
leaq 0x3963(%rip), %rsi      # 0x9158
movq %r12, %rdi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x3240
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jle 0x59ba
movq %rsp, %rsi
movq %r14, %rdi
callq 0x42fd
testl %eax, %eax
js 0x59d0
je 0x5844
movq 0x8(%rsp), %rcx
movq 0x8(%rcx), %rcx
testq %rcx, %rcx
je 0x5846
movq %rsp, %rdi
movq %r14, %rsi
callq *%rcx
jmp 0x5846
xorl %eax, %eax
cmpl $0x1, %eax
jne 0x588d
movl $0x1, %eax
cmpl $0x1, 0x18(%rsp)
je 0x588d
movl $0x1, %edi
callq 0x3bfc
movq %rax, %r15
movq %rsp, %r12
movl 0x18(%r12), %edi
callq 0x3bfc
leaq 0x38e0(%rip), %rsi      # 0x9158
movq %r12, %rdi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x3240
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %eax, %eax
jle 0x59ba
movq 0x8(%rbx), %rax
movq 0x10(%rax), %rax
cmpq $0x1, %rax
je 0x58da
cmpq $0x3, %rax
jne 0x58e7
leaq 0x50(%rsp), %rsi
movq %r14, %rdi
callq 0x42fd
testl %eax, %eax
js 0x59d5
je 0x58f1
movq 0x58(%rsp), %rcx
movq 0x8(%rcx), %rcx
testq %rcx, %rcx
je 0x58f3
leaq 0x50(%rsp), %rdi
movq %r14, %rsi
callq *%rcx
jmp 0x58f3
movl 0x20(%rsp), %r14d
movl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
jmp 0x5949
movl 0x20(%rsp), %r15d
xorl %r14d, %r14d
jmp 0x5949
xorl %eax, %eax
cmpl $0x1, %eax
jne 0x593b
movl $0x1, %eax
cmpl $0x1, 0x68(%rsp)
je 0x593b
movl $0x1, %edi
callq 0x3bfc
movq %rax, %r14
leaq 0x50(%rsp), %r15
movl 0x18(%r15), %edi
callq 0x3bfc
leaq 0x3832(%rip), %rsi      # 0x9158
movq %r15, %rdi
movq %r14, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x3240
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %eax, %eax
jle 0x59ba
movl 0x20(%rsp), %r14d
movl 0x70(%rsp), %r15d
movl $0x3, 0x18(%rbx)
movl $0x10, %edi
callq 0x3180
movq %rax, 0x20(%rbx)
movq %rax, 0x8(%rax)
movq %rax, (%rax)
xorl %r12d, %r12d
movq 0x48(%rsp), %r13
movl $0x1, %ebp
movq 0x8(%r13), %r13
cmpq 0x48(%rsp), %r13
je 0x59ba
cmpl %r14d, %r12d
jl 0x59b1
movb $0x1, %al
cmpl %r15d, %r12d
jge 0x59b6
movl $0x20, %edi
callq 0x3180
movups 0x10(%r13), %xmm0
movups %xmm0, 0x10(%rax)
movq 0x20(%rbx), %rcx
movq (%rcx), %rdx
movq %rax, (%rcx)
movq %rcx, 0x8(%rax)
movq %rdx, (%rax)
movq %rax, 0x8(%rdx)
incl %r12d
xorl %eax, %eax
testb %al, %al
je 0x5972
movl %ebp, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x363d
callq 0x3618
callq 0x35f3