user: Please show me the C implementation that matches the assembly code listed below:

```asm
<decode_block2>:
  endbr64
  test   %esi,%esi
  je     L68
  push   %r13
  lea    -0x2(%rsi),%eax
  mov    %rdx,%r8
  xor    %r9d,%r9d
  push   %r12
  lea    0x2(%rdi,%rax,1),%rsi
  pxor   %xmm7,%xmm7
  pxor   %xmm5,%xmm5
  push   %rbp
  push   %rbx
  sub    $0x350,%rsp
  movdqa D2(%rip),%xmm6
  jmp    L122
  nopl   0x0(%rax)
L80:
  mov    %eax,%edx
  mov    %eax,%ecx
  add    $0x4,%r8
  add    $0x4,%r9d
  and    $0x7800,%edx
  and    $0x780,%ecx
  shl    $0x11,%edx
  shl    $0xd,%ecx
  or     %edx,%ecx
  mov    %eax,%edx
  and    $0x7,%eax
  and    $0x78,%edx
  shl    $0x5,%eax
  shl    $0x9,%edx
  or     %ecx,%edx
  or     %edx,%eax
  bswap  %eax
  mov    %eax,-0x4(%r8)
L93:
  cmp    %rsi,%rdi
  je     L39
L122:
  movzbl (%rdi),%eax
  movzbl 0x1(%rdi),%edx
  add    $0x2,%rdi
  shl    $0x8,%eax
  add    %dx,%ax
  jns    L80
  mov    %eax,%ecx
  mov    %eax,%ebp
  mov    %r8,%rdx
  shr    $0x4,%cx
  and    $0x1f,%ebp
  and    $0x7fe,%ecx
  mov    %rcx,%r11
  sub    %rcx,%rdx
  neg    %r11
  and    $0x1f,%ax
  mov    %eax,%r10d
  je     L93
  lea    -0x1(%rbp),%r12d
  cmp    $0xffffffffffffffc0,%r11
  ja     L42
  cmp    $0xe,%r12d
  jbe    L42
  mov    %r8,%rax
  mov    %rdx,%rcx
  nopl   0x0(%rax,%rax,1)
L121:
  movdqu (%rcx),%xmm9
  movdqu (%rcx),%xmm1
  mov    %rcx,%r11
  add    $0x40,%rax
  movdqu 0x10(%rcx),%xmm0
  movdqu 0x30(%rcx),%xmm2
  movdqa %xmm6,%xmm8
  movdqa %xmm6,%xmm10
  pand   %xmm6,%xmm9
  psrlw  $0x8,%xmm1
  movdqu 0x30(%rcx),%xmm3
  add    $0x40,%rcx
  pand   %xmm6,%xmm0
  pand   %xmm6,%xmm2
  packuswb %xmm0,%xmm9
  movdqu -0x30(%rcx),%xmm0
  psrlw  $0x8,%xmm3
  pand   %xmm9,%xmm8
  psrlw  $0x8,%xmm9
  psrlw  $0x8,%xmm0
  packuswb %xmm0,%xmm1
  movdqu -0x20(%rcx),%xmm0
  pand   %xmm1,%xmm10
  psrlw  $0x8,%xmm1
  pand   %xmm6,%xmm0
  packuswb %xmm2,%xmm0
  movdqu -0x20(%rcx),%xmm2
  psrlw  $0x8,%xmm2
  packuswb %xmm3,%xmm2
  movdqa %xmm6,%xmm3
  pand   %xmm0,%xmm3
  psrlw  $0x8,%xmm0
  packuswb %xmm0,%xmm9
  movdqa %xmm6,%xmm0
  packuswb %xmm3,%xmm8
  pand   %xmm2,%xmm0
  movdqa %xmm8,%xmm3
  movdqa %xmm9,%xmm4
  packuswb %xmm0,%xmm10
  punpcklbw %xmm7,%xmm3
  punpcklbw %xmm7,%xmm4
  movdqa %xmm10,%xmm11
  movdqa %xmm3,%xmm0
  punpckhwd %xmm5,%xmm3
  punpcklbw %xmm7,%xmm11
  psrlw  $0x8,%xmm2
  punpcklwd %xmm5,%xmm0
  movdqa %xmm11,%xmm12
  packuswb %xmm2,%xmm1
  punpckhwd %xmm5,%xmm11
  punpcklwd %xmm5,%xmm12
  psllw  $0x8,%xmm4
  movdqa %xmm1,%xmm2
  pslld  $0x10,%xmm12
  pslld  $0x18,%xmm0
  punpcklbw %xmm7,%xmm2
  paddd  %xmm12,%xmm0
  pslld  $0x10,%xmm11
  movdqa %xmm4,%xmm12
  pslld  $0x18,%xmm3
  punpcklwd %xmm5,%xmm12
  punpckhwd %xmm5,%xmm4
  paddd  %xmm11,%xmm3
  punpckhbw %xmm7,%xmm8
  punpckhbw %xmm7,%xmm10
  paddd  %xmm12,%xmm0
  paddd  %xmm4,%xmm3
  movdqa %xmm2,%xmm12
  punpckhwd %xmm5,%xmm2
  movdqa %xmm10,%xmm4
  punpckhbw %xmm7,%xmm9
  paddd  %xmm2,%xmm3
  movdqa %xmm8,%xmm2
  punpcklwd %xmm5,%xmm4
  punpcklwd %xmm5,%xmm2
  psllw  $0x8,%xmm9
  punpckhbw %xmm7,%xmm1
  pslld  $0x10,%xmm4
  pslld  $0x18,%xmm2
  punpckhwd %xmm5,%xmm8
  paddd  %xmm4,%xmm2
  movdqa %xmm9,%xmm4
  punpckhwd %xmm5,%xmm10
  punpcklwd %xmm5,%xmm4
  punpcklwd %xmm5,%xmm12
  punpckhwd %xmm5,%xmm9
  paddd  %xmm4,%xmm2
  pslld  $0x10,%xmm10
  movdqa %xmm1,%xmm4
  pslld  $0x18,%xmm8
  paddd  %xmm12,%xmm0
  punpcklwd %xmm5,%xmm4
  paddd  %xmm10,%xmm8
  paddd  %xmm2,%xmm4
  movdqa %xmm0,%xmm2
  paddd  %xmm9,%xmm8
  movdqa %xmm3,%xmm9
  punpckhwd %xmm5,%xmm1
  psrld  $0x18,%xmm9
  psrld  $0x18,%xmm2
  paddd  %xmm1,%xmm8
  movdqa %xmm2,%xmm1
  punpcklwd %xmm9,%xmm2
  movdqa %xmm8,%xmm10
  punpckhwd %xmm9,%xmm1
  movdqa %xmm2,%xmm9
  movdqa %xmm8,%xmm11
  punpckhwd %xmm1,%xmm9
  psrld  $0x18,%xmm10
  punpcklwd %xmm1,%xmm2
  movdqa %xmm4,%xmm1
  psrld  $0x10,%xmm11
  punpcklwd %xmm9,%xmm2
  psrld  $0x18,%xmm1
  pand   %xmm6,%xmm2
  movdqa %xmm1,%xmm9
  punpcklwd %xmm10,%xmm1
  punpckhwd %xmm10,%xmm9
  movdqa %xmm1,%xmm10
  punpckhwd %xmm9,%xmm10
  punpcklwd %xmm9,%xmm1
  punpcklwd %xmm10,%xmm1
  movdqa %xmm3,%xmm10
  pand   %xmm6,%xmm1
  psrld  $0x10,%xmm10
  packuswb %xmm1,%xmm2
  movdqa %xmm0,%xmm1
  movd   %xmm2,%ebx
  psrld  $0x10,%xmm1
  mov    %bl,-0x40(%rax)
  movdqa %xmm1,%xmm9
  punpcklwd %xmm10,%xmm1
  movaps %xmm2,0x338(%rsp)
  movzbl 0x339(%rsp),%ebx
  punpckhwd %xmm10,%xmm9
  movdqa %xmm1,%xmm10
  punpckhwd %xmm9,%xmm10
  punpcklwd %xmm9,%xmm1
  movdqa %xmm4,%xmm9
  mov    %bl,-0x3c(%rax)
  psrld  $0x10,%xmm9
  punpcklwd %xmm10,%xmm1
  movaps %xmm2,0x328(%rsp)
  movzbl 0x32a(%rsp),%ebx
  movdqa %xmm9,%xmm10
  pand   %xmm6,%xmm1
  punpcklwd %xmm11,%xmm9
  punpckhwd %xmm11,%xmm10
  mov    %bl,-0x38(%rax)
  movdqa %xmm9,%xmm11
  punpcklwd %xmm10,%xmm9
  movaps %xmm2,0x318(%rsp)
  movzbl 0x31b(%rsp),%ebx
  punpckhwd %xmm10,%xmm11
  punpcklwd %xmm11,%xmm9
  mov    %bl,-0x34(%rax)
  pand   %xmm6,%xmm9
  movaps %xmm2,0x308(%rsp)
  movzbl 0x30c(%rsp),%ebx
  packuswb %xmm9,%xmm1
  mov    %bl,-0x30(%rax)
  movaps %xmm2,0x2f8(%rsp)
  movzbl 0x2fd(%rsp),%ebx
  mov    %bl,-0x2c(%rax)
  movaps %xmm2,0x2e8(%rsp)
  movzbl 0x2ee(%rsp),%ebx
  mov    %bl,-0x28(%rax)
  movaps %xmm2,0x2d8(%rsp)
  movzbl 0x2df(%rsp),%ebx
  mov    %bl,-0x24(%rax)
  movaps %xmm2,0x2c8(%rsp)
  movzbl 0x2d0(%rsp),%ebx
  mov    %bl,-0x20(%rax)
  movaps %xmm2,0x2b8(%rsp)
  movzbl 0x2c1(%rsp),%ebx
  mov    %bl,-0x1c(%rax)
  movaps %xmm2,0x2a8(%rsp)
  movzbl 0x2b2(%rsp),%ebx
  mov    %bl,-0x18(%rax)
  movaps %xmm2,0x298(%rsp)
  movzbl 0x2a3(%rsp),%ebx
  mov    %bl,-0x14(%rax)
  movaps %xmm2,0x288(%rsp)
  movzbl 0x294(%rsp),%ebx
  mov    %bl,-0x10(%rax)
  movaps %xmm2,0x278(%rsp)
  movzbl 0x285(%rsp),%ebx
  mov    %bl,-0xc(%rax)
  movaps %xmm2,0x268(%rsp)
  movzbl 0x276(%rsp),%ebx
  mov    %bl,-0x8(%rax)
  movaps %xmm2,0x258(%rsp)
  movzbl 0x267(%rsp),%ebx
  mov    %bl,-0x4(%rax)
  movd   %xmm1,%ebx
  mov    %bl,-0x3f(%rax)
  movaps %xmm1,0x248(%rsp)
  movzbl 0x249(%rsp),%ebx
  mov    %bl,-0x3b(%rax)
  movaps %xmm1,0x238(%rsp)
  movzbl 0x23a(%rsp),%ebx
  mov    %bl,-0x37(%rax)
  movaps %xmm1,0x228(%rsp)
  movzbl 0x22b(%rsp),%ebx
  mov    %bl,-0x33(%rax)
  movaps %xmm1,0x218(%rsp)
  movzbl 0x21c(%rsp),%ebx
  mov    %bl,-0x2f(%rax)
  movaps %xmm1,0x208(%rsp)
  movzbl 0x20d(%rsp),%ebx
  mov    %bl,-0x2b(%rax)
  movaps %xmm1,0x1f8(%rsp)
  movzbl 0x1fe(%rsp),%ebx
  mov    %bl,-0x27(%rax)
  movaps %xmm1,0x1e8(%rsp)
  movzbl 0x1ef(%rsp),%ebx
  mov    %bl,-0x23(%rax)
  movaps %xmm1,0x1d8(%rsp)
  movzbl 0x1e0(%rsp),%ebx
  mov    %bl,-0x1f(%rax)
  movaps %xmm1,0x1c8(%rsp)
  movzbl 0x1d1(%rsp),%ebx
  mov    %bl,-0x1b(%rax)
  movaps %xmm1,0x1b8(%rsp)
  movzbl 0x1c2(%rsp),%ebx
  mov    %bl,-0x17(%rax)
  movaps %xmm1,0x1a8(%rsp)
  movzbl 0x1b3(%rsp),%ebx
  mov    %bl,-0x13(%rax)
  movaps %xmm1,0x198(%rsp)
  movzbl 0x1a4(%rsp),%ebx
  mov    %bl,-0xf(%rax)
  movaps %xmm1,0x188(%rsp)
  movzbl 0x195(%rsp),%ebx
  mov    %bl,-0xb(%rax)
  movaps %xmm1,0x178(%rsp)
  movzbl 0x186(%rsp),%ebx
  mov    %bl,-0x7(%rax)
  movaps %xmm1,0x168(%rsp)
  movdqa %xmm0,%xmm1
  punpcklwd %xmm3,%xmm0
  movzbl 0x177(%rsp),%ebx
  punpckhwd %xmm3,%xmm1
  movdqa %xmm0,%xmm2
  movdqa %xmm4,%xmm3
  punpckhwd %xmm1,%xmm2
  punpcklwd %xmm1,%xmm0
  punpckhwd %xmm8,%xmm3
  mov    %bl,-0x3(%rax)
  punpcklwd %xmm2,%xmm0
  movdqa %xmm4,%xmm2
  punpcklwd %xmm8,%xmm2
  movdqa %xmm0,%xmm1
  pand   %xmm6,%xmm0
  movdqa %xmm2,%xmm4
  psrlw  $0x8,%xmm1
  punpcklwd %xmm3,%xmm2
  punpckhwd %xmm3,%xmm4
  pand   %xmm6,%xmm1
  punpcklwd %xmm4,%xmm2
  movdqa %xmm2,%xmm3
  pand   %xmm6,%xmm2
  psrlw  $0x8,%xmm3
  packuswb %xmm2,%xmm0
  pand   %xmm6,%xmm3
  packuswb %xmm3,%xmm1
  movd   %xmm1,%ebx
  mov    %bl,-0x3e(%rax)
  movaps %xmm1,0x158(%rsp)
  movzbl 0x159(%rsp),%ebx
  mov    %bl,-0x3a(%rax)
  movaps %xmm1,0x148(%rsp)
  movzbl 0x14a(%rsp),%ebx
  mov    %bl,-0x36(%rax)
  movaps %xmm1,0x138(%rsp)
  movzbl 0x13b(%rsp),%ebx
  mov    %bl,-0x32(%rax)
  movaps %xmm1,0x128(%rsp)
  movzbl 0x12c(%rsp),%ebx
  mov    %bl,-0x2e(%rax)
  movaps %xmm1,0x118(%rsp)
  movzbl 0x11d(%rsp),%ebx
  mov    %bl,-0x2a(%rax)
  movaps %xmm1,0x108(%rsp)
  movzbl 0x10e(%rsp),%ebx
  mov    %bl,-0x26(%rax)
  movaps %xmm1,0xf8(%rsp)
  movzbl 0xff(%rsp),%ebx
  mov    %bl,-0x22(%rax)
  movaps %xmm1,0xe8(%rsp)
  movzbl 0xf0(%rsp),%ebx
  mov    %bl,-0x1e(%rax)
  movaps %xmm1,0xd8(%rsp)
  movzbl 0xe1(%rsp),%ebx
  mov    %bl,-0x1a(%rax)
  movaps %xmm1,0xc8(%rsp)
  movzbl 0xd2(%rsp),%ebx
  mov    %bl,-0x16(%rax)
  movaps %xmm1,0xb8(%rsp)
  movzbl 0xc3(%rsp),%ebx
  mov    %bl,-0x12(%rax)
  movaps %xmm1,0xa8(%rsp)
  movzbl 0xb4(%rsp),%ebx
  mov    %bl,-0xe(%rax)
  movaps %xmm1,0x98(%rsp)
  movzbl 0xa5(%rsp),%ebx
  mov    %bl,-0xa(%rax)
  movaps %xmm1,0x88(%rsp)
  movzbl 0x96(%rsp),%ebx
  mov    %bl,-0x6(%rax)
  movaps %xmm1,0x78(%rsp)
  movzbl 0x87(%rsp),%ebx
  mov    %bl,-0x2(%rax)
  movd   %xmm0,%ebx
  mov    %bl,-0x3d(%rax)
  movaps %xmm0,0x68(%rsp)
  movzbl 0x69(%rsp),%ebx
  mov    %bl,-0x39(%rax)
  movaps %xmm0,0x58(%rsp)
  movzbl 0x5a(%rsp),%ebx
  mov    %bl,-0x35(%rax)
  movaps %xmm0,0x48(%rsp)
  movzbl 0x4b(%rsp),%ebx
  mov    %bl,-0x31(%rax)
  movaps %xmm0,0x38(%rsp)
  movzbl 0x3c(%rsp),%ebx
  mov    %bl,-0x2d(%rax)
  movaps %xmm0,0x28(%rsp)
  movzbl 0x2d(%rsp),%ebx
  mov    %bl,-0x29(%rax)
  movaps %xmm0,0x18(%rsp)
  movzbl 0x1e(%rsp),%ebx
  mov    %bl,-0x25(%rax)
  movaps %xmm0,0x8(%rsp)
  movzbl 0xf(%rsp),%ebx
  mov    %bl,-0x21(%rax)
  movaps %xmm0,-0x8(%rsp)
  movzbl (%rsp),%ebx
  mov    %bl,-0x1d(%rax)
  movaps %xmm0,-0x18(%rsp)
  movzbl -0xf(%rsp),%ebx
  mov    %bl,-0x19(%rax)
  movaps %xmm0,-0x28(%rsp)
  movzbl -0x1e(%rsp),%ebx
  mov    %bl,-0x15(%rax)
  movaps %xmm0,-0x38(%rsp)
  movzbl -0x2d(%rsp),%ebx
  mov    %bl,-0x11(%rax)
  movaps %xmm0,-0x48(%rsp)
  movzbl -0x3c(%rsp),%ebx
  mov    %bl,-0xd(%rax)
  movaps %xmm0,-0x58(%rsp)
  movzbl -0x4b(%rsp),%ebx
  mov    %bl,-0x9(%rax)
  movaps %xmm0,-0x68(%rsp)
  movzbl -0x5a(%rsp),%ebx
  mov    %bl,-0x5(%rax)
  movaps %xmm0,-0x78(%rsp)
  movzbl -0x69(%rsp),%ebx
  mov    %bl,-0x1(%rax)
  cmp    %rdx,%r11
  jne    L121
  lea    0x40(%r8),%rcx
  add    $0x40,%rdx
  cmp    $0x10,%ebp
  je     L32
  lea    -0x10(%rbp),%eax
  lea    (%rdx,%rax,4),%r13
  nopl   0x0(%rax,%rax,1)
L102:
  movzbl 0x1(%rdx),%ebx
  movzbl 0x3(%rdx),%eax
  add    $0x4,%rdx
  add    $0x4,%rcx
  movzbl -0x2(%rdx),%r11d
  movzbl -0x4(%rdx),%ebp
  mov    %bl,-0x3(%rcx)
  mov    %bpl,-0x4(%rcx)
  mov    %r11b,-0x2(%rcx)
  mov    %al,-0x1(%rcx)
  cmp    %r13,%rdx
  jne    L102
L32:
  movzwl %r10w,%eax
L110:
  lea    (%r8,%rax,4),%r8
  lea    0x4(%r9,%r12,4),%r9d
  cmp    %rsi,%rdi
  jne    L122
L39:
  add    $0x350,%rsp
  mov    %r9d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax,%rax,1)
L42:
  movzwl %r10w,%eax
  mov    %r8,%rcx
  lea    (%rdx,%rax,4),%r13
  nopl   0x0(%rax,%rax,1)
L118:
  movzbl 0x1(%rdx),%ebx
  movzbl (%rdx),%ebp
  add    $0x4,%rdx
  add    $0x4,%rcx
  movzbl -0x2(%rdx),%r11d
  movzbl -0x1(%rdx),%r10d
  mov    %bpl,-0x4(%rcx)
  mov    %bl,-0x3(%rcx)
  mov    %r11b,-0x2(%rcx)
  mov    %r10b,-0x1(%rcx)
  cmp    %r13,%rdx
  jne    L118
  jmp    L110
L68:
  xor    %eax,%eax
  ret
```

