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

```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    L319
  mov    %rdi,%r13
  test   %rdi,%rdi
  je     L319
  movzbl (%rdi),%ecx
  mov    %rsi,%r15
  xor    %edx,%edx
  xor    %eax,%eax
  test   %cl,%cl
  jne    L327
  nopl   0x0(%rax,%rax,1)
L33:
  mov    %r15,%rsi
  mov    %r13,%rdi
  call   <strstr@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L319
  mov    %rax,%r14
  mov    %r15,%rdi
  call   <strlen@plt>
  sub    %r13,%r14
  lea    (%rax,%r14,1),%r12d
  sub    $0x1,%r14d
  jmp    L19
  nop
L141:
  test   $0xdf,%al
  je     L117
L357:
  lea    0x1(%rbp),%rdi
  mov    %r15,%rsi
  call   <strstr@plt>
  test   %rax,%rax
  je     L319
  mov    %rax,%rdx
  sub    %rbp,%rdx
  mov    %rax,%rbp
  add    %edx,%r12d
  add    %edx,%r14d
L19:
  test   %r14d,%r14d
  je     L299
  movslq %r14d,%rax
  movzbl 0x0(%r13,%rax,1),%eax
  test   $0xdf,%al
  je     L299
  sub    $0x9,%eax
  cmp    $0x1,%al
  ja     L357
L299:
  movslq %r12d,%rax
  movzbl 0x0(%r13,%rax,1),%eax
  lea    -0x9(%rax),%edx
  cmp    $0x1,%dl
  ja     L141
L117:
  lea    0x1(%r12),%edx
  movslq %edx,%rdx
  test   %al,%al
  je     L319
  nopw   0x0(%rax,%rax,1)
L165:
  movzbl 0x0(%r13,%rdx,1),%ecx
  movslq %edx,%rsi
  add    $0x1,%rdx
  lea    -0x9(%rcx),%eax
  cmp    $0x1,%al
  jbe    L165
  cmp    $0x20,%cl
  je     L165
  mov    0xc(%rsp),%eax
  test   %eax,%eax
  je     L3
  cmp    $0x22,%cl
  je     L220
  test   %cl,%cl
  je     L220
  add    $0x1,%esi
  movslq %esi,%rax
  jmp    L124
  xchg   %ax,%ax
L68:
  cmp    $0x22,%dl
  je     L220
L124:
  movzbl 0x0(%r13,%rax,1),%edx
  mov    %eax,%esi
  add    $0x1,%rax
  test   %dl,%dl
  jne    L68
L220:
  lea    0x1(%rsi),%eax
  cltq
  movzbl 0x0(%r13,%rax,1),%edx
  cmp    $0xa,%dl
  je     L304
  mov    $0x1,%ecx
  add    %r13,%rax
  test   %dl,%dl
  jne    L210
  jmp    L304
  nopl   0x0(%rax,%rax,1)
L214:
  add    $0x1,%rcx
  test   %dl,%dl
  je     L328
  cmp    $0xa,%dl
  je     L328
L210:
  mov    %dl,-0x1(%rbx,%rcx,1)
  movzbl (%rax,%rcx,1),%edx
  movslq %ecx,%rsi
  cmp    $0x22,%dl
  jne    L214
L328:
  add    %rsi,%rbx
L304:
  movb   $0x0,(%rbx)
  add    $0x18,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L245:
  cmpb   $0x2f,0x1(%r13,%rax,1)
  je     L325
L55:
  add    $0x1,%edx
  movslq %edx,%rax
  movzbl 0x0(%r13,%rax,1),%ecx
  test   %cl,%cl
  je     L33
L327:
  cmp    $0x2f,%cl
  jne    L55
  jmp    L245
  nopl   0x0(%rax,%rax,1)
L319:
  add    $0x18,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L325:
  movslq %edx,%rcx
  xor    %eax,%eax
  lea    0x1(%rdx),%esi
  add    %r13,%rcx
  nopl   0x0(%rax,%rax,1)
L92:
  movb   $0x2f,(%rcx,%rax,1)
  lea    (%rsi,%rax,1),%edx
  add    $0x1,%rax
  cmpb   $0xa,(%rcx,%rax,1)
  jne    L92
  jmp    L55
  nopl   0x0(%rax,%rax,1)
L3:
  mov    $0x1,%edx
  lea    0x0(%r13,%rsi,1),%rax
  test   %cl,%cl
  jne    L326
  jmp    L304
  nopl   0x0(%rax,%rax,1)
L207:
  test   %cl,%cl
  je     L328
L326:
  mov    %cl,-0x1(%rbx,%rdx,1)
  movzbl (%rax,%rdx,1),%ecx
  movslq %edx,%rsi
  add    $0x1,%rdx
  cmp    $0xa,%cl
  jne    L207
  jmp    L328
```

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