user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<stbi_write_png_to_mem>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xd8,%rsp
  mov    %rdi,0x80(%rsp)
  mov    %edx,0x94(%rsp)
  imul   %r8d,%edx
  mov    %ecx,0x74(%rsp)
  mov    %r8d,0x10(%rsp)
  mov    %r9,0x98(%rsp)
  lea    0x1(%rdx),%ebx
  mov    %fs:0x28,%rax
  mov    %rax,0xc8(%rsp)
  mov    $0xffffffff,%eax
  test   %esi,%esi
  mov    %edx,0x14(%rsp)
  movl   $0x6,0xc0(%rsp)
  cmove  %edx,%esi
  imul   %ebx,%ecx
  mov    %esi,0x24(%rsp)
  movslq %ecx,%rdi
  mov    %ecx,0x90(%rsp)
  mov    %rax,0xb0(%rsp)
  movabs $0x200000004,%rax
  mov    %rax,0xb8(%rsp)
  call   <malloc@plt>
  mov    %rax,0x88(%rsp)
  test   %rax,%rax
  je     L195
  movslq 0x14(%rsp),%rax
  mov    %rax,%rdi
  mov    %rax,0x48(%rsp)
  call   <malloc@plt>
  mov    %rax,0x28(%rsp)
  test   %rax,%rax
  je     L68
  mov    0x74(%rsp),%r8d
  test   %r8d,%r8d
  jle    L311
  movslq %ebx,%rax
  movl   $0x0,0x70(%rsp)
  mov    %rax,0x78(%rsp)
  mov    0x88(%rsp),%rax
  movl   $0x0,0x64(%rsp)
  add    $0x1,%rax
  mov    %rax,0x68(%rsp)
  lea    D2(%rip),%rax
  mov    %rax,0x38(%rsp)
  movslq 0x10(%rsp),%rax
  mov    %rax,%rdi
  mov    %rax,0x50(%rsp)
  mov    0x28(%rsp),%rax
  add    %rdi,%rax
  mov    0x24(%rsp),%edi
  mov    %rax,0x58(%rsp)
  add    %eax,%edi
  mov    %edi,0x44(%rsp)
L142:
  movslq 0x70(%rsp),%rax
  mov    0x80(%rsp),%rsi
  movl   $0x0,0x40(%rsp)
  mov    0x40(%rsp),%edi
  movl   $0x7fffffff,0x34(%rsp)
  lea    (%rsi,%rax,1),%r14
  movl   $0x0,0x60(%rsp)
  mov    %r14,%r15
  test   %edi,%edi
  je     L314
L124:
  movslq 0x60(%rsp),%rax
  cmp    $0x4,%eax
  jg     L57
L18:
  mov    %rax,0x8(%rsp)
  lea    D41(%rip),%r9
  mov    %r15,%r8
  nopl   0x0(%rax,%rax,1)
L42:
  mov    0x8(%rsp),%rax
  mov    0x38(%rsp),%rdi
  mov    0x10(%rsp),%esi
  mov    %eax,0x30(%rsp)
  mov    (%rdi,%rax,4),%ebx
  test   %esi,%esi
  jle    L192
  mov    0x24(%rsp),%eax
  mov    0x10(%rsp),%r15d
  mov    %r8,%r14
  mov    0x28(%rsp),%r13
  mov    %eax,%r12d
  sub    %eax,%r15d
  neg    %r12d
  nopl   0x0(%rax,%rax,1)
L339:
  cmp    $0x6,%ebx
  ja     L275
  mov    %ebx,%eax
  movslq (%r9,%rax,4),%rax
  add    %r9,%rax
  notrack jmp *%rax
  nopl   0x0(%rax)
  movzbl (%r14),%eax
  mov    %al,0x0(%r13)
L275:
  add    $0x1,%r12d
  add    $0x1,%r14
  add    $0x1,%r13
  cmp    %r15d,%r12d
  jne    L339
