// File: /workspace/github_c_makefile_star2_O3/archer1357[P]Offline-Raytracer/jo_jpeg.c
// Function: jo_write_jpg
bool jo_write_jpg(const char *filename, const void *data, int width, int height, int comp, int quality) {
  // Constants that don't pollute global namespace
  static const unsigned char std_dc_luminance_nrcodes[] = {0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0};
  static const unsigned char std_dc_luminance_values[] = {0,1,2,3,4,5,6,7,8,9,10,11};
  static const unsigned char std_ac_luminance_nrcodes[] = {0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,0x7d};
  static const unsigned char std_ac_luminance_values[] = {
    0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12,0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07,0x22,0x71,0x14,0x32,0x81,0x91,0xa1,0x08,
    0x23,0x42,0xb1,0xc1,0x15,0x52,0xd1,0xf0,0x24,0x33,0x62,0x72,0x82,0x09,0x0a,0x16,0x17,0x18,0x19,0x1a,0x25,0x26,0x27,0x28,
    0x29,0x2a,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58,0x59,
    0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x83,0x84,0x85,0x86,0x87,0x88,0x89,
    0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,0xb5,0xb6,
    0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xe1,0xe2,
    0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa
  };
  static const unsigned char std_dc_chrominance_nrcodes[] = {0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0};
  static const unsigned char std_dc_chrominance_values[] = {0,1,2,3,4,5,6,7,8,9,10,11};
  static const unsigned char std_ac_chrominance_nrcodes[] = {0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,0x77};
  static const unsigned char std_ac_chrominance_values[] = {
    0x00,0x01,0x02,0x03,0x11,0x04,0x05,0x21,0x31,0x06,0x12,0x41,0x51,0x07,0x61,0x71,0x13,0x22,0x32,0x81,0x08,0x14,0x42,0x91,
    0xa1,0xb1,0xc1,0x09,0x23,0x33,0x52,0xf0,0x15,0x62,0x72,0xd1,0x0a,0x16,0x24,0x34,0xe1,0x25,0xf1,0x17,0x18,0x19,0x1a,0x26,
    0x27,0x28,0x29,0x2a,0x35,0x36,0x37,0x38,0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58,
    0x59,0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x82,0x83,0x84,0x85,0x86,0x87,
    0x88,0x89,0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,
    0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,
    0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa
  };
  // Huffman tables
  static const unsigned short YDC_HT[256][2] = { {0,2},{2,3},{3,3},{4,3},{5,3},{6,3},{14,4},{30,5},{62,6},{126,7},{254,8},{510,9}};
  static const unsigned short UVDC_HT[256][2] = { {0,2},{1,2},{2,2},{6,3},{14,4},{30,5},{62,6},{126,7},{254,8},{510,9},{1022,10},{2046,11}};
  static const unsigned short YAC_HT[256][2] = {
    {10,4},{0,2},{1,2},{4,3},{11,4},{26,5},{120,7},{248,8},{1014,10},{65410,16},{65411,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {12,4},{27,5},{121,7},{502,9},{2038,11},{65412,16},{65413,16},{65414,16},{65415,16},{65416,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {28,5},{249,8},{1015,10},{4084,12},{65417,16},{65418,16},{65419,16},{65420,16},{65421,16},{65422,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {58,6},{503,9},{4085,12},{65423,16},{65424,16},{65425,16},{65426,16},{65427,16},{65428,16},{65429,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {59,6},{1016,10},{65430,16},{65431,16},{65432,16},{65433,16},{65434,16},{65435,16},{65436,16},{65437,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {122,7},{2039,11},{65438,16},{65439,16},{65440,16},{65441,16},{65442,16},{65443,16},{65444,16},{65445,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {123,7},{4086,12},{65446,16},{65447,16},{65448,16},{65449,16},{65450,16},{65451,16},{65452,16},{65453,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {250,8},{4087,12},{65454,16},{65455,16},{65456,16},{65457,16},{65458,16},{65459,16},{65460,16},{65461,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {504,9},{32704,15},{65462,16},{65463,16},{65464,16},{65465,16},{65466,16},{65467,16},{65468,16},{65469,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {505,9},{65470,16},{65471,16},{65472,16},{65473,16},{65474,16},{65475,16},{65476,16},{65477,16},{65478,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {506,9},{65479,16},{65480,16},{65481,16},{65482,16},{65483,16},{65484,16},{65485,16},{65486,16},{65487,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {1017,10},{65488,16},{65489,16},{65490,16},{65491,16},{65492,16},{65493,16},{65494,16},{65495,16},{65496,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {1018,10},{65497,16},{65498,16},{65499,16},{65500,16},{65501,16},{65502,16},{65503,16},{65504,16},{65505,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {2040,11},{65506,16},{65507,16},{65508,16},{65509,16},{65510,16},{65511,16},{65512,16},{65513,16},{65514,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {65515,16},{65516,16},{65517,16},{65518,16},{65519,16},{65520,16},{65521,16},{65522,16},{65523,16},{65524,16},{0,0},{0,0},{0,0},{0,0},{0,0},
    {2041,11},{65525,16},{65526,16},{65527,16},{65528,16},{65529,16},{65530,16},{65531,16},{65532,16},{65533,16},{65534,16},{0,0},{0,0},{0,0},{0,0},{0,0}
  };
  static const unsigned short UVAC_HT[256][2] = {
    {0,2},{1,2},{4,3},{10,4},{24,5},{25,5},{56,6},{120,7},{500,9},{1014,10},{4084,12},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {11,4},{57,6},{246,8},{501,9},{2038,11},{4085,12},{65416,16},{65417,16},{65418,16},{65419,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {26,5},{247,8},{1015,10},{4086,12},{32706,15},{65420,16},{65421,16},{65422,16},{65423,16},{65424,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {27,5},{248,8},{1016,10},{4087,12},{65425,16},{65426,16},{65427,16},{65428,16},{65429,16},{65430,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {58,6},{502,9},{65431,16},{65432,16},{65433,16},{65434,16},{65435,16},{65436,16},{65437,16},{65438,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {59,6},{1017,10},{65439,16},{65440,16},{65441,16},{65442,16},{65443,16},{65444,16},{65445,16},{65446,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {121,7},{2039,11},{65447,16},{65448,16},{65449,16},{65450,16},{65451,16},{65452,16},{65453,16},{65454,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {122,7},{2040,11},{65455,16},{65456,16},{65457,16},{65458,16},{65459,16},{65460,16},{65461,16},{65462,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {249,8},{65463,16},{65464,16},{65465,16},{65466,16},{65467,16},{65468,16},{65469,16},{65470,16},{65471,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {503,9},{65472,16},{65473,16},{65474,16},{65475,16},{65476,16},{65477,16},{65478,16},{65479,16},{65480,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {504,9},{65481,16},{65482,16},{65483,16},{65484,16},{65485,16},{65486,16},{65487,16},{65488,16},{65489,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {505,9},{65490,16},{65491,16},{65492,16},{65493,16},{65494,16},{65495,16},{65496,16},{65497,16},{65498,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {506,9},{65499,16},{65500,16},{65501,16},{65502,16},{65503,16},{65504,16},{65505,16},{65506,16},{65507,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {2041,11},{65508,16},{65509,16},{65510,16},{65511,16},{65512,16},{65513,16},{65514,16},{65515,16},{65516,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
    {16352,14},{65517,16},{65518,16},{65519,16},{65520,16},{65521,16},{65522,16},{65523,16},{65524,16},{65525,16},{0,0},{0,0},{0,0},{0,0},{0,0},
    {1018,10},{32707,15},{65526,16},{65527,16},{65528,16},{65529,16},{65530,16},{65531,16},{65532,16},{65533,16},{65534,16},{0,0},{0,0},{0,0},{0,0},{0,0}
  };
  static const int YQT[] = {16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99};
  static const int UVQT[] = {17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99};
  static const float aasf[] = { 1.0f * 2.828427125f, 1.387039845f * 2.828427125f, 1.306562965f * 2.828427125f, 1.175875602f * 2.828427125f, 1.0f * 2.828427125f, 0.785694958f * 2.828427125f, 0.541196100f * 2.828427125f, 0.275899379f * 2.828427125f };

  if(!data || !filename || !width || !height || comp > 4 || comp < 1 || comp == 2) {
    return false;
  }

  FILE *fp = fopen(filename, "wb");
  if(!fp) {
    return false;
  }

  quality = quality ? quality : 90;
  quality = quality < 1 ? 1 : quality > 100 ? 100 : quality;
  quality = quality < 50 ? 5000 / quality : 200 - quality * 2;

  unsigned char YTable[64], UVTable[64];
  int i,k,row,col;
  for(  i = 0; i < 64; ++i) {
    int yti = (YQT[i]*quality+50)/100;
    YTable[s_jo_ZigZag[i]] = yti < 1 ? 1 : yti > 255 ? 255 : yti;
    int uvti  = (UVQT[i]*quality+50)/100;
    UVTable[s_jo_ZigZag[i]] = uvti < 1 ? 1 : uvti > 255 ? 255 : uvti;
  }

  float fdtbl_Y[64], fdtbl_UV[64];
  for(  row = 0, k = 0; row < 8; ++row) {
    for(  col = 0; col < 8; ++col, ++k) {
      fdtbl_Y[k]  = 1 / (YTable [s_jo_ZigZag[k]] * aasf[row] * aasf[col]);
      fdtbl_UV[k] = 1 / (UVTable[s_jo_ZigZag[k]] * aasf[row] * aasf[col]);
    }
  }

  // Write Headers
  static const unsigned char head0[] = { 0xFF,0xD8,0xFF,0xE0,0,0x10,'J','F','I','F',0,1,1,0,0,1,0,1,0,0,0xFF,0xDB,0,0x84,0 };
  fwrite(head0, sizeof(head0), 1, fp);
  fwrite(YTable, sizeof(YTable), 1, fp);
  putc(1, fp);
  fwrite(UVTable, sizeof(UVTable), 1, fp);
  const unsigned char head1[] = { 0xFF,0xC0,0,0x11,8,(unsigned char)(height>>8),(unsigned char)(height&0xFF),(unsigned char)(width>>8),(unsigned char)(width&0xFF),3,1,0x11,0,2,0x11,1,3,0x11,1,0xFF,0xC4,0x01,0xA2,0 };
  fwrite(head1, sizeof(head1), 1, fp);
  fwrite(std_dc_luminance_nrcodes+1, sizeof(std_dc_luminance_nrcodes)-1, 1, fp);
  fwrite(std_dc_luminance_values, sizeof(std_dc_luminance_values), 1, fp);
  putc(0x10, fp); // HTYACinfo
  fwrite(std_ac_luminance_nrcodes+1, sizeof(std_ac_luminance_nrcodes)-1, 1, fp);
  fwrite(std_ac_luminance_values, sizeof(std_ac_luminance_values), 1, fp);
  putc(1, fp); // HTUDCinfo
  fwrite(std_dc_chrominance_nrcodes+1, sizeof(std_dc_chrominance_nrcodes)-1, 1, fp);
  fwrite(std_dc_chrominance_values, sizeof(std_dc_chrominance_values), 1, fp);
  putc(0x11, fp); // HTUACinfo
  fwrite(std_ac_chrominance_nrcodes+1, sizeof(std_ac_chrominance_nrcodes)-1, 1, fp);
  fwrite(std_ac_chrominance_values, sizeof(std_ac_chrominance_values), 1, fp);
  static const unsigned char head2[] = { 0xFF,0xDA,0,0xC,3,1,0,2,0x11,3,0x11,0,0x3F,0 };
  fwrite(head2, sizeof(head2), 1, fp);

  // Encode 8x8 macroblocks
  const unsigned char *imageData = (const unsigned char *)data;
  int DCY=0, DCU=0, DCV=0;
  int bitBuf=0, bitCnt=0;
  int ofsG = comp > 1 ? 1 : 0, ofsB = comp > 1 ? 2 : 0;

  int y,x,pos;
  for(  y = 0; y < height; y += 8) {
    for(  x = 0; x < width; x += 8) {
      float YDU[64], UDU[64], VDU[64];
      for(  row = y, pos = 0; row < y+8; ++row) {
        for(  col = x; col < x+8; ++col, ++pos) {
          int p = row*width*comp + col*comp;
          if(row >= height) {
            p -= width*comp*(row+1 - height);
          }
          if(col >= width) {
            p -= comp*(col+1 - width);
          }

          float r = imageData[p+0], g = imageData[p+ofsG], b = imageData[p+ofsB];
          YDU[pos]=+0.29900f*r+0.58700f*g+0.11400f*b-128;
          UDU[pos]=-0.16874f*r-0.33126f*g+0.50000f*b;
          VDU[pos]=+0.50000f*r-0.41869f*g-0.08131f*b;
        }
      }

      DCY = jo_processDU(fp, &bitBuf, &bitCnt, YDU, fdtbl_Y, DCY, YDC_HT, YAC_HT);
      DCU = jo_processDU(fp, &bitBuf, &bitCnt, UDU, fdtbl_UV, DCU, UVDC_HT, UVAC_HT);
      DCV = jo_processDU(fp, &bitBuf, &bitCnt, VDU, fdtbl_UV, DCV, UVDC_HT, UVAC_HT);
    }
  }

  // Do the bit alignment of the EOI marker
  static const unsigned short fillBits[] = {0x7F, 7};
  jo_writeBits(fp, &bitBuf, &bitCnt, fillBits);

  // EOI
  putc(0xFF, fp);
  putc(0xD9, fp);

  fclose(fp);
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x618, %rsp            # imm = 0x618
movl %ecx, (%rsp)
xorl %eax, %eax
cmpl $0x2, %r8d
je 0x405378
testq %rdi, %rdi
je 0x405378
movq %rsi, %r14
testq %rsi, %rsi
je 0x405378
testl %edx, %edx
je 0x405378
cmpl $0x0, (%rsp)
je 0x405378
movl %r8d, %ebx
leal -0x5(%rbx), %ecx
cmpl $-0x4, %ecx
jb 0x405378
movl %r9d, %ebp
movq %rdx, 0x28(%rsp)
leaq 0xd17b1(%rip), %rsi     # 0x4d6312
callq 0x42f2a0
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0x404ba3
cmpl $0x64, %ebp
movl $0x64, %eax
cmovll %ebp, %eax
cmpl $0x2, %eax
movl $0x1, %edx
cmovgel %eax, %edx
testl %ebp, %ebp
movl $0x5a, %ecx
cmovnel %edx, %ecx
cmpl $0x31, %ecx
ja 0x404baa
movw $0x1388, %ax            # imm = 0x1388
xorl %edx, %edx
divw %cx
movzwl %ax, %eax
jmp 0x404bb3
xorl %eax, %eax
jmp 0x405378
addl %ecx, %ecx
movl $0xc8, %eax
subl %ecx, %eax
leaq 0xd2cd6(%rip), %rcx     # 0x4d7890
xorl %edx, %edx
leaq 0xd2acd(%rip), %rsi     # 0x4d7690
leaq 0xd2bc6(%rip), %rdi     # 0x4d7790
movl (%rdx,%rsi), %r8d
imull %eax, %r8d
addl $0x32, %r8d
movslq %r8d, %r8
imulq $0x51eb851f, %r8, %r10  # imm = 0x51EB851F
movq %r10, %r8
shrq $0x3f, %r8
sarq $0x25, %r10
addl %r8d, %r10d
movl $0xff, %r8d
cmpl %r8d, %r10d
jl 0x404bff
movl $0xff, %r10d
cmpl $0x2, %r10d
jge 0x404c0b
movl $0x1, %r10d
movzbl (%rcx), %r9d
movb %r10b, 0xd0(%rsp,%r9)
movl (%rdx,%rdi), %r10d
imull %eax, %r10d
addl $0x32, %r10d
movslq %r10d, %r10
imulq $0x51eb851f, %r10, %r10 # imm = 0x51EB851F
movq %r10, %r11
shrq $0x3f, %r11
sarq $0x25, %r10
addl %r11d, %r10d
cmpl %r8d, %r10d
jl 0x404c46
movl $0xff, %r10d
cmpl $0x2, %r10d
jge 0x404c52
movl $0x1, %r10d
movb %r10b, 0x90(%rsp,%r9)
addq $0x4, %rdx
incq %rcx
cmpq $0x100, %rdx            # imm = 0x100
jne 0x404bca
xorl %eax, %eax
leaq 0xd2c89(%rip), %rcx     # 0x4d7900
pxor %xmm0, %xmm0
movaps 0xd17de(%rip), %xmm1    # 0x4d6460
xorl %edx, %edx
movslq %edx, %r9
leaq 0x8(%r9), %rdx
movq %rdx, 0x30(%rsp)
movss (%rcx,%rax,4), %xmm2
shufps $0x0, %xmm2, %xmm2      # xmm2 = xmm2[0,0,0,0]
leaq 0xd2bf0(%rip), %rdx     # 0x4d7890
leaq (%r9,%rdx), %rdi
addq $0x3, %rdi
leaq (%rsp,%r9,4), %r8
addq $0x510, %r8             # imm = 0x510
leaq (%rsp,%r9,4), %r9
addq $0x310, %r9             # imm = 0x310
xorl %r10d, %r10d
movzbl -0x3(%rdi), %r15d
movzbl -0x2(%rdi), %r12d
movzbl -0x1(%rdi), %r13d
movzbl (%rdi), %r11d
movzbl 0xd0(%rsp,%r15), %ebp
movzbl 0xd0(%rsp,%r12), %edx
movzbl 0xd0(%rsp,%r13), %esi
shll $0x8, %edx
orl %ebp, %edx
shll $0x10, %esi
orl %edx, %esi
movzbl 0xd0(%rsp,%r11), %edx
shll $0x18, %edx
orl %esi, %edx
movd %edx, %xmm3
punpcklbw %xmm0, %xmm3    # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1],xmm3[2],xmm0[2],xmm3[3],xmm0[3],xmm3[4],xmm0[4],xmm3[5],xmm0[5],xmm3[6],xmm0[6],xmm3[7],xmm0[7]
punpcklwd %xmm0, %xmm3    # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1],xmm3[2],xmm0[2],xmm3[3],xmm0[3]
cvtdq2ps %xmm3, %xmm3
mulps %xmm2, %xmm3
movaps (%r10,%rcx), %xmm4
mulps %xmm4, %xmm3
movaps %xmm1, %xmm5
divps %xmm3, %xmm5
movups %xmm5, (%r8,%r10)
movzbl 0x90(%rsp,%r15), %edx
movzbl 0x90(%rsp,%r12), %esi
movzbl 0x90(%rsp,%r13), %ebp
shll $0x8, %esi
orl %edx, %esi
shll $0x10, %ebp
orl %esi, %ebp
movzbl 0x90(%rsp,%r11), %edx
shll $0x18, %edx
orl %ebp, %edx
movd %edx, %xmm3
punpcklbw %xmm0, %xmm3    # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1],xmm3[2],xmm0[2],xmm3[3],xmm0[3],xmm3[4],xmm0[4],xmm3[5],xmm0[5],xmm3[6],xmm0[6],xmm3[7],xmm0[7]
punpcklwd %xmm0, %xmm3    # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1],xmm3[2],xmm0[2],xmm3[3],xmm0[3]
cvtdq2ps %xmm3, %xmm3
mulps %xmm2, %xmm3
mulps %xmm4, %xmm3
movaps %xmm1, %xmm4
divps %xmm3, %xmm4
movups %xmm4, (%r9,%r10)
addq $0x10, %r10
addq $0x4, %rdi
cmpq $0x20, %r10
jne 0x404cc1
incq %rax
cmpq $0x8, %rax
movq 0x30(%rsp), %rdx
jne 0x404c84
leaq 0xd2b26(%rip), %rdi     # 0x4d78d0
movl $0x19, %esi
movl $0x1, %edx
movq 0x20(%rsp), %r15
movq %r15, %rcx
callq 0x42f5f0
leaq 0xd0(%rsp), %rdi
movl $0x40, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x42f5f0
movl $0x1, %edi
movq %r15, %rsi
callq 0x433600
leaq 0x90(%rsp), %rdi
movl $0x40, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x42f5f0
leaq 0x70(%rsp), %rdi
movl $0x1100c0ff, (%rdi)     # imm = 0x1100C0FF
movb $0x8, 0x4(%rdi)
movl (%rsp), %eax
movb %ah, 0x75(%rsp)
movb %al, 0x6(%rdi)
movl %eax, %ebp
movq 0x28(%rsp), %rax
movb %ah, 0x77(%rsp)
movb %al, 0x8(%rdi)
movq %rax, %r12
movabsq $0x301110200110103, %rax # imm = 0x301110200110103
movq %rax, 0x9(%rdi)
movl $0xc4ff0111, 0x11(%rdi) # imm = 0xC4FF0111
movw $0xa201, 0x15(%rdi)     # imm = 0xA201
movb $0x0, 0x17(%rdi)
movl $0x18, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x42f5f0
leaq 0xd164d(%rip), %rdi     # 0x4d64b1
movl $0x10, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x42f5f0
leaq 0xd1644(%rip), %rdi     # 0x4d64c1
movl $0xc, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x42f5f0
movl $0x10, %edi
movq %r15, %rsi
callq 0x433600
leaq 0xd162e(%rip), %rdi     # 0x4d64d1
movl $0x10, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x42f5f0
leaq 0xd1634(%rip), %rdi     # 0x4d64f0
movl $0xa2, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x42f5f0
movl $0x1, %edi
movq %r15, %rsi
callq 0x433600
leaq 0xd16bf(%rip), %rdi     # 0x4d65a1
movl $0x10, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x42f5f0
leaq 0xd16b6(%rip), %rdi     # 0x4d65b1
movl $0xc, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x42f5f0
movl $0x11, %edi
movq %r15, %rsi
callq 0x433600
leaq 0xd16a0(%rip), %rdi     # 0x4d65c1
movl $0x10, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x42f5f0
leaq 0xd16a6(%rip), %rdi     # 0x4d65e0
movl $0xa2, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x42f5f0
leaq 0xd2996(%rip), %rdi     # 0x4d78e9
movl $0xe, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x42f5f0
xorl %r13d, %r13d
movl %r13d, 0x8(%rsp)
movl %r13d, 0x4(%rsp)
xorl %edx, %edx
cmpl $0x2, %ebx
setge %al
testl %ebp, %ebp
jle 0x405332
movq %r12, %rcx
movb %al, %dl
leal (%rdx,%rdx), %r11d
movl %ebx, %ebp
imull %ecx, %ebp
leal (,%rbp,8), %esi
movl %esi, 0x40(%rsp)
leal (,%rbx,8), %esi
movl %esi, 0x4c(%rsp)
leal -0x1(%r12), %esi
imull %ebx, %esi
movl %esi, 0x3c(%rsp)
movl $0x8, 0x18(%rsp)
leaq 0x210(%rsp), %r8
leaq 0x110(%rsp), %rdi
leaq 0x410(%rsp), %r12
movss 0xd1496(%rip), %xmm5    # 0x4d6470
movss 0xd1492(%rip), %xmm6    # 0x4d6474
movss 0xd148e(%rip), %xmm7    # 0x4d6478
movss 0xd1489(%rip), %xmm8    # 0x4d647c
movss 0xd1484(%rip), %xmm9    # 0x4d6480
movss 0xd147f(%rip), %xmm10   # 0x4d6484
movss 0xd147a(%rip), %xmm11   # 0x4d6488
movss 0xd1475(%rip), %xmm12   # 0x4d648c
movss 0xd1470(%rip), %xmm13   # 0x4d6490
xorl %r9d, %r9d
movl $0x0, 0xc(%rsp)
xorl %eax, %eax
movl $0x0, 0x14(%rsp)
movl $0x0, 0x10(%rsp)
movq %rbp, 0x68(%rsp)
testl %ecx, %ecx
movq %rdx, 0x60(%rsp)
movl %r11d, 0x48(%rsp)
movl %r9d, 0x44(%rsp)
jle 0x4052fa
movl 0x3c(%rsp), %ecx
movl %ecx, 0x1c(%rsp)
xorl %r15d, %r15d
movl %eax, 0x5c(%rsp)
movl %edx, 0x58(%rsp)
movl %edx, %eax
movl %r11d, 0x54(%rsp)
movl %r11d, %ecx
movl %r9d, 0x50(%rsp)
movl %r9d, %edx
movq %r12, %rsi
movl 0xc(%rsp), %r9d
movl %r9d, %r10d
notl %r10d
movl (%rsp), %r11d
addl %r11d, %r10d
imull %ebp, %r10d
movl %r9d, 0x30(%rsp)
cmpl %r11d, %r9d
cmovll %r13d, %r10d
movl 0x1c(%rsp), %r11d
xorl %r12d, %r12d
movq 0x28(%rsp), %r9
leal (%r15,%r12), %ebp
cmpl %r9d, %ebp
movl %r11d, %ebp
cmovll %r13d, %ebp
leal (%rdx,%r10), %r13d
addl %ebp, %r13d
movslq %r13d, %r13
movzbl (%r14,%r13), %r13d
xorps %xmm0, %xmm0
cvtsi2ss %r13d, %xmm0
leal (%rax,%r10), %r13d
addl %ebp, %r13d
movslq %r13d, %r13
movzbl (%r14,%r13), %r13d
xorps %xmm1, %xmm1
cvtsi2ss %r13d, %xmm1
addl %ecx, %ebp
addl %r10d, %ebp
movslq %ebp, %r13
movzbl (%r14,%r13), %ebp
xorl %r13d, %r13d
xorps %xmm2, %xmm2
cvtsi2ss %ebp, %xmm2
movaps %xmm1, %xmm3
mulss %xmm5, %xmm3
movaps %xmm0, %xmm4
mulss %xmm6, %xmm4
addss %xmm3, %xmm4
movaps %xmm2, %xmm3
mulss %xmm7, %xmm3
addss %xmm4, %xmm3
addss %xmm8, %xmm3
movss %xmm3, (%r8,%r12,4)
movaps %xmm1, %xmm3
mulss %xmm9, %xmm3
movaps %xmm0, %xmm4
mulss %xmm10, %xmm4
addss %xmm3, %xmm4
movaps %xmm2, %xmm3
mulss %xmm11, %xmm3
addss %xmm4, %xmm3
movss %xmm3, (%rdi,%r12,4)
mulss %xmm12, %xmm1
mulss %xmm11, %xmm0
addss %xmm1, %xmm0
mulss %xmm13, %xmm2
addss %xmm0, %xmm2
movss %xmm2, (%rsi,%r12,4)
incq %r12
addl %ebx, %r10d
subl %ebx, %r11d
cmpl $0x8, %r12d
jne 0x4050b0
movl 0x30(%rsp), %r9d
incl %r9d
addq $0x20, %r8
addq $0x20, %rdi
addq $0x20, %rsi
movq 0x68(%rsp), %rbp
addl %ebp, %edx
addl %ebp, %ecx
addl %ebp, %eax
cmpl 0x18(%rsp), %r9d
jne 0x405086
movq 0x20(%rsp), %r12
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
leaq 0x4(%rsp), %rdx
leaq 0x210(%rsp), %rcx
leaq 0x510(%rsp), %r8
movl 0x10(%rsp), %r9d
leaq 0xd1cb7(%rip), %rax     # 0x4d6e90
pushq %rax
leaq 0xd14af(%rip), %rax     # 0x4d6690
pushq %rax
callq 0x40538a
addq $0x10, %rsp
movl %eax, 0x10(%rsp)
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
leaq 0x4(%rsp), %rdx
leaq 0x110(%rsp), %rcx
leaq 0x310(%rsp), %r8
movl 0x14(%rsp), %r9d
leaq 0xd2078(%rip), %rax     # 0x4d7290
pushq %rax
leaq 0xd1870(%rip), %rax     # 0x4d6a90
pushq %rax
callq 0x40538a
addq $0x10, %rsp
movl %eax, 0x14(%rsp)
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
leaq 0x4(%rsp), %rdx
leaq 0x410(%rsp), %r12
movq %r12, %rcx
leaq 0x310(%rsp), %r8
movl 0x5c(%rsp), %r9d
leaq 0xd2036(%rip), %rax     # 0x4d7290
pushq %rax
leaq 0xd182e(%rip), %rax     # 0x4d6a90
pushq %rax
callq 0x40538a
movss 0xd121f(%rip), %xmm13   # 0x4d6490
movss 0xd1212(%rip), %xmm12   # 0x4d648c
movss 0xd1205(%rip), %xmm11   # 0x4d6488
movss 0xd11f8(%rip), %xmm10   # 0x4d6484
movss 0xd11eb(%rip), %xmm9    # 0x4d6480
movss 0xd11de(%rip), %xmm8    # 0x4d647c
movss 0xd11d2(%rip), %xmm7    # 0x4d6478
movss 0xd11c6(%rip), %xmm6    # 0x4d6474
movss 0xd11ba(%rip), %xmm5    # 0x4d6470
leaq 0x120(%rsp), %rdi
leaq 0x220(%rsp), %r8
addq $0x10, %rsp
addq $0x8, %r15
movl 0x4c(%rsp), %ecx
movl 0x50(%rsp), %r9d
addl %ecx, %r9d
movl 0x54(%rsp), %r11d
addl %ecx, %r11d
movl 0x58(%rsp), %edx
addl %ecx, %edx
subl %ecx, 0x1c(%rsp)
movq 0x28(%rsp), %rcx
cmpl %ecx, %r15d
jl 0x405064
movl 0xc(%rsp), %r10d
addl $0x8, %r10d
addl $0x8, 0x18(%rsp)
movl 0x40(%rsp), %esi
movl 0x44(%rsp), %r9d
addl %esi, %r9d
movl 0x48(%rsp), %r11d
addl %esi, %r11d
movq 0x60(%rsp), %rdx
addl %esi, %edx
movl %r10d, 0xc(%rsp)
cmpl (%rsp), %r10d
jl 0x405042
leaq 0x8(%rsp), %rsi
leaq 0x4(%rsp), %rdx
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
movl $0x7f, %ecx
movl $0x7, %r8d
callq 0x405719
movl $0xff, %edi
movq %rbx, %rsi
callq 0x433600
movl $0xd9, %edi
movq %rbx, %rsi
callq 0x433600
movq %rbx, %rdi
callq 0x42eb70
movb $0x1, %al
addq $0x618, %rsp            # imm = 0x618
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq