// File: /workspace/github_c_makefile_star2_O0/imaya[P]zopfli-for-emscripten/squeeze.c
// Function: FollowPath
static void FollowPath(ZopfliBlockState* s,
                       const unsigned char* in, size_t instart, size_t inend,
                       unsigned short* path, size_t pathsize,
                       ZopfliLZ77Store* store) {
  size_t i, j, pos = 0;
  size_t windowstart = instart > ZOPFLI_WINDOW_SIZE
      ? instart - ZOPFLI_WINDOW_SIZE : 0;

  size_t total_length_test = 0;

  ZopfliHash hash;
  ZopfliHash* h = &hash;

  if (instart == inend) return;

  ZopfliInitHash(ZOPFLI_WINDOW_SIZE, h);
  ZopfliWarmupHash(in, windowstart, inend, h);
  for (i = windowstart; i < instart; i++) {
    ZopfliUpdateHash(in, i, inend, h);
  }

  pos = instart;
  for (i = 0; i < pathsize; i++) {
    unsigned short length = path[i];
    unsigned short dummy_length;
    unsigned short dist;
    assert(pos < inend);

    ZopfliUpdateHash(in, pos, inend, h);

    /* Add to output. */
    if (length >= ZOPFLI_MIN_MATCH) {
      /* Get the distance by recalculating longest match. The found length
      should match the length from the path. */
      ZopfliFindLongestMatch(s, h, in, pos, inend, length, 0,
                             &dist, &dummy_length);
      assert(!(dummy_length != length && length > 2 && dummy_length > 2));
      ZopfliVerifyLenDist(in, inend, pos, dist, length);
      ZopfliStoreLitLenDist(length, dist, store);
      total_length_test += length;
    } else {
      length = 1;
      ZopfliStoreLitLenDist(in[pos], 0, store);
      total_length_test++;
    }


    assert(pos + length <= inend);
    for (j = 1; j < length; j++) {
      ZopfliUpdateHash(in, pos + j, inend, h);
    }

    pos += length;
  }

  ZopfliCleanHash(h);
}

