// File: /workspace/github_c_makefile_star2_O1/BernardTatin[P]s7sh/s7.c
// Function: g_complex
static s7_pointer g_complex(s7_scheme *sc, s7_pointer args)
    {
        s7_pointer x, y;
#define H_complex "(complex x1 x2) returns a complex number with real-part x1 and imaginary-part x2"
#define Q_complex s7_make_signature(sc, 3, sc->is_number_symbol, sc->is_real_symbol, sc->is_real_symbol)

        x = car(args);
        y = cadr(args);

        switch (type(y))
        {
            case T_INTEGER:
                switch (type(x))
                {
                    case T_INTEGER:
                        if (integer(y) == 0) return(x);
                        return(c_complex(sc, (s7_double)integer(x), (s7_double)integer(y)));

                    case T_RATIO:
                        if (integer(y) == 0) return(x);
                        return(c_complex(sc, (s7_double)fraction(x), (s7_double)integer(y)));

                    case T_REAL:
                        if (integer(y) == 0) return(x);
                        return(c_complex(sc, real(x), (s7_double)integer(y)));

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

            case T_RATIO:
                switch (type(x))
                {
                    case T_INTEGER: return(c_complex(sc, (s7_double)integer(x), (s7_double)fraction(y)));
                    case T_RATIO:   return(c_complex(sc, (s7_double)fraction(x), (s7_double)fraction(y)));
                    case T_REAL:    return(c_complex(sc, real(x), (s7_double)fraction(y)));
                    default:
                                    return(method_or_bust(sc, x, sc->complex_symbol, args, T_REAL, 1));
                }

            case T_REAL:
                switch (type(x))
                {
                    case T_INTEGER:
                        if (real(y) == 0.0) return(x);
                        return(c_complex(sc, (s7_double)integer(x), real(y)));

                    case T_RATIO:
                        if (real(y) == 0.0) return(x);
                        return(c_complex(sc, (s7_double)fraction(x), real(y)));

                    case T_REAL:
                        if (real(y) == 0.0) return(x);
                        return(c_complex(sc, real(x), real(y)));

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

            default:
                return(method_or_bust(sc, (is_let(x)) ? x : y, sc->complex_symbol, args, T_REAL, 2));
        }
    }

// Assembly:
pushq %rbx
subq $0xa0, %rsp
movq %rsi, %rcx
movq %rdi, %rbx
movq 0x8(%rsi), %rax
movq 0x10(%rsi), %rdx
movq 0x8(%rdx), %rsi
movzbl (%rsi), %edi
movzbl (%rax), %edx
cmpl $0xd, %edi
je 0x6a896
cmpl $0xc, %edi
je 0x6a84a
cmpl $0xb, %edi
jne 0x6a8d0
cmpl $0xd, %edx
je 0x6aac8
cmpl $0xc, %edx
je 0x6aa1a
cmpl $0xb, %edx
jne 0x6a8ef
movq 0x8(%rsi), %rcx
testq %rcx, %rcx
je 0x6ab30
cvtsi2sdq 0x8(%rax), %xmm0
cvtsi2sd %rcx, %xmm1
jmp 0x6a994
cmpl $0xd, %edx
je 0x6a963
cmpl $0xc, %edx
je 0x6a915
cmpl $0xb, %edx
jne 0x6a8ef
cvtsi2sdq 0x8(%rax), %xmm0
movq 0x8(%rsi), %rax
movq 0x10(%rsi), %rcx
movq %rax, 0x38(%rsp)
fildll 0x38(%rsp)
movq %rcx, 0x30(%rsp)
fildll 0x30(%rsp)
fdivrp %st, %st(1)
fstpl 0x28(%rsp)
movsd 0x28(%rsp), %xmm1
jmp 0x6a994
cmpl $0xd, %edx
je 0x6aa57
cmpl $0xc, %edx
je 0x6a9cb
cmpl $0xb, %edx
jne 0x6a8ef
movsd 0x8(%rsi), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x6a8c2
jnp 0x6ab30
xorps %xmm0, %xmm0
cvtsi2sdq 0x8(%rax), %xmm0
jmp 0x6aa71
cmpl $0x1c, %edx
cmoveq %rax, %rsi
movq 0xe10(%rbx), %rdx
movq %rbx, %rdi
movl $0xd, %r8d
movl $0x2, %r9d
jmp 0x6a908
movq 0xe10(%rbx), %rdx
movq %rbx, %rdi
movq %rax, %rsi
movl $0xd, %r8d
movl $0x1, %r9d
addq $0xa0, %rsp
popq %rbx
jmp 0xf1ae
movq 0x8(%rax), %rcx
movq 0x10(%rax), %rax
movq %rcx, 0x58(%rsp)
fildll 0x58(%rsp)
movq %rax, 0x50(%rsp)
fildll 0x50(%rsp)
fdivrp %st, %st(1)
fstpl 0x48(%rsp)
movsd 0x48(%rsp), %xmm0
movq 0x8(%rsi), %rax
movq 0x10(%rsi), %rcx
movq %rax, 0x68(%rsp)
fildll 0x68(%rsp)
movq %rcx, 0x60(%rsp)
fildll 0x60(%rsp)
fdivrp %st, %st(1)
fstpl 0x40(%rsp)
movsd 0x40(%rsp), %xmm1
jmp 0x6a994
movsd 0x8(%rax), %xmm0
movq 0x8(%rsi), %rax
movq 0x10(%rsi), %rcx
movq %rax, 0x80(%rsp)
fildll 0x80(%rsp)
movq %rcx, 0x78(%rsp)
fildll 0x78(%rsp)
fdivrp %st, %st(1)
fstpl 0x70(%rsp)
movsd 0x70(%rsp), %xmm1
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x6aa9f
movq %rbx, %rdi
movsd %xmm0, 0x8(%rsp)
movsd %xmm1, (%rsp)
callq 0xb389
movsd (%rsp), %xmm1
movsd 0x8(%rsp), %xmm0
jmp 0x6aa9f
movsd 0x8(%rsi), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x6a9e0
jnp 0x6ab30
movq 0x8(%rax), %rcx
movq 0x10(%rax), %rax
movq %rcx, 0x98(%rsp)
fildll 0x98(%rsp)
movq %rax, 0x90(%rsp)
fildll 0x90(%rsp)
fdivrp %st, %st(1)
fstpl 0x88(%rsp)
movsd 0x88(%rsp), %xmm0
jmp 0x6aa71
movq 0x8(%rsi), %rcx
testq %rcx, %rcx
je 0x6ab30
movq 0x8(%rax), %rdx
movq 0x10(%rax), %rax
movq %rdx, 0x20(%rsp)
fildll 0x20(%rsp)
movq %rax, 0x18(%rsp)
fildll 0x18(%rsp)
fdivrp %st, %st(1)
fstpl 0x10(%rsp)
cvtsi2sd %rcx, %xmm0
movsd 0x10(%rsp), %xmm1
jmp 0x6aadb
movsd 0x8(%rsi), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x6aa6c
jnp 0x6ab30
movsd 0x8(%rax), %xmm0
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x6aa9f
movq %rbx, %rdi
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, (%rsp)
callq 0xb389
movsd (%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0xe, (%rax)
movsd %xmm0, 0x8(%rax)
movsd %xmm1, 0x10(%rax)
jmp 0x6ab30
movq 0x8(%rsi), %rcx
testq %rcx, %rcx
je 0x6ab30
cvtsi2sd %rcx, %xmm0
movsd 0x8(%rax), %xmm1
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x6ab09
movq %rbx, %rdi
movsd %xmm0, 0x8(%rsp)
movsd %xmm1, (%rsp)
callq 0xb389
movsd (%rsp), %xmm1
movsd 0x8(%rsp), %xmm0
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0xe, (%rax)
movsd %xmm1, 0x8(%rax)
movsd %xmm0, 0x10(%rax)
addq $0xa0, %rsp
popq %rbx
retq