// File: /workspace/github_c_makefile_star2_O3/BernardTatin[P]s7sh/s7.c
// Function: s7_make_ratio
s7_pointer s7_make_ratio(s7_scheme *sc, s7_int a, s7_int b)
    {
        s7_pointer x;
        if (b == 0)
            return(division_by_zero_error(sc, wrap_string(sc, "make-ratio", 10), set_elist_2(sc, wrap_integer1(sc, a), small_int(0))));
        if (a == 0)
            return(small_int(0));
        if (a == b)
            return(small_int(1));
        if (b == 1)
            return(make_integer(sc, a));

#if (!WITH_GMP)
        if (b == s7_int_min)
        {
            /* we've got a problem... This should not trigger an error during reading -- we might have the
             *   ratio on a switch with-bignums or whatever, so its mere occurrence is just an annoyance.
             */
            if (a & 1)
                return(make_real(sc, (long double)a / (long double)b));
            a /= 2;
            b /= 2;
        }
#endif

        if (b < 0)
        {
            a = -a;
            b = -b;
        }

        if (a == s7_int_min)
        {
            while (((a & 1) == 0) && ((b & 1) == 0))
            {
                a /= 2;
                b /= 2;
            }
        }
        else
        {
            s7_int b1, divisor;
            divisor = s7_int_abs(a);
            b1 = b;
            do {
                s7_int temp;
                temp = divisor % b1;
                divisor = b1;
                b1 = temp;
            } while (b1 != 0);
            if (divisor != 1)
            {
                a /= divisor;
                b /= divisor;
            }
        }
        if (b == 1)
            return(make_integer(sc, a));

        new_cell(sc, x, T_RATIO);
        numerator(x) = a;
        denominator(x) = b;
        return(x);
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rsi, %r15
movq %rdi, %rbx
testq %rdx, %rdx
je 0xcfda
testq %r15, %r15
je 0xd056
cmpq %rdx, %r15
jne 0xd067
movq 0x139983(%rip), %rax    # 0x146958
jmp 0xd05d
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %rsi
leal 0x1(%rcx), %eax
andl $0x7, %eax
movl %eax, 0x7dc(%rbx)
leaq 0xfd047(%rip), %rax     # 0x10a046
movq %rax, 0x10(%rsi)
movq $0xa, 0x8(%rsi)
movq 0x1f00(%rbx), %rax
movq %r15, 0x8(%rax)
movq 0x1f00(%rbx), %rax
movq 0x13992c(%rip), %rcx    # 0x146950
movq 0x6e0(%rbx), %rdx
movq %rax, 0x8(%rdx)
movq 0x6e0(%rbx), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x8(%rax)
movq 0x6e0(%rbx), %rdx
movq %rbx, %rdi
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0xd434
movq 0x1398f3(%rip), %rax    # 0x146950
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
cmpq $0x1, %rdx
jne 0xd083
cmpq $0x7ff, %r15            # imm = 0x7FF
ja 0xd0f1
leaq 0x1398d3(%rip), %rax    # 0x146950
movq (%rax,%r15,8), %rax
jmp 0xd05d
movl 0x13d99f(%rip), %eax    # 0x14aa28
shlq $0x3f, %rax
cmpq %rdx, %rax
jne 0xd0af
testb $0x1, %r15b
jne 0xd15a
sarq %r15
movq %rdx, %rcx
shrq $0x3f, %rcx
addq %rdx, %rcx
sarq %rcx
movq %rcx, %rdx
movq %r15, %r14
negq %r14
movq %rdx, %rcx
negq %rcx
cmovsq %rdx, %rcx
testq %rdx, %rdx
cmovnsq %r15, %r14
cmpq %rax, %r14
jne 0xd12f
testb $0x1, %cl
jne 0xd1c1
movq %rax, %r14
movq %rcx, %r15
sarq %r14
shrq %r15
orl %ecx, %eax
movq %r15, %rcx
testb $0x2, %al
movq %r14, %rax
je 0xd0da
jmp 0xd1df
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0xd110
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0xb, (%rax)
movq %r15, 0x8(%rax)
jmp 0xd05d
movq %r15, %rax
negq %rax
cmovsq %r15, %rax
movq %rcx, %rdx
movq %rdx, %rsi
xorl %edx, %edx
divq %rsi
movq %rsi, %rax
testq %rdx, %rdx
jne 0xd13c
cmpq $0x1, %rsi
jne 0xd1c9
movq %rcx, %r15
jmp 0xd1df
movq %r15, 0x10(%rsp)
fildll 0x10(%rsp)
movq %rdx, 0x18(%rsp)
fildll 0x18(%rsp)
fdivrp %st, %st(1)
fstpl 0x8(%rsp)
movsd 0x8(%rsp), %xmm0
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0xd1a1
movq %rbx, %rdi
movsd %xmm0, (%rsp)
callq 0xa550
movsd (%rsp), %xmm0
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0xd, (%rax)
movsd %xmm0, 0x8(%rax)
jmp 0xd05d
movq %rcx, %r15
movq %rax, %r14
jmp 0xd1df
movq %r14, %rax
cqto
idivq %rsi
movq %rax, %r14
movq %rcx, %rax
xorl %edx, %edx
divq %rsi
movq %rax, %r15
cmpq $0x1, %r15
jne 0xd1fe
cmpq $0x7ff, %r14            # imm = 0x7FF
ja 0xd240
leaq 0x13975b(%rip), %rax    # 0x146950
movq (%rax,%r14,8), %rax
jmp 0xd05d
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0xd21d
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0xc, (%rax)
movq %r14, 0x8(%rax)
movq %r15, 0x10(%rax)
jmp 0xd05d
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0xd25f
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0xb, (%rax)
movq %r14, 0x8(%rax)
jmp 0xd05d