user: Converte this assembly snippet into its equivalent C code:

```asm
<retrieve_facet>:
  endbr64
  push   %rbp
  mov    %esi,%eax
  mov    %rsp,%rbp
  push   %r13
  mov    %rdx,%r13
  push   %r12
  push   %rbx
  mov    %rcx,%rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rdx
  mov    %rdx,-0x28(%rbp)
  xor    %edx,%edx
  mov    %edi,-0x2c(%rbp)
  imul   $0x64,%edi,%edi
  mov    %rsp,%rdx
  movslq %edi,%rdi
  shl    $0x2,%rdi
  mov    %rdi,%rcx
  and    $0xfffffffffffff000,%rcx
  sub    %rcx,%rdx
  cmp    %rdx,%rsp
  je     L86
L33:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rdx,%rsp
  jne    L33
L86:
  and    $0xfff,%edi
  sub    %rdi,%rsp
  test   %rdi,%rdi
  jne    L4
L178:
  lea    0x3(%rsp),%r12
  xor    %ecx,%ecx
  lea    -0x2c(%rbp),%rsi
  mov    $0x247,%edi
  mov    %r12,%rdx
  and    $0xfffffffffffffffc,%r12
  shr    $0x2,%rdx
  mov    %eax,0x0(,%rdx,4)
  mov    %r12,%rdx
  call   <_ada_use_c2phc@plt>
  movslq -0x2c(%rbp),%rcx
  mov    %eax,%r8d
  mov    %ecx,0x0(%r13)
  test   %ecx,%ecx
  jle    L108
  lea    -0x1(%rcx),%eax
  cmp    $0xe,%eax
  jbe    L201
  mov    %ecx,%esi
  movdqa D9(%rip),%xmm3
  mov    %r12,%rax
  mov    %rbx,%rdx
  shr    $0x4,%esi
  shl    $0x6,%rsi
  add    %r12,%rsi
  nopl   0x0(%rax)
L200:
  movdqu (%rax),%xmm0
  movdqu 0x10(%rax),%xmm5
  add    $0x40,%rax
  add    $0x10,%rdx
  movdqu -0x10(%rax),%xmm7
  movdqa %xmm0,%xmm1
  punpcklwd %xmm5,%xmm0
  punpckhwd %xmm5,%xmm1
  movdqa %xmm0,%xmm2
  punpckhwd %xmm1,%xmm2
  punpcklwd %xmm1,%xmm0
  movdqu -0x20(%rax),%xmm1
  punpcklwd %xmm2,%xmm0
  movdqa %xmm1,%xmm2
  punpcklwd %xmm7,%xmm1
  pand   %xmm3,%xmm0
  punpckhwd %xmm7,%xmm2
  movdqa %xmm1,%xmm4
  punpckhwd %xmm2,%xmm4
  punpcklwd %xmm2,%xmm1
  punpcklwd %xmm4,%xmm1
  pand   %xmm3,%xmm1
  packuswb %xmm1,%xmm0
  movups %xmm0,-0x10(%rdx)
  cmp    %rsi,%rax
  jne    L200
  mov    %ecx,%eax
  and    $0xfffffff0,%eax
  test   $0xf,%cl
  je     L108
L35:
  movslq %eax,%rsi
  lea    (%r12,%rsi,4),%rdx
  mov    (%rdx),%edi
  mov    %dil,(%rbx,%rsi,1)
  lea    0x1(%rax),%esi
  cmp    %esi,%ecx
  jle    L108
  mov    0x4(%rdx),%edi
  movslq %esi,%rsi
  mov    %dil,(%rbx,%rsi,1)
  lea    0x2(%rax),%esi
  cmp    %esi,%ecx
  jle    L108
  mov    0x8(%rdx),%edi
  movslq %esi,%rsi
  mov    %dil,(%rbx,%rsi,1)
  lea    0x3(%rax),%esi
  cmp    %esi,%ecx
  jle    L108
  mov    0xc(%rdx),%edi
  movslq %esi,%rsi
  mov    %dil,(%rbx,%rsi,1)
  lea    0x4(%rax),%esi
  cmp    %esi,%ecx
  jle    L108
  mov    0x10(%rdx),%edi
  movslq %esi,%rsi
  mov    %dil,(%rbx,%rsi,1)
  lea    0x5(%rax),%esi
  cmp    %esi,%ecx
  jle    L108
  mov    0x14(%rdx),%edi
  movslq %esi,%rsi
  mov    %dil,(%rbx,%rsi,1)
  lea    0x6(%rax),%esi
  cmp    %esi,%ecx
  jle    L108
  mov    0x18(%rdx),%edi
  movslq %esi,%rsi
  mov    %dil,(%rbx,%rsi,1)
  lea    0x7(%rax),%esi
  cmp    %esi,%ecx
  jle    L108
  mov    0x1c(%rdx),%edi
  movslq %esi,%rsi
  mov    %dil,(%rbx,%rsi,1)
  lea    0x8(%rax),%esi
  cmp    %esi,%ecx
  jle    L108
  mov    0x20(%rdx),%edi
  movslq %esi,%rsi
  mov    %dil,(%rbx,%rsi,1)
  lea    0x9(%rax),%esi
  cmp    %esi,%ecx
  jle    L108
  mov    0x24(%rdx),%edi
  movslq %esi,%rsi
  mov    %dil,(%rbx,%rsi,1)
  lea    0xa(%rax),%esi
  cmp    %esi,%ecx
  jle    L108
  mov    0x28(%rdx),%edi
  movslq %esi,%rsi
  mov    %dil,(%rbx,%rsi,1)
  lea    0xb(%rax),%esi
  cmp    %esi,%ecx
  jle    L108
  mov    0x2c(%rdx),%edi
  movslq %esi,%rsi
  mov    %dil,(%rbx,%rsi,1)
  lea    0xc(%rax),%esi
  cmp    %esi,%ecx
  jle    L108
  mov    0x30(%rdx),%edi
  movslq %esi,%rsi
  mov    %dil,(%rbx,%rsi,1)
  lea    0xd(%rax),%esi
  cmp    %esi,%ecx
  jle    L108
  mov    0x34(%rdx),%edi
  movslq %esi,%rsi
  add    $0xe,%eax
  mov    %dil,(%rbx,%rsi,1)
  cmp    %eax,%ecx
  jle    L108
  mov    0x38(%rdx),%edx
  cltq
  mov    %dl,(%rbx,%rax,1)
  nopl   0x0(%rax,%rax,1)
L108:
  movb   $0x0,(%rbx,%rcx,1)
  mov    -0x28(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L41
  lea    -0x18(%rbp),%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %rbp
  ret
  nopl   0x0(%rax)
L4:
  orq    $0x0,-0x8(%rsp,%rdi,1)
  jmp    L178
L201:
  xor    %eax,%eax
  jmp    L35
L41:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: tag: D9
type_guessed: byte[16]

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

assistant: ```c
int retrieve_facet(int dim, int fcn, int *nc_rep, char *fctrep) {
  int fail, k;
  int a = dim;
  int b[100 * dim];
  double *c;
  b[0] = fcn;
  fail = _ada_use_c2phc(583, &a, b, c);
  *nc_rep = a;
  for (k = 0; k < a; k++)
    fctrep[k] = (char)b[k];
  fctrep[a] = '\0';
  return fail;
}
```