L192:
  mov    0x14(%rsp),%esi
  cmp    %esi,0x10(%rsp)
  jge    L236
  mov    0x50(%rsp),%rax
  mov    0x14(%rsp),%r10d
  xor    %ebp,%ebp
  lea    D62(%rip),%rcx
  mov    0x58(%rsp),%r12
  lea    (%r8,%rax,1),%r13
  mov    0x10(%rsp),%eax
  mov    %eax,%r14d
  sub    %eax,%r10d
  sub    0x24(%rsp),%r14d
  nopw   0x0(%rax,%rax,1)
L30:
  cmp    $0x6,%ebx
  ja     L123
  mov    %ebx,%eax
  movslq (%rcx,%rax,4),%rax
  add    %rcx,%rax
  notrack jmp *%rax
  nopl   (%rax)
  movslq %r12d,%rdx
  movzbl (%r14),%eax
  sub    (%r8,%rdx,1),%al
  mov    %al,0x0(%r13)
  jmp    L275
  nopl   0x0(%rax)
  movslq %r12d,%rax
  movzbl (%r8,%rax,1),%edx
  movzbl (%r14),%eax
  shr    %dl
  sub    %edx,%eax
  mov    %al,0x0(%r13)
  jmp    L275
  nopl   0x0(%rax)
  movslq %r12d,%rax
  movzbl (%r14),%ebp
  xor    %edx,%edx
  xor    %edi,%edi
  movzbl (%r8,%rax,1),%esi
  xor    %eax,%eax
  mov    %r8,0x18(%rsp)
  call   <stbiw__paeth@plt>
  mov    0x18(%rsp),%r8
  lea    D41(%rip),%r9
  sub    %eax,%ebp
  mov    %bpl,0x0(%r13)
  jmp    L275
  nopl   0x0(%rax,%rax,1)
  movslq %ebp,%rax
  movzbl (%r8,%rax,1),%edx
  movzbl 0x0(%r13),%eax
  shr    %dl
  sub    %edx,%eax
  mov    %al,(%r12)
  nopl   (%rax)
L123:
  add    $0x1,%ebp
  add    $0x1,%r13
  add    $0x1,%r12
  add    $0x1,%r14d
  cmp    %r10d,%ebp
  jne    L30
L236:
  mov    0x40(%rsp),%ecx
  test   %ecx,%ecx
  jne    L306
  mov    0x14(%rsp),%edx
  test   %edx,%edx
  jle    L206
  mov    0x28(%rsp),%rdi
  xor    %esi,%esi
  mov    %rdi,%rdx
  add    0x48(%rsp),%rdi
  nop
L161:
  movzbl (%rdx),%ecx
  mov    %ecx,%eax
  neg    %al
  cmovs  %ecx,%eax
  add    $0x1,%rdx
  movzbl %al,%eax
  add    %eax,%esi
  cmp    %rdx,%rdi
  jne    L161
L52:
  cmp    0x34(%rsp),%esi
  jge    L166
  mov    0x30(%rsp),%eax
  mov    %esi,0x34(%rsp)
  mov    %eax,0x60(%rsp)
L166:
  addq   $0x1,0x8(%rsp)
  mov    0x8(%rsp),%rax
  cmp    $0x4,%eax
  jle    L42
  mov    %r8,%r15
L72:
  addl   $0x1,0x40(%rsp)
  mov    0x40(%rsp),%edi
  test   %edi,%edi
  jne    L124
