// File: Lut99[P]RayTracer/src/lib/LodePNG.cpp
// Function: decodeGeneric(unsigned char**, unsigned int*, unsigned int*, LodePNGState*, unsigned char const*, unsigned long)
static void decodeGeneric(unsigned char** out, unsigned* w, unsigned* h,
                          LodePNGState* state,
                          const unsigned char* in, size_t insize) {
  unsigned char IEND = 0;
  const unsigned char* chunk;
  size_t i;
  ucvector idat; /*the data from idat chunks*/
  unsigned char* scanlines = 0;
  size_t scanlines_size = 0, expected_size = 0;
  size_t outsize = 0;

  /*for unknown chunk order*/
  unsigned unknown = 0;
#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
  unsigned critical_pos = 1; /*1 = after IHDR, 2 = after PLTE, 3 = after IDAT*/
#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/


  /* safe output values in case error happens */
  *out = 0;
  *w = *h = 0;

  state->error = lodepng_inspect(w, h, state, in, insize); /*reads header and resets other parameters in state->info_png*/
  if(state->error) return;

  if(lodepng_pixel_overflow(*w, *h, &state->info_png.color, &state->info_raw)) {
    CERROR_RETURN(state->error, 92); /*overflow possible due to amount of pixels*/
  }

  ucvector_init(&idat);
  chunk = &in[33]; /*first byte of the first chunk after the header*/

  /*loop through the chunks, ignoring unknown chunks and stopping at IEND chunk.
  IDAT data is put at the start of the in buffer*/
  while(!IEND && !state->error) {
    unsigned chunkLength;
    const unsigned char* data; /*the data in the chunk*/

    /*error: size of the in buffer too small to contain next chunk*/
    if((size_t)((chunk - in) + 12) > insize || chunk < in) {
      if(state->decoder.ignore_end) break; /*other errors may still happen though*/
      CERROR_BREAK(state->error, 30);
    }

    /*length of the data of the chunk, excluding the length bytes, chunk type and CRC bytes*/
    chunkLength = lodepng_chunk_length(chunk);
    /*error: chunk length larger than the max PNG chunk size*/
    if(chunkLength > 2147483647) {
      if(state->decoder.ignore_end) break; /*other errors may still happen though*/
      CERROR_BREAK(state->error, 63);
    }

    if((size_t)((chunk - in) + chunkLength + 12) > insize || (chunk + chunkLength + 12) < in) {
      CERROR_BREAK(state->error, 64); /*error: size of the in buffer too small to contain next chunk*/
    }

    data = lodepng_chunk_data_const(chunk);

    unknown = 0;

    /*IDAT chunk, containing compressed image data*/
    if(lodepng_chunk_type_equals(chunk, "IDAT")) {
      size_t oldsize = idat.size;
      size_t newsize;
      if(lodepng_addofl(oldsize, chunkLength, &newsize)) CERROR_BREAK(state->error, 95);
      if(!ucvector_resize(&idat, newsize)) CERROR_BREAK(state->error, 83 /*alloc fail*/);
      for(i = 0; i != chunkLength; ++i) idat.data[oldsize + i] = data[i];
#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
      critical_pos = 3;
#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/
    } else if(lodepng_chunk_type_equals(chunk, "IEND")) {
      /*IEND chunk*/
      IEND = 1;
    } else if(lodepng_chunk_type_equals(chunk, "PLTE")) {
      /*palette chunk (PLTE)*/
      state->error = readChunk_PLTE(&state->info_png.color, data, chunkLength);
      if(state->error) break;
#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
      critical_pos = 2;
#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/
    } else if(lodepng_chunk_type_equals(chunk, "tRNS")) {
      /*palette transparency chunk (tRNS). Even though this one is an ancillary chunk , it is still compiled
      in without 'LODEPNG_COMPILE_ANCILLARY_CHUNKS' because it contains essential color information that
      affects the alpha channel of pixels. */
      state->error = readChunk_tRNS(&state->info_png.color, data, chunkLength);
      if(state->error) break;
#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
      /*background color chunk (bKGD)*/
    } else if(lodepng_chunk_type_equals(chunk, "bKGD")) {
      state->error = readChunk_bKGD(&state->info_png, data, chunkLength);
      if(state->error) break;
    } else if(lodepng_chunk_type_equals(chunk, "tEXt")) {
      /*text chunk (tEXt)*/
      if(state->decoder.read_text_chunks) {
        state->error = readChunk_tEXt(&state->info_png, data, chunkLength);
        if(state->error) break;
      }
    } else if(lodepng_chunk_type_equals(chunk, "zTXt")) {
      /*compressed text chunk (zTXt)*/
      if(state->decoder.read_text_chunks) {
        state->error = readChunk_zTXt(&state->info_png, &state->decoder.zlibsettings, data, chunkLength);
        if(state->error) break;
      }
    } else if(lodepng_chunk_type_equals(chunk, "iTXt")) {
      /*international text chunk (iTXt)*/
      if(state->decoder.read_text_chunks) {
        state->error = readChunk_iTXt(&state->info_png, &state->decoder.zlibsettings, data, chunkLength);
        if(state->error) break;
      }
    } else if(lodepng_chunk_type_equals(chunk, "tIME")) {
      state->error = readChunk_tIME(&state->info_png, data, chunkLength);
      if(state->error) break;
    } else if(lodepng_chunk_type_equals(chunk, "pHYs")) {
      state->error = readChunk_pHYs(&state->info_png, data, chunkLength);
      if(state->error) break;
    } else if(lodepng_chunk_type_equals(chunk, "gAMA")) {
      state->error = readChunk_gAMA(&state->info_png, data, chunkLength);
      if(state->error) break;
    } else if(lodepng_chunk_type_equals(chunk, "cHRM")) {
      state->error = readChunk_cHRM(&state->info_png, data, chunkLength);
      if(state->error) break;
    } else if(lodepng_chunk_type_equals(chunk, "sRGB")) {
      state->error = readChunk_sRGB(&state->info_png, data, chunkLength);
      if(state->error) break;
    } else if(lodepng_chunk_type_equals(chunk, "iCCP")) {
      state->error = readChunk_iCCP(&state->info_png, &state->decoder.zlibsettings, data, chunkLength);
      if(state->error) break;
#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/
    } else /*it's not an implemented chunk type, so ignore it: skip over the data*/ {
      /*error: unknown critical chunk (5th bit of first byte of chunk type is 0)*/
      if(!state->decoder.ignore_critical && !lodepng_chunk_ancillary(chunk)) {
        CERROR_BREAK(state->error, 69);
      }

      unknown = 1;
#ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
      if(state->decoder.remember_unknown_chunks) {
        state->error = lodepng_chunk_append(&state->info_png.unknown_chunks_data[critical_pos - 1],
                                            &state->info_png.unknown_chunks_size[critical_pos - 1], chunk);
        if(state->error) break;
      }
#endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/
    }

    if(!state->decoder.ignore_crc && !unknown) /*check CRC if wanted, only on known chunk types*/ {
      if(lodepng_chunk_check_crc(chunk)) CERROR_BREAK(state->error, 57); /*invalid CRC*/
    }

    if(!IEND) chunk = lodepng_chunk_next_const(chunk, in + insize);
  }

  if (state->info_png.color.colortype == LCT_PALETTE
      && !state->info_png.color.palette) {
    state->error = 106; /* error: PNG file must have PLTE chunk if color type is palette */
  }

  /*predict output size, to allocate exact size for output buffer to avoid more dynamic allocation.
  If the decompressed size does not match the prediction, the image must be corrupt.*/
  if(state->info_png.interlace_method == 0) {
    expected_size = lodepng_get_raw_size_idat(*w, *h, &state->info_png.color);
  } else {
    /*Adam-7 interlaced: expected size is the sum of the 7 sub-images sizes*/
    const LodePNGColorMode* color = &state->info_png.color;
    expected_size = 0;
    expected_size += lodepng_get_raw_size_idat((*w + 7) >> 3, (*h + 7) >> 3, color);
    if(*w > 4) expected_size += lodepng_get_raw_size_idat((*w + 3) >> 3, (*h + 7) >> 3, color);
    expected_size += lodepng_get_raw_size_idat((*w + 3) >> 2, (*h + 3) >> 3, color);
    if(*w > 2) expected_size += lodepng_get_raw_size_idat((*w + 1) >> 2, (*h + 3) >> 2, color);
    expected_size += lodepng_get_raw_size_idat((*w + 1) >> 1, (*h + 1) >> 2, color);
    if(*w > 1) expected_size += lodepng_get_raw_size_idat((*w + 0) >> 1, (*h + 1) >> 1, color);
    expected_size += lodepng_get_raw_size_idat((*w + 0), (*h + 0) >> 1, color);
  }
  if(!state->error) {
    /* This allocated data will be realloced by zlib_decompress, initially at
    smaller size again. But the fact that it's already allocated at full size
    here speeds the multiple reallocs up. TODO: make zlib_decompress support
    receiving already allocated buffer with expected size instead. */
    scanlines = (unsigned char*)lodepng_malloc(expected_size);
    if(!scanlines) state->error = 83; /*alloc fail*/
    scanlines_size = 0;
  }
  if(!state->error) {
    state->error = zlib_decompress(&scanlines, &scanlines_size, idat.data,
                                   idat.size, &state->decoder.zlibsettings);
    if(!state->error && scanlines_size != expected_size) state->error = 91; /*decompressed size doesn't match prediction*/
  }
  ucvector_cleanup(&idat);

  if(!state->error) {
    outsize = lodepng_get_raw_size(*w, *h, &state->info_png.color);
    *out = (unsigned char*)lodepng_malloc(outsize);
    if(!*out) state->error = 83; /*alloc fail*/
  }
  if(!state->error) {
    for(i = 0; i < outsize; i++) (*out)[i] = 0;
    state->error = postProcessScanlines(*out, scanlines, *w, *h, &state->info_png);
  }
  lodepng_free(scanlines);
}

