// File: srajangarg[P]raytracer/src/core/stb_image.hpp
// Function: stbi__bmp_load(stbi__context*, int*, int*, int*, int)
static stbi_uc *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int req_comp)
{
   stbi_uc *out;
   unsigned int mr=0,mg=0,mb=0,ma=0, all_a;
   stbi_uc pal[256][4];
   int psize=0,i,j,width;
   int flip_vertically, pad, target;
   stbi__bmp_data info;

   info.all_a = 255;   
   if (stbi__bmp_parse_header(s, &info) == NULL)
      return NULL; // error code already set

   flip_vertically = ((int) s->img_y) > 0;
   s->img_y = abs((int) s->img_y);

   mr = info.mr;
   mg = info.mg;
   mb = info.mb;
   ma = info.ma;
   all_a = info.all_a;

   if (info.hsz == 12) {
      if (info.bpp < 24)
         psize = (info.offset - 14 - 24) / 3;
   } else {
      if (info.bpp < 16)
         psize = (info.offset - 14 - info.hsz) >> 2;
   }

   s->img_n = ma ? 4 : 3;
   if (req_comp && req_comp >= 3) // we can directly decode 3 or 4
      target = req_comp;
   else
      target = s->img_n; // if they want monochrome, we'll post-convert

   out = (stbi_uc *) stbi__malloc(target * s->img_x * s->img_y);
   if (!out) return stbi__errpuc("outofmem", "Out of memory");
   if (info.bpp < 16) {
      int z=0;
      if (psize == 0 || psize > 256) { STBI_FREE(out); return stbi__errpuc("invalid", "Corrupt BMP"); }
      for (i=0; i < psize; ++i) {
         pal[i][2] = stbi__get8(s);
         pal[i][1] = stbi__get8(s);
         pal[i][0] = stbi__get8(s);
         if (info.hsz != 12) stbi__get8(s);
         pal[i][3] = 255;
      }
      stbi__skip(s, info.offset - 14 - info.hsz - psize * (info.hsz == 12 ? 3 : 4));
      if (info.bpp == 4) width = (s->img_x + 1) >> 1;
      else if (info.bpp == 8) width = s->img_x;
      else { STBI_FREE(out); return stbi__errpuc("bad bpp", "Corrupt BMP"); }
      pad = (-width)&3;
      for (j=0; j < (int) s->img_y; ++j) {
         for (i=0; i < (int) s->img_x; i += 2) {
            int v=stbi__get8(s),v2=0;
            if (info.bpp == 4) {
               v2 = v & 15;
               v >>= 4;
            }
            out[z++] = pal[v][0];
            out[z++] = pal[v][1];
            out[z++] = pal[v][2];
            if (target == 4) out[z++] = 255;
            if (i+1 == (int) s->img_x) break;
            v = (info.bpp == 8) ? stbi__get8(s) : v2;
            out[z++] = pal[v][0];
            out[z++] = pal[v][1];
            out[z++] = pal[v][2];
            if (target == 4) out[z++] = 255;
         }
         stbi__skip(s, pad);
      }
   } else {
      int rshift=0,gshift=0,bshift=0,ashift=0,rcount=0,gcount=0,bcount=0,acount=0;
      int z = 0;
      int easy=0;
      stbi__skip(s, info.offset - 14 - info.hsz);
      if (info.bpp == 24) width = 3 * s->img_x;
      else if (info.bpp == 16) width = 2*s->img_x;
      else /* bpp = 32 and pad = 0 */ width=0;
      pad = (-width) & 3;
      if (info.bpp == 24) {
         easy = 1;
      } else if (info.bpp == 32) {
         if (mb == 0xff && mg == 0xff00 && mr == 0x00ff0000 && ma == 0xff000000)
            easy = 2;
      }
      if (!easy) {
         if (!mr || !mg || !mb) { STBI_FREE(out); return stbi__errpuc("bad masks", "Corrupt BMP"); }
         // right shift amt to put high bit in position #7
         rshift = stbi__high_bit(mr)-7; rcount = stbi__bitcount(mr);
         gshift = stbi__high_bit(mg)-7; gcount = stbi__bitcount(mg);
         bshift = stbi__high_bit(mb)-7; bcount = stbi__bitcount(mb);
         ashift = stbi__high_bit(ma)-7; acount = stbi__bitcount(ma);
      }
      for (j=0; j < (int) s->img_y; ++j) {
         if (easy) {
            for (i=0; i < (int) s->img_x; ++i) {
               unsigned char a;
               out[z+2] = stbi__get8(s);
               out[z+1] = stbi__get8(s);
               out[z+0] = stbi__get8(s);
               z += 3;
               a = (easy == 2 ? stbi__get8(s) : 255);
               all_a |= a;
               if (target == 4) out[z++] = a;
            }
         } else {
            int bpp = info.bpp;
            for (i=0; i < (int) s->img_x; ++i) {
               stbi__uint32 v = (bpp == 16 ? (stbi__uint32) stbi__get16le(s) : stbi__get32le(s));
               int a;
               out[z++] = STBI__BYTECAST(stbi__shiftsigned(v & mr, rshift, rcount));
               out[z++] = STBI__BYTECAST(stbi__shiftsigned(v & mg, gshift, gcount));
               out[z++] = STBI__BYTECAST(stbi__shiftsigned(v & mb, bshift, bcount));
               a = (ma ? stbi__shiftsigned(v & ma, ashift, acount) : 255);
               all_a |= a;
               if (target == 4) out[z++] = STBI__BYTECAST(a);
            }
         }
         stbi__skip(s, pad);
      }
   }
   
   // if alpha channel is all 0s, replace with all 255s
   if (target == 4 && all_a == 0)
      for (i=4*s->img_x*s->img_y-1; i >= 0; i -= 4)
         out[i] = 255;

   if (flip_vertically) {
      stbi_uc t;
      for (j=0; j < (int) s->img_y>>1; ++j) {
         stbi_uc *p1 = out +      j     *s->img_x*target;
         stbi_uc *p2 = out + (s->img_y-1-j)*s->img_x*target;
         for (i=0; i < (int) s->img_x*target; ++i) {
            t = p1[i], p1[i] = p2[i], p2[i] = t;
         }
      }
   }

   if (req_comp && req_comp != target) {
      out = stbi__convert_format(out, target, req_comp, s->img_x, s->img_y);
      if (out == NULL) return out; // stbi__convert_format frees input on failure
   }

   *x = s->img_x;
   *y = s->img_y;
   if (comp) *comp = s->img_n;
   return out;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x500, %rsp            # imm = 0x500
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movl $0x0, -0x48(%rbp)
movl $0x0, -0x454(%rbp)
movl $0xff, -0x470(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x48c(%rbp), %rsi
callq 0x33400
cmpq $0x0, %rax
jne 0x28b82
movq $0x0, -0x8(%rbp)
jmp 0x2975e
movq -0x10(%rbp), %rax
cmpl $0x0, 0x4(%rax)
setg %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x464(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %ecx
movl %ecx, %eax
negl %eax
cmovnsl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0x480(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x47c(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x478(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x474(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x470(%rbp), %eax
movl %eax, -0x4c(%rbp)
cmpl $0xc, -0x484(%rbp)
jne 0x28c08
cmpl $0x18, -0x48c(%rbp)
jge 0x28c06
movl -0x488(%rbp), %eax
subl $0xe, %eax
subl $0x18, %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %eax, -0x454(%rbp)
jmp 0x28c2b
cmpl $0x10, -0x48c(%rbp)
jge 0x28c29
movl -0x488(%rbp), %eax
subl $0xe, %eax
subl -0x484(%rbp), %eax
sarl $0x2, %eax
movl %eax, -0x454(%rbp)
jmp 0x28c2b
movl -0x48(%rbp), %edx
movl $0x3, %ecx
movl $0x4, %eax
cmpl $0x0, %edx
cmovnel %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
cmpl $0x0, -0x2c(%rbp)
je 0x28c5c
cmpl $0x3, -0x2c(%rbp)
jl 0x28c5c
movl -0x2c(%rbp), %eax
movl %eax, -0x46c(%rbp)
jmp 0x28c69
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x46c(%rbp)
movl -0x46c(%rbp), %eax
movq -0x10(%rbp), %rcx
imull (%rcx), %eax
movq -0x10(%rbp), %rcx
imull 0x4(%rcx), %eax
movl %eax, %eax
movl %eax, %edi
callq 0x27f20
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x28cb2
leaq 0x1f34c(%rip), %rdi     # 0x47fe5
callq 0x275b0
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
cmovneq %rax, %rax
movq %rax, -0x8(%rbp)
jmp 0x2975e
cmpl $0x10, -0x48c(%rbp)
jge 0x29092
movl $0x0, -0x490(%rbp)
cmpl $0x0, -0x454(%rbp)
je 0x28cde
cmpl $0x100, -0x454(%rbp)    # imm = 0x100
jle 0x28d07
movq -0x38(%rbp), %rdi
callq 0x54c0
leaq 0x1f782(%rip), %rdi     # 0x48470
callq 0x275b0
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
cmovneq %rax, %rax
movq %rax, -0x8(%rbp)
jmp 0x2975e
movl $0x0, -0x458(%rbp)
movl -0x458(%rbp), %eax
cmpl -0x454(%rbp), %eax
jge 0x28da3
movq -0x10(%rbp), %rdi
callq 0x2ce50
movb %al, %cl
movslq -0x458(%rbp), %rax
movb %cl, -0x44e(%rbp,%rax,4)
movq -0x10(%rbp), %rdi
callq 0x2ce50
movb %al, %cl
movslq -0x458(%rbp), %rax
movb %cl, -0x44f(%rbp,%rax,4)
movq -0x10(%rbp), %rdi
callq 0x2ce50
movb %al, %cl
movslq -0x458(%rbp), %rax
movb %cl, -0x450(%rbp,%rax,4)
cmpl $0xc, -0x484(%rbp)
je 0x28d80
movq -0x10(%rbp), %rdi
callq 0x2ce50
movslq -0x458(%rbp), %rax
movb $-0x1, -0x44d(%rbp,%rax,4)
movl -0x458(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x458(%rbp)
jmp 0x28d11
movq -0x10(%rbp), %rdi
movl -0x488(%rbp), %esi
subl $0xe, %esi
subl -0x484(%rbp), %esi
movl -0x454(%rbp), %eax
movl -0x484(%rbp), %r8d
movl $0x4, %ecx
movl $0x3, %edx
cmpl $0xc, %r8d
cmovel %edx, %ecx
imull %ecx, %eax
subl %eax, %esi
callq 0x2d340
cmpl $0x4, -0x48c(%rbp)
jne 0x28dfa
movq -0x10(%rbp), %rax
movl (%rax), %eax
addl $0x1, %eax
shrl %eax
movl %eax, -0x460(%rbp)
jmp 0x28e3c
cmpl $0x8, -0x48c(%rbp)
jne 0x28e11
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x460(%rbp)
jmp 0x28e3a
movq -0x38(%rbp), %rdi
callq 0x54c0
leaq 0x1f657(%rip), %rdi     # 0x48478
callq 0x275b0
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
cmovneq %rax, %rax
movq %rax, -0x8(%rbp)
jmp 0x2975e
jmp 0x28e3c
xorl %eax, %eax
subl -0x460(%rbp), %eax
andl $0x3, %eax
movl %eax, -0x468(%rbp)
movl $0x0, -0x45c(%rbp)
movl -0x45c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x2908d
movl $0x0, -0x458(%rbp)
movl -0x458(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x2906a
movq -0x10(%rbp), %rdi
callq 0x2ce50
movzbl %al, %eax
movl %eax, -0x494(%rbp)
movl $0x0, -0x498(%rbp)
cmpl $0x4, -0x48c(%rbp)
jne 0x28ec9
movl -0x494(%rbp), %eax
andl $0xf, %eax
movl %eax, -0x498(%rbp)
movl -0x494(%rbp), %eax
sarl $0x4, %eax
movl %eax, -0x494(%rbp)
movslq -0x494(%rbp), %rax
movb -0x450(%rbp,%rax,4), %dl
movq -0x38(%rbp), %rax
movl -0x490(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x490(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movslq -0x494(%rbp), %rax
movb -0x44f(%rbp,%rax,4), %dl
movq -0x38(%rbp), %rax
movl -0x490(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x490(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movslq -0x494(%rbp), %rax
movb -0x44e(%rbp,%rax,4), %dl
movq -0x38(%rbp), %rax
movl -0x490(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x490(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
cmpl $0x4, -0x46c(%rbp)
jne 0x28f69
movq -0x38(%rbp), %rax
movl -0x490(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x490(%rbp)
movslq %ecx, %rcx
movb $-0x1, (%rax,%rcx)
movl -0x458(%rbp), %eax
addl $0x1, %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jne 0x28f7f
jmp 0x2906a
cmpl $0x8, -0x48c(%rbp)
jne 0x28f9c
movq -0x10(%rbp), %rdi
callq 0x2ce50
movzbl %al, %eax
movl %eax, -0x4ec(%rbp)
jmp 0x28fa8
movl -0x498(%rbp), %eax
movl %eax, -0x4ec(%rbp)
movl -0x4ec(%rbp), %eax
movl %eax, -0x494(%rbp)
movslq -0x494(%rbp), %rax
movb -0x450(%rbp,%rax,4), %dl
movq -0x38(%rbp), %rax
movl -0x490(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x490(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movslq -0x494(%rbp), %rax
movb -0x44f(%rbp,%rax,4), %dl
movq -0x38(%rbp), %rax
movl -0x490(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x490(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movslq -0x494(%rbp), %rax
movb -0x44e(%rbp,%rax,4), %dl
movq -0x38(%rbp), %rax
movl -0x490(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x490(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
cmpl $0x4, -0x46c(%rbp)
jne 0x29054
movq -0x38(%rbp), %rax
movl -0x490(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x490(%rbp)
movslq %ecx, %rcx
movb $-0x1, (%rax,%rcx)
jmp 0x29056
movl -0x458(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x458(%rbp)
jmp 0x28e74
movq -0x10(%rbp), %rdi
movl -0x468(%rbp), %esi
callq 0x2d340
movl -0x45c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x45c(%rbp)
jmp 0x28e57
jmp 0x29573
movl $0x0, -0x49c(%rbp)
movl $0x0, -0x4a0(%rbp)
movl $0x0, -0x4a4(%rbp)
movl $0x0, -0x4a8(%rbp)
movl $0x0, -0x4ac(%rbp)
movl $0x0, -0x4b0(%rbp)
movl $0x0, -0x4b4(%rbp)
movl $0x0, -0x4b8(%rbp)
movl $0x0, -0x4bc(%rbp)
movl $0x0, -0x4c0(%rbp)
movq -0x10(%rbp), %rdi
movl -0x488(%rbp), %esi
subl $0xe, %esi
subl -0x484(%rbp), %esi
callq 0x2d340
cmpl $0x18, -0x48c(%rbp)
jne 0x29126
movq -0x10(%rbp), %rax
imull $0x3, (%rax), %eax
movl %eax, -0x460(%rbp)
jmp 0x2914b
cmpl $0x10, -0x48c(%rbp)
jne 0x2913f
movq -0x10(%rbp), %rax
movl (%rax), %eax
shll %eax
movl %eax, -0x460(%rbp)
jmp 0x29149
movl $0x0, -0x460(%rbp)
jmp 0x2914b
xorl %eax, %eax
subl -0x460(%rbp), %eax
andl $0x3, %eax
movl %eax, -0x468(%rbp)
cmpl $0x18, -0x48c(%rbp)
jne 0x29171
movl $0x1, -0x4c0(%rbp)
jmp 0x291ac
cmpl $0x20, -0x48c(%rbp)
jne 0x291aa
cmpl $0xff, -0x44(%rbp)
jne 0x291a8
cmpl $0xff00, -0x40(%rbp)    # imm = 0xFF00
jne 0x291a8
cmpl $0xff0000, -0x3c(%rbp)  # imm = 0xFF0000
jne 0x291a8
cmpl $0xff000000, -0x48(%rbp) # imm = 0xFF000000
jne 0x291a8
movl $0x2, -0x4c0(%rbp)
jmp 0x291aa
jmp 0x291ac
cmpl $0x0, -0x4c0(%rbp)
jne 0x29270
cmpl $0x0, -0x3c(%rbp)
je 0x291cb
cmpl $0x0, -0x40(%rbp)
je 0x291cb
cmpl $0x0, -0x44(%rbp)
jne 0x291f4
movq -0x38(%rbp), %rdi
callq 0x54c0
leaq 0x1f2a5(%rip), %rdi     # 0x48480
callq 0x275b0
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
cmovneq %rax, %rax
movq %rax, -0x8(%rbp)
jmp 0x2975e
movl -0x3c(%rbp), %edi
callq 0x33860
subl $0x7, %eax
movl %eax, -0x49c(%rbp)
movl -0x3c(%rbp), %edi
callq 0x33910
movl %eax, -0x4ac(%rbp)
movl -0x40(%rbp), %edi
callq 0x33860
subl $0x7, %eax
movl %eax, -0x4a0(%rbp)
movl -0x40(%rbp), %edi
callq 0x33910
movl %eax, -0x4b0(%rbp)
movl -0x44(%rbp), %edi
callq 0x33860
subl $0x7, %eax
movl %eax, -0x4a4(%rbp)
movl -0x44(%rbp), %edi
callq 0x33910
movl %eax, -0x4b4(%rbp)
movl -0x48(%rbp), %edi
callq 0x33860
subl $0x7, %eax
movl %eax, -0x4a8(%rbp)
movl -0x48(%rbp), %edi
callq 0x33910
movl %eax, -0x4b8(%rbp)
movl $0x0, -0x45c(%rbp)
movl -0x45c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x29571
cmpl $0x0, -0x4c0(%rbp)
je 0x293a7
movl $0x0, -0x458(%rbp)
movl -0x458(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x293a2
movq -0x10(%rbp), %rdi
callq 0x2ce50
movb %al, %dl
movq -0x38(%rbp), %rax
movl -0x4bc(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x10(%rbp), %rdi
callq 0x2ce50
movb %al, %dl
movq -0x38(%rbp), %rax
movl -0x4bc(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x10(%rbp), %rdi
callq 0x2ce50
movb %al, %dl
movq -0x38(%rbp), %rax
movl -0x4bc(%rbp), %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x4bc(%rbp), %eax
addl $0x3, %eax
movl %eax, -0x4bc(%rbp)
cmpl $0x2, -0x4c0(%rbp)
jne 0x2933c
movq -0x10(%rbp), %rdi
callq 0x2ce50
movzbl %al, %eax
movl %eax, -0x4f0(%rbp)
jmp 0x29349
movl $0xff, %eax
movl %eax, -0x4f0(%rbp)
jmp 0x29349
movl -0x4f0(%rbp), %eax
movb %al, -0x4c1(%rbp)
movzbl -0x4c1(%rbp), %eax
orl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
cmpl $0x4, -0x46c(%rbp)
jne 0x2938c
movb -0x4c1(%rbp), %dl
movq -0x38(%rbp), %rax
movl -0x4bc(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x4bc(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
jmp 0x2938e
movl -0x458(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x458(%rbp)
jmp 0x292a4
jmp 0x2954e
movl -0x48c(%rbp), %eax
movl %eax, -0x4c8(%rbp)
movl $0x0, -0x458(%rbp)
movl -0x458(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x2954c
cmpl $0x10, -0x4c8(%rbp)
jne 0x293e9
movq -0x10(%rbp), %rdi
callq 0x28370
movl %eax, -0x4f4(%rbp)
jmp 0x293f8
movq -0x10(%rbp), %rdi
callq 0x333c0
movl %eax, -0x4f4(%rbp)
movl -0x4f4(%rbp), %eax
movl %eax, -0x4cc(%rbp)
movl -0x4cc(%rbp), %edi
andl -0x3c(%rbp), %edi
movl -0x49c(%rbp), %esi
movl -0x4ac(%rbp), %edx
callq 0x33990
andl $0xff, %eax
movb %al, %dl
movq -0x38(%rbp), %rax
movl -0x4bc(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x4bc(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x4cc(%rbp), %edi
andl -0x40(%rbp), %edi
movl -0x4a0(%rbp), %esi
movl -0x4b0(%rbp), %edx
callq 0x33990
andl $0xff, %eax
movb %al, %dl
movq -0x38(%rbp), %rax
movl -0x4bc(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x4bc(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x4cc(%rbp), %edi
andl -0x44(%rbp), %edi
movl -0x4a4(%rbp), %esi
movl -0x4b4(%rbp), %edx
callq 0x33990
andl $0xff, %eax
movb %al, %dl
movq -0x38(%rbp), %rax
movl -0x4bc(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x4bc(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
cmpl $0x0, -0x48(%rbp)
je 0x294e0
movl -0x4cc(%rbp), %edi
andl -0x48(%rbp), %edi
movl -0x4a8(%rbp), %esi
movl -0x4b8(%rbp), %edx
callq 0x33990
movl %eax, -0x4f8(%rbp)
jmp 0x294ed
movl $0xff, %eax
movl %eax, -0x4f8(%rbp)
jmp 0x294ed
movl -0x4f8(%rbp), %eax
movl %eax, -0x4d0(%rbp)
movl -0x4d0(%rbp), %eax
orl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
cmpl $0x4, -0x46c(%rbp)
jne 0x29536
movl -0x4d0(%rbp), %eax
andl $0xff, %eax
movb %al, %dl
movq -0x38(%rbp), %rax
movl -0x4bc(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x4bc(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
jmp 0x29538
movl -0x458(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x458(%rbp)
jmp 0x293bd
jmp 0x2954e
movq -0x10(%rbp), %rdi
movl -0x468(%rbp), %esi
callq 0x2d340
movl -0x45c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x45c(%rbp)
jmp 0x2927a
jmp 0x29573
cmpl $0x4, -0x46c(%rbp)
jne 0x295c7
cmpl $0x0, -0x4c(%rbp)
jne 0x295c7
movq -0x10(%rbp), %rax
movl (%rax), %eax
shll $0x2, %eax
movq -0x10(%rbp), %rcx
imull 0x4(%rcx), %eax
subl $0x1, %eax
movl %eax, -0x458(%rbp)
cmpl $0x0, -0x458(%rbp)
jl 0x295c5
movq -0x38(%rbp), %rax
movslq -0x458(%rbp), %rcx
movb $-0x1, (%rax,%rcx)
movl -0x458(%rbp), %eax
subl $0x4, %eax
movl %eax, -0x458(%rbp)
jmp 0x2959c
jmp 0x295c7
cmpl $0x0, -0x464(%rbp)
je 0x296e1
movl $0x0, -0x45c(%rbp)
movl -0x45c(%rbp), %eax
movq -0x10(%rbp), %rcx
movl 0x4(%rcx), %ecx
sarl %ecx
cmpl %ecx, %eax
jge 0x296df
movq -0x38(%rbp), %rax
movl -0x45c(%rbp), %ecx
movq -0x10(%rbp), %rdx
imull (%rdx), %ecx
imull -0x46c(%rbp), %ecx
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x4e0(%rbp)
movq -0x38(%rbp), %rax
movq -0x10(%rbp), %rcx
movl 0x4(%rcx), %ecx
subl $0x1, %ecx
subl -0x45c(%rbp), %ecx
movq -0x10(%rbp), %rdx
imull (%rdx), %ecx
imull -0x46c(%rbp), %ecx
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x4e8(%rbp)
movl $0x0, -0x458(%rbp)
movl -0x458(%rbp), %eax
movq -0x10(%rbp), %rcx
movl (%rcx), %ecx
imull -0x46c(%rbp), %ecx
cmpl %ecx, %eax
jge 0x296c9
movq -0x4e0(%rbp), %rax
movslq -0x458(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x4d1(%rbp)
movq -0x4e8(%rbp), %rax
movslq -0x458(%rbp), %rcx
movb (%rax,%rcx), %dl
movq -0x4e0(%rbp), %rax
movslq -0x458(%rbp), %rcx
movb %dl, (%rax,%rcx)
movb -0x4d1(%rbp), %dl
movq -0x4e8(%rbp), %rax
movslq -0x458(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x458(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x458(%rbp)
jmp 0x29651
jmp 0x296cb
movl -0x45c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x45c(%rbp)
jmp 0x295de
jmp 0x296e1
cmpl $0x0, -0x2c(%rbp)
je 0x29729
movl -0x2c(%rbp), %eax
cmpl -0x46c(%rbp), %eax
je 0x29729
movq -0x38(%rbp), %rdi
movl -0x46c(%rbp), %esi
movl -0x2c(%rbp), %edx
movq -0x10(%rbp), %rax
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movl 0x4(%rax), %r8d
callq 0x30f30
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x29727
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x2975e
jmp 0x29729
movq -0x10(%rbp), %rax
movl (%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
cmpq $0x0, -0x28(%rbp)
je 0x29756
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x500, %rsp            # imm = 0x500
popq %rbp
retq
nopl (%rax,%rax)