// File: /workspace/github_c_makefile_star2_O2/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:
subq $0x10, %rsp
movq %rsi, %rcx
movq 0x8(%rsi), %rax
movq 0x10(%rsi), %rdx
movq 0x8(%rdx), %rsi
movzbl (%rsi), %r8d
movzbl (%rax), %edx
cmpl $0xd, %r8d
je 0x51363
cmpl $0xc, %r8d
je 0x51317
cmpl $0xb, %r8d
jne 0x5139a
cmpl $0xd, %edx
je 0x514da
cmpl $0xc, %edx
je 0x51491
cmpl $0xb, %edx
jne 0x513b6
movq 0x8(%rsi), %rcx
testq %rcx, %rcx
je 0x514f6
cvtsi2sdq 0x8(%rax), %xmm0
cvtsi2sd %rcx, %xmm1
jmp 0x514ed
cmpl $0xd, %edx
je 0x51426
cmpl $0xc, %edx
je 0x513d5
cmpl $0xb, %edx
jne 0x513b6
cvtsi2sdq 0x8(%rax), %xmm0
movq 0x8(%rsi), %rax
movq 0x10(%rsi), %rcx
movq %rax, -0x58(%rsp)
fildll -0x58(%rsp)
movq %rcx, -0x60(%rsp)
fildll -0x60(%rsp)
fdivrp %st, %st(1)
fstpl -0x68(%rsp)
movsd -0x68(%rsp), %xmm1
jmp 0x514ed
cmpl $0xd, %edx
je 0x514c7
cmpl $0xc, %edx
je 0x51456
cmpl $0xb, %edx
jne 0x513b6
movsd 0x8(%rsi), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x5138f
jnp 0x514f6
cvtsi2sdq 0x8(%rax), %xmm0
jmp 0x514ed
cmpl $0x1c, %edx
cmoveq %rax, %rsi
movq 0xe10(%rdi), %rdx
movl $0xd, %r8d
movl $0x2, %r9d
jmp 0x513cc
movq 0xe10(%rdi), %rdx
movl $0xd, %r8d
movl $0x1, %r9d
movq %rax, %rsi
addq $0x10, %rsp
jmp 0xcd70
movq 0x8(%rax), %rcx
movq 0x10(%rax), %rax
movq %rcx, -0x38(%rsp)
fildll -0x38(%rsp)
movq %rax, -0x40(%rsp)
fildll -0x40(%rsp)
fdivrp %st, %st(1)
fstpl -0x48(%rsp)
movsd -0x48(%rsp), %xmm0
movq 0x8(%rsi), %rax
movq 0x10(%rsi), %rcx
movq %rax, -0x28(%rsp)
fildll -0x28(%rsp)
movq %rcx, -0x30(%rsp)
fildll -0x30(%rsp)
fdivrp %st, %st(1)
fstpl -0x50(%rsp)
movsd -0x50(%rsp), %xmm1
jmp 0x514ed
movsd 0x8(%rax), %xmm0
movq 0x8(%rsi), %rax
movq 0x10(%rsi), %rcx
movq %rax, -0x10(%rsp)
fildll -0x10(%rsp)
movq %rcx, -0x18(%rsp)
fildll -0x18(%rsp)
fdivrp %st, %st(1)
fstpl -0x20(%rsp)
movsd -0x20(%rsp), %xmm1
jmp 0x514ed
movsd 0x8(%rsi), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x5146b
jnp 0x514f6
movq 0x8(%rax), %rcx
movq 0x10(%rax), %rax
movq %rcx, 0x8(%rsp)
fildll 0x8(%rsp)
movq %rax, (%rsp)
fildll (%rsp)
fdivrp %st, %st(1)
fstpl -0x8(%rsp)
movsd -0x8(%rsp), %xmm0
jmp 0x514ed
movq 0x8(%rsi), %rcx
testq %rcx, %rcx
je 0x514f6
movq 0x8(%rax), %rdx
movq 0x10(%rax), %rax
movq %rdx, -0x70(%rsp)
fildll -0x70(%rsp)
movq %rax, -0x78(%rsp)
fildll -0x78(%rsp)
fdivrp %st, %st(1)
fstpl -0x80(%rsp)
cvtsi2sd %rcx, %xmm1
movsd -0x80(%rsp), %xmm0
jmp 0x514ed
movsd 0x8(%rsi), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x514e8
jnp 0x514f6
jmp 0x514e8
movq 0x8(%rsi), %rcx
testq %rcx, %rcx
je 0x514f6
cvtsi2sd %rcx, %xmm1
movsd 0x8(%rax), %xmm0
addq $0x10, %rsp
jmp 0xc75bc
addq $0x10, %rsp
retq