tool_calls: name: parse_data
arguments: data_label: D2
data_type: byte[16]

tool: {"D2": [0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00]}

assistant: ```c
int decode_block2(unsigned char *in, int length, unsigned char *out) {
  unsigned char *look;
  unsigned short t0;
  unsigned int t1, t2, t3;
  int len = 0;
  while (length != 0) {
    t0 = (((in)[0] << 8) + ((in)[1]));
    in += 2;
    if ((t0 & 0x8000) == 0) {
      t1 = t0 & 0x7800;
      t2 = t0 & 0x0780;
      t1 <<= 17;
      t2 <<= 13;
      t1 |= t2;
      t2 = t0 & 0x78;
      t2 <<= 9;
      t1 |= t2;
      t2 = t0 & 7;
      t2 <<= 5;
      t1 |= t2;
      do {
        (out)[0] = ((t1) >> 24) & 0xFF;
        (out)[1] = ((t1) >> 16) & 0xFF;
        (out)[2] = ((t1) >> 8) & 0xFF;
        (out)[3] = (t1)&0xFF;
      } while (0);
      out += 4;
      length -= 2;
      len += 4;
    } else {
      t1 = t0 & 0x1f;
      t0 &= 0x7FE0;
      t0 >>= 4;
      length -= 2;
      look = out - t0;
      while (t1 != 0) {
        t3 = (unsigned int)(((look)[0] << 24) + ((look)[1] << 16) + ((look)[2] << 8) + ((look)[3]));
        do {
          (out)[0] = ((t3) >> 24) & 0xFF;
          (out)[1] = ((t3) >> 16) & 0xFF;
          (out)[2] = ((t3) >> 8) & 0xFF;
          (out)[3] = (t3)&0xFF;
        } while (0);
        look += 4;
        t1 -= 1;
        out += 4;
        len += 4;
      }
    }
  }
  return len;
}
```