// File: /workspace/github_cpp_makefile_star2_O1/cloudinary[P]fuif/transform/2dmatch.h
// Function: fwd_match(Image&, std::vector<int, std::allocator<int>>&)
bool fwd_match(Image &input, std::vector<int> &parameters) {
    std::vector<int> adj_params = parameters; // use a copy so empty (default) parameters remain empty
    meta_match(input, adj_params);
    int c0 = input.nb_meta_channels + adj_params[0];
    int cn = input.nb_meta_channels + adj_params[1];
    if (c0 >= input.channel.size() || cn >= input.channel.size()) {
        e_printf("Error: match transform with incorrect parameters.\n");
        return false;
    }
    int maxdist = 10000, erodes = 1;
    if (adj_params.size() > 3) maxdist = adj_params[3];
    if (adj_params[0] == 0 && adj_params[1] == input.nb_channels-1 && adj_params[2] == 0) parameters.clear(); // we can use default parameters
    if (parameters.size() > 3) parameters.pop_back();
    bool softmatch = adj_params[2];
    Channel &m = input.channel[0];
    int w = input.channel[c0].w;
    int h = input.channel[c0].h;

    if (maxdist > 0) {
      v_printf(5,"Running heuristic to find matches (channels %i-%i)\n",c0,cn);
      offsets ot(maxdist + 1);
      make_offsets_table(ot);
      for (int y=0; y<h; y++) {
        if (y%10 == 0) v_printf(7,"Finding matches at row %i\n",y);
        for (int x=0; x<w; x++) {
            if (m.value(y,x)) continue;
            pixel_type z = find_good_match(input,c0,cn,x,y,ot);
            if (!z) continue;
            int count=0;
            for (int yy=0; y+yy<h; yy++) {
                int xl=0;
                for (; x+xl>=0; xl--) {
                    if (matches(input,c0,cn,x+xl,y+yy,z,ot,false)) {
                        if (m.value(y+yy,x+xl) == 0 || m.value(y+yy,x+xl) > z)
                        { m.value(y+yy,x+xl) = z; count++; }
                    }
                    else break;
                }
                xl++;
                int xr=1;
                for (; x+xr<w; xr++) {
                    if (matches(input,c0,cn,x+xr,y+yy,z,ot,false)) {
                        if (m.value(y+yy,x+xr) == 0 || m.value(y+yy,x+xr) > z)
                        { m.value(y+yy,x+xr) = z; count++; }
                    }
                    else break;
                }
                xr--;
                if (!xl && !xr) break;
            }
            v_printf(8,"Matched %i pixels from seed position (%i,%i)\n",count,x,y);
        }
      }
      for (int y=h-1; y>=0; y--) {
        for (int x=w-1; x>=0; x--) {
            if (m.value(y,x)) do_match(input,c0,cn,x,y,m.value(y,x),ot);
        }
      }
    } else {
      if (input.nb_frames < 2) {
        e_printf("This transform is meant for animations only.\n");
        return false;
      }
      v_printf(5,"Running simple heuristic to find matches from previous frames (channels %i-%i)\n",c0,cn);
      int fh = h / input.nb_frames;
      int offsetcode = 2*fh*fh + (fh&1); // this simple formula corresponds to the code to go exactly one frame up
      m.q = offsetcode;
      int minmatchcount = CLAMP(w/50,5,40); // arbitrary threshold

      for (int n=1; n <= -maxdist; n++)
      for (int y=n*fh; y<h; y++) {
        int matchcount=0;  // to reduce entropy in the match channel, only consider it a match if it matches enough pixels in a row
        bool firstmatch=true;
        for (int x=0; x<w; x++) {
            if (m.value(y,x)) continue;
            bool nomatch = false;
            for (int c=c0; c<=cn; c++)
                if (input.channel[c].value(y,x) != input.channel[c].value(y-n*fh,x)) nomatch=true;
            if (nomatch) { matchcount=0; firstmatch=true; continue; }
            matchcount++;
            if (matchcount >= minmatchcount) {
                if (firstmatch) {
                    for (int prev_x = x-matchcount+1; prev_x < x; prev_x++) {
                        m.value(y,prev_x) = n;
                    }
                }
                firstmatch=false;
                m.value(y,x) = n; // quantization multiplies this by offsetcode;
            }
        }
      }

      // vertical-only erode
/*
      for (int y=fh; y<=h; y++) {
        if (y<h) for (int x=0; x<w; x++) {
            if (m.value(y,x) > 0) {
                if (m.value(y-1,x) == 0
                    && (y+1<h && m.value(y+1,x) == 0)
                ) m.value(y,x) = -m.value(y,x); // if top and bottom are zero, flag this one
            }
        }
        for (int x=0; x<w; x++) {
            if (m.value(y-1,x) < 0) m.value(y-1,x) = 0;
        }
      }
*/

     // simple erode, reduces entropy and helps to avoid lossy artifacts accumulating at the edges

    for (int it=0; it<3; it++)
      for (int y=fh; y<=h; y++) {
        if (y<h) for (int x=0; x<w; x++) {
            if (m.value(y,x) > 0) {
                if (m.value(y-1,x) == 0
                    || (x>0 && m.value(y,x-1) == 0)
                    || (y+1<h && m.value(y+1,x) <= 0)
                    || (x+1<w && m.value(y,x+1) <= 0)
                ) m.value(y,x) = -m.value(y,x); // if any neighbor is zero, flag this one
            }
        }
//        for (int x=0; x<w; x++) {
//            if (m.value(y-1,x) < 0) m.value(y-1,x) = 0;
//        }
      }


      for (int y=fh; y<h; y++) {
        for (int x=0; x<w; x++) {
            if (m.value(y,x) > 0)
                for (int c=c0; c<=cn; c++)
                    input.channel[c].value(y,x) = 0;
            else if (m.value(y,x) < 0) m.value(y,x) *= -1;
        }
      }

    }
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rsi, %rbx
movq %rdi, %r15
leaq 0xb0(%rsp), %r14
movq %r14, %rdi
callq 0x641c
movq %r15, %rdi
movq %r14, %rsi
callq 0xbaa0
movl 0x6c(%r15), %r14d
movq 0xb0(%rsp), %rax
movl (%rax), %ecx
movq %rcx, 0x8(%rsp)
addl %r14d, %ecx
movl %ecx, 0x4(%rsp)
movslq %ecx, %rsi
movq (%r15), %rdx
movq 0x8(%r15), %rcx
movq %rdx, 0x10(%rsp)
subq %rdx, %rcx
sarq $0x6, %rcx
cmpq %rsi, %rcx
jbe 0xc544
movl 0x4(%rax), %edx
movl %edx, 0x20(%rsp)
addl %edx, %r14d
movslq %r14d, %rdx
cmpq %rdx, %rcx
jbe 0xc544
movq 0xb8(%rsp), %rcx
subq %rax, %rcx
movl $0x2710, %r13d          # imm = 0x2710
cmpq $0xd, %rcx
jb 0xc106
movl 0xc(%rax), %r13d
cmpl $0x0, 0x8(%rsp)
jne 0xc12c
movl 0x64(%r15), %ecx
decl %ecx
cmpl %ecx, 0x20(%rsp)
jne 0xc12c
cmpl $0x0, 0x8(%rax)
jne 0xc12c
movq (%rbx), %rax
cmpq %rax, 0x8(%rbx)
je 0xc12c
movq %rax, 0x8(%rbx)
movq 0x8(%rbx), %rax
movq %rax, %rcx
subq (%rbx), %rcx
cmpq $0xd, %rcx
jb 0xc144
addq $-0x4, %rax
movq %rax, 0x8(%rbx)
shlq $0x6, %rsi
movq 0x10(%rsp), %rax
movslq 0x18(%rax,%rsi), %rcx
movq %rcx, 0x58(%rsp)
movl %ecx, %ecx
movq %rcx, 0x18(%rsp)
movl 0x1c(%rax,%rsi), %r12d
testl %r13d, %r13d
movq %r15, 0x50(%rsp)
movq %r14, 0x48(%rsp)
movq %r12, 0x60(%rsp)
jle 0xc585
leaq 0x19d3b(%rip), %rsi     # 0x25ebd
movl $0x5, %edi
movl 0x4(%rsp), %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0x1d0d6
incl %r13d
leaq 0x98(%rsp), %rdi
leaq 0x3f(%rsp), %rdx
movq %r13, %rsi
callq 0xe11e
leaq 0x98(%rsp), %rdi
callq 0xb38b
testl %r12d, %r12d
jle 0xc46a
movq 0x10(%rsp), %rax
addq $0x24, %rax
movq %rax, 0x20(%rsp)
movq 0x18(%rsp), %rax
negl %eax
movq %rax, 0x78(%rsp)
xorl %ebp, %ebp
imull $0xcccccccd, %ebp, %eax # imm = 0xCCCCCCCD
rorl %eax
cmpl $0x19999999, %eax       # imm = 0x19999999
ja 0xc203
movl $0x7, %edi
leaq 0x19cf7(%rip), %rsi     # 0x25ef1
movl %ebp, %edx
xorl %eax, %eax
callq 0x1d0d6
cmpl $0x0, 0x18(%rsp)
jle 0xc45f
xorl %ecx, %ecx
movq %rbp, 0x88(%rsp)
movq 0x10(%rsp), %rdx
movl 0x18(%rdx), %eax
imull %ebp, %eax
addl %ecx, %eax
cltq
movq (%rdx), %rsi
movq 0x8(%rdx), %rdx
subq %rsi, %rdx
sarq %rdx
cmpq %rax, %rdx
leaq (%rsi,%rax,2), %rax
cmovbeq 0x20(%rsp), %rax
cmpw $0x0, (%rax)
jne 0xc452
movq %r15, %rdi
movl 0x4(%rsp), %esi
movl %r14d, %edx
movq %rcx, 0x8(%rsp)
movl %ebp, %r8d
leaq 0x98(%rsp), %r9
callq 0xbd4b
movl %eax, %r13d
testw %ax, %ax
movq 0x8(%rsp), %rcx
je 0xc452
movswl %r13w, %ebx
leal 0x1(%rcx), %eax
movl %eax, 0x90(%rsp)
movl %ecx, %eax
notl %eax
movl %eax, 0x30(%rsp)
movq 0x78(%rsp), %rax
addl %ecx, %eax
movl %eax, 0x70(%rsp)
xorl %edx, %edx
movl %ebp, %esi
movl $0x0, (%rsp)
movq %rdx, 0x68(%rsp)
addl %edx, %ebp
movl %esi, 0x40(%rsp)
movslq %esi, %r14
movq %rcx, %r12
xorl %r15d, %r15d
addl %r15d, %ecx
movq 0x50(%rsp), %rdi
movl 0x4(%rsp), %esi
movq 0x48(%rsp), %rdx
movl %ebp, %r8d
movl %ebx, %r9d
pushq $0x0
leaq 0xa0(%rsp), %rax
pushq %rax
callq 0xbbdb
addq $0x10, %rsp
testb %al, %al
je 0xc33d
movq 0x10(%rsp), %rdx
movslq 0x18(%rdx), %rax
imulq %r14, %rax
addq %r12, %rax
movq (%rdx), %rcx
movq 0x8(%rdx), %rdx
subq %rcx, %rdx
sarq %rdx
cmpq %rax, %rdx
leaq (%rcx,%rax,2), %rax
cmovbeq 0x20(%rsp), %rax
movzwl (%rax), %ecx
testw %cx, %cx
je 0xc322
cmpw %r13w, %cx
jle 0xc329
movw %r13w, (%rax)
incl (%rsp)
movq 0x8(%rsp), %rcx
decl %r15d
decq %r12
cmpl 0x30(%rsp), %r15d
jg 0xc2bb
jmp 0xc342
movq 0x8(%rsp), %rcx
movl 0x90(%rsp), %eax
cmpl 0x18(%rsp), %eax
jge 0xc3e5
movl $0x1, %r14d
leal (%rcx,%r14), %r12d
movq 0x50(%rsp), %rdi
movl 0x4(%rsp), %esi
movq 0x48(%rsp), %rdx
movl %r12d, %ecx
movl %ebp, %r8d
movl %ebx, %r9d
pushq $0x0
leaq 0xa0(%rsp), %rax
pushq %rax
callq 0xbbdb
addq $0x10, %rsp
testb %al, %al
je 0xc3e9
movq 0x10(%rsp), %rdx
movl 0x18(%rdx), %eax
imull 0x40(%rsp), %eax
addl %eax, %r12d
movslq %r12d, %rax
movq (%rdx), %rcx
movq 0x8(%rdx), %rdx
subq %rcx, %rdx
sarq %rdx
cmpq %rax, %rdx
leaq (%rcx,%rax,2), %rax
cmovbeq 0x20(%rsp), %rax
movzwl (%rax), %ecx
testw %cx, %cx
je 0xc3c7
cmpw %r13w, %cx
jle 0xc3ce
movw %r13w, (%rax)
incl (%rsp)
movq 0x8(%rsp), %rcx
incl %r14d
movl 0x70(%rsp), %eax
addl %r14d, %eax
jne 0xc359
jmp 0xc3ee
xorl %eax, %eax
jmp 0xc3f5
movq 0x8(%rsp), %rcx
cmpl $0x1, %r14d
setne %al
cmpl $-0x1, %r15d
sete %dl
xorb $0x1, %al
testb %al, %dl
movq 0x60(%rsp), %r12
movq 0x88(%rsp), %rbp
movl 0x40(%rsp), %esi
movq 0x68(%rsp), %rdx
jne 0xc42a
leal (%rdx,%rbp), %eax
incl %eax
incl %edx
incl %esi
cmpl %r12d, %eax
jl 0xc2a7
movl $0x8, %edi
leaq 0x19ad6(%rip), %rsi     # 0x25f0c
movl (%rsp), %edx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x1d0d6
movq 0x8(%rsp), %rcx
movq 0x50(%rsp), %r15
movq 0x48(%rsp), %r14
incq %rcx
cmpl 0x18(%rsp), %ecx
jne 0xc218
incl %ebp
cmpl %r12d, %ebp
jne 0xc1df
testl %r12d, %r12d
jle 0xc523
movq 0x10(%rsp), %rax
leaq 0x24(%rax), %rbx
movq 0x58(%rsp), %rax
leal 0x1(%rax), %ecx
movl %ecx, 0x8(%rsp)
leal -0x1(%r12), %r14d
decq %rax
movq %rax, 0x20(%rsp)
movl %r12d, %r15d
leal -0x1(%r15), %r12d
movq 0x20(%rsp), %r13
movl 0x8(%rsp), %eax
movl %eax, %ebp
cmpl $0x0, 0x58(%rsp)
jle 0xc516
movq 0x10(%rsp), %rdx
movslq 0x18(%rdx), %rax
movslq %r14d, %rcx
imulq %rax, %rcx
addq %r13, %rcx
movq (%rdx), %rax
movq 0x8(%rdx), %rdx
subq %rax, %rdx
sarq %rdx
cmpq %rcx, %rdx
leaq (%rax,%rcx,2), %rax
cmovbeq %rbx, %rax
movswl (%rax), %r9d
testl %r9d, %r9d
je 0xc50c
leal -0x2(%rbp), %ecx
subq $0x8, %rsp
movq 0x58(%rsp), %rdi
movl 0xc(%rsp), %esi
movq 0x50(%rsp), %rdx
movl %r12d, %r8d
leaq 0xa0(%rsp), %rax
pushq %rax
callq 0xbcc8
addq $0x10, %rsp
decl %ebp
decq %r13
cmpl $0x1, %ebp
jg 0xc4ae
decl %r14d
cmpl $0x2, %r15d
jge 0xc495
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0xc540
movq 0xa8(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
movb $0x1, %bl
jmp 0xc554
xorl %ebx, %ebx
leaq 0x198aa(%rip), %rdi     # 0x25df7
xorl %eax, %eax
callq 0x3796
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0xc571
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
movl %ebx, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x1, 0x38(%r15)
jg 0xc59e
xorl %ebx, %ebx
leaq 0x199a5(%rip), %rdi     # 0x25f3a
xorl %eax, %eax
callq 0x3796
jmp 0xc554
movq %rsi, 0x80(%rsp)
leaq 0x199bb(%rip), %rsi     # 0x25f68
movl $0x5, %ebx
movl $0x5, %edi
movl 0x4(%rsp), %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0x1d0d6
movl %r12d, %eax
cltd
idivl 0x38(%r15)
movl %eax, %ecx
imull %eax, %eax
movq %rcx, 0x28(%rsp)
andl $0x1, %ecx
leal (%rcx,%rax,2), %eax
movq 0x10(%rsp), %rcx
movl %eax, 0x28(%rcx)
movq 0x18(%rsp), %rdx
movslq %edx, %rax
imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x24, %rax
addl %ecx, %eax
cmpl $0x802, 0x58(%rsp)      # imm = 0x802
movl $0x28, %ecx
cmovll %eax, %ecx
cmpl $0xfa, %edx
cmovll %ebx, %ecx
movl %ecx, 0x40(%rsp)
testl %r13d, %r13d
jns 0xc853
negl %r13d
movq 0x48(%rsp), %rax
movl 0x4(%rsp), %ecx
cmpl %eax, %ecx
movl %eax, %edx
cmovgl %ecx, %edx
cmpl $0x2, %r13d
movl $0x1, %r11d
cmovll %r11d, %r13d
movq 0x10(%rsp), %rax
leaq 0x24(%rax), %rdi
movq 0x80(%rsp), %rax
addq $0x24, %rax
movq %rax, 0xd0(%rsp)
subl %ecx, %edx
incl %edx
movl %edx, 0x88(%rsp)
movq %r13, 0xc8(%rsp)
movl %r11d, %eax
imull 0x28(%rsp), %eax
movl %eax, 0x78(%rsp)
cmpl %r12d, %eax
jge 0xc83b
movl 0x78(%rsp), %r10d
movq %r11, 0x90(%rsp)
cmpl $0x0, 0x18(%rsp)
jle 0xc82a
movq 0x10(%rsp), %rcx
movl 0x18(%rcx), %eax
imull %r10d, %eax
movq (%rcx), %r15
movq 0x8(%rcx), %rbx
subq %r15, %rbx
sarq %rbx
movl %r10d, %r13d
subl 0x78(%rsp), %r13d
movslq %eax, %rsi
movq 0x50(%rsp), %rax
movq (%rax), %rax
addq 0xd0(%rsp), %rax
movq %rax, 0x68(%rsp)
movb $0x1, %r14b
xorl %r8d, %r8d
xorl %eax, %eax
xorl %ebp, %ebp
movq %rsi, 0x30(%rsp)
movq %r15, 0x70(%rsp)
leaq (%rax,%rsi), %rcx
cmpq %rcx, %rbx
leaq (%r15,%rcx,2), %r9
cmovbeq %rdi, %r9
cmpw $0x0, (%r9)
je 0xc71e
movl %ebp, %edx
incq %rax
incl %r8d
movl %edx, %ebp
cmpq 0x18(%rsp), %rax
jne 0xc6f2
jmp 0xc82a
movl 0x20(%rsp), %ecx
cmpl %ecx, 0x8(%rsp)
jg 0xc7c1
movl %r14d, (%rsp)
xorl %edx, %edx
movl 0x88(%rsp), %ecx
movq 0x68(%rsp), %r12
movl -0xc(%r12), %esi
movl %esi, %r14d
imull %r10d, %r14d
movslq %r14d, %r14
addq %rax, %r14
movq -0x24(%r12), %r11
movq -0x1c(%r12), %r15
subq %r11, %r15
sarq %r15
cmpq %r14, %r15
leaq (%r11,%r14,2), %r14
cmovbeq %r12, %r14
imull %r13d, %esi
movslq %esi, %rsi
addq %rax, %rsi
cmpq %rsi, %r15
leaq (%r11,%rsi,2), %rsi
cmovbeq %r12, %rsi
movzwl (%r14), %r11d
cmpw (%rsi), %r11w
je 0xc791
movl $0x1, %edx
jmp 0xc794
movzbl %dl, %edx
addq $0x40, %r12
decl %ecx
jne 0xc73e
testb $0x1, %dl
movq 0x90(%rsp), %r11
movq 0x70(%rsp), %r15
movq 0x30(%rsp), %rsi
movl (%rsp), %r14d
je 0xc7c1
movb $0x1, %r14b
xorl %edx, %edx
jmp 0xc70a
leal 0x1(%rbp), %edx
cmpl 0x40(%rsp), %edx
jl 0xc70a
testb $0x1, %r14b
je 0xc819
movl %eax, %ecx
subl %edx, %ecx
incl %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jle 0xc819
movl %r8d, %ecx
subl %ebp, %ecx
movslq %ecx, %rcx
movq 0x30(%rsp), %rsi
leaq (%rsi,%rcx), %r14
leaq (%r15,%r14,2), %r12
incq %rcx
cmpq %r14, %rbx
movq %rdi, %rsi
cmovaq %r12, %rsi
movw %r11w, (%rsi)
movl %ecx, %esi
incq %r14
addq $0x2, %r12
incq %rcx
cmpq %rax, %rsi
jne 0xc7fa
movw %r11w, (%r9)
xorl %r14d, %r14d
movq 0x30(%rsp), %rsi
jmp 0xc70a
incl %r10d
movq 0x60(%rsp), %r12
cmpl %r12d, %r10d
jl 0xc69a
leal 0x1(%r11), %eax
movq 0xc8(%rsp), %r13
cmpl %r13d, %r11d
movl %eax, %r11d
jne 0xc678
movq 0x10(%rsp), %rax
leaq 0x24(%rax), %rsi
movq 0x28(%rsp), %rax
leal -0x1(%rax), %ecx
movl %ecx, 0x70(%rsp)
incl %eax
movl %eax, 0x68(%rsp)
xorl %eax, %eax
movq %rax, 0x40(%rsp)
movl 0x68(%rsp), %eax
movl %eax, (%rsp)
movl 0x70(%rsp), %r8d
movq 0x28(%rsp), %rax
movl %eax, %r9d
cmpl %r12d, %eax
jg 0xc9b3
cmpl $0x0, 0x58(%rsp)
setle %al
cmpl %r12d, %r9d
setge %cl
orb %al, %cl
jne 0xc998
movq 0x10(%rsp), %rdx
movl 0x18(%rdx), %eax
movq (%rdx), %rcx
movq 0x8(%rdx), %r10
subq %rcx, %r10
sarq %r10
leal 0x1(%r9), %r11d
movl %eax, %edx
imull %r9d, %edx
movslq %edx, %rbx
leaq (%rcx,%rbx,2), %r14
movl %eax, %edx
imull %r8d, %edx
movslq %edx, %r15
leaq (%rcx,%r15,2), %r12
imull (%rsp), %eax
cltq
movq %rax, 0x30(%rsp)
leaq (%rcx,%rax,2), %rbp
xorl %eax, %eax
leaq (%rbx,%rax), %rcx
cmpq %rcx, %r10
movq %rsi, %rcx
cmovaq %r14, %rcx
movzwl (%rcx), %edx
testw %dx, %dx
jle 0xc97e
leaq (%r15,%rax), %r13
cmpq %r13, %r10
movq %rsi, %r13
cmovaq %r12, %r13
cmpw $0x0, (%r13)
je 0xc979
testq %rax, %rax
je 0xc935
leaq (%rbx,%rax), %r13
decq %r13
leaq -0x2(%r14), %rdi
cmpq %r13, %r10
cmovbeq %rsi, %rdi
cmpw $0x0, (%rdi)
je 0xc979
cmpl 0x60(%rsp), %r11d
jge 0xc954
movq 0x30(%rsp), %rdi
addq %rax, %rdi
cmpq %rdi, %r10
movq %rsi, %rdi
cmovaq %rbp, %rdi
cmpw $0x0, (%rdi)
jle 0xc979
leaq 0x1(%rax), %rdi
cmpq 0x58(%rsp), %rdi
jge 0xc97e
leaq (%rbx,%rax), %rdi
incq %rdi
leaq 0x2(%r14), %r13
cmpq %rdi, %r10
cmovbeq %rsi, %r13
cmpw $0x0, (%r13)
jg 0xc97e
negl %edx
movw %dx, (%rcx)
incq %rax
addq $0x2, %r14
addq $0x2, %r12
addq $0x2, %rbp
cmpq %rax, 0x18(%rsp)
jne 0xc8ec
leal 0x1(%r9), %eax
incl %r8d
incl (%rsp)
movq 0x60(%rsp), %r12
cmpl %r12d, %r9d
movl %eax, %r9d
jne 0xc892
movq 0x40(%rsp), %rax
incl %eax
cmpl $0x3, %eax
jne 0xc870
movb $0x1, %bl
cmpl %r12d, 0x28(%rsp)
jge 0xc554
movq 0x48(%rsp), %rbp
movl 0x4(%rsp), %eax
cmpl %ebp, %eax
cmovgl %eax, %ebp
addq $0x24, 0x80(%rsp)
subl %eax, %ebp
incl %ebp
movq 0x50(%rsp), %r13
cmpl $0x0, 0x18(%rsp)
jle 0xca9c
movq 0x10(%rsp), %rdi
movslq 0x18(%rdi), %rax
movslq 0x28(%rsp), %rdx
imulq %rdx, %rax
movq (%rdi), %rcx
movq 0x8(%rdi), %rdi
subq %rcx, %rdi
sarq %rdi
movq (%r13), %r8
addq 0x80(%rsp), %r8
xorl %r9d, %r9d
leaq (%r9,%rax), %r10
cmpq %r10, %rdi
leaq (%rcx,%r10,2), %r10
cmovbeq %rsi, %r10
movzwl (%r10), %r11d
testw %r11w, %r11w
jle 0xca89
movl 0x20(%rsp), %r10d
cmpl %r10d, 0x8(%rsp)
jg 0xca92
movl %ebp, %r10d
movq %r8, %r11
movslq -0xc(%r11), %r14
imulq %rdx, %r14
addq %r9, %r14
movq -0x24(%r11), %r15
movq -0x1c(%r11), %r12
subq %r15, %r12
sarq %r12
cmpq %r14, %r12
leaq (%r15,%r14,2), %r14
cmovbeq %r11, %r14
movw $0x0, (%r14)
addq $0x40, %r11
decl %r10d
jne 0xca54
jmp 0xca92
jns 0xca92
negl %r11d
movw %r11w, (%r10)
incq %r9
cmpq 0x18(%rsp), %r9
jne 0xca29
movq 0x28(%rsp), %rax
incl %eax
movq %rax, 0x28(%rsp)
cmpl 0x60(%rsp), %eax
jne 0xc9f0
jmp 0xc554
jmp 0xcabd
jmp 0xcabd
jmp 0xcabd
movq %rax, %rbx
jmp 0xcae6
jmp 0xcac6
jmp 0xcac6
movq %rax, %rbx
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0xcae6
movq 0xa8(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0xcb03
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
movq %rbx, %rdi
callq 0x35a0