// File: /workspace/github_c_makefile_star2_O2/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 0x5fddd
movq 0x8(%rcx), %r14
movq 0x8(%rsi), %r12
movb (%r14), %al
decb %al
cmpb $0x2, %al
jae 0x5fdfd
testq %r12, %r12
js 0x5fd90
cmpq 0x2b0(%rbx), %r12
jle 0x5fedc
testq %r12, %r12
movq 0x1270(%rbx), %rax
movq 0x8(%rax), %rsi
movq 0xb5bbb(%rip), %rdx     # 0x115960
movq 0x1f00(%rbx), %rax
movq %r12, 0x8(%rax)
movq 0x1f00(%rbx), %rcx
leaq 0xb9c8a(%rip), %rax     # 0x119a48
leaq 0xb9c7b(%rip), %rdi     # 0x119a40
cmovsq %rax, %rdi
movq (%rdi), %r8
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xcb8f
movq 0x1270(%rbx), %rdx
pushq $0xb
popq %r8
pushq $0x2
popq %r9
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xcd70
movq 0x1270(%rbx), %r15
cmpq $0x7ff, %r12            # imm = 0x7FF
ja 0x5fe1a
leaq 0xb5b3c(%rip), %rax     # 0x115950
movq (%rax,%r12,8), %r13
jmp 0x5fe54
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x5fe39
movq %rbx, %rdi
callq 0x9c27
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 0x5fe7a
movq %rbx, %rdi
callq 0x9c27
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 0xc471f(%rip), %r8      # 0x1245e0
pushq $0x1
popq %r9
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xcf9a
movq %r12, %rax
subq $0x1, %rax
jb 0x5fef1
cmpb $0x1, (%r14)
jne 0x5fefe
movq 0x10(%r14), %r14
jmp 0x5fedf
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x1270(%rbx), %rax
movq 0x8(%rax), %rsi
movq 0xb5a50(%rip), %rdx     # 0x115960
movq 0x1f00(%rbx), %rax
movq %r12, 0x8(%rax)
movq 0x1f00(%rbx), %rcx
movq 0xb9b17(%rip), %r8      # 0x119a40
jmp 0x5fdcc