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

```asm
<ars_d_firstfield_off>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x70,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %rdx,-0x58(%rbp)
  mov    %rcx,-0x60(%rbp)
  mov    %r8,-0x68(%rbp)
  mov    %r9,-0x70(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x50(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x3c(%rbp)
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x38(%rbp)
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x34(%rbp)
  mov    -0x3c(%rbp),%eax
  add    $0x3,%eax
  mov    %eax,%edi
  call   <alloca@plt>
  mov    %rax,-0x20(%rbp)
  mov    -0x38(%rbp),%eax
  add    $0x3,%eax
  mov    %eax,%edi
  call   <alloca@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x20(%rbp),%rax
  movb   $0x2b,(%rax)
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    -0x3c(%rbp),%edx
  mov    -0x50(%rbp),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <memcpy@plt>
  mov    -0x3c(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movb   $0x28,(%rax)
  mov    -0x3c(%rbp),%eax
  cltq
  lea    0x2(%rax),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x3c(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x34(%rbp)
  jg     L181
  mov    $0x0,%eax
  jmp    L22
L181:
  mov    -0x3c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    -0x48(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcmp@plt>
  test   %rax,%rax
  jne    L145
  mov    -0x48(%rbp),%rax
  mov    %rax,-0x30(%rbp)
  jmp    L40
L145:
  mov    -0x20(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    %rax,-0x30(%rbp)
  cmpq   $0x0,-0x30(%rbp)
  jne    L144
  mov    $0x0,%eax
  jmp    L22
L144:
  addq   $0x1,-0x30(%rbp)
L40:
  mov    -0x18(%rbp),%rax
  movb   $0x2c,(%rax)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    -0x38(%rbp),%edx
  mov    -0x58(%rbp),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <memcpy@plt>
  mov    -0x38(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x3d,(%rax)
  mov    -0x38(%rbp),%eax
  cltq
  lea    0x2(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x3c(%rbp),%eax
  cltq
  add    $0x1,%rax
  add    %rax,-0x30(%rbp)
  mov    -0x34(%rbp),%edx
  mov    -0x30(%rbp),%rax
  sub    -0x48(%rbp),%rax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,-0x34(%rbp)
  mov    -0x38(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x34(%rbp)
  jg     L159
  mov    $0x0,%eax
  jmp    L22
L159:
  mov    -0x30(%rbp),%rax
  mov    $0x29,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x28(%rbp)
  cmpq   $0x0,-0x28(%rbp)
  jne    L15
  mov    $0x0,%eax
  jmp    L22
L15:
  mov    -0x38(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    -0x30(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcmp@plt>
  test   %rax,%rax
  je     L30
  mov    -0x18(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    %rax,-0x30(%rbp)
  cmpq   $0x0,-0x30(%rbp)
  je     L185
  mov    -0x30(%rbp),%rax
  cmp    -0x28(%rbp),%rax
  jb     L67
L185:
  mov    $0x0,%eax
  jmp    L22
L67:
  addq   $0x1,-0x30(%rbp)
L30:
  cmpq   $0x0,-0x60(%rbp)
  je     L170
  mov    -0x30(%rbp),%rax
  sub    -0x48(%rbp),%rax
  mov    %eax,%edx
  mov    -0x60(%rbp),%rax
  mov    %edx,(%rax)
L170:
  mov    -0x38(%rbp),%eax
  cltq
  add    $0x1,%rax
  add    %rax,-0x30(%rbp)
  cmpq   $0x0,-0x68(%rbp)
  je     L41
  mov    -0x30(%rbp),%rax
  sub    -0x48(%rbp),%rax
  mov    %eax,%edx
  mov    -0x68(%rbp),%rax
  mov    %edx,(%rax)
L41:
  mov    -0x30(%rbp),%rax
  mov    $0x2c,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  je     L80
  mov    -0x10(%rbp),%rax
  cmp    -0x28(%rbp),%rax
  jae    L80
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x28(%rbp)
L80:
  cmpq   $0x0,-0x70(%rbp)
  je     L5
  mov    -0x28(%rbp),%rax
  sub    -0x48(%rbp),%rax
  sub    $0x1,%eax
  mov    %eax,%edx
  mov    -0x70(%rbp),%rax
  mov    %edx,(%rax)
L5:
  mov    $0x1,%eax
L22:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L173
  call   <__stack_chk_fail@plt>
L173:
  leave
  ret
```

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;
}
```