unsigned char *stbi_write_png_to_mem(unsigned char *pixels, int stride_bytes,
                                     int x, int y, int n, int *out_len) {
  int ctype[5] = {-1, 0, 4, 2, 6};
  unsigned char sig[8] = {137, 80, 78, 71, 13, 10, 26, 10};
  unsigned char *out, *o, *filt, *zlib;
  signed char *line_buffer;
  int i, j, k, p, zlen;
  if (stride_bytes == 0)
    stride_bytes = x * n;
  filt = (unsigned char *)malloc((x * n + 1) * y);
  if (!filt)
    return 0;
  line_buffer = (signed char *)malloc(x * n);
  if (!line_buffer) {
    free(filt);
    return 0;
  }
  for (j = 0; j < y; ++j) {
    static int mapping[] = {0, 1, 2, 3, 4};
    static int firstmap[] = {0, 1, 0, 5, 6};
    int *mymap = j ? mapping : firstmap;
    int best = 0, bestval = 0x7fffffff;
    for (p = 0; p < 2; ++p) {
      for (k = p ? best : 0; k < 5; ++k) {
        int type = mymap[k], est = 0;
        unsigned char *z = pixels + stride_bytes * j;
        for (i = 0; i < n; ++i)
          switch (type) {
          case 0:
            line_buffer[i] = z[i];
            break;
          case 1:
            line_buffer[i] = z[i];
            break;
          case 2:
            line_buffer[i] = z[i] - z[i - stride_bytes];
            break;
          case 3:
            line_buffer[i] = z[i] - (z[i - stride_bytes] >> 1);
            break;
          case 4:
            line_buffer[i] =
                (signed char)(z[i] - stbiw__paeth(0, z[i - stride_bytes], 0));
            break;
          case 5:
            line_buffer[i] = z[i];
            break;
          case 6:
            line_buffer[i] = z[i];
            break;
          }
        for (i = n; i < x * n; ++i) {
          switch (type) {
          case 0:
            line_buffer[i] = z[i];
            break;
          case 1:
            line_buffer[i] = z[i] - z[i - n];
            break;
          case 2:
            line_buffer[i] = z[i] - z[i - stride_bytes];
            break;
          case 3:
            line_buffer[i] = z[i] - ((z[i - n] + z[i - stride_bytes]) >> 1);
            break;
          case 4:
            line_buffer[i] = z[i] - stbiw__paeth(z[i - n], z[i - stride_bytes],
                                                 z[i - stride_bytes - n]);
            break;
          case 5:
            line_buffer[i] = z[i] - (z[i - n] >> 1);
            break;
          case 6:
            line_buffer[i] = z[i] - stbiw__paeth(z[i - n], 0, 0);
            break;
          }
        }
        if (p)
          break;
        for (i = 0; i < x * n; ++i)
          est += abs((signed char)line_buffer[i]);
        if (est < bestval) {
          bestval = est;
          best = k;
        }
      }
    }
    filt[j * (x * n + 1)] = (unsigned char)best;
    memmove(filt + j * (x * n + 1) + 1, line_buffer, x * n);
  }
  free(line_buffer);
  zlib = stbi_zlib_compress(filt, y * (x * n + 1), &zlen, 8);
  free(filt);
  if (!zlib)
    return 0;
  out = (unsigned char *)malloc(8 + 12 + 13 + 12 + zlen + 12);
  if (!out)
    return 0;
  *out_len = 8 + 12 + 13 + 12 + zlen + 12;
  o = out;
  memmove(o, sig, 8);
  o += 8;
  ((o)[0] = (unsigned char)(((13) >> 24) & 0xff),
   (o)[1] = (unsigned char)(((13) >> 16) & 0xff),
   (o)[2] = (unsigned char)(((13) >> 8) & 0xff),
   (o)[3] = (unsigned char)(((13)) & 0xff), (o) += 4);
  ;
  ((o)[0] = (unsigned char)(("IHDR"[0]) & 0xff),
   (o)[1] = (unsigned char)(("IHDR"[1]) & 0xff),
   (o)[2] = (unsigned char)(("IHDR"[2]) & 0xff),
   (o)[3] = (unsigned char)(("IHDR"[3]) & 0xff), (o) += 4);
  ((o)[0] = (unsigned char)(((x) >> 24) & 0xff),
   (o)[1] = (unsigned char)(((x) >> 16) & 0xff),
   (o)[2] = (unsigned char)(((x) >> 8) & 0xff),
   (o)[3] = (unsigned char)(((x)) & 0xff), (o) += 4);
  ;
  ((o)[0] = (unsigned char)(((y) >> 24) & 0xff),
   (o)[1] = (unsigned char)(((y) >> 16) & 0xff),
   (o)[2] = (unsigned char)(((y) >> 8) & 0xff),
   (o)[3] = (unsigned char)(((y)) & 0xff), (o) += 4);
  ;
  *o++ = 8;
  *o++ = (unsigned char)((ctype[n]) & 0xff);
  *o++ = 0;
  *o++ = 0;
  *o++ = 0;
  stbiw__wpcrc(&o, 13);
  ((o)[0] = (unsigned char)(((zlen) >> 24) & 0xff),
   (o)[1] = (unsigned char)(((zlen) >> 16) & 0xff),
   (o)[2] = (unsigned char)(((zlen) >> 8) & 0xff),
   (o)[3] = (unsigned char)(((zlen)) & 0xff), (o) += 4);
  ;
  ((o)[0] = (unsigned char)(("IDAT"[0]) & 0xff),
   (o)[1] = (unsigned char)(("IDAT"[1]) & 0xff),
   (o)[2] = (unsigned char)(("IDAT"[2]) & 0xff),
   (o)[3] = (unsigned char)(("IDAT"[3]) & 0xff), (o) += 4);
  memmove(o, zlib, zlen);
  o += zlen;
  free(zlib);
  stbiw__wpcrc(&o, zlen);
  ((o)[0] = (unsigned char)(((0) >> 24) & 0xff),
   (o)[1] = (unsigned char)(((0) >> 16) & 0xff),
   (o)[2] = (unsigned char)(((0) >> 8) & 0xff),
   (o)[3] = (unsigned char)(((0)) & 0xff), (o) += 4);
  ;
  ((o)[0] = (unsigned char)(("IEND"[0]) & 0xff),
   (o)[1] = (unsigned char)(("IEND"[1]) & 0xff),
   (o)[2] = (unsigned char)(("IEND"[2]) & 0xff),
   (o)[3] = (unsigned char)(("IEND"[3]) & 0xff), (o) += 4);
  stbiw__wpcrc(&o, 0);
  assert(o == out + *out_len);
  return out;
}