L314:
  xor    %eax,%eax
  jmp    L18
  nopl   0x0(%rax)
  mov    %r12d,%eax
  sub    0x44(%rsp),%eax
  movzbl 0x0(%r13),%r15d
  mov    %r10d,0x20(%rsp)
  cltq
  mov    %r8,0x18(%rsp)
  movzbl (%r8,%rax,1),%edx
  movslq %r14d,%rax
  movzbl (%r8,%rax,1),%esi
  movslq %ebp,%rax
  movzbl (%r8,%rax,1),%edi
  xor    %eax,%eax
  call   <stbiw__paeth@plt>
  mov    0x18(%rsp),%r8
  mov    0x20(%rsp),%r10d
  lea    D62(%rip),%rcx
  sub    %eax,%r15d
  lea    D41(%rip),%r9
  mov    %r15b,(%r12)
  jmp    L123
  nopl   0x0(%rax,%rax,1)
  movslq %ebp,%rax
  movslq %r14d,%rdx
  movzbl (%r8,%rdx,1),%edx
  movzbl (%r8,%rax,1),%eax
  add    %edx,%eax
  movzbl 0x0(%r13),%edx
  sar    %eax
  sub    %eax,%edx
  mov    %dl,(%r12)
  jmp    L123
  nopl   0x0(%rax)
  movslq %r14d,%rdx
  movzbl 0x0(%r13),%eax
  sub    (%r8,%rdx,1),%al
  mov    %al,(%r12)
  jmp    L123
  nopl   (%rax)
  movslq %ebp,%rdx
  movzbl 0x0(%r13),%eax
  sub    (%r8,%rdx,1),%al
  mov    %al,(%r12)
  jmp    L123
  nopl   (%rax)
  movslq %ebp,%rax
  movzbl 0x0(%r13),%r15d
  xor    %edx,%edx
  xor    %esi,%esi
  movzbl (%r8,%rax,1),%edi
  xor    %eax,%eax
  mov    %r10d,0x20(%rsp)
  mov    %r8,0x18(%rsp)
  call   <stbiw__paeth@plt>
  mov    0x20(%rsp),%r10d
  mov    0x18(%rsp),%r8
  lea    D41(%rip),%r9
  sub    %eax,%r15d
  lea    D62(%rip),%rcx
  mov    %r15b,(%r12)
  jmp    L123
  xchg   %ax,%ax
  movzbl 0x0(%r13),%eax
  mov    %al,(%r12)
  jmp    L123
  xchg   %ax,%ax
L206:
  xor    %esi,%esi
  jmp    L52
L306:
  mov    %r8,%r15
L57:
  cmpl   $0x1,0x40(%rsp)
  jne    L72
  mov    0x68(%rsp),%rbx
  movzbl 0x60(%rsp),%eax
  mov    0x28(%rsp),%rsi
  mov    0x48(%rsp),%rdx
  mov    %al,-0x1(%rbx)
  mov    %rbx,%rdi
  call   <memcpy@plt>
  mov    0x78(%rsp),%rdi
  mov    0x24(%rsp),%esi
  add    %esi,0x70(%rsp)
  lea    D70(%rip),%rsi
  add    %rdi,%rbx
  addl   $0x1,0x64(%rsp)
  mov    0x64(%rsp),%eax
  mov    %rbx,0x68(%rsp)
  mov    %rsi,0x38(%rsp)
  cmp    %eax,0x74(%rsp)
  jne    L142
