// File: /workspace/github_cpp_makefile_star2_O1/cloudinary[P]fuif/encoding/encoding.cpp
// Function: bool fuif_encode_channels<BlobIO, RacOutput24<BlobIO>, FinalPropertySymbolCoder<SimpleBitChance, RacOutput24<BlobIO>, 15>, false, true>(BlobIO&, Tree&, fuif_options&, int, int, int, Image const&, unsigned long&)
bool fuif_encode_channels(IO& io, Tree &tree, fuif_options &options, int predictor, int beginc, int endc, const Image &image, size_t &header_pos) {
  assert(endc >= beginc);
  write_big_endian_varint(io, ((endc-beginc) << 4) + (predictor << 1) + (compress?1:0));
  if (endc>beginc) v_printf(5,"Encoding%s channels %i-%i\n", (compress?"":" uncompressed"), beginc, endc);

  pixel_type global_minv=LARGEST_VAL;
  pixel_type global_maxv=SMALLEST_VAL;
  for (int i=beginc; i<=endc; i++) {
    const Channel &channel = image.channel[i];
    if (channel.w * channel.h <= 0) continue; // zero pixel channel? could happen
    pixel_type minv = channel.minval;
    pixel_type maxv = channel.maxval;
    if (minv<global_minv) global_minv=minv;
    if (maxv>global_maxv) global_maxv=maxv;
  }
  if (global_minv <= 0) {
    write_big_endian_varint(io, 1-global_minv);
  } else {
    write_big_endian_varint(io, 0);
    write_big_endian_varint(io, global_minv);
  }
  write_big_endian_varint(io, global_maxv-global_minv);


  int firstrealc = beginc;
  for (int i=beginc; i<=endc; i++) {
    const Channel &channel = image.channel[i];
    if (channel.w * channel.h <= 0) continue; // zero pixel channel? could happen

    pixel_type minv = channel.minval;
    pixel_type maxv = channel.maxval;

    if (endc > beginc && global_minv < global_maxv) {
      write_big_endian_varint(io, minv-global_minv);
      write_big_endian_varint(io, maxv-minv);
    }
    if (minv == maxv) { firstrealc++; }

    if (!check_bit_depth(minv,maxv,predictor)) return false;

    if (minv == 0 && maxv == 0) continue; // don't need quantization factor if it's all zeroes anyway

    write_big_endian_varint(io, channel.q);

    if (!learn) v_printf(6,"Encoding %ix%i channel %i with range %i..%i (predictor %i, quantization %i), (shift=%i,%i, cshift=%i,%i)\n", channel.w, channel.h, i, minv, maxv, predictor, channel.q, channel.hshift, channel.vshift, channel.hcshift, channel.vcshift);
    else  v_printf(7,"Learning %ix%i channel %i with range %i..%i (predictor %i)\n", channel.w, channel.h, i, minv, maxv, predictor);

    channel.setzero();
  }

  header_pos = io.ftell();

  if (firstrealc > endc) return true; // all trivial


  Ranges propRanges;
  init_properties(propRanges, image, beginc, endc, options);

  int predictability = 2048; // 50%
  {
    const Channel &channel = image.channel[firstrealc];
    if (predictor == 0 && compress) {
        uint64_t zeroes = 0;
        uint64_t pixels = channel.h*channel.w;
        for (int y=0; y<channel.h; y++)
          for (int x=0; x<channel.w; x++)
            if ( channel.value(y,x) == 0) zeroes++;
        int rounded = zeroes * 128 / pixels;
        if (rounded < 1) rounded = 1;
        if (rounded > 127) rounded = 127;
        write_big_endian_varint(io, rounded);
        predictability = rounded * 32;
        v_printf(5,"Found %i zeroes in %i pixels (zero chance=%i/4096)\n",zeroes,pixels,predictability);
    }
  }

  Rac rac(io);

  if (!compress) {
    UniformSymbolCoder<Rac> coder(rac);
    for (int i=beginc; i<=endc; i++) {
        const Channel &channel = image.channel[i];
        for (int y=0; y<channel.h; y++) {
            for (int x=0; x<channel.w; x++) {
                coder.write_int(channel.minval,channel.maxval,channel.value(y,x)); // TODO: use predictor? (only makes sense if the predictor residues have a smaller range)
                if (!learn && options.debug)
                    options.heatmap.channel[i].value(y,x) = (x);
            }
        }
    }
  } else {
    if (!learn) {
        // encode tree here
        MetaPropertySymbolCoder<FUIFBitChanceTree, Rac> metacoder(rac, propRanges);
        metacoder.write_tree(tree);
    }
    Coder coder(rac, propRanges, tree, predictability, CONTEXT_TREE_SPLIT_THRESHOLD, options.maniac_cutoff, options.maniac_alpha);
    Properties properties(propRanges.size());


    // planar
    for (int i=beginc; i<=endc; i++) {
        const Channel &channel = image.channel[i];
        pixel_type minv = channel.minval;
        pixel_type maxv = channel.maxval;
        if (minv==maxv) continue;
        int rowslearned=0;
        Channel references(properties.size() - NB_NONREF_PROPERTIES, channel.w, 0, 0);
        for (int y=0; y<channel.h; y++) {
            if (learn) { if (++rowslearned > options.nb_repeats*channel.h) break; }
            if (learn) y=rand()%channel.h; // try random rows, to avoid giving priority to the top of the image (because then the y property cannot be learned)
            precompute_references(channel, y, image, beginc, options, references);
            for (int x=0; x<channel.w; x++) {
                pixel_type guess;
        //        guess = predict_and_compute_properties_with_reference(properties, channel, x, y, predictor, image, beginc, options);
                guess = predict_and_compute_properties_with_precomputed_reference(properties, channel, x, y, predictor, image, beginc, options, references);
                pixel_type diff = channel.value(y,x)-guess;
                if (!learn && options.debug) {
                    int estimate = coder.estimate_int(properties, minv-guess, maxv-guess, diff);
                    options.heatmap.channel[i].value(y,x) = estimate;
                }
                coder.write_int(properties, minv-guess, maxv-guess, diff);
            }
            if (learn) { y=0; } // set to zero in case random row was channel.h-1
        }
    }
    coder.simplify();
  }

  rac.flush();
  io.flush();
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4148, %rsp           # imm = 0x4148
movl %r9d, %ebx
movl %r8d, %ebp
movq %rdx, 0x58(%rsp)
movq %rsi, %r14
movq %rdi, %r12
movl %r9d, %eax
subl %r8d, %eax
shll $0x4, %eax
movq %rcx, 0x68(%rsp)
leal (%rax,%rcx,2), %eax
incl %eax
movslq %eax, %rsi
movl $0x1, %edx
callq 0x12307
cmpl %ebp, %ebx
movq %rbx, 0x10(%rsp)
jle 0x131e3
leaq 0x138cd(%rip), %rsi     # 0x26a93
leaq 0x147ba(%rip), %rdx     # 0x27987
movl $0x5, %edi
movl %ebp, %ecx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x1d0d6
movq 0x10(%rsp), %rbx
movq 0x4180(%rsp), %r15
movl %ebx, %eax
movslq %ebp, %r13
movl %ebp, 0xc(%rsp)
subl %ebp, %eax
jge 0x13202
movw $0x7fff, %dx            # imm = 0x7FFF
movw $0x8001, %bp            # imm = 0x8001
jmp 0x13246
movq (%r15), %rcx
movq %r13, %rdx
shlq $0x6, %rdx
addq %rdx, %rcx
addq $0x22, %rcx
incl %eax
movw $0x8001, %bp            # imm = 0x8001
movw $0x7fff, %dx            # imm = 0x7FFF
movl -0x6(%rcx), %esi
imull -0xa(%rcx), %esi
testl %esi, %esi
jle 0x1323e
movl -0x2(%rcx), %esi
movzwl (%rcx), %edi
cmpw %dx, %si
cmovgel %edx, %esi
cmpw %bp, %di
cmovlel %ebp, %edi
movl %edi, %ebp
movl %esi, %edx
addq $0x40, %rcx
decl %eax
jne 0x1321d
movswl %dx, %ebx
testw %bx, %bx
jle 0x1325d
movq %r12, %rdi
xorl %esi, %esi
callq 0x14634
movslq %ebx, %rsi
jmp 0x13264
movl $0x1, %esi
subl %ebx, %esi
movq %r14, 0xc0(%rsp)
movq %r12, %rdi
movl $0x1, %edx
callq 0x12307
movswl %bp, %eax
subl %ebx, %eax
movslq %eax, %rsi
movq %r12, 0x60(%rsp)
movq %r12, %rdi
movl $0x1, %edx
callq 0x12307
movq 0x10(%rsp), %rcx
movl 0xc(%rsp), %edx
cmpl %edx, %ecx
setl 0xa(%rsp)
jge 0x133a9
movl %edx, 0x28(%rsp)
movb 0xa(%rsp), %bpl
testb $0x1, %bpl
movq 0x60(%rsp), %r12
je 0x13ae7
movq 0x4188(%rsp), %rax
movslq 0x18(%r12), %rcx
movq %rcx, (%rax)
movl 0x28(%rsp), %eax
cmpl 0x10(%rsp), %eax
jg 0x13ae7
xorps %xmm0, %xmm0
leaq 0xa0(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq %r15, %rsi
movl 0xc(%rsp), %ebx
movl %ebx, %edx
movq 0x10(%rsp), %rcx
movq 0x58(%rsp), %r8
callq 0x107aa
movw $0x800, %r13w           # imm = 0x800
cmpl $0x0, 0x68(%rsp)
movq 0xc0(%rsp), %r14
jne 0x135f7
movslq 0x28(%rsp), %rax
shlq $0x6, %rax
addq (%r15), %rax
movslq 0x1c(%rax), %rcx
movl 0x18(%rax), %edx
movl %edx, %esi
imull %ecx, %esi
movslq %esi, %rbx
testq %rcx, %rcx
jle 0x13587
leaq 0x24(%rax), %rsi
leaq (%rdx,%rdx), %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %r10d, %r10d
xorl %r15d, %r15d
testl %edx, %edx
jle 0x13396
movq (%rax), %r11
movq 0x8(%rax), %r14
subq %r11, %r14
sarq %r14
addq %r9, %r11
movq %rdx, %r12
movq %r8, %r13
cmpq %r13, %r14
movq %rsi, %rbp
cmovaq %r11, %rbp
cmpw $0x1, (%rbp)
adcq $0x0, %r15
addq $0x2, %r11
incq %r13
decq %r12
jne 0x13377
incq %r10
addq %rdi, %r9
addq %rdx, %r8
cmpq %rcx, %r10
jne 0x1335d
jmp 0x1358a
setg %al
movl %ebx, 0x84(%rsp)
cmpw %bp, %bx
setl %sil
andb %al, %sil
movb %sil, 0xb(%rsp)
movslq %ecx, %rax
movq %rax, 0x70(%rsp)
leal 0x1(%rcx), %eax
movl %eax, 0x78(%rsp)
movq %r13, %r12
shlq $0x6, %r12
orq $0x18, %r12
movl %edx, %ebp
movl %edx, 0x28(%rsp)
movq (%r15), %r14
movl 0x4(%r14,%r12), %eax
imull (%r14,%r12), %eax
movl $0x7, %ebx
testl %eax, %eax
jle 0x1352b
movq %r13, 0x18(%rsp)
movswl 0x8(%r14,%r12), %r13d
movswl 0xa(%r14,%r12), %r15d
cmpb $0x0, 0xb(%rsp)
je 0x13455
movl %r13d, %eax
subl 0x84(%rsp), %eax
movslq %eax, %rsi
movq %r15, 0x30(%rsp)
movq 0x60(%rsp), %r15
movq %r15, %rdi
movl $0x1, %edx
callq 0x12307
movq 0x30(%rsp), %rax
subl %r13d, %eax
movslq %eax, %rsi
movq %r15, %rdi
movq 0x30(%rsp), %r15
movl $0x1, %edx
callq 0x12307
xorl %eax, %eax
cmpw %r15w, %r13w
sete %al
addl %eax, 0x28(%rsp)
movl %r13d, %edi
movl %r15d, %esi
movq 0x68(%rsp), %rdx
callq 0x112f8
testb %al, %al
je 0x13519
movl %r15d, %eax
orw %r13w, %ax
je 0x1351e
movslq 0x10(%r14,%r12), %rsi
movq 0x60(%rsp), %rdi
movl $0x1, %edx
callq 0x12307
movl (%r14,%r12), %edx
movl 0x4(%r14,%r12), %ecx
movl 0x10(%r14,%r12), %eax
movq %rax, 0x30(%rsp)
movl 0x14(%r14,%r12), %eax
movq %rax, 0x108(%rsp)
movl 0x18(%r14,%r12), %ebx
movl 0x1c(%r14,%r12), %r10d
movl 0x20(%r14,%r12), %r11d
subq $0x8, %rsp
movl $0x6, %edi
leaq 0x135e2(%rip), %rsi     # 0x26abc
movl %ebp, %r8d
movl %r13d, %r9d
xorl %eax, %eax
pushq %r11
pushq %r10
pushq %rbx
pushq 0x128(%rsp)
pushq 0x58(%rsp)
pushq 0x98(%rsp)
pushq %r15
callq 0x1d0d6
addq $0x40, %rsp
movzwl 0x8(%r14,%r12), %eax
testw %ax, %ax
jle 0x1355b
movw %ax, 0xc(%r14,%r12)
xorl %ebx, %ebx
jmp 0x1351e
movl $0x1, %ebx
movq 0x4180(%rsp), %r15
movq 0x18(%rsp), %r13
cmpl $0x7, %ebx
je 0x13538
testl %ebx, %ebx
jne 0x132ad
cmpq 0x70(%rsp), %r13
leaq 0x1(%r13), %r13
setge 0xa(%rsp)
incl %ebp
addq $0x40, %r12
cmpl %ebp, 0x78(%rsp)
jne 0x133e2
jmp 0x132ad
movzwl 0xa(%r14,%r12), %eax
testw %ax, %ax
movq 0x4180(%rsp), %r15
movq 0x18(%rsp), %r13
js 0x1357d
movw $0x0, 0xc(%r14,%r12)
jmp 0x13583
movw %ax, 0xc(%r14,%r12)
xorl %ebx, %ebx
jmp 0x1352b
xorl %r15d, %r15d
movq %r15, %rax
shlq $0x7, %rax
xorl %edx, %edx
divq %rbx
cmpl $0x2, %eax
movl $0x1, %ecx
cmovll %ecx, %eax
cmpl $0x7f, %eax
movl $0x7f, %r13d
cmovll %eax, %r13d
movq 0x60(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
movl $0x1, %edx
callq 0x12307
shll $0x5, %r13d
leaq 0x13558(%rip), %rsi     # 0x26b26
movl $0x5, %edi
movq %r15, %rdx
movq %rbx, %rcx
movl %r13d, %r8d
xorl %eax, %eax
callq 0x1d0d6
movl 0xc(%rsp), %ebx
movq 0x4180(%rsp), %r15
movq 0xc0(%rsp), %r14
leaq 0x38(%rsp), %rsi
movq %r12, (%rsi)
movq $0x1000000, 0x8(%rsi)   # imm = 0x1000000
movq $0x0, 0x10(%rsi)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0x18(%rsi)
leaq 0x110(%rsp), %rdi
leaq 0xa0(%rsp), %rdx
movl $0x2, %ecx
movl $0xd79435e, %r8d        # imm = 0xD79435E
callq 0x1b56c
leaq 0x110(%rsp), %rdi
movq %r14, %rsi
callq 0x1b66a
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0x13665
movq 0x138(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
movq 0x110(%rsp), %rdi
testq %rdi, %rdi
je 0x13682
movq 0x120(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
movq 0x58(%rsp), %rcx
movl 0x14(%rcx), %eax
movl 0x18(%rcx), %r10d
movzwl %r13w, %r8d
leaq 0x110(%rsp), %rdi
leaq 0x38(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
movq %r14, %rcx
movl $0x15550, %r9d          # imm = 0x15550
pushq %r10
pushq %rax
callq 0x1b70e
addq $0x10, %rsp
movq 0xa8(%rsp), %rsi
subq 0xa0(%rsp), %rsi
sarq $0x3, %rsi
leaq 0x88(%rsp), %rdi
leaq 0xc8(%rsp), %rdx
callq 0x18c64
movq 0x10(%rsp), %rax
cmpl %ebx, %eax
jl 0x13999
movslq 0xc(%rsp), %rcx
incl %eax
movq %rax, 0x10(%rsp)
movq (%r15), %rbp
movq %rcx, %rdx
shlq $0x6, %rdx
movswl 0x20(%rbp,%rdx), %esi
movswl 0x22(%rbp,%rdx), %edi
movl %esi, 0x18(%rsp)
movl %edi, 0x70(%rsp)
cmpw %di, %si
je 0x1398e
movq %rcx, 0x28(%rsp)
movq 0x90(%rsp), %rbx
subq 0x88(%rsp), %rbx
movq %rdx, 0x30(%rsp)
addq %rdx, %rbp
shrq $0x2, %rbx
addl $-0xd, %ebx
movl 0x18(%rbp), %r14d
movl %ebx, %eax
imull %r14d, %eax
movslq %eax, %rsi
movw $0x0, 0x24(%rsp)
leaq 0xc8(%rsp), %rdi
leaq 0x24(%rsp), %rdx
leaq 0x27(%rsp), %rcx
callq 0xe312
movl %ebx, 0xe0(%rsp)
movl %r14d, 0xe4(%rsp)
movl $0x0, 0xe8(%rsp)
movl $0x1, 0xf0(%rsp)
leaq 0xf4(%rsp), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movl $0xffffffff, 0x104(%rsp) # imm = 0xFFFFFFFF
movw $0x0, 0xec(%rsp)
cmpl $0x0, 0x1c(%rbp)
leaq 0x88(%rsp), %rbx
jle 0x13967
leaq 0x24(%rbp), %rax
movq %rax, 0x78(%rsp)
xorl %r14d, %r14d
movq %rbp, %rdi
movl %r14d, %esi
movq %r15, %rdx
movl 0xc(%rsp), %ecx
movq 0x58(%rsp), %r8
leaq 0xc8(%rsp), %r9
callq 0x10c8d
cmpl $0x0, 0x18(%rbp)
jle 0x13952
xorl %r15d, %r15d
movl 0xe0(%rsp), %esi
movl $0x0, %r9d
testl %esi, %esi
jle 0x13867
movq 0xc8(%rsp), %rax
movq 0x88(%rsp), %rcx
movslq %r15d, %rdx
xorl %r9d, %r9d
imull %r15d, %esi
movslq %esi, %rsi
addq %r9, %rsi
movswl (%rax,%rsi,2), %esi
movl %esi, (%rcx,%r9,4)
movslq 0xe0(%rsp), %rsi
imulq %rdx, %rsi
addq %r9, %rsi
movswl 0x2(%rax,%rsi,2), %esi
movl %esi, 0x4(%rcx,%r9,4)
addq $0x2, %r9
movslq 0xe0(%rsp), %rsi
cmpq %rsi, %r9
jl 0x1382b
movq %rbx, %rdi
movq %rbp, %rsi
movl %r15d, %edx
movl %r14d, %ecx
movq 0x68(%rsp), %r8
callq 0x5122
movl 0x18(%rbp), %ecx
imull %r14d, %ecx
addl %r15d, %ecx
movslq %ecx, %rcx
movq (%rbp), %rdx
movq 0x8(%rbp), %rsi
subq %rdx, %rsi
sarq %rsi
cmpq %rcx, %rsi
leaq (%rdx,%rcx,2), %rcx
cmovbeq 0x78(%rsp), %rcx
movzwl (%rcx), %ecx
subl %eax, %ecx
movswl %ax, %r13d
movq 0x58(%rsp), %rax
cmpb $0x1, 0x24(%rax)
movswl %cx, %r12d
jne 0x13924
movl 0x18(%rsp), %edx
subl %r13d, %edx
movl 0x70(%rsp), %ecx
subl %r13d, %ecx
leaq 0x110(%rsp), %rdi
movq %rbx, %rsi
movl %r12d, %r8d
callq 0x1b7e4
movq 0x58(%rsp), %rcx
movq 0x40(%rcx), %rcx
movq 0x30(%rsp), %rdx
addq %rdx, %rcx
addq $0x24, %rcx
movl -0xc(%rcx), %edx
imull %r14d, %edx
addl %r15d, %edx
movslq %edx, %rdx
movq -0x24(%rcx), %rsi
movq -0x1c(%rcx), %rdi
subq %rsi, %rdi
sarq %rdi
cmpq %rdx, %rdi
leaq (%rsi,%rdx,2), %rdx
cmovbeq %rcx, %rdx
movw %ax, (%rdx)
leaq 0x88(%rsp), %rbx
movl 0x18(%rsp), %edx
subl %r13d, %edx
movl 0x70(%rsp), %ecx
subl %r13d, %ecx
leaq 0x110(%rsp), %rdi
movq %rbx, %rsi
movl %r12d, %r8d
callq 0x1b87c
incl %r15d
cmpl 0x18(%rbp), %r15d
jl 0x13804
incl %r14d
cmpl 0x1c(%rbp), %r14d
movq 0x4180(%rsp), %r15
jl 0x137d8
movq 0xc8(%rsp), %rdi
testq %rdi, %rdi
je 0x13984
movq 0xd8(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
movq 0x10(%rsp), %rax
movq 0x28(%rsp), %rcx
incq %rcx
cmpl %ecx, %eax
jne 0x136fe
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x139b6
movq 0x98(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
movq 0x4128(%rsp), %rdi
testq %rdi, %rdi
movb 0xa(%rsp), %bpl
je 0x139d8
movq 0x4138(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
movl $0xffff, %eax           # imm = 0xFFFF
addq %rax, 0x48(%rsp)
movq %rax, 0x40(%rsp)
movq 0x48(%rsp), %rcx
movq %rcx, %rbx
shrq $0x10, %rbx
movl 0x50(%rsp), %esi
testl %esi, %esi
js 0x13a2c
addq %rcx, %rax
cmpq $0xffffff, %rax         # imm = 0xFFFFFF
ja 0x13a57
movq 0x38(%rsp), %rdi
callq 0x14634
cmpl $0x0, 0x54(%rsp)
je 0x13a2c
movq 0x38(%rsp), %rdi
movl $0xff, %esi
callq 0x14634
decl 0x54(%rsp)
jne 0x13a17
movl %ebx, 0x50(%rsp)
movl 0x48(%rsp), %eax
movzwl %ax, %eax
shll $0x8, %eax
movq %rax, 0x48(%rsp)
movq 0x40(%rsp), %rax
shlq $0x8, %rax
movq %rax, 0x40(%rsp)
cmpq $0x10001, %rax          # imm = 0x10001
jb 0x139e7
jmp 0x13a94
cmpq $0x1000000, %rcx        # imm = 0x1000000
jb 0x13a8e
movq 0x38(%rsp), %rdi
incl %esi
callq 0x14634
cmpl $0x0, 0x54(%rsp)
je 0x13a85
movq 0x38(%rsp), %rdi
xorl %esi, %esi
callq 0x14634
decl 0x54(%rsp)
jne 0x13a73
movzbl %bl, %eax
movl %eax, 0x50(%rsp)
jmp 0x13a30
incl 0x54(%rsp)
jmp 0x13a30
leaq 0x38(%rsp), %rdi
movq $0xffff, 0x8(%rdi)      # imm = 0xFFFF
callq 0x18a0c
leaq 0x38(%rsp), %rdi
movq $0xffff, 0x8(%rdi)      # imm = 0xFFFF
callq 0x18a0c
leaq 0x38(%rsp), %rdi
movq $0xffff, 0x8(%rdi)      # imm = 0xFFFF
callq 0x18a0c
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x13ae7
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
andb $0x1, %bpl
movl %ebp, %eax
addq $0x4148, %rsp           # imm = 0x4148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x13b29
movq %rax, %rbx
jmp 0x13b6d
jmp 0x13b29
movq %rax, %rbx
leaq 0x110(%rsp), %rdi
callq 0x1b6de
jmp 0x13b8a
jmp 0x13b29
jmp 0x13b29
jmp 0x13b29
movq %rax, %rbx
jmp 0x13b50
jmp 0x13b29
jmp 0x13b29
movq %rax, %rbx
jmp 0x13b8a
jmp 0x13b30
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
testq %rdi, %rdi
je 0x13b50
movq 0xd8(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x13b6d
movq 0x98(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
movq 0x4128(%rsp), %rdi
testq %rdi, %rdi
je 0x13b8a
movq 0x4138(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x13ba7
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x32c0
movq %rbx, %rdi
callq 0x35a0
nop