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

```asm
<route_and_arp>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdx,%r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  mov    %r8,%r12
  push   %rbp
  mov    %ecx,%ebp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0xd8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xc8(%rsp)
  lea    D97(%rip),%rax
  lea    0x90(%rsp),%r15
  mov    %rsi,0x68(%rsp)
  mov    %r15,0x10(%rsp)
  movq   $0x0,0x18(%rsp)
  mov    %rdi,0x78(%rsp)
  movq   $0x0,0x80(%rsp)
  mov    %rsi,0x30(%rsp)
  mov    %rax,(%rsp)
  lea    D117(%rip),%rax
  mov    %rax,0x8(%rsp)
  lea    D62(%rip),%rax
  mov    %rax,0x50(%rsp)
  lea    D64(%rip),%rax
  mov    %rax,0x58(%rsp)
  lea    D67(%rip),%rax
  mov    %rax,0x60(%rsp)
  lea    D41(%rip),%rax
  mov    %rax,0x70(%rsp)
  lea    D99(%rip),%rax
  mov    %rax,0x20(%rsp)
  lea    D87(%rip),%rax
  mov    %rax,0x28(%rsp)
  lea    D56(%rip),%rax
  mov    %rax,0x38(%rsp)
  lea    D22(%rip),%rax
  mov    %rax,0x40(%rsp)
  movq   $0x0,0x48(%rsp)
  call   <is_a_device@plt>
  test   %eax,%eax
  je     L56
  lea    0x50(%rsp),%rdi
  mov    %r12,%rdx
  mov    %ebp,%esi
  call   <do_exec@plt>
  test   %rax,%rax
  jne    L35
  mov    %rbx,%rcx
  lea    D6(%rip),%rdx
  mov    $0x34,%esi
  mov    %r15,%rdi
  call   <snprintf@plt>
  mov    %rsp,%rdi
  mov    %r12,%rdx
  xor    %esi,%esi
  call   <do_exec@plt>
  lea    0x20(%rsp),%rdi
  test   %r14,%r14
  je     L53
  mov    %r12,%r9
  mov    %rbx,%r8
  mov    %r14,%rcx
  mov    %r13,%rdx
  mov    $0x3,%esi
  call   <local_net_do@plt>
  xor    %eax,%eax
L26:
  mov    0xc8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L29
  add    $0xd8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L53:
  mov    %r12,%rdx
  xor    %esi,%esi
  call   <do_exec@plt>
  xor    %eax,%eax
  jmp    L26
  cs nopw 0x0(%rax,%rax,1)
L35:
  mov    $0xffffffff,%eax
  jmp    L26
  nopw   0x0(%rax,%rax,1)
L56:
  mov    $0xffffffff,%edx
  lea    D96(%rip),%rsi
  mov    %r12,%rdi
  call   <add_output@plt>
  mov    $0xffffffff,%eax
  jmp    L26
L29:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: tag: D97
type_guessed: string
name: retrieve_data
arguments: tag: D117
type_guessed: string
name: retrieve_data
arguments: tag: D62
type_guessed: string
name: retrieve_data
arguments: tag: D64
type_guessed: string
name: retrieve_data
arguments: tag: D67
type_guessed: string
name: retrieve_data
arguments: tag: D41
type_guessed: string
name: retrieve_data
arguments: tag: D99
type_guessed: string
name: retrieve_data
arguments: tag: D87
type_guessed: string
name: retrieve_data
arguments: tag: D56
type_guessed: string
name: retrieve_data
arguments: tag: D22
type_guessed: string
name: retrieve_data
arguments: tag: D6
type_guessed: string
name: retrieve_data
arguments: tag: D96
type_guessed: string

tool: D97: bash

tool: D117: -c

tool: D62: route

tool: D64: add

tool: D67: -host

tool: D41: dev

tool: D99: arp

tool: D87: -Ds

tool: D56: eth0

tool: D22: pub

tool: D6: echo 1 > /proc/sys/net/ipv4/conf/%.9s/proxy_arp

tool: D96: Device doesn't contain only alphanumeric characters


assistant: ```c
int route_and_arp(char *dev, char *addr, char *netmask, int need_route, struct output *output) {
  char echo[sizeof("echo 1 > /proc/sys/net/ipv4/conf/XXXXXXXXX/proxy_arp")];
  char *echo_argv[] = {"bash", "-c", echo, NULL};
  char *route_argv[] = {"route", "add", "-host", addr, "dev", dev, NULL};
  char *arp_argv[] = {"arp", "-Ds", addr, "eth0", "pub", NULL};
  if (!is_a_device(dev)) {
    add_output(output, "Device doesn't contain only alphanumeric characters\n", -1);
    return (-1);
  }
  if (do_exec(route_argv, need_route, output))
    return (-1);
  snprintf(echo, sizeof(echo) - 1, "echo 1 > /proc/sys/net/ipv4/conf/%.9s/proxy_arp", dev);
  do_exec(echo_argv, 0, output);
  if (netmask)
    local_net_do(arp_argv, 3, addr, netmask, dev, output);
  else
    do_exec(arp_argv, 0, output);
  return (0);
}
```