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

```asm
<inv_chk_img>:
  endbr64
  mov    %rdi,%rcx
  mov    %esi,%edx
  test   %esi,%esi
  jle    L16
  lea    -0x1(%rsi),%eax
  cmp    $0x6,%eax
  jbe    L78
  shr    $0x3,%esi
  movdqa D16(%rip),%xmm5
  mov    %rdi,%rax
  pxor   %xmm4,%xmm4
  sub    $0x1,%esi
  movdqa D8(%rip),%xmm3
  shl    $0x4,%rsi
  lea    0x10(%rdi,%rsi,1),%rsi
  nopl   0x0(%rax,%rax,1)
L62:
  movdqu (%rax),%xmm6
  movdqa %xmm5,%xmm1
  movdqa %xmm4,%xmm2
  add    $0x10,%rax
  psubw  %xmm6,%xmm1
  movdqa %xmm1,%xmm0
  pcmpgtw %xmm1,%xmm2
  pcmpgtw %xmm3,%xmm0
  pand   %xmm3,%xmm0
  pandn  %xmm0,%xmm2
  movdqa %xmm1,%xmm0
  psubusw %xmm3,%xmm0
  pcmpeqw %xmm4,%xmm0
  pand   %xmm0,%xmm1
  pandn  %xmm2,%xmm0
  por    %xmm1,%xmm0
  movups %xmm0,-0x10(%rax)
  cmp    %rsi,%rax
  jne    L62
  mov    %edx,%r8d
  and    $0xfffffff8,%r8d
  test   $0x7,%dl
  je     L1
L72:
  movslq %r8d,%rsi
  mov    $0x1000,%eax
  mov    $0x0,%r10d
  add    %rsi,%rsi
  mov    %eax,%edi
  lea    (%rcx,%rsi,1),%r9
  sub    (%r9),%di
  cmovs  %r10d,%edi
  mov    $0xfff,%r10d
  cmp    %r10w,%di
  cmovg  %r10d,%edi
  mov    %di,(%r9)
  lea    0x1(%r8),%edi
  cmp    %edi,%edx
  jle    L16
  lea    0x2(%rcx,%rsi,1),%r9
  mov    $0x0,%r10d
  mov    %eax,%edi
  sub    (%r9),%di
  cmovs  %r10d,%edi
  mov    $0xfff,%r10d
  cmp    %r10w,%di
  cmovg  %r10d,%edi
  mov    %di,(%r9)
  lea    0x2(%r8),%edi
  cmp    %edi,%edx
  jle    L16
  lea    0x4(%rcx,%rsi,1),%r9
  mov    $0x0,%r10d
  mov    %eax,%edi
  sub    (%r9),%di
  cmovs  %r10d,%edi
  mov    $0xfff,%r10d
  cmp    %r10w,%di
  cmovg  %r10d,%edi
  mov    %di,(%r9)
  lea    0x3(%r8),%edi
  cmp    %edi,%edx
  jle    L16
  lea    0x6(%rcx,%rsi,1),%r9
  mov    $0x0,%r10d
  mov    %eax,%edi
  sub    (%r9),%di
  cmovs  %r10d,%edi
  mov    $0xfff,%r10d
  cmp    %r10w,%di
  cmovg  %r10d,%edi
  mov    %di,(%r9)
  lea    0x4(%r8),%edi
  cmp    %edi,%edx
  jle    L16
  lea    0x8(%rcx,%rsi,1),%r9
  mov    $0x0,%r10d
  mov    %eax,%edi
  sub    (%r9),%di
  cmovs  %r10d,%edi
  mov    $0xfff,%r10d
  cmp    %r10w,%di
  cmovg  %r10d,%edi
  mov    %di,(%r9)
  lea    0x5(%r8),%edi
  cmp    %edi,%edx
  jle    L16
  lea    0xa(%rcx,%rsi,1),%r9
  mov    $0x0,%r10d
  mov    %eax,%edi
  sub    (%r9),%di
  cmovs  %r10d,%edi
  mov    $0xfff,%r10d
  cmp    %r10w,%di
  cmovg  %r10d,%edi
  add    $0x6,%r8d
  mov    %di,(%r9)
  cmp    %r8d,%edx
  jle    L16
  lea    0xc(%rcx,%rsi,1),%rdx
  mov    $0x0,%ecx
  sub    (%rdx),%ax
  cmovs  %ecx,%eax
  mov    $0xfff,%ecx
  cmp    %cx,%ax
  cmovg  %ecx,%eax
  mov    %ax,(%rdx)
L16:
  ret
  nopl   0x0(%rax)
L1:
  ret
L78:
  xor    %r8d,%r8d
  jmp    L72
```

tool_calls: name: retrieve_data
arguments: tag: D16
data_type: byte[16]
name: retrieve_data
arguments: tag: D8
data_type: byte[16]

tool: {"D16": [0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0x10]}

tool: {"D8": [0xff,0x0f,0xff,0x0f,0xff,0x0f,0xff,0x0f,0xff,0x0f,0xff,0x0f,0xff,0x0f,0xff,0x0f]}

assistant: ```c
void inv_chk_img(short int *src, int npix) {
  int i;
  short int tmp;
  for (i = 0; i < npix; ++i) {
    tmp = 4096 - src[i];
    if (tmp >= 4096)
      src[i] = 4096 - 1;
    else if (tmp < 0)
      src[i] = 0;
    else
      src[i] = tmp;
  }
}
```