// File: /workspace/github_cpp_makefile_star2_O1/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 $0x128, %rsp            # imm = 0x128
movq %rcx, %r14
movq %rdx, %r12
movq %rdi, %rbx
movq (%rsi), %rax
movq %rax, 0x38(%rsp)
movq 0x8(%rsi), %rax
movq %rax, 0x28(%rsp)
movq 0x10(%rsi), %rax
movq %rax, 0x30(%rsp)
movq 0x18(%rsi), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsi), %r15
movq 0x28(%rsi), %rax
movq %rax, 0x10(%rsp)
movq 0x30(%rsi), %rax
movq %rax, 0x18(%rsp)
movq 0x38(%rsi), %rax
movq %rax, 0x8(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x9(%rdi)
movups %xmm0, (%rdi)
xorl %r13d, %r13d
movq $0x0, 0xe8(%rsp)
movq $0x0, 0x78(%rsp)
movq $0x0, 0x70(%rsp)
movq %rdi, 0x80(%rsp)
movq %rcx, 0x118(%rsp)
movq %rdx, 0x110(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x60(%rsp)
movq %r15, 0x68(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x13dc0
movq 0x28(%rsp), %rax
movq %rax, 0xb8(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0xc0(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0x13dc0
movq 0x30(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0xb0(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0x13dc0
movq 0x20(%rsp), %rax
movq %rax, 0x100(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x108(%rsp)
leaq 0x100(%rsp), %rdi
callq 0x13dc0
testq %r15, %r15
je 0x141e6
movq 0x60(%rsp), %rax
cqto
idivq 0x68(%rsp)
movq %rax, 0x90(%rsp)
cmpq $0x0, 0x10(%rsp)
je 0x14208
movq 0xb8(%rsp), %rax
cqto
idivq 0xc0(%rsp)
movq %rax, 0xf8(%rsp)
cmpq $0x0, 0x18(%rsp)
je 0x1422a
movq 0xa8(%rsp), %rax
cqto
idivq 0xb0(%rsp)
movq %rax, 0xf0(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0x1424c
movq 0x100(%rsp), %rax
cqto
idivq 0x108(%rsp)
movq %rax, 0x120(%rsp)
testq %r15, %r15
movq %r13, 0x88(%rsp)
je 0x143a6
cmpq $0x0, 0x10(%rsp)
je 0x143a6
cmpq $0x0, 0x18(%rsp)
je 0x143a6
cmpq $0x0, 0x8(%rsp)
je 0x143a6
movq 0xf8(%rsp), %rax
cmpq %rax, 0x90(%rsp)
jne 0x143a6
movq 0xf0(%rsp), %rax
cmpq %rax, 0xf8(%rsp)
jne 0x143a6
movq 0x120(%rsp), %rax
cmpq %rax, 0xf0(%rsp)
jne 0x143a6
leaq 0x40(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
leaq 0x90(%rsp), %rdx
callq 0x14832
movq %rbx, %rdi
movq %r13, %rsi
callq 0x14952
movb 0x58(%rsp), %al
movb %al, 0x18(%rbx)
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x14304
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x4250
cmpq $0x0, 0x38(%rsp)
jns 0x14328
cmpq $0x0, 0x28(%rsp)
jns 0x14328
cmpq $0x0, 0x30(%rsp)
jns 0x14328
cmpq $0x0, 0x20(%rsp)
jns 0x14328
movb $0x1, 0x18(%rbx)
movq 0x90(%rsp), %rax
movq %rax, %rcx
imulq %r15, %rcx
movq 0x38(%rsp), %rdx
subq %rcx, %rdx
movq %rax, %rcx
movq 0x10(%rsp), %r9
imulq %r9, %rcx
movq 0x28(%rsp), %rsi
subq %rcx, %rsi
movq %rax, %rcx
movq 0x18(%rsp), %r10
imulq %r10, %rcx
movq 0x30(%rsp), %rdi
subq %rcx, %rdi
movq 0x8(%rsp), %r8
imulq %r8, %rax
movq 0x20(%rsp), %rcx
subq %rax, %rcx
xorl %r13d, %r13d
movq %r15, 0x38(%rsp)
movq %r9, 0x28(%rsp)
movq %r10, 0x30(%rsp)
movq %r8, 0x20(%rsp)
movq %rdx, %r15
movq %rsi, 0x10(%rsp)
movq %rdi, 0x18(%rsp)
movq %rcx, 0x8(%rsp)
jmp 0x1478f
movb $0x1, %r13b
testq %r15, %r15
jne 0x143ca
cmpq $0x0, 0x10(%rsp)
jne 0x143ca
cmpq $0x0, 0x18(%rsp)
jne 0x143ca
cmpq $0x0, 0x8(%rsp)
je 0x1478f
testb $0x1, 0x78(%rsp)
je 0x144bf
testb $0x1, 0x70(%rsp)
je 0x144bf
cmpq $0x0, 0x8(%rsp)
je 0x1478f
leaq 0x40(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0x5752
movq 0x40(%rsp), %rdx
cmpq %rdx, 0x48(%rsp)
je 0x144a1
xorl %ebx, %ebx
xorl %r12d, %r12d
leaq 0xc8(%rsp), %rdi
addq %rbx, %rdx
movq %rdi, %rbp
movq 0x80(%rsp), %r14
movq %r14, %rsi
callq 0x14832
movq %r14, %rdi
movq %rbp, %rsi
callq 0x14952
movb 0xe0(%rsp), %al
movb %al, 0x18(%r14)
movq 0xc8(%rsp), %rdi
testq %rdi, %rdi
je 0x14464
movq 0xd8(%rsp), %rsi
subq %rdi, %rsi
callq 0x4250
incq %r12
movq 0x40(%rsp), %rdx
movq 0x48(%rsp), %rax
subq %rdx, %rax
sarq $0x3, %rax
addq $0x8, %rbx
cmpq %rax, %r12
leaq 0xc8(%rsp), %rdi
jb 0x1441b
movq 0x80(%rsp), %rbx
movq 0x118(%rsp), %r14
movq 0x110(%rsp), %r12
testq %rdx, %rdx
je 0x1478f
movq 0x50(%rsp), %rsi
subq %rdx, %rsi
movq %rdx, %rdi
callq 0x4250
jmp 0x1478f
movq 0x68(%rsp), %rax
movq 0xb8(%rsp), %rcx
imulq %rax, %rcx
movq 0xc0(%rsp), %rdx
movq 0x60(%rsp), %rsi
imulq %rdx, %rsi
subq %rsi, %rcx
imulq %rax, %rdx
movq %rcx, 0x40(%rsp)
movq %rdx, 0x48(%rsp)
leaq 0x40(%rsp), %r13
movq %r13, %rdi
callq 0x13dc0
movups 0x40(%rsp), %xmm0
movups %xmm0, 0xc8(%rsp)
movq 0x68(%rsp), %rax
movq 0xa8(%rsp), %rcx
imulq %rax, %rcx
movq 0xb0(%rsp), %rdx
movq 0x60(%rsp), %rsi
imulq %rdx, %rsi
subq %rsi, %rcx
imulq %rax, %rdx
movq %rcx, 0x40(%rsp)
movq %rdx, 0x48(%rsp)
movq %r13, %rdi
callq 0x13dc0
movq 0x88(%rsp), %r13
movups 0x40(%rsp), %xmm0
movups %xmm0, 0x98(%rsp)
movq 0xc8(%rsp), %rax
testq %rax, %rax
jns 0x14581
negq %rax
movq %rax, 0xc8(%rsp)
leaq 0xc8(%rsp), %rdi
callq 0x13dc0
movq 0x98(%rsp), %rax
testq %rax, %rax
jns 0x145a6
negq %rax
movq %rax, 0x98(%rsp)
leaq 0x98(%rsp), %rdi
callq 0x13dc0
cmpq $0x0, 0x10(%rsp)
je 0x14612
cmpq $0x0, 0x8(%rsp)
je 0x14612
testq %r15, %r15
je 0x1469d
cmpq $0x0, 0x18(%rsp)
je 0x1469d
movq 0xc8(%rsp), %rax
movq 0x98(%rsp), %rcx
testq %rax, %rax
js 0x145ea
testq %rcx, %rcx
jns 0x145ef
jmp 0x1469d
testq %rcx, %rcx
jns 0x14612
imulq 0xa0(%rsp), %rax
movq 0xd0(%rsp), %rcx
imulq 0x98(%rsp), %rcx
cmpq %rcx, %rax
jg 0x1469d
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movq 0xe8(%rsp), %rdi
cmpq %rcx, %rdi
jae 0x14692
movq (%rax,%rdi,8), %rax
movq %rax, %rcx
movq 0x30(%rsp), %r9
imulq %r9, %rcx
movq 0x38(%rsp), %r10
addq %rcx, %r10
movq %rax, %rcx
movq 0x20(%rsp), %rsi
imulq %rsi, %rcx
addq 0x28(%rsp), %rcx
movq %rax, %rdx
movq 0x18(%rsp), %r8
imulq %r8, %rdx
addq %rdx, %r15
movq 0x8(%rsp), %rdx
imulq %rdx, %rax
addq 0x10(%rsp), %rax
incq %rdi
movq %rdi, 0xe8(%rsp)
movq %rsi, 0x28(%rsp)
movq %rcx, 0x20(%rsp)
movq %rdx, 0x10(%rsp)
jmp 0x14712
testb $0x1, 0x70(%rsp)
je 0x1474c
movq (%r12), %rax
movq 0x8(%r12), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rcx, %r13
jae 0x14719
movq (%rax,%r13,8), %rax
movq %rax, %rcx
movq 0x28(%rsp), %r9
imulq %r9, %rcx
addq 0x38(%rsp), %rcx
movq %rax, %rdx
movq 0x20(%rsp), %rdi
imulq %rdi, %rdx
addq 0x30(%rsp), %rdx
movq %rax, %rsi
movq 0x10(%rsp), %r8
imulq %r8, %rsi
addq %r15, %rsi
movq 0x8(%rsp), %r15
imulq %r15, %rax
addq 0x18(%rsp), %rax
incq %r13
movq %r13, 0x88(%rsp)
movq %rcx, 0x28(%rsp)
movq %rdi, %r10
movq %rdx, 0x20(%rsp)
movq %rsi, 0x10(%rsp)
movq %rax, 0x8(%rsp)
jmp 0x14777
testb $0x1, 0x78(%rsp)
jne 0x14612
movq 0x38(%rsp), %r10
movq %r10, %r9
movq 0x28(%rsp), %rax
movq %rax, 0x20(%rsp)
movq %r15, %r8
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rsp)
movb $0x1, %al
movq %rax, 0x78(%rsp)
jmp 0x14777
movq 0x20(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x30(%rsp), %r9
movq %r9, %r10
movq 0x8(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %r8
movq %r8, %r15
movb $0x1, %al
movq %rax, 0x70(%rsp)
movq %r15, %rax
xorl %r13d, %r13d
movq %r9, 0x38(%rsp)
movq %r10, 0x30(%rsp)
movq %r8, %r15
movq %rax, 0x18(%rsp)
testb %r13b, %r13b
movq 0x88(%rsp), %r13
je 0x1413f
movq %rbx, %rax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x147c1
jmp 0x147c1
jmp 0x147c1
jmp 0x147d1
jmp 0x147c1
jmp 0x147c1
movq %rax, %r14
jmp 0x1480d
jmp 0x147cc
jmp 0x147cc
jmp 0x147cc
movq %rax, %r14
jmp 0x14815
movq %rax, %r14
jmp 0x147f6
movq %rax, %r14
movq 0xc8(%rsp), %rdi
testq %rdi, %rdi
je 0x147f6
movq 0xd8(%rsp), %rsi
subq %rdi, %rsi
callq 0x4250
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x1480d
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x4250
movq 0x80(%rsp), %rbx
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x14829
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x4250
movq %r14, %rdi
callq 0x43c0
nop