ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<fb_hTimeDaysInMonth>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  cmpl   $0x2,-0x14(%rbp)
  jne    L10
  mov    -0x14(%rbp),%eax
  sub    $0x1,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  lea    D18(%rip),%rax
  mov    (%rdx,%rax,1),%ebx
  mov    -0x18(%rbp),%eax
  mov    %eax,%edi
  call   <fb_hTimeLeap@plt>
  add    %ebx,%eax
  jmp    L8
L10:
  mov    -0x14(%rbp),%eax
  sub    $0x1,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  lea    D18(%rip),%rax
  mov    (%rdx,%rax,1),%eax
L8:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: parse_data
arguments: label: D18
type_infered: string

tool: D18: 

assistant: ```c
int fb_hTimeDaysInMonth(int month, int year) {
  static const int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  ((void)0);
  if (month == 2)
    return days[month - 1] + fb_hTimeLeap(year);
  return days[month - 1];
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<fb_hTimeDaysInMonth>:
  endbr64
  cmp    $0x2,%edi
  je     L8
  mov    %edi,%eax
  sub    $0x1,%eax
  cltq
  lea    D1(%rip),%rdx
  mov    (%rdx,%rax,4),%eax
  ret
L8:
  sub    $0x8,%rsp
  mov    %esi,%edi
  call   <fb_hTimeLeap@plt>
  add    $0x1c,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: parse_data
arguments: data_label: D1
data_type: string

tool: D1: 

assistant: ```c
int fb_hTimeDaysInMonth(int month, int year) {
  static const int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  ((void)0);
  if (month == 2)
    return days[month - 1] + fb_hTimeLeap(year);
  return days[month - 1];
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<fb_hTimeDaysInMonth>:
  endbr64
  cmp    $0x2,%edi
  je     L0
  mov    %edi,%eax
  lea    D6(%rip),%rdx
  sub    $0x1,%eax
  cltq
  mov    (%rdx,%rax,4),%eax
  ret
  nopl   0x0(%rax,%rax,1)
L0:
  sub    $0x8,%rsp
  mov    %esi,%edi
  call   <fb_hTimeLeap@plt>
  add    $0x8,%rsp
  add    $0x1c,%eax
  ret
```

tool_calls: name: parse_data
arguments: data_label: D6
type_guessed: string

tool: D6: 

assistant: ```c
int fb_hTimeDaysInMonth(int month, int year) {
  static const int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  ((void)0);
  if (month == 2)
    return days[month - 1] + fb_hTimeLeap(year);
  return days[month - 1];
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<fb_hTimeDaysInMonth>:
  endbr64
  cmp    $0x2,%edi
  je     L1
  mov    %edi,%eax
  lea    D1(%rip),%rdx
  sub    $0x1,%eax
  cltq
  mov    (%rdx,%rax,4),%eax
  ret
  nopl   0x0(%rax,%rax,1)
L1:
  sub    $0x8,%rsp
  mov    %esi,%edi
  call   <fb_hTimeLeap@plt>
  add    $0x8,%rsp
  add    $0x1c,%eax
  ret
```

tool_calls: name: read_data
arguments: label: D1
type: string

tool: D1: 

assistant: ```c
int fb_hTimeDaysInMonth(int month, int year) {
  static const int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  ((void)0);
  if (month == 2)
    return days[month - 1] + fb_hTimeLeap(year);
  return days[month - 1];
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<remove_component3d>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  movsd  (%rax),%xmm1
  mov    -0x20(%rbp),%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm0,%xmm1
  mov    -0x18(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm2
  mov    -0x20(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm0,%xmm1
  mov    -0x18(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm2
  mov    -0x20(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  movsd  (%rax),%xmm0
  mov    -0x20(%rbp),%rax
  movsd  (%rax),%xmm1
  mulsd  -0x8(%rbp),%xmm1
  subsd  %xmm1,%xmm0
  mov    -0x28(%rbp),%rax
  movsd  %xmm0,(%rax)
  mov    -0x18(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm0
  mov    -0x20(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm1
  mulsd  -0x8(%rbp),%xmm1
  mov    -0x28(%rbp),%rax
  add    $0x8,%rax
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x18(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm0
  mov    -0x20(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm1
  mulsd  -0x8(%rbp),%xmm1
  mov    -0x28(%rbp),%rax
  add    $0x10,%rax
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  nop
  pop    %rbp
  ret
```

assistant: ```c
void remove_component3d(double *v1, double *unit, double *result) {
  double dot;
  dot = v1[0] * unit[0] + v1[1] * unit[1] + v1[2] * unit[2];
  result[0] = v1[0] - unit[0] * dot;
  result[1] = v1[1] - unit[1] * dot;
  result[2] = v1[2] - unit[2] * dot;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<remove_component3d>:
  endbr64
  movsd  (%rdi),%xmm1
  movsd  (%rsi),%xmm2
  movsd  0x8(%rdi),%xmm0
  mulsd  0x8(%rsi),%xmm0
  movapd %xmm1,%xmm3
  mulsd  %xmm2,%xmm3
  addsd  %xmm3,%xmm0
  movsd  0x10(%rdi),%xmm3
  mulsd  0x10(%rsi),%xmm3
  addsd  %xmm3,%xmm0
  mulsd  %xmm0,%xmm2
  subsd  %xmm2,%xmm1
  movsd  %xmm1,(%rdx)
  movapd %xmm0,%xmm2
  mulsd  0x8(%rsi),%xmm2
  movsd  0x8(%rdi),%xmm1
  subsd  %xmm2,%xmm1
  movsd  %xmm1,0x8(%rdx)
  mulsd  0x10(%rsi),%xmm0
  movsd  0x10(%rdi),%xmm1
  subsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%rdx)
  ret
```

assistant: ```c
void remove_component3d(double *v1, double *unit, double *result) {
  double dot;
  dot = v1[0] * unit[0] + v1[1] * unit[1] + v1[2] * unit[2];
  result[0] = v1[0] - unit[0] * dot;
  result[1] = v1[1] - unit[1] * dot;
  result[2] = v1[2] - unit[2] * dot;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<remove_component3d>:
  endbr64
  movsd  (%rdi),%xmm1
  movsd  (%rsi),%xmm2
  movsd  0x8(%rdi),%xmm0
  mulsd  0x8(%rsi),%xmm0
  movapd %xmm1,%xmm3
  mulsd  %xmm2,%xmm3
  addsd  %xmm3,%xmm0
  movsd  0x10(%rdi),%xmm3
  mulsd  0x10(%rsi),%xmm3
  addsd  %xmm3,%xmm0
  mulsd  %xmm0,%xmm2
  subsd  %xmm2,%xmm1
  movsd  %xmm1,(%rdx)
  movsd  0x8(%rsi),%xmm2
  movsd  0x8(%rdi),%xmm1
  mulsd  %xmm0,%xmm2
  subsd  %xmm2,%xmm1
  movsd  %xmm1,0x8(%rdx)
  mulsd  0x10(%rsi),%xmm0
  movsd  0x10(%rdi),%xmm1
  subsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%rdx)
  ret
```

assistant: ```c
void remove_component3d(double *v1, double *unit, double *result) {
  double dot;
  dot = v1[0] * unit[0] + v1[1] * unit[1] + v1[2] * unit[2];
  result[0] = v1[0] - unit[0] * dot;
  result[1] = v1[1] - unit[1] * dot;
  result[2] = v1[2] - unit[2] * dot;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<remove_component3d>:
  endbr64
  movsd  (%rdi),%xmm1
  movsd  (%rsi),%xmm2
  movsd  0x8(%rdi),%xmm0
  mulsd  0x8(%rsi),%xmm0
  movapd %xmm1,%xmm3
  mulsd  %xmm2,%xmm3
  addsd  %xmm3,%xmm0
  movsd  0x10(%rdi),%xmm3
  mulsd  0x10(%rsi),%xmm3
  addsd  %xmm3,%xmm0
  mulsd  %xmm0,%xmm2
  subsd  %xmm2,%xmm1
  movsd  %xmm1,(%rdx)
  movsd  0x8(%rsi),%xmm2
  movsd  0x8(%rdi),%xmm1
  mulsd  %xmm0,%xmm2
  subsd  %xmm2,%xmm1
  movsd  %xmm1,0x8(%rdx)
  mulsd  0x10(%rsi),%xmm0
  movsd  0x10(%rdi),%xmm1
  subsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%rdx)
  ret
```

assistant: ```c
void remove_component3d(double *v1, double *unit, double *result) {
  double dot;
  dot = v1[0] * unit[0] + v1[1] * unit[1] + v1[2] * unit[2];
  result[0] = v1[0] - unit[0] * dot;
  result[1] = v1[1] - unit[1] * dot;
  result[2] = v1[2] - unit[2] * dot;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<print_table>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x1c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  sub    $0x4,%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,%edi
  call   <digit_count@plt>
  add    $0x1,%eax
  mov    %eax,-0x4(%rbp)
  movl   $0x0,-0xc(%rbp)
  jmp    L35
L20:
  movl   $0x0,-0x8(%rbp)
  jmp    L33
L21:
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x8(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x4(%rbp),%eax
  mov    %eax,%esi
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  addl   $0x1,-0x8(%rbp)
L33:
  mov    -0x8(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L21
  mov    $0xa,%edi
  call   <putchar@plt>
  addl   $0x1,-0xc(%rbp)
L35:
  mov    -0xc(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L20
  nop
  nop
  leave
  ret
```

tool_calls: name: unpack_data
arguments: tag: D2
data_type: string

tool: D2: %*d

assistant: ```c
void print_table(int **table, int width) {
  int padding = digit_count(table[width - 1][width - 1]) + 1;
  for (int row = 0; row < width; ++row) {
    for (int col = 0; col < width; ++col) {
      printf("%*d", padding, table[row][col]);
    }
    printf("\n");
  }
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<print_table>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r12
  mov    %esi,%ebx
  movslq %esi,%rax
  mov    -0x8(%rdi,%rax,8),%rdx
  mov    -0x4(%rdx,%rax,4),%edi
  call   <digit_count@plt>
  test   %ebx,%ebx
  jle    L6
  lea    0x1(%rax),%r13d
  mov    %r12,%rbp
  lea    -0x1(%rbx),%eax
  lea    0x8(%r12,%rax,8),%r15
  mov    %ebx,%ebx
  lea    0x0(,%rbx,4),%r12
  lea    D1(%rip),%r14
L13:
  mov    $0x0,%ebx
L29:
  mov    0x0(%rbp),%rax
  mov    (%rax,%rbx,1),%edx
  mov    %r13d,%esi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x4,%rbx
  cmp    %rbx,%r12
  jne    L29
  mov    $0xa,%edi
  call   <putchar@plt>
  add    $0x8,%rbp
  cmp    %r15,%rbp
  jne    L13
L6:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: read_data
arguments: tag: D1
type_infered: string

tool: D1: %*d

assistant: ```c
void print_table(int **table, int width) {
  int padding = digit_count(table[width - 1][width - 1]) + 1;
  for (int row = 0; row < width; ++row) {
    for (int col = 0; col < width; ++col) {
      printf("%*d", padding, table[row][col]);
    }
    printf("\n");
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<print_table>:
  endbr64
  push   %r15
  movslq %esi,%rax
  mov    %rdi,%r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rax,%rbx
  sub    $0x8,%rsp
  mov    -0x8(%rdi,%rax,8),%rdx
  mov    -0x4(%rdx,%rax,4),%edi
  call   <digit_count@plt>
  test   %ebx,%ebx
  jle    L11
  lea    0x1(%rax),%r12d
  lea    -0x1(%rbx),%eax
  mov    %ebx,%ebx
  lea    0x8(%r15,%rax,8),%r14
  lea    0x0(,%rbx,4),%rbp
  lea    D4(%rip),%r13
  nopw   0x0(%rax,%rax,1)
L20:
  xor    %ebx,%ebx
  nopw   0x0(%rax,%rax,1)
L15:
  mov    (%r15),%rax
  mov    %r12d,%esi
  mov    %r13,%rdi
  mov    (%rax,%rbx,1),%edx
  xor    %eax,%eax
  add    $0x4,%rbx
  call   <printf@plt>
  cmp    %rbx,%rbp
  jne    L15
  mov    $0xa,%edi
  add    $0x8,%r15
  call   <putchar@plt>
  cmp    %r14,%r15
  jne    L20
L11:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D4
data_type: string

tool: D4: %*d

assistant: ```c
void print_table(int **table, int width) {
  int padding = digit_count(table[width - 1][width - 1]) + 1;
  for (int row = 0; row < width; ++row) {
    for (int col = 0; col < width; ++col) {
      printf("%*d", padding, table[row][col]);
    }
    printf("\n");
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<print_table>:
  endbr64
  push   %r15
  movslq %esi,%rax
  mov    %rdi,%r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rax,%rbx
  sub    $0x8,%rsp
  mov    -0x8(%rdi,%rax,8),%rdx
  mov    -0x4(%rdx,%rax,4),%edi
  call   <digit_count@plt>
  test   %ebx,%ebx
  jle    L27
  lea    0x1(%rax),%r12d
  lea    -0x1(%rbx),%eax
  mov    %ebx,%ebx
  lea    0x8(%r15,%rax,8),%r14
  lea    0x0(,%rbx,4),%rbp
  lea    D4(%rip),%r13
  nopw   0x0(%rax,%rax,1)
L18:
  xor    %ebx,%ebx
  nopw   0x0(%rax,%rax,1)
L8:
  mov    (%r15),%rax
  mov    %r12d,%esi
  mov    %r13,%rdi
  mov    (%rax,%rbx,1),%edx
  xor    %eax,%eax
  add    $0x4,%rbx
  call   <printf@plt>
  cmp    %rbx,%rbp
  jne    L8
  mov    $0xa,%edi
  add    $0x8,%r15
  call   <putchar@plt>
  cmp    %r14,%r15
  jne    L18
L27:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: read_data
arguments: label: D4
datatype: string

tool: D4: %*d

assistant: ```c
void print_table(int **table, int width) {
  int padding = digit_count(table[width - 1][width - 1]) + 1;
  for (int row = 0; row < width; ++row) {
    for (int col = 0; col < width; ++col) {
      printf("%*d", padding, table[row][col]);
    }
    printf("\n");
  }
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<__gnu_strerror_r>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x4(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    %rdx,-0x18(%rbp)
  mov    -0x18(%rbp),%rdx
  mov    -0x10(%rbp),%rcx
  mov    -0x4(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <__xsi_strerror_r@plt>
  mov    D7(%rip),%rdx
  mov    %rax,(%rdx)
  mov    D7(%rip),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L3
  mov    -0x10(%rbp),%rax
  jmp    L4
L3:
  mov    $0x0,%eax
L4:
  leave
  ret
```

assistant: ```c
char *__gnu_strerror_r(int errnum, char *buf, size_t buflen) {
  errno = __xsi_strerror_r(errnum, buf, buflen);
  return errno ? NULL : buf;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<__gnu_strerror_r>:
  endbr64
  push   %rbx
  mov    %rsi,%rbx
  call   <__xsi_strerror_r@plt>
  mov    D0(%rip),%rdx
  mov    %rax,(%rdx)
  test   %rax,%rax
  mov    $0x0,%eax
  cmovne %rax,%rbx
  mov    %rbx,%rax
  pop    %rbx
  ret
```

assistant: ```c
char *__gnu_strerror_r(int errnum, char *buf, size_t buflen) {
  errno = __xsi_strerror_r(errnum, buf, buflen);
  return errno ? NULL : buf;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<__gnu_strerror_r>:
  endbr64
  push   %r12
  mov    %rsi,%r12
  call   <__xsi_strerror_r@plt>
  mov    D7(%rip),%rdx
  test   %rax,%rax
  mov    %rax,(%rdx)
  mov    $0x0,%eax
  cmovne %rax,%r12
  mov    %r12,%rax
  pop    %r12
  ret
```

assistant: ```c
char *__gnu_strerror_r(int errnum, char *buf, size_t buflen) {
  errno = __xsi_strerror_r(errnum, buf, buflen);
  return errno ? NULL : buf;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<__gnu_strerror_r>:
  endbr64
  push   %r12
  mov    %rsi,%r12
  call   <__xsi_strerror_r@plt>
  mov    D7(%rip),%rdx
  test   %rax,%rax
  mov    %rax,(%rdx)
  mov    $0x0,%eax
  cmovne %rax,%r12
  mov    %r12,%rax
  pop    %r12
  ret
```

assistant: ```c
char *__gnu_strerror_r(int errnum, char *buf, size_t buflen) {
  errno = __xsi_strerror_r(errnum, buf, buflen);
  return errno ? NULL : buf;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<inet_parseaddr>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %rcx,-0x40(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <strdup@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    $0x3a,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x10(%rbp)
  movl   $0x0,-0x14(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  je     L25
  mov    D0(%rip),%rax
  mov    (%rax),%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,0x8(%rax)
  cmpq   $0x0,-0x10(%rbp)
  je     L8
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movb   $0x0,(%rax)
  jmp    L2
L8:
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x10(%rbp)
L2:
  mov    -0x38(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <inet_service@plt>
  mov    -0x28(%rbp),%rdx
  mov    %eax,(%rdx)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <inet_hostaddr@plt>
  mov    -0x28(%rbp),%rdx
  mov    %eax,0x4(%rdx)
  mov    -0x28(%rbp),%rax
  mov    0x4(%rax),%edx
  mov    D10(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  je     L25
  mov    -0x28(%rbp),%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jle    L25
  movl   $0x1,-0x14(%rbp)
L25:
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x14(%rbp),%eax
  leave
  ret
```

assistant: ```c
int inet_parseaddr(struct sockaddr_in *sa, const char *addr, const char *proto, const char *def_service) {
  char *host = strdup(addr);
  char *serv = strchr(host, ':');
  int ok = 0;
  if (host) {
    sa->sin_family = AF_INET;
    if (serv)
      *serv++ = '\0';
    else
      serv = (char *)def_service;
    sa->sin_port = inet_service(serv, proto);
    sa->sin_addr.s_addr = inet_hostaddr(host);
    if (sa->sin_addr.s_addr != INADDR_NONE && sa->sin_port > 0)
      ok = 1;
  }
  free(host);
  return ok;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<inet_parseaddr>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  mov    %rsi,%rdi
  mov    %rdx,%r13
  mov    %rcx,%r12
  call   <strdup@plt>
  mov    %rax,%rbx
  mov    $0x3a,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  test   %rbx,%rbx
  je     L12
  mov    D18(%rip),%rdx
  mov    (%rdx),%edx
  mov    %edx,0x8(%rbp)
  test   %rax,%rax
  je     L15
  lea    0x1(%rax),%r12
  movb   $0x0,(%rax)
L15:
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <inet_service@plt>
  mov    %eax,0x0(%rbp)
  mov    %rbx,%rdi
  call   <inet_hostaddr@plt>
  mov    %eax,0x4(%rbp)
  mov    $0x0,%r12d
  mov    D3(%rip),%rdx
  cmp    (%rdx),%eax
  je     L35
  cmpl   $0x0,0x0(%rbp)
  setg   %r12b
  movzbl %r12b,%r12d
L35:
  mov    %rbx,%rdi
  call   <free@plt>
  mov    %r12d,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L12:
  mov    $0x0,%r12d
  jmp    L35
```

assistant: ```c
int inet_parseaddr(struct sockaddr_in *sa, const char *addr, const char *proto, const char *def_service) {
  char *host = strdup(addr);
  char *serv = strchr(host, ':');
  int ok = 0;
  if (host) {
    sa->sin_family = AF_INET;
    if (serv)
      *serv++ = '\0';
    else
      serv = (char *)def_service;
    sa->sin_port = inet_service(serv, proto);
    sa->sin_addr.s_addr = inet_hostaddr(host);
    if (sa->sin_addr.s_addr != INADDR_NONE && sa->sin_port > 0)
      ok = 1;
  }
  free(host);
  return ok;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<inet_parseaddr>:
  endbr64
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %rcx,%r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    %rsi,%rdi
  sub    $0x8,%rsp
  call   <strdup@plt>
  mov    $0x3a,%esi
  mov    %rax,%rbp
  mov    %rax,%rdi
  call   <strchr@plt>
  test   %rbp,%rbp
  je     L38
  mov    D9(%rip),%rdx
  mov    (%rdx),%edx
  mov    %edx,0x8(%rbx)
  test   %rax,%rax
  je     L24
  movb   $0x0,(%rax)
  lea    0x1(%rax),%r12
L24:
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <inet_service@plt>
  mov    %rbp,%rdi
  mov    %eax,(%rbx)
  call   <inet_hostaddr@plt>
  mov    D5(%rip),%rdx
  mov    %eax,0x4(%rbx)
  cmp    (%rdx),%eax
  je     L38
  mov    (%rbx),%eax
  xor    %r12d,%r12d
  test   %eax,%eax
  setg   %r12b
L4:
  mov    %rbp,%rdi
  call   <free@plt>
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L38:
  xor    %r12d,%r12d
  jmp    L4
```

assistant: ```c
int inet_parseaddr(struct sockaddr_in *sa, const char *addr, const char *proto, const char *def_service) {
  char *host = strdup(addr);
  char *serv = strchr(host, ':');
  int ok = 0;
  if (host) {
    sa->sin_family = AF_INET;
    if (serv)
      *serv++ = '\0';
    else
      serv = (char *)def_service;
    sa->sin_port = inet_service(serv, proto);
    sa->sin_addr.s_addr = inet_hostaddr(host);
    if (sa->sin_addr.s_addr != INADDR_NONE && sa->sin_port > 0)
      ok = 1;
  }
  free(host);
  return ok;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<inet_parseaddr>:
  endbr64
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %rcx,%r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    %rsi,%rdi
  sub    $0x8,%rsp
  call   <strdup@plt>
  mov    $0x3a,%esi
  mov    %rax,%rbp
  mov    %rax,%rdi
  call   <strchr@plt>
  test   %rbp,%rbp
  je     L28
  mov    D9(%rip),%rdx
  mov    (%rdx),%edx
  mov    %edx,0x8(%rbx)
  test   %rax,%rax
  je     L32
  movb   $0x0,(%rax)
  lea    0x1(%rax),%r12
L32:
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <inet_service@plt>
  mov    %rbp,%rdi
  mov    %eax,(%rbx)
  call   <inet_hostaddr@plt>
  mov    D1(%rip),%rdx
  mov    %eax,0x4(%rbx)
  cmp    (%rdx),%eax
  je     L28
  mov    (%rbx),%eax
  xor    %r12d,%r12d
  test   %eax,%eax
  setg   %r12b
L20:
  mov    %rbp,%rdi
  call   <free@plt>
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L28:
  xor    %r12d,%r12d
  jmp    L20
```

assistant: ```c
int inet_parseaddr(struct sockaddr_in *sa, const char *addr, const char *proto, const char *def_service) {
  char *host = strdup(addr);
  char *serv = strchr(host, ':');
  int ok = 0;
  if (host) {
    sa->sin_family = AF_INET;
    if (serv)
      *serv++ = '\0';
    else
      serv = (char *)def_service;
    sa->sin_port = inet_service(serv, proto);
    sa->sin_addr.s_addr = inet_hostaddr(host);
    if (sa->sin_addr.s_addr != INADDR_NONE && sa->sin_port > 0)
      ok = 1;
  }
  free(host);
  return ok;
}
```