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

```asm
<find_executable>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x418,%rsp
  mov    %rdi,%r13
  mov    %fs:0x28,%rax
  mov    %rax,0x408(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L73
  movzbl (%rdi),%eax
  test   %al,%al
  je     L286
  cmp    $0x2f,%al
  je     L289
L171:
  mov    %r13,%rdx
L9:
  cmp    $0x2f,%al
  je     L271
  add    $0x1,%rdx
  movzbl (%rdx),%eax
  test   %al,%al
  jne    L9
L315:
  lea    D13(%rip),%rdi
  call   <getenv@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L271
  cmpb   $0x0,(%r12)
  jne    L118
L271:
  mov    %rsp,%rdi
  mov    $0x400,%esi
  call   <getcwd@plt>
  test   %rax,%rax
  je     L183
L213:
  mov    %rsp,%r14
  mov    %r14,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  mov    %r13,%rdi
  call   <strlen@plt>
  lea    0x2(%rbx,%rax,1),%edi
  call   <xmalloc@plt>
  mov    %rax,%r12
  mov    %rax,%rbp
  mov    %ebx,%edx
  mov    %r14,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  movslq %ebx,%rbx
  movb   $0x2f,(%r12,%rbx,1)
  lea    0x1(%r12,%rbx,1),%rdi
  mov    %r13,%rsi
  call   <strcpy@plt>
  mov    %r12,%rdi
  call   <check_executable@plt>
  test   %rax,%rax
  jne    L172
  mov    $0x0,%ebp
  test   %r12,%r12
  jne    L69
L172:
  mov    0x408(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L274
  mov    %rbp,%rax
  add    $0x418,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L289:
  call   <xstrdup@plt>
  mov    %rax,%rbp
  mov    %rax,%rdi
  call   <check_executable@plt>
  test   %rax,%rax
  jne    L172
  test   %rbp,%rbp
  je     L113
  mov    %rbp,%rdi
  call   <free@plt>
L113:
  movzbl 0x0(%r13),%eax
  test   %al,%al
  jne    L171
  jmp    L315
L210:
  mov    %rsp,%rdi
  mov    $0x400,%esi
  call   <getcwd@plt>
  test   %rax,%rax
  je     L216
L264:
  mov    %rsp,%r14
  mov    %r14,%rdi
  call   <strlen@plt>
  mov    %eax,%r12d
  mov    %r13,%rdi
  call   <strlen@plt>
  lea    0x2(%r12,%rax,1),%edi
  call   <xmalloc@plt>
  mov    %rax,%rbp
  mov    %r12d,%edx
  mov    %r14,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  movslq %r12d,%r12
  movb   $0x2f,0x0(%rbp,%r12,1)
  lea    0x1(%rbp,%r12,1),%rdi
  mov    %r13,%rsi
  call   <strcpy@plt>
  mov    %rbx,%r12
L250:
  mov    %rbp,%rdi
  call   <check_executable@plt>
  test   %rax,%rax
  jne    L172
  test   %rbp,%rbp
  je     L293
  mov    %rbp,%rdi
  call   <free@plt>
L293:
  cmpb   $0x0,(%r12)
  je     L271
L118:
  movzbl (%r12),%eax
  cmp    $0x3a,%al
  je     L71
  test   %al,%al
  je     L71
  mov    %r12,%rbx
L31:
  add    $0x1,%rbx
  movzbl (%rbx),%eax
  cmp    $0x3a,%al
  je     L82
  test   %al,%al
  jne    L31
L82:
  mov    %rbx,%r14
  sub    %r12,%r14
  mov    %r14,%r15
  test   %al,%al
  je     L7
L298:
  add    $0x1,%rbx
L7:
  test   %r15,%r15
  je     L210
  mov    %r13,%rdi
  call   <strlen@plt>
  lea    0x2(%rax,%r14,1),%edi
  call   <xmalloc@plt>
  mov    %rax,%rbp
  mov    %r14d,%edx
  mov    %r12,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  movb   $0x2f,0x0(%rbp,%r15,1)
  lea    0x1(%rbp,%r15,1),%rdi
  mov    %r13,%rsi
  call   <strcpy@plt>
  mov    %rbx,%r12
  jmp    L250
L216:
  lea    D22(%rip),%rdi
  call   <lt_fatal@plt>
  jmp    L264
L183:
  lea    D22(%rip),%rdi
  call   <lt_fatal@plt>
  jmp    L213
L69:
  mov    %r12,%rdi
  call   <free@plt>
  jmp    L172
L73:
  mov    %rdi,%rbp
  jmp    L172
L286:
  mov    $0x0,%ebp
  jmp    L172
L71:
  mov    %r12,%rbx
  test   %al,%al
  je     L210
  mov    %r12,%rbx
  mov    $0x0,%r15d
  mov    $0x0,%r14d
  jmp    L298
L274:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: tag: D13
type_guessed: string
name: disassemble_data
arguments: tag: D22
type_guessed: string

tool: D13: PATH

tool: D22: getcwd failed

assistant: ```c
char *find_executable(const char *wrapper) {
  int has_slash = 0;
  const char *p;
  const char *p_next;
  char tmp[1024 + 1];
  int tmp_len;
  char *concat_name;

  ;
  if ((wrapper == NULL) || (*wrapper == '\0'))
    return NULL;
  if (((wrapper[0]) == '/')) {
    concat_name = xstrdup(wrapper);
    if (check_executable(concat_name))
      return concat_name;
    do {
      if (concat_name) {
        free((void *)concat_name);
        concat_name = 0;
      }
    } while (0);
  }
  for (p = wrapper; *p; p++)
    if (*p == '/') {
      has_slash = 1;
      break;
    }
  if (!has_slash) {
    const char *path = getenv("PATH");
    if (path != NULL) {
      for (p = path; *p; p = p_next) {
        const char *q;
        size_t p_len;
        for (q = p; *q; q++)
          if (((*q) == ':'))
            break;
        p_len = q - p;
        p_next = (*q == '\0' ? q : q + 1);
        if (p_len == 0) {
          if (getcwd(tmp, 1024) == NULL)
            lt_fatal("getcwd failed");
          tmp_len = strlen(tmp);
          concat_name = ((char *)xmalloc((tmp_len + 1 + strlen(wrapper) + 1) * sizeof(char)));
          memcpy(concat_name, tmp, tmp_len);
          concat_name[tmp_len] = '/';
          strcpy(concat_name + tmp_len + 1, wrapper);
        } else {
          concat_name = ((char *)xmalloc((p_len + 1 + strlen(wrapper) + 1) * sizeof(char)));
          memcpy(concat_name, p, p_len);
          concat_name[p_len] = '/';
          strcpy(concat_name + p_len + 1, wrapper);
        }
        if (check_executable(concat_name))
          return concat_name;
        do {
          if (concat_name) {
            free((void *)concat_name);
            concat_name = 0;
          }
        } while (0);
      }
    }
  }
  if (getcwd(tmp, 1024) == NULL)
    lt_fatal("getcwd failed");
  tmp_len = strlen(tmp);
  concat_name = ((char *)xmalloc((tmp_len + 1 + strlen(wrapper) + 1) * sizeof(char)));
  memcpy(concat_name, tmp, tmp_len);
  concat_name[tmp_len] = '/';
  strcpy(concat_name + tmp_len + 1, wrapper);
  if (check_executable(concat_name))
    return concat_name;
  do {
    if (concat_name) {
      free((void *)concat_name);
      concat_name = 0;
    }
  } while (0);
  return NULL;
}
```