user: 请从给定的汇编指令推导出C源代码:

```asm
<png_predict>:
  endbr64
  imul   %r8d,%ecx
  push   %r15
  push   %r14
  push   %r13
  imul   %ecx,%esi
  push   %r12
  add    $0x7,%ecx
  push   %rbp
  shr    $0x3,%ecx
  push   %rbx
  add    $0x7,%esi
  mov    %esi,%eax
  sub    $0x58,%rsp
  shr    $0x3,%eax
  mov    %rdi,0x20(%rsp)
  mov    %edx,0x2c(%rsp)
  mov    %eax,0x4(%rsp)
  mov    %ecx,0x28(%rsp)
  test   %edx,%edx
  je     L381
  mov    %ecx,%esi
  lea    0x1(%rax),%edi
  mov    %eax,%ecx
  movl   $0x0,0x8(%rsp)
  sub    %esi,%eax
  mov    %rcx,0x40(%rsp)
  neg    %rcx
  mov    %eax,0x3c(%rsp)
  lea    -0x1(%rsi),%eax
  add    $0x2,%rax
  mov    %edi,0x38(%rsp)
  mov    %rcx,0x30(%rsp)
  movl   $0x0,0xc(%rsp)
  movl   $0x0,(%rsp)
  mov    %rax,0x48(%rsp)
  nopl   0x0(%rax)
L472:
  mov    0x20(%rsp),%rax
  mov    0xc(%rsp),%ebx
  mov    0x8(%rsp),%ecx
  add    %rax,%rbx
  lea    (%rax,%rcx,1),%r12
  mov    0x30(%rsp),%rax
  lea    0x1(%rbx),%rbp
  lea    (%r12,%rax,1),%r13
  movzbl (%rbx),%eax
  cmp    $0x3,%al
  je     L424
  ja     L236
  cmp    $0x1,%al
  je     L150
  cmp    $0x2,%al
  jne    L225
  mov    (%rsp),%r8d
  test   %r8d,%r8d
  je     L26
  mov    0x4(%rsp),%edi
  mov    0x40(%rsp),%rcx
  xor    %eax,%eax
  test   %edi,%edi
  je     L46
  nopw   0x0(%rax,%rax,1)
L323:
  movzbl 0x0(%r13,%rax,1),%edx
  add    0x1(%rbx,%rax,1),%dl
  mov    %dl,(%r12,%rax,1)
  add    $0x1,%rax
  cmp    %rax,%rcx
  jne    L323
  nop
L46:
  addl   $0x1,(%rsp)
  mov    0x38(%rsp),%ecx
  mov    0x4(%rsp),%ebx
  add    %ecx,0xc(%rsp)
  add    %ebx,0x8(%rsp)
  mov    (%rsp),%eax
  cmp    %eax,0x2c(%rsp)
  jne    L472
L381:
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L236:
  cmp    $0x4,%al
  jne    L225
  mov    (%rsp),%edx
  test   %edx,%edx
  je     L30
  mov    0x28(%rsp),%ecx
  xor    %r15d,%r15d
  mov    %rcx,0x10(%rsp)
  test   %ecx,%ecx
  je     L187
  mov    %rbp,0x18(%rsp)
  mov    %r15,%rbp
  mov    %rbx,%r15
  mov    0x10(%rsp),%rbx
  nopw   0x0(%rax,%rax,1)
L177:
  movzbl 0x0(%r13,%rbp,1),%esi
  movzbl 0x1(%r15,%rbp,1),%r14d
  xor    %edx,%edx
  xor    %edi,%edi
  xor    %eax,%eax
  call   <paeth@plt>
  add    %eax,%r14d
  mov    %r14b,(%r12,%rbp,1)
  add    $0x1,%rbp
  cmp    %rbp,%rbx
  jne    L177
  mov    0x10(%rsp),%rax
  mov    0x18(%rsp),%rbp
  lea    0x0(%r13,%rax,1),%r14
  add    %rax,%rbp
  add    %r12,%rax
  mov    %rax,0x10(%rsp)
L277:
  mov    0x28(%rsp),%esi
  cmp    %esi,0x4(%rsp)
  jbe    L46
  mov    0x3c(%rsp),%eax
  xor    %r15d,%r15d
  sub    $0x1,%eax
  mov    %rax,0x18(%rsp)
  mov    %r14,%rax
  mov    %r15,%r14
  mov    %rax,%r15
  nopw   0x0(%rax,%rax,1)
L71:
  movzbl 0x0(%r13,%r14,1),%edx
  movzbl (%r15,%r14,1),%esi
  xor    %eax,%eax
  movzbl (%r12,%r14,1),%edi
  movzbl 0x0(%rbp,%r14,1),%ebx
  call   <paeth@plt>
  add    %eax,%ebx
  mov    0x10(%rsp),%rax
  mov    %bl,(%rax,%r14,1)
  mov    %r14,%rax
  add    $0x1,%r14
  cmp    0x18(%rsp),%rax
  jne    L71
  jmp    L46
  nopl   0x0(%rax,%rax,1)
L225:
  mov    0x4(%rsp),%r9d
  mov    0x40(%rsp),%rcx
  xor    %eax,%eax
  test   %r9d,%r9d
  je     L46
  nopl   (%rax)
L129:
  movzbl 0x1(%rbx,%rax,1),%edx
  mov    %dl,(%r12,%rax,1)
  add    $0x1,%rax
  cmp    %rax,%rcx
  jne    L129
  jmp    L46
  nop
L424:
  mov    (%rsp),%ecx
  test   %ecx,%ecx
  je     L336
  mov    0x28(%rsp),%esi
  xor    %edx,%edx
  test   %esi,%esi
  je     L273
  nopl   0x0(%rax)
L291:
  movzbl 0x0(%r13,%rdx,1),%eax
  shr    %al
  add    0x1(%rbx,%rdx,1),%al
  mov    %al,(%r12,%rdx,1)
  add    $0x1,%rdx
  cmp    %rsi,%rdx
  jne    L291
  add    %rdx,%rbp
  add    %rdx,%r13
  add    %r12,%rdx
L331:
  mov    0x28(%rsp),%ebx
  cmp    %ebx,0x4(%rsp)
  jbe    L46
  mov    0x3c(%rsp),%eax
  xor    %esi,%esi
  lea    -0x1(%rax),%edi
  nopl   0x0(%rax)
L407:
  movzbl 0x0(%r13,%rsi,1),%eax
  movzbl (%r12,%rsi,1),%ecx
  add    %ecx,%eax
  sar    %eax
  add    0x0(%rbp,%rsi,1),%al
  mov    %al,(%rdx,%rsi,1)
  mov    %rsi,%rax
  add    $0x1,%rsi
  cmp    %rax,%rdi
  jne    L407
  jmp    L46
  nopw   0x0(%rax,%rax,1)
L150:
  mov    0x28(%rsp),%esi
  xor    %eax,%eax
  test   %esi,%esi
  je     L287
  xchg   %ax,%ax
L155:
  movzbl 0x1(%rbx,%rax,1),%edx
  mov    %dl,(%r12,%rax,1)
  add    $0x1,%rax
  cmp    %rsi,%rax
  jne    L155
  add    %rax,%rbp
  add    %r12,%rax
L221:
  mov    0x28(%rsp),%esi
  cmp    %esi,0x4(%rsp)
  jbe    L46
  mov    0x3c(%rsp),%ebx
  xor    %edx,%edx
  lea    -0x1(%rbx),%edi
  nop
L64:
  movzbl (%r12,%rdx,1),%ecx
  add    0x0(%rbp,%rdx,1),%cl
  mov    %cl,(%rax,%rdx,1)
  mov    %rdx,%rcx
  add    $0x1,%rdx
  cmp    %rcx,%rdi
  jne    L64
  jmp    L46
  nopl   (%rax)
L336:
  mov    0x28(%rsp),%eax
  test   %eax,%eax
  je     L452
  mov    %eax,%edx
  xor    %eax,%eax
L21:
  movzbl 0x1(%rbx,%rax,1),%ecx
  mov    %cl,(%r12,%rax,1)
  add    $0x1,%rax
  cmp    %rax,%rdx
  jne    L21
  add    %rdx,%rbp
  lea    (%r12,%rdx,1),%rsi
L88:
  mov    0x28(%rsp),%ebx
  cmp    %ebx,0x4(%rsp)
  jbe    L46
  mov    0x3c(%rsp),%eax
  lea    -0x1(%rax),%edi
  xor    %eax,%eax
L293:
  movzbl (%r12,%rax,1),%edx
  shr    %dl
  add    0x0(%rbp,%rax,1),%dl
  mov    %dl,(%rsi,%rax,1)
  mov    %rax,%rdx
  add    $0x1,%rax
  cmp    %rdx,%rdi
  jne    L293
  jmp    L46
  nop
L30:
  mov    0x28(%rsp),%eax
  test   %eax,%eax
  je     L43
  add    0x48(%rsp),%rbx
  mov    %r12,%r14
  nopl   0x0(%rax)
L178:
  movzbl 0x0(%rbp),%r13d
  xor    %edx,%edx
  xor    %esi,%esi
  xor    %edi,%edi
  xor    %eax,%eax
  add    $0x1,%rbp
  add    $0x1,%r14
  call   <paeth@plt>
  add    %eax,%r13d
  mov    %r13b,-0x1(%r14)
  cmp    %rbp,%rbx
  jne    L178
  mov    0x28(%rsp),%r14d
  add    %r12,%r14
L32:
  mov    0x28(%rsp),%ecx
  cmp    %ecx,0x4(%rsp)
  jbe    L46
  mov    0x3c(%rsp),%eax
  xor    %ebp,%ebp
  lea    -0x1(%rax),%r15d
  xchg   %ax,%ax
L18:
  movzbl (%r12,%rbp,1),%edi
  movzbl (%rbx,%rbp,1),%r13d
  xor    %edx,%edx
  xor    %esi,%esi
  xor    %eax,%eax
  call   <paeth@plt>
  add    %eax,%r13d
  mov    %rbp,%rax
  mov    %r13b,(%r14,%rbp,1)
  add    $0x1,%rbp
  cmp    %r15,%rax
  jne    L18
  jmp    L46
  nopl   (%rax)
L26:
  mov    0x4(%rsp),%esi
  test   %esi,%esi
  je     L46
  mov    0x40(%rsp),%rcx
  xor    %eax,%eax
  nopl   0x0(%rax,%rax,1)
L19:
  movzbl 0x1(%rbx,%rax,1),%edx
  mov    %dl,(%r12,%rax,1)
  add    $0x1,%rax
  cmp    %rax,%rcx
  jne    L19
  jmp    L46
  nop
L287:
  mov    %r12,%rax
  jmp    L221
L187:
  mov    %r12,0x10(%rsp)
  mov    %r13,%r14
  jmp    L277
L273:
  mov    %r12,%rdx
  jmp    L331
L452:
  mov    %r12,%rsi
  jmp    L88
L43:
  mov    %r12,%r14
  mov    %rbp,%rbx
  jmp    L32
```

