// File: /workspace/github_cpp_makefile_star2_O2/sbingner[P]kerneldec/lzfse/src/lzfse_decode_base.c
// Function: lzfse_decode
int lzfse_decode(lzfse_decoder_state *s) {
  while (1) {
    // Are we inside a block?
    switch (s->block_magic) {
    case LZFSE_NO_BLOCK_MAGIC: {
      // We need at least 4 bytes of magic number to identify next block
      if (s->src + 4 > s->src_end)
        return LZFSE_STATUS_SRC_EMPTY; // SRC truncated
      uint32_t magic = load4(s->src);

      if (magic == LZFSE_ENDOFSTREAM_BLOCK_MAGIC) {
        s->src += 4;
        s->end_of_stream = 1;
        return LZFSE_STATUS_OK; // done
      }

      if (magic == LZFSE_UNCOMPRESSED_BLOCK_MAGIC) {
        if (s->src + sizeof(uncompressed_block_header) > s->src_end)
          return LZFSE_STATUS_SRC_EMPTY; // SRC truncated
        // Setup state for uncompressed block
        uncompressed_block_decoder_state *bs = &(s->uncompressed_block_state);
        bs->n_raw_bytes =
            load4(s->src + offsetof(uncompressed_block_header, n_raw_bytes));
        s->src += sizeof(uncompressed_block_header);
        s->block_magic = magic;
        break;
      }

      if (magic == LZFSE_COMPRESSEDLZVN_BLOCK_MAGIC) {
        if (s->src + sizeof(lzvn_compressed_block_header) > s->src_end)
          return LZFSE_STATUS_SRC_EMPTY; // SRC truncated
        // Setup state for compressed LZVN block
        lzvn_compressed_block_decoder_state *bs =
            &(s->compressed_lzvn_block_state);
        bs->n_raw_bytes =
            load4(s->src + offsetof(lzvn_compressed_block_header, n_raw_bytes));
        bs->n_payload_bytes = load4(
            s->src + offsetof(lzvn_compressed_block_header, n_payload_bytes));
        bs->d_prev = 0;
        s->src += sizeof(lzvn_compressed_block_header);
        s->block_magic = magic;
        break;
      }

      if (magic == LZFSE_COMPRESSEDV1_BLOCK_MAGIC ||
          magic == LZFSE_COMPRESSEDV2_BLOCK_MAGIC) {
        lzfse_compressed_block_header_v1 header1;
        size_t header_size = 0;

        // Decode compressed headers
        if (magic == LZFSE_COMPRESSEDV2_BLOCK_MAGIC) {
          // Check we have the fixed part of the structure
          if (s->src + offsetof(lzfse_compressed_block_header_v2, freq) > s->src_end)
            return LZFSE_STATUS_SRC_EMPTY; // SRC truncated

          // Get size, and check we have the entire structure
          const lzfse_compressed_block_header_v2 *header2 =
              (const lzfse_compressed_block_header_v2 *)s->src; // not aligned, OK
          header_size = lzfse_decode_v2_header_size(header2);
          if (s->src + header_size > s->src_end)
            return LZFSE_STATUS_SRC_EMPTY; // SRC truncated
          int decodeStatus = lzfse_decode_v1(&header1, header2);
          if (decodeStatus != 0)
            return LZFSE_STATUS_ERROR; // failed
        } else {
          if (s->src + sizeof(lzfse_compressed_block_header_v1) > s->src_end)
            return LZFSE_STATUS_SRC_EMPTY; // SRC truncated
          memcpy(&header1, s->src, sizeof(lzfse_compressed_block_header_v1));
          header_size = sizeof(lzfse_compressed_block_header_v1);
        }

        // We require the header + entire encoded block to be present in SRC
        // during the entire block decoding.
        // This can be relaxed somehow, if it becomes a limiting factor, at the
        // price of a more complex state maintenance.
        // For DST, we can't easily require space for the entire decoded block,
        // because it may expand to something very very large.
        if (s->src + header_size + header1.n_literal_payload_bytes +
                header1.n_lmd_payload_bytes >
            s->src_end)
          return LZFSE_STATUS_SRC_EMPTY; // need all encoded block

        // Sanity checks
        if (lzfse_check_block_header_v1(&header1) != 0) {
          return LZFSE_STATUS_ERROR;
        }

        // Skip header
        s->src += header_size;

        // Setup state for compressed V1 block from header
        lzfse_compressed_block_decoder_state *bs =
            &(s->compressed_lzfse_block_state);
        bs->n_lmd_payload_bytes = header1.n_lmd_payload_bytes;
        bs->n_matches = header1.n_matches;
        fse_init_decoder_table(LZFSE_ENCODE_LITERAL_STATES,
                               LZFSE_ENCODE_LITERAL_SYMBOLS,
                               header1.literal_freq, bs->literal_decoder);
        fse_init_value_decoder_table(
            LZFSE_ENCODE_L_STATES, LZFSE_ENCODE_L_SYMBOLS, header1.l_freq,
            l_extra_bits, l_base_value, bs->l_decoder);
        fse_init_value_decoder_table(
            LZFSE_ENCODE_M_STATES, LZFSE_ENCODE_M_SYMBOLS, header1.m_freq,
            m_extra_bits, m_base_value, bs->m_decoder);
        fse_init_value_decoder_table(
            LZFSE_ENCODE_D_STATES, LZFSE_ENCODE_D_SYMBOLS, header1.d_freq,
            d_extra_bits, d_base_value, bs->d_decoder);

        // Decode literals
        {
          fse_in_stream in;
          const uint8_t *buf_start = s->src_begin;
          s->src += header1.n_literal_payload_bytes; // skip literal payload
          const uint8_t *buf = s->src; // read bits backwards from the end
          if (fse_in_init(&in, header1.literal_bits, &buf, buf_start) != 0)
            return LZFSE_STATUS_ERROR;

          fse_state state0 = header1.literal_state[0];
          fse_state state1 = header1.literal_state[1];
          fse_state state2 = header1.literal_state[2];
          fse_state state3 = header1.literal_state[3];

          for (uint32_t i = 0; i < header1.n_literals; i += 4) // n_literals is multiple of 4
          {
#if FSE_IOSTREAM_64
            if (fse_in_flush(&in, &buf, buf_start) != 0)
              return LZFSE_STATUS_ERROR; // [57, 64] bits
            bs->literals[i + 0] =
                fse_decode(&state0, bs->literal_decoder, &in); // 10b max
            bs->literals[i + 1] =
                fse_decode(&state1, bs->literal_decoder, &in); // 10b max
            bs->literals[i + 2] =
                fse_decode(&state2, bs->literal_decoder, &in); // 10b max
            bs->literals[i + 3] =
                fse_decode(&state3, bs->literal_decoder, &in); // 10b max
#else
            if (fse_in_flush(&in, &buf, buf_start) != 0)
              return LZFSE_STATUS_ERROR; // [25, 23] bits
            bs->literals[i + 0] =
                fse_decode(&state0, bs->literal_decoder, &in); // 10b max
            bs->literals[i + 1] =
                fse_decode(&state1, bs->literal_decoder, &in); // 10b max
            if (fse_in_flush(&in, &buf, buf_start) != 0)
              return LZFSE_STATUS_ERROR; // [25, 23] bits
            bs->literals[i + 2] =
                fse_decode(&state2, bs->literal_decoder, &in); // 10b max
            bs->literals[i + 3] =
                fse_decode(&state3, bs->literal_decoder, &in); // 10b max
#endif
          }

          bs->current_literal = bs->literals;
        } // literals

        // SRC is not incremented to skip the LMD payload, since we need it
        // during block decode.
        // We will increment SRC at the end of the block only after this point.

        // Initialize the L,M,D decode stream, do not start decoding matches
        // yet, and store decoder state
        {
          fse_in_stream in;
          // read bits backwards from the end
          const uint8_t *buf = s->src + header1.n_lmd_payload_bytes;
          if (fse_in_init(&in, header1.lmd_bits, &buf, s->src) != 0)
            return LZFSE_STATUS_ERROR;

          bs->l_state = header1.l_state;
          bs->m_state = header1.m_state;
          bs->d_state = header1.d_state;
          bs->lmd_in_buf = (uint32_t)(buf - s->src);
          bs->l_value = bs->m_value = 0;
          //  Initialize D to an illegal value so we can't erroneously use
          //  an uninitialized "previous" value.
          bs->d_value = -1;
          bs->lmd_in_stream = in;
        }

        s->block_magic = magic;
        break;
      }

      // Here we have an invalid magic number
      return LZFSE_STATUS_ERROR;
    } // LZFSE_NO_BLOCK_MAGIC

    case LZFSE_UNCOMPRESSED_BLOCK_MAGIC: {
      uncompressed_block_decoder_state *bs = &(s->uncompressed_block_state);

      //  Compute the size (in bytes) of the data that we will actually copy.
      //  This size is minimum(bs->n_raw_bytes, space in src, space in dst).

      uint32_t copy_size = bs->n_raw_bytes; // bytes left to copy
      if (copy_size == 0) {
        s->block_magic = 0;
        break;
      } // end of block

      if (s->src_end <= s->src)
        return LZFSE_STATUS_SRC_EMPTY; // need more SRC data
      const size_t src_space = s->src_end - s->src;
      if (copy_size > src_space)
        copy_size = (uint32_t)src_space; // limit to SRC data (> 0)

      if (s->dst_end <= s->dst)
        return LZFSE_STATUS_DST_FULL; // need more DST capacity
      const size_t dst_space = s->dst_end - s->dst;
      if (copy_size > dst_space)
        copy_size = (uint32_t)dst_space; // limit to DST capacity (> 0)

      // Now that we know that the copy size is bounded to the source and
      // dest buffers, go ahead and copy the data.
      // We always have copy_size > 0 here
      memcpy(s->dst, s->src, copy_size);
      s->src += copy_size;
      s->dst += copy_size;
      bs->n_raw_bytes -= copy_size;

      break;
    } // LZFSE_UNCOMPRESSED_BLOCK_MAGIC

    case LZFSE_COMPRESSEDV1_BLOCK_MAGIC:
    case LZFSE_COMPRESSEDV2_BLOCK_MAGIC: {
      lzfse_compressed_block_decoder_state *bs =
          &(s->compressed_lzfse_block_state);
      // Require the entire LMD payload to be in SRC
      if (s->src_end <= s->src ||
          bs->n_lmd_payload_bytes > (size_t)(s->src_end - s->src))
        return LZFSE_STATUS_SRC_EMPTY;

      int status = lzfse_decode_lmd(s);
      if (status != LZFSE_STATUS_OK)
        return status;

      s->block_magic = LZFSE_NO_BLOCK_MAGIC;
      s->src += bs->n_lmd_payload_bytes; // to next block
      break;
    } // LZFSE_COMPRESSEDV1_BLOCK_MAGIC || LZFSE_COMPRESSEDV2_BLOCK_MAGIC

    case LZFSE_COMPRESSEDLZVN_BLOCK_MAGIC: {
      lzvn_compressed_block_decoder_state *bs =
          &(s->compressed_lzvn_block_state);
      if (bs->n_payload_bytes > 0 && s->src_end <= s->src)
        return LZFSE_STATUS_SRC_EMPTY; // need more SRC data

      // Init LZVN decoder state
      lzvn_decoder_state dstate;
      memset(&dstate, 0x00, sizeof(dstate));
      dstate.src = s->src;
      dstate.src_end = s->src_end;
      if (dstate.src_end - s->src > bs->n_payload_bytes)
        dstate.src_end = s->src + bs->n_payload_bytes; // limit to payload bytes
      dstate.dst_begin = s->dst_begin;
      dstate.dst = s->dst;
      dstate.dst_end = s->dst_end;
      if (dstate.dst_end - s->dst > bs->n_raw_bytes)
        dstate.dst_end = s->dst + bs->n_raw_bytes; // limit to raw bytes
      dstate.d_prev = bs->d_prev;
      dstate.end_of_stream = 0;

      // Run LZVN decoder
      lzvn_decode(&dstate);

      // Update our state
      size_t src_used = dstate.src - s->src;
      size_t dst_used = dstate.dst - s->dst;
      if (src_used > bs->n_payload_bytes || dst_used > bs->n_raw_bytes)
        return LZFSE_STATUS_ERROR; // sanity check
      s->src = dstate.src;
      s->dst = dstate.dst;
      bs->n_payload_bytes -= (uint32_t)src_used;
      bs->n_raw_bytes -= (uint32_t)dst_used;
      bs->d_prev = (uint32_t)dstate.d_prev;

      // Test end of block
      if (bs->n_payload_bytes == 0 && bs->n_raw_bytes == 0 &&
          dstate.end_of_stream) {
        s->block_magic = 0;
        break;
      } // block done

      // Check for invalid state
      if (bs->n_payload_bytes == 0 || bs->n_raw_bytes == 0 ||
          dstate.end_of_stream)
        return LZFSE_STATUS_ERROR;

      // Here, block is not done and state is valid, so we need more space in dst.
      return LZFSE_STATUS_DST_FULL;
    }

    default:
      return LZFSE_STATUS_ERROR; // invalid magic

    } // switch magic

  } // block loop

  return LZFSE_STATUS_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x388, %rsp            # imm = 0x388
movq %rdi, %rbx
leaq 0xb8f8(%rdi), %rax
movq %rax, 0x58(%rsp)
leaq 0x78(%rdi), %rax
movq %rax, 0x50(%rsp)
leaq 0x278(%rdi), %rax
movq %rax, 0x38(%rsp)
leaq 0x478(%rdi), %rax
movq %rax, 0x48(%rsp)
leaq 0xc78(%rdi), %rax
movq %rax, 0x68(%rsp)
leaq 0x1c78(%rdi), %rax
movq %rax, 0x60(%rsp)
pushq $-0x3
popq %r15
movq %rdi, 0x20(%rsp)
movl 0x34(%rbx), %eax
cmpl $0x6e787662, %eax       # imm = 0x6E787662
je 0x512b
cmpl $0x2d787662, %eax       # imm = 0x2D787662
je 0x50d5
cmpl $0x31787662, %eax       # imm = 0x31787662
je 0x502a
cmpl $0x32787662, %eax       # imm = 0x32787662
je 0x502a
testl %eax, %eax
jne 0x5dc5
movq (%rbx), %rbp
movq 0x10(%rbx), %r14
leaq 0x4(%rbp), %rax
cmpq %r14, %rax
ja 0x5d17
movl (%rbp), %r13d
cmpl $0x2d787662, %r13d      # imm = 0x2D787662
je 0x5754
cmpl $0x31787662, %r13d      # imm = 0x31787662
je 0x5273
cmpl $0x32787662, %r13d      # imm = 0x32787662
je 0x5273
cmpl $0x6e787662, %r13d      # imm = 0x6E787662
jne 0x5df2
leaq 0xc(%rbp), %rax
cmpq %r14, %rax
ja 0x5d17
movl 0x4(%rbp), %ecx
movl %ecx, 0xb8f8(%rbx)
movl 0x8(%rbp), %ecx
movl %ecx, 0xb8fc(%rbx)
andl $0x0, 0xb900(%rbx)
movq %rax, (%rbx)
movl $0x6e787662, 0x34(%rbx) # imm = 0x6E787662
jmp 0x4f72
movq (%rbx), %r11
movq 0x10(%rbx), %rax
subq %r11, %rax
jbe 0x5d17
movl 0x3c(%rbx), %ecx
cmpq %rcx, %rax
jb 0x5d17
movzwl 0x6c(%rbx), %eax
cmpw $0x40, %ax
jae 0x5eae
movzwl 0x6e(%rbx), %ecx
cmpw $0x40, %cx
jae 0x5ecd
movl %ecx, 0x28(%rsp)
movl %eax, 0xc(%rsp)
movzwl 0x70(%rbx), %eax
movl %eax, 0x8(%rsp)
cmpw $0x100, %ax             # imm = 0x100
jae 0x5eec
movq 0x58(%rbx), %rax
movq %rax, 0x18(%rsp)
movl 0x60(%rbx), %eax
movl 0x64(%rbx), %ecx
movl %ecx, 0x44(%rsp)
movq 0x8(%rbx), %rcx
movq %rcx, 0x70(%rsp)
movq 0x18(%rbx), %r14
movl 0x68(%rbx), %ecx
addq %rcx, %r11
movq 0x40(%rbx), %r9
movl 0x38(%rbx), %esi
movl 0x48(%rbx), %r12d
movl 0x4c(%rbx), %r13d
movl 0x50(%rbx), %ecx
movq 0x28(%rbx), %r8
movl %ecx, %ebx
subq %r14, %r8
addq $-0x20, %r8
movl %r12d, %ecx
orl %r13d, %ecx
movq %r8, %r15
je 0x5b42
jmp 0x5a40
movl 0xb904(%rbx), %eax
testq %rax, %rax
je 0x526a
movq (%rbx), %rsi
movq 0x10(%rbx), %rcx
subq %rsi, %rcx
jbe 0x5d17
movq 0x18(%rbx), %rdi
movq 0x28(%rbx), %rbp
subq %rdi, %rbp
jbe 0x5dc1
cmpq %rax, %rcx
cmovael %eax, %ecx
cmpq %rcx, %rbp
cmovael %ecx, %ebp
movq %rbp, %rdx
callq 0x30c0
addq %rbp, (%rbx)
addq %rbp, 0x18(%rbx)
subl %ebp, 0xb904(%rbx)
jmp 0x4f72
movl 0xb8fc(%rbx), %eax
testq %rax, %rax
sete %dil
movq (%rbx), %rcx
movq 0x10(%rbx), %rdx
movq %rdx, %rsi
subq %rcx, %rsi
seta %r8b
orb %dil, %r8b
cmpb $0x1, %r8b
jne 0x5d17
leaq 0xb2(%rsp), %rdi
pxor %xmm0, %xmm0
movdqu %xmm0, 0x16(%rdi)
movdqu %xmm0, 0x6(%rdi)
movdqu %xmm0, -0xa(%rdi)
movq %rcx, 0x80(%rsp)
addq %rax, %rcx
cmpq %rax, %rsi
cmovgq %rcx, %rdx
movq %rdx, 0x88(%rsp)
movq 0x20(%rbx), %rax
movq %rax, 0x98(%rsp)
movq 0x18(%rbx), %rax
movq %rax, 0x90(%rsp)
movq 0x28(%rbx), %rdx
movq %rdx, 0xa0(%rsp)
subq %rax, %rdx
movl 0xb8f8(%rbx), %ecx
cmpq %rcx, %rdx
jle 0x51c8
addq %rcx, %rax
movq %rax, 0xa0(%rsp)
movl 0xb900(%rbx), %eax
movq %rax, 0xc8(%rsp)
andl $0x0, 0xd0(%rsp)
leaq 0x80(%rsp), %rdi
callq 0x6bb0
movq 0x80(%rsp), %rdi
movq %rdi, %rdx
subq (%rbx), %rdx
movl 0xb8fc(%rbx), %esi
cmpq %rsi, %rdx
ja 0x5dc5
movq 0x90(%rsp), %r8
movq %r8, %rax
subq 0x18(%rbx), %rax
movq 0x58(%rsp), %rcx
movl (%rcx), %ecx
cmpq %rcx, %rax
ja 0x5dc5
movq %rdi, (%rbx)
movq %r8, 0x18(%rbx)
movl %ecx, %edi
subl %eax, %edi
subl %edx, %esi
movl %esi, 0xb8fc(%rbx)
movl %edi, 0xb8f8(%rbx)
movl 0xc8(%rsp), %edx
movl %edx, 0xb900(%rbx)
movl 0xd0(%rsp), %edx
jne 0x5dda
cmpl %eax, %ecx
jne 0x5dc5
testl %edx, %edx
je 0x5dc5
andl $0x0, 0x34(%rbx)
jmp 0x4f72
cmpl $0x32787662, %r13d      # imm = 0x32787662
jne 0x546c
leaq 0x20(%rbp), %r12
cmpq %r14, %r12
ja 0x5d17
movl 0x18(%rbp), %r15d
leaq (%r15,%rbp), %rax
cmpq %r14, %rax
ja 0x5d17
movl $0x304, %edx            # imm = 0x304
leaq 0x80(%rsp), %rdi
xorl %esi, %esi
callq 0x3080
movq 0x8(%rbp), %rdx
movq 0x10(%rbp), %rcx
movq 0x18(%rbp), %rax
movl $0x31787662, 0x80(%rsp) # imm = 0x31787662
movl 0x4(%rbp), %esi
movl %esi, 0x84(%rsp)
movl %edx, %esi
movl $0xfffff, %r10d         # imm = 0xFFFFF
andl %r10d, %esi
movl %esi, 0x8c(%rsp)
movq %rdx, %rsi
shrq $0x14, %rsi
andl %r10d, %esi
movl %esi, 0x94(%rsp)
movq %rdx, %rdi
shrq $0x3c, %rdi
andl $0x7, %edi
addl $-0x7, %edi
movl %edi, 0x9c(%rsp)
movl %ecx, %edi
shrl $0xa, %edi
movq %rcx, %r8
movd %ecx, %xmm0
movl %ecx, %r9d
shrl $0x14, %r9d
pinsrw $0x1, %edi, %xmm0
pinsrw $0x2, %r9d, %xmm0
shrq $0x1e, %r8
pinsrw $0x3, %r8d, %xmm0
pand 0x4776(%rip), %xmm0     # 0x9ab0
movq %xmm0, 0xa0(%rsp)
shrq $0x28, %rdx
andl %r10d, %edx
movl %edx, 0x90(%rsp)
movq %rcx, %rdx
shrq $0x28, %rdx
andl %r10d, %edx
movl %edx, 0x98(%rsp)
shrq $0x3c, %rcx
andl $0x7, %ecx
addl $-0x7, %ecx
movl %ecx, 0xa8(%rsp)
movq %rax, %rcx
movq %rax, %r8
movl %eax, %edi
shrq $0x20, %rax
movl $0x3ff, %r9d            # imm = 0x3FF
andl %r9d, %eax
movw %ax, 0xac(%rsp)
shrq $0x2a, %rcx
andl %r9d, %ecx
movw %cx, 0xae(%rsp)
shrq $0x34, %r8
andl %r9d, %r8d
movw %r8w, 0xb0(%rsp)
leal (%rdx,%rsi), %eax
movl %eax, 0x88(%rsp)
cmpq $0x20, %rdi
je 0x54a5
addq %rbp, %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
leaq 0x472b(%rip), %r11      # 0x9b00
cmpq $0x168, %r8             # imm = 0x168
je 0x5a29
cmpq %rdi, %r12
jae 0x5401
cmpl $0x18, %eax
jg 0x5401
movzbl (%r12), %r10d
movl %eax, %ecx
shll %cl, %r10d
addl $0x8, %eax
orl %r10d, %r9d
incq %r12
jmp 0x53e2
movl %r9d, %ecx
andl $0x1f, %ecx
movl %r9d, %r10d
andl $0xf, %r10d
cmpl $0xf, %r10d
je 0x542b
cmpl $0x7, %r10d
jne 0x543f
movl %r9d, %r10d
shrl $0x4, %r10d
andl $0xf, %r10d
addl $0x8, %r10d
jmp 0x544b
movl %r9d, %r10d
shrl $0x4, %r10d
andl $0x3ff, %r10d           # imm = 0x3FF
addl $0x18, %r10d
jmp 0x544b
leaq 0x46da(%rip), %r10      # 0x9b20
movsbl (%rcx,%r10), %r10d
movsbl (%rcx,%r11), %ecx
movw %r10w, 0xb2(%rsp,%r8,2)
subl %ecx, %eax
jl 0x5d10
shrl %cl, %r9d
incq %r8
jmp 0x53d5
leaq 0x304(%rbp), %rax
cmpq %r14, %rax
ja 0x5d17
movl $0x304, %r15d           # imm = 0x304
movl $0x304, %edx            # imm = 0x304
leaq 0x80(%rsp), %rdi
movq %rbp, %rsi
callq 0x30c0
movl 0x94(%rsp), %esi
movl 0x98(%rsp), %edx
addq %r15, %rbp
movl %esi, %eax
addq %rbp, %rax
movl %edx, %ecx
addq %rax, %rcx
cmpq %r14, %rcx
ja 0x5d17
movl %r13d, 0x8(%rsp)
movl 0x80(%rsp), %edi
xorl %esi, %esi
cmpl $0x9c41, 0x8c(%rsp) # imm = 0x9C41
setae %sil
addl %esi, %esi
movl 0x90(%rsp), %eax
xorl %r8d, %r8d
movl %eax, 0x10(%rsp)
cmpl $0x2711, %eax           # imm = 0x2711
setae %r8b
shll $0x2, %r8d
xorl %r9d, %r9d
movw $0x400, %ax             # imm = 0x400
cmpw %ax, 0xa0(%rsp)
setae %r9b
xorl %r10d, %r10d
cmpw %ax, 0xa2(%rsp)
setae %r10b
xorl %ecx, %ecx
cmpw %ax, 0xa4(%rsp)
setae %cl
xorl %ebx, %ebx
cmpw %ax, 0xa6(%rsp)
setae %bl
shll $0x3, %r9d
shll $0x4, %r10d
shll $0x5, %ecx
shll $0x6, %ebx
xorl %r14d, %r14d
cmpw $0x40, 0xac(%rsp)
setae %r14b
shll $0x7, %r14d
xorl %r15d, %r15d
cmpw $0x40, 0xae(%rsp)
setae %r15b
shll $0x8, %r15d
xorl %r11d, %r11d
cmpw $0x100, 0xb0(%rsp)      # imm = 0x100
setae %r11b
shll $0x9, %r11d
pushq $0x19
popq %r13
xorl %r12d, %r12d
cmpq $0x2d, %r13
je 0x559a
movzwl 0x80(%rsp,%r13,2), %eax
addq %rax, %r12
incq %r13
jmp 0x5583
xorl %eax, %eax
cmpl $0x31787662, %edi       # imm = 0x31787662
setne %al
orl %r8d, %esi
orl %r9d, %esi
orl %r10d, %esi
orl %eax, %esi
orl %ebx, %ecx
orl %r14d, %ecx
orl %r15d, %ecx
orl %esi, %ecx
xorl %edi, %edi
cmpq $0x41, %r12
setae %dil
shll $0xa, %edi
pushq $0x2d
popq %rsi
xorl %r8d, %r8d
movq 0x20(%rsp), %rbx
pushq $-0x3
popq %r15
movq 0x48(%rsp), %r14
leaq 0x3d0e(%rip), %r13      # 0x92f0
cmpq $0x41, %rsi
je 0x55f8
movzwl 0x80(%rsp,%rsi,2), %eax
addq %rax, %r8
incq %rsi
jmp 0x55e2
orl %r11d, %ecx
xorl %esi, %esi
cmpq $0x41, %r8
setae %sil
shll $0xb, %esi
pushq $0x41
popq %r9
xorl %r8d, %r8d
cmpq $0x81, %r9
je 0x5629
movzwl 0x80(%rsp,%r9,2), %eax
addq %rax, %r8
incq %r9
jmp 0x560f
orl %edi, %ecx
xorl %edi, %edi
cmpq $0x101, %r8             # imm = 0x101
setae %dil
shll $0xc, %edi
movl $0x81, %r9d
xorl %r8d, %r8d
cmpq $0x181, %r9             # imm = 0x181
je 0x565e
movzwl 0x80(%rsp,%r9,2), %eax
addq %rax, %r8
incq %r9
jmp 0x5644
orl %esi, %ecx
orl %edi, %ecx
xorl %eax, %eax
cmpq $0x401, %r8             # imm = 0x401
setae %al
shll $0xd, %eax
orl %ecx, %eax
jne 0x5dc5
movq %rbp, (%rbx)
movl %edx, 0x3c(%rbx)
movl 0x10(%rsp), %eax
movl %eax, 0x38(%rbx)
movl $0x400, %edi            # imm = 0x400
movl $0x100, %esi            # imm = 0x100
leaq 0x182(%rsp), %rdx
movq 0x68(%rsp), %rcx
callq 0x7042
pushq $0x40
popq %rbp
movl %ebp, %edi
pushq $0x14
popq %r12
movl %r12d, %esi
leaq 0xb2(%rsp), %rdx
leaq 0x3a13(%rip), %rcx      # 0x90d0
leaq 0x3a2c(%rip), %r8       # 0x90f0
movq 0x50(%rsp), %r9
callq 0x718d
movl %ebp, %edi
movl %r12d, %esi
leaq 0xda(%rsp), %rdx
leaq 0x3a5e(%rip), %rcx      # 0x9140
leaq 0x3a77(%rip), %r8       # 0x9160
movq 0x38(%rsp), %r9
callq 0x718d
movl $0x100, %edi            # imm = 0x100
movl %ebp, %esi
leaq 0x102(%rsp), %rdx
leaq 0x3aa7(%rip), %rcx      # 0x91b0
leaq 0x3ae0(%rip), %r8       # 0x91f0
movq %r14, %r9
callq 0x718d
movl 0x94(%rsp), %r9d
addq (%rbx), %r9
movq 0x8(%rbx), %r14
movq %r9, (%rbx)
movl 0x9c(%rsp), %eax
testl %eax, %eax
je 0x5778
leaq 0x8(%r14), %rcx
cmpq %rcx, %r9
jb 0x5dc5
leaq -0x8(%r9), %rcx
movq %rcx, 0x10(%rsp)
movq -0x8(%r9), %rsi
addl $0x40, %eax
jmp 0x57ab
addq $0x8, %rbp
cmpq %r14, %rbp
ja 0x5d17
movl (%rax), %eax
movl %eax, 0xb904(%rbx)
movq %rbp, (%rbx)
movl $0x2d787662, 0x34(%rbx) # imm = 0x2D787662
jmp 0x4f72
leaq 0x7(%r14), %rax
cmpq %rax, %r9
jb 0x5dc5
leaq -0x7(%r9), %rax
movq %rax, 0x10(%rsp)
movzwl -0x3(%r9), %eax
movzbl -0x1(%r9), %ecx
shll $0x10, %ecx
orl %eax, %ecx
shlq $0x20, %rcx
movl -0x7(%r9), %esi
orq %rcx, %rsi
pushq $0x38
popq %rax
movl %eax, %edi
andl $-0x8, %edi
movq %rsi, %rdx
movl %eax, %ecx
shrq %cl, %rdx
cmpl $0x38, %edi
jne 0x5dc5
testq %rdx, %rdx
jne 0x5dc5
movq %r9, 0x30(%rsp)
movzwl 0xa0(%rsp), %r10d
movzwl 0xa2(%rsp), %r11d
movzwl 0xa4(%rsp), %ebp
movzwl 0xa6(%rsp), %r15d
movl 0x8c(%rsp), %ecx
movl %ecx, 0x18(%rsp)
pushq $0x3
popq %rcx
movl %ecx, %r8d
movq %r14, 0x28(%rsp)
leal -0x3(%r8), %r12d
cmpl 0x18(%rsp), %r12d
movq 0x10(%rsp), %rdi
jae 0x595d
pushq $0x3f
popq %rcx
subl %eax, %ecx
movl %ecx, %edx
shrl $0x3, %edx
negl %edx
movslq %edx, %rdx
addq %rdx, %rdi
cmpq %r14, %rdi
jb 0x5d10
andl $-0x8, %ecx
shlq %cl, %rsi
addl %ecx, %eax
movl %eax, %edx
andl $-0x8, %edx
cmpl $0x38, %edx
jne 0x5e29
movq (%r13,%rcx,8), %rbx
andq (%rdi), %rbx
orq %rsi, %rbx
movq %rbx, %rdx
movl %eax, %ecx
shrq %cl, %rdx
testq %rdx, %rdx
jne 0x5e32
movq %rdi, 0x10(%rsp)
movzwl %r10w, %ecx
movq 0x68(%rsp), %r14
movl (%r14,%rcx,4), %edx
movzbl %dl, %ecx
subl %ecx, %eax
movq 0x60(%rsp), %rdi
jb 0x5e0a
movq %rbx, %r10
movl %eax, %ecx
shrq %cl, %r10
movslq %eax, %rcx
movq %r13, %r9
movq (%r13,%rcx,8), %r13
movl %r12d, %eax
movl %edx, 0xc(%rsp)
movb %dh, (%rdi,%rax)
movzwl %r11w, %eax
movl (%r14,%rax,4), %edx
movzbl %dl, %eax
subl %eax, %ecx
jl 0x5e0a
andq %rbx, %r13
movq %r13, %r11
shrq %cl, %r11
movslq %ecx, %rcx
movq (%r9,%rcx,8), %r12
leal -0x2(%r8), %eax
movb %dh, (%rdi,%rax)
movzwl %bp, %eax
movl (%r14,%rax,4), %ebx
movzbl %bl, %eax
subl %eax, %ecx
jl 0x5e0a
movslq %ecx, %rax
movq (%r9,%rax,8), %rsi
leal -0x1(%r8), %ebp
movb %bh, (%rdi,%rbp)
movzwl %r15w, %r15d
movl (%r14,%r15,4), %ebp
movl %ebp, %r14d
movzbl %bpl, %ebp
subl %ebp, %eax
jl 0x5e0a
movl 0xc(%rsp), %ebp
shrl $0x10, %ebp
addl %ebp, %r10d
shrl $0x10, %edx
addl %edx, %r11d
andq %r13, %r12
andq %r12, %rsi
shrq %cl, %r12
movq %rsi, %r15
movl %eax, %ecx
shrq %cl, %r15
shrl $0x10, %ebx
addl %ebx, %r12d
movl %r14d, %edx
movl %r14d, %ecx
shrl $0x10, %ecx
addl %ecx, %r15d
movslq %eax, %rcx
andq (%r9,%rcx,8), %rsi
movl %r8d, %ecx
movb %dh, (%rdi,%rcx)
addl $0x4, %r8d
movl %r12d, %ebp
movq %r9, %r13
movq 0x28(%rsp), %r14
jmp 0x5808
movq 0x20(%rsp), %rbx
movq 0x60(%rsp), %rax
movq %rax, 0x40(%rbx)
movl 0x98(%rsp), %edx
movl 0xa8(%rsp), %ecx
movq %rdx, %rax
movq 0x30(%rsp), %r9
addq %r9, %rax
testl %ecx, %ecx
je 0x59a7
cmpl $0x8, %edx
pushq $-0x3
popq %r15
movl 0x8(%rsp), %r8d
jb 0x5dc5
movq -0x8(%rax), %rdx
addq $-0x8, %rax
addl $0x40, %ecx
jmp 0x59d7
cmpl $0x7, %edx
pushq $-0x3
popq %r15
movl 0x8(%rsp), %r8d
jb 0x5dc5
movzwl -0x3(%rax), %ecx
movzbl -0x1(%rax), %esi
movl -0x7(%rax), %edx
addq $-0x7, %rax
shll $0x10, %esi
orl %ecx, %esi
shlq $0x20, %rsi
orq %rsi, %rdx
pushq $0x38
popq %rcx
movl %ecx, %edi
andl $-0x8, %edi
movq %rdx, %rsi
shrq %cl, %rsi
cmpl $0x38, %edi
jne 0x5dc5
testq %rsi, %rsi
jne 0x5dc5
movl 0xac(%rsp), %esi
movl %esi, 0x6c(%rbx)
movzwl 0xb0(%rsp), %esi
movw %si, 0x70(%rbx)
subl %r9d, %eax
movl %eax, 0x68(%rbx)
andq $0x0, 0x48(%rbx)
orl $-0x1, 0x50(%rbx)
movq %rdx, 0x58(%rbx)
movl %ecx, 0x60(%rbx)
movl %r8d, 0x34(%rbx)
jmp 0x4f72
cmpl $0x7, %eax
jg 0x5d10
cmpq %rdi, %r12
je 0x54a5
jmp 0x5d10
movl %esi, 0x10(%rsp)
movl %ebx, %esi
movslq %r12d, %rdx
leaq (%r14,%rdx), %rcx
movq %rcx, %rdi
movq 0x20(%rsp), %r10
subq 0x20(%r10), %rdi
cmpq %rsi, %rdi
jl 0x5d10
leal (%r12,%r13), %esi
movslq %esi, %rdi
movq %r15, %r8
movslq %ebx, %rsi
subq %rdi, %r8
jge 0x5a9b
leaq 0x20(%r15), %rdi
movq %rdi, %r10
subq %rdx, %r10
jl 0x5d1e
movl %ebx, %r8d
xorl %ebx, %ebx
cmpq %rbx, %rdx
je 0x5adf
movb (%r9,%rbx), %bpl
movb %bpl, (%r14,%rbx)
incq %rbx
jmp 0x5a89
movslq %r13d, %r10
movq %r9, %rdi
movq (%rdi), %r15
movq %r15, (%r14)
addq $0x8, %r14
addq $0x8, %rdi
cmpq %rcx, %r14
jb 0x5aa1
addq %rdx, %r9
cmpl $0x7, %ebx
jg 0x5b1e
cmpl %r13d, %ebx
jge 0x5b1e
movslq %r13d, %r10
negq %rsi
movq %r10, %rdx
movq %rcx, %rdi
subq $0x1, %rdx
jb 0x5b38
movb (%rdi,%rsi), %bpl
movb %bpl, (%rdi)
incq %rdi
jmp 0x5acd
addq %rdx, %r9
movslq %r13d, %r12
movq %r10, %rbx
subq %r12, %rbx
jl 0x5d44
movq %rbx, %rbp
negq %rsi
movq %r12, %rdx
movq %rcx, %rdi
movl %r8d, %ebx
movq %rbp, %r8
subq $0x1, %rdx
jb 0x5b15
movb (%rdi,%rsi), %r10b
movb %r10b, (%rdi)
incq %rdi
jmp 0x5b03
addq %r12, %rcx
addq $-0x20, %r8
jmp 0x5b3b
negq %rsi
leaq (%rcx,%r10), %rdx
movq %rcx, %rdi
movq (%rdi,%rsi), %r14
movq %r14, (%rdi)
addq $0x8, %rdi
cmpq %rdx, %rdi
jb 0x5b28
addq %r10, %rcx
movq %rcx, %r14
movl 0x10(%rsp), %esi
testl %esi, %esi
je 0x5cf4
pushq $0x3f
popq %rcx
subl %eax, %ecx
movl %ecx, %edx
sarl $0x3, %edx
negl %edx
movslq %edx, %rdx
addq %rdx, %r11
cmpq 0x70(%rsp), %r11
jb 0x5d10
movq %r8, 0x30(%rsp)
movl %esi, 0x10(%rsp)
andl $-0x8, %ecx
movq 0x18(%rsp), %rsi
shlq %cl, %rsi
addl %ecx, %eax
movl %eax, %edx
andl $-0x8, %edx
cmpl $0x38, %edx
jne 0x5e29
movslq %ecx, %rcx
leaq 0x375b(%rip), %r8       # 0x92f0
movq (%r8,%rcx,8), %r10
andq (%r11), %r10
orq %rsi, %r10
movq %r10, %rdx
movl %eax, %ecx
shrq %cl, %rdx
testq %rdx, %rdx
movq 0x50(%rsp), %rdi
movl 0xc(%rsp), %ecx
jne 0x5e32
movzwl %cx, %esi
movzbl (%rdi,%rsi,8), %ecx
cmpl %ecx, %eax
movq 0x38(%rsp), %rbp
jb 0x5e0a
movzbl 0x1(%rdi,%rsi,8), %edx
cltq
subq %rcx, %rax
movq %r10, %r12
movl %eax, %ecx
shrq %cl, %r12
movl %r12d, %r15d
movl %edx, %ecx
shrl %cl, %r15d
addw 0x2(%rdi,%rsi,8), %r15w
cmpw $0x40, %r15w
jae 0x5e51
andl (%r8,%rdx,8), %r12d
addl 0x4(%rdi,%rsi,8), %r12d
movslq %r12d, %rcx
addq %r9, %rcx
cmpq 0x58(%rsp), %rcx
jae 0x5d10
movl %r15d, 0xc(%rsp)
movzwl 0x28(%rsp), %r15d
movzbl (%rbp,%r15,8), %ecx
cmpl %ecx, %eax
jl 0x5e0a
andq (%r8,%rax,8), %r10
movzbl 0x1(%rbp,%r15,8), %edx
cltq
subq %rcx, %rax
movq %r10, %r13
movl %eax, %ecx
shrq %cl, %r13
movl %r13d, %esi
movl %edx, %ecx
shrl %cl, %esi
addw 0x2(%rbp,%r15,8), %si
cmpw $0x40, %si
jae 0x5e70
movl %ebx, 0x18(%rsp)
movl %esi, 0x28(%rsp)
movq %r11, 0x78(%rsp)
movzwl 0x8(%rsp), %ebp
movq 0x48(%rsp), %r8
movzbl (%r8,%rbp,8), %ecx
cmpl %ecx, %eax
jl 0x5e0a
leaq 0x366c(%rip), %r11      # 0x92f0
andq (%r11,%rax,8), %r10
movzbl 0x1(%r8,%rbp,8), %esi
cltq
subq %rcx, %rax
movq %r10, %rdi
movl %eax, %ecx
shrq %cl, %rdi
movl %edi, %ebx
movl %esi, %ecx
shrl %cl, %ebx
addw 0x2(%r8,%rbp,8), %bx
movl %ebx, 0x8(%rsp)
cmpw $0x100, %bx             # imm = 0x100
jae 0x5e8f
andl (%r11,%rdx,8), %r13d
movq 0x38(%rsp), %rcx
addl 0x4(%rcx,%r15,8), %r13d
andl (%r11,%rsi,8), %edi
addl 0x4(%r8,%rbp,8), %edi
andq (%r11,%rax,8), %r10
testl %edi, %edi
cmovel 0x18(%rsp), %edi
movl 0x10(%rsp), %esi
decl %esi
movq %r10, 0x18(%rsp)
movl %edi, %ebx
movq 0x30(%rsp), %r15
movq 0x78(%rsp), %r11
jmp 0x5a40
movq 0x20(%rsp), %rbx
movq %r14, 0x18(%rbx)
andl $0x0, 0x34(%rbx)
movl 0x3c(%rbx), %eax
addq %rax, (%rbx)
pushq $-0x3
popq %r15
jmp 0x4f72
pushq $-0x3
jmp 0x5dc3
pushq $-0x1
jmp 0x5dc3
xorl %ecx, %ecx
movq 0x20(%rsp), %rsi
movl 0xc(%rsp), %r10d
cmpq %rcx, %rdi
je 0x5d3c
movb (%r9,%rcx), %dl
movb %dl, (%r14,%rcx)
incq %rcx
jmp 0x5d2a
addq %rdi, %r9
subl %edi, %r12d
jmp 0x5d75
leaq (%r14,%rdx), %rcx
negq %rsi
subq %rdx, %r15
addq $0x20, %r15
movl %r8d, %ebx
subq $0x1, %r15
jb 0x5d65
movb (%rcx,%rsi), %dl
movb %dl, (%rcx)
incq %rcx
jmp 0x5d55
subl %r10d, %r13d
xorl %r12d, %r12d
movq 0x20(%rsp), %rsi
movl 0xc(%rsp), %r10d
addq %rdi, %r14
movl %r12d, 0x48(%rsi)
movl %r13d, 0x4c(%rsi)
movl %ebx, 0x50(%rsi)
movw %r10w, 0x6c(%rsi)
movl 0x28(%rsp), %ecx
movw %cx, 0x6e(%rsi)
movl 0x8(%rsp), %ecx
movw %cx, 0x70(%rsi)
movq 0x18(%rsp), %rcx
movq %rcx, 0x58(%rsi)
movl %eax, 0x60(%rsi)
movl 0x44(%rsp), %eax
movl %eax, 0x64(%rsi)
movl 0x10(%rsp), %eax
movl %eax, 0x38(%rsi)
subl (%rsi), %r11d
movl %r11d, 0x68(%rsi)
movq %r9, 0x40(%rsi)
movq %r14, 0x18(%rsi)
pushq $-0x2
popq %r15
movl %r15d, %eax
addq $0x388, %rsp            # imm = 0x388
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %edx, %edx
setne %dl
cmpl %eax, %ecx
sete %al
orb %dl, %al
movzbl %al, %eax
pushq $-0x2
popq %r15
subl %eax, %r15d
jmp 0x5dc5
cmpl $0x24787662, %r13d      # imm = 0x24787662
jne 0x5dc5
movq %rax, (%rbx)
movl $0x1, 0x30(%rbx)
xorl %r15d, %r15d
jmp 0x5dc5
leaq 0x3a71(%rip), %rdi      # 0x9882
leaq 0x3887(%rip), %rsi      # 0x969f
leaq 0x3a81(%rip), %rcx      # 0x98a0
movl $0x198, %edx            # imm = 0x198
callq 0x3070
leaq 0x39d5(%rip), %rdi      # 0x9805
jmp 0x5e39
leaq 0x38c3(%rip), %rdi      # 0x96fc
leaq 0x385f(%rip), %rsi      # 0x969f
leaq 0x39ea(%rip), %rcx      # 0x9831
movl $0x178, %edx            # imm = 0x178
callq 0x3070
leaq 0x3a81(%rip), %rdi      # 0x98d9
leaq 0x398e(%rip), %rsi      # 0x97ed
leaq 0x3a93(%rip), %rcx      # 0x98f9
movl $0xc6, %edx
callq 0x3070
leaq 0x3aae(%rip), %rdi      # 0x9925
leaq 0x396f(%rip), %rsi      # 0x97ed
leaq 0x3a74(%rip), %rcx      # 0x98f9
movl $0xcf, %edx
callq 0x3070
leaq 0x3aaf(%rip), %rdi      # 0x9945
leaq 0x3950(%rip), %rsi      # 0x97ed
leaq 0x3a55(%rip), %rcx      # 0x98f9
movl $0xd5, %edx
callq 0x3070
leaq 0x3a24(%rip), %rdi      # 0x98d9
leaq 0x3931(%rip), %rsi      # 0x97ed
leaq 0x3a36(%rip), %rcx      # 0x98f9
movl $0xab, %edx
callq 0x3070
leaq 0x3a51(%rip), %rdi      # 0x9925
leaq 0x3912(%rip), %rsi      # 0x97ed
leaq 0x3a17(%rip), %rcx      # 0x98f9
movl $0xac, %edx
callq 0x3070
leaq 0x3a52(%rip), %rdi      # 0x9945
leaq 0x38f3(%rip), %rsi      # 0x97ed
leaq 0x39f8(%rip), %rcx      # 0x98f9
movl $0xad, %edx
callq 0x3070
nop