user: 请从给定的汇编指令推导出C源代码:

```asm
<scanDhcpLease>:
  endbr64
  push   %r15
  mov    $0x100,%esi
  lea    D112(%rip),%rdx
  push   %r14
  lea    D27(%rip),%r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1d8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x1c8(%rsp)
  xor    %eax,%eax
  lea    0xc0(%rsp),%r13
  mov    %r13,%rdi
  call   <snprintf@plt>
  mov    %r13,%rdi
  call   <system@plt>
  lea    D48(%rip),%rdi
  call   <system@plt>
  mov    %r14,%rsi
  lea    D0(%rip),%rdi
  call   <fopen@plt>
  test   %rax,%rax
  je     L12
  mov    %rax,%rbp
  mov    %rsp,%rbx
  lea    0x20(%rsp),%r12
  jmp    L31
  nopl   0x0(%rax)
L67:
  mov    %r12,%rdi
  call   <strlen@plt>
  test   %rax,%rax
  jg     L110
L31:
  mov    %rbp,%rcx
  mov    $0x60,%edx
  mov    $0x1,%esi
  mov    %rbx,%rdi
  call   <fread@plt>
  cmp    $0x60,%eax
  je     L67
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    %r14,%rsi
  lea    D56(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L12
  lea    0x20(%rsp),%r12
  jmp    L98
  nopl   (%rax)
L157:
  mov    %r12,%rdi
  call   <strlen@plt>
  test   %rax,%rax
  jg     L60
L98:
  mov    %rbp,%rcx
  mov    $0x60,%edx
  mov    $0x1,%esi
  mov    %rbx,%rdi
  call   <fread@plt>
  cmp    $0x60,%eax
  je     L157
  mov    %rbp,%rdi
  xor    %r14d,%r14d
  call   <fclose@plt>
L167:
  mov    0x1c8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L112
  add    $0x1d8,%rsp
  mov    %r14d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L110:
  movzbl 0x5(%rsp),%eax
  movzbl 0x1(%rsp),%ecx
  lea    0x60(%rsp),%rbx
  lea    D85(%rip),%rsi
  movzbl (%rsp),%edx
  mov    %rbx,%rdi
  push   %rax
  movzbl 0xc(%rsp),%eax
  push   %rax
  movzbl 0x13(%rsp),%r9d
  movzbl 0x12(%rsp),%r8d
  call   <sprintf@plt>
  mov    0x28(%rsp),%rdi
  mov    0x20(%rsp),%rbp
  call   <ntohl@plt>
  movabs $0xc22e450672894ab7,%rdx
  mov    %rax,%rcx
  mul    %rdx
  pop    %rax
  pop    %rsi
  lea    0x80(%rsp),%r14
  shr    $0x10,%rdx
  mov    %edx,%r10d
  test   %edx,%edx
  jne    L51
L177:
  mov    %rbp,%rdi
  call   <inet_ntoa@plt>
  mov    %rax,%rdi
  call   <isARPReply@plt>
  mov    %rbp,%rdi
  test   %eax,%eax
  jne    L148
  call   <inet_ntoa@plt>
  mov    %rbx,%rdi
  mov    %rax,%r15
  call   <mac2if@plt>
  sub    $0x8,%rsp
  mov    %rbx,%r9
  mov    %r15,%r8
  push   %r12
  mov    %rax,%rcx
  lea    D16(%rip),%rdx
  mov    %r13,%rdi
  mov    $0x100,%esi
  xor    %eax,%eax
  call   <snprintf@plt>
  mov    %r13,%rsi
  lea    D111(%rip),%rdi
  call   <printf@plt>
  mov    %r13,%rdi
  call   <system@plt>
  pop    %r9
  pop    %r10
L65:
  mov    %rbx,%rdi
  call   <mac2if@plt>
  mov    %rbp,%rdi
  mov    %rax,%r15
  call   <inet_ntoa@plt>
  push   %r15
  mov    %rbx,%r9
  mov    %r12,%rcx
  push   %r14
  mov    %rax,%r8
  lea    D120(%rip),%rdx
  mov    %r13,%rdi
  mov    $0x100,%esi
  xor    %eax,%eax
  xor    %r14d,%r14d
  call   <snprintf@plt>
  mov    %r13,%rdi
  call   <system@plt>
  pop    %rdi
  pop    %r8
  jmp    L167
  nopl   0x0(%rax)
L60:
  movzbl 0x5(%rsp),%eax
  movzbl 0x1(%rsp),%ecx
  lea    0x60(%rsp),%rbx
  lea    D85(%rip),%rsi
  movzbl (%rsp),%edx
  mov    %rbx,%rdi
  push   %rax
  movzbl 0xc(%rsp),%eax
  push   %rax
  movzbl 0x13(%rsp),%r9d
  movzbl 0x12(%rsp),%r8d
  call   <sprintf@plt>
  mov    0x20(%rsp),%rbp
  mov    %rbp,%rdi
  call   <inet_ntoa@plt>
  mov    %rax,%rdi
  call   <isARPReply@plt>
  pop    %rcx
  mov    %rbp,%rdi
  pop    %rsi
  mov    %eax,%r14d
  test   %eax,%eax
  jne    L166
  call   <inet_ntoa@plt>
  mov    %rbx,%rdi
  mov    %rax,%rbp
  call   <mac2if@plt>
  sub    $0x8,%rsp
  mov    %rbx,%r9
  mov    %rbp,%r8
  push   %r12
  mov    %rax,%rcx
  lea    D16(%rip),%rdx
  mov    %r13,%rdi
  mov    $0x100,%esi
  xor    %eax,%eax
  call   <snprintf@plt>
  mov    %r13,%rdi
  call   <system@plt>
  pop    %rax
  pop    %rdx
  jmp    L167
  nopw   0x0(%rax,%rax,1)
L148:
  call   <inet_ntoa@plt>
  lea    D55(%rip),%rdi
  mov    %rax,%rsi
  call   <printf@plt>
  jmp    L65
  nopl   0x0(%rax)
L166:
  call   <inet_ntoa@plt>
  lea    D55(%rip),%rdi
  xor    %r14d,%r14d
  mov    %rax,%rsi
  call   <printf@plt>
  jmp    L167
  nopl   0x0(%rax)
L51:
  imul   $0x15180,%rdx,%rdx
  sub    $0x8,%rsp
  mov    %r14,%rdi
  movabs $0x8888888888888889,%r9
  sub    %rdx,%rcx
  movabs $0x91a2b3c4d5e6f81,%rdx
  mov    %rcx,%r8
  shr    $0x4,%r8
  mov    %r8,%rax
  mul    %rdx
  mov    %rdx,%rsi
  mov    %rdx,%r8
  shr    $0x3,%rsi
  shr    $0x3,%r8
  imul   $0xe10,%rsi,%rax
  sub    %rax,%rcx
  mov    %rcx,%rax
  mov    %rcx,%rsi
  mov    %r10d,%ecx
  mul    %r9
  mov    %rdx,%r9
  lea    D91(%rip),%rdx
  shr    $0x5,%r9
  mov    %r9,%rax
  shl    $0x4,%rax
  sub    %r9,%rax
  shl    $0x2,%rax
  sub    %rax,%rsi
  xor    %eax,%eax
  push   %rsi
  mov    $0x40,%esi
  call   <snprintf@plt>
  pop    %r11
  pop    %r15
  jmp    L177
L12:
  mov    $0xffffffff,%r14d
  jmp    L167
L112:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_label: D112
type_infered: string
name: unpack_data
arguments: data_label: D27
type_infered: string
name: unpack_data
arguments: data_label: D48
type_infered: string
name: unpack_data
arguments: data_label: D0
type_infered: string
name: unpack_data
arguments: data_label: D56
type_infered: string
name: unpack_data
arguments: data_label: D85
type_infered: string
name: unpack_data
arguments: data_label: D16
type_infered: string
name: unpack_data
arguments: data_label: D111
type_infered: string
name: unpack_data
arguments: data_label: D120
type_infered: string
name: unpack_data
arguments: data_label: D55
type_infered: string
name: unpack_data
arguments: data_label: D91
type_infered: string

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

tool: D27: r

tool: D48: killall -q -USR1 udhcpd

tool: D0: /tmp/udhcpd0.leases

tool: D56: /tmp/udhcpd1.leases

tool: D85: %02x:%02x:%02x:%02x:%02x:%02x

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

tool: D111: [debug] %s


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

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


tool: D91: %u days %02u:%02u:%02u


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