assistant: ```c
void png_predict(unsigned char *samples, unsigned int width, unsigned int height, unsigned int n, unsigned int depth) {
  unsigned int stride = (width * n * depth + 7) / 8;
  unsigned int bpp = (n * depth + 7) / 8;
  unsigned int i, row;
  for (row = 0; row < height; row++) {
    unsigned char *src = samples + (unsigned int)((stride + 1) * row);
    unsigned char *dst = samples + (unsigned int)(stride * row);
    unsigned char *a = dst;
    unsigned char *b = dst - stride;
    unsigned char *c = dst - stride;
    switch (*src++) {
    default:
    case 0:
      for (i = 0; i < stride; i++)
        *dst++ = *src++;
      break;
    case 1:
      for (i = 0; i < bpp; i++)
        *dst++ = *src++;
      for (i = bpp; i < stride; i++)
        *dst++ = *src++ + *a++;
      break;
    case 2:
      if (row == 0)
        for (i = 0; i < stride; i++)
          *dst++ = *src++;
      else
        for (i = 0; i < stride; i++)
          *dst++ = *src++ + *b++;
      break;
    case 3:
      if (row == 0) {
        for (i = 0; i < bpp; i++)
          *dst++ = *src++;
        for (i = bpp; i < stride; i++)
          *dst++ = *src++ + (*a++ >> 1);
      } else {
        for (i = 0; i < bpp; i++)
          *dst++ = *src++ + (*b++ >> 1);
        for (i = bpp; i < stride; i++)
          *dst++ = *src++ + ((*b++ + *a++) >> 1);
      }
      break;
    case 4:
      if (row == 0) {
        for (i = 0; i < bpp; i++)
          *dst++ = *src++ + paeth(0, 0, 0);
        for (i = bpp; i < stride; i++)
          *dst++ = *src++ + paeth(*a++, 0, 0);
      } else {
        for (i = 0; i < bpp; i++)
          *dst++ = *src++ + paeth(0, *b++, 0);
        for (i = bpp; i < stride; i++)
          *dst++ = *src++ + paeth(*a++, *b++, *c++);
      }
      break;
    }
  }
}
```