ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请从给定的汇编指令推导出C源代码：

```asm
<main>:
  endbr64
  push   %r15
  mov    $0x32,%ecx
  push   %r14
  push   %r13
  push   %r12
  lea    D6(%rip),%r12
  push   %rbp
  push   %rbx
  sub    $0x1b8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x1a8(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%r15
  mov    %r15,%rdi
  rep stos %rax,%es:(%rdi)
  lea    D12(%rip),%rdi
  call   <printf@plt>
  lea    0xc(%rsp),%rsi
  mov    %r12,%rdi
  call   <scanf@plt>
  lea    D8(%rip),%rdi
  call   <printf@plt>
  mov    0xc(%rsp),%esi
  test   %esi,%esi
  jle    L9
  lea    0x3c(%rsp),%r14
  mov    $0x1,%r13d
  nopw   0x0(%rax,%rax,1)
L38:
  mov    %r14,%rbp
  mov    $0x1,%ebx
  nopl   0x0(%rax,%rax,1)
L16:
  mov    %rbp,%rsi
  mov    %r12,%rdi
  add    $0x1,%ebx
  add    $0x4,%rbp
  call   <scanf@plt>
  mov    0xc(%rsp),%esi
  cmp    %ebx,%esi
  jge    L16
  add    $0x1,%r13d
  add    $0x28,%r14
  cmp    %r13d,%esi
  jge    L38
L9:
  mov    %r15,%rdi
  call   <prims@plt>
  mov    0x1a8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L31
  add    $0x1b8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L31:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D6
type_guessed: string
name: disassemble_data
arguments: data_tag: D12
type_guessed: string
name: disassemble_data
arguments: data_tag: D8
type_guessed: string

tool: D6: %d

tool: D12: Enter the no of vertices


tool: D8: Enter the matrix


assistant: ```c
int main(int argc, char *argv[]) {
  int no, i, j;
  int a[10][10] = {0};
  printf("Enter the no of vertices\n");
  scanf("%d", &no);
  printf("Enter the matrix\n");
  for (i = 1; i <= no; i++) {
    for (j = 1; j <= no; j++) {
      scanf("%d", &a[i][j]);
    }
  }
  prims(a, no);
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  push   %r15
  mov    $0x32,%ecx
  push   %r14
  mov    $0x1,%r14d
  push   %r13
  push   %r12
  lea    D25(%rip),%r12
  push   %rbp
  push   %rbx
  sub    $0x1b8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x1a8(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%r15
  lea    0x3c(%rsp),%r13
  mov    %r15,%rdi
  rep stos %rax,%es:(%rdi)
  lea    D3(%rip),%rdi
  call   <printf@plt>
  lea    0xc(%rsp),%rsi
  mov    %r12,%rdi
  call   <scanf@plt>
  lea    D21(%rip),%rdi
  call   <printf@plt>
  mov    0xc(%rsp),%esi
  test   %esi,%esi
  jle    L30
  nopw   0x0(%rax,%rax,1)
L25:
  mov    %r13,%rbp
  mov    $0x1,%ebx
  nopl   0x0(%rax,%rax,1)
L12:
  mov    %rbp,%rsi
  mov    %r12,%rdi
  add    $0x1,%ebx
  add    $0x4,%rbp
  call   <scanf@plt>
  mov    0xc(%rsp),%esi
  cmp    %ebx,%esi
  jge    L12
  add    $0x1,%r14d
  cmp    %r14d,%esi
  jl     L30
  add    $0x28,%r13
  jmp    L25
  nopl   0x0(%rax)
L30:
  mov    %r15,%rdi
  call   <prims@plt>
  mov    0x1a8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L45
  add    $0x1b8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L45:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_label: D25
datatype: string
name: unpack_data
arguments: data_label: D3
datatype: string
name: unpack_data
arguments: data_label: D21
datatype: string

tool: D25: %d

tool: D3: Enter the no of vertices


tool: D21: Enter the matrix


assistant: ```c
int main(int argc, char *argv[]) {
  int no, i, j;
  int a[10][10] = {0};
  printf("Enter the no of vertices\n");
  scanf("%d", &no);
  printf("Enter the matrix\n");
  for (i = 1; i <= no; i++) {
    for (j = 1; j <= no; j++) {
      scanf("%d", &a[i][j]);
    }
  }
  prims(a, no);
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  movsd  D0(%rip),%xmm0
  movsd  %xmm0,-0x10(%rbp)
  movsd  D3(%rip),%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movsd  -0x8(%rbp),%xmm0
  mov    -0x10(%rbp),%rax
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  mov    $0x1,%esi
  lea    D48(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  movl   $0x2,-0x14(%rbp)
  jmp    L12
L2:
  movsd  -0x8(%rbp),%xmm0
  addsd  %xmm0,%xmm0
  movsd  -0x10(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  movsd  -0x8(%rbp),%xmm0
  movsd  D2(%rip),%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movsd  -0x8(%rbp),%xmm0
  mov    -0x10(%rbp),%rdx
  mov    -0x14(%rbp),%eax
  movapd %xmm0,%xmm1
  movq   %rdx,%xmm0
  mov    %eax,%esi
  lea    D48(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  addl   $0x1,-0x14(%rbp)
L12:
  cmpl   $0xa,-0x14(%rbp)
  jle    L2
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D0
type_infered: f64
name: disassemble_data
arguments: tag: D3
type_infered: f64
name: disassemble_data
arguments: tag: D48
type_infered: string
name: disassemble_data
arguments: tag: D2
type_infered: byte[8]

tool: D0: 100

tool: D3: 50

tool: D48: [%2d]s=%10g, r=%10g


tool: {"D2": [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40]}

assistant: ```c
int main(void) {
  double s = 100, r = 50;
  printf("[%2d]s=%10g, r=%10g\n", 1, s, r);
  for (int i = 2; i <= 10; i++) {
    s = s + r * 2;
    r = r / 2;
    printf("[%2d]s=%10g, r=%10g\n", i, s, r);
  }
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<main>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    D49(%rip),%rax
  movq   %rax,%xmm1
  mov    D26(%rip),%rax
  movq   %rax,%xmm0
  mov    $0x1,%esi
  lea    D50(%rip),%rdi
  call   <printf@plt>
  mov    $0x2,%ebx
  mov    D49(%rip),%rax
  mov    %rax,0x8(%rsp)
  mov    D26(%rip),%rax
  mov    %rax,(%rsp)
  lea    D50(%rip),%rbp
L9:
  movsd  0x8(%rsp),%xmm2
  movapd %xmm2,%xmm0
  addsd  %xmm2,%xmm0
  addsd  (%rsp),%xmm0
  movsd  %xmm0,(%rsp)
  movsd  D20(%rip),%xmm3
  mulsd  %xmm2,%xmm3
  movapd %xmm3,%xmm1
  movsd  %xmm3,0x8(%rsp)
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <printf@plt>
  add    $0x1,%ebx
  cmp    $0xb,%ebx
  jne    L9
  mov    $0x0,%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

tool_calls: name: read_data
arguments: label: D49
data_type: f64
name: read_data
arguments: label: D26
data_type: f64
name: read_data
arguments: label: D50
data_type: string
name: read_data
arguments: label: D20
data_type: byte[8]

tool: D49: 50

tool: D26: 100

tool: D50: [%2d]s=%10g, r=%10g


tool: {"D20": [0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x3f]}

assistant: ```c
int main(void) {
  double s = 100, r = 50;
  printf("[%2d]s=%10g, r=%10g\n", 1, s, r);
  for (int i = 2; i <= 10; i++) {
    s = s + r * 2;
    r = r / 2;
    printf("[%2d]s=%10g, r=%10g\n", i, s, r);
  }
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %rbp
  lea    D43(%rip),%rbp
  mov    $0x1,%esi
  push   %rbx
  mov    %rbp,%rdi
  mov    $0x2,%ebx
  sub    $0x18,%rsp
  mov    D45(%rip),%rax
  movq   %rax,%xmm1
  mov    D19(%rip),%rax
  movq   %rax,%xmm0
  call   <printf@plt>
  mov    D45(%rip),%rax
  movq   %rax,%xmm1
  mov    D19(%rip),%rax
  movq   %rax,%xmm0
  nopl   0x0(%rax,%rax,1)
L9:
  movapd %xmm1,%xmm2
  mov    %ebx,%esi
  mov    %rbp,%rdi
  add    $0x1,%ebx
  addsd  %xmm1,%xmm2
  mulsd  D58(%rip),%xmm1
  addsd  %xmm2,%xmm0
  movsd  %xmm1,0x8(%rsp)
  movsd  %xmm0,(%rsp)
  call   <printf@plt>
  cmp    $0xb,%ebx
  movsd  (%rsp),%xmm0
  movsd  0x8(%rsp),%xmm1
  jne    L9
  add    $0x18,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  ret
```

tool_calls: name: disassemble_data
arguments: data_tag: D43
type: string
name: disassemble_data
arguments: data_tag: D45
type: f64
name: disassemble_data
arguments: data_tag: D19
type: f64
name: disassemble_data
arguments: data_tag: D58
type: byte[8]

tool: D43: [%2d]s=%10g, r=%10g


tool: D45: 50

tool: D19: 100

tool: {"D58": [0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x3f]}

assistant: ```c
int main(void) {
  double s = 100, r = 50;
  printf("[%2d]s=%10g, r=%10g\n", 1, s, r);
  for (int i = 2; i <= 10; i++) {
    s = s + r * 2;
    r = r / 2;
    printf("[%2d]s=%10g, r=%10g\n", i, s, r);
  }
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<main>:
  endbr64
  push   %rbp
  lea    D27(%rip),%rbp
  mov    $0x1,%esi
  push   %rbx
  mov    %rbp,%rdi
  mov    $0x2,%ebx
  sub    $0x18,%rsp
  mov    D22(%rip),%rax
  movq   %rax,%xmm1
  mov    D48(%rip),%rax
  movq   %rax,%xmm0
  call   <printf@plt>
  mov    D22(%rip),%rax
  movq   %rax,%xmm1
  mov    D48(%rip),%rax
  movq   %rax,%xmm0
  nopl   0x0(%rax,%rax,1)
L3:
  movapd %xmm1,%xmm2
  mov    %ebx,%esi
  mov    %rbp,%rdi
  add    $0x1,%ebx
  addsd  %xmm1,%xmm2
  mulsd  D6(%rip),%xmm1
  addsd  %xmm2,%xmm0
  movsd  %xmm1,0x8(%rsp)
  movsd  %xmm0,(%rsp)
  call   <printf@plt>
  cmp    $0xb,%ebx
  movsd  (%rsp),%xmm0
  movsd  0x8(%rsp),%xmm1
  jne    L3
  add    $0x18,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  ret
```

tool_calls: name: read_data
arguments: data_tag: D27
type_guessed: string
name: read_data
arguments: data_tag: D22
type_guessed: f64
name: read_data
arguments: data_tag: D48
type_guessed: f64
name: read_data
arguments: data_tag: D6
type_guessed: byte[8]

tool: D27: [%2d]s=%10g, r=%10g


tool: D22: 50

tool: D48: 100

tool: {"D6": [0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x3f]}

assistant: ```c
int main(void) {
  double s = 100, r = 50;
  printf("[%2d]s=%10g, r=%10g\n", 1, s, r);
  for (int i = 2; i <= 10; i++) {
    s = s + r * 2;
    r = r / 2;
    printf("[%2d]s=%10g, r=%10g\n", i, s, r);
  }
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<_ucRcAT102_ChkSecurityCode>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    $0x32,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    $0x2391,%edx
  lea    D6(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  mov    %eax,-0x10(%rbp)
  mov    -0x10(%rbp),%edx
  mov    -0x8(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x18(%rbp),%rax
  mov    $0x2,%edx
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <memcpy@plt>
  addl   $0x2,-0x10(%rbp)
  mov    -0x10(%rbp),%edx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  lea    D4(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  add    %eax,-0x10(%rbp)
  mov    -0x10(%rbp),%ecx
  mov    -0x8(%rbp),%rax
  mov    $0x1,%edx
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <iDoRemoteFunc@plt>
  mov    %eax,-0xc(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  cmpl   $0x0,-0xc(%rbp)
  je     L11
  mov    -0xc(%rbp),%eax
  mov    %eax,%esi
  lea    D8(%rip),%rax
  mov    %rax,%rdi
  call   <vWriteLogTxt@plt>
  mov    $0x1,%eax
  jmp    L14
L11:
  mov    $0x0,%edi
  call   <iGetParaInt@plt>
L14:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D6
datatype: string
name: retrieve_data
arguments: tag: D4
datatype: string
name: retrieve_data
arguments: tag: D8
datatype: string

tool: D6: %u(b002

tool: D4: )

tool: D8: _AT102_ChkSecurityCode iDoRemoteFunc ret = %d

assistant: ```c
unsigned char _ucRcAT102_ChkSecurityCode(unsigned char *psSC) {
  unsigned int uiDataLen, uiRet;
  char *psFunCall = malloc(50);
  uiDataLen = sprintf(psFunCall, "%u(b002", 9105);
  memcpy(psFunCall + uiDataLen, psSC, 2);
  uiDataLen += 2;
  uiDataLen += sprintf(psFunCall + uiDataLen, ")");
  uiRet = iDoRemoteFunc((unsigned char *)psFunCall, uiDataLen, 1);
  free(psFunCall);
  if (uiRet) {
    vWriteLogTxt("_AT102_ChkSecurityCode iDoRemoteFunc ret = %d", uiRet);
    return 1;
  }
  return iGetParaInt(0);
}
```
user: Translate the below assembly code into C programming language:

```asm
<_ucRcAT102_ChkSecurityCode>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  mov    $0x32,%edi
  call   <malloc@plt>
  mov    %rax,%rbx
  mov    $0x2391,%edx
  lea    D11(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  lea    0x9(%rbx),%rdi
  mov    $0x2,%edx
  mov    %rbp,%rsi
  call   <memcpy@plt>
  movw   $0x29,0xb(%rbx)
  mov    $0x1,%edx
  mov    $0xc,%esi
  mov    %rbx,%rdi
  call   <iDoRemoteFunc@plt>
  mov    %eax,%ebp
  mov    %rbx,%rdi
  call   <free@plt>
  test   %ebp,%ebp
  jne    L17
  mov    $0x0,%edi
  call   <iGetParaInt@plt>
L6:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L17:
  mov    %ebp,%esi
  lea    D7(%rip),%rdi
  call   <vWriteLogTxt@plt>
  mov    $0x1,%eax
  jmp    L6
```

tool_calls: name: read_data
arguments: data_label: D11
data_type: string
name: read_data
arguments: data_label: D7
data_type: string

tool: D11: %u(b002

tool: D7: _AT102_ChkSecurityCode iDoRemoteFunc ret = %d

assistant: ```c
unsigned char _ucRcAT102_ChkSecurityCode(unsigned char *psSC) {
  unsigned int uiDataLen, uiRet;
  char *psFunCall = malloc(50);
  uiDataLen = sprintf(psFunCall, "%u(b002", 9105);
  memcpy(psFunCall + uiDataLen, psSC, 2);
  uiDataLen += 2;
  uiDataLen += sprintf(psFunCall + uiDataLen, ")");
  uiRet = iDoRemoteFunc((unsigned char *)psFunCall, uiDataLen, 1);
  free(psFunCall);
  if (uiRet) {
    vWriteLogTxt("_AT102_ChkSecurityCode iDoRemoteFunc ret = %d", uiRet);
    return 1;
  }
  return iGetParaInt(0);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<_ucRcAT102_ChkSecurityCode>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  mov    $0x32,%edi
  push   %rbp
  sub    $0x8,%rsp
  call   <malloc@plt>
  mov    $0x2391,%edx
  lea    D10(%rip),%rsi
  mov    %rax,%rbp
  mov    %rax,%rdi
  xor    %eax,%eax
  call   <sprintf@plt>
  mov    %r12,%rsi
  lea    0x9(%rbp),%rdi
  mov    $0x2,%edx
  call   <memcpy@plt>
  mov    $0x29,%eax
  mov    %rbp,%rdi
  mov    $0x1,%edx
  mov    %ax,0xb(%rbp)
  mov    $0xc,%esi
  call   <iDoRemoteFunc@plt>
  mov    %rbp,%rdi
  mov    %eax,%r12d
  call   <free@plt>
  test   %r12d,%r12d
  jne    L2
  add    $0x8,%rsp
  xor    %edi,%edi
  pop    %rbp
  pop    %r12
  jmp    10c0 <iGetParaInt@plt>
  nopl   0x0(%rax,%rax,1)
L2:
  mov    %r12d,%esi
  lea    D4(%rip),%rdi
  call   <vWriteLogTxt@plt>
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbp
  pop    %r12
  ret
```

tool_calls: name: disassemble_data
arguments: data_tag: D10
datatype: string
name: disassemble_data
arguments: data_tag: D4
datatype: string

tool: D10: %u(b002

tool: D4: _AT102_ChkSecurityCode iDoRemoteFunc ret = %d

assistant: ```c
unsigned char _ucRcAT102_ChkSecurityCode(unsigned char *psSC) {
  unsigned int uiDataLen, uiRet;
  char *psFunCall = malloc(50);
  uiDataLen = sprintf(psFunCall, "%u(b002", 9105);
  memcpy(psFunCall + uiDataLen, psSC, 2);
  uiDataLen += 2;
  uiDataLen += sprintf(psFunCall + uiDataLen, ")");
  uiRet = iDoRemoteFunc((unsigned char *)psFunCall, uiDataLen, 1);
  free(psFunCall);
  if (uiRet) {
    vWriteLogTxt("_AT102_ChkSecurityCode iDoRemoteFunc ret = %d", uiRet);
    return 1;
  }
  return iGetParaInt(0);
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<_ucRcAT102_ChkSecurityCode>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  mov    $0x32,%edi
  push   %rbp
  sub    $0x8,%rsp
  call   <malloc@plt>
  mov    $0x2391,%edx
  lea    D17(%rip),%rsi
  mov    %rax,%rbp
  mov    %rax,%rdi
  xor    %eax,%eax
  call   <sprintf@plt>
  mov    %r12,%rsi
  lea    0x9(%rbp),%rdi
  mov    $0x2,%edx
  call   <memcpy@plt>
  mov    $0x29,%eax
  mov    %rbp,%rdi
  mov    $0x1,%edx
  mov    %ax,0xb(%rbp)
  mov    $0xc,%esi
  call   <iDoRemoteFunc@plt>
  mov    %rbp,%rdi
  mov    %eax,%r12d
  call   <free@plt>
  test   %r12d,%r12d
  jne    L0
  add    $0x8,%rsp
  xor    %edi,%edi
  pop    %rbp
  pop    %r12
  jmp    10c0 <iGetParaInt@plt>
  nopl   0x0(%rax,%rax,1)
L0:
  mov    %r12d,%esi
  lea    D2(%rip),%rdi
  call   <vWriteLogTxt@plt>
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbp
  pop    %r12
  ret
```

tool_calls: name: disassemble_data
arguments: label: D17
type_infered: string
name: disassemble_data
arguments: label: D2
type_infered: string

tool: D17: %u(b002

tool: D2: _AT102_ChkSecurityCode iDoRemoteFunc ret = %d

assistant: ```c
unsigned char _ucRcAT102_ChkSecurityCode(unsigned char *psSC) {
  unsigned int uiDataLen, uiRet;
  char *psFunCall = malloc(50);
  uiDataLen = sprintf(psFunCall, "%u(b002", 9105);
  memcpy(psFunCall + uiDataLen, psSC, 2);
  uiDataLen += 2;
  uiDataLen += sprintf(psFunCall + uiDataLen, ")");
  uiRet = iDoRemoteFunc((unsigned char *)psFunCall, uiDataLen, 1);
  free(psFunCall);
  if (uiRet) {
    vWriteLogTxt("_AT102_ChkSecurityCode iDoRemoteFunc ret = %d", uiRet);
    return 1;
  }
  return iGetParaInt(0);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<crc16_inet>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,%ecx
  mov    %rsi,-0x20(%rbp)
  mov    %edx,%eax
  mov    %ecx,%edx
  mov    %dx,-0x14(%rbp)
  mov    %ax,-0x18(%rbp)
  movzwl -0x14(%rbp),%eax
  mov    %rax,-0x8(%rbp)
  mov    -0x20(%rbp),%rax
  and    $0x1,%eax
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  je     L24
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x8,%eax
  cltq
  add    %rax,-0x8(%rbp)
  subw   $0x1,-0x18(%rbp)
  jmp    L24
L25:
  mov    -0x20(%rbp),%rax
  movzwl (%rax),%eax
  movzwl %ax,%eax
  add    %rax,-0x8(%rbp)
  subw   $0x2,-0x18(%rbp)
  addq   $0x2,-0x20(%rbp)
L24:
  cmpw   $0x1,-0x18(%rbp)
  ja     L25
  movzwl -0x18(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  je     L42
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  add    %rax,-0x8(%rbp)
L42:
  mov    -0x8(%rbp),%rax
  shr    $0x10,%rax
  mov    %rax,%rdx
  mov    -0x8(%rbp),%rax
  movzwl %ax,%eax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %ax,-0x14(%rbp)
  mov    -0x8(%rbp),%rax
  and    $0x10000,%eax
  test   %rax,%rax
  je     L46
  addw   $0x1,-0x14(%rbp)
L46:
  cmpl   $0x0,-0xc(%rbp)
  je     L57
  movzwl -0x14(%rbp),%eax
  shl    $0x8,%eax
  mov    %eax,%edx
  movzwl -0x14(%rbp),%eax
  shr    $0x8,%ax
  or     %edx,%eax
  mov    %ax,-0x14(%rbp)
L57:
  movzwl -0x14(%rbp),%eax
  pop    %rbp
  ret
```

assistant: ```c
unsigned short crc16_inet(unsigned short sum, unsigned const char *buf, unsigned short len) {
  unsigned long longsum;
  unsigned swap_flag;
  longsum = sum;
  swap_flag = (int)buf & 1;
  if (swap_flag) {
    longsum += *buf++ << 8;
    --len;
  }
  for (; len > 1; len -= 2, buf += 2)
    longsum += *(unsigned short *)buf;
  if (len & 1) {
    longsum += *buf;
  }
  longsum = (longsum >> 16) + (unsigned short)longsum;
  sum = longsum;
  if (longsum & 0x10000)
    ++sum;
  if (swap_flag) {
    sum = sum << 8 | sum >> 8;
  }
  return sum;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<crc16_inet>:
  endbr64
  mov    %edi,%ecx
  mov    %rsi,%rax
  mov    %edx,%edi
  movzwl %cx,%ecx
  mov    %esi,%r8d
  and    $0x1,%r8d
  je     L49
  movzbl (%rsi),%esi
  shl    $0x8,%esi
  movslq %esi,%rsi
  add    %rsi,%rcx
  lea    -0x1(%rdx),%edi
  lea    0x1(%rax),%rax
L49:
  cmp    $0x1,%di
  jbe    L28
  lea    -0x2(%rdi),%edx
  shr    %dx
  add    $0x1,%edx
  movzwl %dx,%edx
  lea    (%rax,%rdx,2),%rsi
L26:
  movzwl (%rax),%edx
  add    %rdx,%rcx
  add    $0x2,%rax
  cmp    %rsi,%rax
  jne    L26
  and    $0x1,%edi
L34:
  test   $0x1,%dil
  je     L3
  movzbl (%rsi),%eax
  add    %rax,%rcx
L3:
  mov    %rcx,%rax
  shr    $0x10,%rax
  movzwl %cx,%ecx
  add    %rcx,%rax
  mov    %rax,%rdx
  and    $0x10000,%edx
  cmp    $0x1,%rdx
  sbb    $0xffff,%ax
  mov    %eax,%edx
  rol    $0x8,%ax
  test   %r8d,%r8d
  cmove  %edx,%eax
  ret
L28:
  mov    %rax,%rsi
  jmp    L34
```

assistant: ```c
unsigned short crc16_inet(unsigned short sum, unsigned const char *buf, unsigned short len) {
  unsigned long longsum;
  unsigned swap_flag;
  longsum = sum;
  swap_flag = (int)buf & 1;
  if (swap_flag) {
    longsum += *buf++ << 8;
    --len;
  }
  for (; len > 1; len -= 2, buf += 2)
    longsum += *(unsigned short *)buf;
  if (len & 1) {
    longsum += *buf;
  }
  longsum = (longsum >> 16) + (unsigned short)longsum;
  sum = longsum;
  if (longsum & 0x10000)
    ++sum;
  if (swap_flag) {
    sum = sum << 8 | sum >> 8;
  }
  return sum;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<crc16_inet>:
  endbr64
  mov    %edi,%r8d
  mov    %rsi,%rax
  mov    %edx,%edi
  movzwl %r8w,%ecx
  mov    %esi,%r8d
  and    $0x1,%r8d
  je     L30
  movzbl (%rsi),%esi
  lea    -0x1(%rdx),%edi
  add    $0x1,%rax
  shl    $0x8,%esi
  movslq %esi,%rsi
  add    %rsi,%rcx
L30:
  cmp    $0x1,%di
  jbe    L42
  lea    -0x2(%rdi),%edx
  shr    %dx
  add    $0x1,%edx
  movzwl %dx,%edx
  lea    (%rax,%rdx,2),%rsi
  nopw   0x0(%rax,%rax,1)
L11:
  movzwl (%rax),%edx
  add    $0x2,%rax
  add    %rdx,%rcx
  cmp    %rax,%rsi
  jne    L11
  and    $0x1,%edi
L8:
  test   %di,%di
  je     L44
  movzbl (%rsi),%eax
  add    %rax,%rcx
L44:
  mov    %rcx,%rax
  movzwl %cx,%ecx
  shr    $0x10,%rax
  add    %rcx,%rax
  mov    %rax,%rdx
  and    $0x10000,%edx
  cmp    $0x1,%rdx
  sbb    $0xffff,%ax
  mov    %eax,%edx
  rol    $0x8,%dx
  test   %r8d,%r8d
  cmovne %edx,%eax
  ret
L42:
  mov    %rax,%rsi
  jmp    L8
```

assistant: ```c
unsigned short crc16_inet(unsigned short sum, unsigned const char *buf, unsigned short len) {
  unsigned long longsum;
  unsigned swap_flag;
  longsum = sum;
  swap_flag = (int)buf & 1;
  if (swap_flag) {
    longsum += *buf++ << 8;
    --len;
  }
  for (; len > 1; len -= 2, buf += 2)
    longsum += *(unsigned short *)buf;
  if (len & 1) {
    longsum += *buf;
  }
  longsum = (longsum >> 16) + (unsigned short)longsum;
  sum = longsum;
  if (longsum & 0x10000)
    ++sum;
  if (swap_flag) {
    sum = sum << 8 | sum >> 8;
  }
  return sum;
}
```