// File: /workspace/github_c_makefile_star2_O1/BernardTatin[P]s7sh/s7.c
// Function: g_less_or_equal
static s7_pointer g_less_or_equal(s7_scheme *sc, s7_pointer args)
    {
#define H_less_or_equal "(<= x1 ...) returns #t if its arguments are in increasing order"
#define Q_less_or_equal s7_make_circular_signature(sc, 1, 2, sc->is_boolean_symbol, sc->is_real_symbol)

        s7_pointer x, y, p;

        x = car(args);
        p = cdr(args);

        switch (type(x))
        {
            case T_INTEGER:
INTEGER_LEQ:
                y = car(p);
                p = cdr(p);
                switch (type(y))
                {
                    case T_INTEGER:
                        if (integer(x) > integer(y)) goto NOT_LEQ;
                        if (is_null(p)) return(sc->T);
                        x = y;
                        goto INTEGER_LEQ;

                    case T_RATIO:
                        /* no gmp here, but this can overflow: (< 9223372036 1/9223372036), but conversion to real is also problematic
                        */
                        if ((integer(x) >= 0) && (numerator(y) < 0)) goto NOT_LEQ;  /* (< 1 -1/2), ratio numerator can't be 0 */
                        if ((integer(x) <= 0) && (numerator(y) > 0))                 /* (< 0 1/2) */
                        {
                            if (is_null(p)) return(sc->T);
                            x = y;
                            goto RATIO_LEQ;
                        }
                        if ((integer(x) < s7_int32_max) &&
                                (integer(x) > s7_int32_min) &&
                                (denominator(y) < s7_int32_max))
                        {
                            if ((integer(x) * denominator(y)) > numerator(y)) goto NOT_LEQ;
                        }
                        else
                        {
                            if (integer(x) > fraction(y)) goto NOT_LEQ;
                        }
                        if (is_null(p)) return(sc->T);
                        x = y;
                        goto RATIO_LEQ;

                    case T_REAL:
                        if (is_NaN(real(y))) goto NOT_LEQ;
                        if (integer(x) > real(y)) goto NOT_LEQ;
                        if (is_null(p)) return(sc->T);
                        x = y;
                        goto REAL_LEQ;

                    default:
                        return(method_or_bust(sc, y, sc->leq_symbol, cons_unchecked(sc, x, cons(sc, y, p)), T_REAL, position_of(p, args) - 1));
                }

            case T_RATIO:
RATIO_LEQ:
                y = car(p);
                p = cdr(p);
                switch (type(y))
                {
                    case T_INTEGER:
                        if ((numerator(x) > 0) && (integer(y) <= 0)) goto NOT_LEQ;
                        if ((numerator(x) < 0) && (integer(y) >= 0))
                        {
                            if (is_null(p)) return(sc->T);
                            x = y;
                            goto INTEGER_LEQ;
                        }
                        if ((integer(y) < s7_int32_max) &&
                                (integer(y) > s7_int32_min) &&
                                (denominator(x) < s7_int32_max))
                        {
                            if (numerator(x) > (integer(y) * denominator(x))) goto NOT_LEQ;
                        }
                        else
                        {
                            if (fraction(x) > integer(y)) goto NOT_LEQ;
                        }
                        if (is_null(p)) return(sc->T);
                        x = y;
                        goto INTEGER_LEQ;

                    case T_RATIO:
                        {
                            s7_int d1, d2, n1, n2;
                            d1 = denominator(x);
                            n1 = numerator(x);
                            d2 = denominator(y);
                            n2 = numerator(y);
                            if (d1 == d2)
                            {
                                if (n1 > n2) goto NOT_LEQ;
                            }
                            else
                            {
#if HAVE_OVERFLOW_CHECKS
                                if ((multiply_overflow(n1, d2, &n1)) ||
                                        (multiply_overflow(n2, d1, &n2)))
                                {
                                    if (fraction(x) > fraction(y)) goto NOT_LEQ;
                                }
                                else
                                {
                                    if (n1 > n2) goto NOT_LEQ;
                                }
#else
                                if ((n1 * d2) >  (n2 * d1)) goto NOT_LEQ;
#endif
                            }
                        }
                        if (is_null(p)) return(sc->T);
                        x = y;
                        goto RATIO_LEQ;

                    case T_REAL:
                        if (is_NaN(real(y))) goto NOT_LEQ;
                        if (fraction(x) > real(y)) goto NOT_LEQ;
                        if (is_null(p)) return(sc->T);
                        x = y;
                        goto REAL_LEQ;

                    default:
                        return(method_or_bust(sc, y, sc->leq_symbol, cons_unchecked(sc, x, cons(sc, y, p)), T_REAL, position_of(p, args) - 1));
                }

            case T_REAL:
                if (is_NaN(real(x))) goto NOT_LEQ;

REAL_LEQ:
                y = car(p);
                p = cdr(p);
                switch (type(y))
                {
                    case T_INTEGER:
                        if (real(x) > integer(y)) goto NOT_LEQ;
                        if (is_null(p)) return(sc->T);
                        x = y;
                        goto INTEGER_LEQ;

                    case T_RATIO:
                        if (real(x) > fraction(y)) goto NOT_LEQ;
                        if (is_null(p)) return(sc->T);
                        x = y;
                        goto RATIO_LEQ;

                    case T_REAL:
                        if (is_NaN(real(y))) goto NOT_LEQ;
                        if (real(x) > real(y)) goto NOT_LEQ;
                        if (is_null(p)) return(sc->T);
                        x = y;
                        goto REAL_LEQ;

                    default:
                        return(method_or_bust(sc, y, sc->leq_symbol, cons_unchecked(sc, x, cons(sc, y, p)), T_REAL, position_of(p, args) - 1));
                }

            default:
                return(method_or_bust(sc, x, sc->leq_symbol, args, T_REAL, 1));
        }

NOT_LEQ:
        for (; is_pair(p); p = cdr(p))
            if (!is_real_via_method(sc, car(p)))
                return(wrong_type_argument(sc, sc->leq_symbol, position_of(p, args), car(p), T_REAL));

        return(sc->F);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rsi), %r15