// Assembly:
subq $0xb8, %rsp
movq %rdi, 0xb0(%rsp)
movq %rsi, 0xa8(%rsp)
movq %rdx, 0xa0(%rsp)
movq %rcx, 0x98(%rsp)
movq %r8, 0x90(%rsp)
movq %r9, 0x88(%rsp)
movb $0x0, 0x87(%rsp)
movq $0x0, 0x50(%rsp)
movq $0x0, 0x48(%rsp)
movq $0x0, 0x40(%rsp)
movq $0x0, 0x38(%rsp)
movl $0x0, 0x34(%rsp)
movl $0x1, 0x30(%rsp)
movq 0xb0(%rsp), %rax
movq $0x0, (%rax)
movq 0xa0(%rsp), %rax
movl $0x0, (%rax)
movq 0xa8(%rsp), %rax
movl $0x0, (%rax)
movq 0xa8(%rsp), %rdi
movq 0xa0(%rsp), %rsi
movq 0x98(%rsp), %rdx
movq 0x90(%rsp), %rcx
movq 0x88(%rsp), %r8
callq 0x144500
movl %eax, %ecx
movq 0x98(%rsp), %rax
movl %ecx, 0x1f0(%rax)
movq 0x98(%rsp), %rax
cmpl $0x0, 0x1f0(%rax)
je 0x1464c1
jmp 0x14717d
movq 0xa8(%rsp), %rax
movl (%rax), %edi
movq 0xa0(%rsp), %rax
movl (%rax), %esi
movq 0x98(%rsp), %rdx
addq $0xb8, %rdx
addq $0x10, %rdx
movq 0x98(%rsp), %rcx
addq $0x90, %rcx
callq 0x14ff60
cmpl $0x0, %eax
je 0x146518
movq 0x98(%rsp), %rax
movl $0x5c, 0x1f0(%rax)
jmp 0x14717d
leaq 0x58(%rsp), %rdi
callq 0x148440
movq 0x90(%rsp), %rax
addq $0x21, %rax
movq %rax, 0x78(%rsp)
xorl %eax, %eax
cmpb $0x0, 0x87(%rsp)
movb %al, 0x7(%rsp)
jne 0x14655b
movq 0x98(%rsp), %rax
cmpl $0x0, 0x1f0(%rax)
setne %al
xorb $-0x1, %al
movb %al, 0x7(%rsp)
movb 0x7(%rsp), %al
testb $0x1, %al
jne 0x146568
jmp 0x146d79
movq 0x78(%rsp), %rax
movq 0x90(%rsp), %rcx
subq %rcx, %rax
addq $0xc, %rax
cmpq 0x88(%rsp), %rax
ja 0x146595
movq 0x78(%rsp), %rax
cmpq 0x90(%rsp), %rax
jae 0x1465bf
movq 0x98(%rsp), %rax
cmpl $0x0, 0x28(%rax)
je 0x1465a8
jmp 0x146d79
movq 0x98(%rsp), %rax
movl $0x1e, 0x1f0(%rax)
jmp 0x146d79
movq 0x78(%rsp), %rdi
callq 0x13ee80
movl %eax, 0x2c(%rsp)
cmpl $0x7fffffff, 0x2c(%rsp) # imm = 0x7FFFFFFF
jbe 0x146601
movq 0x98(%rsp), %rax
cmpl $0x0, 0x28(%rax)
je 0x1465ea
jmp 0x146d79
movq 0x98(%rsp), %rax
movl $0x3f, 0x1f0(%rax)
jmp 0x146d79
movq 0x78(%rsp), %rax
movq 0x90(%rsp), %rcx
subq %rcx, %rax
movl 0x2c(%rsp), %ecx
addq %rcx, %rax
addq $0xc, %rax
cmpq 0x88(%rsp), %rax
ja 0x146640
movq 0x78(%rsp), %rax
movl 0x2c(%rsp), %ecx
addq %rcx, %rax
addq $0xc, %rax
cmpq 0x90(%rsp), %rax
jae 0x146657
movq 0x98(%rsp), %rax
movl $0x40, 0x1f0(%rax)
jmp 0x146d79
movq 0x78(%rsp), %rdi
callq 0x13f040
movq %rax, 0x20(%rsp)
movl $0x0, 0x34(%rsp)
movq 0x78(%rsp), %rdi
leaq 0x31276(%rip), %rsi     # 0x1778f0
callq 0x13eee0
cmpb $0x0, %al
je 0x146740
movq 0x60(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rdi
movl 0x2c(%rsp), %eax
movl %eax, %esi
leaq 0x10(%rsp), %rdx
callq 0x13f260
cmpl $0x0, %eax
je 0x1466c2
movq 0x98(%rsp), %rax
movl $0x5f, 0x1f0(%rax)
jmp 0x146d79
movq 0x10(%rsp), %rsi
leaq 0x58(%rsp), %rdi
callq 0x14be50
cmpl $0x0, %eax
jne 0x1466ed
movq 0x98(%rsp), %rax
movl $0x53, 0x1f0(%rax)
jmp 0x146d79
movq $0x0, 0x70(%rsp)
movq 0x70(%rsp), %rax
movl 0x2c(%rsp), %ecx
cmpq %rcx, %rax
je 0x146733
movq 0x20(%rsp), %rax
movq 0x70(%rsp), %rcx
movb (%rax,%rcx), %dl
movq 0x58(%rsp), %rax
movq 0x18(%rsp), %rcx
addq 0x70(%rsp), %rcx
movb %dl, (%rax,%rcx)
movq 0x70(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x70(%rsp)
jmp 0x1466f6
movl $0x3, 0x30(%rsp)
jmp 0x146d11
movq 0x78(%rsp), %rdi
leaq 0x311a9(%rip), %rsi     # 0x1778f5
callq 0x13eee0
cmpb $0x0, %al
je 0x146762
movb $0x1, 0x87(%rsp)
jmp 0x146d0f
movq 0x78(%rsp), %rdi
leaq 0x2ff5f(%rip), %rsi     # 0x1766cd
callq 0x13eee0
cmpb $0x0, %al
je 0x1467cd
movq 0x98(%rsp), %rdi
addq $0xb8, %rdi
addq $0x10, %rdi
movq 0x20(%rsp), %rsi
movl 0x2c(%rsp), %eax
movl %eax, %edx
callq 0x144d40
movl %eax, %ecx
movq 0x98(%rsp), %rax
movl %ecx, 0x1f0(%rax)
movq 0x98(%rsp), %rax
cmpl $0x0, 0x1f0(%rax)
je 0x1467c0
jmp 0x146d79
movl $0x2, 0x30(%rsp)
jmp 0x146d0d
movq 0x78(%rsp), %rdi
leaq 0x2fef9(%rip), %rsi     # 0x1766d2
callq 0x13eee0
cmpb $0x0, %al
je 0x146830
movq 0x98(%rsp), %rdi
addq $0xb8, %rdi
addq $0x10, %rdi
movq 0x20(%rsp), %rsi
movl 0x2c(%rsp), %eax
movl %eax, %edx
callq 0x144ec0
movl %eax, %ecx
movq 0x98(%rsp), %rax
movl %ecx, 0x1f0(%rax)
movq 0x98(%rsp), %rax
cmpl $0x0, 0x1f0(%rax)
je 0x14682b
jmp 0x146d79
jmp 0x146d0b
movq 0x78(%rsp), %rdi
leaq 0x2fe9b(%rip), %rsi     # 0x1766d7
callq 0x13eee0
cmpb $0x0, %al
je 0x14688f
movq 0x98(%rsp), %rdi
addq $0xb8, %rdi
movq 0x20(%rsp), %rsi
movl 0x2c(%rsp), %eax
movl %eax, %edx
callq 0x145050
movl %eax, %ecx
movq 0x98(%rsp), %rax
movl %ecx, 0x1f0(%rax)
movq 0x98(%rsp), %rax
cmpl $0x0, 0x1f0(%rax)
je 0x14688a
jmp 0x146d79
jmp 0x146d09
movq 0x78(%rsp), %rdi
leaq 0x2fe41(%rip), %rsi     # 0x1766dc
callq 0x13eee0
cmpb $0x0, %al
je 0x1468fe
movq 0x98(%rsp), %rax
cmpl $0x0, 0x30(%rax)
je 0x1468f9
movq 0x98(%rsp), %rdi
addq $0xb8, %rdi
movq 0x20(%rsp), %rsi
movl 0x2c(%rsp), %eax
movl %eax, %edx
callq 0x1451e0
movl %eax, %ecx
movq 0x98(%rsp), %rax
movl %ecx, 0x1f0(%rax)
movq 0x98(%rsp), %rax
cmpl $0x0, 0x1f0(%rax)
je 0x1468f7
jmp 0x146d79
jmp 0x1468f9
jmp 0x146d07
movq 0x78(%rsp), %rdi
leaq 0x2fdd7(%rip), %rsi     # 0x1766e1
callq 0x13eee0
cmpb $0x0, %al
je 0x146975
movq 0x98(%rsp), %rax
cmpl $0x0, 0x30(%rax)
je 0x146970
movq 0x98(%rsp), %rdi
addq $0xb8, %rdi
movq 0x98(%rsp), %rsi
movq 0x20(%rsp), %rdx
movl 0x2c(%rsp), %eax
movl %eax, %ecx
callq 0x1453e0
movl %eax, %ecx
movq 0x98(%rsp), %rax
movl %ecx, 0x1f0(%rax)
movq 0x98(%rsp), %rax
cmpl $0x0, 0x1f0(%rax)
je 0x14696e
jmp 0x146d79
jmp 0x146970
jmp 0x146d05
movq 0x78(%rsp), %rdi
leaq 0x2fd65(%rip), %rsi     # 0x1766e6
callq 0x13eee0
cmpb $0x0, %al
je 0x1469ec
movq 0x98(%rsp), %rax
cmpl $0x0, 0x30(%rax)
je 0x1469e7
movq 0x98(%rsp), %rdi
addq $0xb8, %rdi
movq 0x98(%rsp), %rsi
movq 0x20(%rsp), %rdx
movl 0x2c(%rsp), %eax
movl %eax, %ecx
callq 0x1455e0
movl %eax, %ecx
movq 0x98(%rsp), %rax
movl %ecx, 0x1f0(%rax)
movq 0x98(%rsp), %rax
cmpl $0x0, 0x1f0(%rax)
je 0x1469e5
jmp 0x146d79
jmp 0x1469e7
jmp 0x146d03
movq 0x78(%rsp), %rdi
leaq 0x2fcf3(%rip), %rsi     # 0x1766eb
callq 0x13eee0
cmpb $0x0, %al
je 0x146a4b
movq 0x98(%rsp), %rdi
addq $0xb8, %rdi
movq 0x20(%rsp), %rsi
movl 0x2c(%rsp), %eax
movl %eax, %edx
callq 0x145aa0
movl %eax, %ecx
movq 0x98(%rsp), %rax
movl %ecx, 0x1f0(%rax)
movq 0x98(%rsp), %rax
cmpl $0x0, 0x1f0(%rax)
je 0x146a46
jmp 0x146d79
jmp 0x146d01
movq 0x78(%rsp), %rdi
leaq 0x2fc99(%rip), %rsi     # 0x1766f0
callq 0x13eee0
cmpb $0x0, %al
je 0x146aaa
movq 0x98(%rsp), %rdi
addq $0xb8, %rdi
movq 0x20(%rsp), %rsi
movl 0x2c(%rsp), %eax
movl %eax, %edx
callq 0x145b70
movl %eax, %ecx
movq 0x98(%rsp), %rax
movl %ecx, 0x1f0(%rax)
movq 0x98(%rsp), %rax
cmpl $0x0, 0x1f0(%rax)
je 0x146aa5
jmp 0x146d79
jmp 0x146cff
movq 0x78(%rsp), %rdi
leaq 0x2fc3f(%rip), %rsi     # 0x1766f5
callq 0x13eee0
cmpb $0x0, %al
je 0x146b09
movq 0x98(%rsp), %rdi
addq $0xb8, %rdi
movq 0x20(%rsp), %rsi
movl 0x2c(%rsp), %eax
movl %eax, %edx
callq 0x145c40
movl %eax, %ecx
movq 0x98(%rsp), %rax
movl %ecx, 0x1f0(%rax)
movq 0x98(%rsp), %rax
cmpl $0x0, 0x1f0(%rax)
je 0x146b04
jmp 0x146d79
jmp 0x146cfd
movq 0x78(%rsp), %rdi
leaq 0x2fbe5(%rip), %rsi     # 0x1766fa
callq 0x13eee0
cmpb $0x0, %al
je 0x146b68
movq 0x98(%rsp), %rdi
addq $0xb8, %rdi
movq 0x20(%rsp), %rsi
movl 0x2c(%rsp), %eax
movl %eax, %edx
callq 0x145cc0
movl %eax, %ecx
movq 0x98(%rsp), %rax
movl %ecx, 0x1f0(%rax)
movq 0x98(%rsp), %rax
cmpl $0x0, 0x1f0(%rax)
je 0x146b63
jmp 0x146d79
jmp 0x146cfb
movq 0x78(%rsp), %rdi
leaq 0x2fb8b(%rip), %rsi     # 0x1766ff
callq 0x13eee0
cmpb $0x0, %al
je 0x146bc7
movq 0x98(%rsp), %rdi
addq $0xb8, %rdi
movq 0x20(%rsp), %rsi
movl 0x2c(%rsp), %eax
movl %eax, %edx
callq 0x145ef0
movl %eax, %ecx
movq 0x98(%rsp), %rax
movl %ecx, 0x1f0(%rax)
movq 0x98(%rsp), %rax
cmpl $0x0, 0x1f0(%rax)
je 0x146bc2
jmp 0x146d79
jmp 0x146cf9
movq 0x78(%rsp), %rdi
leaq 0x2fb31(%rip), %rsi     # 0x176704
callq 0x13eee0
cmpb $0x0, %al
je 0x146c2e
movq 0x98(%rsp), %rdi
addq $0xb8, %rdi
movq 0x98(%rsp), %rsi
movq 0x20(%rsp), %rdx
movl 0x2c(%rsp), %eax
movl %eax, %ecx
callq 0x145f40
movl %eax, %ecx
movq 0x98(%rsp), %rax
movl %ecx, 0x1f0(%rax)
movq 0x98(%rsp), %rax
cmpl $0x0, 0x1f0(%rax)
je 0x146c29
jmp 0x146d79
jmp 0x146cf7
movq 0x98(%rsp), %rax
cmpl $0x0, 0x24(%rax)
jne 0x146c61
movq 0x78(%rsp), %rdi
callq 0x13efd0
cmpb $0x0, %al
jne 0x146c61
movq 0x98(%rsp), %rax
movl $0x45, 0x1f0(%rax)
jmp 0x146d79
movl $0x1, 0x34(%rsp)
movq 0x98(%rsp), %rax
cmpl $0x0, 0x34(%rax)
je 0x146cf5
movq 0x98(%rsp), %rdi
addq $0xb8, %rdi
addq $0x108, %rdi            # imm = 0x108
movl 0x30(%rsp), %eax
subl $0x1, %eax
movl %eax, %eax
shlq $0x3, %rax
addq %rax, %rdi
movq 0x98(%rsp), %rsi
addq $0xb8, %rsi
addq $0x120, %rsi            # imm = 0x120
movl 0x30(%rsp), %eax
subl $0x1, %eax
movl %eax, %eax
shlq $0x3, %rax
addq %rax, %rsi
movq 0x78(%rsp), %rdx
callq 0x13f4d0
movl %eax, %ecx
movq 0x98(%rsp), %rax
movl %ecx, 0x1f0(%rax)
movq 0x98(%rsp), %rax
cmpl $0x0, 0x1f0(%rax)
je 0x146cf3
jmp 0x146d79
jmp 0x146cf5
jmp 0x146cf7
jmp 0x146cf9
jmp 0x146cfb
jmp 0x146cfd
jmp 0x146cff
jmp 0x146d01
jmp 0x146d03
jmp 0x146d05
jmp 0x146d07
jmp 0x146d09
jmp 0x146d0b
jmp 0x146d0d
jmp 0x146d0f
jmp 0x146d11
movq 0x98(%rsp), %rax
cmpl $0x0, 0x20(%rax)
jne 0x146d4b
cmpl $0x0, 0x34(%rsp)
jne 0x146d4b
movq 0x78(%rsp), %rdi
callq 0x13f050
cmpl $0x0, %eax
je 0x146d49
movq 0x98(%rsp), %rax
movl $0x39, 0x1f0(%rax)
jmp 0x146d79
jmp 0x146d4b
cmpb $0x0, 0x87(%rsp)
jne 0x146d74
movq 0x78(%rsp), %rdi
movq 0x90(%rsp), %rsi
addq 0x88(%rsp), %rsi
callq 0x13f2a0
movq %rax, 0x78(%rsp)
jmp 0x146533
movq 0x98(%rsp), %rax
cmpl $0x3, 0xc8(%rax)
jne 0x146dae
movq 0x98(%rsp), %rax
cmpq $0x0, 0xd0(%rax)
jne 0x146dae
movq 0x98(%rsp), %rax
movl $0x6a, 0x1f0(%rax)
movq 0x98(%rsp), %rax
cmpl $0x0, 0xc0(%rax)
jne 0x146df5
movq 0xa8(%rsp), %rax
movl (%rax), %edi
movq 0xa0(%rsp), %rax
movl (%rax), %esi
movq 0x98(%rsp), %rdx
addq $0xb8, %rdx
addq $0x10, %rdx
callq 0x1500d0
movq %rax, 0x40(%rsp)
jmp 0x146fa1
movq 0x98(%rsp), %rax
addq $0xb8, %rax
addq $0x10, %rax
movq %rax, 0x8(%rsp)
movq $0x0, 0x40(%rsp)
movq 0xa8(%rsp), %rax
movl (%rax), %edi
addl $0x7, %edi
shrl $0x3, %edi
movq 0xa0(%rsp), %rax
movl (%rax), %esi
addl $0x7, %esi
shrl $0x3, %esi
movq 0x8(%rsp), %rdx
callq 0x1500d0
addq 0x40(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0xa8(%rsp), %rax
cmpl $0x4, (%rax)
jbe 0x146e8a
movq 0xa8(%rsp), %rax
movl (%rax), %edi
addl $0x3, %edi
shrl $0x3, %edi
movq 0xa0(%rsp), %rax
movl (%rax), %esi
addl $0x7, %esi
shrl $0x3, %esi
movq 0x8(%rsp), %rdx
callq 0x1500d0
addq 0x40(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0xa8(%rsp), %rax
movl (%rax), %edi
addl $0x3, %edi
shrl $0x2, %edi
movq 0xa0(%rsp), %rax
movl (%rax), %esi
addl $0x3, %esi
shrl $0x3, %esi
movq 0x8(%rsp), %rdx
callq 0x1500d0
addq 0x40(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0xa8(%rsp), %rax
cmpl $0x2, (%rax)
jbe 0x146eff
movq 0xa8(%rsp), %rax
movl (%rax), %edi
addl $0x1, %edi
shrl $0x2, %edi
movq 0xa0(%rsp), %rax
movl (%rax), %esi
addl $0x3, %esi
shrl $0x2, %esi
movq 0x8(%rsp), %rdx
callq 0x1500d0
addq 0x40(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0xa8(%rsp), %rax
movl (%rax), %edi
addl $0x1, %edi
shrl %edi
movq 0xa0(%rsp), %rax
movl (%rax), %esi
addl $0x1, %esi
shrl $0x2, %esi
movq 0x8(%rsp), %rdx
callq 0x1500d0
addq 0x40(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0xa8(%rsp), %rax
cmpl $0x1, (%rax)
jbe 0x146f71
movq 0xa8(%rsp), %rax
movl (%rax), %edi
addl $0x0, %edi
shrl %edi
movq 0xa0(%rsp), %rax
movl (%rax), %esi
addl $0x1, %esi
shrl %esi
movq 0x8(%rsp), %rdx
callq 0x1500d0
addq 0x40(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0xa8(%rsp), %rax
movl (%rax), %edi
addl $0x0, %edi
movq 0xa0(%rsp), %rax
movl (%rax), %esi
addl $0x0, %esi
shrl %esi
movq 0x8(%rsp), %rdx
callq 0x1500d0
addq 0x40(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x98(%rsp), %rax
cmpl $0x0, 0x1f0(%rax)
jne 0x146fe4
movq 0x40(%rsp), %rdi
callq 0x13ce80
movq %rax, 0x50(%rsp)
cmpq $0x0, 0x50(%rsp)
jne 0x146fdb
movq 0x98(%rsp), %rax
movl $0x53, 0x1f0(%rax)
movq $0x0, 0x48(%rsp)
movq 0x98(%rsp), %rax
cmpl $0x0, 0x1f0(%rax)
jne 0x147057
movq 0x58(%rsp), %rdx
movq 0x60(%rsp), %rcx
movq 0x98(%rsp), %r8
leaq 0x50(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x14aac0
movl %eax, %ecx
movq 0x98(%rsp), %rax
movl %ecx, 0x1f0(%rax)
movq 0x98(%rsp), %rax
cmpl $0x0, 0x1f0(%rax)
jne 0x147055
movq 0x48(%rsp), %rax
cmpq 0x40(%rsp), %rax
je 0x147055
movq 0x98(%rsp), %rax
movl $0x5b, 0x1f0(%rax)
jmp 0x147057
leaq 0x58(%rsp), %rdi
callq 0x14ff20
movq 0x98(%rsp), %rax
cmpl $0x0, 0x1f0(%rax)
jne 0x1470dd
movq 0xa8(%rsp), %rax
movl (%rax), %edi
movq 0xa0(%rsp), %rax
movl (%rax), %esi
movq 0x98(%rsp), %rdx
addq $0xb8, %rdx
addq $0x10, %rdx
callq 0x13fd60
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rdi
callq 0x13ce80
movq %rax, %rcx
movq 0xb0(%rsp), %rax
movq %rcx, (%rax)
movq 0xb0(%rsp), %rax
cmpq $0x0, (%rax)
jne 0x1470db
movq 0x98(%rsp), %rax
movl $0x53, 0x1f0(%rax)
jmp 0x1470dd
movq 0x98(%rsp), %rax
cmpl $0x0, 0x1f0(%rax)
jne 0x147173
movq $0x0, 0x70(%rsp)
movq 0x70(%rsp), %rax
cmpq 0x38(%rsp), %rax
jae 0x14712b
movq 0xb0(%rsp), %rax
movq (%rax), %rax
movq 0x70(%rsp), %rcx
movb $0x0, (%rax,%rcx)
movq 0x70(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x70(%rsp)
jmp 0x1470fb
movq 0xb0(%rsp), %rax
movq (%rax), %rdi
movq 0x50(%rsp), %rsi
movq 0xa8(%rsp), %rax
movl (%rax), %edx
movq 0xa0(%rsp), %rax
movl (%rax), %ecx
movq 0x98(%rsp), %r8
addq $0xb8, %r8
callq 0x150140
movl %eax, %ecx
movq 0x98(%rsp), %rax
movl %ecx, 0x1f0(%rax)
movq 0x50(%rsp), %rdi
callq 0x13e2d0
addq $0xb8, %rsp
retq
nopw %cs:(%rax,%rax)