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

```asm
<print_state>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    $0x0,%edi
  call   <time@plt>
  mov    %eax,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  movl   $0x0,-0xc(%rbp)
  lea    -0x14(%rbp),%rax
  mov    %rax,%rdi
  call   <ctime@plt>
  mov    %eax,%ecx
  lea    D38(%rip),%rax
  mov    %rax,%rdx
  mov    $0x40,%esi
  mov    $0x2,%edi
  mov    $0x0,%eax
  call   <report@plt>
  mov    -0x28(%rbp),%rax
  mov    $0x1,%r8d
  mov    %rax,%rcx
  lea    D55(%rip),%rax
  mov    %rax,%rdx
  mov    $0x44,%esi
  mov    $0x2,%edi
  mov    $0x0,%eax
  call   <report@plt>
  mov    -0x28(%rbp),%rax
  add    $0x1,%rax
  mov    $0x8,%r8d
  mov    %rax,%rcx
  lea    D69(%rip),%rax
  mov    %rax,%rdx
  mov    $0x44,%esi
  mov    $0x2,%edi
  mov    $0x0,%eax
  call   <report@plt>
  mov    -0x28(%rbp),%rax
  add    $0x9,%rax
  mov    $0x4,%r8d
  mov    %rax,%rcx
  lea    D27(%rip),%rax
  mov    %rax,%rdx
  mov    $0x44,%esi
  mov    $0x2,%edi
  mov    $0x0,%eax
  call   <report@plt>
  mov    -0x28(%rbp),%rax
  add    $0xd,%rax
  mov    $0x1,%r8d
  mov    %rax,%rcx
  lea    D31(%rip),%rax
  mov    %rax,%rdx
  mov    $0x44,%esi
  mov    $0x2,%edi
  mov    $0x0,%eax
  call   <report@plt>
  mov    -0x28(%rbp),%rax
  add    $0xe,%rax
  mov    $0x1,%r8d
  mov    %rax,%rcx
  lea    D64(%rip),%rax
  mov    %rax,%rdx
  mov    $0x44,%esi
  mov    $0x2,%edi
  mov    $0x0,%eax
  call   <report@plt>
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  cmp    $0x20,%eax
  je     L114
  cmp    $0x20,%eax
  jg     L111
  cmp    $0x10,%eax
  je     L71
  cmp    $0x10,%eax
  jg     L111
  test   %eax,%eax
  je     L120
  cmp    $0x8,%eax
  je     L109
  jmp    L111
L120:
  lea    D24(%rip),%rax
  mov    %rax,%rdx
  mov    $0x20,%esi
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <report@plt>
  jmp    L111
L109:
  lea    D90(%rip),%rax
  mov    %rax,%rdx
  mov    $0x20,%esi
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <report@plt>
  jmp    L111
L71:
  lea    D22(%rip),%rax
  mov    %rax,%rdx
  mov    $0x20,%esi
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <report@plt>
  jmp    L111
L114:
  mov    -0x28(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  movzbl %al,%edx
  mov    -0x28(%rbp),%rax
  add    $0x2,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x8,%eax
  or     %eax,%edx
  mov    -0x28(%rbp),%rax
  add    $0x3,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x10,%eax
  or     %eax,%edx
  mov    -0x28(%rbp),%rax
  add    $0x4,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x18,%eax
  or     %edx,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x28(%rbp),%rax
  add    $0x5,%rax
  movzbl (%rax),%eax
  movzbl %al,%edx
  mov    -0x28(%rbp),%rax
  add    $0x6,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x8,%eax
  or     %eax,%edx
  mov    -0x28(%rbp),%rax
  add    $0x7,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x10,%eax
  or     %eax,%edx
  mov    -0x28(%rbp),%rax
  add    $0x8,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x18,%eax
  or     %edx,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x10(%rbp),%eax
  movzwl %ax,%eax
  test   %eax,%eax
  jne    L46
  mov    -0xc(%rbp),%eax
  movzwl %ax,%eax
  test   %eax,%eax
  jne    L46
  sarl   $0x10,-0x10(%rbp)
  sarl   $0x10,-0xc(%rbp)
L46:
  mov    -0xc(%rbp),%edx
  mov    -0x10(%rbp),%eax
  mov    %edx,%r8d
  mov    %eax,%ecx
  lea    D21(%rip),%rax
  mov    %rax,%rdx
  mov    $0x20,%esi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <report@plt>
  nop
L111:
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L107
  call   <__stack_chk_fail@plt>
L107:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: tag: D38
type: string
name: unpack_data
arguments: tag: D55
type: string
name: unpack_data
arguments: tag: D69
type: string
name: unpack_data
arguments: tag: D27
type: string
name: unpack_data
arguments: tag: D31
type: string
name: unpack_data
arguments: tag: D64
type: string
name: unpack_data
arguments: tag: D24
type: string
name: unpack_data
arguments: tag: D90
type: string
name: unpack_data
arguments: tag: D22
type: string
name: unpack_data
arguments: tag: D21
type: string

tool: D38: Modem State


tool: D55: c0 12 0007 : 

tool: D69: c0 12 000b : 

tool: D27: c0 12 000d : 

tool: D31: c0 01 000e : 

tool: D64: c0 01 000f : 

tool: D24: ADSL line is down


tool: D90: ADSL line is blocked?


tool: D22: ADSL line is synchronising


tool: D21: ADSL line is up (%d kbit/s down | %d kbit/s up)


assistant: ```c
int print_state(unsigned char *buf) {
  time_t t = time(NULL);
  int down_speed = 0, up_speed = 0;
  report(2, ((unsigned int)0x00000040), "Modem State\n", ctime(&t));
  report(2, ((unsigned int)0x00000040) | ((unsigned int)0x00000004), "c0 12 0007 : ", buf + 0, 1);
  report(2, ((unsigned int)0x00000040) | ((unsigned int)0x00000004), "c0 12 000b : ", buf + 1, 8);
  report(2, ((unsigned int)0x00000040) | ((unsigned int)0x00000004), "c0 12 000d : ", buf + 9, 4);
  report(2, ((unsigned int)0x00000040) | ((unsigned int)0x00000004), "c0 01 000e : ", buf + 13, 1);
  report(2, ((unsigned int)0x00000040) | ((unsigned int)0x00000004), "c0 01 000f : ", buf + 14, 1);
  switch (buf[0]) {
  case 0x00:
    report(1, ((unsigned int)0x00000020), "ADSL line is down\n");
    break;
  case 0x08:
    report(1, ((unsigned int)0x00000020), "ADSL line is blocked?\n");
    break;
  case 0x10:
    report(1, ((unsigned int)0x00000020), "ADSL line is synchronising\n");
    break;
  case 0x20:
    down_speed = buf[1] | (buf[1 + 1] << 8) | (buf[1 + 2] << 16) | (buf[1 + 3] << 24);
    up_speed = buf[1 + 4] | (buf[1 + 5] << 8) | (buf[1 + 6] << 16) | (buf[1 + 7] << 24);
    if (((down_speed & 0x0000ffff) == 0) && ((up_speed & 0x0000ffff) == 0)) {
      down_speed >>= 16;
      up_speed >>= 16;
    }
    report(0, ((unsigned int)0x00000020), "ADSL line is up (%d kbit/s down | %d kbit/s up)\n", down_speed, up_speed);
    break;
  }
  return (0);
}
```