// File: /workspace/github_c_makefile_star2_O1/BernardTatin[P]s7sh/s7.c
// Function: g_list_tail
static s7_pointer g_list_tail(s7_scheme *sc, s7_pointer args)
                {
#define H_list_tail "(list-tail lst i) returns the list from the i-th element on"
#define Q_list_tail s7_make_signature(sc, 3, sc->T, sc->is_pair_symbol, sc->is_integer_symbol) /* #t: (list-tail '(1 . 2) 1) -> 2 */
                    s7_pointer lst, p;
                    s7_int i, index;

                    lst = car(args);
                    p = cadr(args);
                    if (!s7_is_integer(p))
                        return(method_or_bust(sc, p, sc->list_tail_symbol, args, T_INTEGER, 2));
                    index = s7_integer(p);

                    if (!is_list(lst))
                        return(method_or_bust_with_type(sc, lst, sc->list_tail_symbol, list_2(sc, lst, make_integer(sc, index)), a_list_string, 1));

                    if ((index < 0) || (index > sc->max_list_length))
                        return(out_of_range(sc, sc->list_tail_symbol, small_int(2), wrap_integer1(sc, index), (index < 0) ? its_negative_string : its_too_large_string));

                    for (i = 0, p = lst; (i < index) && (is_pair(p)); i++, p = cdr(p)) {}
                    if (i < index)
                        return(out_of_range(sc, sc->list_tail_symbol, small_int(2), wrap_integer1(sc, index), its_too_large_string));
                    return(p);
                }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rcx
movq %rdi, %rbx
movq 0x10(%rsi), %rax
movq 0x8(%rax), %rsi
cmpb $0xb, (%rsi)
jne 0x7c47c
movq 0x8(%rcx), %r14
movq 0x8(%rsi), %r12
movb (%r14), %al
decb %al
cmpb $0x2, %al
jae 0x7c4a0
testq %r12, %r12
js 0x7c3f3
cmpq 0x2b0(%rbx), %r12
jle 0x7c581
testq %r12, %r12
movq 0x1270(%rbx), %rax
movq 0x8(%rax), %rax
movq 0xd2558(%rip), %rcx     # 0x14e960
movq 0x1f00(%rbx), %rdx
movq %r12, 0x8(%rdx)
movq 0x1ee8(%rbx), %rdx
leaq 0xd6627(%rip), %rsi     # 0x152a48
leaq 0xd6618(%rip), %rdi     # 0x152a40
cmovsq %rsi, %rdi
movq 0x1f00(%rbx), %rsi
movq (%rdi), %rdi
movq 0x10(%rdx), %rdx
movq %rax, 0x8(%rdx)
movq 0x10(%rdx), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rax), %rax
movq %rsi, 0x8(%rax)
movq 0x10(%rax), %rax
movq %rdi, 0x8(%rax)
movq 0x1948(%rbx), %r14
movq 0x1ee8(%rbx), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3b366
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x1270(%rbx), %rdx
movq %rbx, %rdi
movl $0xb, %r8d
movl $0x2, %r9d
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xf1ae
movq 0x1270(%rbx), %r15
cmpq $0x7ff, %r12            # imm = 0x7FF
ja 0x7c4bd
leaq 0xd2499(%rip), %rax     # 0x14e950
movq (%rax,%r12,8), %r13
jmp 0x7c4f7
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x7c4d5
movq %rbx, %rdi
callq 0xb389
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %r13
movq $0xb, (%r13)
movq %r12, 0x8(%r13)
movq 0x90(%rbx), %rax
movq 0x110(%rbx), %r12
cmpq 0x98(%rbx), %rax
ja 0x7c516
movq %rbx, %rdi
callq 0xb389
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movl $0x200001, %edx         # imm = 0x200001
movq %rdx, (%rax)
movq %r13, 0x8(%rax)
movq %r12, 0x10(%rax)
movq 0x90(%rbx), %rcx
leaq -0x8(%rcx), %rsi
movq %rsi, 0x90(%rbx)
movq -0x8(%rcx), %rcx
movq %rdx, (%rcx)
movq %r14, 0x8(%rcx)
movq %rax, 0x10(%rcx)
movq 0xe107c(%rip), %r8      # 0x15d5e0
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movl $0x1, %r9d
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xf3da
testq %r12, %r12
je 0x7c46f
movq %r12, %rax
cmpb $0x1, (%r14)
jne 0x7c5a1
movq 0x10(%r14), %r14
decq %rax
jne 0x7c58d
jmp 0x7c46f
movq 0x1270(%rbx), %rax
movq 0x8(%rax), %rsi
movq 0xd23ad(%rip), %rdx     # 0x14e960
movq 0x1f00(%rbx), %rax
movq %r12, 0x8(%rax)
movq 0x1f00(%rbx), %rcx
movq 0xd6474(%rip), %r8      # 0x152a40
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xef7f