// File: /workspace/github_c_makefile_star2_O1/BernardTatin[P]s7sh/s7.c
// Function: g_lcm
static s7_pointer g_lcm(s7_scheme *sc, s7_pointer args)
    {
        /* (/ (* m n) (gcd m n)), (lcm a b c) -> (lcm a (lcm b c)) */
#define H_lcm "(lcm ...) returns the least common multiple of its rational arguments"
#define Q_lcm sc->pcl_f

        s7_int n = 1, d = 0;
        s7_pointer p;

        if (!is_pair(args))
            return(small_int(1));

        if (!is_pair(cdr(args)))
        {
            if (!is_rational(car(args)))
                return(method_or_bust_with_type(sc, car(args), sc->lcm_symbol, args, a_rational_string, 1));
            return(g_abs(sc, args));
        }

        for (p = args; is_pair(p); p = cdr(p))
        {
            s7_pointer x;
            s7_int b;
            x = car(p);
            switch (type(x))
            {
                case T_INTEGER:
                    if (integer(x) == 0)
                        n = 0;
                    else
                    {
                        b = integer(x);
                        if (b < 0) b = -b;
#if HAVE_OVERFLOW_CHECKS
                        if (multiply_overflow(n / c_gcd(n, b), b, &n))
                            return(simple_out_of_range(sc, sc->lcm_symbol, args, result_is_too_large_string));
#else
                        n = (n / c_gcd(n, b)) * b;
#endif
                    }
                    if (d != 0) d = 1;
                    break;

                case T_RATIO:
                    b = numerator(x);
                    if (b < 0) b = -b;
                    n = (n / c_gcd(n, b)) * b;
                    if (d == 0)
                    {
                        if (p == args)
                            d = s7_denominator(x);
                        else d = 1;
                    }
                    else d = c_gcd(d, s7_denominator(x));
                    break;

                default:
                    return(method_or_bust_with_type(sc, x, sc->lcm_symbol, cons(sc, (d <= 1) ? make_integer(sc, n) : s7_make_ratio(sc, n, d), p),
                                a_rational_string, position_of(p, args)));
            }
            if (n < 0) return(simple_out_of_range(sc, sc->lcm_symbol, args, result_is_too_large_string));
            if (n == 0)
            {
                for (p = cdr(p); is_pair(p); p = cdr(p))
                    if (!is_rational_via_method(sc, car(p)))
                        return(wrong_type_argument_with_type(sc, sc->lcm_symbol, position_of(p, args), x, a_rational_string));
                return(small_int(0));
            }
        }

        if (d <= 1)
            return(make_integer(sc, n));
        return(make_simple_ratio(sc, n, d));
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
cmpb $0x1, (%rsi)
jne 0x6e955
movq %rsi, %r15
movq %rdi, %rbx
movq 0x10(%rsi), %rax
cmpb $0x1, (%rax)
jne 0x6e96b
cmpb $0x1, (%r15)
jne 0x6e998
movl $0x1, %r12d
movq $0x0, 0x8(%rsp)
movq %r15, %r14
movq %r15, (%rsp)
movq 0x8(%r14), %r13
movzbl (%r13), %ebp
cmpl $0xc, %ebp
je 0x6e5db
cmpl $0xb, %ebp
jne 0x6e62a
movq 0x8(%r13), %rax
testq %rax, %rax
je 0x6e66c
movq %rax, %r15
negq %r15
cmovsq %rax, %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x103913
movq %rax, %rcx
movq %r12, %rax
cqto
idivq %rcx
movq %rax, %r12
imulq %r15, %r12
jno 0x6e690
movq 0x1210(%rbx), %rax
movq 0x8(%rax), %rax
movq 0xef079(%rip), %rcx     # 0x15d638
movq 0x1ef8(%rbx), %rdx
movq 0x10(%rdx), %rdx
movq %rax, 0x8(%rdx)
movq 0x10(%rdx), %rax
movq (%rsp), %r15
jmp 0x6e7e0
movq 0x8(%r13), %rax
movq %rax, %r15
negq %r15
cmovsq %rax, %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x103913
movq %rax, %rcx
movq %r12, %rax
cqto
idivq %rcx
movq %rax, %r12
imulq %r15, %r12
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x6e671
movl $0x1, %esi
cmpb $0xc, %bpl
movq (%rsp), %r15
jne 0x6e623
movq 0x10(%r13), %rsi
callq 0x103913
jmp 0x6e69f
movq 0x1210(%rbx), %rbp
movq 0x8(%rsp), %rdx
cmpq $0x1, %rdx
jg 0x6e659
cmpq $0x7ff, %r12            # imm = 0x7FF
ja 0x6e818
leaq 0xe0300(%rip), %rax     # 0x14e950
movq (%rax,%r12,8), %r15
jmp 0x6e851
movq %rbx, %rdi
movq %r12, %rsi
callq 0xdd7f
movq %rax, %r15
jmp 0x6e851
xorl %r12d, %r12d
jmp 0x6e694
movq (%rsp), %r15
cmpq %r15, %r14
setne %al
cmpb $0xc, %bpl
setne %cl
orb %al, %cl
jne 0x6e8e3
movq 0x10(%r13), %rax
jmp 0x6e69f
movq (%rsp), %r15
xorl %eax, %eax
cmpq $0x0, 0x8(%rsp)
setne %al
movq %rax, 0x8(%rsp)
testq %r12, %r12
js 0x6e7bb
movb $0x1, %al
jne 0x6e8c8
movq 0x10(%r14), %r14
cmpb $0x1, (%r14)
jne 0x6e80c
movq 0x8(%r14), %r12
movzbl (%r12), %eax
leaq 0xe431d(%rip), %rcx     # 0x1529f0
cmpb $0x1, (%rax,%rcx)
je 0x6e6b5
testb $0x40, 0x3(%r12)
je 0x6e777
cmpb $0x1, 0x24c(%rbx)
jne 0x6e777
movq %rbx, %rdi
movq %r12, %rsi
callq 0x9a55
movq 0x1178(%rbx), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x99ef
cmpq 0x128(%rbx), %rax
je 0x6e777
movq %rax, %r15
movq 0x90(%rbx), %rax
movq 0x110(%rbx), %rbp
cmpq 0x98(%rbx), %rax
ja 0x6e73a
movq %rbx, %rdi
callq 0xb389
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rdx
movq $0x200001, (%rdx)       # imm = 0x200001
movq %r12, 0x8(%rdx)
movq %rbp, 0x10(%rdx)
movq %rbx, %rdi
movq %r15, %rsi
callq 0xbd41
cmpq 0x120(%rbx), %rax
jne 0x6e6b5
movq (%rsp), %rcx
movl $0x1, %eax
cmpq %rcx, %r14
je 0x6e790
incl %eax
movq 0x10(%rcx), %rcx
cmpq %r14, %rcx
jne 0x6e785
movq 0x1210(%rbx), %rcx
movq 0x8(%rcx), %r12
movslq %eax, %r15
cmpl $0x7ff, %r15d           # imm = 0x7FF
ja 0x6e8ed
leaq 0xe019e(%rip), %rax     # 0x14e950
movq (%rax,%r15,8), %rdx
jmp 0x6e926
movq 0x1210(%rbx), %rax
movq 0x8(%rax), %rax
movq 0xeee6b(%rip), %rcx     # 0x15d638
movq 0x1ef8(%rbx), %rdx
movq 0x10(%rdx), %rdx
movq %rax, 0x8(%rdx)
movq 0x10(%rdx), %rax
movq %r15, 0x8(%rax)
movq 0x10(%rax), %rax
movq %rcx, 0x8(%rax)
movq 0x1948(%rbx), %rsi
movq 0x1ef8(%rbx), %rdx
movq %rbx, %rdi
movq %rsi, 0x10(%rsp)
callq 0x3b366
jmp 0x6e8c6
movq 0xe013d(%rip), %rax     # 0x14e950
jmp 0x6e942
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x6e830
movq %rbx, %rdi
callq 0xb389
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %r15
movq $0xb, (%r15)
movq %r12, 0x8(%r15)
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x6e869
movq %rbx, %rdi
callq 0xb389
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rcx
movq $0x200001, (%rcx)       # imm = 0x200001
movq %r15, 0x8(%rcx)
movq %r14, 0x10(%rcx)
movq 0xeed63(%rip), %r8      # 0x15d5f8
movq (%rsp), %r15
movl $0x1, %r9d
cmpq %r15, %r14
je 0x6e8b3
movq %r15, %rax
incl %r9d
movq 0x10(%rax), %rax
cmpq %r14, %rax
jne 0x6e8a7
movq %rbx, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0xf3da
movq %rax, 0x10(%rsp)
xorl %eax, %eax
testb %al, %al
je 0x6ea0e
movq 0x10(%r14), %r14
cmpb $0x1, (%r14)
je 0x6e55c
jmp 0x6e9a7
movl $0x1, %eax
jmp 0x6e69f
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x6e905
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 0x140(%rbx), %r8
movq 0xeecc4(%rip), %r9      # 0x15d5f8
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rcx
callq 0xb31d
movq %rax, 0x10(%rsp)
xorl %eax, %eax
xorl %r12d, %r12d
movq (%rsp), %r15
jmp 0x6e8c8
movq 0xdfffc(%rip), %rax     # 0x14e958
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%r15), %rsi
movzbl (%rsi), %eax
leaq 0xe4077(%rip), %rcx     # 0x1529f0
cmpb $0x0, (%rax,%rcx)
je 0x6e9c8
movq %rbx, %rdi
movq %r15, %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6b20f
movl $0x1, %r12d
movq $0x0, 0x8(%rsp)
movq 0x8(%rsp), %rdx
cmpq $0x1, %rdx
jg 0x6e9f5
cmpq $0x7ff, %r12            # imm = 0x7FF
ja 0x6ea18
leaq 0xdff8e(%rip), %rax     # 0x14e950
movq (%rax,%r12,8), %rax
jmp 0x6e95c
movq 0x1210(%rbx), %rdx
movq 0xeec22(%rip), %r8      # 0x15d5f8
movq %rbx, %rdi
movq %r15, %rcx
movl $0x1, %r9d
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf3da
movq %rbx, %rdi
movq %r12, %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x103338
movq 0x10(%rsp), %rax
jmp 0x6e95c
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x6ea30
movq %rbx, %rdi
callq 0xb389
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0xb, (%rax)
movq %r12, 0x8(%rax)
jmp 0x6e95c