L311:
  mov    0x28(%rsp),%rdi
  call   <free@plt>
  mov    0x88(%rsp),%rbx
  xor    %eax,%eax
  mov    0x90(%rsp),%esi
  lea    0xa4(%rsp),%rdx
  mov    $0x8,%ecx
  mov    %rbx,%rdi
  call   <stbi_zlib_compress@plt>
  mov    %rbx,%rdi
  movslq %eax,%rbp
  call   <free@plt>
  test   %ebp,%ebp
  je     L195
  mov    0xa4(%rsp),%eax
  lea    0x39(%rax),%r12d
  movslq %r12d,%rdi
  call   <malloc@plt>
  mov    %rax,0x28(%rsp)
  mov    %rax,%r15
  test   %rax,%rax
  je     L20
  movabs $0xa1a0a0d474e5089,%rax
  movb   $0x8,0x18(%r15)
  mov    $0xd,%esi
  mov    0x98(%rsp),%r14
  mov    %rax,(%r15)
  movabs $0x524448490d000000,%rax
  mov    %rax,0x8(%r15)
  mov    0x94(%rsp),%eax
  mov    %r12d,(%r14)
  lea    0xa8(%rsp),%r12
  bswap  %eax
  mov    %eax,0x10(%r15)
  mov    0x74(%rsp),%eax
  mov    %r12,%rdi
  movb   $0x0,0x1c(%r15)
  bswap  %eax
  mov    %eax,0x14(%r15)
  movslq 0x10(%rsp),%rax
  mov    0xb0(%rsp,%rax,4),%eax
  mov    %al,0x19(%r15)
  lea    0x1d(%r15),%rax
  mov    %rax,0xa8(%rsp)
  xor    %eax,%eax
  mov    %ax,0x1a(%r15)
  xor    %eax,%eax
  call   <stbiw__wpcrc@plt>
  mov    0xa8(%rsp),%rax
  movsbl 0xa7(%rsp),%edx
  mov    %rbp,%rsi
  mov    %dl,(%rax)
  mov    0xa8(%rsp),%rax
  movswl 0xa6(%rsp),%edx
  mov    %dl,0x1(%rax)
  mov    0xa8(%rsp),%rax
  mov    0xa4(%rsp),%edx
  mov    %dh,0x2(%rax)
  mov    0xa8(%rsp),%rax
  mov    0xa4(%rsp),%edx
  mov    %dl,0x3(%rax)
  mov    0xa8(%rsp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,0xa8(%rsp)
  movb   $0x49,0x4(%rax)
  mov    0xa8(%rsp),%rax
  movb   $0x44,0x1(%rax)
  mov    0xa8(%rsp),%rax
  movb   $0x41,0x2(%rax)
  mov    0xa8(%rsp),%rax
  movb   $0x54,0x3(%rax)
  mov    0xa8(%rsp),%rax
  movslq 0xa4(%rsp),%rbx
  lea    0x4(%rax),%rdi
  mov    %rbx,%rdx
  mov    %rdi,0xa8(%rsp)
  call   <memmove@plt>
  mov    %rbp,%rdi
  add    %rbx,0xa8(%rsp)
  call   <free@plt>
  mov    0xa4(%rsp),%esi
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <stbiw__wpcrc@plt>
  mov    0xa8(%rsp),%rax
  xor    %esi,%esi
  mov    %r12,%rdi
  movb   $0x0,(%rax)
  mov    0xa8(%rsp),%rax
  movb   $0x0,0x1(%rax)
  mov    0xa8(%rsp),%rax
  movb   $0x0,0x2(%rax)
  mov    0xa8(%rsp),%rax
  movb   $0x0,0x3(%rax)
  mov    0xa8(%rsp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,0xa8(%rsp)
  movb   $0x49,0x4(%rax)
  mov    0xa8(%rsp),%rax
  movb   $0x45,0x1(%rax)
  mov    0xa8(%rsp),%rax
  movb   $0x4e,0x2(%rax)
  mov    0xa8(%rsp),%rax
  movb   $0x44,0x3(%rax)
  xor    %eax,%eax
  addq   $0x4,0xa8(%rsp)
  call   <stbiw__wpcrc@plt>
  movslq (%r14),%rax
  xor    %edi,%edi
  add    %r15,%rax
  cmp    %rax,0xa8(%rsp)
  sete   %dil
  xor    %eax,%eax
  call   <assert@plt>
L20:
  mov    0xc8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L31
  mov    0x28(%rsp),%rax
  add    $0xd8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L195:
  movq   $0x0,0x28(%rsp)
  jmp    L20
L31:
  call   <__stack_chk_fail@plt>
L68:
  mov    0x88(%rsp),%rdi
  call   <free@plt>
  jmp    L20
```

assistant: ```c
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;
}
```