// File: /workspace/github_c_makefile_star2_O3/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 0x693fa
movq %rsi, %rbx
movq 0x10(%rsi), %rax
cmpb $0x1, (%rax)
jne 0x69413
movq %rdi, 0x8(%rsp)
movl $0x1, %r12d
xorl %r13d, %r13d
movq %rbx, %r14
movq 0x8(%r14), %r15
movzbl (%r15), %eax
cmpl $0xc, %eax
je 0x6937a
cmpl $0xb, %eax
jne 0x695c9
movq 0x8(%r15), %rax
testq %rax, %rax
je 0x693b8
movq %rax, %rbp
negq %rbp
cmovsq %rax, %rbp
movq %r12, %rdi
movq %rbp, %rsi
callq 0xfab36
movq %rax, %rcx
movq %r12, %rax
cqto
idivq %rcx
movq %rax, %r12
imulq %rbp, %r12
jno 0x693bb
jmp 0x69459
movq 0x8(%r15), %rax
movq %rax, %rbp
negq %rbp
cmovsq %rax, %rbp
movq %r12, %rdi
movq %rbp, %rsi
callq 0xfab36
movq %rax, %rcx
movq %r12, %rax
cqto
idivq %rcx
movq %rax, %r12
imulq %rbp, %r12
testq %r13, %r13
je 0x693e9
movq 0x10(%r15), %rsi
movq %r13, %rdi
callq 0xfab36
jmp 0x693c3
xorl %r12d, %r12d
xorl %eax, %eax
testq %r13, %r13
setne %al
movq %rax, %r13
testq %r12, %r12
js 0x69459
movq 0x10(%r14), %r14
movb (%r14), %al
je 0x694aa
cmpb $0x1, %al
je 0x6932d
jmp 0x695a1
movl $0x1, %r13d
cmpq %rbx, %r14
jne 0x693c6
movq 0x10(%r15), %r13
jmp 0x693c6
movq 0xdd557(%rip), %r14     # 0x146958
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rbx), %rsi
movzbl (%rsi), %eax
leaq 0xe15cf(%rip), %rcx     # 0x14a9f0
cmpb $0x0, (%rax,%rcx)
je 0x6943d
movq %rbx, %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x661b9
movq 0x1210(%rdi), %rdx
movq 0xec1ad(%rip), %r8      # 0x1555f8
movq %rbx, %rcx
movl $0x1, %r9d
jmp 0x6979c
movq 0x8(%rsp), %rdi
movq 0x1210(%rdi), %rax
movq 0x8(%rax), %rax
movq 0xec1c8(%rip), %rcx     # 0x155638
movq 0x1ef8(%rdi), %rdx
movq 0x10(%rdx), %rdx
movq %rax, 0x8(%rdx)
movq 0x10(%rdx), %rax
movq %rbx, 0x8(%rax)
movq 0x10(%rax), %rax
movq %rcx, 0x8(%rax)
movq 0x1948(%rdi), %r14
movq 0x1ef8(%rdi), %rdx
movq %r14, %rsi
callq 0x38dfa
jmp 0x69401
cmpb $0x1, %al
jne 0x69595
movq 0x8(%r14), %r12
movzbl (%r12), %eax
leaq 0xe152e(%rip), %rcx     # 0x14a9f0
cmpb $0x0, (%rax,%rcx)
jne 0x69587
testb $0x40, 0x3(%r12)
je 0x69624
movq 0x8(%rsp), %rax
cmpb $0x1, 0x24c(%rax)
jne 0x69624
movq 0x8(%rsp), %rbp
movq %rbp, %rdi
movq %r12, %rsi
callq 0x8a63
movq 0x1178(%rbp), %rdx
movq %rbp, %rdi
movq %rax, %rsi
callq 0x89ff
cmpq 0x128(%rbp), %rax
je 0x69624
movq %rax, %r13
movq 0x8(%rsp), %rbp
movq 0x90(%rbp), %rax
movq 0x110(%rbp), %rsi
cmpq 0x98(%rbp), %rax
ja 0x69551
movq %rbp, %rdi
movq %rsi, 0x10(%rsp)
callq 0xa550
movq 0x10(%rsp), %rsi
movq 0x90(%rbp), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbp)
movq -0x8(%rax), %rdx
movq $0x200001, (%rdx)       # imm = 0x200001
movq %r12, 0x8(%rdx)
movq %rsi, 0x10(%rdx)
movq %rbp, %rdi
movq %r13, %rsi
callq 0xaee6
cmpq 0x120(%rbp), %rax
je 0x69624
movq 0x10(%r14), %r14
cmpb $0x1, (%r14)
je 0x694b2
movq 0xdd3b4(%rip), %r14     # 0x146950
jmp 0x69401
cmpq $0x1, %r13
jg 0x69606
cmpq $0x7ff, %r12            # imm = 0x7FF
movq 0x8(%rsp), %rbx
ja 0x696b0
leaq 0xdd390(%rip), %rax     # 0x146950
movq (%rax,%r12,8), %r14
jmp 0x69401
movq 0x8(%rsp), %rbp
movq 0x1210(%rbp), %rax
cmpq $0x1, %r13
movq %rax, 0x10(%rsp)
jg 0x6969d
cmpq $0x7ff, %r12            # imm = 0x7FF
ja 0x696ee
leaq 0xdd358(%rip), %rax     # 0x146950
movq (%rax,%r12,8), %r13
movq 0x8(%rsp), %rbp
jmp 0x6972d
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xfa58d
movq 0x8(%rsp), %rax
movq 0x1210(%rax), %rax
movq 0x8(%rax), %r12
cmpq %rbx, %r14
je 0x697af
xorl %eax, %eax
movq 0x10(%rbx), %rbx
incq %rax
cmpq %r14, %rbx
jne 0x6963f
leaq 0x1(%rax), %rbx
cmpl $0x7fe, %eax            # imm = 0x7FE
jbe 0x697b4
movq 0x8(%rsp), %r14
movq 0x90(%r14), %rax
cmpq 0x98(%r14), %rax
ja 0x6967e
movq %r14, %rdi
callq 0xa550
movq 0x90(%r14), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%r14)
movq -0x8(%rax), %rdx
movq $0xb, (%rdx)
movq %rbx, 0x8(%rdx)
jmp 0x697bf
movq %rbp, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0xcfa8
movq %rax, %r13
jmp 0x6972d
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x696cf
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %r14
movq $0xb, (%r14)
movq %r12, 0x8(%r14)
jmp 0x69401
movq 0x8(%rsp), %rbp
movq 0x90(%rbp), %rax
cmpq 0x98(%rbp), %rax
ja 0x69712
movq %rbp, %rdi
callq 0xa550
movq 0x90(%rbp), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbp)
movq -0x8(%rax), %r13
movq $0xb, (%r13)
movq %r12, 0x8(%r13)
movq 0x90(%rbp), %rax
cmpq 0x98(%rbp), %rax
ja 0x6974c
movq %rbp, %rdi
callq 0xa550
movq 0x90(%rbp), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbp)
movq -0x8(%rax), %rcx
movq $0x200001, (%rcx)       # imm = 0x200001
movq %r13, 0x8(%rcx)
movq %r14, 0x10(%rcx)
movq 0xebe87(%rip), %r8      # 0x1555f8
movl $0x1, %r9d
cmpq %rbx, %r14
je 0x6978f
movq 0x10(%rsp), %rdx
incl %r9d
movq 0x10(%rbx), %rbx
cmpq %r14, %rbx
jne 0x69781
jmp 0x69794
movq 0x10(%rsp), %rdx
movq 0x8(%rsp), %rdi
movq %r15, %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe659
movl $0x1, %ebx
leaq 0xdd195(%rip), %rax     # 0x146950
movq (%rax,%rbx,8), %rdx
movq 0x8(%rsp), %rdi
movq 0x140(%rdi), %r8
movq 0xebe26(%rip), %r9      # 0x1555f8
movq %r12, %rsi
movq %r15, %rcx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa4e4