x86 assembly (clang, -O0):
<stbi_write_png_to_mem>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    0xe99(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xe96(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xe94(%rip),%eax
mov    %eax,-0x30(%rbp)
mov    0xe8e(%rip),%rax
mov    %rax,-0x48(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11de <stbi_write_png_to_mem+0x5e>
mov    -0x18(%rbp),%eax
imul   -0x20(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
imul   -0x20(%rbp),%eax
add    $0x1,%eax
imul   -0x1c(%rbp),%eax
movslq %eax,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
jne    1210 <stbi_write_png_to_mem+0x90>
movq   $0x0,-0x8(%rbp)
jmp    1bfa <stbi_write_png_to_mem+0xa7a>
mov    -0x18(%rbp),%eax
imul   -0x20(%rbp),%eax
movslq %eax,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x70(%rbp)
cmpq   $0x0,-0x70(%rbp)
jne    1244 <stbi_write_png_to_mem+0xc4>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
jmp    1bfa <stbi_write_png_to_mem+0xa7a>
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    17c5 <stbi_write_png_to_mem+0x645>
mov    -0x78(%rbp),%edx
lea    0x2e2f(%rip),%rax
lea    0x2e08(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x90(%rbp)
movl   $0x0,-0x94(%rbp)
movl   $0x7fffffff,-0x98(%rbp)
ff ff 7f
movl   $0x0,-0x80(%rbp)
cmpl   $0x2,-0x80(%rbp)
jge    1765 <stbi_write_png_to_mem+0x5e5>
cmpl   $0x0,-0x80(%rbp)
je     12b6 <stbi_write_png_to_mem+0x136>
mov    -0x94(%rbp),%eax
mov    %eax,-0xac(%rbp)
jmp    12c3 <stbi_write_png_to_mem+0x143>
xor    %eax,%eax
mov    %eax,-0xac(%rbp)
jmp    12c3 <stbi_write_png_to_mem+0x143>
mov    -0xac(%rbp),%eax
mov    %eax,-0x7c(%rbp)
cmpl   $0x5,-0x7c(%rbp)
jge    1752 <stbi_write_png_to_mem+0x5d2>
mov    -0x90(%rbp),%rax
movslq -0x7c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x9c(%rbp)
movl   $0x0,-0xa0(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x78(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0xa8(%rbp)
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1494 <stbi_write_png_to_mem+0x314>
mov    -0x9c(%rbp),%eax
mov    %rax,-0xb8(%rbp)
sub    $0x6,%rax
ja     1481 <stbi_write_png_to_mem+0x301>
mov    -0xb8(%rbp),%rax
lea    0xcd8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0xa8(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x70(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1481 <stbi_write_png_to_mem+0x301>
mov    -0xa8(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x70(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1481 <stbi_write_png_to_mem+0x301>
mov    -0xa8(%rbp),%rax
movslq -0x74(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0xa8(%rbp),%rcx
mov    -0x74(%rbp),%edx
sub    -0x14(%rbp),%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
sub    %ecx,%eax
mov    %al,%dl
mov    -0x70(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1481 <stbi_write_png_to_mem+0x301>
mov    -0xa8(%rbp),%rax
movslq -0x74(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0xa8(%rbp),%rcx
mov    -0x74(%rbp),%edx
sub    -0x14(%rbp),%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
sar    $0x1,%ecx
sub    %ecx,%eax
mov    %al,%dl
mov    -0x70(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1481 <stbi_write_png_to_mem+0x301>
mov    -0xa8(%rbp),%rax
movslq -0x74(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0xbc(%rbp)
mov    -0xa8(%rbp),%rax
mov    -0x74(%rbp),%ecx
sub    -0x14(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%esi
xor    %edx,%edx
mov    %edx,%edi
mov    $0x0,%al
call   1060 <stbiw__paeth@plt>
mov    %eax,%ecx
mov    -0xbc(%rbp),%eax
sub    %ecx,%eax
mov    %al,%dl
mov    -0x70(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1481 <stbi_write_png_to_mem+0x301>
mov    -0xa8(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x70(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1481 <stbi_write_png_to_mem+0x301>
mov    -0xa8(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x70(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1486 <stbi_write_png_to_mem+0x306>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1313 <stbi_write_png_to_mem+0x193>
mov    -0x20(%rbp),%eax
mov    %eax,-0x74(%rbp)
mov    -0x74(%rbp),%eax
mov    -0x18(%rbp),%ecx
imul   -0x20(%rbp),%ecx
cmp    %ecx,%eax
jge    16c5 <stbi_write_png_to_mem+0x545>
mov    -0x9c(%rbp),%eax
mov    %rax,-0xc8(%rbp)
sub    $0x6,%rax
ja     16b2 <stbi_write_png_to_mem+0x532>
mov    -0xc8(%rbp),%rax
lea    0xb2f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0xa8(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x70(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    16b2 <stbi_write_png_to_mem+0x532>
mov    -0xa8(%rbp),%rax
movslq -0x74(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0xa8(%rbp),%rcx
mov    -0x74(%rbp),%edx
sub    -0x20(%rbp),%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
sub    %ecx,%eax
mov    %al,%dl
mov    -0x70(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    16b2 <stbi_write_png_to_mem+0x532>
mov    -0xa8(%rbp),%rax
movslq -0x74(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0xa8(%rbp),%rcx
mov    -0x74(%rbp),%edx
sub    -0x14(%rbp),%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
sub    %ecx,%eax
mov    %al,%dl
mov    -0x70(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    16b2 <stbi_write_png_to_mem+0x532>
mov    -0xa8(%rbp),%rax
movslq -0x74(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0xa8(%rbp),%rcx
mov    -0x74(%rbp),%edx
sub    -0x20(%rbp),%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
mov    -0xa8(%rbp),%rdx
mov    -0x74(%rbp),%esi
sub    -0x14(%rbp),%esi
movslq %esi,%rsi
movzbl (%rdx,%rsi,1),%edx
add    %edx,%ecx
sar    $0x1,%ecx
sub    %ecx,%eax
mov    %al,%dl
mov    -0x70(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    16b2 <stbi_write_png_to_mem+0x532>
mov    -0xa8(%rbp),%rax
movslq -0x74(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0xcc(%rbp)
mov    -0xa8(%rbp),%rax
mov    -0x74(%rbp),%ecx
sub    -0x20(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edi
mov    -0xa8(%rbp),%rax
mov    -0x74(%rbp),%ecx
sub    -0x14(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%esi
mov    -0xa8(%rbp),%rax
mov    -0x74(%rbp),%ecx
sub    -0x14(%rbp),%ecx
sub    -0x20(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edx
mov    $0x0,%al
call   1060 <stbiw__paeth@plt>
mov    %eax,%ecx
mov    -0xcc(%rbp),%eax
sub    %ecx,%eax
mov    %al,%dl
mov    -0x70(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    16b2 <stbi_write_png_to_mem+0x532>
mov    -0xa8(%rbp),%rax
movslq -0x74(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0xa8(%rbp),%rcx
mov    -0x74(%rbp),%edx
sub    -0x20(%rbp),%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
sar    $0x1,%ecx
sub    %ecx,%eax
mov    %al,%dl
mov    -0x70(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    16b2 <stbi_write_png_to_mem+0x532>
mov    -0xa8(%rbp),%rax
movslq -0x74(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0xd0(%rbp)
mov    -0xa8(%rbp),%rax
mov    -0x74(%rbp),%ecx
sub    -0x20(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edi
xor    %edx,%edx
mov    %edx,%esi
mov    $0x0,%al
call   1060 <stbiw__paeth@plt>
mov    %eax,%ecx
mov    -0xd0(%rbp),%eax
sub    %ecx,%eax
mov    %al,%dl
mov    -0x70(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    16b7 <stbi_write_png_to_mem+0x537>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    149a <stbi_write_png_to_mem+0x31a>
cmpl   $0x0,-0x80(%rbp)
je     16d4 <stbi_write_png_to_mem+0x554>
jmp    1752 <stbi_write_png_to_mem+0x5d2>
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
mov    -0x18(%rbp),%ecx
imul   -0x20(%rbp),%ecx
cmp    %ecx,%eax
jge    1718 <stbi_write_png_to_mem+0x598>
mov    -0x70(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1050 <abs@plt>
add    -0xa0(%rbp),%eax
mov    %eax,-0xa0(%rbp)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    16db <stbi_write_png_to_mem+0x55b>
mov    -0xa0(%rbp),%eax
cmp    -0x98(%rbp),%eax
jge    173f <stbi_write_png_to_mem+0x5bf>
mov    -0xa0(%rbp),%eax
mov    %eax,-0x98(%rbp)
mov    -0x7c(%rbp),%eax
mov    %eax,-0x94(%rbp)
jmp    1744 <stbi_write_png_to_mem+0x5c4>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    12cc <stbi_write_png_to_mem+0x14c>
jmp    1757 <stbi_write_png_to_mem+0x5d7>
mov    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    1291 <stbi_write_png_to_mem+0x111>
mov    -0x94(%rbp),%eax
mov    %al,%dl
mov    -0x60(%rbp),%rax
mov    -0x78(%rbp),%ecx
mov    -0x18(%rbp),%esi
imul   -0x20(%rbp),%esi
add    $0x1,%esi
imul   %esi,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x60(%rbp),%rdi
mov    -0x78(%rbp),%eax
mov    -0x18(%rbp),%ecx
imul   -0x20(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
cltq
add    %rax,%rdi
add    $0x1,%rdi
mov    -0x70(%rbp),%rsi
mov    -0x18(%rbp),%eax
imul   -0x20(%rbp),%eax
movslq %eax,%rdx
call   10a0 <memmove@plt>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    124b <stbi_write_png_to_mem+0xcb>
mov    -0x70(%rbp),%rdi
call   1030 <free@plt>
mov    -0x60(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%eax
imul   -0x20(%rbp),%eax
add    $0x1,%eax
imul   %eax,%esi
lea    -0x84(%rbp),%rdx
mov    $0x8,%ecx
mov    $0x0,%al
call   1040 <stbi_zlib_compress@plt>
cltq
mov    %rax,-0x68(%rbp)
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x68(%rbp)
jne    181c <stbi_write_png_to_mem+0x69c>
movq   $0x0,-0x8(%rbp)
jmp    1bfa <stbi_write_png_to_mem+0xa7a>
mov    -0x84(%rbp),%eax
add    $0x2d,%eax
add    $0xc,%eax
movslq %eax,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
jne    184c <stbi_write_png_to_mem+0x6cc>
movq   $0x0,-0x8(%rbp)
jmp    1bfa <stbi_write_png_to_mem+0xa7a>
mov    -0x84(%rbp),%ecx
add    $0x2d,%ecx
add    $0xc,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x50(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
lea    -0x48(%rbp),%rcx
mov    (%rcx),%rcx
mov    %rcx,(%rax)
mov    -0x58(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x58(%rbp),%rax
movb   $0x0,0x1(%rax)
mov    -0x58(%rbp),%rax
movb   $0x0,0x2(%rax)
mov    -0x58(%rbp),%rax
movb   $0xd,0x3(%rax)
mov    -0x58(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x58(%rbp)
movsbl 0x7aa(%rip),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %cl,(%rax)
movsbl 0x797(%rip),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %cl,0x1(%rax)
movsbl 0x783(%rip),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %cl,0x2(%rax)
movsbl 0x76f(%rip),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x58(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x58(%rbp)
mov    -0x18(%rbp),%eax
sar    $0x18,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x18(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x18(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x58(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x58(%rbp)
mov    -0x1c(%rbp),%eax
sar    $0x18,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %cl,(%rax)
mov    -0x1c(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x1c(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x1c(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x58(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x58(%rbp)
movb   $0x8,(%rax)
movslq -0x20(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x58(%rbp)
mov    %cl,(%rax)
mov    -0x58(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x58(%rbp)
movb   $0x0,(%rax)
mov    -0x58(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x58(%rbp)
movb   $0x0,(%rax)
mov    -0x58(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x58(%rbp)
movb   $0x0,(%rax)
lea    -0x58(%rbp),%rdi
mov    $0xd,%esi
mov    $0x0,%al
call   1070 <stbiw__wpcrc@plt>
mov    -0x84(%rbp),%eax
sar    $0x18,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %cl,(%rax)
mov    -0x84(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x84(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x84(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x58(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x58(%rbp)
movsbl 0x5c4(%rip),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %cl,(%rax)
movsbl 0x5b1(%rip),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %cl,0x1(%rax)
movsbl 0x59d(%rip),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %cl,0x2(%rax)
movsbl 0x589(%rip),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x58(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x68(%rbp),%rsi
movslq -0x84(%rbp),%rdx
call   10a0 <memmove@plt>
mov    -0x84(%rbp),%ecx
mov    -0x58(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
mov    -0x84(%rbp),%esi
lea    -0x58(%rbp),%rdi
mov    $0x0,%al
call   1070 <stbiw__wpcrc@plt>
mov    -0x58(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x58(%rbp),%rax
movb   $0x0,0x1(%rax)
mov    -0x58(%rbp),%rax
movb   $0x0,0x2(%rax)
mov    -0x58(%rbp),%rax
movb   $0x0,0x3(%rax)
mov    -0x58(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x58(%rbp)
movsbl 0x4fd(%rip),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %cl,(%rax)
movsbl 0x4ea(%rip),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %cl,0x1(%rax)
movsbl 0x4d6(%rip),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %cl,0x2(%rax)
movsbl 0x4c2(%rip),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x58(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x58(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x58(%rbp)
lea    -0x58(%rbp),%rdi
xor    %esi,%esi
mov    $0x0,%al
call   1070 <stbiw__wpcrc@plt>
mov    -0x58(%rbp),%rax
mov    -0x50(%rbp),%rcx
mov    -0x28(%rbp),%rdx
movslq (%rdx),%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1080 <assert@plt>
mov    -0x50(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stbi_write_png_to_mem>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
mov    %r8d,%ebp
mov    %esi,%r15d
mov    %r8d,%ebx
mov    %edx,0x74(%rsp)
imul   %edx,%ebx
test   %esi,%esi
cmove  %ebx,%r15d
mov    %r9,0x98(%rsp)
mov    %rdi,0x80(%rsp)
lea    0x1(%rbx),%r14d
mov    %r14d,%eax
mov    %ecx,0x20(%rsp)
imul   %ecx,%eax
mov    %eax,0x78(%rsp)
movslq %eax,%rdi
call   1090 <malloc@plt>
mov    %rax,0x58(%rsp)
test   %rax,%rax
je     19bb <stbi_write_png_to_mem+0x83b>
mov    %rbx,0x28(%rsp)
movslq %ebx,%rdi
mov    %rdi,0xb0(%rsp)
call   1090 <malloc@plt>
test   %rax,%rax
je     19b1 <stbi_write_png_to_mem+0x831>
mov    %rax,%rsi
mov    %ebp,0x34(%rsp)
movslq %ebp,%rax
mov    %rax,0x88(%rsp)
cmpl   $0x0,0x20(%rsp)
mov    0x28(%rsp),%r8
jle    17a8 <stbi_write_png_to_mem+0x628>
movslq %r15d,%rcx
movslq %r14d,%rax
mov    %rax,0xa8(%rsp)
mov    0x20(%rsp),%eax
mov    %rax,0xa0(%rsp)
mov    0x34(%rsp),%r13d
mov    %r8d,%ebp
mov    %ebp,%eax
and    $0xfffffff8,%eax
mov    %rax,0xd0(%rsp)
add    $0xfffffffffffffff8,%rax
mov    %rax,0xc8(%rsp)
mov    %rax,%rdx
shr    $0x3,%rdx
add    $0x1,%rdx
mov    %rdx,%rax
mov    %rdx,0xc0(%rsp)
and    $0xfffffffffffffffe,%rdx
mov    %rdx,0xb8(%rsp)
mov    0x80(%rsp),%rax
mov    %rax,%rdx
sub    %rcx,%rdx
mov    %rdx,0x50(%rsp)
lea    0xd6a(%rip),%rdi
lea    0xd7f(%rip),%r9
pxor   %xmm5,%xmm5
mov    %rax,%r10
mov    %rcx,%rax
xor    %r14d,%r14d
mov    %rsi,0x40(%rsp)
mov    %rcx,0x38(%rsp)
mov    %rbp,0x60(%rsp)
nopl   0x0(%rax)
test   %r14,%r14
lea    0xd96(%rip),%rdx
lea    0xdaf(%rip),%rcx
cmove  %rcx,%rdx
mov    %rdx,0xd8(%rsp)
mov    %r14,%r11
imul   %rax,%r11
add    0x80(%rsp),%r11
mov    $0x1,%r15b
mov    $0x7fffffff,%r12d
xor    %edx,%edx
mov    %r10,0x48(%rsp)
mov    %r11,0x68(%rsp)
mov    %r14,0x90(%rsp)
test   $0x1,%r15b
mov    %edx,%eax
mov    $0x0,%ecx
cmovne %ecx,%eax
cmp    $0x4,%eax
jg     1710 <stbi_write_png_to_mem+0x590>
cltq
mov    %edx,0x18(%rsp)
mov    %edx,0x1c(%rsp)
mov    %r15d,0x7c(%rsp)
jmp    1375 <stbi_write_png_to_mem+0x1f5>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
mov    0x24(%rsp),%r12d
cmp    %r12d,%eax
mov    0x18(%rsp),%ecx
mov    0xe0(%rsp),%rdx
cmovl  %edx,%ecx
mov    %ecx,0x18(%rsp)
cmovl  %eax,%r12d
mov    %rdx,%rax
add    $0x1,%rax
cmp    $0x5,%eax
mov    0x1c(%rsp),%edx
je     1714 <stbi_write_png_to_mem+0x594>
mov    %r12d,0x24(%rsp)
mov    %rax,%rcx
mov    0xd8(%rsp),%rax
mov    %rcx,0xe0(%rsp)
mov    (%rax,%rcx,4),%r12d
mov    %r12d,%r14d
mov    0x34(%rsp),%eax
mov    %eax,%r15d
test   %eax,%eax
jle    1440 <stbi_write_png_to_mem+0x2c0>
xor    %ebp,%ebp
jmp    13c1 <stbi_write_png_to_mem+0x241>
nopw   0x0(%rax,%rax,1)
movzbl (%r10,%rbp,1),%ebx
mov    %bl,(%rsi,%rbp,1)
add    $0x1,%rbp
cmp    %rbp,%r13
je     1440 <stbi_write_png_to_mem+0x2c0>
cmp    $0x6,%r12d
ja     13b8 <stbi_write_png_to_mem+0x238>
movslq (%rdi,%r14,4),%rax
add    %rdi,%rax
jmp    *%rax
movzbl (%r10,%rbp,1),%ebx
mov    0x50(%rsp),%rax
sub    (%rax,%rbp,1),%bl
jmp    13b5 <stbi_write_png_to_mem+0x235>
movzbl (%r10,%rbp,1),%ebx
mov    0x50(%rsp),%rax
movzbl (%rax,%rbp,1),%eax
shr    %al
sub    %al,%bl
jmp    13b5 <stbi_write_png_to_mem+0x235>
movzbl (%r10,%rbp,1),%ebx
mov    0x50(%rsp),%rax
movzbl (%rax,%rbp,1),%esi
xor    %edi,%edi
xor    %edx,%edx
xor    %eax,%eax
call   1050 <stbiw__paeth@plt>
mov    0x1c(%rsp),%edx
mov    0x68(%rsp),%r11
mov    0x48(%rsp),%r10
pxor   %xmm5,%xmm5
lea    0xbf7(%rip),%r9
lea    0xbd4(%rip),%rdi
mov    0x40(%rsp),%rsi
mov    0x28(%rsp),%r8
sub    %al,%bl
jmp    13b5 <stbi_write_png_to_mem+0x235>
nopl   (%rax)
mov    %r13,%rbp
mov    0x88(%rsp),%rbx
mov    %rbx,%r13
cmp    %r15d,%r8d
jg     14f0 <stbi_write_png_to_mem+0x370>
mov    0x7c(%rsp),%r15d
test   $0x1,%r15b
je     1730 <stbi_write_png_to_mem+0x5b0>
test   %r8d,%r8d
mov    %rbp,%r13
mov    0x90(%rsp),%r14
jle    1340 <stbi_write_png_to_mem+0x1c0>
cmp    $0x8,%r8d
jae    15a0 <stbi_write_png_to_mem+0x420>
xor    %ecx,%ecx
xor    %eax,%eax
mov    0x60(%rsp),%rbp
mov    0x24(%rsp),%r12d
jmp    16d0 <stbi_write_png_to_mem+0x550>
movzbl (%r11,%r13,1),%r15d
mov    %r13,%rax
sub    %rbx,%rax
movzbl (%r11,%rax,1),%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %eax,%eax
call   1050 <stbiw__paeth@plt>
mov    0x1c(%rsp),%edx
mov    0x68(%rsp),%r11
mov    0x48(%rsp),%r10
pxor   %xmm5,%xmm5
lea    0xb51(%rip),%r9
lea    0xb2e(%rip),%rdi
mov    0x40(%rsp),%rsi
mov    0x28(%rsp),%r8
sub    %al,%r15b
mov    %r15b,(%rsi,%r13,1)
add    $0x1,%r13
cmp    %r8d,%r13d
je     1457 <stbi_write_png_to_mem+0x2d7>
cmp    $0x6,%r12d
ja     14e3 <stbi_write_png_to_mem+0x363>
movslq (%r9,%r14,4),%rax
add    %r9,%rax
jmp    *%rax
movzbl (%r11,%r13,1),%r15d
jmp    14df <stbi_write_png_to_mem+0x35f>
movzbl (%r11,%r13,1),%r15d
mov    %r13,%rax
sub    %rbx,%rax
sub    (%r11,%rax,1),%r15b
jmp    14df <stbi_write_png_to_mem+0x35f>
movzbl (%r11,%r13,1),%r15d
mov    %r13,%rax
sub    0x38(%rsp),%rax
sub    (%r11,%rax,1),%r15b
jmp    14df <stbi_write_png_to_mem+0x35f>
movzbl (%r11,%r13,1),%r15d
mov    %r13,%rax
sub    %rbx,%rax
movzbl (%r11,%rax,1),%eax
mov    %r13,%rcx
sub    0x38(%rsp),%rcx
movzbl (%r11,%rcx,1),%ecx
add    %eax,%ecx
shr    %ecx
sub    %cl,%r15b
jmp    14df <stbi_write_png_to_mem+0x35f>
movzbl (%r11,%r13,1),%r15d
mov    %r13,%rax
sub    %rbx,%rax
movzbl (%r11,%rax,1),%edi
mov    %r13,%rax
sub    0x38(%rsp),%rax
movzbl (%r11,%rax,1),%esi
sub    %rbx,%rax
movzbl (%r11,%rax,1),%edx
jmp    14ab <stbi_write_png_to_mem+0x32b>
movzbl (%r11,%r13,1),%r15d
mov    %r13,%rax
sub    %rbx,%rax
movzbl (%r11,%rax,1),%eax
shr    %al
sub    %al,%r15b
jmp    14df <stbi_write_png_to_mem+0x35f>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmpq   $0x0,0xc8(%rsp)
mov    0x24(%rsp),%r12d
pxor   %xmm0,%xmm0
je     16f0 <stbi_write_png_to_mem+0x570>
mov    0xb8(%rsp),%rcx
xor    %eax,%eax
pxor   %xmm1,%xmm1
mov    0x60(%rsp),%rbp
nopl   0x0(%rax,%rax,1)
movd   (%rsi,%rax,1),%xmm2
movd   0x4(%rsi,%rax,1),%xmm4
pxor   %xmm3,%xmm3
psubb  %xmm2,%xmm3
pminub %xmm2,%xmm3
pxor   %xmm2,%xmm2
psubb  %xmm4,%xmm2
pminub %xmm4,%xmm2
punpcklbw %xmm5,%xmm3
punpcklwd %xmm5,%xmm3
paddd  %xmm0,%xmm3
punpcklbw %xmm5,%xmm2
punpcklwd %xmm5,%xmm2
paddd  %xmm1,%xmm2
movd   0x8(%rsi,%rax,1),%xmm1
movd   0xc(%rsi,%rax,1),%xmm4
pxor   %xmm0,%xmm0
psubb  %xmm1,%xmm0
pminub %xmm1,%xmm0
pxor   %xmm1,%xmm1
psubb  %xmm4,%xmm1
pminub %xmm4,%xmm1
punpcklbw %xmm5,%xmm0
punpcklwd %xmm5,%xmm0
paddd  %xmm3,%xmm0
punpcklbw %xmm5,%xmm1
punpcklwd %xmm5,%xmm1
paddd  %xmm2,%xmm1
add    $0x10,%rax
add    $0xfffffffffffffffe,%rcx
jne    15d0 <stbi_write_png_to_mem+0x450>
testb  $0x1,0xc0(%rsp)
01
je     169a <stbi_write_png_to_mem+0x51a>
movd   (%rsi,%rax,1),%xmm2
movd   0x4(%rsi,%rax,1),%xmm3
pxor   %xmm4,%xmm4
psubb  %xmm2,%xmm4
pminub %xmm2,%xmm4
pxor   %xmm2,%xmm2
psubb  %xmm3,%xmm2
pminub %xmm3,%xmm2
punpcklbw %xmm5,%xmm4
punpcklwd %xmm5,%xmm4
paddd  %xmm4,%xmm0
punpcklbw %xmm5,%xmm2
punpcklwd %xmm5,%xmm2
paddd  %xmm2,%xmm1
paddd  %xmm1,%xmm0
pshufd $0xee,%xmm0,%xmm1
paddd  %xmm0,%xmm1
pshufd $0x55,%xmm1,%xmm0
paddd  %xmm1,%xmm0
movd   %xmm0,%eax
mov    0xd0(%rsp),%rdx
mov    %rdx,%rcx
cmp    %rbp,%rdx
je     1347 <stbi_write_png_to_mem+0x1c7>
nopl   0x0(%rax,%rax,1)
movzbl (%rsi,%rcx,1),%edx
mov    %edx,%ebx
sar    $0x7,%bl
add    %bl,%dl
xor    %bl,%dl
movzbl %dl,%edx
add    %edx,%eax
add    $0x1,%rcx
cmp    %rcx,%rbp
jne    16d0 <stbi_write_png_to_mem+0x550>
jmp    1347 <stbi_write_png_to_mem+0x1c7>
xor    %eax,%eax
pxor   %xmm1,%xmm1
mov    0x60(%rsp),%rbp
testb  $0x1,0xc0(%rsp)
01
jne    165f <stbi_write_png_to_mem+0x4df>
jmp    169a <stbi_write_png_to_mem+0x51a>
nopl   0x0(%rax,%rax,1)
mov    %edx,0x18(%rsp)
mov    0x18(%rsp),%eax
mov    %eax,%edx
test   $0x1,%r15b
mov    $0x0,%r15d
jne    1309 <stbi_write_png_to_mem+0x189>
jmp    173d <stbi_write_png_to_mem+0x5bd>
nopl   0x0(%rax)
mov    %edx,%eax
mov    %rbp,%r13
mov    0x90(%rsp),%r14
mov    %eax,%edx
mov    %r14,%rax
imul   0xa8(%rsp),%rax
mov    0x58(%rsp),%rcx
mov    %dl,(%rcx,%rax,1)
lea    (%rcx,%rax,1),%rdi
add    $0x1,%rdi
mov    0xb0(%rsp),%rdx
call   1080 <memcpy@plt>
mov    0x48(%rsp),%r10
pxor   %xmm5,%xmm5
lea    0x8a4(%rip),%r9
lea    0x881(%rip),%rdi
mov    0x40(%rsp),%rsi
mov    0x28(%rsp),%r8
add    $0x1,%r14
mov    0x38(%rsp),%rax
add    %rax,0x50(%rsp)
add    %rax,%r10
cmp    0xa0(%rsp),%r14
jne    12c0 <stbi_write_png_to_mem+0x140>
mov    %rsi,%rdi
call   1030 <free@plt>
xor    %ebp,%ebp
lea    0x14(%rsp),%rdx
mov    0x58(%rsp),%rbx
mov    %rbx,%rdi
mov    0x78(%rsp),%esi
mov    $0x8,%ecx
xor    %eax,%eax
call   1040 <stbi_zlib_compress@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
call   1030 <free@plt>
test   %r14d,%r14d
je     19bd <stbi_write_png_to_mem+0x83d>
movslq 0x14(%rsp),%rbx
add    $0x39,%rbx
mov    %rbx,%rdi
call   1090 <malloc@plt>
test   %rax,%rax
je     19bb <stbi_write_png_to_mem+0x83b>
mov    %rax,%rbp
movslq %r14d,%r15
mov    0x98(%rsp),%r12
mov    %ebx,(%r12)
movabs $0xa1a0a0d474e5089,%rax
0a 1a 0a
mov    %rax,0x0(%rbp)
movabs $0x524448490d000000,%rax
48 44 52
mov    %rax,0x8(%rbp)
mov    0x74(%rsp),%ecx
mov    %ecx,%eax
shr    $0x18,%eax
mov    %al,0x10(%rbp)
mov    %ecx,%eax
shr    $0x10,%eax
mov    %al,0x11(%rbp)
mov    %ch,0x12(%rbp)
mov    %cl,0x13(%rbp)
mov    0x20(%rsp),%ecx
mov    %ecx,%eax
shr    $0x18,%eax
mov    %al,0x14(%rbp)
mov    %ecx,%eax
shr    $0x10,%eax
mov    %al,0x15(%rbp)
mov    %ch,0x16(%rbp)
mov    %cl,0x17(%rbp)
movb   $0x8,0x18(%rbp)
lea    0x7d6(%rip),%rax
mov    0x88(%rsp),%rcx
mov    (%rax,%rcx,4),%al
mov    %al,0x19(%rbp)
movw   $0x0,0x1a(%rbp)
lea    0x1d(%rbp),%rax
mov    %rax,0x8(%rsp)
movb   $0x0,0x1c(%rbp)
lea    0x8(%rsp),%r14
mov    %r14,%rdi
mov    $0xd,%esi
xor    %eax,%eax
call   1060 <stbiw__wpcrc@plt>
mov    0x17(%rsp),%al
mov    0x8(%rsp),%rcx
mov    %al,(%rcx)
mov    0x16(%rsp),%al
mov    0x8(%rsp),%rcx
mov    %al,0x1(%rcx)
mov    0x15(%rsp),%al
mov    0x8(%rsp),%rcx
mov    %al,0x2(%rcx)
mov    0x14(%rsp),%al
mov    0x8(%rsp),%rcx
mov    %al,0x3(%rcx)
mov    0x8(%rsp),%rax
lea    0x4(%rax),%rcx
mov    %rcx,0x8(%rsp)
movb   $0x49,0x4(%rax)
mov    0x8(%rsp),%rax
movb   $0x44,0x1(%rax)
mov    0x8(%rsp),%rax
movb   $0x41,0x2(%rax)
mov    0x8(%rsp),%rax
movb   $0x54,0x3(%rax)
mov    0x8(%rsp),%rdi
add    $0x4,%rdi
mov    %rdi,0x8(%rsp)
movslq 0x14(%rsp),%rbx
mov    %r15,%rsi
mov    %rbx,%rdx
call   10a0 <memmove@plt>
add    %rbx,0x8(%rsp)
mov    %r15,%rdi
call   1030 <free@plt>
mov    0x14(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <stbiw__wpcrc@plt>
mov    0x8(%rsp),%rax
movb   $0x0,(%rax)
mov    0x8(%rsp),%rax
movb   $0x0,0x1(%rax)
mov    0x8(%rsp),%rax
movb   $0x0,0x2(%rax)
mov    0x8(%rsp),%rax
movb   $0x0,0x3(%rax)
mov    0x8(%rsp),%rax
lea    0x4(%rax),%rcx
mov    %rcx,0x8(%rsp)
movb   $0x49,0x4(%rax)
mov    0x8(%rsp),%rax
movb   $0x45,0x1(%rax)
mov    0x8(%rsp),%rax
movb   $0x4e,0x2(%rax)
mov    0x8(%rsp),%rax
movb   $0x44,0x3(%rax)
addq   $0x4,0x8(%rsp)
mov    %r14,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1060 <stbiw__wpcrc@plt>
movslq (%r12),%rax
add    %rbp,%rax
xor    %edi,%edi
cmp    %rax,0x8(%rsp)
sete   %dil
xor    %eax,%eax
call   1070 <assert@plt>
jmp    19bd <stbi_write_png_to_mem+0x83d>
mov    0x58(%rsp),%rdi
call   1030 <free@plt>
xor    %ebp,%ebp
mov    %rbp,%rax
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.stbi_write_png_to_mem.ctype = [5 x i32] [i32 -1, i32 0, i32 4, i32 2, i32 6]
@__const.stbi_write_png_to_mem.sig = [8 x i8] c"\89PNG\0D\0A\1A\0A"
@stbi_write_png_to_mem.mapping = internal global [5 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4]
@stbi_write_png_to_mem.firstmap = internal global [5 x i32] [i32 0, i32 1, i32 0, i32 5, i32 6]
@.str = [5 x i8] c"IHDR\00"
@.str.1 = [5 x i8] c"IDAT\00"
@.str.2 = [5 x i8] c"IEND\00"
define i8* @stbi_write_png_to_mem(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32* %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32*
%14 = alloca [5 x i32]
%15 = alloca [8 x i8]
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca i8*
%20 = alloca i8*
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32*
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i8*
store i8* %0, i8** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32* %5, i32** %13
%32 = bitcast [5 x i32]* %14 to i8*
%33 = bitcast [8 x i8]* %15 to i8*
%34 = load i32, i32* %9
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %40
36: ; preds = %6
%37 = load i32, i32* %10
%38 = load i32, i32* %12
%39 = mul nsw i32 %37, %38
store i32 %39, i32* %9
br label %40
40: ; preds = %36, %6
%41 = load i32, i32* %10
%42 = load i32, i32* %12
%43 = mul nsw i32 %41, %42
%44 = add nsw i32 %43, 1
%45 = load i32, i32* %11
%46 = mul nsw i32 %44, %45
%47 = sext i32 %46 to i64
%48 = call i8* @malloc(i64 %47)
store i8* %48, i8** %18
%49 = load i8*, i8** %18
%50 = icmp ne i8* %49, null
br i1 %50, label %52, label %51
51: ; preds = %40
store i8* null, i8** %7
br label %710
52: ; preds = %40
%53 = load i32, i32* %10
%54 = load i32, i32* %12
%55 = mul nsw i32 %53, %54
%56 = sext i32 %55 to i64
%57 = call i8* @malloc(i64 %56)
store i8* %57, i8** %20
%58 = load i8*, i8** %20
%59 = icmp ne i8* %58, null
br i1 %59, label %62, label %60
60: ; preds = %52
%61 = load i8*, i8** %18
store i8* null, i8** %7
br label %710
62: ; preds = %52
store i32 0, i32* %22
br label %63
63: ; preds = %460, %62
%64 = load i32, i32* %22
%65 = load i32, i32* %11
%66 = icmp slt i32 %64, %65
br i1 %66, label %67, label %463
67: ; preds = %63
%68 = load i32, i32* %22
%69 = icmp ne i32 %68, 0
%70 = zext i1 %69 to i64
%71 = select i1 %69, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @stbi_write_png_to_mem.mapping, i64 0, i64 0), i32* getelementptr inbounds ([5 x i32], [5 x i32]* @stbi_write_png_to_mem.firstmap, i64 0, i64 0)
store i32* %71, i32** %26
store i32 0, i32* %27
store i32 2147483647, i32* %28
store i32 0, i32* %24
br label %72
72: ; preds = %430, %67
%73 = load i32, i32* %24
%74 = icmp slt i32 %73, 2
br i1 %74, label %75, label %433
75: ; preds = %72
%76 = load i32, i32* %24
%77 = icmp ne i32 %76, 0
br i1 %77, label %78, label %80
78: ; preds = %75
%79 = load i32, i32* %27
br label %81
80: ; preds = %75
br label %81
81: ; preds = %80, %78
%82 = phi i32 [ %79, %78 ], [ 0, %80 ]
store i32 %82, i32* %23
br label %83
83: ; preds = %426, %81
%84 = load i32, i32* %23
%85 = icmp slt i32 %84, 5
br i1 %85, label %86, label %429
86: ; preds = %83
%87 = load i32*, i32** %26
%88 = load i32, i32* %23
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds i32, i32* %87, i64 %89
%91 = load i32, i32* %90
store i32 %91, i32* %29
store i32 0, i32* %30
%92 = load i8*, i8** %8
%93 = load i32, i32* %9
%94 = load i32, i32* %22
%95 = mul nsw i32 %93, %94
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds i8, i8* %92, i64 %96
store i8* %97, i8** %31
store i32 0, i32* %21
br label %98
98: ; preds = %210, %86
%99 = load i32, i32* %21
%100 = load i32, i32* %12
%101 = icmp slt i32 %99, %100
br i1 %101, label %102, label %213
102: ; preds = %98
%103 = load i32, i32* %29
switch i32 %103, label %209 [
i32 0, label %104
i32 1, label %114
i32 2, label %124
i32 3, label %145
i32 4, label %167
i32 5, label %189
i32 6, label %199
]
104: ; preds = %102
%105 = load i8*, i8** %31
%106 = load i32, i32* %21
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds i8, i8* %105, i64 %107
%109 = load i8, i8* %108
%110 = load i8*, i8** %20
%111 = load i32, i32* %21
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds i8, i8* %110, i64 %112
store i8 %109, i8* %113
br label %209
114: ; preds = %102
%115 = load i8*, i8** %31
%116 = load i32, i32* %21
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds i8, i8* %115, i64 %117
%119 = load i8, i8* %118
%120 = load i8*, i8** %20
%121 = load i32, i32* %21
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds i8, i8* %120, i64 %122
store i8 %119, i8* %123
br label %209
124: ; preds = %102
%125 = load i8*, i8** %31
%126 = load i32, i32* %21
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds i8, i8* %125, i64 %127
%129 = load i8, i8* %128
%130 = zext i8 %129 to i32
%131 = load i8*, i8** %31
%132 = load i32, i32* %21
%133 = load i32, i32* %9
%134 = sub nsw i32 %132, %133
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds i8, i8* %131, i64 %135
%137 = load i8, i8* %136
%138 = zext i8 %137 to i32
%139 = sub nsw i32 %130, %138
%140 = trunc i32 %139 to i8
%141 = load i8*, i8** %20
%142 = load i32, i32* %21
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds i8, i8* %141, i64 %143
store i8 %140, i8* %144
br label %209
145: ; preds = %102
%146 = load i8*, i8** %31
%147 = load i32, i32* %21
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds i8, i8* %146, i64 %148
%150 = load i8, i8* %149
%151 = zext i8 %150 to i32
%152 = load i8*, i8** %31
%153 = load i32, i32* %21
%154 = load i32, i32* %9
%155 = sub nsw i32 %153, %154
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds i8, i8* %152, i64 %156
%158 = load i8, i8* %157
%159 = zext i8 %158 to i32
%160 = ashr i32 %159, 1
%161 = sub nsw i32 %151, %160
%162 = trunc i32 %161 to i8
%163 = load i8*, i8** %20
%164 = load i32, i32* %21
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds i8, i8* %163, i64 %165
store i8 %162, i8* %166
br label %209
167: ; preds = %102
%168 = load i8*, i8** %31
%169 = load i32, i32* %21
%170 = sext i32 %169 to i64
%171 = getelementptr inbounds i8, i8* %168, i64 %170
%172 = load i8, i8* %171
%173 = zext i8 %172 to i32
%174 = load i8*, i8** %31
%175 = load i32, i32* %21
%176 = load i32, i32* %9
%177 = sub nsw i32 %175, %176
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds i8, i8* %174, i64 %178
%180 = load i8, i8* %179
%181 = zext i8 %180 to i32
%182 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @stbiw__paeth to i32 (i32, i32, i32, ...)*)(i32 0, i32 %181, i32 0)
%183 = sub nsw i32 %173, %182
%184 = trunc i32 %183 to i8
%185 = load i8*, i8** %20
%186 = load i32, i32* %21
%187 = sext i32 %186 to i64
%188 = getelementptr inbounds i8, i8* %185, i64 %187
store i8 %184, i8* %188
br label %209
189: ; preds = %102
%190 = load i8*, i8** %31
%191 = load i32, i32* %21
%192 = sext i32 %191 to i64
%193 = getelementptr inbounds i8, i8* %190, i64 %192
%194 = load i8, i8* %193
%195 = load i8*, i8** %20
%196 = load i32, i32* %21
%197 = sext i32 %196 to i64
%198 = getelementptr inbounds i8, i8* %195, i64 %197
store i8 %194, i8* %198
br label %209
199: ; preds = %102
%200 = load i8*, i8** %31
%201 = load i32, i32* %21
%202 = sext i32 %201 to i64
%203 = getelementptr inbounds i8, i8* %200, i64 %202
%204 = load i8, i8* %203
%205 = load i8*, i8** %20
%206 = load i32, i32* %21
%207 = sext i32 %206 to i64
%208 = getelementptr inbounds i8, i8* %205, i64 %207
store i8 %204, i8* %208
br label %209
209: ; preds = %102, %199, %189, %167, %145, %124, %114, %104
br label %210
210: ; preds = %209
%211 = load i32, i32* %21
%212 = add nsw i32 %211, 1
store i32 %212, i32* %21
br label %98
213: ; preds = %98
%214 = load i32, i32* %12
store i32 %214, i32* %21
br label %215
215: ; preds = %391, %213
%216 = load i32, i32* %21
%217 = load i32, i32* %10
%218 = load i32, i32* %12
%219 = mul nsw i32 %217, %218
%220 = icmp slt i32 %216, %219
br i1 %220, label %221, label %394
221: ; preds = %215
%222 = load i32, i32* %29
switch i32 %222, label %390 [
i32 0, label %223
i32 1, label %233
i32 2, label %254
i32 3, label %275
i32 4, label %306
i32 5, label %346
i32 6, label %368
]
223: ; preds = %221
%224 = load i8*, i8** %31
%225 = load i32, i32* %21
%226 = sext i32 %225 to i64
%227 = getelementptr inbounds i8, i8* %224, i64 %226
%228 = load i8, i8* %227
%229 = load i8*, i8** %20
%230 = load i32, i32* %21
%231 = sext i32 %230 to i64
%232 = getelementptr inbounds i8, i8* %229, i64 %231
store i8 %228, i8* %232
br label %390
233: ; preds = %221
%234 = load i8*, i8** %31
%235 = load i32, i32* %21
%236 = sext i32 %235 to i64
%237 = getelementptr inbounds i8, i8* %234, i64 %236
%238 = load i8, i8* %237
%239 = zext i8 %238 to i32
%240 = load i8*, i8** %31
%241 = load i32, i32* %21
%242 = load i32, i32* %12
%243 = sub nsw i32 %241, %242
%244 = sext i32 %243 to i64
%245 = getelementptr inbounds i8, i8* %240, i64 %244
%246 = load i8, i8* %245
%247 = zext i8 %246 to i32
%248 = sub nsw i32 %239, %247
%249 = trunc i32 %248 to i8
%250 = load i8*, i8** %20
%251 = load i32, i32* %21
%252 = sext i32 %251 to i64
%253 = getelementptr inbounds i8, i8* %250, i64 %252
store i8 %249, i8* %253
br label %390
254: ; preds = %221
%255 = load i8*, i8** %31
%256 = load i32, i32* %21
%257 = sext i32 %256 to i64
%258 = getelementptr inbounds i8, i8* %255, i64 %257
%259 = load i8, i8* %258
%260 = zext i8 %259 to i32
%261 = load i8*, i8** %31
%262 = load i32, i32* %21
%263 = load i32, i32* %9
%264 = sub nsw i32 %262, %263
%265 = sext i32 %264 to i64
%266 = getelementptr inbounds i8, i8* %261, i64 %265
%267 = load i8, i8* %266
%268 = zext i8 %267 to i32
%269 = sub nsw i32 %260, %268
%270 = trunc i32 %269 to i8
%271 = load i8*, i8** %20
%272 = load i32, i32* %21
%273 = sext i32 %272 to i64
%274 = getelementptr inbounds i8, i8* %271, i64 %273
store i8 %270, i8* %274
br label %390
275: ; preds = %221
%276 = load i8*, i8** %31
%277 = load i32, i32* %21
%278 = sext i32 %277 to i64
%279 = getelementptr inbounds i8, i8* %276, i64 %278
%280 = load i8, i8* %279
%281 = zext i8 %280 to i32
%282 = load i8*, i8** %31
%283 = load i32, i32* %21
%284 = load i32, i32* %12
%285 = sub nsw i32 %283, %284
%286 = sext i32 %285 to i64
%287 = getelementptr inbounds i8, i8* %282, i64 %286
%288 = load i8, i8* %287
%289 = zext i8 %288 to i32
%290 = load i8*, i8** %31
%291 = load i32, i32* %21
%292 = load i32, i32* %9
%293 = sub nsw i32 %291, %292
%294 = sext i32 %293 to i64
%295 = getelementptr inbounds i8, i8* %290, i64 %294
%296 = load i8, i8* %295
%297 = zext i8 %296 to i32
%298 = add nsw i32 %289, %297
%299 = ashr i32 %298, 1
%300 = sub nsw i32 %281, %299
%301 = trunc i32 %300 to i8
%302 = load i8*, i8** %20
%303 = load i32, i32* %21
%304 = sext i32 %303 to i64
%305 = getelementptr inbounds i8, i8* %302, i64 %304
store i8 %301, i8* %305
br label %390
306: ; preds = %221
%307 = load i8*, i8** %31
%308 = load i32, i32* %21
%309 = sext i32 %308 to i64
%310 = getelementptr inbounds i8, i8* %307, i64 %309
%311 = load i8, i8* %310
%312 = zext i8 %311 to i32
%313 = load i8*, i8** %31
%314 = load i32, i32* %21
%315 = load i32, i32* %12
%316 = sub nsw i32 %314, %315
%317 = sext i32 %316 to i64
%318 = getelementptr inbounds i8, i8* %313, i64 %317
%319 = load i8, i8* %318
%320 = zext i8 %319 to i32
%321 = load i8*, i8** %31
%322 = load i32, i32* %21
%323 = load i32, i32* %9
%324 = sub nsw i32 %322, %323
%325 = sext i32 %324 to i64
%326 = getelementptr inbounds i8, i8* %321, i64 %325
%327 = load i8, i8* %326
%328 = zext i8 %327 to i32
%329 = load i8*, i8** %31
%330 = load i32, i32* %21
%331 = load i32, i32* %9
%332 = sub nsw i32 %330, %331
%333 = load i32, i32* %12
%334 = sub nsw i32 %332, %333
%335 = sext i32 %334 to i64
%336 = getelementptr inbounds i8, i8* %329, i64 %335
%337 = load i8, i8* %336
%338 = zext i8 %337 to i32
%339 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @stbiw__paeth to i32 (i32, i32, i32, ...)*)(i32 %320, i32 %328, i32 %338)
%340 = sub nsw i32 %312, %339
%341 = trunc i32 %340 to i8
%342 = load i8*, i8** %20
%343 = load i32, i32* %21
%344 = sext i32 %343 to i64
%345 = getelementptr inbounds i8, i8* %342, i64 %344
store i8 %341, i8* %345
br label %390
346: ; preds = %221
%347 = load i8*, i8** %31
%348 = load i32, i32* %21
%349 = sext i32 %348 to i64
%350 = getelementptr inbounds i8, i8* %347, i64 %349
%351 = load i8, i8* %350
%352 = zext i8 %351 to i32
%353 = load i8*, i8** %31
%354 = load i32, i32* %21
%355 = load i32, i32* %12
%356 = sub nsw i32 %354, %355
%357 = sext i32 %356 to i64
%358 = getelementptr inbounds i8, i8* %353, i64 %357
%359 = load i8, i8* %358
%360 = zext i8 %359 to i32
%361 = ashr i32 %360, 1
%362 = sub nsw i32 %352, %361
%363 = trunc i32 %362 to i8
%364 = load i8*, i8** %20
%365 = load i32, i32* %21
%366 = sext i32 %365 to i64
%367 = getelementptr inbounds i8, i8* %364, i64 %366
store i8 %363, i8* %367
br label %390
368: ; preds = %221
%369 = load i8*, i8** %31
%370 = load i32, i32* %21
%371 = sext i32 %370 to i64
%372 = getelementptr inbounds i8, i8* %369, i64 %371
%373 = load i8, i8* %372
%374 = zext i8 %373 to i32
%375 = load i8*, i8** %31
%376 = load i32, i32* %21
%377 = load i32, i32* %12
%378 = sub nsw i32 %376, %377
%379 = sext i32 %378 to i64
%380 = getelementptr inbounds i8, i8* %375, i64 %379
%381 = load i8, i8* %380
%382 = zext i8 %381 to i32
%383 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @stbiw__paeth to i32 (i32, i32, i32, ...)*)(i32 %382, i32 0, i32 0)
%384 = sub nsw i32 %374, %383
%385 = trunc i32 %384 to i8
%386 = load i8*, i8** %20
%387 = load i32, i32* %21
%388 = sext i32 %387 to i64
%389 = getelementptr inbounds i8, i8* %386, i64 %388
store i8 %385, i8* %389
br label %390
390: ; preds = %221, %368, %346, %306, %275, %254, %233, %223
br label %391
391: ; preds = %390
%392 = load i32, i32* %21
%393 = add nsw i32 %392, 1
store i32 %393, i32* %21
br label %215
394: ; preds = %215
%395 = load i32, i32* %24
%396 = icmp ne i32 %395, 0
br i1 %396, label %397, label %398
397: ; preds = %394
br label %429
398: ; preds = %394
store i32 0, i32* %21
br label %399
399: ; preds = %415, %398
%400 = load i32, i32* %21
%401 = load i32, i32* %10
%402 = load i32, i32* %12
%403 = mul nsw i32 %401, %402
%404 = icmp slt i32 %400, %403
br i1 %404, label %405, label %418
405: ; preds = %399
%406 = load i8*, i8** %20
%407 = load i32, i32* %21
%408 = sext i32 %407 to i64
%409 = getelementptr inbounds i8, i8* %406, i64 %408
%410 = load i8, i8* %409
%411 = sext i8 %410 to i32
%412 = call i32 @abs(i32 %411)
%413 = load i32, i32* %30
%414 = add nsw i32 %413, %412
store i32 %414, i32* %30
br label %415
415: ; preds = %405
%416 = load i32, i32* %21
%417 = add nsw i32 %416, 1
store i32 %417, i32* %21
br label %399
418: ; preds = %399
%419 = load i32, i32* %30
%420 = load i32, i32* %28
%421 = icmp slt i32 %419, %420
br i1 %421, label %422, label %425
422: ; preds = %418
%423 = load i32, i32* %30
store i32 %423, i32* %28
%424 = load i32, i32* %23
store i32 %424, i32* %27
br label %425
425: ; preds = %422, %418
br label %426
426: ; preds = %425
%427 = load i32, i32* %23
%428 = add nsw i32 %427, 1
store i32 %428, i32* %23
br label %83
429: ; preds = %397, %83
br label %430
430: ; preds = %429
%431 = load i32, i32* %24
%432 = add nsw i32 %431, 1
store i32 %432, i32* %24
br label %72
433: ; preds = %72
%434 = load i32, i32* %27
%435 = trunc i32 %434 to i8
%436 = load i8*, i8** %18
%437 = load i32, i32* %22
%438 = load i32, i32* %10
%439 = load i32, i32* %12
%440 = mul nsw i32 %438, %439
%441 = add nsw i32 %440, 1
%442 = mul nsw i32 %437, %441
%443 = sext i32 %442 to i64
%444 = getelementptr inbounds i8, i8* %436, i64 %443
store i8 %435, i8* %444
%445 = load i8*, i8** %18
%446 = load i32, i32* %22
%447 = load i32, i32* %10
%448 = load i32, i32* %12
%449 = mul nsw i32 %447, %448
%450 = add nsw i32 %449, 1
%451 = mul nsw i32 %446, %450
%452 = sext i32 %451 to i64
%453 = getelementptr inbounds i8, i8* %445, i64 %452
%454 = getelementptr inbounds i8, i8* %453, i64 1
%455 = load i8*, i8** %20
%456 = load i32, i32* %10
%457 = load i32, i32* %12
%458 = mul nsw i32 %456, %457
%459 = sext i32 %458 to i64
br label %460
460: ; preds = %433
%461 = load i32, i32* %22
%462 = add nsw i32 %461, 1
store i32 %462, i32* %22
br label %63
463: ; preds = %63
%464 = load i8*, i8** %20
%465 = load i8*, i8** %18
%466 = load i32, i32* %11
%467 = load i32, i32* %10
%468 = load i32, i32* %12
%469 = mul nsw i32 %467, %468
%470 = add nsw i32 %469, 1
%471 = mul nsw i32 %466, %470
%472 = call i32 (i8*, i32, i32*, i32, ...) bitcast (i32 (...)* @stbi_zlib_compress to i32 (i8*, i32, i32*, i32, ...)*)(i8* %465, i32 %471, i32* %25, i32 8)
%473 = sext i32 %472 to i64
%474 = inttoptr i64 %473 to i8*
store i8* %474, i8** %19
%475 = load i8*, i8** %18
%476 = load i8*, i8** %19
%477 = icmp ne i8* %476, null
br i1 %477, label %479, label %478
478: ; preds = %463
store i8* null, i8** %7
br label %710
479: ; preds = %463
%480 = load i32, i32* %25
%481 = add nsw i32 45, %480
%482 = add nsw i32 %481, 12
%483 = sext i32 %482 to i64
%484 = call i8* @malloc(i64 %483)
store i8* %484, i8** %16
%485 = load i8*, i8** %16
%486 = icmp ne i8* %485, null
br i1 %486, label %488, label %487
487: ; preds = %479
store i8* null, i8** %7
br label %710
488: ; preds = %479
%489 = load i32, i32* %25
%490 = add nsw i32 45, %489
%491 = add nsw i32 %490, 12
%492 = load i32*, i32** %13
store i32 %491, i32* %492
%493 = load i8*, i8** %16
store i8* %493, i8** %17
%494 = load i8*, i8** %17
%495 = getelementptr inbounds [8 x i8], [8 x i8]* %15, i64 0, i64 0
%496 = load i8*, i8** %17
%497 = getelementptr inbounds i8, i8* %496, i64 8
store i8* %497, i8** %17
%498 = load i8*, i8** %17
%499 = getelementptr inbounds i8, i8* %498, i64 0
store i8 0, i8* %499
%500 = load i8*, i8** %17
%501 = getelementptr inbounds i8, i8* %500, i64 1
store i8 0, i8* %501
%502 = load i8*, i8** %17
%503 = getelementptr inbounds i8, i8* %502, i64 2
store i8 0, i8* %503
%504 = load i8*, i8** %17
%505 = getelementptr inbounds i8, i8* %504, i64 3
store i8 13, i8* %505
%506 = load i8*, i8** %17
%507 = getelementptr inbounds i8, i8* %506, i64 4
store i8* %507, i8** %17
%508 = load i8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
%509 = sext i8 %508 to i32
%510 = and i32 %509, 255
%511 = trunc i32 %510 to i8
%512 = load i8*, i8** %17
%513 = getelementptr inbounds i8, i8* %512, i64 0
store i8 %511, i8* %513
%514 = load i8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 1)
%515 = sext i8 %514 to i32
%516 = and i32 %515, 255
%517 = trunc i32 %516 to i8
%518 = load i8*, i8** %17
%519 = getelementptr inbounds i8, i8* %518, i64 1
store i8 %517, i8* %519
%520 = load i8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 2)
%521 = sext i8 %520 to i32
%522 = and i32 %521, 255
%523 = trunc i32 %522 to i8
%524 = load i8*, i8** %17
%525 = getelementptr inbounds i8, i8* %524, i64 2
store i8 %523, i8* %525
%526 = load i8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 3)
%527 = sext i8 %526 to i32
%528 = and i32 %527, 255
%529 = trunc i32 %528 to i8
%530 = load i8*, i8** %17
%531 = getelementptr inbounds i8, i8* %530, i64 3
store i8 %529, i8* %531
%532 = load i8*, i8** %17
%533 = getelementptr inbounds i8, i8* %532, i64 4
store i8* %533, i8** %17
%534 = load i32, i32* %10
%535 = ashr i32 %534, 24
%536 = and i32 %535, 255
%537 = trunc i32 %536 to i8
%538 = load i8*, i8** %17
%539 = getelementptr inbounds i8, i8* %538, i64 0
store i8 %537, i8* %539
%540 = load i32, i32* %10
%541 = ashr i32 %540, 16
%542 = and i32 %541, 255
%543 = trunc i32 %542 to i8
%544 = load i8*, i8** %17
%545 = getelementptr inbounds i8, i8* %544, i64 1
store i8 %543, i8* %545
%546 = load i32, i32* %10
%547 = ashr i32 %546, 8
%548 = and i32 %547, 255
%549 = trunc i32 %548 to i8
%550 = load i8*, i8** %17
%551 = getelementptr inbounds i8, i8* %550, i64 2
store i8 %549, i8* %551
%552 = load i32, i32* %10
%553 = and i32 %552, 255
%554 = trunc i32 %553 to i8
%555 = load i8*, i8** %17
%556 = getelementptr inbounds i8, i8* %555, i64 3
store i8 %554, i8* %556
%557 = load i8*, i8** %17
%558 = getelementptr inbounds i8, i8* %557, i64 4
store i8* %558, i8** %17
%559 = load i32, i32* %11
%560 = ashr i32 %559, 24
%561 = and i32 %560, 255
%562 = trunc i32 %561 to i8
%563 = load i8*, i8** %17
%564 = getelementptr inbounds i8, i8* %563, i64 0
store i8 %562, i8* %564
%565 = load i32, i32* %11
%566 = ashr i32 %565, 16
%567 = and i32 %566, 255
%568 = trunc i32 %567 to i8
%569 = load i8*, i8** %17
%570 = getelementptr inbounds i8, i8* %569, i64 1
store i8 %568, i8* %570
%571 = load i32, i32* %11
%572 = ashr i32 %571, 8
%573 = and i32 %572, 255
%574 = trunc i32 %573 to i8
%575 = load i8*, i8** %17
%576 = getelementptr inbounds i8, i8* %575, i64 2
store i8 %574, i8* %576
%577 = load i32, i32* %11
%578 = and i32 %577, 255
%579 = trunc i32 %578 to i8
%580 = load i8*, i8** %17
%581 = getelementptr inbounds i8, i8* %580, i64 3
store i8 %579, i8* %581
%582 = load i8*, i8** %17
%583 = getelementptr inbounds i8, i8* %582, i64 4
store i8* %583, i8** %17
%584 = load i8*, i8** %17
%585 = getelementptr inbounds i8, i8* %584, i32 1
store i8* %585, i8** %17
store i8 8, i8* %584
%586 = load i32, i32* %12
%587 = sext i32 %586 to i64
%588 = getelementptr inbounds [5 x i32], [5 x i32]* %14, i64 0, i64 %587
%589 = load i32, i32* %588
%590 = and i32 %589, 255
%591 = trunc i32 %590 to i8
%592 = load i8*, i8** %17
%593 = getelementptr inbounds i8, i8* %592, i32 1
store i8* %593, i8** %17
store i8 %591, i8* %592
%594 = load i8*, i8** %17
%595 = getelementptr inbounds i8, i8* %594, i32 1
store i8* %595, i8** %17
store i8 0, i8* %594
%596 = load i8*, i8** %17
%597 = getelementptr inbounds i8, i8* %596, i32 1
store i8* %597, i8** %17
store i8 0, i8* %596
%598 = load i8*, i8** %17
%599 = getelementptr inbounds i8, i8* %598, i32 1
store i8* %599, i8** %17
store i8 0, i8* %598
%600 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @stbiw__wpcrc to i32 (i8**, i32, ...)*)(i8** %17, i32 13)
%601 = load i32, i32* %25
%602 = ashr i32 %601, 24
%603 = and i32 %602, 255
%604 = trunc i32 %603 to i8
%605 = load i8*, i8** %17
%606 = getelementptr inbounds i8, i8* %605, i64 0
store i8 %604, i8* %606
%607 = load i32, i32* %25
%608 = ashr i32 %607, 16
%609 = and i32 %608, 255
%610 = trunc i32 %609 to i8
%611 = load i8*, i8** %17
%612 = getelementptr inbounds i8, i8* %611, i64 1
store i8 %610, i8* %612
%613 = load i32, i32* %25
%614 = ashr i32 %613, 8
%615 = and i32 %614, 255
%616 = trunc i32 %615 to i8
%617 = load i8*, i8** %17
%618 = getelementptr inbounds i8, i8* %617, i64 2
store i8 %616, i8* %618
%619 = load i32, i32* %25
%620 = and i32 %619, 255
%621 = trunc i32 %620 to i8
%622 = load i8*, i8** %17
%623 = getelementptr inbounds i8, i8* %622, i64 3
store i8 %621, i8* %623
%624 = load i8*, i8** %17
%625 = getelementptr inbounds i8, i8* %624, i64 4
store i8* %625, i8** %17
%626 = load i8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
%627 = sext i8 %626 to i32
%628 = and i32 %627, 255
%629 = trunc i32 %628 to i8
%630 = load i8*, i8** %17
%631 = getelementptr inbounds i8, i8* %630, i64 0
store i8 %629, i8* %631
%632 = load i8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 1)
%633 = sext i8 %632 to i32
%634 = and i32 %633, 255
%635 = trunc i32 %634 to i8
%636 = load i8*, i8** %17
%637 = getelementptr inbounds i8, i8* %636, i64 1
store i8 %635, i8* %637
%638 = load i8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 2)
%639 = sext i8 %638 to i32
%640 = and i32 %639, 255
%641 = trunc i32 %640 to i8
%642 = load i8*, i8** %17
%643 = getelementptr inbounds i8, i8* %642, i64 2
store i8 %641, i8* %643
%644 = load i8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 3)
%645 = sext i8 %644 to i32
%646 = and i32 %645, 255
%647 = trunc i32 %646 to i8
%648 = load i8*, i8** %17
%649 = getelementptr inbounds i8, i8* %648, i64 3
store i8 %647, i8* %649
%650 = load i8*, i8** %17
%651 = getelementptr inbounds i8, i8* %650, i64 4
store i8* %651, i8** %17
%652 = load i8*, i8** %17
%653 = load i8*, i8** %19
%654 = load i32, i32* %25
%655 = sext i32 %654 to i64
%656 = load i32, i32* %25
%657 = load i8*, i8** %17
%658 = sext i32 %656 to i64
%659 = getelementptr inbounds i8, i8* %657, i64 %658
store i8* %659, i8** %17
%660 = load i8*, i8** %19
%661 = load i32, i32* %25
%662 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @stbiw__wpcrc to i32 (i8**, i32, ...)*)(i8** %17, i32 %661)
%663 = load i8*, i8** %17
%664 = getelementptr inbounds i8, i8* %663, i64 0
store i8 0, i8* %664
%665 = load i8*, i8** %17
%666 = getelementptr inbounds i8, i8* %665, i64 1
store i8 0, i8* %666
%667 = load i8*, i8** %17
%668 = getelementptr inbounds i8, i8* %667, i64 2
store i8 0, i8* %668
%669 = load i8*, i8** %17
%670 = getelementptr inbounds i8, i8* %669, i64 3
store i8 0, i8* %670
%671 = load i8*, i8** %17
%672 = getelementptr inbounds i8, i8* %671, i64 4
store i8* %672, i8** %17
%673 = load i8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%674 = sext i8 %673 to i32
%675 = and i32 %674, 255
%676 = trunc i32 %675 to i8
%677 = load i8*, i8** %17
%678 = getelementptr inbounds i8, i8* %677, i64 0
store i8 %676, i8* %678
%679 = load i8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 1)
%680 = sext i8 %679 to i32
%681 = and i32 %680, 255
%682 = trunc i32 %681 to i8
%683 = load i8*, i8** %17
%684 = getelementptr inbounds i8, i8* %683, i64 1
store i8 %682, i8* %684
%685 = load i8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 2)
%686 = sext i8 %685 to i32
%687 = and i32 %686, 255
%688 = trunc i32 %687 to i8
%689 = load i8*, i8** %17
%690 = getelementptr inbounds i8, i8* %689, i64 2
store i8 %688, i8* %690
%691 = load i8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 3)
%692 = sext i8 %691 to i32
%693 = and i32 %692, 255
%694 = trunc i32 %693 to i8
%695 = load i8*, i8** %17
%696 = getelementptr inbounds i8, i8* %695, i64 3
store i8 %694, i8* %696
%697 = load i8*, i8** %17
%698 = getelementptr inbounds i8, i8* %697, i64 4
store i8* %698, i8** %17
%699 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @stbiw__wpcrc to i32 (i8**, i32, ...)*)(i8** %17, i32 0)
%700 = load i8*, i8** %17
%701 = load i8*, i8** %16
%702 = load i32*, i32** %13
%703 = load i32, i32* %702
%704 = sext i32 %703 to i64
%705 = getelementptr inbounds i8, i8* %701, i64 %704
%706 = icmp eq i8* %700, %705
%707 = zext i1 %706 to i32
%708 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %707)
%709 = load i8*, i8** %16
store i8* %709, i8** %7
br label %710
710: ; preds = %488, %487, %478, %60, %51
%711 = load i8*, i8** %7
ret i8* %711
}

LLVM IR (-O2):
@__const.stbi_write_png_to_mem.ctype = [5 x i32] [i32 -1, i32 0, i32 4, i32 2, i32 6]
@stbi_write_png_to_mem.mapping = internal unnamed_addr constant [5 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4]
@stbi_write_png_to_mem.firstmap = internal unnamed_addr constant [5 x i32] [i32 0, i32 1, i32 0, i32 5, i32 6]
define i8* @stbi_write_png_to_mem(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32* nocapture %5) {
%7 = alloca i8*
%8 = alloca i32
%9 = bitcast i8** %7 to i8*
%10 = bitcast i32* %8 to i8*
%11 = icmp eq i32 %1, 0
%12 = mul nsw i32 %4, %2
%13 = select i1 %11, i32 %12, i32 %1
%14 = add nsw i32 %12, 1
%15 = mul nsw i32 %14, %3
%16 = sext i32 %15 to i64
%17 = tail call i8* @malloc(i64 %16)
%18 = icmp eq i8* %17, null
br i1 %18, label %397, label %19
19: ; preds = %6
%20 = sext i32 %12 to i64
%21 = tail call i8* @malloc(i64 %20)
%22 = icmp eq i8* %21, null
br i1 %22, label %46, label %23
23: ; preds = %19
%24 = icmp sgt i32 %3, 0
br i1 %24, label %25, label %284
25: ; preds = %23
%26 = icmp sgt i32 %4, 0
%27 = icmp sgt i32 %12, %4
%28 = icmp sgt i32 %12, 0
%29 = sext i32 %13 to i64
%30 = sext i32 %4 to i64
%31 = sext i32 %14 to i64
%32 = zext i32 %3 to i64
%33 = zext i32 %4 to i64
%34 = zext i32 %12 to i64
%35 = and i64 %34, 4294967288
%36 = add nsw i64 %35, -8
%37 = lshr exact i64 %36, 3
%38 = add nuw nsw i64 %37, 1
%39 = icmp ult i32 %12, 8
%40 = and i64 %34, 4294967288
%41 = and i64 %38, 1
%42 = icmp eq i64 %36, 0
%43 = and i64 %38, 4611686018427387902
%44 = icmp eq i64 %41, 0
%45 = icmp eq i64 %40, %34
br label %47
46: ; preds = %19
tail call void @free(i8* %17)
br label %397
47: ; preds = %25, %276
%48 = phi i64 [ 0, %25 ], [ %282, %276 ]
%49 = icmp eq i64 %48, 0
%50 = select i1 %49, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @stbi_write_png_to_mem.firstmap, i64 0, i64 0), i32* getelementptr inbounds ([5 x i32], [5 x i32]* @stbi_write_png_to_mem.mapping, i64 0, i64 0)
%51 = mul nsw i64 %48, %29
%52 = getelementptr inbounds i8, i8* %0, i64 %51
br label %53
53: ; preds = %47, %273
%54 = phi i32 [ 2147483647, %47 ], [ %275, %273 ]
%55 = phi i32 [ 0, %47 ], [ %274, %273 ]
%56 = phi i1 [ true, %47 ], [ false, %273 ]
%57 = select i1 %56, i32 0, i32 %55
%58 = icmp slt i32 %57, 5
br i1 %58, label %59, label %273
59: ; preds = %53
%60 = sext i32 %57 to i64
br label %61
61: ; preds = %59, %264
%62 = phi i64 [ %60, %59 ], [ %270, %264 ]
%63 = phi i32 [ %54, %59 ], [ %269, %264 ]
%64 = phi i32 [ %55, %59 ], [ %268, %264 ]
%65 = getelementptr inbounds i32, i32* %50, i64 %62
%66 = load i32, i32* %65
br i1 %26, label %68, label %67
67: ; preds = %110, %61
br i1 %27, label %113, label %190
68: ; preds = %61, %110
%69 = phi i64 [ %111, %110 ], [ 0, %61 ]
switch i32 %66, label %110 [
i32 0, label %70
i32 1, label %73
i32 2, label %76
i32 3, label %83
i32 4, label %91
i32 5, label %101
i32 6, label %104
]
70: ; preds = %68
%71 = getelementptr inbounds i8, i8* %52, i64 %69
%72 = load i8, i8* %71
br label %107
73: ; preds = %68
%74 = getelementptr inbounds i8, i8* %52, i64 %69
%75 = load i8, i8* %74
br label %107
76: ; preds = %68
%77 = getelementptr inbounds i8, i8* %52, i64 %69
%78 = load i8, i8* %77
%79 = sub nsw i64 %69, %29
%80 = getelementptr inbounds i8, i8* %52, i64 %79
%81 = load i8, i8* %80
%82 = sub i8 %78, %81
br label %107
83: ; preds = %68
%84 = getelementptr inbounds i8, i8* %52, i64 %69
%85 = load i8, i8* %84
%86 = sub nsw i64 %69, %29
%87 = getelementptr inbounds i8, i8* %52, i64 %86
%88 = load i8, i8* %87
%89 = lshr i8 %88, 1
%90 = sub i8 %85, %89
br label %107
91: ; preds = %68
%92 = getelementptr inbounds i8, i8* %52, i64 %69
%93 = load i8, i8* %92
%94 = sub nsw i64 %69, %29
%95 = getelementptr inbounds i8, i8* %52, i64 %94
%96 = load i8, i8* %95
%97 = zext i8 %96 to i32
%98 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @stbiw__paeth to i32 (i32, i32, i32, ...)*)(i32 0, i32 %97, i32 0)
%99 = trunc i32 %98 to i8
%100 = sub i8 %93, %99
br label %107
101: ; preds = %68
%102 = getelementptr inbounds i8, i8* %52, i64 %69
%103 = load i8, i8* %102
br label %107
104: ; preds = %68
%105 = getelementptr inbounds i8, i8* %52, i64 %69
%106 = load i8, i8* %105
br label %107
107: ; preds = %104, %101, %91, %83, %76, %73, %70
%108 = phi i8 [ %72, %70 ], [ %75, %73 ], [ %82, %76 ], [ %90, %83 ], [ %100, %91 ], [ %103, %101 ], [ %106, %104 ]
%109 = getelementptr inbounds i8, i8* %21, i64 %69
store i8 %108, i8* %109
br label %110
110: ; preds = %107, %68
%111 = add nuw nsw i64 %69, 1
%112 = icmp eq i64 %111, %33
br i1 %112, label %67, label %68
113: ; preds = %67, %186
%114 = phi i64 [ %187, %186 ], [ %30, %67 ]
switch i32 %66, label %186 [
i32 0, label %115
i32 1, label %118
i32 2, label %125
i32 3, label %132
i32 4, label %147
i32 5, label %165
i32 6, label %173
]
115: ; preds = %113
%116 = getelementptr inbounds i8, i8* %52, i64 %114
%117 = load i8, i8* %116
br label %183
118: ; preds = %113
%119 = getelementptr inbounds i8, i8* %52, i64 %114
%120 = load i8, i8* %119
%121 = sub nsw i64 %114, %30
%122 = getelementptr inbounds i8, i8* %52, i64 %121
%123 = load i8, i8* %122
%124 = sub i8 %120, %123
br label %183
125: ; preds = %113
%126 = getelementptr inbounds i8, i8* %52, i64 %114
%127 = load i8, i8* %126
%128 = sub nsw i64 %114, %29
%129 = getelementptr inbounds i8, i8* %52, i64 %128
%130 = load i8, i8* %129
%131 = sub i8 %127, %130
br label %183
132: ; preds = %113
%133 = getelementptr inbounds i8, i8* %52, i64 %114
%134 = load i8, i8* %133
%135 = sub nsw i64 %114, %30
%136 = getelementptr inbounds i8, i8* %52, i64 %135
%137 = load i8, i8* %136
%138 = zext i8 %137 to i16
%139 = sub nsw i64 %114, %29
%140 = getelementptr inbounds i8, i8* %52, i64 %139
%141 = load i8, i8* %140
%142 = zext i8 %141 to i16
%143 = add nuw nsw i16 %142, %138
%144 = lshr i16 %143, 1
%145 = trunc i16 %144 to i8
%146 = sub i8 %134, %145
br label %183
147: ; preds = %113
%148 = getelementptr inbounds i8, i8* %52, i64 %114
%149 = load i8, i8* %148
%150 = sub nsw i64 %114, %30
%151 = getelementptr inbounds i8, i8* %52, i64 %150
%152 = load i8, i8* %151
%153 = zext i8 %152 to i32
%154 = sub nsw i64 %114, %29
%155 = getelementptr inbounds i8, i8* %52, i64 %154
%156 = load i8, i8* %155
%157 = zext i8 %156 to i32
%158 = sub nsw i64 %154, %30
%159 = getelementptr inbounds i8, i8* %52, i64 %158
%160 = load i8, i8* %159
%161 = zext i8 %160 to i32
%162 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @stbiw__paeth to i32 (i32, i32, i32, ...)*)(i32 %153, i32 %157, i32 %161)
%163 = trunc i32 %162 to i8
%164 = sub i8 %149, %163
br label %183
165: ; preds = %113
%166 = getelementptr inbounds i8, i8* %52, i64 %114
%167 = load i8, i8* %166
%168 = sub nsw i64 %114, %30
%169 = getelementptr inbounds i8, i8* %52, i64 %168
%170 = load i8, i8* %169
%171 = lshr i8 %170, 1
%172 = sub i8 %167, %171
br label %183
173: ; preds = %113
%174 = getelementptr inbounds i8, i8* %52, i64 %114
%175 = load i8, i8* %174
%176 = sub nsw i64 %114, %30
%177 = getelementptr inbounds i8, i8* %52, i64 %176
%178 = load i8, i8* %177
%179 = zext i8 %178 to i32
%180 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @stbiw__paeth to i32 (i32, i32, i32, ...)*)(i32 %179, i32 0, i32 0)
%181 = trunc i32 %180 to i8
%182 = sub i8 %175, %181
br label %183
183: ; preds = %173, %165, %147, %132, %125, %118, %115
%184 = phi i8 [ %117, %115 ], [ %124, %118 ], [ %131, %125 ], [ %146, %132 ], [ %164, %147 ], [ %172, %165 ], [ %182, %173 ]
%185 = getelementptr inbounds i8, i8* %21, i64 %114
store i8 %184, i8* %185
br label %186
186: ; preds = %183, %113
%187 = add nsw i64 %114, 1
%188 = trunc i64 %187 to i32
%189 = icmp eq i32 %12, %188
br i1 %189, label %190, label %113
190: ; preds = %186, %67
br i1 %56, label %191, label %276
191: ; preds = %190
br i1 %28, label %192, label %264
192: ; preds = %191
br i1 %39, label %251, label %193
193: ; preds = %192
br i1 %42, label %227, label %194
194: ; preds = %193, %194
%195 = phi i64 [ %224, %194 ], [ 0, %193 ]
%196 = phi <4 x i32> [ %222, %194 ], [ zeroinitializer, %193 ]
%197 = phi <4 x i32> [ %223, %194 ], [ zeroinitializer, %193 ]
%198 = phi i64 [ %225, %194 ], [ 0, %193 ]
%199 = getelementptr inbounds i8, i8* %21, i64 %195
%200 = bitcast i8* %199 to <4 x i8>*
%201 = load <4 x i8>, <4 x i8>* %200
%202 = getelementptr inbounds i8, i8* %199, i64 4
%203 = bitcast i8* %202 to <4 x i8>*
%204 = load <4 x i8>, <4 x i8>* %203
%205 = call <4 x i8> @llvm.abs.v4i8(<4 x i8> %201, i1 false)
%206 = call <4 x i8> @llvm.abs.v4i8(<4 x i8> %204, i1 false)
%207 = zext <4 x i8> %205 to <4 x i32>
%208 = zext <4 x i8> %206 to <4 x i32>
%209 = add <4 x i32> %196, %207
%210 = add <4 x i32> %197, %208
%211 = or i64 %195, 8
%212 = getelementptr inbounds i8, i8* %21, i64 %211
%213 = bitcast i8* %212 to <4 x i8>*
%214 = load <4 x i8>, <4 x i8>* %213
%215 = getelementptr inbounds i8, i8* %212, i64 4
%216 = bitcast i8* %215 to <4 x i8>*
%217 = load <4 x i8>, <4 x i8>* %216
%218 = call <4 x i8> @llvm.abs.v4i8(<4 x i8> %214, i1 false)
%219 = call <4 x i8> @llvm.abs.v4i8(<4 x i8> %217, i1 false)
%220 = zext <4 x i8> %218 to <4 x i32>
%221 = zext <4 x i8> %219 to <4 x i32>
%222 = add <4 x i32> %209, %220
%223 = add <4 x i32> %210, %221
%224 = add nuw i64 %195, 16
%225 = add i64 %198, 2
%226 = icmp eq i64 %225, %43
br i1 %226, label %227, label %194
227: ; preds = %194, %193
%228 = phi <4 x i32> [ undef, %193 ], [ %222, %194 ]
%229 = phi <4 x i32> [ undef, %193 ], [ %223, %194 ]
%230 = phi i64 [ 0, %193 ], [ %224, %194 ]
%231 = phi <4 x i32> [ zeroinitializer, %193 ], [ %222, %194 ]
%232 = phi <4 x i32> [ zeroinitializer, %193 ], [ %223, %194 ]
br i1 %44, label %246, label %233
233: ; preds = %227
%234 = getelementptr inbounds i8, i8* %21, i64 %230
%235 = bitcast i8* %234 to <4 x i8>*
%236 = load <4 x i8>, <4 x i8>* %235
%237 = getelementptr inbounds i8, i8* %234, i64 4
%238 = bitcast i8* %237 to <4 x i8>*
%239 = load <4 x i8>, <4 x i8>* %238
%240 = call <4 x i8> @llvm.abs.v4i8(<4 x i8> %236, i1 false)
%241 = call <4 x i8> @llvm.abs.v4i8(<4 x i8> %239, i1 false)
%242 = zext <4 x i8> %240 to <4 x i32>
%243 = zext <4 x i8> %241 to <4 x i32>
%244 = add <4 x i32> %231, %242
%245 = add <4 x i32> %232, %243
br label %246
246: ; preds = %227, %233
%247 = phi <4 x i32> [ %228, %227 ], [ %244, %233 ]
%248 = phi <4 x i32> [ %229, %227 ], [ %245, %233 ]
%249 = add <4 x i32> %248, %247
%250 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %249)
br i1 %45, label %264, label %251
251: ; preds = %192, %246
%252 = phi i64 [ 0, %192 ], [ %40, %246 ]
%253 = phi i32 [ 0, %192 ], [ %250, %246 ]
br label %254
254: ; preds = %251, %254
%255 = phi i64 [ %262, %254 ], [ %252, %251 ]
%256 = phi i32 [ %261, %254 ], [ %253, %251 ]
%257 = getelementptr inbounds i8, i8* %21, i64 %255
%258 = load i8, i8* %257
%259 = tail call i8 @llvm.abs.i8(i8 %258, i1 false)
%260 = zext i8 %259 to i32
%261 = add nuw nsw i32 %256, %260
%262 = add nuw nsw i64 %255, 1
%263 = icmp eq i64 %262, %34
br i1 %263, label %264, label %254
264: ; preds = %254, %246, %191
%265 = phi i32 [ 0, %191 ], [ %250, %246 ], [ %261, %254 ]
%266 = icmp slt i32 %265, %63
%267 = trunc i64 %62 to i32
%268 = select i1 %266, i32 %267, i32 %64
%269 = select i1 %266, i32 %265, i32 %63
%270 = add nsw i64 %62, 1
%271 = trunc i64 %270 to i32
%272 = icmp eq i32 %271, 5
br i1 %272, label %273, label %61
273: ; preds = %264, %53
%274 = phi i32 [ %55, %53 ], [ %268, %264 ]
%275 = phi i32 [ %54, %53 ], [ %269, %264 ]
br i1 %56, label %53, label %276
276: ; preds = %273, %190
%277 = phi i32 [ %55, %190 ], [ %274, %273 ]
%278 = trunc i32 %277 to i8
%279 = mul nsw i64 %48, %31
%280 = getelementptr inbounds i8, i8* %17, i64 %279
store i8 %278, i8* %280
%281 = getelementptr inbounds i8, i8* %280, i64 1
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %281, i8* align 1 %21, i64 %20, i1 false)
%282 = add nuw nsw i64 %48, 1
%283 = icmp eq i64 %282, %32
br i1 %283, label %284, label %47
284: ; preds = %276, %23
tail call void @free(i8* %21)
%285 = call i32 (i8*, i32, i32*, i32, ...) bitcast (i32 (...)* @stbi_zlib_compress to i32 (i8*, i32, i32*, i32, ...)*)(i8* %17, i32 %15, i32* %8, i32 8)
%286 = sext i32 %285 to i64
%287 = inttoptr i64 %286 to i8*
%288 = icmp eq i32 %285, 0
br i1 %288, label %397, label %289
289: ; preds = %284
%290 = load i32, i32* %8
%291 = add nsw i32 %290, 57
%292 = sext i32 %291 to i64
%293 = call i8* @malloc(i64 %292)
%294 = icmp eq i8* %293, null
br i1 %294, label %397, label %295
295: ; preds = %289
store i32 %291, i32* %5
%296 = bitcast i8* %293 to i64*
store i64 727905341920923785, i64* %296
%297 = getelementptr inbounds i8, i8* %293, i64 8
store i8 0, i8* %297
%298 = getelementptr inbounds i8, i8* %293, i64 9
store i8 0, i8* %298
%299 = getelementptr inbounds i8, i8* %293, i64 10
store i8 0, i8* %299
%300 = getelementptr inbounds i8, i8* %293, i64 11
store i8 13, i8* %300
%301 = getelementptr inbounds i8, i8* %293, i64 12
store i8 73, i8* %301
%302 = getelementptr inbounds i8, i8* %293, i64 13
store i8 72, i8* %302
%303 = getelementptr inbounds i8, i8* %293, i64 14
store i8 68, i8* %303
%304 = getelementptr inbounds i8, i8* %293, i64 15
store i8 82, i8* %304
%305 = getelementptr inbounds i8, i8* %293, i64 16
%306 = lshr i32 %2, 24
%307 = trunc i32 %306 to i8
store i8 %307, i8* %305
%308 = lshr i32 %2, 16
%309 = trunc i32 %308 to i8
%310 = getelementptr inbounds i8, i8* %293, i64 17
store i8 %309, i8* %310
%311 = lshr i32 %2, 8
%312 = trunc i32 %311 to i8
%313 = getelementptr inbounds i8, i8* %293, i64 18
store i8 %312, i8* %313
%314 = trunc i32 %2 to i8
%315 = getelementptr inbounds i8, i8* %293, i64 19
store i8 %314, i8* %315
%316 = getelementptr inbounds i8, i8* %293, i64 20
%317 = lshr i32 %3, 24
%318 = trunc i32 %317 to i8
store i8 %318, i8* %316
%319 = lshr i32 %3, 16
%320 = trunc i32 %319 to i8
%321 = getelementptr inbounds i8, i8* %293, i64 21
store i8 %320, i8* %321
%322 = lshr i32 %3, 8
%323 = trunc i32 %322 to i8
%324 = getelementptr inbounds i8, i8* %293, i64 22
store i8 %323, i8* %324
%325 = trunc i32 %3 to i8
%326 = getelementptr inbounds i8, i8* %293, i64 23
store i8 %325, i8* %326
%327 = getelementptr inbounds i8, i8* %293, i64 24
%328 = getelementptr inbounds i8, i8* %293, i64 25
store i8 8, i8* %327
%329 = sext i32 %4 to i64
%330 = getelementptr inbounds [5 x i32], [5 x i32]* @__const.stbi_write_png_to_mem.ctype, i64 0, i64 %329
%331 = load i32, i32* %330
%332 = trunc i32 %331 to i8
%333 = getelementptr inbounds i8, i8* %293, i64 26
store i8 %332, i8* %328
%334 = getelementptr inbounds i8, i8* %293, i64 27
store i8 0, i8* %333
%335 = getelementptr inbounds i8, i8* %293, i64 28
store i8 0, i8* %334
%336 = getelementptr inbounds i8, i8* %293, i64 29
store i8* %336, i8** %7
store i8 0, i8* %335
%337 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @stbiw__wpcrc to i32 (i8**, i32, ...)*)(i8** %7, i32 13)
%338 = load i32, i32* %8
%339 = lshr i32 %338, 24
%340 = trunc i32 %339 to i8
%341 = load i8*, i8** %7
store i8 %340, i8* %341
%342 = load i32, i32* %8
%343 = lshr i32 %342, 16
%344 = trunc i32 %343 to i8
%345 = load i8*, i8** %7
%346 = getelementptr inbounds i8, i8* %345, i64 1
store i8 %344, i8* %346
%347 = load i32, i32* %8
%348 = lshr i32 %347, 8
%349 = trunc i32 %348 to i8
%350 = load i8*, i8** %7
%351 = getelementptr inbounds i8, i8* %350, i64 2
store i8 %349, i8* %351
%352 = load i32, i32* %8
%353 = trunc i32 %352 to i8
%354 = load i8*, i8** %7
%355 = getelementptr inbounds i8, i8* %354, i64 3
store i8 %353, i8* %355
%356 = load i8*, i8** %7
%357 = getelementptr inbounds i8, i8* %356, i64 4
store i8* %357, i8** %7
store i8 73, i8* %357
%358 = load i8*, i8** %7
%359 = getelementptr inbounds i8, i8* %358, i64 1
store i8 68, i8* %359
%360 = load i8*, i8** %7
%361 = getelementptr inbounds i8, i8* %360, i64 2
store i8 65, i8* %361
%362 = load i8*, i8** %7
%363 = getelementptr inbounds i8, i8* %362, i64 3
store i8 84, i8* %363
%364 = load i8*, i8** %7
%365 = getelementptr inbounds i8, i8* %364, i64 4
store i8* %365, i8** %7
%366 = load i32, i32* %8
%367 = sext i32 %366 to i64
%368 = load i8*, i8** %7
%369 = getelementptr inbounds i8, i8* %368, i64 %367
store i8* %369, i8** %7
%370 = load i32, i32* %8
%371 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @stbiw__wpcrc to i32 (i8**, i32, ...)*)(i8** %7, i32 %370)
%372 = load i8*, i8** %7
store i8 0, i8* %372
%373 = load i8*, i8** %7
%374 = getelementptr inbounds i8, i8* %373, i64 1
store i8 0, i8* %374
%375 = load i8*, i8** %7
%376 = getelementptr inbounds i8, i8* %375, i64 2
store i8 0, i8* %376
%377 = load i8*, i8** %7
%378 = getelementptr inbounds i8, i8* %377, i64 3
store i8 0, i8* %378
%379 = load i8*, i8** %7
%380 = getelementptr inbounds i8, i8* %379, i64 4
store i8* %380, i8** %7
store i8 73, i8* %380
%381 = load i8*, i8** %7
%382 = getelementptr inbounds i8, i8* %381, i64 1
store i8 69, i8* %382
%383 = load i8*, i8** %7
%384 = getelementptr inbounds i8, i8* %383, i64 2
store i8 78, i8* %384
%385 = load i8*, i8** %7
%386 = getelementptr inbounds i8, i8* %385, i64 3
store i8 68, i8* %386
%387 = load i8*, i8** %7
%388 = getelementptr inbounds i8, i8* %387, i64 4
store i8* %388, i8** %7
%389 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @stbiw__wpcrc to i32 (i8**, i32, ...)*)(i8** %7, i32 0)
%390 = load i8*, i8** %7
%391 = load i32, i32* %5
%392 = sext i32 %391 to i64
%393 = getelementptr inbounds i8, i8* %293, i64 %392
%394 = icmp eq i8* %390, %393
%395 = zext i1 %394 to i32
%396 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %395)
br label %397
397: ; preds = %289, %284, %6, %295, %46
%398 = phi i8* [ %293, %295 ], [ null, %46 ], [ null, %6 ], [ null, %284 ], [ null, %289 ]
ret i8* %398
}