// File: /workspace/github_c_makefile_star2_O2/archer1357[P]Offline-Raytracer/stb_image.c
// Function: stbi__parse_png_file
static int stbi__parse_png_file(stbi__png *z, int scan, int req_comp)
{
   stbi_uc palette[1024], pal_img_n=0;
   stbi_uc has_trans=0, tc[3];
   stbi__uint32 ioff=0, idata_limit=0, i, pal_len=0;
   int first=1,k,interlace=0, is_iphone=0;
   stbi__context *s = z->s;

   z->expanded = NULL;
   z->idata = NULL;
   z->out = NULL;

   if (!stbi__check_png_header(s)) return 0;

   if (scan == SCAN_type) return 1;

   for (;;) {
      stbi__pngchunk c = stbi__get_chunk_header(s);
      switch (c.type) {
         case PNG_TYPE('C','g','B','I'):
            is_iphone = 1;
            stbi__skip(s, c.length);
            break;
         case PNG_TYPE('I','H','D','R'): {
            int depth,color,comp,filter;
            if (!first) return stbi__err("multiple IHDR","Corrupt PNG");
            first = 0;
            if (c.length != 13) return stbi__err("bad IHDR len","Corrupt PNG");
            s->img_x = stbi__get32be(s); if (s->img_x > (1 << 24)) return stbi__err("too large","Very large image (corrupt?)");
            s->img_y = stbi__get32be(s); if (s->img_y > (1 << 24)) return stbi__err("too large","Very large image (corrupt?)");
            depth = stbi__get8(s);  if (depth != 8)        return stbi__err("8bit only","PNG not supported: 8-bit only");
            color = stbi__get8(s);  if (color > 6)         return stbi__err("bad ctype","Corrupt PNG");
            if (color == 3) pal_img_n = 3; else if (color & 1) return stbi__err("bad ctype","Corrupt PNG");
            comp  = stbi__get8(s);  if (comp) return stbi__err("bad comp method","Corrupt PNG");
            filter= stbi__get8(s);  if (filter) return stbi__err("bad filter method","Corrupt PNG");
            interlace = stbi__get8(s); if (interlace>1) return stbi__err("bad interlace method","Corrupt PNG");
            if (!s->img_x || !s->img_y) return stbi__err("0-pixel image","Corrupt PNG");
            if (!pal_img_n) {
               s->img_n = (color & 2 ? 3 : 1) + (color & 4 ? 1 : 0);
               if ((1 << 30) / s->img_x / s->img_n < s->img_y) return stbi__err("too large", "Image too large to decode");
               if (scan == SCAN_header) return 1;
            } else {
               // if paletted, then pal_n is our final components, and
               // img_n is # components to decompress/filter.
               s->img_n = 1;
               if ((1 << 30) / s->img_x / 4 < s->img_y) return stbi__err("too large","Corrupt PNG");
               // if SCAN_header, have to scan to see if we have a tRNS
            }
            break;
         }

         case PNG_TYPE('P','L','T','E'):  {
            if (first) return stbi__err("first not IHDR", "Corrupt PNG");
            if (c.length > 256*3) return stbi__err("invalid PLTE","Corrupt PNG");
            pal_len = c.length / 3;
            if (pal_len * 3 != c.length) return stbi__err("invalid PLTE","Corrupt PNG");
            for (i=0; i < pal_len; ++i) {
               palette[i*4+0] = stbi__get8(s);
               palette[i*4+1] = stbi__get8(s);
               palette[i*4+2] = stbi__get8(s);
               palette[i*4+3] = 255;
            }
            break;
         }

         case PNG_TYPE('t','R','N','S'): {
            if (first) return stbi__err("first not IHDR", "Corrupt PNG");
            if (z->idata) return stbi__err("tRNS after IDAT","Corrupt PNG");
            if (pal_img_n) {
               if (scan == SCAN_header) { s->img_n = 4; return 1; }
               if (pal_len == 0) return stbi__err("tRNS before PLTE","Corrupt PNG");
               if (c.length > pal_len) return stbi__err("bad tRNS len","Corrupt PNG");
               pal_img_n = 4;
               for (i=0; i < c.length; ++i)
                  palette[i*4+3] = stbi__get8(s);
            } else {
               if (!(s->img_n & 1)) return stbi__err("tRNS with alpha","Corrupt PNG");
               if (c.length != (stbi__uint32) s->img_n*2) return stbi__err("bad tRNS len","Corrupt PNG");
               has_trans = 1;
               for (k=0; k < s->img_n; ++k)
                  tc[k] = (stbi_uc) (stbi__get16be(s) & 255); // non 8-bit images will be larger
            }
            break;
         }

         case PNG_TYPE('I','D','A','T'): {
            if (first) return stbi__err("first not IHDR", "Corrupt PNG");
            if (pal_img_n && !pal_len) return stbi__err("no PLTE","Corrupt PNG");
            if (scan == SCAN_header) { s->img_n = pal_img_n; return 1; }
            if (ioff + c.length > idata_limit) {
               stbi_uc *p;
               if (idata_limit == 0) idata_limit = c.length > 4096 ? c.length : 4096;
               while (ioff + c.length > idata_limit)
                  idata_limit *= 2;
               p = (stbi_uc *) realloc(z->idata, idata_limit); if (p == NULL) return stbi__err("outofmem", "Out of memory");
               z->idata = p;
            }
            if (!stbi__getn(s, z->idata+ioff,c.length)) return stbi__err("outofdata","Corrupt PNG");
            ioff += c.length;
            break;
         }

         case PNG_TYPE('I','E','N','D'): {
            stbi__uint32 raw_len;
            if (first) return stbi__err("first not IHDR", "Corrupt PNG");
            if (scan != SCAN_load) return 1;
            if (z->idata == NULL) return stbi__err("no IDAT","Corrupt PNG");
            z->expanded = (stbi_uc *) stbi_zlib_decode_malloc_guesssize_headerflag((char *) z->idata, ioff, 16384, (int *) &raw_len, !is_iphone);
            if (z->expanded == NULL) return 0; // zlib should set error
            free(z->idata); z->idata = NULL;
            if ((req_comp == s->img_n+1 && req_comp != 3 && !pal_img_n) || has_trans)
               s->img_out_n = s->img_n+1;
            else
               s->img_out_n = s->img_n;
            if (!stbi__create_png_image(z, z->expanded, raw_len, s->img_out_n, interlace)) return 0;
            if (has_trans)
               if (!stbi__compute_transparency(z, tc, s->img_out_n)) return 0;
            if (is_iphone && stbi__de_iphone_flag && s->img_out_n > 2)
               stbi__de_iphone(z);
            if (pal_img_n) {
               // pal_img_n == 3 or 4
               s->img_n = pal_img_n; // record the actual colors we had
               s->img_out_n = pal_img_n;
               if (req_comp >= 3) s->img_out_n = req_comp;
               if (!stbi__expand_png_palette(z, palette, pal_len, s->img_out_n))
                  return 0;
            }
            free(z->expanded); z->expanded = NULL;
            return 1;
         }

         default:
            // if critical, fail
            if (first) return stbi__err("first not IHDR", "Corrupt PNG");
            if ((c.type & (1 << 29)) == 0) {
               #ifndef STBI_NO_FAILURE_STRINGS
               // not threadsafe
               static char invalid_chunk[] = "XXXX PNG chunk not known";
               invalid_chunk[0] = STBI__BYTECAST(c.type >> 24);
               invalid_chunk[1] = STBI__BYTECAST(c.type >> 16);
               invalid_chunk[2] = STBI__BYTECAST(c.type >>  8);
               invalid_chunk[3] = STBI__BYTECAST(c.type >>  0);
               #endif
               return stbi__err(invalid_chunk, "PNG not supported: unknown PNG chunk type");
            }
            stbi__skip(s, c.length);
            break;
      }
      // end of PNG chunk, read and skip CRC
      stbi__get32be(s);
   }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x498, %rsp            # imm = 0x498
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %rbx
movq (%rdi), %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdi)
andq $0x0, 0x18(%rdi)
movq %r15, %rdi
callq 0x40e8df
testl %eax, %eax
je 0x40eda4
cmpl $0x1, %r14d
jne 0x40e976
pushq $0x1
popq %rbx
jmp 0x40eda6
movl %r14d, 0x20(%rsp)
movl %ebp, 0x14(%rsp)
movq %rbx, 0x40(%rsp)
leaq 0x8(%rbx), %rax
movq %rax, 0x38(%rsp)
pushq $0x1
popq %r12
movl $0x0, 0xc(%rsp)
movl $0x0, 0x34(%rsp)
movq $0x0, 0x28(%rsp)
xorl %r13d, %r13d
movq $0x0, 0x18(%rsp)
movq $0x0, 0x58(%rsp)
xorl %r14d, %r14d
movq %r15, %rdi
callq 0x40f7c7
movl %eax, %ebp
movq %r15, %rdi
callq 0x40f7c7
cmpl $0x43674249, %eax       # imm = 0x43674249
je 0x40eb87
cmpl $0x49444154, %eax       # imm = 0x49444154
je 0x40ec1f
cmpl $0x49484452, %eax       # imm = 0x49484452
je 0x40ea2d
cmpl $0x504c5445, %eax       # imm = 0x504C5445
je 0x40eb9d
cmpl $0x74524e53, %eax       # imm = 0x74524E53
je 0x40eb23
cmpl $0x49454e44, %eax       # imm = 0x49454E44
je 0x40ed8d
testl %r12d, %r12d
jne 0x40ed96
xorl %r12d, %r12d
btl $0x1d, %eax
jb 0x40eb8e
jmp 0x40edd5
testl %r12d, %r12d
je 0x40edba
cmpl $0xd, %ebp
jne 0x40edc3
movq %r15, %rdi
callq 0x40f7c7
movl %eax, (%r15)
cmpl $0x1000001, %eax        # imm = 0x1000001
jae 0x40ed69
movq %r15, %rdi
callq 0x40f7c7
movl %eax, 0x4(%r15)
cmpl $0x1000001, %eax        # imm = 0x1000001
jae 0x40ed69
movq %r15, %rdi
callq 0x40dd8f
cmpb $0x8, %al
jne 0x40ee15
movq %r15, %rdi
callq 0x40dd8f
cmpb $0x7, %al
jae 0x40ed84
movl %eax, %ebp
movzbl %al, %r12d
movb $0x3, %bl
cmpl $0x3, %r12d
je 0x40eaa7
movl %r14d, %ebx
testb $0x1, %bpl
jne 0x40ed84
movq %r15, %rdi
callq 0x40dd8f
testb %al, %al
jne 0x40ee21
movq %r15, %rdi
callq 0x40dd8f
testb %al, %al
jne 0x40ee2d
movq %r15, %rdi
callq 0x40dd8f
cmpb $0x2, %al
jae 0x40ee39
movl (%r15), %esi
testl %esi, %esi
je 0x40ed7b
movl 0x4(%r15), %ecx
testl %ecx, %ecx
je 0x40ed7b
movzbl %al, %r8d
testb %bl, %bl
movl %r8d, 0xc(%rsp)
je 0x40ed29
movl $0x1, 0x8(%r15)
xorl %r12d, %r12d
movl $0x40000000, %eax       # imm = 0x40000000
xorl %edx, %edx
divl %esi
shrl $0x2, %eax
cmpl %ecx, %eax
jae 0x40ecd6
jmp 0x40ed69
testl %r12d, %r12d
jne 0x40ed96
movq 0x38(%rsp), %rax
cmpq $0x0, (%rax)
jne 0x40edcc
testb %r14b, %r14b
je 0x40ece6
cmpl $0x2, 0x20(%rsp)
movq 0x28(%rsp), %rax
je 0x40ee45
testl %eax, %eax
je 0x40ee52
cmpl %ebp, %eax
jb 0x40ee0c
movl %ebp, %ebx
xorl %r14d, %r14d
cmpq %r14, %rbx
je 0x40eca3
movq %r15, %rdi
callq 0x40dd8f
movb %al, 0x93(%rsp,%r14,4)
incq %r14
jmp 0x40eb69
pushq $0x1
popq %rax
movl %eax, 0x34(%rsp)
movq %r15, %rdi
movl %ebp, %esi
callq 0x40df66
jmp 0x40ecd3
testl %r12d, %r12d
jne 0x40ed96
cmpl $0x301, %ebp            # imm = 0x301
jae 0x40ed72
movl %ebp, %eax
xorl %edx, %edx
movw $0x3, %cx
divw %cx
movzwl %ax, %ecx
leal (%rcx,%rcx,2), %eax
cmpl %ebp, %eax
jne 0x40ed72
movq %r14, %rbp
movq %rcx, 0x28(%rsp)
movl %ecx, %ebx
xorl %r14d, %r14d
cmpq %r14, %rbx
je 0x40ec9c
movq %r15, %rdi
callq 0x40dd8f
movb %al, 0x90(%rsp,%r14,4)
movq %r15, %rdi
callq 0x40dd8f
movb %al, 0x91(%rsp,%r14,4)
movq %r15, %rdi
callq 0x40dd8f
movb %al, 0x92(%rsp,%r14,4)
movb $-0x1, 0x93(%rsp,%r14,4)
incq %r14
jmp 0x40ebd8
testl %r12d, %r12d
jne 0x40ed96
testb %r14b, %r14b
je 0x40ec38
cmpl $0x0, 0x28(%rsp)
je 0x40eded
cmpl $0x2, 0x20(%rsp)
je 0x40edf6
movq 0x18(%rsp), %rcx
leal (%rcx,%rbp), %ebx
cmpl %r13d, %ebx
jbe 0x40ecaa
cmpl $0x1001, %ebp           # imm = 0x1001
movl %ebp, %eax
movl $0x1000, %ecx           # imm = 0x1000
cmovbl %ecx, %eax
testl %r13d, %r13d
cmovnel %r13d, %eax
movq 0x38(%rsp), %r12
movl %eax, %r13d
leal (,%r13,2), %eax
cmpl %r13d, %ebx
ja 0x40ec6c
movq (%r12), %rdi
movl %r13d, %esi
callq 0x4427f0
testq %rax, %rax
je 0x40f35d
movq %rax, (%r12)
movq 0x18(%rsp), %rcx
jmp 0x40ecb2
xorl %r12d, %r12d
movl %ebp, %ebx
jmp 0x40ecd6
movb $0x4, %bl
xorl %r12d, %r12d
jmp 0x40ecd6
movq 0x38(%rsp), %rax
movq (%rax), %rax
movl %ecx, %esi
addq %rax, %rsi
movq %r15, %rdi
movl %ebp, %edx
callq 0x40f7e8
testl %eax, %eax
je 0x40ee03
xorl %r12d, %r12d
movl %ebx, %eax
movq %rax, 0x18(%rsp)
movl %r14d, %ebx
movq %r15, %rdi
callq 0x40f7c7
movl %ebx, %r14d
jmp 0x40e9c2
movl 0x8(%r15), %eax
testb $0x1, %al
je 0x40f102
leal (%rax,%rax), %ecx
cmpl %ebp, %ecx
jne 0x40ee0c
xorl %ebx, %ebx
cltq
cmpq %rax, %rbx
jge 0x40ed1b
movq %r15, %rdi
callq 0x40de10
movb %al, 0x11(%rsp,%rbx)
incq %rbx
movl 0x8(%r15), %eax
jmp 0x40ecff
movb $0x1, %al
movq %rax, 0x58(%rsp)
xorl %r12d, %r12d
xorl %ebx, %ebx
jmp 0x40ecd6
andl $0x2, %r12d
xorl %eax, %eax
cmpb $0x4, %bpl
setae %al
leal (%rax,%r12), %edi
incl %edi
movl %edi, 0x8(%r15)
movl $0x40000000, %eax       # imm = 0x40000000
xorl %edx, %edx
divl %esi
xorl %edx, %edx
divl %edi
cmpl %ecx, %eax
jb 0x40ed69
xorl %r12d, %r12d
movl $0x0, %ebx
cmpl $0x2, 0x20(%rsp)
jne 0x40ecd6
jmp 0x40e96e
leaq 0xcfa6f(%rip), %rax     # 0x4de7df
jmp 0x40ed9d
leaq 0xc5c6a(%rip), %rax     # 0x4d49e3
jmp 0x40ed9d
leaq 0xc5c44(%rip), %rax     # 0x4d49c6
jmp 0x40ed9d
leaq 0xc5bfa(%rip), %rax     # 0x4d4985
jmp 0x40ed9d
testl %r12d, %r12d
je 0x40ee5e
leaq 0xc5c37(%rip), %rax     # 0x4d49d4
movq %rax, 0x10a79c(%rip)    # 0x519540
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x498, %rsp            # imm = 0x498
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc5b9f(%rip), %rax     # 0x4d4960
jmp 0x40ed9d
leaq 0xc5ba4(%rip), %rax     # 0x4d496e
jmp 0x40ed9d
leaq 0xc5c1d(%rip), %rax     # 0x4d49f0
jmp 0x40ed9d
leaq 0x107464(%rip), %rcx    # 0x516240
bswapl %eax
movl %eax, 0x10745c(%rip)    # 0x516240
movq %rcx, 0x10a755(%rip)    # 0x519540
jmp 0x40eda4
leaq 0xc5c3a(%rip), %rax     # 0x4d4a2e
jmp 0x40ed9d
movzbl %r14b, %eax
movl %eax, 0x8(%r15)
jmp 0x40e96e
leaq 0xc5c2c(%rip), %rax     # 0x4d4a36
jmp 0x40ed9d
leaq 0xc5bfe(%rip), %rax     # 0x4d4a11
jmp 0x40ed9d
leaq 0xc5b5f(%rip), %rax     # 0x4d497b
jmp 0x40ed9d
leaq 0xc5b67(%rip), %rax     # 0x4d498f
jmp 0x40ed9d
leaq 0xc5b6b(%rip), %rax     # 0x4d499f
jmp 0x40ed9d
leaq 0xc5b71(%rip), %rax     # 0x4d49b1
jmp 0x40ed9d
movl $0x4, 0x8(%r15)
jmp 0x40e96e
leaq 0xc5ba7(%rip), %rax     # 0x4d4a00
jmp 0x40ed9d
pushq $0x1
popq %rbx
cmpl $0x0, 0x20(%rsp)
jne 0x40eda6
movq 0x38(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x40f10e
xorl %r8d, %r8d
cmpl $0x0, 0x34(%rsp)
sete %r8b
leaq 0x6c(%rsp), %rcx
movq 0x18(%rsp), %rsi
movl $0x4000, %edx           # imm = 0x4000
callq 0x40cefb
movq 0x40(%rsp), %r13
movq %rax, 0x10(%r13)
testq %rax, %rax
je 0x40eda4
movq 0x8(%r13), %rdi
callq 0x4424a0
andq $0x0, 0x8(%r13)
movl 0x8(%r15), %eax
leal 0x1(%rax), %ecx
cmpb $0x0, 0x58(%rsp)
cmovnel %ecx, %eax
movl 0x14(%rsp), %ebp
cmpl $0x3, %ebp
movl %eax, %r12d
cmovnel %ecx, %r12d
testb %r14b, %r14b
cmovnel %eax, %r12d
cmpl %ebp, %ecx
cmovnel %eax, %r12d
movl %r12d, 0xc(%r15)
movq (%r13), %rax
movq 0x10(%r13), %rsi
movl 0x6c(%rsp), %edx
movl (%rax), %r8d
movl 0x4(%rax), %r9d
cmpl $0x0, 0xc(%rsp)
je 0x40f12c
imull %r12d, %r8d
imull %r9d, %r8d
movq %r8, %rdi
movl %edx, %ebx
movq %rsi, %rbp
callq 0x442160
movq %rbp, %rsi
movl %ebx, %r8d
movq %rax, 0x50(%rsp)
movl %r12d, 0x48(%rsp)
movslq %r12d, %rbp
xorl %r10d, %r10d
leaq 0xc5535(%rip), %r11     # 0x4d4470
leaq 0xc556e(%rip), %rbx     # 0x4d44b0
movq %r14, 0x80(%rsp)
cmpq $0x7, %r10
je 0x40f11a
movq %r13, %r12
movq (%r13), %rdi
movslq (%r11,%r10,4), %rax
movslq (%rbx,%r10,4), %r13
movq %rax, 0x20(%rsp)
movl %eax, %r9d
notl %r9d
addl (%rdi), %r9d
addl %r13d, %r9d
movl %r9d, %eax
xorl %edx, %edx
divl %r13d
movl %eax, 0x4c(%rsp)
leaq 0xc5509(%rip), %rax     # 0x4d4490
movl (%rax,%r10,4), %ecx
movl %ecx, 0x18(%rsp)
notl %ecx
addl 0x4(%rdi), %ecx
leaq 0xc5535(%rip), %rax     # 0x4d44d0
movl (%rax,%r10,4), %edi
addl %edi, %ecx
movl %ecx, %eax
xorl %edx, %edx
divl %edi
movq %r13, 0x28(%rsp)
cmpl %r9d, %r13d
ja 0x40f0af
movl %edi, 0xc(%rsp)
cmpl %ecx, %edi
ja 0x40f0af
movq %r10, 0x70(%rsp)
movq %r12, %rdi
movq %rsi, 0x78(%rsp)
movl %r8d, 0x68(%rsp)
movl %r8d, %edx
movl 0x48(%rsp), %ebx
movl %ebx, %ecx
movl 0x4c(%rsp), %r13d
movl %r13d, %r8d
movl %eax, %r9d
movl %eax, %r12d
callq 0x40f888
testl %eax, %eax
je 0x40f21f
movslq %r13d, %r13
movl %r12d, 0x64(%rsp)
movslq %r12d, %rax
movq %rax, 0x88(%rsp)
movl 0x18(%rsp), %eax
imull %ebx, %eax
movl %eax, 0x18(%rsp)
movl 0xc(%rsp), %ecx
imull %ebx, %ecx
movq 0x20(%rsp), %r12
imulq %rbp, %r12
addq 0x50(%rsp), %r12
movq %r12, 0x20(%rsp)
movq 0x28(%rsp), %rax
imulq %rbp, %rax
movq %rax, 0x28(%rsp)
xorl %eax, %eax
movl %ecx, 0xc(%rsp)
cmpq 0x88(%rsp), %rax
jge 0x40f0b4
movq %rax, 0x38(%rsp)
movq %rax, %r14
imulq %r13, %r14
movq 0x20(%rsp), %r12
xorl %ebx, %ebx
cmpq %r13, %rbx
jge 0x40f095
movq 0x40(%rsp), %rcx
movq (%rcx), %rax
movl (%rax), %edi
imull 0x18(%rsp), %edi
addq %r12, %rdi
leaq (%rbx,%r14), %rsi
imulq %rbp, %rsi
addq 0x18(%rcx), %rsi
movq %rbp, %rdx
callq 0x401060
incq %rbx
addq 0x28(%rsp), %r12
jmp 0x40f060
movq 0x38(%rsp), %rax
incq %rax
movl 0xc(%rsp), %ecx
addl %ecx, 0x18(%rsp)
movq 0x80(%rsp), %r14
jmp 0x40f043
movq %r12, %r13
jmp 0x40f0fa
movq 0x40(%rsp), %r13
movq 0x18(%r13), %rdi
callq 0x4424a0
movl 0x4c(%rsp), %eax
imull 0x48(%rsp), %eax
incl %eax
movl 0x64(%rsp), %ecx
imull %eax, %ecx
movslq %ecx, %rax
movq 0x78(%rsp), %rsi
addq %rax, %rsi
movl 0x68(%rsp), %r8d
subl %eax, %r8d
movq 0x70(%rsp), %r10
leaq 0xc537d(%rip), %r11     # 0x4d4470
leaq 0xc53b6(%rip), %rbx     # 0x4d44b0
incq %r10
jmp 0x40ef4a
leaq 0xc5915(%rip), %rax     # 0x4d4a1e
jmp 0x40ed9d
leaq 0xc592b(%rip), %rax     # 0x4d4a40
jmp 0x40ed9d
movq 0x50(%rsp), %rax
movq %rax, 0x18(%r13)
pushq $0x1
popq %rbx
movl 0x14(%rsp), %ebp
jmp 0x40f13f
movq %r13, %rdi
movl %r12d, %ecx
callq 0x40f888
testl %eax, %eax
je 0x40eda4
cmpb $0x0, 0x58(%rsp)
je 0x40f1bb
movl 0xc(%r15), %edx
movq (%r13), %rcx
movq 0x18(%r13), %rax
movl 0x4(%rcx), %esi
imull (%rcx), %esi
movl %esi, %ecx
cmpl $0x4, %edx
je 0x40f186
cmpl $0x2, %edx
jne 0x40f3a5
movb 0x11(%rsp), %dl
xorl %esi, %esi
cmpl %esi, %ecx
je 0x40f1bb
cmpb %dl, (%rax,%rsi,2)
setne %dil
negb %dil
movb %dil, 0x1(%rax,%rsi,2)
incq %rsi
jmp 0x40f16e
movb 0x11(%rsp), %dl
movb 0x12(%rsp), %sil
movb 0x13(%rsp), %dil
xorl %r8d, %r8d
cmpl %r8d, %ecx
je 0x40f1bb
cmpb %dl, (%rax,%r8,4)
jne 0x40f1b6
cmpb %sil, 0x1(%rax,%r8,4)
jne 0x40f1b6
cmpb %dil, 0x2(%rax,%r8,4)
jne 0x40f1b6
movb $0x0, 0x3(%rax,%r8,4)
incq %r8
jmp 0x40f197
cmpl $0x0, 0x34(%rsp)
je 0x40f2d8
cmpl $0x0, 0x10a37f(%rip)    # 0x51954c
je 0x40f2d8
cmpl $0x3, 0xc(%r15)
jl 0x40f2d8
movq (%r13), %rdx
movq 0x18(%r13), %rsi
movl 0x4(%rdx), %eax
movl 0xc(%rdx), %ecx
imull (%rdx), %eax
cmpl $0x4, %ecx
je 0x40f22e
cmpl $0x3, %ecx
jne 0x40f3c4
movq 0x40(%rsp), %r13
movl 0x14(%rsp), %ebp
subl $0x1, %eax
jb 0x40f2d8
movb (%rsi), %cl
movb 0x2(%rsi), %dl
movb %dl, (%rsi)
movb %cl, 0x2(%rsi)
addq $0x3, %rsi
jmp 0x40f206
movq 0x50(%rsp), %rdi
callq 0x4424a0
jmp 0x40eda4
cmpl $0x0, 0x10a313(%rip)    # 0x519548
je 0x40f2b2
movl %eax, %edi
xorl %r8d, %r8d
movq 0x40(%rsp), %r13
movl 0x14(%rsp), %ebp
cmpl %r8d, %edi
je 0x40f2d8
movzbl 0x3(%rsi,%r8,4), %r9d
movb (%rsi,%r8,4), %al
movb 0x2(%rsi,%r8,4), %cl
testw %r9w, %r9w
je 0x40f2a4
movzbl %al, %r10d
movzbl %cl, %eax
movzwl %ax, %eax
imull $0xff, %eax, %eax
xorl %edx, %edx
divw %r9w
movzbl 0x1(%rsi,%r8,4), %ecx
imull $0xff, %ecx, %edx
movl %eax, %ecx
movl %edx, %eax
xorl %edx, %edx
divw %r9w
movb %al, 0x1(%rsi,%r8,4)
movzwl %r10w, %eax
imull $0xff, %eax, %eax
xorl %edx, %edx
divw %r9w
movb %cl, (%rsi,%r8,4)
movb %al, 0x2(%rsi,%r8,4)
incq %r8
jmp 0x40f245
movl %eax, %eax
xorl %ecx, %ecx
movq 0x40(%rsp), %r13
movl 0x14(%rsp), %ebp
cmpl %ecx, %eax
je 0x40f2d8
movb (%rsi,%rcx,4), %dl
movb 0x2(%rsi,%rcx,4), %dil
movb %dil, (%rsi,%rcx,4)
movb %dl, 0x2(%rsi,%rcx,4)
incq %rcx
jmp 0x40f2bf
testb %r14b, %r14b
je 0x40f392
movq %r14, %rax
movl %ebx, %r14d
movzbl %al, %ebx
movl %ebx, 0x8(%r15)
cmpl $0x3, %ebp
cmovgel %ebp, %ebx
movl %ebx, 0xc(%r15)
movq (%r13), %rax
movq 0x18(%r13), %r15
movl 0x4(%rax), %ebp
imull (%rax), %ebp
movl %ebp, %edi
imull %ebx, %edi
callq 0x442160
testq %rax, %rax
je 0x40f35d
movq %rax, %r12
movl %ebp, %eax
xorl %ecx, %ecx
cmpl $0x3, %ebx
jne 0x40f369
movq %r12, %rdx
movl %r14d, %ebx
cmpq %rcx, %rax
je 0x40f386
movzbl (%r15,%rcx), %esi
movb 0x90(%rsp,%rsi,4), %dil
movb %dil, (%rdx)
movb 0x91(%rsp,%rsi,4), %dil
movb %dil, 0x1(%rdx)
movb 0x92(%rsp,%rsi,4), %sil
movb %sil, 0x2(%rdx)
addq $0x3, %rdx
incq %rcx
jmp 0x40f327
leaq 0xc54db(%rip), %rax     # 0x4d483f
jmp 0x40ed9d
movl %r14d, %ebx
cmpq %rcx, %rax
je 0x40f386
movzbl (%r15,%rcx), %edx
movl 0x90(%rsp,%rdx,4), %edx
movl %edx, (%r12,%rcx,4)
incq %rcx
jmp 0x40f36c
movq %r15, %rdi
callq 0x4424a0
movq %r12, 0x18(%r13)
movq 0x10(%r13), %rdi
callq 0x4424a0
andq $0x0, 0x10(%r13)
jmp 0x40eda6
leaq 0xc575d(%rip), %rdi     # 0x4d4b09
leaq 0xc555b(%rip), %rsi     # 0x4d490e
leaq 0xc5768(%rip), %rcx     # 0x4d4b22
movl $0x8dc, %edx            # imm = 0x8DC
callq 0x41d270
leaq 0xc5793(%rip), %rdi     # 0x4d4b5e
leaq 0xc553c(%rip), %rsi     # 0x4d490e
leaq 0xc5797(%rip), %rcx     # 0x4d4b70
movl $0x92d, %edx            # imm = 0x92D
callq 0x41d270