user: 请将以下的汇编代码转换成C语言代码：

```asm
<mag_img>:
  endbr64
  mov    %rdx,%r8
  mov    %ecx,%edx
  test   %edx,%edx
  jle    L6
  lea    0x2(%rsi),%rcx
  mov    %r8,%rax
  sub    %rcx,%rax
  cmp    $0xc,%rax
  lea    -0x1(%rdx),%eax
  seta   %cl
  cmp    $0x6,%eax
  seta   %al
  test   %al,%cl
  je     L97
  lea    0x2(%rdi),%rcx
  mov    %r8,%rax
  sub    %rcx,%rax
  cmp    $0xc,%rax
  jbe    L97
  mov    %edx,%ecx
  movdqa D5(%rip),%xmm4
  xor    %eax,%eax
  pxor   %xmm5,%xmm5
  shr    $0x3,%ecx
  shl    $0x4,%rcx
  xchg   %ax,%ax
L60:
  movdqu (%rdi,%rax,1),%xmm2
  movdqu (%rsi,%rax,1),%xmm1
  movdqa %xmm5,%xmm7
  movdqa %xmm5,%xmm6
  movdqa %xmm4,%xmm8
  pcmpgtw %xmm2,%xmm7
  pcmpgtw %xmm1,%xmm6
  movdqa %xmm2,%xmm0
  movdqa %xmm1,%xmm3
  punpcklwd %xmm7,%xmm0
  punpcklwd %xmm6,%xmm3
  punpckhwd %xmm7,%xmm2
  paddd  %xmm0,%xmm3
  punpckhwd %xmm6,%xmm1
  paddd  %xmm2,%xmm1
  movdqa %xmm3,%xmm0
  pcmpgtd %xmm4,%xmm0
  movdqa %xmm1,%xmm2
  pcmpgtd %xmm4,%xmm2
  pand   %xmm0,%xmm8
  pandn  %xmm3,%xmm0
  movdqa %xmm4,%xmm3
  pand   %xmm2,%xmm3
  pandn  %xmm1,%xmm2
  por    %xmm8,%xmm0
  movdqa %xmm2,%xmm1
  movdqa %xmm0,%xmm2
  por    %xmm3,%xmm1
  punpcklwd %xmm1,%xmm0
  punpckhwd %xmm1,%xmm2
  movdqa %xmm0,%xmm1
  punpcklwd %xmm2,%xmm0
  punpckhwd %xmm2,%xmm1
  punpcklwd %xmm1,%xmm0
  movups %xmm0,(%r8,%rax,1)
  add    $0x10,%rax
  cmp    %rcx,%rax
  jne    L60
  mov    %edx,%ecx
  and    $0xfffffff8,%ecx
  mov    %ecx,%eax
  add    %rax,%rax
  add    %rax,%rdi
  add    %rax,%rsi
  add    %r8,%rax
  cmp    %ecx,%edx
  je     L6
  movswl (%rsi),%r9d
  movswl (%rdi),%r8d
  add    %r9d,%r8d
  mov    $0xfff,%r9d
  cmp    %r9d,%r8d
  cmovg  %r9d,%r8d
  mov    %r8w,(%rax)
  lea    0x1(%rcx),%r8d
  cmp    %r8d,%edx
  jle    L6
  movswl 0x2(%rsi),%r9d
  movswl 0x2(%rdi),%r8d
  add    %r9d,%r8d
  mov    $0xfff,%r9d
  cmp    %r9d,%r8d
  cmovg  %r9d,%r8d
  mov    %r8w,0x2(%rax)
  lea    0x2(%rcx),%r8d
  cmp    %r8d,%edx
  jle    L6
  movswl 0x4(%rsi),%r9d
  movswl 0x4(%rdi),%r8d
  add    %r9d,%r8d
  mov    $0xfff,%r9d
  cmp    %r9d,%r8d
  cmovg  %r9d,%r8d
  mov    %r8w,0x4(%rax)
  lea    0x3(%rcx),%r8d
  cmp    %r8d,%edx
  jle    L6
  movswl 0x6(%rsi),%r9d
  movswl 0x6(%rdi),%r8d
  add    %r9d,%r8d
  mov    $0xfff,%r9d
  cmp    %r9d,%r8d
  cmovg  %r9d,%r8d
  mov    %r8w,0x6(%rax)
  lea    0x4(%rcx),%r8d
  cmp    %r8d,%edx
  jle    L6
  movswl 0x8(%rsi),%r9d
  movswl 0x8(%rdi),%r8d
  add    %r9d,%r8d
  mov    $0xfff,%r9d
  cmp    %r9d,%r8d
  cmovg  %r9d,%r8d
  mov    %r8w,0x8(%rax)
  lea    0x5(%rcx),%r8d
  cmp    %r8d,%edx
  jle    L6
  movswl 0xa(%rsi),%r9d
  movswl 0xa(%rdi),%r8d
  add    %r9d,%r8d
  mov    $0xfff,%r9d
  cmp    %r9d,%r8d
  cmovg  %r9d,%r8d
  add    $0x6,%ecx
  mov    %r8w,0xa(%rax)
  cmp    %ecx,%edx
  jle    L6
  movswl 0xc(%rsi),%ecx
  movswl 0xc(%rdi),%edx
  add    %ecx,%edx
  mov    $0xfff,%ecx
  cmp    %ecx,%edx
  cmovg  %ecx,%edx
  mov    %dx,0xc(%rax)
  ret
  xchg   %ax,%ax
L97:
  xor    %ecx,%ecx
  nopw   0x0(%rax,%rax,1)
L35:
  movswl (%rsi,%rcx,2),%r9d
  movswl (%rdi,%rcx,2),%eax
  add    %r9d,%eax
  mov    $0xfff,%r9d
  cmp    %r9d,%eax
  cmovg  %r9d,%eax
  mov    %ax,(%r8,%rcx,2)
  add    $0x1,%rcx
  cmp    %rcx,%rdx
  jne    L35
L6:
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D5
data_type: byte[16]

tool: {"D5": [0xff,0x0f,0x00,0x00,0xff,0x0f,0x00,0x00,0xff,0x0f,0x00,0x00,0xff,0x0f,0x00,0x00]}

assistant: ```c
void mag_img(short int *srcx, short int *srcy, short int *dst, int npix) {
  int i, res;
  for (i = 0; i < npix; ++i) {
    res = *srcx + *srcy;
    if (res > 4096 - 1)
      *dst = 4096 - 1;
    else
      *dst = res;
    dst++;
    srcx++;
    srcy++;
  }
}
```