// File: /workspace/github_cpp_makefile_star2_O3/ef-gy[P]libefgy/include/ef.gy/continued-fractions.h
// Function: efgy::math::numeric::continuedFractional<long long>::binaryOperator::operator()(efgy::math::numeric::continuedFractional<long long> const&, efgy::math::numeric::continuedFractional<long long> const&) const
continuedFractional operator()(const continuedFractional &x,
                                   const continuedFractional &y) const {
      binaryOperator op = *this;
      continuedFractional rv;
      N px = N(0), py = N(0);
      bool xInf = false, yInf = false;
      while (1) {
        fractional<N> ae = fractional<N>(op.a, op.e),
                      bf = fractional<N>(op.b, op.f),
                      cg = fractional<N>(op.c, op.g),
                      dh = fractional<N>(op.d, op.h);

        N rae, rbf, rcg, rdh;

        if (op.e != zero()) {
          rae = N(ae);
        }
        if (op.f != zero()) {
          rbf = N(bf);
        }
        if (op.g != zero()) {
          rcg = N(cg);
        }
        if (op.h != zero()) {
          rdh = N(dh);
        }

        if ((op.e != zero()) && (op.f != zero()) && (op.g != zero()) &&
            (op.h != zero())) {
          if ((rae == rbf) && (rbf == rcg) && (rcg == rdh)) {
            rv = (rv, rae);
            if ((op.a < zero()) && (op.b < zero()) && (op.c < zero()) &&
                (op.d < zero())) {
              rv.negative = true;
            }
            op = op.output(rae);
            continue;
          }
        }

        if ((op.e == zero()) && (op.f == zero()) && (op.g == zero()) &&
            (op.h == zero())) {
          break;
        }

        if (xInf && yInf) {
          if (op.h != zero()) {
            continuedFractional<N> cfdh = dh;
            for (N i = N(0); i < cfdh.coefficient.size(); i++) {
              rv = (rv, cfdh.coefficient[i]);
            }
          }
          break;
        }

        fractional<N> bfae = bf - ae;
        fractional<N> cgae = cg - ae;

        if (bfae < zero()) {
          bfae *= N(-1);
        }
        if (cgae < zero()) {
          cgae *= N(-1);
        }

        if ((op.f == zero()) || (op.h == zero())) {
          goto processY;
        }
        if ((op.e == zero()) || (op.g == zero())) {
          goto processX;
        }

        if (bfae > cgae) {
        processX:
          if (px < x.coefficient.size()) {
            op = op.insertX(x.coefficient[px]);
            px++;
          } else if (!xInf) {
            op = op.insertXinf();
            xInf = true;
          } else {
            goto processY;
          }
        } else {
        processY:
          if (py < y.coefficient.size()) {
            op = op.insertY(y.coefficient[py]);
            py++;
          } else if (!yInf) {
            op = op.insertYinf();
            yInf = true;
          } else {
            goto processX;
          }
        }
      }
      return rv;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rcx, 0x108(%rsp)
movq %rdx, 0x100(%rsp)
movq (%rsi), %rcx
movq 0x8(%rsi), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsi), %rax
movq %rax, 0x20(%rsp)
movq 0x18(%rsi), %rax
movq %rax, 0x8(%rsp)
movq 0x20(%rsi), %r13
movq 0x28(%rsi), %r15
movq 0x30(%rsi), %r14
movq 0x38(%rsi), %rax
movq %rax, (%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x9(%rdi)
movq %rdi, 0x18(%rsp)
movups %xmm0, (%rdi)
movq $0x0, 0xd0(%rsp)
leaq 0x30(%rsp), %rbx
movq $0x0, 0xc8(%rsp)
movq $0x0, 0x68(%rsp)
movq $0x0, 0x60(%rsp)
movq %rcx, %rax
movq 0x18(%rsp), %rbp
movq %rax, 0x28(%rsp)
movq %rax, 0x50(%rsp)
movq %r13, 0x58(%rsp)
leaq 0x50(%rsp), %rdi
callq 0x13e3e
movq 0x10(%rsp), %rax
movq %rax, 0x80(%rsp)
movq %r15, 0x88(%rsp)
leaq 0x80(%rsp), %rdi
callq 0x13e3e
movq 0x20(%rsp), %rax
movq %rax, 0x70(%rsp)
movq %r14, 0x78(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x13e3e
movq 0x8(%rsp), %rax
movq %rax, 0xf0(%rsp)
movq (%rsp), %rax
movq %rax, 0xf8(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x13e3e
testq %r13, %r13
je 0x14247
movq 0x50(%rsp), %rax
cqto
idivq 0x58(%rsp)
movq %rax, %rcx
movq %rax, 0xe8(%rsp)
testq %r15, %r15
je 0x14266
movq 0x80(%rsp), %rax
cqto
idivq 0x88(%rsp)
movq %rax, 0xe0(%rsp)
testq %r14, %r14
je 0x1427f
movq 0x70(%rsp), %rax
cqto
idivq 0x78(%rsp)
movq %rax, 0xd8(%rsp)
cmpq $0x0, (%rsp)
je 0x142a0
movq 0xf0(%rsp), %rax
cqto
idivq 0xf8(%rsp)
movq %rax, 0x110(%rsp)
testq %r13, %r13
je 0x143d1
testq %r15, %r15
je 0x143e1
testq %r14, %r14
je 0x143e1
cmpq $0x0, (%rsp)
je 0x143e1
cmpq 0xe0(%rsp), %rcx
jne 0x143e1
movq 0xd8(%rsp), %rax
cmpq %rax, 0xe0(%rsp)
jne 0x143e1
movq 0x110(%rsp), %rax
cmpq %rax, 0xd8(%rsp)
jne 0x143e1
movq %rbx, %rdi
movq %rbp, %rsi
leaq 0xe8(%rsp), %rdx
callq 0x147e0
movq %rbp, %rdi
movq %rbx, %r12
movq %rbx, %rsi
callq 0x14900
movb 0x48(%rsp), %al
movb %al, 0x18(%rbp)
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1433f
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x4250
cmpq $0x0, 0x28(%rsp)
movq %r12, %rbx
movq 0x20(%rsp), %rdi
jns 0x1436d
cmpq $0x0, 0x10(%rsp)
jns 0x1436d
testq %rdi, %rdi
jns 0x1436d
cmpq $0x0, 0x8(%rsp)
jns 0x1436d
movq 0x18(%rsp), %rax
movb $0x1, 0x18(%rax)
movq 0xe8(%rsp), %rax
movq %rax, %rcx
imulq %r13, %rcx
movq 0x28(%rsp), %rdx
subq %rcx, %rdx
movq %rax, %rcx
imulq %r15, %rcx
movq 0x10(%rsp), %rsi
subq %rcx, %rsi
movq %rax, %rcx
imulq %r14, %rcx
subq %rcx, %rdi
movq (%rsp), %r8
imulq %r8, %rax
movq 0x8(%rsp), %rcx
subq %rax, %rcx
movq %r13, %rax
movq %r15, 0x10(%rsp)
movq %r14, 0x20(%rsp)
movq %r8, 0x8(%rsp)
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %r14
movq %rcx, (%rsp)
jmp 0x141b1
movq %r15, %rax
orq %r14, %rax
orq (%rsp), %rax
je 0x14753
testb $0x1, 0x68(%rsp)
je 0x143f3
testb $0x1, 0x60(%rsp)
jne 0x146a3
movq 0x58(%rsp), %rax
movq 0x80(%rsp), %rcx
imulq %rax, %rcx
movq 0x88(%rsp), %rdx
movq 0x50(%rsp), %rsi
imulq %rdx, %rsi
subq %rsi, %rcx
imulq %rax, %rdx
movq %rcx, 0x30(%rsp)
movq %rdx, 0x38(%rsp)
movq %rbx, %rdi
callq 0x13e3e
movaps 0x30(%rsp), %xmm0
movaps %xmm0, 0xa0(%rsp)
movq 0x58(%rsp), %rax
movq 0x70(%rsp), %rcx
imulq %rax, %rcx
movq 0x78(%rsp), %rdx
movq 0x50(%rsp), %rsi
imulq %rdx, %rsi
subq %rsi, %rcx
imulq %rax, %rdx
movq %rcx, 0x30(%rsp)
movq %rdx, 0x38(%rsp)
movq %rbx, %rdi
callq 0x13e3e
movq 0x30(%rsp), %rax
movaps 0x30(%rsp), %xmm0
movaps %xmm0, 0x90(%rsp)
movq 0xa0(%rsp), %rcx
testq %rcx, %rcx
jns 0x144af
negq %rcx
movq %rcx, 0xa0(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x13e3e
movq 0x90(%rsp), %rax
testq %rax, %rax
jns 0x144cc
negq %rax
movq %rax, 0x90(%rsp)
leaq 0x90(%rsp), %rdi
callq 0x13e3e
testq %r15, %r15
je 0x14529
cmpq $0x0, (%rsp)
je 0x14529
testq %r13, %r13
je 0x145b8
testq %r14, %r14
je 0x145b8
movq 0xa0(%rsp), %rax
movq 0x90(%rsp), %rcx
testq %rax, %rax
js 0x14509
testq %rcx, %rcx
jns 0x1450e
jmp 0x145b8
testq %rcx, %rcx
jns 0x14529
imulq 0x98(%rsp), %rax
imulq 0xa8(%rsp), %rcx
cmpq %rcx, %rax
jg 0x145b8
movq 0x108(%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movq 0xc8(%rsp), %rdx
cmpq %rcx, %rdx
jae 0x145ad
movq (%rax,%rdx,8), %rax
movq %rdx, %rdi
movq %rax, %rcx
movq 0x20(%rsp), %r8
imulq %r8, %rcx
movq 0x28(%rsp), %r9
addq %rcx, %r9
movq %rax, %rcx
movq 0x8(%rsp), %rsi
imulq %rsi, %rcx
addq 0x10(%rsp), %rcx
movq %rax, %rdx
imulq %r14, %rdx
addq %rdx, %r13
movq (%rsp), %rdx
imulq %rdx, %rax
addq %r15, %rax
incq %rdi
movq %rdi, 0xc8(%rsp)
movq %r8, %rdi
movq %rsi, 0x10(%rsp)
movq %rcx, 0x8(%rsp)
movq %rdx, %r15
jmp 0x1463a
testb $0x1, 0x60(%rsp)
je 0x1466d
movq 0x100(%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movq 0xd0(%rsp), %rdx
cmpq %rcx, %rdx
jae 0x14640
movq (%rax,%rdx,8), %rax
movq %rdx, %rdi
movq %rax, %rcx
movq 0x10(%rsp), %r9
imulq %r9, %rcx
addq 0x28(%rsp), %rcx
movq %rax, %rdx
movq 0x8(%rsp), %r8
imulq %r8, %rdx
addq 0x20(%rsp), %rdx
movq %rax, %rsi
imulq %r15, %rsi
addq %r13, %rsi
movq (%rsp), %r13
imulq %r13, %rax
addq %r14, %rax
incq %rdi
movq %rdi, 0xd0(%rsp)
movq %r9, %rdi
movq %rcx, 0x10(%rsp)
movq %r8, %r9
movq %rdx, 0x8(%rsp)
movq %r15, %r14
movq %rsi, %r15
movq %rax, (%rsp)
jmp 0x1468d
testb $0x1, 0x68(%rsp)
jne 0x14529
movq 0x28(%rsp), %r9
movq %r9, %rdi
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r13, %r14
movq %r15, (%rsp)
movb $0x1, %al
movq %rax, 0x68(%rsp)
jmp 0x1468d
movq 0x8(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %rdi
movq %rdi, %r9
movq (%rsp), %r15
movq %r14, %r13
movb $0x1, %al
movq %rax, 0x60(%rsp)
movq %r13, %rax
movq %r9, 0x20(%rsp)
movq %r14, %r13
movq %rax, %r14
movq %rdi, %rax
jmp 0x141b1
cmpq $0x0, (%rsp)
je 0x14753
leaq 0x30(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x5746
movq 0x30(%rsp), %rdx
cmpq %rdx, 0x38(%rsp)
movq 0x18(%rsp), %r12
je 0x1473e
xorl %r14d, %r14d
leaq 0xa0(%rsp), %rbx
xorl %r15d, %r15d
addq %r14, %rdx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x147e0
movq %r12, %rdi
movq %rbx, %rsi
callq 0x14900
movb 0xb8(%rsp), %al
movb %al, 0x18(%r12)
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x14721
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4250
incq %r15
movq 0x30(%rsp), %rdx
movq 0x38(%rsp), %rax
subq %rdx, %rax
sarq $0x3, %rax
addq $0x8, %r14
cmpq %rax, %r15
jb 0x146df
testq %rdx, %rdx
je 0x14753
movq 0x40(%rsp), %rsi
subq %rdx, %rsi
movq %rdx, %rdi
callq 0x4250
movq 0x18(%rsp), %rax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x147bc
jmp 0x14770
jmp 0x147bc
movq %rax, %rbx
jmp 0x14795
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x14795
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4250
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x147bf
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x4250
jmp 0x147bf
jmp 0x147bc
jmp 0x147bc
jmp 0x147bc
jmp 0x147bc
jmp 0x147bc
jmp 0x147bc
jmp 0x147bc
movq %rax, %rbx
movq 0x18(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x147d8
movq 0x10(%rax), %rsi
subq %rdi, %rsi
callq 0x4250
movq %rbx, %rdi
callq 0x43c0