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

```asm
<scanDhcpLease>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x208,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  lea    -0x120(%rbp),%rax
  lea    D44(%rip),%rdx
  mov    $0x100,%esi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <snprintf@plt>
  lea    -0x120(%rbp),%rax
  mov    %rax,%rdi
  call   <system@plt>
  lea    D126(%rip),%rax
  mov    %rax,%rdi
  call   <system@plt>
  lea    D61(%rip),%rax
  mov    %rax,%rsi
  lea    D27(%rip),%rax
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x1f0(%rbp)
  cmpq   $0x0,-0x1f0(%rbp)
  jne    L152
  mov    $0xffffffff,%eax
  jmp    L125
L131:
  lea    -0x1e0(%rbp),%rax
  add    $0x20,%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  test   %rax,%rax
  jle    L152
  movzbl -0x1db(%rbp),%eax
  movzbl %al,%edi
  movzbl -0x1dc(%rbp),%eax
  movzbl %al,%esi
  movzbl -0x1dd(%rbp),%eax
  movzbl %al,%r9d
  movzbl -0x1de(%rbp),%eax
  movzbl %al,%r8d
  movzbl -0x1df(%rbp),%eax
  movzbl %al,%ecx
  movzbl -0x1e0(%rbp),%eax
  movzbl %al,%edx
  lea    -0x180(%rbp),%rax
  push   %rdi
  push   %rsi
  lea    D57(%rip),%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  add    $0x10,%rsp
  mov    -0x1d0(%rbp),%rax
  mov    %rax,-0x1f8(%rbp)
  mov    -0x1c8(%rbp),%rax
  mov    %rax,%rdi
  call   <ntohl@plt>
  mov    %rax,-0x1e8(%rbp)
  mov    -0x1e8(%rbp),%rax
  movabs $0xc22e450672894ab7,%rdx
  mul    %rdx
  mov    %rdx,%rax
  shr    $0x10,%rax
  mov    %eax,-0x204(%rbp)
  mov    -0x1e8(%rbp),%rcx
  movabs $0xc22e450672894ab7,%rdx
  mov    %rcx,%rax
  mul    %rdx
  mov    %rdx,%rax
  shr    $0x10,%rax
  imul   $0x15180,%rax,%rdx
  mov    %rcx,%rax
  sub    %rdx,%rax
  mov    %rax,-0x1e8(%rbp)
  mov    -0x1e8(%rbp),%rax
  shr    $0x4,%rax
  movabs $0x91a2b3c4d5e6f81,%rdx
  mul    %rdx
  mov    %rdx,%rax
  shr    $0x3,%rax
  mov    %eax,-0x200(%rbp)
  mov    -0x1e8(%rbp),%rcx
  mov    %rcx,%rax
  shr    $0x4,%rax
  movabs $0x91a2b3c4d5e6f81,%rdx
  mul    %rdx
  mov    %rdx,%rax
  shr    $0x3,%rax
  imul   $0xe10,%rax,%rdx
  mov    %rcx,%rax
  sub    %rdx,%rax
  mov    %rax,-0x1e8(%rbp)
  mov    -0x1e8(%rbp),%rax
  movabs $0x8888888888888889,%rdx
  mul    %rdx
  mov    %rdx,%rax
  shr    $0x5,%rax
  mov    %eax,-0x1fc(%rbp)
  mov    -0x1e8(%rbp),%rcx
  movabs $0x8888888888888889,%rdx
  mov    %rcx,%rax
  mul    %rdx
  shr    $0x5,%rdx
  mov    %rdx,%rax
  shl    $0x4,%rax
  sub    %rdx,%rax
  shl    $0x2,%rax
  sub    %rax,%rcx
  mov    %rcx,%rdx
  mov    %rdx,-0x1e8(%rbp)
  cmpl   $0x0,-0x204(%rbp)
  je     L63
  mov    -0x1e8(%rbp),%rax
  mov    %eax,%edi
  mov    -0x1fc(%rbp),%esi
  mov    -0x200(%rbp),%ecx
  mov    -0x204(%rbp),%edx
  lea    -0x160(%rbp),%rax
  sub    $0x8,%rsp
  push   %rdi
  mov    %esi,%r9d
  mov    %ecx,%r8d
  mov    %edx,%ecx
  lea    D121(%rip),%rdx
  mov    $0x40,%esi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <snprintf@plt>
  add    $0x10,%rsp
L63:
  mov    -0x1f8(%rbp),%rax
  mov    %rax,%rdi
  call   <inet_ntoa@plt>
  mov    %rax,%rdi
  call   <isARPReply@plt>
  test   %eax,%eax
  jne    L0
  mov    -0x1f8(%rbp),%rax
  mov    %rax,%rdi
  call   <inet_ntoa@plt>
  mov    %rax,%rbx
  lea    -0x180(%rbp),%rax
  mov    %rax,%rdi
  call   <mac2if@plt>
  mov    %rax,%rdx
  lea    -0x180(%rbp),%rsi
  lea    -0x120(%rbp),%rax
  sub    $0x8,%rsp
  lea    -0x1e0(%rbp),%rcx
  add    $0x20,%rcx
  push   %rcx
  mov    %rsi,%r9
  mov    %rbx,%r8
  mov    %rdx,%rcx
  lea    D19(%rip),%rdx
  mov    $0x100,%esi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <snprintf@plt>
  add    $0x10,%rsp
  lea    -0x120(%rbp),%rax
  mov    %rax,%rsi
  lea    D12(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    -0x120(%rbp),%rax
  mov    %rax,%rdi
  call   <system@plt>
  jmp    L64
L0:
  mov    -0x1f8(%rbp),%rax
  mov    %rax,%rdi
  call   <inet_ntoa@plt>
  mov    %rax,%rsi
  lea    D100(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
L64:
  lea    -0x180(%rbp),%rax
  mov    %rax,%rdi
  call   <mac2if@plt>
  mov    %rax,%rbx
  mov    -0x1f8(%rbp),%rax
  mov    %rax,%rdi
  call   <inet_ntoa@plt>
  mov    %rax,%rsi
  lea    -0x180(%rbp),%rdi
  lea    -0x1e0(%rbp),%rax
  lea    0x20(%rax),%rdx
  lea    -0x120(%rbp),%rax
  push   %rbx
  lea    -0x160(%rbp),%rcx
  push   %rcx
  mov    %rdi,%r9
  mov    %rsi,%r8
  mov    %rdx,%rcx
  lea    D26(%rip),%rdx
  mov    $0x100,%esi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <snprintf@plt>
  add    $0x10,%rsp
  lea    -0x120(%rbp),%rax
  mov    %rax,%rdi
  call   <system@plt>
  mov    $0x0,%eax
  jmp    L125
L152:
  mov    -0x1f0(%rbp),%rdx
  lea    -0x1e0(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x60,%edx
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <fread@plt>
  cmp    $0x60,%eax
  je     L131
  mov    -0x1f0(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  lea    D61(%rip),%rax
  mov    %rax,%rsi
  lea    D72(%rip),%rax
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x1f0(%rbp)
  cmpq   $0x0,-0x1f0(%rbp)
  jne    L121
  mov    $0xffffffff,%eax
  jmp    L125
L72:
  lea    -0x1e0(%rbp),%rax
  add    $0x20,%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  test   %rax,%rax
  jle    L121
  movzbl -0x1db(%rbp),%eax
  movzbl %al,%edi
  movzbl -0x1dc(%rbp),%eax
  movzbl %al,%esi
  movzbl -0x1dd(%rbp),%eax
  movzbl %al,%r9d
  movzbl -0x1de(%rbp),%eax
  movzbl %al,%r8d
  movzbl -0x1df(%rbp),%eax
  movzbl %al,%ecx
  movzbl -0x1e0(%rbp),%eax
  movzbl %al,%edx
  lea    -0x180(%rbp),%rax
  push   %rdi
  push   %rsi
  lea    D57(%rip),%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  add    $0x10,%rsp
  mov    -0x1d0(%rbp),%rax
  mov    %rax,-0x1f8(%rbp)
  mov    -0x1f8(%rbp),%rax
  mov    %rax,%rdi
  call   <inet_ntoa@plt>
  mov    %rax,%rdi
  call   <isARPReply@plt>
  test   %eax,%eax
  jne    L109
  mov    -0x1f8(%rbp),%rax
  mov    %rax,%rdi
  call   <inet_ntoa@plt>
  mov    %rax,%rbx
  lea    -0x180(%rbp),%rax
  mov    %rax,%rdi
  call   <mac2if@plt>
  mov    %rax,%rdx
  lea    -0x180(%rbp),%rsi
  lea    -0x120(%rbp),%rax
  sub    $0x8,%rsp
  lea    -0x1e0(%rbp),%rcx
  add    $0x20,%rcx
  push   %rcx
  mov    %rsi,%r9
  mov    %rbx,%r8
  mov    %rdx,%rcx
  lea    D19(%rip),%rdx
  mov    $0x100,%esi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <snprintf@plt>
  add    $0x10,%rsp
  lea    -0x120(%rbp),%rax
  mov    %rax,%rdi
  call   <system@plt>
  jmp    L85
L109:
  mov    -0x1f8(%rbp),%rax
  mov    %rax,%rdi
  call   <inet_ntoa@plt>
  mov    %rax,%rsi
  lea    D100(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
L85:
  mov    $0x0,%eax
  jmp    L125
L121:
  mov    -0x1f0(%rbp),%rdx
  lea    -0x1e0(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x60,%edx
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <fread@plt>
  cmp    $0x60,%eax
  je     L72
  mov    -0x1f0(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    $0x0,%eax
L125:
  mov    -0x18(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L24
  call   <__stack_chk_fail@plt>
L24:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D44
type_guessed: string
name: retrieve_data
arguments: tag: D126
type_guessed: string
name: retrieve_data
arguments: tag: D61
type_guessed: string
name: retrieve_data
arguments: tag: D27
type_guessed: string
name: retrieve_data
arguments: tag: D57
type_guessed: string
name: retrieve_data
arguments: tag: D121
type_guessed: string
name: retrieve_data
arguments: tag: D19
type_guessed: string
name: retrieve_data
arguments: tag: D12
type_guessed: string
name: retrieve_data
arguments: tag: D100
type_guessed: string
name: retrieve_data
arguments: tag: D26
type_guessed: string
name: retrieve_data
arguments: tag: D72
type_guessed: string

tool: D44: sqlite3 /tmp/system.db "delete from DhcpLeasedClients"

tool: D126: killall -q -USR1 udhcpd

tool: D61: r

tool: D27: /tmp/udhcpd0.leases

tool: D57: %02x:%02x:%02x:%02x:%02x:%02x

tool: D121: %u days %02u:%02u:%02u


tool: D19: sqlite3 /tmp/system.db "insert into attacheddevice  (AttchedType, IpAddress, MacAddress, DeviceName) values ('%s', '%s', '%s', '%s')"

tool: D12: [debug] %s


tool: D100: %s didn't exist anymore...


tool: D26: sqlite3 /tmp/system.db "insert into DhcpLeasedClients (LogicalIfname, hostName, IPAddress, MacAddress, Timeout, clientIf)  values ('br0', '%s', '%s', '%s', '%s', '%s')"

tool: D72: /tmp/udhcpd1.leases

assistant: ```c
int scanDhcpLease() {
  FILE *fp;
  char tmpmac[30];
  char sysCmd[256];
  char tmpexpires[64];
  unsigned long expires;
  unsigned d, h, m;
  struct dhcpOfferedAddr {
    unsigned char mac[16];
    unsigned long ip;
    unsigned long expires;
    unsigned char hostname[64];
  } lease;
  struct in_addr addr;
  snprintf(sysCmd, sizeof(sysCmd), "sqlite3 /tmp/system.db \"delete from DhcpLeasedClients\"");
  system(sysCmd);
  system("killall -q -USR1 udhcpd");
  fp = fopen("/tmp/udhcpd0.leases", "r");
  if (NULL == fp) {
    return -1;
  }
  while (fread(&lease, 1, sizeof(lease), fp) == sizeof(lease)) {
    if (strlen(lease.hostname) > 0) {
      sprintf(tmpmac, "%02x:%02x:%02x:%02x:%02x:%02x", lease.mac[0], lease.mac[1], lease.mac[2], lease.mac[3], lease.mac[4], lease.mac[5]);
      addr.s_addr = lease.ip;
      expires = ntohl(lease.expires);
      d = expires / (24 * 60 * 60);
      expires %= (24 * 60 * 60);
      h = expires / (60 * 60);
      expires %= (60 * 60);
      m = expires / 60;
      expires %= 60;
      if (d)
        snprintf(tmpexpires, sizeof(tmpexpires), "%u days %02u:%02u:%02u\n", d, h, m, (unsigned)expires);
      if (!isARPReply(inet_ntoa(addr))) {
        snprintf(sysCmd, sizeof(sysCmd), "sqlite3 /tmp/system.db \"insert into attacheddevice  (AttchedType, IpAddress, MacAddress, DeviceName) values ('%s', '%s', '%s', '%s')\"", mac2if(tmpmac), inet_ntoa(addr), tmpmac, lease.hostname);
        printf("[debug] %s\n", sysCmd);
        system(sysCmd);
      } else
        printf("%s didn't exist anymore...\n", inet_ntoa(addr));
      snprintf(sysCmd, sizeof(sysCmd), "sqlite3 /tmp/system.db \"insert into DhcpLeasedClients (LogicalIfname, hostName, IPAddress, MacAddress, Timeout, clientIf)  values ('br0', '%s', '%s', '%s', '%s', '%s')\"", lease.hostname, inet_ntoa(addr), tmpmac, tmpexpires, mac2if(tmpmac));
      system(sysCmd);
      return 0;
    }
  }
  fclose(fp);
  fp = fopen("/tmp/udhcpd1.leases", "r");
  if (NULL == fp) {
    return -1;
  }
  while (fread(&lease, 1, sizeof(lease), fp) == sizeof(lease)) {
    if (strlen(lease.hostname) > 0) {
      sprintf(tmpmac, "%02x:%02x:%02x:%02x:%02x:%02x", lease.mac[0], lease.mac[1], lease.mac[2], lease.mac[3], lease.mac[4], lease.mac[5]);
      addr.s_addr = lease.ip;
      if (!isARPReply(inet_ntoa(addr))) {
        snprintf(sysCmd, sizeof(sysCmd), "sqlite3 /tmp/system.db \"insert into attacheddevice  (AttchedType, IpAddress, MacAddress, DeviceName) values ('%s', '%s', '%s', '%s')\"", mac2if(tmpmac), inet_ntoa(addr), tmpmac, lease.hostname);
        system(sysCmd);
      } else
        printf("%s didn't exist anymore...\n", inet_ntoa(addr));
      return 0;
    }
  }
  fclose(fp);
  return 0;
}
```