user: Translate the below assembly code into C programming language:

```asm
<ars_d_firstfield_off>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  mov    %rdx,%r15
  push   %r14
  push   %r13
  mov    %rdi,%r13
  mov    %rsi,%rdi
  push   %r12
  push   %rbx
  sub    $0x58,%rsp
  mov    %rcx,-0x68(%rbp)
  mov    %r8,-0x70(%rbp)
  mov    %r9,-0x78(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  mov    %rsi,-0x58(%rbp)
  call   <strlen@plt>
  mov    %r15,%rdi
  mov    %eax,%ebx
  call   <strlen@plt>
  mov    %r13,%rdi
  mov    %eax,%r12d
  call   <strlen@plt>
  lea    0x3(%rbx),%edi
  mov    %eax,-0x4c(%rbp)
  call   <alloca@plt>
  lea    0x3(%r12),%edi
  mov    %rax,%r14
  call   <alloca@plt>
  movb   $0x2b,(%r14)
  lea    0x1(%r14),%r9
  mov    %ebx,%edx
  mov    -0x58(%rbp),%rsi
  mov    %r9,%rdi
  mov    %r9,-0x58(%rbp)
  mov    %rax,-0x48(%rbp)
  call   <memcpy@plt>
  movslq %ebx,%rax
  lea    0x1(%rbx),%edx
  cmp    -0x4c(%rbp),%edx
  lea    0x1(%rax),%rcx
  movb   $0x28,0x1(%r14,%rax,1)
  mov    -0x58(%rbp),%r9
  mov    %rcx,-0x60(%rbp)
  movb   $0x0,0x2(%r14,%rax,1)
  jl     L162
L80:
  xor    %eax,%eax
L139:
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  jne    L84
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
  nopl   0x0(%rax)
L162:
  mov    %r9,%rsi
  mov    %r13,%rdi
  call   <memcmp@plt>
  test   %rax,%rax
  je     L64
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L80
  lea    0x1(%rax),%rbx
L7:
  mov    -0x48(%rbp),%rax
  mov    %r12d,%edx
  mov    %r15,%rsi
  movb   $0x2c,(%rax)
  lea    0x1(%rax),%r8
  mov    %r8,%rdi
  mov    %r8,-0x58(%rbp)
  call   <memcpy@plt>
  mov    -0x60(%rbp),%r15
  mov    -0x48(%rbp),%rcx
  movslq %r12d,%rax
  lea    0x1(%rax),%r14
  add    $0x1,%r12d
  add    %rbx,%r15
  movb   $0x3d,0x1(%rcx,%rax,1)
  movb   $0x0,0x2(%rcx,%rax,1)
  mov    %r15,%rdx
  mov    -0x4c(%rbp),%eax
  sub    %r13,%rdx
  sub    %edx,%eax
  cmp    %eax,%r12d
  jge    L80
  mov    $0x29,%esi
  mov    %r15,%rdi
  call   <strchr@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L80
  mov    -0x58(%rbp),%rsi
  mov    %r12d,%edx
  mov    %r15,%rdi
  call   <memcmp@plt>
  test   %rax,%rax
  je     L142
  mov    -0x48(%rbp),%rsi
  mov    %r15,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L80
  cmp    %rax,%rbx
  jbe    L80
  lea    0x1(%rax),%r15
L142:
  mov    -0x68(%rbp),%rcx
  test   %rcx,%rcx
  je     L93
  mov    %r15,%rax
  sub    %r13,%rax
  mov    %eax,(%rcx)
L93:
  mov    -0x70(%rbp),%rcx
  lea    (%r15,%r14,1),%rdi
  test   %rcx,%rcx
  je     L115
  mov    %rdi,%rax
  sub    %r13,%rax
  mov    %eax,(%rcx)
L115:
  mov    $0x2c,%esi
  call   <strchr@plt>
  mov    %rax,%rdx
  test   %rax,%rax
  je     L75
  cmp    %rax,%rbx
  jbe    L75
L66:
  mov    -0x78(%rbp),%rbx
  mov    $0x1,%eax
  test   %rbx,%rbx
  je     L139
  sub    %r13,%rdx
  sub    $0x1,%edx
  mov    %edx,(%rbx)
  jmp    L139
  nopl   0x0(%rax)
L64:
  mov    %r13,%rbx
  jmp    L7
  nopl   0x0(%rax,%rax,1)
L75:
  mov    %rbx,%rdx
  jmp    L66
L84:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int ars_d_firstfield_off(char *packet, char *layer, char *field, int *field_start, int *value_start, int *value_end) {
  int layerlen = strlen(layer);
  int fieldlen = strlen(field);
  int pktlen = strlen(packet);
  char *x = alloca(layerlen + 3);
  char *y = alloca(fieldlen + 3);
  char *p, *j, *w;
  x[0] = '+';
  memcpy(x + 1, layer, layerlen);
  x[layerlen + 1] = '(';
  x[layerlen + 2] = '\0';
  if (pktlen <= layerlen + 1)
    return 0;
  if (memcmp(packet, x + 1, layerlen + 1) == 0) {
    p = packet;
  } else {
    p = strstr(packet, x);
    if (p == NULL)
      return 0;
    p++;
  }
  y[0] = ',';
  memcpy(y + 1, field, fieldlen);
  y[fieldlen + 1] = '=';
  y[fieldlen + 2] = '\0';
  p += layerlen + 1;
  pktlen -= p - packet;
  if (pktlen <= fieldlen + 1)
    return 0;
  if ((j = strchr(p, ')')) == NULL)
    return 0;
  if (memcmp(p, y + 1, fieldlen + 1)) {
    p = strstr(p, y);
    if (p == NULL || p >= j)
      return 0;
    p++;
  }
  if (field_start)
    *field_start = p - packet;
  p += fieldlen + 1;
  if (value_start)
    *value_start = p - packet;
  w = strchr(p, ',');
  if (w && w < j)
    j = w;
  if (value_end)
    *value_end = (j - packet) - 1;
  return 1;
}
```