user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<CGSagaGetPairedValue>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x18,%rsp
  test   %rsi,%rsi
  sete   %al
  test   %rdx,%rdx
  mov    %ecx,0xc(%rsp)
  sete   %dl
  or     %dl,%al
  jne    L316
  mov    %rdi,%r12
  test   %rdi,%rdi
  je     L316
  movzbl (%rdi),%edx
  mov    %rsi,%r15
  xor    %eax,%eax
  xor    %ecx,%ecx
  test   %dl,%dl
  jne    L242
  nopl   0x0(%rax,%rax,1)
L98:
  mov    %r15,%rsi
  mov    %r12,%rdi
  call   <strstr@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L316
  mov    %rax,%r14
  mov    %r15,%rdi
  call   <strlen@plt>
  sub    %r12,%r14
  lea    (%rax,%r14,1),%r13d
  sub    $0x1,%r14d
  jmp    L91
  nop
L182:
  test   $0xdf,%al
  je     L318
L308:
  lea    0x1(%rbp),%rdi
  mov    %r15,%rsi
  call   <strstr@plt>
  test   %rax,%rax
  je     L316
  mov    %rax,%rdx
  sub    %rbp,%rdx
  mov    %rax,%rbp
  add    %edx,%r13d
  add    %edx,%r14d
L91:
  test   %r14d,%r14d
  je     L259
  movslq %r14d,%rax
  movzbl (%r12,%rax,1),%eax
  test   $0xdf,%al
  je     L259
  sub    $0x9,%eax
  cmp    $0x1,%al
  ja     L308
L259:
  movslq %r13d,%rax
  movzbl (%r12,%rax,1),%eax
  lea    -0x9(%rax),%edx
  cmp    $0x1,%dl
  ja     L182
L318:
  lea    0x1(%r13),%edx
  movslq %edx,%rdx
  test   %al,%al
  je     L316
  nop
L183:
  movzbl (%r12,%rdx,1),%eax
  mov    %edx,%esi
  add    $0x1,%rdx
  lea    -0x9(%rax),%ecx
  cmp    $0x1,%cl
  jbe    L183
  cmp    $0x20,%al
  je     L183
  mov    0xc(%rsp),%r8d
  test   %r8d,%r8d
  je     L37
  cmp    $0x22,%al
  je     L189
  test   %al,%al
  je     L189
  add    $0x1,%esi
  movslq %esi,%rax
  jmp    L132
  nopl   0x0(%rax)
L273:
  cmp    $0x22,%dl
  je     L189
L132:
  movzbl (%r12,%rax,1),%edx
  mov    %eax,%esi
  add    $0x1,%rax
  test   %dl,%dl
  jne    L273
L189:
  add    $0x1,%esi
  movslq %esi,%rcx
  movzbl (%r12,%rcx,1),%eax
L37:
  cmp    $0xa,%al
  je     L172
  test   %al,%al
  je     L172
  movslq %esi,%rcx
  mov    $0x1,%edx
  add    %r12,%rcx
  jmp    L291
  nopl   0x0(%rax)
L121:
  add    $0x1,%rdx
  test   %al,%al
  je     L157
  cmp    $0xa,%al
  je     L157
L291:
  mov    0xc(%rsp),%edi
  mov    %al,-0x1(%rbx,%rdx,1)
  movslq %edx,%rsi
  movzbl (%rcx,%rdx,1),%eax
  test   %edi,%edi
  je     L121
  cmp    $0x22,%al
  jne    L121
L157:
  add    %rsi,%rbx
L172:
  movb   $0x0,(%rbx)
  add    $0x18,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L262:
  cmpb   $0x2f,0x1(%r12,%rcx,1)
  je     L123
L161:
  add    $0x1,%eax
  movslq %eax,%rcx
  movzbl (%r12,%rcx,1),%edx
  test   %dl,%dl
  je     L98
L242:
  cmp    $0x2f,%dl
  jne    L161
  jmp    L262
  nopw   0x0(%rax,%rax,1)
L316:
  add    $0x18,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L123:
  movslq %eax,%rcx
  add    %r12,%rcx
  cmpb   $0xa,(%rcx)
  je     L161
  xor    %edx,%edx
  lea    0x1(%rax),%esi
L105:
  movb   $0x2f,(%rcx,%rdx,1)
  lea    (%rsi,%rdx,1),%eax
  add    $0x1,%rdx
  cmpb   $0xa,(%rcx,%rdx,1)
  jne    L105
  jmp    L161
```

assistant: ```c
int CGSagaGetPairedValue(char *buf, char *key, char *outbuf, int inquotes) {
  char *place, *placesecond;
  int startpoint, startletter;
  int i, found;
  if (!buf || !key || !outbuf) {
    return 0;
  }
  i = 0;
  while (buf[i] && buf[i] != '\0') {
    if (buf[i] == '/') {
      if (buf[i + 1] && buf[i + 1] != '\0' && buf[i + 1] == '/') {
        while (buf[i] != '\n') {
          buf[i] = '/';
          i++;
        }
      }
    }
    i++;
  }
  place = strstr(buf, key);
  if (!place) {
    return 0;
  }
  startpoint = place - buf + strlen(key);
  startletter = (place - buf) - 1;
  found = 0;
  while (!found) {
    if (startletter == 0 || !buf[startletter] || buf[startletter] == '\0' || buf[startletter] == 9 || buf[startletter] == ' ' || buf[startletter] == '\n') {
      if (buf[startpoint] == '\0' || buf[startpoint] == 9 || buf[startpoint] == ' ' || buf[startpoint] == '\n') {
        found = 1;
        break;
      }
    }
    placesecond = strstr(place + 1, key);
    if (placesecond) {
      startpoint += placesecond - place;
      startletter += placesecond - place;
      place = placesecond;
    } else {
      place = ((void *)0);
      break;
    }
  }
  if (!found || !place || !buf[startpoint] || buf[startpoint] == '\0') {
    return 0;
  }
  while (buf[startpoint] == ' ' || buf[startpoint] == 9 || buf[startpoint] == '\n') {
    startpoint++;
  }
  i = 0;
  if (inquotes) {
    while (buf[startpoint] && buf[startpoint] != '\"') {
      startpoint++;
    }
    startpoint++;
  }
  while (buf[startpoint] && buf[startpoint] != '\0' && buf[startpoint] != '\n') {
    outbuf[i] = buf[startpoint];
    i++;
    startpoint++;
    if (inquotes && buf[startpoint] == '\"') {
      break;
    }
  }
  outbuf[i] = '\0';
  return 1;
}
```