// File: /workspace/github_cpp_makefile_star2_O3/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 0xb8(%rsp), %r14
movq %r14, %rdi
callq 0x63d8
movq %r15, %rdi
movq %r14, %rsi
callq 0xb9c5
movl 0x6c(%r15), %r14d
movq 0xb8(%rsp), %rax
movl (%rax), %ecx
movq %rcx, 0x28(%rsp)
addl %r14d, %ecx
movl %ecx, 0xc(%rsp)
movslq %ecx, %rsi
movq (%r15), %rdx
movq 0x8(%r15), %rcx
movq %rdx, 0x20(%rsp)
subq %rdx, %rcx
sarq $0x6, %rcx
cmpq %rsi, %rcx
jbe 0xc498
movl 0x4(%rax), %edx
movl %edx, 0x40(%rsp)
addl %edx, %r14d
movslq %r14d, %rdx
cmpq %rdx, %rcx
jbe 0xc498
movq 0xc0(%rsp), %rcx
subq %rax, %rcx
movl $0x2710, %r12d          # imm = 0x2710
cmpq $0xd, %rcx
jb 0xc02d
movl 0xc(%rax), %r12d
cmpl $0x0, 0x28(%rsp)
jne 0xc053
movl 0x64(%r15), %ecx
decl %ecx
cmpl %ecx, 0x40(%rsp)
jne 0xc053
cmpl $0x0, 0x8(%rax)
jne 0xc053
movq (%rbx), %rax
cmpq %rax, 0x8(%rbx)
je 0xc053
movq %rax, 0x8(%rbx)
movq 0x8(%rbx), %rax
movq %rax, %rcx
subq (%rbx), %rcx
cmpq $0xd, %rcx
jb 0xc06b
addq $-0x4, %rax
movq %rax, 0x8(%rbx)
shlq $0x6, %rsi
movq 0x20(%rsp), %rax
movl 0x18(%rax,%rsi), %ecx
movl 0x1c(%rax,%rsi), %eax
movq %rax, (%rsp)
movq %rcx, 0x10(%rsp)
movslq %ecx, %rax
movq %rax, 0x68(%rsp)
testl %r12d, %r12d
movq %r15, 0x48(%rsp)
jle 0xc4d9
leaq 0x19e1b(%rip), %rsi     # 0x25ebd
movl $0x5, %edi
movl 0xc(%rsp), %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0x1cede
incl %r12d
leaq 0xa0(%rsp), %rdi
leaq 0x67(%rsp), %rdx
movq %r12, %rsi
callq 0xe090
leaq 0xa0(%rsp), %rdi
callq 0xb2a5
cmpl $0x0, (%rsp)
jle 0xc477
movq %r14, 0x58(%rsp)
movq 0x20(%rsp), %rax
addq $0x24, %rax
movq %rax, 0x40(%rsp)
movq 0x10(%rsp), %rax
negl %eax
movq %rax, 0x78(%rsp)
xorl %r14d, %r14d
movq 0x48(%rsp), %rbx
imull $0xcccccccd, %r14d, %eax # imm = 0xCCCCCCCD
rorl %eax
cmpl $0x19999999, %eax       # imm = 0x19999999
ja 0xc131
movl $0x7, %edi
leaq 0x19dca(%rip), %rsi     # 0x25ef1
movl %r14d, %edx
xorl %eax, %eax
callq 0x1cede
cmpl $0x0, 0x10(%rsp)
jle 0xc3b2
xorl %ecx, %ecx
movq 0x10(%rsp), %rax
movl %eax, 0x34(%rsp)
movq %r14, 0x80(%rsp)
movq 0x20(%rsp), %rdx
movl 0x18(%rdx), %eax
imull %r14d, %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 0x40(%rsp), %rax
cmpw $0x0, (%rax)
jne 0xc3a1
movq %rbx, %rdi
movl 0xc(%rsp), %esi
movq 0x58(%rsp), %rdx
movq %rcx, 0x28(%rsp)
movl %r14d, %r8d
leaq 0xa0(%rsp), %r9
callq 0xbc62
movl %eax, %r13d
testw %ax, %ax
movq 0x28(%rsp), %rcx
je 0xc3a1
movswl %r13w, %ebx
leal 0x1(%rcx), %eax
movl %eax, 0x88(%rsp)
movl %ecx, %eax
notl %eax
movl %eax, 0x50(%rsp)
movq 0x78(%rsp), %rax
addl %ecx, %eax
movl %eax, 0x98(%rsp)
xorl %edx, %edx
movl %r14d, %esi
movl $0x0, 0x38(%rsp)
movq %rdx, 0x90(%rsp)
leal (%rdx,%r14), %ebp
movl %esi, 0x3c(%rsp)
movslq %esi, %r14
movq %rcx, %r12
xorl %r15d, %r15d
addl %r15d, %ecx
movq 0x48(%rsp), %rdi
movl 0xc(%rsp), %esi
movq 0x58(%rsp), %rdx
movl %ebp, %r8d
movl %ebx, %r9d
pushq $0x0
leaq 0xa8(%rsp), %rax
pushq %rax
callq 0xbb03
addq $0x10, %rsp
testb %al, %al
je 0xc286
movq 0x20(%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 0x40(%rsp), %rax
movzwl (%rax), %ecx
testw %cx, %cx
je 0xc266
cmpw %r13w, %cx
jle 0xc26e
movw %r13w, (%rax)
incl 0x38(%rsp)
movq 0x28(%rsp), %rcx
decl %r15d
decq %r12
cmpl 0x50(%rsp), %r15d
jg 0xc1ff
jmp 0xc28b
movq 0x28(%rsp), %rcx
movl 0x88(%rsp), %eax
cmpl 0x10(%rsp), %eax
jge 0xc339
movl $0x1, %r14d
leal (%rcx,%r14), %r12d
movq 0x48(%rsp), %rdi
movl 0xc(%rsp), %esi
movq 0x58(%rsp), %rdx
movl %r12d, %ecx
movl %ebp, %r8d
movl %ebx, %r9d
pushq $0x0
leaq 0xa8(%rsp), %rax
pushq %rax
callq 0xbb03
addq $0x10, %rsp
testb %al, %al
je 0xc33d
movq 0x20(%rsp), %rdx
movl 0x18(%rdx), %eax
imull 0x3c(%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 0x40(%rsp), %rax
movzwl (%rax), %ecx
testw %cx, %cx
je 0xc310
cmpw %r13w, %cx
jle 0xc318
movw %r13w, (%rax)
incl 0x38(%rsp)
movq 0x28(%rsp), %rcx
incl %r14d
movl 0x98(%rsp), %eax
addl %r14d, %eax
jne 0xc2a2
movl 0x34(%rsp), %eax
movl %eax, %r14d
jmp 0xc342
xorl %eax, %eax
jmp 0xc349
movq 0x28(%rsp), %rcx
cmpl $0x1, %r14d
setne %al
cmpl $-0x1, %r15d
sete %dl
xorb $0x1, %al
testb %al, %dl
movq 0x80(%rsp), %r14
movl 0x3c(%rsp), %esi
movq 0x90(%rsp), %rdx
jne 0xc37d
leal (%rdx,%r14), %eax
incl %eax
incl %edx
incl %esi
cmpl (%rsp), %eax
jl 0xc1e6
movl $0x8, %edi
leaq 0x19b83(%rip), %rsi     # 0x25f0c
movl 0x38(%rsp), %edx
movl %r14d, %r8d
xorl %eax, %eax
callq 0x1cede
movq 0x28(%rsp), %rcx
movq 0x48(%rsp), %rbx
incq %rcx
decl 0x34(%rsp)
cmpl 0x10(%rsp), %ecx
jne 0xc14f
incl %r14d
cmpl (%rsp), %r14d
jne 0xc10b
cmpl $0x0, (%rsp)
movq 0x58(%rsp), %r13
jle 0xc477
movq 0x10(%rsp), %rax
leal 0x1(%rax), %ebx
movq (%rsp), %rax
leal -0x1(%rax), %ebp
decq 0x68(%rsp)
movq (%rsp), %r14
leal -0x1(%r14), %eax
movq %rax, (%rsp)
movq 0x68(%rsp), %r15
movl %ebx, %r12d
cmpl $0x0, 0x10(%rsp)
jle 0xc46b
movq 0x20(%rsp), %rdx
movslq 0x18(%rdx), %rax
movslq %ebp, %rcx
imulq %rax, %rcx
addq %r15, %rcx
movq (%rdx), %rax
movq 0x8(%rdx), %rdx
subq %rax, %rdx
sarq %rdx
cmpq %rcx, %rdx
leaq (%rax,%rcx,2), %rax
cmovbeq 0x40(%rsp), %rax
movswl (%rax), %r9d
testl %r9d, %r9d
je 0xc45f
leal -0x2(%r12), %ecx
subq $0x8, %rsp
movq 0x50(%rsp), %rdi
movl 0x14(%rsp), %esi
movl %r13d, %edx
movq 0x8(%rsp), %r8
leaq 0xa8(%rsp), %rax
pushq %rax
callq 0xbbdf
addq $0x10, %rsp
decl %r12d
decq %r15
cmpl $0x1, %r12d
ja 0xc3fd
decl %ebp
cmpl $0x2, %r14d
jge 0xc3e2
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0xc494
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
movb $0x1, %bl
jmp 0xc4a8
xorl %ebx, %ebx
leaq 0x19956(%rip), %rdi     # 0x25df7
xorl %eax, %eax
callq 0x379e
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0xc4c5
movq 0xc8(%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 0xc4f2
xorl %ebx, %ebx
leaq 0x19a51(%rip), %rdi     # 0x25f3a
xorl %eax, %eax
callq 0x379e
jmp 0xc4a8
movq %rsi, 0x70(%rsp)
leaq 0x19a6a(%rip), %rsi     # 0x25f68
movl $0x5, %ebx
movl $0x5, %edi
movl 0xc(%rsp), %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0x1cede
movq %r14, 0x58(%rsp)
movq (%rsp), %rax
cltd
idivl 0x38(%r15)
movl %eax, %edx
imull %edx, %edx
movl %eax, 0x1c(%rsp)
movl %eax, %ecx
andl $0x1, %ecx
leal (%rcx,%rdx,2), %eax
movq 0x20(%rsp), %rcx
movl %eax, 0x28(%rcx)
movq 0x68(%rsp), %rdx
imulq $0x51eb851f, %rdx, %rax # imm = 0x51EB851F
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x24, %rax
addl %ecx, %eax
cmpl $0x802, %edx            # imm = 0x802
movl $0x28, %ecx
cmovll %eax, %ecx
cmpl $0xfa, %edx
cmovll %ebx, %ecx
movl %ecx, 0x3c(%rsp)
testl %r12d, %r12d
jns 0xc7a2
negl %r12d
movq 0x58(%rsp), %rax
movl 0xc(%rsp), %ecx
cmpl %eax, %ecx
movl %eax, %edx
cmovgl %ecx, %edx
cmpl $0x2, %r12d
movl $0x1, %r11d
cmovll %r11d, %r12d
movq 0x20(%rsp), %rax
leaq 0x24(%rax), %rdi
movq 0x70(%rsp), %rax
addq $0x24, %rax
movq %rax, 0x78(%rsp)
subl %ecx, %edx
incl %edx
movl %edx, 0x80(%rsp)
movq %r12, 0xd0(%rsp)
movl %r11d, %eax
imull 0x1c(%rsp), %eax
movl %eax, 0x34(%rsp)
cmpl (%rsp), %eax
jge 0xc78a
movl 0x34(%rsp), %r10d
movq %r11, 0x88(%rsp)
cmpl $0x0, 0x10(%rsp)
jle 0xc77d
movq 0x20(%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 0x34(%rsp), %r13d
movslq %eax, %rsi
movq 0x48(%rsp), %rax
movq (%rax), %rax
addq 0x78(%rsp), %rax
movq %rax, 0x90(%rsp)
movb $0x1, %r14b
xorl %r8d, %r8d
xorl %eax, %eax
xorl %ebp, %ebp
movq %rsi, 0x50(%rsp)
movq %r15, 0x98(%rsp)
leaq (%rax,%rsi), %rcx
cmpq %rcx, %rbx
leaq (%r15,%rcx,2), %r9
cmovbeq %rdi, %r9
cmpw $0x0, (%r9)
je 0xc66e
movl %ebp, %edx
incq %rax
incl %r8d
movl %edx, %ebp
cmpq 0x10(%rsp), %rax
jne 0xc642
jmp 0xc77d
movl 0x40(%rsp), %ecx
cmpl %ecx, 0x28(%rsp)
jg 0xc714
movl %r14d, 0x38(%rsp)
xorl %edx, %edx
movl 0x80(%rsp), %ecx
movq 0x90(%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
setne %sil
orb %sil, %dl
addq $0x40, %r12
decl %ecx
jne 0xc692
testb $0x1, %dl
movq 0x88(%rsp), %r11
movq 0x98(%rsp), %r15
movq 0x50(%rsp), %rsi
movl 0x38(%rsp), %r14d
je 0xc714
movb $0x1, %r14b
xorl %edx, %edx
jmp 0xc65a
leal 0x1(%rbp), %edx
cmpl 0x3c(%rsp), %edx
jl 0xc65a
testb $0x1, %r14b
je 0xc76c
movl %eax, %ecx
subl %edx, %ecx
incl %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jle 0xc76c
movl %r8d, %ecx
subl %ebp, %ecx
movslq %ecx, %rcx
movq 0x50(%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 0xc74d
movw %r11w, (%r9)
xorl %r14d, %r14d
movq 0x50(%rsp), %rsi
jmp 0xc65a
incl %r10d
cmpl (%rsp), %r10d
jl 0xc5e7
leal 0x1(%r11), %eax
movq 0xd0(%rsp), %r12
cmpl %r12d, %r11d
movl %eax, %r11d
jne 0xc5c5
movq 0x20(%rsp), %rax
leaq 0x24(%rax), %rcx
movq (%rsp), %rax
incl %eax
xorl %edx, %edx
movq 0x48(%rsp), %r13
movq %rdx, 0x50(%rsp)
movl 0x1c(%rsp), %edx
movl %edx, %esi
cmpl (%rsp), %edx
jg 0xc8e6
cmpl $0x0, 0x10(%rsp)
setle %dil
cmpl (%rsp), %esi
setge %r8b
orb %dil, %r8b
cmpb $0x1, %r8b
jne 0xc7ec
incl %esi
jmp 0xc8de
movq 0x20(%rsp), %rdx
movl 0x18(%rdx), %r8d
movl %r8d, %r10d
imull %esi, %r10d
movq (%rdx), %r14
movq 0x8(%rdx), %rdi
subq %r14, %rdi
sarq %rdi
leal -0x1(%rsi), %r9d
imull %r8d, %r9d
incl %esi
imull %esi, %r8d
movslq %r8d, %r8
movslq %r9d, %r9
movslq %r10d, %r10
leaq (%r14,%r10,2), %r11
leaq (%r14,%r9,2), %rbx
leaq (%r14,%r8,2), %r14
xorl %r15d, %r15d
leaq (%r10,%r15), %r12
cmpq %r12, %rdi
movq %rcx, %r12
cmovaq %r11, %r12
movzwl (%r12), %ebp
testw %bp, %bp
jle 0xc8bf
leaq (%r9,%r15), %r13
cmpq %r13, %rdi
movq %rcx, %r13
cmovaq %rbx, %r13
cmpw $0x0, (%r13)
je 0xc8b8
testq %r15, %r15
je 0xc87a
leaq (%r10,%r15), %r13
decq %r13
leaq -0x2(%r11), %rdx
cmpq %r13, %rdi
cmovbeq %rcx, %rdx
cmpw $0x0, (%rdx)
je 0xc8b8
cmpl (%rsp), %esi
jge 0xc893
leaq (%r8,%r15), %rdx
cmpq %rdx, %rdi
movq %rcx, %rdx
cmovaq %r14, %rdx
cmpw $0x0, (%rdx)
jle 0xc8b8
leaq 0x1(%r15), %rdx
cmpq 0x68(%rsp), %rdx
jge 0xc8bf
leaq (%r10,%r15), %rdx
incq %rdx
leaq 0x2(%r11), %r13
cmpq %rdx, %rdi
cmovbeq %rcx, %r13
cmpw $0x0, (%r13)
jg 0xc8bf
negl %ebp
movw %bp, (%r12)
incq %r15
addq $0x2, %r11
addq $0x2, %rbx
addq $0x2, %r14
cmpq %r15, 0x10(%rsp)
jne 0xc82f
movq 0x48(%rsp), %r13
cmpl %eax, %esi
jne 0xc7cc
movq 0x50(%rsp), %rdx
incl %edx
cmpl $0x3, %edx
jne 0xc7b8
movb $0x1, %bl
movl 0x1c(%rsp), %eax
cmpl (%rsp), %eax
jge 0xc4a8
movq 0x58(%rsp), %rbp
movl 0xc(%rsp), %eax
cmpl %ebp, %eax
cmovgl %eax, %ebp
addq $0x24, 0x70(%rsp)
subl %eax, %ebp
incl %ebp
cmpl $0x0, 0x10(%rsp)
jle 0xc9c6
movq 0x20(%rsp), %rdi
movslq 0x18(%rdi), %rax
movslq 0x1c(%rsp), %rdx
imulq %rdx, %rax
movq (%rdi), %rsi
movq 0x8(%rdi), %rdi
subq %rsi, %rdi
sarq %rdi
movq (%r13), %r8
addq 0x70(%rsp), %r8
xorl %r9d, %r9d
leaq (%r9,%rax), %r10
cmpq %r10, %rdi
leaq (%rsi,%r10,2), %r10
cmovbeq %rcx, %r10
movzwl (%r10), %r11d
testw %r11w, %r11w
jle 0xc9b3
movl 0x40(%rsp), %r10d
cmpl %r10d, 0x28(%rsp)
jg 0xc9bc
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 0xc97e
jmp 0xc9bc
jns 0xc9bc
negl %r11d
movw %r11w, (%r10)
incq %r9
cmpq 0x10(%rsp), %r9
jne 0xc953
movl 0x1c(%rsp), %eax
incl %eax
movl %eax, 0x1c(%rsp)
cmpl (%rsp), %eax
jne 0xc91d
jmp 0xc4a8
jmp 0xc9e4
jmp 0xc9e4
jmp 0xc9e4
movq %rax, %rbx
jmp 0xca0d
jmp 0xc9ed
jmp 0xc9ed
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0xca0d
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0xca2a
movq 0xc8(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
movq %rbx, %rdi
callq 0x3590