movq 0x10(%rsi), %r13
movzbl (%r15), %eax
cmpl $0xd, %eax
je 0x733e0
cmpl $0xc, %eax
je 0x73643
cmpl $0xb, %eax
je 0x733f5
movq 0x1220(%rbx), %rdx
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rcx
movl $0xd, %r8d
movl $0x1, %r9d
jmp 0x73958
movsd 0x8(%r15), %xmm0
ucomisd %xmm0, %xmm0
jnp 0x7359c
jmp 0x7377a
movq %r15, %rbp
movq 0x8(%r13), %r15
movq 0x10(%r13), %r13
movzbl (%r15), %eax
cmpl $0xb, %eax
jne 0x73428
movq 0x8(%rbp), %rax
cmpq 0x8(%r15), %rax
jg 0x7377a
movq %r15, %rbp
cmpq 0x110(%rbx), %r13
jne 0x733f8
jmp 0x73a18
cmpl $0xc, %eax
je 0x7345e
cmpl $0xd, %eax
jne 0x734d4
movsd 0x8(%r15), %xmm0
ucomisd %xmm0, %xmm0
jp 0x7377a
xorps %xmm1, %xmm1
cvtsi2sdq 0x8(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x7358f
jmp 0x7377a
movq 0x8(%rbp), %rax
testq %rax, %rax
js 0x73472
cmpq $0x0, 0x8(%r15)
js 0x7377a
testq %rax, %rax
jle 0x7357f
xorl %edx, %edx
cmpb $0x0, 0xe9f60(%rip)     # 0x15d3e4
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmoveq %rdx, %rcx
cmpq %rcx, %rax
jge 0x73557
movb 0xe9fc8(%rip), %dl      # 0x15d464
notb %dl
movzbl %dl, %edx
shll $0x1f, %edx
addq $-0x80000000, %rdx      # imm = 0x80000000
cmpq %rdx, %rax
jle 0x73557
movq 0x10(%r15), %rdx
cmpq %rcx, %rdx
jge 0x73557
imulq %rax, %rdx
cmpq 0x8(%r15), %rdx
jle 0x73636
jmp 0x7377a
movq 0x1220(%rbx), %r12
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x734f3
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 %r15, 0x8(%rax)
movq %r13, 0x10(%rax)
movq 0x90(%rbx), %rcx
leaq -0x8(%rcx), %rsi
movq %rsi, 0x90(%rbx)
movq -0x8(%rcx), %rcx
movq %rdx, (%rcx)
movq %rbp, 0x8(%rcx)
movq %rax, 0x10(%rcx)
xorl %r9d, %r9d
cmpq %r14, %r13
je 0x73949
movq 0x10(%r14), %r14
incl %r9d
cmpq %r13, %r14
jne 0x73546
jmp 0x73949
movq %rax, 0x60(%rsp)
fildll 0x60(%rsp)
movq 0x8(%r15), %rax
movq 0x10(%r15), %rcx
movq %rax, 0x70(%rsp)
fildll 0x70(%rsp)
movq %rcx, 0x68(%rsp)
fildll 0x68(%rsp)
jmp 0x73628
cmpq $0x0, 0x8(%r15)
jg 0x73636
jmp 0x7347b
cmpq 0x110(%rbx), %r13
je 0x73a18
movq %r15, %rbp
movq 0x8(%r13), %r15
movq 0x10(%r13), %r13
movzbl (%r15), %eax
cmpl $0xd, %eax
jne 0x735e0
movsd 0x8(%r15), %xmm0
ucomisd %xmm0, %xmm0
jp 0x7377a
movsd 0x8(%rbp), %xmm1
ucomisd %xmm0, %xmm1
ja 0x7377a
movq %r15, %rbp
cmpq 0x110(%rbx), %r13
jne 0x7359f
jmp 0x73a18
cmpl $0xc, %eax
je 0x7360b
cmpl $0xb, %eax
jne 0x738cf
movsd 0x8(%rbp), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdq 0x8(%r15), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x73a0b
jmp 0x7377a
fldl 0x8(%rbp)
movq 0x8(%r15), %rax
movq 0x10(%r15), %rcx
movq %rax, 0x40(%rsp)
fildll 0x40(%rsp)
movq %rcx, 0x38(%rsp)
fildll 0x38(%rsp)
fdivrp %st, %st(1)
fxch %st(1)
fucompi %st(1), %st
fstp %st(0)
ja 0x7377a
cmpq 0x110(%rbx), %r13
je 0x73a18
movq %r15, %rbp
movq 0x8(%r13), %r15
movq 0x10(%r13), %r13
movzbl (%r15), %eax
cmpl $0xc, %eax
jne 0x736ea
movq 0x8(%rbp), %rdx
movq 0x10(%rbp), %rsi
movq 0x8(%r15), %rax
movq 0x10(%r15), %rcx
cmpq %rcx, %rsi
jne 0x73695
movl $0x5, %ecx
cmpq %rax, %rdx
jg 0x7367c
xorl %ecx, %ecx
testl %ecx, %ecx
jne 0x73771
movq %r15, %rbp
cmpq 0x110(%rbx), %r13
jne 0x73646
jmp 0x73a18
movq %rdx, %rdi
imulq %rcx, %rdi
jo 0x736a7
movq %rax, %r8
imulq %rsi, %r8
jno 0x736de
movq %rdx, 0x18(%rsp)
fildll 0x18(%rsp)
movq %rsi, 0x20(%rsp)
fildll 0x20(%rsp)
fdivrp %st, %st(1)
movq %rax, 0x28(%rsp)
fildll 0x28(%rsp)
movq %rcx, 0x30(%rsp)
fildll 0x30(%rsp)
fdivrp %st, %st(1)
movl $0x5, %ecx
fxch %st(1)
fucompi %st(1), %st
fstp %st(0)
jbe 0x7367a
jmp 0x7367c
movl $0x5, %ecx
cmpq %r8, %rdi
jle 0x7367a
jmp 0x7367c
cmpl $0xd, %eax
je 0x73808
cmpl $0xb, %eax
jne 0x7384f
movq 0x8(%rbp), %rax
testq %rax, %rax
jle 0x7370c
cmpq $0x0, 0x8(%r15)
jle 0x7377a
testq %rax, %rax
js 0x73a00
movq 0x8(%r15), %rcx
xorl %esi, %esi
cmpb $0x0, 0xe9cc2(%rip)     # 0x15d3e4
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
cmoveq %rsi, %rdx
cmpq %rdx, %rcx
jge 0x739d4
movb 0xe9d29(%rip), %sil     # 0x15d464
notb %sil
movzbl %sil, %esi
shll $0x1f, %esi
addq $-0x80000000, %rsi      # imm = 0x80000000
cmpq %rsi, %rcx
jle 0x739d4
movq 0x10(%rbp), %rsi
cmpq %rdx, %rsi
jge 0x739d4
imulq %rcx, %rsi
cmpq %rsi, %rax
jle 0x73a0b
jmp 0x7377a
cmpl $0x5, %ecx
jne 0x7396b
cmpb $0x1, (%r13)
jne 0x737bc
leaq 0xdf228(%rip), %r15     # 0x1529b0
movq 0x8(%r13), %rsi
movzbl (%rsi), %eax
cmpb $0x0, (%rax,%r15)
jne 0x737b1
testb $0x40, 0x3(%rsi)
je 0x737c8
cmpb $0x1, 0x24c(%rbx)
jne 0x737c8
movq %rbx, %rdi
callq 0x10523b
testb %al, %al
je 0x737c8
movq 0x10(%r13), %r13
cmpb $0x1, (%r13)
je 0x73788
movq 0x120(%rbx), %rax
jmp 0x73a1f
movq 0x1220(%rbx), %rax
movl $0x1, %ecx
cmpq %r14, %r13
je 0x737e4
incl %ecx
movq 0x10(%r14), %r14
cmpq %r13, %r14
jne 0x737d9
movq 0x8(%rax), %r14
movslq %ecx, %r15
cmpl $0x7ff, %r15d           # imm = 0x7FF
ja 0x73970
leaq 0xdb151(%rip), %rax     # 0x14e950
movq (%rax,%r15,8), %rdx
jmp 0x739a9
movsd 0x8(%r15), %xmm0
ucomisd %xmm0, %xmm0
jp 0x7377a
movq 0x8(%rbp), %rax
movq 0x10(%rbp), %rcx
movq %rax, 0x58(%rsp)
fildll 0x58(%rsp)
movq %rcx, 0x50(%rsp)
fildll 0x50(%rsp)
fdivrp %st, %st(1)
movsd %xmm0, 0x48(%rsp)
fldl 0x48(%rsp)
fxch %st(1)
fucompi %st(1), %st
fstp %st(0)
jbe 0x7358f
jmp 0x7377a
movq 0x1220(%rbx), %r12
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x7386e
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 %r15, 0x8(%rax)
movq %r13, 0x10(%rax)
movq 0x90(%rbx), %rcx
leaq -0x8(%rcx), %rsi
movq %rsi, 0x90(%rbx)
movq -0x8(%rcx), %rcx
movq %rdx, (%rcx)
movq %rbp, 0x8(%rcx)
movq %rax, 0x10(%rcx)
xorl %r9d, %r9d
cmpq %r14, %r13
je 0x73949
movq 0x10(%r14), %r14
incl %r9d
cmpq %r13, %r14
jne 0x738c1
jmp 0x73949
movq 0x1220(%rbx), %r12
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x738ee
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 %r15, 0x8(%rax)
movq %r13, 0x10(%rax)
movq 0x90(%rbx), %rcx
leaq -0x8(%rcx), %rsi
movq %rsi, 0x90(%rbx)
movq -0x8(%rcx), %rcx
movq %rdx, (%rcx)
movq %rbp, 0x8(%rcx)
movq %rax, 0x10(%rcx)
xorl %r9d, %r9d
cmpq %r14, %r13
je 0x73949
movq 0x10(%r14), %r14
incl %r9d
cmpq %r13, %r14
jne 0x7393d
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movl $0xd, %r8d
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf1ae
jmp 0x73a1f
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x73988
movq %rbx, %rdi
callq 0xb389
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rdx
movq $0xb, (%rdx)
movq %r15, 0x8(%rdx)
movq 0x8(%r13), %rcx
movq 0x140(%rbx), %r8
movq 0xdf10d(%rip), %r9      # 0x152ac8
movq %rbx, %rdi
movq %r14, %rsi
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb31d
movq %rax, (%rsp)
fildll (%rsp)
movq 0x10(%rbp), %rax
movq %rax, 0x10(%rsp)
fildll 0x10(%rsp)
fdivrp %st, %st(1)
movq %rcx, 0x8(%rsp)
fildll 0x8(%rsp)
fxch %st(1)
fucompi %st(1), %st
fstp %st(0)
jbe 0x73a0b
jmp 0x7377a
cmpq $0x0, 0x8(%r15)
js 0x73715
cmpq 0x110(%rbx), %r13
jne 0x733f5
movq 0x118(%rbx), %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq