// File: /workspace/github_c_makefile_star2_O1/imaya[P]zopfli-for-emscripten/hash.c
// Function: ZopfliInitHash
void ZopfliInitHash(size_t window_size, ZopfliHash* h) {
  size_t i;

  h->val = 0;
  h->head = (int*)malloc(sizeof(*h->head) * 65536);
  h->prev = (unsigned short*)malloc(sizeof(*h->prev) * window_size);
  h->hashval = (int*)malloc(sizeof(*h->hashval) * window_size);
  for (i = 0; i < 65536; i++) {
    h->head[i] = -1;  /* -1 indicates no head so far. */
  }
  for (i = 0; i < window_size; i++) {
    h->prev[i] = i;  /* If prev[j] == j, then prev[j] is uninitialized. */
    h->hashval[i] = -1;
  }

#ifdef ZOPFLI_HASH_SAME
  h->same = (unsigned short*)malloc(sizeof(*h->same) * window_size);
  for (i = 0; i < window_size; i++) {
    h->same[i] = 0;
  }
#endif

#ifdef ZOPFLI_HASH_SAME_HASH
  h->val2 = 0;
  h->head2 = (int*)malloc(sizeof(*h->head2) * 65536);
  h->prev2 = (unsigned short*)malloc(sizeof(*h->prev2) * window_size);
  h->hashval2 = (int*)malloc(sizeof(*h->hashval2) * window_size);
  for (i = 0; i < 65536; i++) {
    h->head2[i] = -1;
  }
  for (i = 0; i < window_size; i++) {
    h->prev2[i] = i;
    h->hashval2[i] = -1;
  }
#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
movl $0x0, 0x18(%rsi)
movl $0x40000, %edi          # imm = 0x40000
callq 0x1120
movq %rax, %r14
movq %rax, (%r15)
leaq (%rbx,%rbx), %r12
movq %r12, %rdi
callq 0x1120
movq %rax, %r13
movq %rax, 0x8(%r15)
leaq (,%rbx,4), %rdi
movq %rdi, (%rsp)
callq 0x1120
movq %rax, %rbp
movq %rax, 0x10(%r15)
movl $0x40000, %edx          # imm = 0x40000
movq %r14, %rdi
movl $0xff, %esi
callq 0x10c0
testq %rbx, %rbx
je 0x4760
movq %rbp, %rdi
movl $0xff, %esi
movq (%rsp), %rdx
callq 0x10c0
leaq 0x7(%rbx), %rax
andq $-0x8, %rax
leaq -0x1(%rbx), %rcx
movq %rcx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqa 0x5d2f(%rip), %xmm1     # 0xa1f0
movdqa 0x5d37(%rip), %xmm2     # 0xa200
movdqa 0x5d3f(%rip), %xmm3     # 0xa210
movdqa 0x5d47(%rip), %xmm4     # 0xa220
xorl %ecx, %ecx
movdqa 0x5d4d(%rip), %xmm5     # 0xa230
pxor %xmm5, %xmm0
pcmpeqd %xmm6, %xmm6
movdqa 0x5d4d(%rip), %xmm7     # 0xa240
movdqa %xmm4, %xmm8
pxor %xmm5, %xmm8
movdqa %xmm8, %xmm10
pcmpgtd %xmm0, %xmm10
pshufd $0xa0, %xmm10, %xmm9    # xmm9 = xmm10[0,0,2,2]
pshuflw $0xe8, %xmm9, %xmm11    # xmm11 = xmm9[0,2,2,3,4,5,6,7]
pcmpeqd %xmm0, %xmm8
pshufd $0xf5, %xmm8, %xmm8     # xmm8 = xmm8[1,1,3,3]
pshuflw $0xe8, %xmm8, %xmm12    # xmm12 = xmm8[0,2,2,3,4,5,6,7]
pand %xmm11, %xmm12
pshufd $0xf5, %xmm10, %xmm10   # xmm10 = xmm10[1,1,3,3]
pshuflw $0xe8, %xmm10, %xmm11   # xmm11 = xmm10[0,2,2,3,4,5,6,7]
por %xmm12, %xmm11
pxor %xmm6, %xmm11
packssdw %xmm11, %xmm11
movd %xmm11, %edx
testb $0x1, %dl
je 0x4554
movw %cx, (%r13,%rcx,2)
pand %xmm9, %xmm8
por %xmm10, %xmm8
packssdw %xmm8, %xmm8
pxor %xmm6, %xmm8
packssdw %xmm8, %xmm8
movd %xmm8, %edx
shrl $0x10, %edx
testb $0x1, %dl
je 0x4583
leal 0x1(%rcx), %edx
movw %dx, 0x2(%r13,%rcx,2)
movdqa %xmm3, %xmm9
pxor %xmm5, %xmm9
movdqa %xmm9, %xmm10
pcmpgtd %xmm0, %xmm10
pshufd $0xa0, %xmm10, %xmm8    # xmm8 = xmm10[0,0,2,2]
pcmpeqd %xmm0, %xmm9
pshufd $0xf5, %xmm9, %xmm9     # xmm9 = xmm9[1,1,3,3]
movdqa %xmm9, %xmm11
pand %xmm8, %xmm11
pshufd $0xf5, %xmm10, %xmm10   # xmm10 = xmm10[1,1,3,3]
por %xmm10, %xmm11
packssdw %xmm11, %xmm11
pxor %xmm6, %xmm11
packssdw %xmm11, %xmm11
pextrw $0x2, %xmm11, %edx
testb $0x1, %dl
je 0x45e0
leal 0x2(%rcx), %edx
movw %dx, 0x4(%r13,%rcx,2)
pshufhw $0x84, %xmm8, %xmm8     # xmm8 = xmm8[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm9, %xmm9     # xmm9 = xmm9[0,1,2,3,4,5,4,6]
pand %xmm8, %xmm9
pshufhw $0x84, %xmm10, %xmm8    # xmm8 = xmm10[0,1,2,3,4,5,4,6]
por %xmm9, %xmm8
pxor %xmm6, %xmm8
packssdw %xmm8, %xmm8
pextrw $0x3, %xmm8, %edx
testb $0x1, %dl
je 0x461a
leal 0x3(%rcx), %edx
movw %dx, 0x6(%r13,%rcx,2)
movdqa %xmm2, %xmm8
pxor %xmm5, %xmm8
movdqa %xmm8, %xmm10
pcmpgtd %xmm0, %xmm10
pshufd $0xa0, %xmm10, %xmm9    # xmm9 = xmm10[0,0,2,2]
pshuflw $0xe8, %xmm9, %xmm11    # xmm11 = xmm9[0,2,2,3,4,5,6,7]
pcmpeqd %xmm0, %xmm8
pshufd $0xf5, %xmm8, %xmm8     # xmm8 = xmm8[1,1,3,3]
pshuflw $0xe8, %xmm8, %xmm12    # xmm12 = xmm8[0,2,2,3,4,5,6,7]
pand %xmm11, %xmm12
pshufd $0xf5, %xmm10, %xmm10   # xmm10 = xmm10[1,1,3,3]
pshuflw $0xe8, %xmm10, %xmm11   # xmm11 = xmm10[0,2,2,3,4,5,6,7]
por %xmm12, %xmm11
pxor %xmm6, %xmm11
packssdw %xmm11, %xmm11
pextrw $0x4, %xmm11, %edx
testb $0x1, %dl
je 0x467f
leal 0x4(%rcx), %edx
movw %dx, 0x8(%r13,%rcx,2)
pand %xmm9, %xmm8
por %xmm10, %xmm8
packssdw %xmm8, %xmm8
pxor %xmm6, %xmm8
packssdw %xmm8, %xmm8
pextrw $0x5, %xmm8, %edx
testb $0x1, %dl
je 0x46ac
leal 0x5(%rcx), %edx
movw %dx, 0xa(%r13,%rcx,2)
movdqa %xmm1, %xmm9
pxor %xmm5, %xmm9
movdqa %xmm9, %xmm10
pcmpgtd %xmm0, %xmm10
pshufd $0xa0, %xmm10, %xmm8    # xmm8 = xmm10[0,0,2,2]
pcmpeqd %xmm0, %xmm9
pshufd $0xf5, %xmm9, %xmm9     # xmm9 = xmm9[1,1,3,3]
movdqa %xmm9, %xmm11
pand %xmm8, %xmm11
pshufd $0xf5, %xmm10, %xmm10   # xmm10 = xmm10[1,1,3,3]
por %xmm10, %xmm11
packssdw %xmm11, %xmm11
pxor %xmm6, %xmm11
packssdw %xmm11, %xmm11
pextrw $0x6, %xmm11, %edx
testb $0x1, %dl
je 0x4709
leal 0x6(%rcx), %edx
movw %dx, 0xc(%r13,%rcx,2)
pshufhw $0x84, %xmm8, %xmm8     # xmm8 = xmm8[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm9, %xmm9     # xmm9 = xmm9[0,1,2,3,4,5,4,6]
pand %xmm8, %xmm9
pshufhw $0x84, %xmm10, %xmm8    # xmm8 = xmm10[0,1,2,3,4,5,4,6]
por %xmm9, %xmm8
pxor %xmm6, %xmm8
packssdw %xmm8, %xmm8
pextrw $0x7, %xmm8, %edx
testb $0x1, %dl
je 0x4743
leal 0x7(%rcx), %edx
movw %dx, 0xe(%r13,%rcx,2)
addq $0x8, %rcx
paddq %xmm7, %xmm4
paddq %xmm7, %xmm3
paddq %xmm7, %xmm2
paddq %xmm7, %xmm1
cmpq %rcx, %rax
jne 0x44f3
movq %r12, %rdi
callq 0x1120
movq %rax, 0x40(%r15)
testq %rbx, %rbx
je 0x477e
movq %rax, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x10c0
movl $0x0, 0x38(%r15)
movl $0x40000, %edi          # imm = 0x40000
callq 0x1120
movq %rax, %r14
movq %rax, 0x20(%r15)
movq %r12, %rdi
callq 0x1120
movq %rax, %r12
movq %rax, 0x28(%r15)
movq (%rsp), %rbp
movq %rbp, %rdi
callq 0x1120
movq %rax, %r13
movq %rax, 0x30(%r15)
movl $0x40000, %edx          # imm = 0x40000
movq %r14, %rdi
movl $0xff, %esi
callq 0x10c0
testq %rbx, %rbx
je 0x4a9f
movq %r13, %rdi
movl $0xff, %esi
movq %rbp, %rdx
callq 0x10c0
leaq 0x7(%rbx), %rax
andq $-0x8, %rax
decq %rbx
movq %rbx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqa 0x59ef(%rip), %xmm1     # 0xa1f0
movdqa 0x59f7(%rip), %xmm2     # 0xa200
movdqa 0x59ff(%rip), %xmm3     # 0xa210
movdqa 0x5a07(%rip), %xmm4     # 0xa220
xorl %ecx, %ecx
movdqa 0x5a0d(%rip), %xmm5     # 0xa230
pxor %xmm5, %xmm0
pcmpeqd %xmm6, %xmm6
movdqa 0x5a0d(%rip), %xmm7     # 0xa240
movdqa %xmm4, %xmm8
pxor %xmm5, %xmm8
movdqa %xmm8, %xmm10
pcmpgtd %xmm0, %xmm10
pshufd $0xa0, %xmm10, %xmm9    # xmm9 = xmm10[0,0,2,2]
pshuflw $0xe8, %xmm9, %xmm11    # xmm11 = xmm9[0,2,2,3,4,5,6,7]
pcmpeqd %xmm0, %xmm8
pshufd $0xf5, %xmm8, %xmm8     # xmm8 = xmm8[1,1,3,3]
pshuflw $0xe8, %xmm8, %xmm12    # xmm12 = xmm8[0,2,2,3,4,5,6,7]
pand %xmm11, %xmm12
pshufd $0xf5, %xmm10, %xmm10   # xmm10 = xmm10[1,1,3,3]
pshuflw $0xe8, %xmm10, %xmm11   # xmm11 = xmm10[0,2,2,3,4,5,6,7]
por %xmm12, %xmm11
pxor %xmm6, %xmm11
packssdw %xmm11, %xmm11
movd %xmm11, %edx
testb $0x1, %dl
je 0x4893
movw %cx, (%r12,%rcx,2)
pand %xmm9, %xmm8
por %xmm10, %xmm8
packssdw %xmm8, %xmm8
pxor %xmm6, %xmm8
packssdw %xmm8, %xmm8
movd %xmm8, %edx
shrl $0x10, %edx
testb $0x1, %dl
je 0x48c2
leal 0x1(%rcx), %edx
movw %dx, 0x2(%r12,%rcx,2)
movdqa %xmm3, %xmm9
pxor %xmm5, %xmm9
movdqa %xmm9, %xmm10
pcmpgtd %xmm0, %xmm10
pshufd $0xa0, %xmm10, %xmm8    # xmm8 = xmm10[0,0,2,2]
pcmpeqd %xmm0, %xmm9
pshufd $0xf5, %xmm9, %xmm9     # xmm9 = xmm9[1,1,3,3]
movdqa %xmm9, %xmm11
pand %xmm8, %xmm11
pshufd $0xf5, %xmm10, %xmm10   # xmm10 = xmm10[1,1,3,3]
por %xmm10, %xmm11
packssdw %xmm11, %xmm11
pxor %xmm6, %xmm11
packssdw %xmm11, %xmm11
pextrw $0x2, %xmm11, %edx
testb $0x1, %dl
je 0x491f
leal 0x2(%rcx), %edx
movw %dx, 0x4(%r12,%rcx,2)
pshufhw $0x84, %xmm8, %xmm8     # xmm8 = xmm8[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm9, %xmm9     # xmm9 = xmm9[0,1,2,3,4,5,4,6]
pand %xmm8, %xmm9
pshufhw $0x84, %xmm10, %xmm8    # xmm8 = xmm10[0,1,2,3,4,5,4,6]
por %xmm9, %xmm8
pxor %xmm6, %xmm8
packssdw %xmm8, %xmm8
pextrw $0x3, %xmm8, %edx
testb $0x1, %dl
je 0x4959
leal 0x3(%rcx), %edx
movw %dx, 0x6(%r12,%rcx,2)
movdqa %xmm2, %xmm8
pxor %xmm5, %xmm8
movdqa %xmm8, %xmm10
pcmpgtd %xmm0, %xmm10
pshufd $0xa0, %xmm10, %xmm9    # xmm9 = xmm10[0,0,2,2]
pshuflw $0xe8, %xmm9, %xmm11    # xmm11 = xmm9[0,2,2,3,4,5,6,7]
pcmpeqd %xmm0, %xmm8
pshufd $0xf5, %xmm8, %xmm8     # xmm8 = xmm8[1,1,3,3]
pshuflw $0xe8, %xmm8, %xmm12    # xmm12 = xmm8[0,2,2,3,4,5,6,7]
pand %xmm11, %xmm12
pshufd $0xf5, %xmm10, %xmm10   # xmm10 = xmm10[1,1,3,3]
pshuflw $0xe8, %xmm10, %xmm11   # xmm11 = xmm10[0,2,2,3,4,5,6,7]
por %xmm12, %xmm11
pxor %xmm6, %xmm11
packssdw %xmm11, %xmm11
pextrw $0x4, %xmm11, %edx
testb $0x1, %dl
je 0x49be
leal 0x4(%rcx), %edx
movw %dx, 0x8(%r12,%rcx,2)
pand %xmm9, %xmm8
por %xmm10, %xmm8
packssdw %xmm8, %xmm8
pxor %xmm6, %xmm8
packssdw %xmm8, %xmm8
pextrw $0x5, %xmm8, %edx
testb $0x1, %dl
je 0x49eb
leal 0x5(%rcx), %edx
movw %dx, 0xa(%r12,%rcx,2)
movdqa %xmm1, %xmm9
pxor %xmm5, %xmm9
movdqa %xmm9, %xmm10
pcmpgtd %xmm0, %xmm10
pshufd $0xa0, %xmm10, %xmm8    # xmm8 = xmm10[0,0,2,2]
pcmpeqd %xmm0, %xmm9
pshufd $0xf5, %xmm9, %xmm9     # xmm9 = xmm9[1,1,3,3]
movdqa %xmm9, %xmm11
pand %xmm8, %xmm11
pshufd $0xf5, %xmm10, %xmm10   # xmm10 = xmm10[1,1,3,3]
por %xmm10, %xmm11
packssdw %xmm11, %xmm11
pxor %xmm6, %xmm11
packssdw %xmm11, %xmm11
pextrw $0x6, %xmm11, %edx
testb $0x1, %dl
je 0x4a48
leal 0x6(%rcx), %edx
movw %dx, 0xc(%r12,%rcx,2)
pshufhw $0x84, %xmm8, %xmm8     # xmm8 = xmm8[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm9, %xmm9     # xmm9 = xmm9[0,1,2,3,4,5,4,6]
pand %xmm8, %xmm9
pshufhw $0x84, %xmm10, %xmm8    # xmm8 = xmm10[0,1,2,3,4,5,4,6]
por %xmm9, %xmm8
pxor %xmm6, %xmm8
packssdw %xmm8, %xmm8
pextrw $0x7, %xmm8, %edx
testb $0x1, %dl
je 0x4a82
leal 0x7(%rcx), %edx
movw %dx, 0xe(%r12,%rcx,2)
addq $0x8, %rcx
paddq %xmm7, %xmm4
paddq %xmm7, %xmm3
paddq %xmm7, %xmm2
paddq %xmm7, %xmm1
cmpq %rcx, %rax
jne 0x4833
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq