// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/include/stb_image.h
// Function: stbi__psd_load(stbi__context*, int*, int*, int*, int, stbi__result_info*, int)
static void *stbi__psd_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri, int bpc)
{
   int pixelCount;
   int channelCount, compression;
   int channel, i;
   int bitdepth;
   int w,h;
   stbi_uc *out;
   STBI_NOTUSED(ri);

   // Check identifier
   if (stbi__get32be(s) != 0x38425053)   // "8BPS"
      return stbi__errpuc("not PSD", "Corrupt PSD image");

   // Check file type version.
   if (stbi__get16be(s) != 1)
      return stbi__errpuc("wrong version", "Unsupported version of PSD image");

   // Skip 6 reserved bytes.
   stbi__skip(s, 6 );

   // Read the number of channels (R, G, B, A, etc).
   channelCount = stbi__get16be(s);
   if (channelCount < 0 || channelCount > 16)
      return stbi__errpuc("wrong channel count", "Unsupported number of channels in PSD image");

   // Read the rows and columns of the image.
   h = stbi__get32be(s);
   w = stbi__get32be(s);

   // Make sure the depth is 8 bits.
   bitdepth = stbi__get16be(s);
   if (bitdepth != 8 && bitdepth != 16)
      return stbi__errpuc("unsupported bit depth", "PSD bit depth is not 8 or 16 bit");

   // Make sure the color mode is RGB.
   // Valid options are:
   //   0: Bitmap
   //   1: Grayscale
   //   2: Indexed color
   //   3: RGB color
   //   4: CMYK color
   //   7: Multichannel
   //   8: Duotone
   //   9: Lab color
   if (stbi__get16be(s) != 3)
      return stbi__errpuc("wrong color format", "PSD is not in RGB color format");

   // Skip the Mode Data.  (It's the palette for indexed color; other info for other modes.)
   stbi__skip(s,stbi__get32be(s) );

   // Skip the image resources.  (resolution, pen tool paths, etc)
   stbi__skip(s, stbi__get32be(s) );

   // Skip the reserved data.
   stbi__skip(s, stbi__get32be(s) );

   // Find out if the data is compressed.
   // Known values:
   //   0: no compression
   //   1: RLE compressed
   compression = stbi__get16be(s);
   if (compression > 1)
      return stbi__errpuc("bad compression", "PSD has an unknown compression format");

   // Check size
   if (!stbi__mad3sizes_valid(4, w, h, 0))
      return stbi__errpuc("too large", "Corrupt PSD");

   // Create the destination image.

   if (!compression && bitdepth == 16 && bpc == 16) {
      out = (stbi_uc *) stbi__malloc_mad3(8, w, h, 0);
      ri->bits_per_channel = 16;
   } else
      out = (stbi_uc *) stbi__malloc(4 * w*h);

   if (!out) return stbi__errpuc("outofmem", "Out of memory");
   pixelCount = w*h;

   // Initialize the data to zero.
   //memset( out, 0, pixelCount * 4 );

   // Finally, the image data.
   if (compression) {
      // RLE as used by .PSD and .TIFF
      // Loop until you get the number of unpacked bytes you are expecting:
      //     Read the next source byte into n.
      //     If n is between 0 and 127 inclusive, copy the next n+1 bytes literally.
      //     Else if n is between -127 and -1 inclusive, copy the next byte -n+1 times.
      //     Else if n is 128, noop.
      // Endloop

      // The RLE-compressed data is preceded by a 2-byte data count for each row in the data,
      // which we're going to just skip.
      stbi__skip(s, h * channelCount * 2 );

      // Read the RLE data by channel.
      for (channel = 0; channel < 4; channel++) {
         stbi_uc *p;

         p = out+channel;
         if (channel >= channelCount) {
            // Fill this channel with default data.
            for (i = 0; i < pixelCount; i++, p += 4)
               *p = (channel == 3 ? 255 : 0);
         } else {
            // Read the RLE data.
            if (!stbi__psd_decode_rle(s, p, pixelCount)) {
               STBI_FREE(out);
               return stbi__errpuc("corrupt", "bad RLE data");
            }
         }
      }

   } else {
      // We're at the raw image data.  It's each channel in order (Red, Green, Blue, Alpha, ...)
      // where each channel consists of an 8-bit (or 16-bit) value for each pixel in the image.

      // Read the data by channel.
      for (channel = 0; channel < 4; channel++) {
         if (channel >= channelCount) {
            // Fill this channel with default data.
            if (bitdepth == 16 && bpc == 16) {
               stbi__uint16 *q = ((stbi__uint16 *) out) + channel;
               stbi__uint16 val = channel == 3 ? 65535 : 0;
               for (i = 0; i < pixelCount; i++, q += 4)
                  *q = val;
            } else {
               stbi_uc *p = out+channel;
               stbi_uc val = channel == 3 ? 255 : 0;
               for (i = 0; i < pixelCount; i++, p += 4)
                  *p = val;
            }
         } else {
            if (ri->bits_per_channel == 16) {    // output bpc
               stbi__uint16 *q = ((stbi__uint16 *) out) + channel;
               for (i = 0; i < pixelCount; i++, q += 4)
                  *q = (stbi__uint16) stbi__get16be(s);
            } else {
               stbi_uc *p = out+channel;
               if (bitdepth == 16) {  // input bpc
                  for (i = 0; i < pixelCount; i++, p += 4)
                     *p = (stbi_uc) (stbi__get16be(s) >> 8);
               } else {
                  for (i = 0; i < pixelCount; i++, p += 4)
                     *p = stbi__get8(s);
               }
            }
         }
      }
   }

   // remove weird white matte from PSD
   if (channelCount >= 4) {
      if (ri->bits_per_channel == 16) {
         for (i=0; i < w*h; ++i) {
            stbi__uint16 *pixel = (stbi__uint16 *) out + 4*i;
            if (pixel[3] != 0 && pixel[3] != 65535) {
               float a = pixel[3] / 65535.0f;
               float ra = 1.0f / a;
               float inv_a = 65535.0f * (1 - ra);
               pixel[0] = (stbi__uint16) (pixel[0]*ra + inv_a);
               pixel[1] = (stbi__uint16) (pixel[1]*ra + inv_a);
               pixel[2] = (stbi__uint16) (pixel[2]*ra + inv_a);
            }
         }
      } else {
         for (i=0; i < w*h; ++i) {
            unsigned char *pixel = out + 4*i;
            if (pixel[3] != 0 && pixel[3] != 255) {
               float a = pixel[3] / 255.0f;
               float ra = 1.0f / a;
               float inv_a = 255.0f * (1 - ra);
               pixel[0] = (unsigned char) (pixel[0]*ra + inv_a);
               pixel[1] = (unsigned char) (pixel[1]*ra + inv_a);
               pixel[2] = (unsigned char) (pixel[2]*ra + inv_a);
            }
         }
      }
   }

   // convert to desired output format
   if (req_comp && req_comp != 4) {
      if (ri->bits_per_channel == 16)
         out = (stbi_uc *) stbi__convert_format16((stbi__uint16 *) out, 4, req_comp, w, h);
      else
         out = stbi__convert_format(out, 4, req_comp, w, h);
      if (out == NULL) return out; // stbi__convert_format frees input on failure
   }

   if (comp) *comp = 4;
   *y = h;
   *x = w;

   return out;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %r9, 0x70(%rsp)
movl %r8d, %ebp
movq %rcx, %r13
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
callq 0x31ea4
movl %eax, %r14d
shll $0x10, %r14d
movq %rbx, %rdi
callq 0x31ea4
orl %r14d, %eax
cmpl $0x38425053, %eax       # imm = 0x38425053
jne 0x2cdb8
movq %rbx, %rdi
callq 0x31ea4
cmpl $0x1, %eax
jne 0x2cdc4
cmpq $0x0, 0x10(%rbx)
je 0x2cdd0
movq 0xc0(%rbx), %rcx
movl 0xb8(%rbx), %edx
movl %ecx, %eax
subl %edx, %eax
cmpl $0x5, %eax
jg 0x2cdd0
movq %rcx, 0xb8(%rbx)
movq 0x28(%rbx), %rdi
movl $0x6, %esi
subl %eax, %esi
callq *0x18(%rbx)
jmp 0x2cdd8
leaq 0x12f89(%rip), %rax     # 0x3fd48
jmp 0x2ceec
leaq 0x12f85(%rip), %rax     # 0x3fd50
jmp 0x2ceec
addq $0x6, 0xb8(%rbx)
movq %rbx, %rdi
callq 0x31ea4
cmpl $0x11, %eax
jb 0x2cdf1
leaq 0x12f72(%rip), %rax     # 0x3fd5e
jmp 0x2ceec
movl %eax, 0x1c(%rsp)
movq %rbx, %rdi
callq 0x31ea4
movq %rax, 0x28(%rsp)
movq %rbx, %rdi
callq 0x31ea4
movl %eax, %r14d
movq %rbx, %rdi
callq 0x31ea4
movq %rax, 0x20(%rsp)
movq %rbx, %rdi
callq 0x31ea4
movq %rax, 0x50(%rsp)
movq %rbx, %rdi
callq 0x31ea4
cmpl $0x8, %eax
je 0x2ce3d
cmpl $0x10, %eax
jne 0x2cee5
movl %eax, 0x60(%rsp)
movq %rbx, %rdi
callq 0x31ea4
cmpl $0x3, %eax
jne 0x2cedc
movq %r14, 0x38(%rsp)
movq %rbx, %rdi
callq 0x31ea4
movl %eax, %r14d
shll $0x10, %r14d
movq %rbx, %rdi
callq 0x31ea4
orl %eax, %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x320e4
movq %rbx, %rdi
callq 0x31ea4
movl %eax, %r14d
shll $0x10, %r14d
movq %rbx, %rdi
callq 0x31ea4
orl %eax, %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x320e4
movq %rbx, %rdi
callq 0x31ea4
movl %eax, %r14d
shll $0x10, %r14d
movq %rbx, %rdi
callq 0x31ea4
orl %eax, %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x320e4
movq %rbx, %rdi
callq 0x31ea4
cmpl $0x2, %eax
jb 0x2cf0a
leaq 0x12ec1(%rip), %rax     # 0x3fd9b
jmp 0x2ceec
leaq 0x12ea5(%rip), %rax     # 0x3fd88
jmp 0x2ceec
leaq 0x12e86(%rip), %rax     # 0x3fd72
movq %rax, 0x225f5(%rip)     # 0x4f4e8
xorl %edi, %edi
movq %rdi, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %r14d
movq 0x28(%rsp), %rdx
shll $0x10, %edx
movq 0x38(%rsp), %rax
movq %rdx, 0x28(%rsp)
addl %eax, %edx
movq 0x20(%rsp), %rsi
shll $0x10, %esi
movq 0x50(%rsp), %rax
movq %rsi, 0x20(%rsp)
addl %eax, %esi
movl $0x4, %edi
movl %esi, 0x10(%rsp)
movl %edx, 0x14(%rsp)
xorl %ecx, %ecx
callq 0x32132
testl %eax, %eax
je 0x2cf8d
movl %ebp, 0x18(%rsp)
movl 0xd0(%rsp), %ebp
cmpl $0x10, %ebp
jne 0x2cf99
cmpl $0x10, 0x60(%rsp)
jne 0x2cf99
testl %r14d, %r14d
jne 0x2cf99
movl $0x8, %edi
movl 0x10(%rsp), %esi
movl 0x14(%rsp), %edx
xorl %ecx, %ecx
callq 0x32255
movq %rax, %rcx
movq 0x70(%rsp), %rax
movl $0x10, (%rax)
jmp 0x2cfb0
leaq 0x12786(%rip), %rax     # 0x3f71a
jmp 0x2ceec
movl 0x14(%rsp), %eax
imull 0x10(%rsp), %eax
shll $0x2, %eax
movslq %eax, %rdi
callq 0x64c0
movq %rax, %rcx
movq %rcx, 0x30(%rsp)
testq %rcx, %rcx
je 0x2d293
movq %r13, 0x80(%rsp)
movq %r12, 0x88(%rsp)
movq %r15, 0x90(%rsp)
movl 0x10(%rsp), %ecx
movl 0x14(%rsp), %eax
imull %eax, %ecx
movl %ecx, 0xc(%rsp)
testl %r14d, %r14d
je 0x2d2b5
movl 0x1c(%rsp), %ebp
movl %ebp, %esi
imull %eax, %esi
addl %esi, %esi
movq %rbx, %rdi
callq 0x320e4
leaq 0x38(%rbx), %r14
leaq 0x39(%rbx), %rax
movq %rax, 0x48(%rsp)
movl %ebp, %eax
movq %rax, 0x78(%rsp)
movq 0x50(%rsp), %rax
movq 0x20(%rsp), %rcx
addl %ecx, %eax
movq 0x38(%rsp), %rcx
movq 0x28(%rsp), %rdx
addl %edx, %ecx
imull %eax, %ecx
movq %rcx, 0x60(%rsp)
xorl %eax, %eax
movq 0x30(%rsp), %rcx
movq %rcx, 0x68(%rsp)
movl 0x18(%rsp), %ebp
movq %rax, 0x40(%rsp)
cmpq 0x78(%rsp), %rax
jae 0x2d252
cmpl $0x0, 0xc(%rsp)
jle 0x2d277
movq 0x30(%rsp), %rax
movq 0x40(%rsp), %rcx
leaq (%rax,%rcx), %r12
movl $0x0, 0x58(%rsp)
movl 0xc(%rsp), %r13d
movq 0xb8(%rbx), %rax
cmpq 0xc0(%rbx), %rax
jb 0x2d0e0
cmpl $0x0, 0x30(%rbx)
je 0x2d0b7
movq 0x28(%rbx), %rdi
movl 0x34(%rbx), %edx
movq %r14, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0x2d0bb
movq %r14, 0xb8(%rbx)
cltq
addq %r14, %rax
movq %rax, 0xc0(%rbx)
jmp 0x2d0d9
xorl %eax, %eax
jmp 0x2d0ed
movl $0x0, 0x30(%rbx)
movq %r14, 0xb8(%rbx)
movq 0x48(%rsp), %rax
movq %rax, 0xc0(%rbx)
movb $0x0, 0x38(%rbx)
movq 0xb8(%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%rbx)
movb (%rax), %al
cmpb $-0x80, %al
je 0x2d240
movzbl %al, %r15d
testb %al, %al
js 0x2d19c
cmpl %r15d, %r13d
jbe 0x2d29f
incl %r15d
movl %r15d, %ebp
movq 0x48(%rsp), %r13
movq 0xb8(%rbx), %rax
cmpq 0xc0(%rbx), %rax
jb 0x2d175
cmpl $0x0, 0x30(%rbx)
je 0x2d151
movq 0x28(%rbx), %rdi
movl 0x34(%rbx), %edx
movq %r14, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0x2d155
movq %r14, 0xb8(%rbx)
cltq
addq %r14, %rax
movq %rax, 0xc0(%rbx)
jmp 0x2d16e
xorl %eax, %eax
jmp 0x2d182
movl $0x0, 0x30(%rbx)
movq %r14, 0xb8(%rbx)
movq %r13, 0xc0(%rbx)
movb $0x0, 0x38(%rbx)
movq 0xb8(%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%rbx)
movb (%rax), %al
movb %al, (%r12)
addq $0x4, %r12
decl %ebp
jne 0x2d115
addl %r15d, 0x58(%rsp)
movl 0x18(%rsp), %ebp
jmp 0x2d240
movl $0x101, %ebp            # imm = 0x101
subl %r15d, %ebp
cmpl %r13d, %ebp
ja 0x2d237
movq 0xb8(%rbx), %rax
cmpq 0xc0(%rbx), %rax
jb 0x2d212
cmpl $0x0, 0x30(%rbx)
je 0x2d1e9
movq 0x28(%rbx), %rdi
movl 0x34(%rbx), %edx
movq %r14, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0x2d1ed
movq %r14, 0xb8(%rbx)
cltq
addq %r14, %rax
movq %rax, 0xc0(%rbx)
jmp 0x2d20b
xorl %eax, %eax
jmp 0x2d21f
movl $0x0, 0x30(%rbx)
movq %r14, 0xb8(%rbx)
movq 0x48(%rsp), %rax
movq %rax, 0xc0(%rbx)
movb $0x0, 0x38(%rbx)
movq 0xb8(%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%rbx)
movb (%rax), %al
addl $0xfffffeff, %r15d      # imm = 0xFFFFFEFF
movb %al, (%r12)
addq $0x4, %r12
incl %r15d
jne 0x2d226
addl %ebp, 0x58(%rsp)
cmpl %r13d, %ebp
movl 0x18(%rsp), %ebp
ja 0x2d29f
movl 0xc(%rsp), %r13d
subl 0x58(%rsp), %r13d
jg 0x2d07b
jmp 0x2d277
cmpl $0x0, 0xc(%rsp)
jle 0x2d277
cmpq $0x3, 0x40(%rsp)
sete %al
negb %al
xorl %ecx, %ecx
movq 0x68(%rsp), %rdx
movb %al, (%rdx,%rcx,4)
incq %rcx
cmpl %ecx, 0x60(%rsp)
jne 0x2d266
movq 0x40(%rsp), %rax
incq %rax
incq 0x68(%rsp)
cmpq $0x4, %rax
jne 0x2d045
jmp 0x2d484
leaq 0x1248a(%rip), %rax     # 0x3f724
jmp 0x2ceec
movq 0x30(%rsp), %rdi
callq 0x6490
leaq 0x12d44(%rip), %rax     # 0x3fff4
jmp 0x2ceec
xorl $0x10, %ebp
movl 0x60(%rsp), %eax
xorl $0x10, %eax
orl %ebp, %eax
sete 0x40(%rsp)
leaq 0x38(%rbx), %rax
movq %rax, 0x48(%rsp)
leaq 0x39(%rbx), %rax
movq %rax, 0x78(%rsp)
movl 0x1c(%rsp), %eax
movq %rax, 0x58(%rsp)
movq 0x50(%rsp), %rax
movq 0x20(%rsp), %rcx
addl %ecx, %eax
movq 0x38(%rsp), %rcx
movq 0x28(%rsp), %rdx
leal (%rcx,%rdx), %r15d
imull %eax, %r15d
xorl %ecx, %ecx
movq 0x30(%rsp), %r12
movq %r12, %r13
cmpq 0x58(%rsp), %rcx
movq %rcx, 0x68(%rsp)
jae 0x2d348
movq 0x70(%rsp), %rax
cmpl $0x10, (%rax)
jne 0x2d37c
cmpl $0x0, 0xc(%rsp)
jle 0x2d467
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x31ea4
movw %ax, (%r13,%r14,8)
incq %r14
cmpl %r14d, %r15d
jne 0x2d32d
jmp 0x2d467
cmpb $0x0, 0x40(%rsp)
je 0x2d3ab
xorl %eax, %eax
cmpq $0x3, %rcx
sete %cl
cmpl $0x0, 0xc(%rsp)
jle 0x2d467
movb %cl, %al
negl %eax
xorl %ecx, %ecx
movw %ax, (%r13,%rcx,8)
incq %rcx
cmpl %ecx, %r15d
jne 0x2d369
jmp 0x2d467
cmpl $0x10, 0x60(%rsp)
jne 0x2d3d2
cmpl $0x0, 0xc(%rsp)
jle 0x2d467
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x31ea4
movq %r12, %rcx
movb %ah, (%rcx,%rbp,4)
incq %rbp
cmpl %ebp, %r15d
jne 0x2d390
jmp 0x2d467
cmpq $0x3, %rcx
sete %al
cmpl $0x0, 0xc(%rsp)
jle 0x2d467
negb %al
xorl %ecx, %ecx
movb %al, (%r12,%rcx,4)
incq %rcx
cmpl %ecx, %r15d
jne 0x2d3c1
jmp 0x2d467
cmpl $0x0, 0xc(%rsp)
jle 0x2d467
xorl %r14d, %r14d
movq 0xb8(%rbx), %rax
cmpq 0xc0(%rbx), %rax
jb 0x2d44a
cmpl $0x0, 0x30(%rbx)
je 0x2d421
movq 0x28(%rbx), %rdi
movl 0x34(%rbx), %edx
movq 0x48(%rsp), %rbp
movq %rbp, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0x2d425
movq %rbp, 0xb8(%rbx)
cltq
addq %rbp, %rax
movq %rax, 0xc0(%rbx)
jmp 0x2d443
xorl %eax, %eax
jmp 0x2d457
movl $0x0, 0x30(%rbx)
movq %rbp, 0xb8(%rbx)
movq 0x78(%rsp), %rax
movq %rax, 0xc0(%rbx)
movb $0x0, 0x38(%rbx)
movq 0xb8(%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%rbx)
movb (%rax), %al
movb %al, (%r12,%r14,4)
incq %r14
cmpl %r14d, %r15d
jne 0x2d3e0
movq 0x68(%rsp), %rcx
incq %rcx
incq %r12
addq $0x2, %r13
cmpq $0x4, %rcx
movl 0x18(%rsp), %ebp
jne 0x2d309
cmpl $0x4, 0x1c(%rsp)
movq 0x90(%rsp), %rbx
movq 0x88(%rsp), %r14
movq 0x80(%rsp), %r15
movq 0x30(%rsp), %rdi
jb 0x2d644
movq 0x70(%rsp), %rax
cmpl $0x10, (%rax)
jne 0x2d583
cmpl $0x0, 0xc(%rsp)
jle 0x2d644
movq 0x50(%rsp), %rcx
addl 0x20(%rsp), %ecx
movq 0x38(%rsp), %rdx
addl 0x28(%rsp), %edx
imull %ecx, %edx
xorl %eax, %eax
movss 0xfdc8(%rip), %xmm0     # 0x3d2ac
movss 0xed3c(%rip), %xmm1     # 0x3c228
movzwl 0x6(%rdi,%rax,8), %ecx
testl %ecx, %ecx
je 0x2d572
cmpl $0xffff, %ecx           # imm = 0xFFFF
je 0x2d572
movzwl %cx, %ecx
xorps %xmm2, %xmm2
cvtsi2ss %ecx, %xmm2
divss %xmm0, %xmm2
movaps %xmm1, %xmm3
divss %xmm2, %xmm3
movaps %xmm1, %xmm2
subss %xmm3, %xmm2
mulss %xmm0, %xmm2
movzwl (%rdi,%rax,8), %ecx
xorps %xmm4, %xmm4
cvtsi2ss %ecx, %xmm4
mulss %xmm3, %xmm4
addss %xmm2, %xmm4
cvttss2si %xmm4, %ecx
movw %cx, (%rdi,%rax,8)
movzwl 0x2(%rdi,%rax,8), %ecx
xorps %xmm4, %xmm4
cvtsi2ss %ecx, %xmm4
mulss %xmm3, %xmm4
addss %xmm2, %xmm4
cvttss2si %xmm4, %ecx
movw %cx, 0x2(%rdi,%rax,8)
movzwl 0x4(%rdi,%rax,8), %ecx
xorps %xmm4, %xmm4
cvtsi2ss %ecx, %xmm4
mulss %xmm3, %xmm4
addss %xmm2, %xmm4
cvttss2si %xmm4, %ecx
movw %cx, 0x4(%rdi,%rax,8)
incq %rax
cmpq %rax, %rdx
jne 0x2d4ec
jmp 0x2d644
cmpl $0x0, 0xc(%rsp)
jle 0x2d644
movq 0x50(%rsp), %rcx
addl 0x20(%rsp), %ecx
movq 0x38(%rsp), %rdx
addl 0x28(%rsp), %edx
imull %ecx, %edx
xorl %eax, %eax
movss 0xec87(%rip), %xmm0     # 0x3c234
movss 0xec73(%rip), %xmm1     # 0x3c228
movzbl 0x3(%rdi,%rax,4), %ecx
testl %ecx, %ecx
je 0x2d638
cmpl $0xff, %ecx
je 0x2d638
movzbl %cl, %ecx
xorps %xmm2, %xmm2
cvtsi2ss %ecx, %xmm2
divss %xmm0, %xmm2
movaps %xmm1, %xmm3
divss %xmm2, %xmm3
movaps %xmm1, %xmm2
subss %xmm3, %xmm2
mulss %xmm0, %xmm2
movzbl (%rdi,%rax,4), %ecx
xorps %xmm4, %xmm4
cvtsi2ss %ecx, %xmm4
mulss %xmm3, %xmm4
addss %xmm2, %xmm4
cvttss2si %xmm4, %ecx
movb %cl, (%rdi,%rax,4)
movzbl 0x1(%rdi,%rax,4), %ecx
xorps %xmm4, %xmm4
cvtsi2ss %ecx, %xmm4
mulss %xmm3, %xmm4
addss %xmm2, %xmm4
cvttss2si %xmm4, %ecx
movb %cl, 0x1(%rdi,%rax,4)
movzbl 0x2(%rdi,%rax,4), %ecx
xorps %xmm4, %xmm4
cvtsi2ss %ecx, %xmm4
mulss %xmm3, %xmm4
addss %xmm2, %xmm4
cvttss2si %xmm4, %ecx
movb %cl, 0x2(%rdi,%rax,4)
incq %rax
cmpq %rax, %rdx
jne 0x2d5b5
testl $0xfffffffb, %ebp       # imm = 0xFFFFFFFB
je 0x2d670
movq 0x70(%rsp), %rax
cmpl $0x10, (%rax)
movl 0x14(%rsp), %r12d
movl $0x4, %esi
movl %ebp, %edx
jne 0x2d677
movl 0x10(%rsp), %ecx
movl %r12d, %r8d
callq 0x3444c
jmp 0x2d683
movl 0x14(%rsp), %r12d
jmp 0x2d68f
movl 0x10(%rsp), %ecx
movl %r12d, %r8d
callq 0x33ff4
movq %rax, %rdi
testq %rax, %rax
je 0x2cef3
testq %r15, %r15
je 0x2d69b
movl $0x4, (%r15)
movl %r12d, (%r14)
movl 0x10(%rsp), %eax
movl %eax, (%rbx)
jmp 0x2cef5