// File: /workspace/github_c_makefile_star2_O3/madler[P]pigz/zopfli/src/zopfli/lz77.c
// Function: ZopfliCopyLZ77Store
void ZopfliCopyLZ77Store(
    const ZopfliLZ77Store* source, ZopfliLZ77Store* dest) {
  size_t i;
  size_t llsize = ZOPFLI_NUM_LL * CeilDiv(source->size, ZOPFLI_NUM_LL);
  size_t dsize = ZOPFLI_NUM_D * CeilDiv(source->size, ZOPFLI_NUM_D);
  ZopfliCleanLZ77Store(dest);
  ZopfliInitLZ77Store(source->data, dest);
  dest->litlens =
      (unsigned short*)malloc(sizeof(*dest->litlens) * source->size);
  dest->dists = (unsigned short*)malloc(sizeof(*dest->dists) * source->size);
  dest->pos = (size_t*)malloc(sizeof(*dest->pos) * source->size);
  dest->ll_symbol =
      (unsigned short*)malloc(sizeof(*dest->ll_symbol) * source->size);
  dest->d_symbol =
      (unsigned short*)malloc(sizeof(*dest->d_symbol) * source->size);
  dest->ll_counts = (size_t*)malloc(sizeof(*dest->ll_counts) * llsize);
  dest->d_counts = (size_t*)malloc(sizeof(*dest->d_counts) * dsize);

  /* Allocation failed. */
  if (!dest->litlens || !dest->dists) exit(-1);
  if (!dest->pos) exit(-1);
  if (!dest->ll_symbol || !dest->d_symbol) exit(-1);
  if (!dest->ll_counts || !dest->d_counts) exit(-1);

  dest->size = source->size;
  for (i = 0; i < source->size; i++) {
    dest->litlens[i] = source->litlens[i];
    dest->dists[i] = source->dists[i];
    dest->pos[i] = source->pos[i];
    dest->ll_symbol[i] = source->ll_symbol[i];
    dest->d_symbol[i] = source->d_symbol[i];
  }
  for (i = 0; i < llsize; i++) {
    dest->ll_counts[i] = source->ll_counts[i];
  }
  for (i = 0; i < dsize; i++) {
    dest->d_counts[i] = source->d_counts[i];
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
leaq 0x11f(%rdi), %rax
movabsq $-0x1c71c71c71c71c71, %rcx # imm = 0xE38E38E38E38E38F
movq %rax, 0x30(%rsp)
mulq %rcx
movq %rdx, 0x10(%rsp)
movq %rsi, %rbp
addq $0x1f, %rdi
andq $-0x20, %rdi
movq %rdi, 0x20(%rsp)
movq %rsi, %rdi
callq 0x117f5
movq 0x18(%rbx), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rbp)
movq $0x0, 0x10(%rbp)
movq %rax, 0x18(%rbp)
movups %xmm0, 0x28(%rbp)
movups %xmm0, 0x38(%rbp)
movq %rbx, 0x8(%rsp)
movq 0x10(%rbx), %rbx
leaq (%rbx,%rbx), %r14
movq %r14, %rdi
callq 0x33e0
movq %rax, %r12
movq %rax, (%rbp)
movq %r14, %rdi
callq 0x33e0
movq %rax, %r13
movq %rax, 0x8(%rbp)
movq %rbx, 0x28(%rsp)
leaq (,%rbx,8), %rdi
callq 0x33e0
movq %rax, %r15
movq %rax, 0x20(%rbp)
movq %r14, %rdi
callq 0x33e0
movq %rax, %rbx
movq %rax, 0x28(%rbp)
movq %r14, %rdi
callq 0x33e0
movq %rax, %r14
movq %rax, 0x30(%rbp)
movq $-0x100, %rax
andq 0x10(%rsp), %rax
leaq (%rax,%rax,8), %rdi
callq 0x33e0
movq %rax, 0x18(%rsp)
movq %rax, 0x38(%rbp)
movq 0x20(%rsp), %rax
leaq (,%rax,8), %rdi
callq 0x33e0
movq %rax, 0x40(%rbp)
testq %r12, %r12
je 0x11a55
testq %r13, %r13
je 0x11a55
testq %r15, %r15
je 0x11a55
testq %rbx, %rbx
je 0x11a55
testq %r14, %r14
je 0x11a55
cmpq $0x0, 0x18(%rsp)
je 0x11a55
testq %rax, %rax
je 0x11a55
movq 0x28(%rsp), %rcx
movq %rcx, 0x10(%rbp)
movq 0x8(%rsp), %rcx
movq 0x10(%rcx), %rcx
testq %rcx, %rcx
je 0x119e5
movq 0x8(%rsp), %r9
movq (%r9), %rdx
movq 0x8(%r9), %rsi
movq 0x20(%r9), %rdi
movq 0x28(%r9), %r8
movq 0x30(%r9), %r9
xorl %r10d, %r10d
movzwl (%rdx,%r10,2), %r11d
movw %r11w, (%r12,%r10,2)
movzwl (%rsi,%r10,2), %r11d
movw %r11w, (%r13,%r10,2)
movq (%rdi,%r10,8), %r11
movq %r11, (%r15,%r10,8)
movzwl (%r8,%r10,2), %r11d
movw %r11w, (%rbx,%r10,2)
movzwl (%r9,%r10,2), %r11d
movw %r11w, (%r14,%r10,2)
incq %r10
cmpq %r10, %rcx
jne 0x119ac
cmpq $0x120, 0x30(%rsp)      # imm = 0x120
movq 0x18(%rsp), %r8
jb 0x11a21
movq 0x10(%rsp), %rcx
shrq $0x3, %rcx
andq $-0x20, %rcx
leaq (%rcx,%rcx,8), %rcx
movq 0x8(%rsp), %rdx
movq 0x38(%rdx), %rdx
xorl %esi, %esi
movq (%rdx,%rsi,8), %rdi
movq %rdi, (%r8,%rsi,8)
incq %rsi
cmpq %rsi, %rcx
jne 0x11a11
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x11a46
movq 0x8(%rsp), %rcx
movq 0x40(%rcx), %rcx
xorl %edx, %edx
movq (%rcx,%rdx,8), %rsi
movq %rsi, (%rax,%rdx,8)
incq %rdx
cmpq %rdx, %rdi
jne 0x11a36
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3550