// File: srajangarg[P]raytracer/src/core/stb_image.hpp
// Function: stbi__parse_png_file(stbi__png*, int, int)
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, color=0, depth=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 == STBI__SCAN_type) return 1;

   for (;;) {
      stbi__pngchunk c = stbi__get_chunk_header(s);
      switch (c.type) {
         case STBI__PNG_TYPE('C','g','B','I'):
            is_iphone = 1;
            stbi__skip(s, c.length);
            break;
         case STBI__PNG_TYPE('I','H','D','R'): {
            int 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 != 1 && depth != 2 && depth != 4 && depth != 8)  return stbi__err("1/2/4/8-bit only","PNG not supported: 1/2/4/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 == STBI__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 STBI__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 STBI__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 == STBI__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) * stbi__depth_scale_table[depth]; // non 8-bit images will be larger
            }
            break;
         }

         case STBI__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 == STBI__SCAN_header) { s->img_n = pal_img_n; return 1; }
            if ((int)(ioff + c.length) < (int)ioff) return 0;
            if (ioff + c.length > idata_limit) {
               stbi__uint32 idata_limit_old = 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;
               STBI_NOTUSED(idata_limit_old);
               p = (stbi_uc *) STBI_REALLOC_SIZED(z->idata, idata_limit_old, 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 STBI__PNG_TYPE('I','E','N','D'): {
            stbi__uint32 raw_len, bpl;
            if (first) return stbi__err("first not IHDR", "Corrupt PNG");
            if (scan != STBI__SCAN_load) return 1;
            if (z->idata == NULL) return stbi__err("no IDAT","Corrupt PNG");
            // initial guess for decoded data size to avoid unnecessary reallocs
            bpl = (s->img_x * depth + 7) / 8; // bytes per line, per component
            raw_len = bpl * s->img_y * s->img_n /* pixels */ + s->img_y /* filter mode per row */;
            z->expanded = (stbi_uc *) stbi_zlib_decode_malloc_guesssize_headerflag((char *) z->idata, ioff, raw_len, (int *) &raw_len, !is_iphone);
            if (z->expanded == NULL) return 0; // zlib should set error
            STBI_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, depth, color, 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;
            }
            STBI_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
movq %rsp, %rbp
subq $0x490, %rsp            # imm = 0x490
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movb $0x0, -0x421(%rbp)
movb $0x0, -0x422(%rbp)
movl $0x0, -0x42c(%rbp)
movl $0x0, -0x430(%rbp)
movl $0x0, -0x438(%rbp)
movl $0x1, -0x43c(%rbp)
movl $0x0, -0x444(%rbp)
movl $0x0, -0x448(%rbp)
movl $0x0, -0x44c(%rbp)
movl $0x0, -0x450(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x458(%rbp)
movq -0x10(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x458(%rbp), %rdi
callq 0x300c0
cmpl $0x0, %eax
jne 0x30372
movl $0x0, -0x4(%rbp)
jmp 0x30f1e
cmpl $0x1, -0x14(%rbp)
jne 0x30384
movl $0x1, -0x4(%rbp)
jmp 0x30f1e
jmp 0x30386
movq -0x458(%rbp), %rdi
callq 0x314e0
movq %rax, -0x460(%rbp)
movl -0x45c(%rbp), %eax
movl %eax, -0x484(%rbp)
subl $0x43674249, %eax       # imm = 0x43674249
je 0x3040c
jmp 0x303ae
movl -0x484(%rbp), %eax
subl $0x49444154, %eax       # imm = 0x49444154
je 0x30a2c
jmp 0x303c1
movl -0x484(%rbp), %eax
subl $0x49454e44, %eax       # imm = 0x49454E44
je 0x30bd4
jmp 0x303d4
movl -0x484(%rbp), %eax
subl $0x49484452, %eax       # imm = 0x49484452
je 0x3042d
jmp 0x303e3
movl -0x484(%rbp), %eax
subl $0x504c5445, %eax       # imm = 0x504C5445
je 0x3073f
jmp 0x303f6
movl -0x484(%rbp), %eax
subl $0x74524e53, %eax       # imm = 0x74524E53
je 0x30868
jmp 0x30e6d
movl $0x1, -0x450(%rbp)
movq -0x458(%rbp), %rdi
movl -0x460(%rbp), %esi
callq 0x2d340
jmp 0x30f0d
cmpl $0x0, -0x43c(%rbp)
jne 0x3044a
leaq 0x17d56(%rip), %rdi     # 0x48193
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
movl $0x0, -0x43c(%rbp)
cmpl $0xd, -0x460(%rbp)
je 0x30471
leaq 0x17d3d(%rip), %rdi     # 0x481a1
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
movq -0x458(%rbp), %rdi
callq 0x31510
movl %eax, %ecx
movq -0x458(%rbp), %rax
movl %ecx, (%rax)
movq -0x458(%rbp), %rax
cmpl $0x1000000, (%rax)      # imm = 0x1000000
jbe 0x304ab
leaq 0x17b3d(%rip), %rdi     # 0x47fdb
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
movq -0x458(%rbp), %rdi
callq 0x31510
movl %eax, %ecx
movq -0x458(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x458(%rbp), %rax
cmpl $0x1000000, 0x4(%rax)   # imm = 0x1000000
jbe 0x304e7
leaq 0x17b01(%rip), %rdi     # 0x47fdb
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
movq -0x458(%rbp), %rdi
callq 0x2ce50
movzbl %al, %eax
movl %eax, -0x44c(%rbp)
cmpl $0x1, -0x44c(%rbp)
je 0x30534
cmpl $0x2, -0x44c(%rbp)
je 0x30534
cmpl $0x4, -0x44c(%rbp)
je 0x30534
cmpl $0x8, -0x44c(%rbp)
je 0x30534
leaq 0x17c87(%rip), %rdi     # 0x481ae
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
movq -0x458(%rbp), %rdi
callq 0x2ce50
movzbl %al, %eax
movl %eax, -0x448(%rbp)
cmpl $0x6, -0x448(%rbp)
jle 0x30566
leaq 0x17c66(%rip), %rdi     # 0x481bf
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
cmpl $0x3, -0x448(%rbp)
jne 0x30578
movb $0x3, -0x421(%rbp)
jmp 0x3059c
movl -0x448(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x3059a
leaq 0x17c32(%rip), %rdi     # 0x481bf
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
jmp 0x3059c
movq -0x458(%rbp), %rdi
callq 0x2ce50
movzbl %al, %eax
movl %eax, -0x464(%rbp)
cmpl $0x0, -0x464(%rbp)
je 0x305ce
leaq 0x17c08(%rip), %rdi     # 0x481c9
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
movq -0x458(%rbp), %rdi
callq 0x2ce50
movzbl %al, %eax
movl %eax, -0x468(%rbp)
cmpl $0x0, -0x468(%rbp)
je 0x30600
leaq 0x17be6(%rip), %rdi     # 0x481d9
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
movq -0x458(%rbp), %rdi
callq 0x2ce50
movzbl %al, %eax
movl %eax, -0x444(%rbp)
cmpl $0x1, -0x444(%rbp)
jle 0x30632
leaq 0x17bc6(%rip), %rdi     # 0x481eb
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
movq -0x458(%rbp), %rax
cmpl $0x0, (%rax)
je 0x3064b
movq -0x458(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jne 0x3065f
leaq 0x17bae(%rip), %rdi     # 0x48200
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
cmpb $0x0, -0x421(%rbp)
jne 0x306f7
movl -0x448(%rbp), %edx
andl $0x2, %edx
movl $0x1, %ecx
movl $0x3, %eax
cmpl $0x0, %edx
cmovnel %eax, %ecx
movl -0x448(%rbp), %esi
andl $0x4, %esi
xorl %eax, %eax
movl $0x1, %edx
cmpl $0x0, %esi
cmovnel %edx, %eax
addl %eax, %ecx
movq -0x458(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x458(%rbp), %rcx
movl $0x40000000, %eax       # imm = 0x40000000
xorl %edx, %edx
divl (%rcx)
movq -0x458(%rbp), %rcx
xorl %edx, %edx
divl 0x8(%rcx)
movq -0x458(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jae 0x306e3
leaq 0x17905(%rip), %rdi     # 0x47fdb
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
cmpl $0x2, -0x14(%rbp)
jne 0x306f5
movl $0x1, -0x4(%rbp)
jmp 0x30f1e
jmp 0x3073a
movq -0x458(%rbp), %rax
movl $0x1, 0x8(%rax)
movq -0x458(%rbp), %rcx
movl $0x40000000, %eax       # imm = 0x40000000
xorl %edx, %edx
divl (%rcx)
shrl $0x2, %eax
movq -0x458(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jae 0x30738
leaq 0x178b0(%rip), %rdi     # 0x47fdb
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
jmp 0x3073a
jmp 0x30f0d
cmpl $0x0, -0x43c(%rbp)
je 0x3075c
leaq 0x17abf(%rip), %rdi     # 0x4820e
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
cmpl $0x300, -0x460(%rbp)    # imm = 0x300
jbe 0x3077c
leaq 0x17aae(%rip), %rdi     # 0x4821d
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
movl -0x460(%rbp), %eax
movl $0x3, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, -0x438(%rbp)
imull $0x3, -0x438(%rbp), %eax
cmpl -0x460(%rbp), %eax
je 0x307b4
leaq 0x17a76(%rip), %rdi     # 0x4821d
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
movl $0x0, -0x434(%rbp)
movl -0x434(%rbp), %eax
cmpl -0x438(%rbp), %eax
jae 0x30863
movq -0x458(%rbp), %rdi
callq 0x2ce50
movb %al, %cl
movl -0x434(%rbp), %eax
shll $0x2, %eax
addl $0x0, %eax
movl %eax, %eax
movb %cl, -0x420(%rbp,%rax)
movq -0x458(%rbp), %rdi
callq 0x2ce50
movb %al, %cl
movl -0x434(%rbp), %eax
shll $0x2, %eax
addl $0x1, %eax
movl %eax, %eax
movb %cl, -0x420(%rbp,%rax)
movq -0x458(%rbp), %rdi
callq 0x2ce50
movb %al, %cl
movl -0x434(%rbp), %eax
shll $0x2, %eax
addl $0x2, %eax
movl %eax, %eax
movb %cl, -0x420(%rbp,%rax)
movl -0x434(%rbp), %eax
shll $0x2, %eax
addl $0x3, %eax
movl %eax, %eax
movb $-0x1, -0x420(%rbp,%rax)
movl -0x434(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x434(%rbp)
jmp 0x307be
jmp 0x30f0d
cmpl $0x0, -0x43c(%rbp)
je 0x30885
leaq 0x17996(%rip), %rdi     # 0x4820e
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x308a4
leaq 0x17993(%rip), %rdi     # 0x4822a
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
cmpb $0x0, -0x421(%rbp)
je 0x30968
cmpl $0x2, -0x14(%rbp)
jne 0x308d1
movq -0x458(%rbp), %rax
movl $0x4, 0x8(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x30f1e
cmpl $0x0, -0x438(%rbp)
jne 0x308ee
leaq 0x17959(%rip), %rdi     # 0x4823a
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
movl -0x460(%rbp), %eax
cmpl -0x438(%rbp), %eax
jbe 0x30910
leaq 0x17948(%rip), %rdi     # 0x4824b
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
movb $0x4, -0x421(%rbp)
movl $0x0, -0x434(%rbp)
movl -0x434(%rbp), %eax
cmpl -0x460(%rbp), %eax
jae 0x30963
movq -0x458(%rbp), %rdi
callq 0x2ce50
movb %al, %cl
movl -0x434(%rbp), %eax
shll $0x2, %eax
addl $0x3, %eax
movl %eax, %eax
movb %cl, -0x420(%rbp,%rax)
movl -0x434(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x434(%rbp)
jmp 0x30921
jmp 0x30a27
movq -0x458(%rbp), %rax
movl 0x8(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x3098e
leaq 0x178d7(%rip), %rdi     # 0x48258
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
movl -0x460(%rbp), %eax
movq -0x458(%rbp), %rcx
movl 0x8(%rcx), %ecx
shll %ecx
cmpl %ecx, %eax
je 0x309b8
leaq 0x178a0(%rip), %rdi     # 0x4824b
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
movb $0x1, -0x422(%rbp)
movl $0x0, -0x440(%rbp)
movl -0x440(%rbp), %eax
movq -0x458(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x30a25
movq -0x458(%rbp), %rdi
callq 0x2cf90
andl $0xff, %eax
movzbl %al, %eax
movslq -0x44c(%rbp), %rdx
leaq 0x2baef(%rip), %rcx     # 0x5c4ec
movzbl (%rcx,%rdx), %ecx
imull %ecx, %eax
movb %al, %cl
movslq -0x440(%rbp), %rax
movb %cl, -0x425(%rbp,%rax)
movl -0x440(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x440(%rbp)
jmp 0x309c9
jmp 0x30a27
jmp 0x30f0d
cmpl $0x0, -0x43c(%rbp)
je 0x30a49
leaq 0x177d2(%rip), %rdi     # 0x4820e
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
cmpb $0x0, -0x421(%rbp)
je 0x30a6f
cmpl $0x0, -0x438(%rbp)
jne 0x30a6f
leaq 0x17806(%rip), %rdi     # 0x48268
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
cmpl $0x2, -0x14(%rbp)
jne 0x30a92
movzbl -0x421(%rbp), %ecx
movq -0x458(%rbp), %rax
movl %ecx, 0x8(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x30f1e
movl -0x42c(%rbp), %eax
addl -0x460(%rbp), %eax
cmpl -0x42c(%rbp), %eax
jge 0x30ab2
movl $0x0, -0x4(%rbp)
jmp 0x30f1e
movl -0x42c(%rbp), %eax
addl -0x460(%rbp), %eax
cmpl -0x430(%rbp), %eax
jbe 0x30b81
movl -0x430(%rbp), %eax
movl %eax, -0x46c(%rbp)
cmpl $0x0, -0x430(%rbp)
jne 0x30b12
cmpl $0x1000, -0x460(%rbp)   # imm = 0x1000
jbe 0x30af9
movl -0x460(%rbp), %eax
movl %eax, -0x488(%rbp)
jmp 0x30b06
movl $0x1000, %eax           # imm = 0x1000
movl %eax, -0x488(%rbp)
jmp 0x30b06
movl -0x488(%rbp), %eax
movl %eax, -0x430(%rbp)
jmp 0x30b14
movl -0x42c(%rbp), %eax
addl -0x460(%rbp), %eax
cmpl -0x430(%rbp), %eax
jbe 0x30b38
movl -0x430(%rbp), %eax
shll %eax
movl %eax, -0x430(%rbp)
jmp 0x30b14
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movl -0x430(%rbp), %eax
movl %eax, %esi
callq 0x5670
movq %rax, -0x478(%rbp)
cmpq $0x0, -0x478(%rbp)
jne 0x30b72
leaq 0x17480(%rip), %rdi     # 0x47fe5
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
movq -0x478(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x458(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
movl -0x42c(%rbp), %eax
addq %rax, %rsi
movl -0x460(%rbp), %edx
callq 0x31550
cmpl $0x0, %eax
jne 0x30bbd
leaq 0x176c0(%rip), %rdi     # 0x48270
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
movl -0x460(%rbp), %eax
addl -0x42c(%rbp), %eax
movl %eax, -0x42c(%rbp)
jmp 0x30f0d
cmpl $0x0, -0x43c(%rbp)
je 0x30bf1
leaq 0x1762a(%rip), %rdi     # 0x4820e
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
cmpl $0x0, -0x14(%rbp)
je 0x30c03
movl $0x1, -0x4(%rbp)
jmp 0x30f1e
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x30c22
leaq 0x17665(%rip), %rdi     # 0x4827a
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
movq -0x458(%rbp), %rax
movl (%rax), %eax
imull -0x44c(%rbp), %eax
addl $0x7, %eax
shrl $0x3, %eax
movl %eax, -0x480(%rbp)
movl -0x480(%rbp), %eax
movq -0x458(%rbp), %rcx
imull 0x4(%rcx), %eax
movq -0x458(%rbp), %rcx
imull 0x8(%rcx), %eax
movq -0x458(%rbp), %rcx
addl 0x4(%rcx), %eax
movl %eax, -0x47c(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movl -0x42c(%rbp), %esi
movl -0x47c(%rbp), %edx
cmpl $0x0, -0x450(%rbp)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %r8d
leaq -0x47c(%rbp), %rcx
callq 0x27fe0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x30cbe
movl $0x0, -0x4(%rbp)
jmp 0x30f1e
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x54c0
movq -0x10(%rbp), %rax
movq $0x0, 0x8(%rax)
movl -0x18(%rbp), %eax
movq -0x458(%rbp), %rcx
movl 0x8(%rcx), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jne 0x30cfa
cmpl $0x3, -0x18(%rbp)
je 0x30cfa
cmpb $0x0, -0x421(%rbp)
je 0x30d03
cmpb $0x0, -0x422(%rbp)
je 0x30d1c
movq -0x458(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movq -0x458(%rbp), %rax
movl %ecx, 0xc(%rax)
jmp 0x30d30
movq -0x458(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x458(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movl -0x47c(%rbp), %edx
movq -0x458(%rbp), %rax
movl 0xc(%rax), %ecx
movl -0x44c(%rbp), %r8d
movl -0x448(%rbp), %r9d
movl -0x444(%rbp), %eax
movl %eax, (%rsp)
callq 0x31680
cmpl $0x0, %eax
jne 0x30d79
movl $0x0, -0x4(%rbp)
jmp 0x30f1e
cmpb $0x0, -0x422(%rbp)
je 0x30daf
movq -0x10(%rbp), %rdi
leaq -0x425(%rbp), %rsi
movq -0x458(%rbp), %rax
movl 0xc(%rax), %edx
callq 0x31a30
cmpl $0x0, %eax
jne 0x30dad
movl $0x0, -0x4(%rbp)
jmp 0x30f1e
jmp 0x30daf
cmpl $0x0, -0x450(%rbp)
je 0x30dd7
cmpl $0x0, 0x2bed1(%rip)     # 0x5cc90
je 0x30dd7
movq -0x458(%rbp), %rax
cmpl $0x2, 0xc(%rax)
jle 0x30dd7
movq -0x10(%rbp), %rdi
callq 0x31b70
cmpb $0x0, -0x421(%rbp)
je 0x30e48
movzbl -0x421(%rbp), %ecx
movq -0x458(%rbp), %rax
movl %ecx, 0x8(%rax)
movzbl -0x421(%rbp), %ecx
movq -0x458(%rbp), %rax
movl %ecx, 0xc(%rax)
cmpl $0x3, -0x18(%rbp)
jl 0x30e15
movl -0x18(%rbp), %ecx
movq -0x458(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x10(%rbp), %rdi
leaq -0x420(%rbp), %rsi
movl -0x438(%rbp), %edx
movq -0x458(%rbp), %rax
movl 0xc(%rax), %ecx
callq 0x31d40
cmpl $0x0, %eax
jne 0x30e46
movl $0x0, -0x4(%rbp)
jmp 0x30f1e
jmp 0x30e48
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x54c0
movq -0x10(%rbp), %rax
movq $0x0, 0x10(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x30f1e
cmpl $0x0, -0x43c(%rbp)
je 0x30e8a
leaq 0x17391(%rip), %rdi     # 0x4820e
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
movl -0x45c(%rbp), %eax
andl $0x20000000, %eax       # imm = 0x20000000
cmpl $0x0, %eax
jne 0x30efb
movl -0x45c(%rbp), %eax
shrl $0x18, %eax
andl $0xff, %eax
movb %al, 0x2b652(%rip)      # 0x5c500
movl -0x45c(%rbp), %eax
shrl $0x10, %eax
andl $0xff, %eax
movb %al, 0x2b63f(%rip)      # 0x5c501
movl -0x45c(%rbp), %eax
shrl $0x8, %eax
andl $0xff, %eax
movb %al, 0x2b62c(%rip)      # 0x5c502
movl -0x45c(%rbp), %eax
shrl $0x0, %eax
andl $0xff, %eax
movb %al, 0x2b619(%rip)      # 0x5c503
leaq 0x2b60f(%rip), %rdi     # 0x5c500
callq 0x275b0
movl %eax, -0x4(%rbp)
jmp 0x30f1e
movq -0x458(%rbp), %rdi
movl -0x460(%rbp), %esi
callq 0x2d340
movq -0x458(%rbp), %rdi
callq 0x31510
jmp 0x30386
movl -0x4(%rbp), %eax
addq $0x490, %rsp            # imm = 0x490
popq %rbp
retq
nopw (%rax,%rax)