user: Please show me the C implementation that matches the assembly code listed below:

```asm
<execute_cgi>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x760,%rsp
  mov    %edi,-0x744(%rbp)
  mov    %rsi,-0x750(%rbp)
  mov    %rdx,-0x758(%rbp)
  mov    %rcx,-0x760(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x1,-0x730(%rbp)
  movl   $0xffffffff,-0x72c(%rbp)
  movb   $0x41,-0x410(%rbp)
  movb   $0x0,-0x40f(%rbp)
  mov    -0x758(%rbp),%rax
  lea    D134(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcasecmp@plt>
  test   %rax,%rax
  jne    L114
  jmp    L192
L259:
  lea    -0x410(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  lea    -0x410(%rbp),%rcx
  mov    -0x744(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <get_line@plt>
  mov    %eax,-0x730(%rbp)
  lea    -0x410(%rbp),%rax
  mov    %rax,%rsi
  lea    D24(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L192:
  cmpl   $0x0,-0x730(%rbp)
  jle    L186
  lea    -0x410(%rbp),%rax
  mov    %rax,%rsi
  lea    D4(%rip),%rax
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L259
  jmp    L186
L114:
  lea    -0x410(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  lea    -0x410(%rbp),%rcx
  mov    -0x744(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <get_line@plt>
  mov    %eax,-0x730(%rbp)
  lea    -0x410(%rbp),%rax
  mov    %rax,%rsi
  lea    D20(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L221
L224:
  movb   $0x0,-0x401(%rbp)
  lea    -0x410(%rbp),%rax
  mov    %rax,%rsi
  lea    D64(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    -0x410(%rbp),%rax
  lea    D26(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcasecmp@plt>
  test   %rax,%rax
  jne    L215
  lea    -0x410(%rbp),%rax
  add    $0x10,%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    %eax,-0x72c(%rbp)
L215:
  lea    -0x410(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  lea    -0x410(%rbp),%rcx
  mov    -0x744(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <get_line@plt>
  mov    %eax,-0x730(%rbp)
L221:
  cmpl   $0x0,-0x730(%rbp)
  jle    L206
  lea    -0x410(%rbp),%rax
  mov    %rax,%rsi
  lea    D4(%rip),%rax
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L224
L206:
  lea    D1(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  cmpl   $0xffffffff,-0x72c(%rbp)
  jne    L186
  mov    -0x744(%rbp),%eax
  mov    %eax,%edi
  call   <bad_request@plt>
  jmp    L91
L186:
  lea    -0x410(%rbp),%rax
  lea    D13(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  lea    -0x410(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  lea    -0x410(%rbp),%rsi
  mov    -0x744(%rbp),%eax
  mov    $0x0,%ecx
  mov    %eax,%edi
  call   <send@plt>
  lea    -0x720(%rbp),%rax
  mov    %rax,%rdi
  call   <pipe@plt>
  test   %rax,%rax
  jns    L14
  mov    -0x744(%rbp),%eax
  mov    %eax,%edi
  call   <cannot_execute@plt>
  jmp    L91
L14:
  lea    -0x718(%rbp),%rax
  mov    %rax,%rdi
  call   <pipe@plt>
  test   %rax,%rax
  jns    L99
  mov    -0x744(%rbp),%eax
  mov    %eax,%edi
  call   <cannot_execute@plt>
  jmp    L91
L99:
  mov    $0x0,%eax
  call   <fork@plt>
  mov    %rax,-0x728(%rbp)
  cmpq   $0x0,-0x728(%rbp)
  jns    L52
  mov    -0x744(%rbp),%eax
  mov    %eax,%edi
  call   <cannot_execute@plt>
  jmp    L91
L52:
  cmpq   $0x0,-0x728(%rbp)
  jne    L237
  mov    -0x71c(%rbp),%eax
  mov    $0x1,%esi
  mov    %eax,%edi
  call   <dup2@plt>
  mov    -0x718(%rbp),%eax
  mov    $0x0,%esi
  mov    %eax,%edi
  call   <dup2@plt>
  mov    -0x720(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  mov    -0x714(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  mov    -0x758(%rbp),%rdx
  lea    -0x710(%rbp),%rax
  lea    D35(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  lea    -0x710(%rbp),%rax
  mov    %rax,%rdi
  call   <putenv@plt>
  mov    -0x758(%rbp),%rax
  lea    D134(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcasecmp@plt>
  test   %rax,%rax
  jne    L66
  mov    -0x760(%rbp),%rdx
  lea    -0x610(%rbp),%rax
  lea    D11(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <snprintf@plt>
  lea    -0x610(%rbp),%rax
  mov    %rax,%rdi
  call   <putenv@plt>
  jmp    L233
L66:
  mov    -0x72c(%rbp),%edx
  lea    -0x510(%rbp),%rax
  lea    D55(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
L233:
  mov    -0x750(%rbp),%rcx
  mov    -0x750(%rbp),%rax
  mov    $0x0,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <execl@plt>
  test   %rax,%rax
  jns    L136
  lea    D159(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
L136:
  lea    D48(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x0,%edi
  call   <exit@plt>
  jmp    L91
L237:
  mov    -0x758(%rbp),%rax
  lea    D10(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcasecmp@plt>
  test   %rax,%rax
  jne    L122
  movl   $0x0,-0x734(%rbp)
  jmp    L32
L210:
  lea    -0x739(%rbp),%rsi
  mov    -0x744(%rbp),%eax
  mov    $0x0,%ecx
  mov    $0x1,%edx
  mov    %eax,%edi
  call   <recv@plt>
  mov    -0x714(%rbp),%eax
  lea    -0x739(%rbp),%rcx
  mov    $0x1,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <write@plt>
  addl   $0x1,-0x734(%rbp)
L32:
  mov    -0x734(%rbp),%eax
  cmp    -0x72c(%rbp),%eax
  jl     L210
  jmp    L122
L183:
  lea    -0x739(%rbp),%rsi
  mov    -0x744(%rbp),%eax
  mov    $0x0,%ecx
  mov    $0x1,%edx
  mov    %eax,%edi
  call   <send@plt>
L122:
  mov    -0x720(%rbp),%eax
  lea    -0x739(%rbp),%rcx
  mov    $0x1,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <read@plt>
  test   %rax,%rax
  jg     L183
  mov    -0x720(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  mov    -0x714(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  lea    -0x738(%rbp),%rcx
  mov    -0x728(%rbp),%rax
  mov    $0x0,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <waitpid@plt>
L91:
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L239
  call   <__stack_chk_fail@plt>
L239:
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: label: D134
type_guessed: string
name: extract_symbolic_data
arguments: label: D24
type_guessed: string
name: extract_symbolic_data
arguments: label: D4
type_guessed: string
name: extract_symbolic_data
arguments: label: D20
type_guessed: string
name: extract_symbolic_data
arguments: label: D64
type_guessed: string
name: extract_symbolic_data
arguments: label: D26
type_guessed: string
name: extract_symbolic_data
arguments: label: D1
type_guessed: string
name: extract_symbolic_data
arguments: label: D13
type_guessed: string
name: extract_symbolic_data
arguments: label: D35
type_guessed: string
name: extract_symbolic_data
arguments: label: D11
type_guessed: string
name: extract_symbolic_data
arguments: label: D55
type_guessed: string
name: extract_symbolic_data
arguments: label: D159
type_guessed: string
name: extract_symbolic_data
arguments: label: D48
type_guessed: string
name: extract_symbolic_data
arguments: label: D10
type_guessed: string

tool: D134: GET

tool: D24: header: %s 


tool: D4: 


tool: D20: buf: %s


tool: D64: buf:%s 


tool: D26: Content-Length:

tool: D1: before bad_request 

tool: D13: HTTP/1.0 200 OK


tool: D35: REQUEST_METHOD=%s

tool: D11: QUERY_STRING=%s

tool: D55: CONTENT_LENGTH=%d

tool: D159: execl error

tool: D48: <p>come on cgi</p>

tool: D10: POST

assistant: ```c
void execute_cgi(int client, const char *path, const char *method, const char *query_string) {
  char buf[1024];
  int cgi_output[2];
  int cgi_input[2];
  pid_t pid;
  int status;
  int i;
  char c;
  int numchars = 1;
  int content_length = -1;
  buf[0] = 'A';
  buf[1] = '\0';
  if (strcasecmp(method, "GET") == 0)
    while ((numchars > 0) && strcmp("\n", buf)) {
      numchars = get_line(client, buf, strlen(buf));
      printf("header: %s \n", buf);
    }
  else {
    numchars = get_line(client, buf, strlen(buf));
    printf("buf: %s\n", buf);
    while ((numchars > 0) && strcmp("\n", buf)) {
      buf[15] = '\0';
      printf("buf:%s \n", buf);
      if (strcasecmp(buf, "Content-Length:") == 0) {
        content_length = atoi(&buf[16]);
      }
      numchars = get_line(client, buf, strlen(buf));
    }
    printf("before bad_request \n");
    if (content_length == -1) {
      bad_request(client);
      return;
    }
  }
  sprintf(buf, "HTTP/1.0 200 OK\r\n");
  send(client, buf, strlen(buf), 0);
  if (pipe(cgi_output) < 0) {
    cannot_execute(client);
    return;
  }
  if (pipe(cgi_input) < 0) {
    cannot_execute(client);
    return;
  }
  if ((pid = fork()) < 0) {
    cannot_execute(client);
    return;
  }
  if (pid == 0) {
    char meth_env[255];
    char query_env[255];
    char length_env[255];
    dup2(cgi_output[1], 1);
    dup2(cgi_input[0], 0);
    close(cgi_output[0]);
    close(cgi_input[1]);
    sprintf(meth_env, "REQUEST_METHOD=%s", method);
    putenv(meth_env);
    if (strcasecmp(method, "GET") == 0) {
      snprintf(query_env, "QUERY_STRING=%s", query_string);
      putenv(query_env);
    } else {
      sprintf(length_env, "CONTENT_LENGTH=%d", content_length);
    }
    if (execl(path, path, NULL) < 0) {
      printf("execl error\n");
    }
    printf("<p>come on cgi</p>\n");
    exit(0);
  } else {
    if (strcasecmp(method, "POST") == 0)
      for (i = 0; i < content_length; i++) {
        recv(client, &c, 1, 0);
        write(cgi_input[1], &c, 1);
      }
    while (read(cgi_output[0], &c, 1) > 0)
      send(client, &c, 1, 0);
    close(cgi_output[0]);
    close(cgi_input[1]);
    waitpid(pid, &status, 0);
  }
}
```