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

```asm
<r_nonsep>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %esi,%ebp
  mov    %edx,0x1c(%rsp)
  test   %esi,%esi
  jle    L79
  mov    %rdi,%r14
  mov    %rdi,%r15
  mov    %edx,%r12d
  pxor   %xmm7,%xmm7
  movsd  %xmm7,0x8(%rsp)
  movl   $0x0,0x10(%rsp)
L36:
  mov    %r15,%r13
  movsd  0x8(%rsp),%xmm5
  addsd  (%r15),%xmm5
  movsd  %xmm5,0x8(%rsp)
  cmpl   $0x1,0x1c(%rsp)
  jle    L68
  mov    0x10(%rsp),%eax
  lea    0x1(%rax),%ebx
L26:
  mov    %ebx,%eax
  cltd
  idiv   %ebp
  movslq %edx,%rdx
  movsd  0x0(%r13),%xmm0
  subsd  (%r14,%rdx,8),%xmm0
  call   <fabs@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
  addsd  0x8(%rsp),%xmm0
  movsd  %xmm0,0x8(%rsp)
  add    $0x1,%ebx
  cmp    %r12d,%ebx
  jne    L26
L68:
  addl   $0x1,0x10(%rsp)
  mov    0x10(%rsp),%eax
  add    $0x8,%r15
  add    $0x1,%r12d
  cmp    %eax,%ebp
  jne    L36
L0:
  pxor   %xmm6,%xmm6
  cvtsi2sdl 0x1c(%rsp),%xmm6
  movsd  %xmm6,0x10(%rsp)
  movapd %xmm6,%xmm0
  mulsd  D28(%rip),%xmm0
  cvttsd2si %xmm0,%edi
  call   <ceil@plt>
  movsd  0x10(%rsp),%xmm6
  movapd %xmm6,%xmm1
  addsd  %xmm6,%xmm1
  movsd  D5(%rip),%xmm3
  addsd  %xmm3,%xmm1
  movapd %xmm0,%xmm2
  addsd  %xmm0,%xmm2
  subsd  %xmm2,%xmm1
  pxor   %xmm2,%xmm2
  cvtsi2sd %ebp,%xmm2
  mulsd  %xmm2,%xmm0
  mulsd  %xmm0,%xmm1
  divsd  %xmm6,%xmm1
  movsd  0x8(%rsp),%xmm0
  divsd  %xmm1,%xmm0
  comisd %xmm3,%xmm0
  jbe    L55
  movsd  D5(%rip),%xmm0
L63:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L79:
  pxor   %xmm7,%xmm7
  movsd  %xmm7,0x8(%rsp)
  jmp    L0
L55:
  pxor   %xmm1,%xmm1
  comisd %xmm0,%xmm1
  jbe    L63
  movapd %xmm1,%xmm0
  jmp    L63
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D28
type_guessed: f32[2]
name: extract_symbolic_data
arguments: data_label: D5
type_guessed: f64

tool: {"D28": [0.0,1.75]}

tool: D5: 1

assistant: ```c
double r_nonsep(double *y, int y_size, const int A) {
  int i, j;
  double result;
  double numerator = 0.0;
  for (i = 0; i < y_size; i++) {
    numerator += y[i];
    for (j = 0; j <= A - 2; j++)
      numerator += fabs(y[i] - y[(i + j + 1) % y_size]);
  }
  const double tmp = ceil(A / 2.0);
  const double denominator = y_size * tmp * (1.0 + 2.0 * A - 2.0 * tmp) / A;
  result = numerator / denominator;
  if (result > 1)
    result = 1;
  if (result < 0)
    result = 0;
  return result;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<r_nonsep>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %edx,%r13d
  push   %r12
  push   %rbp
  push   %rbx
  mov    %esi,%ebx
  sub    $0x28,%rsp
  test   %esi,%esi
  jle    L38
  movslq %esi,%rax
  pxor   %xmm6,%xmm6
  mov    %rdi,%r14
  mov    %edx,%r12d
  mov    %rax,0x10(%rsp)
  xor    %ebp,%ebp
  movapd %xmm6,%xmm1
  movsd  %xmm6,0x18(%rsp)
  nopl   (%rax)
L12:
  movsd  (%r14,%rbp,8),%xmm0
  addsd  %xmm0,%xmm1
  cmp    $0x1,%r13d
  jle    L56
  lea    0x1(%rbp),%r15d
  jmp    L28
  cs nopw 0x0(%rax,%rax,1)
L37:
  movsd  (%r14,%rbp,8),%xmm0
L28:
  mov    %r15d,%eax
  movsd  %xmm1,0x8(%rsp)
  add    $0x1,%r15d
  cltd
  idiv   %ebx
  movslq %edx,%rdx
  subsd  (%r14,%rdx,8),%xmm0
  call   <fabs@plt>
  pxor   %xmm0,%xmm0
  movsd  0x8(%rsp),%xmm1
  cvtsi2sd %rax,%xmm0
  addsd  %xmm0,%xmm1
  cmp    %r15d,%r12d
  jne    L37
L56:
  add    $0x1,%rbp
  add    $0x1,%r12d
  cmp    %rbp,0x10(%rsp)
  jne    L12
L60:
  pxor   %xmm3,%xmm3
  movsd  %xmm1,0x10(%rsp)
  cvtsi2sd %r13d,%xmm3
  movapd %xmm3,%xmm0
  movsd  %xmm3,0x8(%rsp)
  mulsd  D15(%rip),%xmm0
  cvttsd2si %xmm0,%edi
  call   <ceil@plt>
  movsd  0x8(%rsp),%xmm3
  movsd  D7(%rip),%xmm5
  movapd %xmm0,%xmm4
  movsd  0x10(%rsp),%xmm1
  movapd %xmm3,%xmm2
  addsd  %xmm0,%xmm4
  addsd  %xmm3,%xmm2
  addsd  %xmm5,%xmm2
  subsd  %xmm4,%xmm2
  pxor   %xmm4,%xmm4
  cvtsi2sd %ebx,%xmm4
  mulsd  %xmm4,%xmm0
  mulsd  %xmm0,%xmm2
  divsd  %xmm3,%xmm2
  divsd  %xmm2,%xmm1
  comisd %xmm5,%xmm1
  jbe    L4
  add    $0x28,%rsp
  movapd %xmm5,%xmm0
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L4:
  movsd  0x18(%rsp),%xmm7
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  maxsd  %xmm1,%xmm7
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  movapd %xmm7,%xmm0
  ret
L38:
  pxor   %xmm7,%xmm7
  movsd  %xmm7,0x18(%rsp)
  movapd %xmm7,%xmm1
  jmp    L60
```

tool_calls: name: retrieve_data
arguments: data_label: D15
datatype: f32[2]
name: retrieve_data
arguments: data_label: D7
datatype: f64

tool: {"D15": [0.0,1.75]}

tool: D7: 1

assistant: ```c
double r_nonsep(double *y, int y_size, const int A) {
  int i, j;
  double result;
  double numerator = 0.0;
  for (i = 0; i < y_size; i++) {
    numerator += y[i];
    for (j = 0; j <= A - 2; j++)
      numerator += fabs(y[i] - y[(i + j + 1) % y_size]);
  }
  const double tmp = ceil(A / 2.0);
  const double denominator = y_size * tmp * (1.0 + 2.0 * A - 2.0 * tmp) / A;
  result = numerator / denominator;
  if (result > 1)
    result = 1;
  if (result < 0)
    result = 0;
  return result;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<r_nonsep>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %edx,%r13d
  push   %r12
  push   %rbp
  push   %rbx
  mov    %esi,%ebx
  sub    $0x28,%rsp
  test   %esi,%esi
  jle    L17
  movslq %esi,%rax
  pxor   %xmm6,%xmm6
  mov    %rdi,%r14
  mov    %edx,%r12d
  mov    %rax,0x10(%rsp)
  xor    %ebp,%ebp
  movapd %xmm6,%xmm1
  movsd  %xmm6,0x18(%rsp)
  nopl   (%rax)
L8:
  movsd  (%r14,%rbp,8),%xmm0
  addsd  %xmm0,%xmm1
  cmp    $0x1,%r13d
  jle    L49
  lea    0x1(%rbp),%r15d
  jmp    L68
  cs nopw 0x0(%rax,%rax,1)
L47:
  movsd  (%r14,%rbp,8),%xmm0
L68:
  mov    %r15d,%eax
  movsd  %xmm1,0x8(%rsp)
  add    $0x1,%r15d
  cltd
  idiv   %ebx
  movslq %edx,%rdx
  subsd  (%r14,%rdx,8),%xmm0
  call   <fabs@plt>
  pxor   %xmm0,%xmm0
  movsd  0x8(%rsp),%xmm1
  cvtsi2sd %rax,%xmm0
  addsd  %xmm0,%xmm1
  cmp    %r15d,%r12d
  jne    L47
L49:
  add    $0x1,%rbp
  add    $0x1,%r12d
  cmp    %rbp,0x10(%rsp)
  jne    L8
L19:
  pxor   %xmm3,%xmm3
  movsd  %xmm1,0x10(%rsp)
  cvtsi2sd %r13d,%xmm3
  movapd %xmm3,%xmm0
  movsd  %xmm3,0x8(%rsp)
  mulsd  D9(%rip),%xmm0
  cvttsd2si %xmm0,%edi
  call   <ceil@plt>
  movsd  0x8(%rsp),%xmm3
  movsd  D18(%rip),%xmm5
  movapd %xmm0,%xmm4
  movsd  0x10(%rsp),%xmm1
  movapd %xmm3,%xmm2
  addsd  %xmm0,%xmm4
  addsd  %xmm3,%xmm2
  addsd  %xmm5,%xmm2
  subsd  %xmm4,%xmm2
  pxor   %xmm4,%xmm4
  cvtsi2sd %ebx,%xmm4
  mulsd  %xmm4,%xmm0
  mulsd  %xmm0,%xmm2
  divsd  %xmm3,%xmm2
  divsd  %xmm2,%xmm1
  comisd %xmm5,%xmm1
  jbe    L30
  add    $0x28,%rsp
  movapd %xmm5,%xmm0
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L30:
  movsd  0x18(%rsp),%xmm7
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  maxsd  %xmm1,%xmm7
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  movapd %xmm7,%xmm0
  ret
L17:
  pxor   %xmm7,%xmm7
  movsd  %xmm7,0x18(%rsp)
  movapd %xmm7,%xmm1
  jmp    L19
```

tool_calls: name: parse_data
arguments: label: D9
type_infered: f32[2]
name: parse_data
arguments: label: D18
type_infered: f64

tool: {"D9": [0.0,1.75]}

tool: D18: 1

assistant: ```c
double r_nonsep(double *y, int y_size, const int A) {
  int i, j;
  double result;
  double numerator = 0.0;
  for (i = 0; i < y_size; i++) {
    numerator += y[i];
    for (j = 0; j <= A - 2; j++)
      numerator += fabs(y[i] - y[(i + j + 1) % y_size]);
  }
  const double tmp = ceil(A / 2.0);
  const double denominator = y_size * tmp * (1.0 + 2.0 * A - 2.0 * tmp) / A;
  result = numerator / denominator;
  if (result > 1)
    result = 1;
  if (result < 0)
    result = 0;
  return result;
}
```
user: Translate the below assembly code into C programming language:

```asm
<ytht_utc_time_s>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0xc(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <gmtime_r@plt>
  lea    -0xc(%rbp),%rdx
  mov    -0x20(%rbp),%rsi
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rcx
  lea    D3(%rip),%rdx
  mov    %rax,%rdi
  call   <strftime@plt>
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L7
  call   <__stack_chk_fail@plt>
L7:
  leave
  ret
```

tool_calls: name: parse_data
arguments: tag: D3
datatype: string

tool: D3: %a, %d %b %Y %H:%M:%S %Z

assistant: ```c
size_t ytht_utc_time_s(char *buf, const size_t len, const time_t *t) {
  struct tm tm;
  gmtime_r(t, &tm);
  return strftime(buf, len, "%a, %d %b %Y %H:%M:%S %Z", &tm);
}
```
user: Translate the below assembly code into C programming language:

```asm
<ytht_utc_time_s>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %rdi,%rbx
  mov    %rsi,%rbp
  mov    %rdx,%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%r12
  mov    %r12,%rsi
  call   <gmtime_r@plt>
  mov    %r12,%rcx
  lea    D6(%rip),%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <strftime@plt>
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L6
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L6:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D6
datatype: string

tool: D6: %a, %d %b %Y %H:%M:%S %Z

assistant: ```c
size_t ytht_utc_time_s(char *buf, const size_t len, const time_t *t) {
  struct tm tm;
  gmtime_r(t, &tm);
  return strftime(buf, len, "%a, %d %b %Y %H:%M:%S %Z", &tm);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<ytht_utc_time_s>:
  endbr64
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %rdi,%rbp
  mov    %rdx,%rdi
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%r13
  mov    %r13,%rsi
  call   <gmtime_r@plt>
  mov    %r13,%rcx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  lea    D6(%rip),%rdx
  call   <strftime@plt>
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L9
  add    $0x10,%rsp
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L9:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: tag: D6
type_infered: string

tool: D6: %a, %d %b %Y %H:%M:%S %Z

assistant: ```c
size_t ytht_utc_time_s(char *buf, const size_t len, const time_t *t) {
  struct tm tm;
  gmtime_r(t, &tm);
  return strftime(buf, len, "%a, %d %b %Y %H:%M:%S %Z", &tm);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<ytht_utc_time_s>:
  endbr64
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %rdi,%rbp
  mov    %rdx,%rdi
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%r13
  mov    %r13,%rsi
  call   <gmtime_r@plt>
  mov    %r13,%rcx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  lea    D4(%rip),%rdx
  call   <strftime@plt>
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L6
  add    $0x10,%rsp
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L6:
  call   <__stack_chk_fail@plt>
```

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

tool: D4: %a, %d %b %Y %H:%M:%S %Z

assistant: ```c
size_t ytht_utc_time_s(char *buf, const size_t len, const time_t *t) {
  struct tm tm;
  gmtime_r(t, &tm);
  return strftime(buf, len, "%a, %d %b %Y %H:%M:%S %Z", &tm);
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x34(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    D16(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x1c(%rbp)
  cmpl   $0x1,-0x34(%rbp)
  jle    L124
  cmpl   $0x3,-0x34(%rbp)
  jg     L124
  cmpl   $0x3,-0x34(%rbp)
  jne    L53
  mov    -0x40(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%rax
  lea    -0x10(%rbp),%rcx
  mov    $0xa,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strtol@plt>
  mov    %eax,-0x20(%rbp)
  mov    -0x40(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L23
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L23
  jmp    L97
L53:
  mov    D24(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x20(%rbp)
L23:
  mov    -0x40(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  lea    -0x10(%rbp),%rcx
  mov    $0xa,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strtol@plt>
  mov    %eax,-0x24(%rbp)
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L113
  mov    -0x20(%rbp),%eax
  mov    %eax,%edi
  call   <htons@plt>
  mov    %eax,%edx
  mov    D36(%rip),%rax
  mov    (%rax),%ecx
  mov    D32(%rip),%rax
  mov    (%rax),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <socket@plt>
  mov    %eax,-0x18(%rbp)
  cmpl   $0xffffffff,-0x18(%rbp)
  je     L4
  mov    -0x18(%rbp),%edx
  mov    -0x24(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <send_socket@plt>
  mov    %eax,-0x14(%rbp)
  cmpl   $0xffffffff,-0x14(%rbp)
  jne    L72
  mov    -0x18(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  jmp    L97
L72:
  mov    D17(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x1c(%rbp)
  jmp    L97
L124:
  nop
  jmp    L97
L113:
  nop
  jmp    L97
L4:
  nop
L97:
  mov    -0x24(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  mov    -0x1c(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L1
  call   <__stack_chk_fail@plt>
L1:
  leave
  ret
```

assistant: ```c
int main(int argc, char **argv) {
  int rc;
  int fd, raw_fd;
  char *endp;
  int protocol;
  int ret = EXIT_FAILURE;
  if (argc < 2 || argc > 3)
    goto out;
  if (argc == 3) {
    protocol = strtol(argv[2], &endp, 10);
    if (*argv[2] && *endp)
      goto out;
  } else {
    protocol = ETH_P_ALL;
  }
  fd = strtol(argv[1], &endp, 10);
  if (*endp)
    goto out;
  raw_fd = socket(AF_PACKET, SOCK_RAW, htons(protocol));
  if (raw_fd == -1)
    goto out;
  rc = send_socket(fd, raw_fd);
  if (rc == -1) {
    close(raw_fd);
    goto out;
  }
  ret = EXIT_SUCCESS;
out:
  close(fd);
  return ret;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<main>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    D37(%rip),%rax
  mov    (%rax),%r12d
  lea    -0x2(%rdi),%eax
  cmp    $0x1,%eax
  ja     L7
  mov    %rsi,%rbp
  cmp    $0x3,%edi
  je     L44
  mov    D5(%rip),%rax
  mov    (%rax),%r13d
L25:
  mov    %rsp,%rsi
  mov    0x8(%rbp),%rdi
  mov    $0xa,%edx
  call   <strtol@plt>
  mov    %eax,%ebx
  mov    (%rsp),%rax
  cmpb   $0x0,(%rax)
  je     L68
L7:
  mov    %ebx,%edi
  call   <close@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L4
  mov    %r12d,%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L44:
  mov    %rsp,%rsi
  mov    0x10(%rbp),%rdi
  mov    $0xa,%edx
  call   <strtol@plt>
  mov    %eax,%r13d
  mov    0x10(%rbp),%rax
  cmpb   $0x0,(%rax)
  je     L25
  mov    (%rsp),%rax
  cmpb   $0x0,(%rax)
  je     L25
  jmp    L7
L68:
  mov    %r13d,%edi
  call   <htons@plt>
  mov    %eax,%edx
  mov    D21(%rip),%rax
  mov    (%rax),%esi
  mov    D49(%rip),%rax
  mov    (%rax),%edi
  call   <socket@plt>
  mov    %eax,%ebp
  cmp    $0xffffffff,%eax
  je     L7
  mov    %eax,%esi
  mov    %ebx,%edi
  call   <send_socket@plt>
  cmp    $0xffffffff,%eax
  je     L19
  mov    D1(%rip),%rax
  mov    (%rax),%r12d
  jmp    L7
L19:
  mov    %ebp,%edi
  call   <close@plt>
  jmp    L7
L4:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int main(int argc, char **argv) {
  int rc;
  int fd, raw_fd;
  char *endp;
  int protocol;
  int ret = EXIT_FAILURE;
  if (argc < 2 || argc > 3)
    goto out;
  if (argc == 3) {
    protocol = strtol(argv[2], &endp, 10);
    if (*argv[2] && *endp)
      goto out;
  } else {
    protocol = ETH_P_ALL;
  }
  fd = strtol(argv[1], &endp, 10);
  if (*endp)
    goto out;
  raw_fd = socket(AF_PACKET, SOCK_RAW, htons(protocol));
  if (raw_fd == -1)
    goto out;
  rc = send_socket(fd, raw_fd);
  if (rc == -1) {
    close(raw_fd);
    goto out;
  }
  ret = EXIT_SUCCESS;
out:
  close(fd);
  return ret;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<main>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  mov    D24(%rip),%rax
  mov    (%rax),%r12d
  lea    -0x2(%rdi),%eax
  cmp    $0x1,%eax
  ja     L10
  mov    %rsi,%rbx
  cmp    $0x3,%edi
  je     L61
  mov    D6(%rip),%rax
  lea    0x10(%rsp),%rsi
  mov    (%rax),%r13d
L2:
  mov    0x8(%rbx),%rdi
  mov    $0xa,%edx
  call   <strtol@plt>
  mov    %eax,%ebp
  mov    0x10(%rsp),%rax
  cmpb   $0x0,(%rax)
  jne    L10
  mov    %r13d,%edi
  call   <htons@plt>
  mov    %eax,%edx
  mov    D32(%rip),%rax
  mov    (%rax),%esi
  mov    D30(%rip),%rax
  mov    (%rax),%edi
  call   <socket@plt>
  mov    %eax,%r13d
  cmp    $0xffffffff,%eax
  je     L10
  mov    %eax,%esi
  mov    %ebp,%edi
  call   <send_socket@plt>
  add    $0x1,%eax
  je     L55
  mov    D37(%rip),%rax
  mov    (%rax),%r12d
  nopl   0x0(%rax)
L10:
  mov    %ebp,%edi
  call   <close@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L42
  add    $0x28,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L61:
  mov    0x10(%rbx),%rdi
  lea    0x10(%rsp),%rsi
  mov    $0xa,%edx
  mov    %rsi,0x8(%rsp)
  call   <strtol@plt>
  mov    0x8(%rsp),%rsi
  mov    %eax,%r13d
  mov    0x10(%rbx),%rax
  cmpb   $0x0,(%rax)
  je     L2
  mov    0x10(%rsp),%rax
  cmpb   $0x0,(%rax)
  je     L2
  jmp    L10
L55:
  mov    %r13d,%edi
  call   <close@plt>
  jmp    L10
L42:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int main(int argc, char **argv) {
  int rc;
  int fd, raw_fd;
  char *endp;
  int protocol;
  int ret = EXIT_FAILURE;
  if (argc < 2 || argc > 3)
    goto out;
  if (argc == 3) {
    protocol = strtol(argv[2], &endp, 10);
    if (*argv[2] && *endp)
      goto out;
  } else {
    protocol = ETH_P_ALL;
  }
  fd = strtol(argv[1], &endp, 10);
  if (*endp)
    goto out;
  raw_fd = socket(AF_PACKET, SOCK_RAW, htons(protocol));
  if (raw_fd == -1)
    goto out;
  rc = send_socket(fd, raw_fd);
  if (rc == -1) {
    close(raw_fd);
    goto out;
  }
  ret = EXIT_SUCCESS;
out:
  close(fd);
  return ret;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<main>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  mov    D38(%rip),%rax
  mov    (%rax),%r12d
  lea    -0x2(%rdi),%eax
  cmp    $0x1,%eax
  ja     L14
  mov    %rsi,%rbx
  cmp    $0x3,%edi
  je     L2
  mov    D44(%rip),%rax
  lea    0x10(%rsp),%rsi
  mov    (%rax),%r13d
L68:
  mov    0x8(%rbx),%rdi
  mov    $0xa,%edx
  call   <strtol@plt>
  mov    %eax,%ebp
  mov    0x10(%rsp),%rax
  cmpb   $0x0,(%rax)
  jne    L14
  mov    %r13d,%edi
  call   <htons@plt>
  mov    %eax,%edx
  mov    D47(%rip),%rax
  mov    (%rax),%esi
  mov    D33(%rip),%rax
  mov    (%rax),%edi
  call   <socket@plt>
  mov    %eax,%r13d
  cmp    $0xffffffff,%eax
  je     L14
  mov    %eax,%esi
  mov    %ebp,%edi
  call   <send_socket@plt>
  add    $0x1,%eax
  je     L92
  mov    D31(%rip),%rax
  mov    (%rax),%r12d
  nopl   0x0(%rax)
L14:
  mov    %ebp,%edi
  call   <close@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L32
  add    $0x28,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L2:
  mov    0x10(%rbx),%rdi
  lea    0x10(%rsp),%rsi
  mov    $0xa,%edx
  mov    %rsi,0x8(%rsp)
  call   <strtol@plt>
  mov    0x8(%rsp),%rsi
  mov    %eax,%r13d
  mov    0x10(%rbx),%rax
  cmpb   $0x0,(%rax)
  je     L68
  mov    0x10(%rsp),%rax
  cmpb   $0x0,(%rax)
  je     L68
  jmp    L14
L92:
  mov    %r13d,%edi
  call   <close@plt>
  jmp    L14
L32:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int main(int argc, char **argv) {
  int rc;
  int fd, raw_fd;
  char *endp;
  int protocol;
  int ret = EXIT_FAILURE;
  if (argc < 2 || argc > 3)
    goto out;
  if (argc == 3) {
    protocol = strtol(argv[2], &endp, 10);
    if (*argv[2] && *endp)
      goto out;
  } else {
    protocol = ETH_P_ALL;
  }
  fd = strtol(argv[1], &endp, 10);
  if (*endp)
    goto out;
  raw_fd = socket(AF_PACKET, SOCK_RAW, htons(protocol));
  if (raw_fd == -1)
    goto out;
  rc = send_socket(fd, raw_fd);
  if (rc == -1) {
    close(raw_fd);
    goto out;
  }
  ret = EXIT_SUCCESS;
out:
  close(fd);
  return ret;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<DrawString>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  mov    %rdx,-0x20(%rbp)
  mov    -0x18(%rbp),%edx
  mov    -0x14(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <glRasterPos2f@plt>
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x4(%rbp)
  movl   $0x0,-0x8(%rbp)
  jmp    L11
L5:
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%edx
  mov    D9(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <glutBitmapCharacter@plt>
  addl   $0x1,-0x8(%rbp)
L11:
  mov    -0x8(%rbp),%eax
  cmp    -0x4(%rbp),%eax
  jl     L5
  nop
  nop
  leave
  ret
```

assistant: ```c
void DrawString(int x, int y, char *string) {
  int len, i;
  glRasterPos2f(x, y);
  len = (int)strlen(string);
  for (i = 0; i < len; i++) {
    glutBitmapCharacter(GLUT_BITMAP_9_BY_15, string[i]);
  }
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<DrawString>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdx,%rbp
  call   <glRasterPos2f@plt>
  mov    %rbp,%rdi
  call   <strlen@plt>
  test   %eax,%eax
  jle    L8
  mov    %rbp,%rbx
  lea    -0x1(%rax),%eax
  lea    0x1(%rbp,%rax,1),%r12
  mov    D9(%rip),%rbp
L12:
  movsbl (%rbx),%esi
  mov    0x0(%rbp),%edi
  call   <glutBitmapCharacter@plt>
  add    $0x1,%rbx
  cmp    %r12,%rbx
  jne    L12
L8:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void DrawString(int x, int y, char *string) {
  int len, i;
  glRasterPos2f(x, y);
  len = (int)strlen(string);
  for (i = 0; i < len; i++) {
    glutBitmapCharacter(GLUT_BITMAP_9_BY_15, string[i]);
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<DrawString>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdx,%rbx
  call   <glRasterPos2f@plt>
  mov    %rbx,%rdi
  call   <strlen@plt>
  test   %eax,%eax
  jle    L16
  sub    $0x1,%eax
  mov    D4(%rip),%rbp
  lea    0x1(%rbx,%rax,1),%r12
  nopl   0x0(%rax,%rax,1)
L11:
  movsbl (%rbx),%esi
  mov    0x0(%rbp),%edi
  add    $0x1,%rbx
  call   <glutBitmapCharacter@plt>
  cmp    %r12,%rbx
  jne    L11
L16:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void DrawString(int x, int y, char *string) {
  int len, i;
  glRasterPos2f(x, y);
  len = (int)strlen(string);
  for (i = 0; i < len; i++) {
    glutBitmapCharacter(GLUT_BITMAP_9_BY_15, string[i]);
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<DrawString>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdx,%rbx
  call   <glRasterPos2f@plt>
  mov    %rbx,%rdi
  call   <strlen@plt>
  test   %eax,%eax
  jle    L5
  sub    $0x1,%eax
  mov    D8(%rip),%rbp
  lea    0x1(%rbx,%rax,1),%r12
  nopl   0x0(%rax,%rax,1)
L3:
  movsbl (%rbx),%esi
  mov    0x0(%rbp),%edi
  add    $0x1,%rbx
  call   <glutBitmapCharacter@plt>
  cmp    %r12,%rbx
  jne    L3
L5:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void DrawString(int x, int y, char *string) {
  int len, i;
  glRasterPos2f(x, y);
  len = (int)strlen(string);
  for (i = 0; i < len; i++) {
    glutBitmapCharacter(GLUT_BITMAP_9_BY_15, string[i]);
  }
}
```