// File: /workspace/github_c_makefile_star2_O3/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 0x767f0
movq 0x8(%rcx), %r14
movq 0x8(%rsi), %r12
movb (%r14), %al
decb %al
cmpb $0x2, %al
jae 0x76814
testq %r12, %r12
js 0x76767
cmpq 0x2b0(%rbx), %r12
jle 0x768f5
testq %r12, %r12
movq 0x1270(%rbx), %rax
movq 0x8(%rax), %rax
movq 0xd01e4(%rip), %rcx     # 0x146960
movq 0x1f00(%rbx), %rdx
movq %r12, 0x8(%rdx)
movq 0x1ee8(%rbx), %rdx
leaq 0xd42b3(%rip), %rsi     # 0x14aa48
leaq 0xd42a4(%rip), %rdi     # 0x14aa40
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 0x38dfa
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 0xe42d
movq 0x1270(%rbx), %r15
cmpq $0x7ff, %r12            # imm = 0x7FF
ja 0x76831
leaq 0xd0125(%rip), %rax     # 0x146950
movq (%rax,%r12,8), %r13
jmp 0x7686b
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x76850
movq %rbx, %rdi
callq 0xa550
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 0x76891
movq %rbx, %rdi
callq 0xa550
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 0xded08(%rip), %r8      # 0x1555e0
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movl $0x1, %r9d
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xe659
testq %r12, %r12
je 0x767e3
movq %r12, %rax
cmpb $0x1, (%r14)
jne 0x76915
movq 0x10(%r14), %r14
decq %rax
jne 0x76901
jmp 0x767e3
movq 0x1270(%rbx), %rax
movq 0x8(%rax), %rsi
movq 0xd0039(%rip), %rdx     # 0x146960
movq 0x1f00(%rbx), %rax
movq %r12, 0x8(%rax)
movq 0x1f00(%rbx), %rcx
movq 0xd4100(%rip), %r8      # 0x14aa40
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xe1fe