// Assembly:
subq $0xd8, %rsp
movq 0xe0(%rsp), %rax
movq %rdi, 0xd0(%rsp)
movq %rsi, 0xc8(%rsp)
movq %rdx, 0xc0(%rsp)
movq %rcx, 0xb8(%rsp)
movq %r8, 0xb0(%rsp)
movq %r9, 0xa8(%rsp)
movq $0x0, 0x90(%rsp)
cmpq $0x8000, 0xc0(%rsp) # imm = 0x8000
jbe 0xa91e
movq 0xc0(%rsp), %rax
subq $0x8000, %rax           # imm = 0x8000
movq %rax, 0x20(%rsp)
jmp 0xa927
xorl %eax, %eax
movq %rax, 0x20(%rsp)
jmp 0xa927
movq 0x20(%rsp), %rax
movq %rax, 0x88(%rsp)
movq $0x0, 0x80(%rsp)
leaq 0x38(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0xc0(%rsp), %rax
cmpq 0xb8(%rsp), %rax
jne 0xa961
jmp 0xac9e
movq 0x30(%rsp), %rsi
movl $0x8000, %edi           # imm = 0x8000
callq 0x6a10
movq 0xc8(%rsp), %rdi
movq 0x88(%rsp), %rsi
movq 0xb8(%rsp), %rdx
movq 0x30(%rsp), %rcx
callq 0x6fc0
movq 0x88(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0xa0(%rsp), %rax
cmpq 0xc0(%rsp), %rax
jae 0xa9ec
movq 0xc8(%rsp), %rdi
movq 0xa0(%rsp), %rsi
movq 0xb8(%rsp), %rdx
movq 0x30(%rsp), %rcx
callq 0x6c90
movq 0xa0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xa0(%rsp)
jmp 0xa9a2
movq 0xc0(%rsp), %rax
movq %rax, 0x90(%rsp)
movq $0x0, 0xa0(%rsp)
movq 0xa0(%rsp), %rax
cmpq 0xa8(%rsp), %rax
jae 0xac94
movq 0xb0(%rsp), %rax
movq 0xa0(%rsp), %rcx
movw (%rax,%rcx,2), %ax
movw %ax, 0x2e(%rsp)
movq 0x90(%rsp), %rax
cmpq 0xb8(%rsp), %rax
jae 0xaa4b
jmp 0xaa6a
leaq 0x3544(%rip), %rdi      # 0xdf96
leaq 0x3325(%rip), %rsi      # 0xdd7e
movl $0x168, %edx            # imm = 0x168
leaq 0x353d(%rip), %rcx      # 0xdfa2
callq 0x10b0
movq 0xc8(%rsp), %rdi
movq 0x90(%rsp), %rsi
movq 0xb8(%rsp), %rdx
movq 0x30(%rsp), %rcx
callq 0x6c90
movzwl 0x2e(%rsp), %eax
cmpl $0x3, %eax
jl 0xab8c
movq 0xd0(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0xc8(%rsp), %rdx
movq 0x90(%rsp), %rcx
movq 0xb8(%rsp), %r8
movzwl 0x2e(%rsp), %eax
movl %eax, %r9d
xorl %eax, %eax
leaq 0x2a(%rsp), %r10
leaq 0x2c(%rsp), %rax
movq $0x0, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x7bb0
movzwl 0x2c(%rsp), %eax
movzwl 0x2e(%rsp), %ecx
cmpl %ecx, %eax
je 0xab0c
movzwl 0x2e(%rsp), %eax
cmpl $0x2, %eax
jle 0xab0c
movzwl 0x2c(%rsp), %eax
cmpl $0x2, %eax
jg 0xab0e
jmp 0xab2d
leaq 0x3505(%rip), %rdi      # 0xe01a
leaq 0x3262(%rip), %rsi      # 0xdd7e
movl $0x172, %edx            # imm = 0x172
leaq 0x347a(%rip), %rcx      # 0xdfa2
callq 0x10b0
movq 0xc8(%rsp), %rdi
movq 0xb8(%rsp), %rsi
movq 0x90(%rsp), %rdx
movw 0x2a(%rsp), %ax
movzwl %ax, %ecx
movzwl 0x2e(%rsp), %r8d
callq 0x7aa0
movw 0x2e(%rsp), %cx
movw 0x2a(%rsp), %ax
movq 0xe0(%rsp), %rdx
movzwl %cx, %edi
movzwl %ax, %esi
callq 0x7960
movzwl 0x2e(%rsp), %eax
addq 0x80(%rsp), %rax
movq %rax, 0x80(%rsp)
jmp 0xabcd
movw $0x1, 0x2e(%rsp)
movq 0xc8(%rsp), %rax
movq 0x90(%rsp), %rcx
movzbl (%rax,%rcx), %eax
movq 0xe0(%rsp), %rdx
xorl %esi, %esi
movzwl %ax, %edi
callq 0x7960
movq 0x80(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x80(%rsp)
movq 0x90(%rsp), %rax
movzwl 0x2e(%rsp), %ecx
addq %rcx, %rax
cmpq 0xb8(%rsp), %rax
ja 0xabe9
jmp 0xac08
leaq 0x3466(%rip), %rdi      # 0xe056
leaq 0x3187(%rip), %rsi      # 0xdd7e
movl $0x17d, %edx            # imm = 0x17D
leaq 0x339f(%rip), %rcx      # 0xdfa2
callq 0x10b0
movq $0x1, 0x98(%rsp)
movq 0x98(%rsp), %rax
movzwl 0x2e(%rsp), %ecx
cmpq %rcx, %rax
jae 0xac66
movq 0xc8(%rsp), %rdi
movq 0x90(%rsp), %rsi
addq 0x98(%rsp), %rsi
movq 0xb8(%rsp), %rdx
movq 0x30(%rsp), %rcx
callq 0x6c90
movq 0x98(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x98(%rsp)
jmp 0xac14
movzwl 0x2e(%rsp), %eax
addq 0x90(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0xa0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xa0(%rsp)
jmp 0xaa08
movq 0x30(%rsp), %rdi
callq 0x6c20
addq $0xd8, %rsp
retq
nopw %cs:(%rax,%rax)