// File: /workspace/github_c_makefile_star2_O2/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 0x545de
movq %rsi, %r12
movq %rdi, %rbx
movq 0x10(%rsi), %rax
cmpb $0x1, (%rax)
jne 0x545f4
pushq $0x1
popq %r13
movb $0x1, %al
xorl %ebp, %ebp
movq %r12, 0x8(%rsp)
cmpb $0x1, %al
jne 0x5466c
movq 0x8(%r12), %r15
movzbl (%r15), %eax
cmpl $0xc, %eax
je 0x54563
cmpl $0xb, %eax
jne 0x547ae
movq 0x8(%r15), %rax
testq %rax, %rax
je 0x545a1
movq %rax, %r14
negq %r14
cmovsq %rax, %r14
movq %r13, %rdi
movq %r14, %rsi
callq 0xc7c7d
movq %rax, %rcx
movq %r13, %rax
cqto
idivq %rcx
movq %rax, %r13
imulq %r14, %r13
jno 0x545a4
jmp 0x5463f
movq 0x8(%r15), %rax
movq %rax, %r14
negq %r14
cmovsq %rax, %r14
movq %r13, %rdi
movq %r14, %rsi
callq 0xc7c7d
movq %rax, %rcx
movq %r13, %rax
cqto
idivq %rcx
movq %rax, %r13
imulq %r14, %r13
testq %rbp, %rbp
je 0x545cc
movq 0x10(%r15), %rsi
movq %rbp, %rdi
callq 0xc7c7d
jmp 0x545ac
xorl %r13d, %r13d
xorl %eax, %eax
testq %rbp, %rbp
setne %al
movq %rax, %rbp
testq %r13, %r13
js 0x5463f
je 0x54693
movq 0x10(%r12), %r12
movb (%r12), %al
jmp 0x5450d
cmpq 0x8(%rsp), %r12
je 0x545d8
pushq $0x1
popq %rbp
jmp 0x545af
movq 0x10(%r15), %rbp
jmp 0x545af
movq 0xc1373(%rip), %rax     # 0x115958
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%r12), %rsi
movzbl (%rsi), %eax
leaq 0xc53ed(%rip), %rcx     # 0x1199f0
cmpb $0x0, (%rax,%rcx)
je 0x54622
movq %rbx, %rdi
movq %r12, %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x51b4e
movq 0x1210(%rbx), %rdx
movq 0xcffc8(%rip), %r8      # 0x1245f8
pushq $0x1
popq %r9
movq %rbx, %rdi
movq %r12, %rcx
jmp 0x54940
movq 0x1210(%rbx), %rax
movq 0x8(%rax), %rsi
movq 0xcffe7(%rip), %rcx     # 0x124638
movq %rbx, %rdi
movq 0x8(%rsp), %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x35b47
cmpq $0x1, %rbp
jg 0x54792
cmpq $0x7ff, %r13            # imm = 0x7FF
ja 0x54850
leaq 0xc12c6(%rip), %rax     # 0x115950
movq (%rax,%r13,8), %rax
jmp 0x545e5
leaq 0xc5356(%rip), %rcx     # 0x1199f0
movq 0x10(%r12), %r12
cmpb $0x1, (%r12)
jne 0x547e1
movq 0x8(%r12), %r13
movzbl (%r13), %eax
cmpb $0x0, (%rax,%rcx)
jne 0x5469a
testb $0x40, 0x3(%r13)
je 0x5475e
cmpb $0x1, 0x24c(%rbx)
jne 0x5475e
movq %rbx, %rdi
movq %r13, %rsi
callq 0x88f3
movq 0x1178(%rbx), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x888f
cmpq 0x128(%rbx), %rax
je 0x5475e
movq %rax, %rbp
movq 0x90(%rbx), %rax
movq 0x110(%rbx), %r14
cmpq 0x98(%rbx), %rax
ja 0x54721
movq %rbx, %rdi
callq 0x9c27
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rdx
movq $0x200001, (%rdx)       # imm = 0x200001
movq %r13, 0x8(%rdx)
movq %r14, 0x10(%rdx)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xa34c
cmpq 0x120(%rbx), %rax
leaq 0xc5298(%rip), %rcx     # 0x1199f0
jne 0x5469a
movq 0x1210(%rbx), %rax
movq 0x8(%rax), %r13
movq %r12, %rdi
movq 0x8(%rsp), %rsi
callq 0x72a82
movslq %eax, %r14
cmpl $0x7ff, %r14d           # imm = 0x7FF
ja 0x547ed
leaq 0xc11c7(%rip), %rax     # 0x115950
movq (%rax,%r14,8), %rdx
jmp 0x54826
movq %rbx, %rdi
movq %r13, %rsi
movq %rbp, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xc761f
movq 0x1210(%rbx), %rax
movq %rax, 0x10(%rsp)
cmpq $0x1, %rbp
jg 0x5488e
cmpq $0x7ff, %r13            # imm = 0x7FF
ja 0x548a1
leaq 0xc1178(%rip), %rax     # 0x115950
movq (%rax,%r13,8), %rbp
jmp 0x548db
movq 0xc1168(%rip), %rax     # 0x115950
jmp 0x545e5
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x5480c
movq %rbx, %rdi
callq 0x9c27
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rdx
movq $0xb, (%rdx)
movq %r14, 0x8(%rdx)
movq 0x140(%rbx), %r8
movq 0xcfdc4(%rip), %r9      # 0x1245f8
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rcx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9bbb
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x5486f
movq %rbx, %rdi
callq 0x9c27
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0xb, (%rax)
movq %r13, 0x8(%rax)
jmp 0x545e5
movq %rbx, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0xbd87
movq %rax, %rbp
jmp 0x548db
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x548c0
movq %rbx, %rdi
callq 0x9c27
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rbp
movq $0xb, (%rbp)
movq %r13, 0x8(%rbp)
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x548fa
movq %rbx, %rdi
callq 0x9c27
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %r14
movq $0x200001, (%r14)       # imm = 0x200001
movq %rbp, 0x8(%r14)
movq %r12, 0x10(%r14)
movq 0xcfcd9(%rip), %r13     # 0x1245f8
movq %r12, %rdi
movq 0x8(%rsp), %rsi
callq 0x72a82
movq %rbx, %rdi
movq %r15, %rsi
movq 0x10(%rsp), %rdx
movq %r14, %rcx
movq %r13, %r8
movl %eax, %r9d
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xcf9a