ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<mat_add_scal_mult>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,-0x18(%rsp)
  test   %edi,%edi
  jle    L42
  mov    %esi,%r12d
  test   %esi,%esi
  jle    L42
  mov    %r12d,%eax
  movslq %r12d,%r15
  mov    %r12d,%r9d
  mov    %rdx,%rsi
  shr    %eax
  movapd %xmm0,%xmm2
  mov    %rcx,%rdx
  shl    $0x3,%r15
  lea    -0x1(%rax),%ebx
  lea    -0x1(%r12),%eax
  and    $0xfffffffe,%r9d
  xor    %edi,%edi
  mov    %eax,-0x14(%rsp)
  shl    $0x3,%rax
  add    $0x1,%rbx
  xor    %ebp,%ebp
  mov    %rax,-0x10(%rsp)
  shl    $0x4,%rbx
  xor    %r14d,%r14d
  unpcklpd %xmm2,%xmm2
  mov    $0x8,%r13d
L40:
  lea    (%rsi,%rbp,1),%rcx
  lea    0x0(%r13,%r8,1),%rax
  cmp    %rax,%rcx
  lea    0x0(%r13,%rdx,1),%rax
  setne  %r10b
  cmp    %rax,%rcx
  setne  %al
  test   %al,%r10b
  je     L70
  xor    %eax,%eax
  cmpl   $0x1,-0x14(%rsp)
  lea    0x0(%rbp,%rdx,1),%r11
  lea    0x0(%rbp,%r8,1),%r10
  jbe    L70
  nopw   0x0(%rax,%rax,1)
L75:
  movupd (%r10,%rax,1),%xmm1
  movupd (%r11,%rax,1),%xmm3
  mulpd  %xmm2,%xmm1
  addpd  %xmm3,%xmm1
  movups %xmm1,(%rcx,%rax,1)
  add    $0x10,%rax
  cmp    %rax,%rbx
  jne    L75
  cmp    %r9d,%r12d
  je     L56
  lea    (%rdi,%r9,1),%eax
  cltq
  movsd  (%r8,%rax,8),%xmm1
  mulsd  %xmm0,%xmm1
  addsd  (%rdx,%rax,8),%xmm1
  movsd  %xmm1,(%rsi,%rax,8)
L56:
  add    $0x1,%r14d
  add    %r15,%rbp
  add    %r12d,%edi
  add    %r15,%r13
  cmp    %r14d,-0x18(%rsp)
  jne    L40
L42:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L70:
  mov    -0x10(%rsp),%rax
  lea    0x0(%r13,%rax,1),%rcx
  mov    %rbp,%rax
  nopl   (%rax)
L83:
  movsd  (%r8,%rax,1),%xmm1
  mulsd  %xmm0,%xmm1
  addsd  (%rdx,%rax,1),%xmm1
  movsd  %xmm1,(%rsi,%rax,1)
  add    $0x8,%rax
  cmp    %rcx,%rax
  jne    L83
  jmp    L56
```

assistant: ```c
void mat_add_scal_mult(int n_row, int n_col, double *r, double *a, double k, double *b) {
  int row, col;
  for (row = 0; row < n_row; row++) {
    for (col = 0; col < n_col; col++) {
      int ridx = row * n_col + col;
      r[ridx] = a[ridx] + k * b[ridx];
    }
  }
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<setsat>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %edi,-0x34(%rbp)
  mov    %esi,-0x38(%rbp)
  mov    %edx,-0x3c(%rbp)
  mov    %ecx,-0x40(%rbp)
  mov    %r8,-0x48(%rbp)
  mov    %r9,-0x50(%rbp)
  mov    0x10(%rbp),%rax
  mov    %rax,-0x58(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x34(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  lea    -0x38(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  lea    -0x3c(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x20(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jle    L8
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x18(%rbp)
L8:
  mov    -0x20(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x10(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jle    L43
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x10(%rbp)
L43:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x10(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jle    L37
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x10(%rbp)
L37:
  mov    -0x10(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jle    L10
  mov    -0x18(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x20(%rbp),%rax
  mov    (%rax),%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  imul   -0x40(%rbp),%eax
  mov    -0x10(%rbp),%rdx
  mov    (%rdx),%ecx
  mov    -0x20(%rbp),%rdx
  mov    (%rdx),%esi
  sub    %esi,%ecx
  mov    %ecx,%edi
  mov    -0x18(%rbp),%rcx
  cltd
  idiv   %edi
  mov    %eax,(%rcx)
  mov    -0x10(%rbp),%rax
  mov    -0x40(%rbp),%edx
  mov    %edx,(%rax)
  jmp    L16
L10:
  mov    -0x18(%rbp),%rax
  movl   $0x0,(%rax)
  mov    -0x10(%rbp),%rax
  movl   $0x0,(%rax)
L16:
  mov    -0x34(%rbp),%edx
  mov    -0x48(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x38(%rbp),%edx
  mov    -0x50(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x3c(%rbp),%edx
  mov    -0x58(%rbp),%rax
  mov    %edx,(%rax)
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L42
  call   <__stack_chk_fail@plt>
L42:
  leave
  ret
```

assistant: ```c
void setsat(int r, int g, int b, int s, int *dr, int *dg, int *db) {
  int *m[3] = {&r, &g, &b};
  int *t;
  if (*m[0] > *m[1])
    (t = m[0], m[0] = m[1], m[1] = t);
  if (*m[0] > *m[2])
    (t = m[0], m[0] = m[2], m[2] = t);
  if (*m[1] > *m[2])
    (t = m[1], m[1] = m[2], m[2] = t);
  if (*m[2] > *m[0]) {
    *m[1] = (*m[1] - *m[0]) * s / (*m[2] - *m[0]);
    *m[2] = s;
  } else {
    *m[1] = 0;
    *m[2] = 0;
  }
  *dr = r;
  *dg = g;
  *db = b;
}
```
user: Translate the below assembly code into C programming language:

```asm
<setsat>:
  endbr64
  mov    %edi,%eax
  mov    %edi,-0x4(%rsp)
  mov    %esi,-0x8(%rsp)
  mov    %edx,-0xc(%rsp)
  mov    %ecx,%edi
  mov    %eax,%edx
  mov    %esi,%eax
  cmp    %esi,%edx
  jg     L46
  mov    -0xc(%rsp),%ecx
  cmp    %ecx,%edx
  jg     L50
  lea    -0x8(%rsp),%rsi
L22:
  lea    -0xc(%rsp),%r10
  mov    %r10,%r11
  cmp    %eax,%ecx
  jge    L60
L80:
  mov    %eax,%ecx
  mov    %rsi,%r10
  mov    %r11,%rsi
L60:
  cmp    %edx,%ecx
  jg     L75
  movl   $0x0,(%rsi)
  movl   $0x0,(%r10)
  jmp    L52
L24:
  mov    %ecx,%edx
  lea    -0x8(%rsp),%rsi
  lea    -0x4(%rsp),%r11
  jmp    L80
L2:
  mov    %edx,%eax
  mov    %ecx,%edx
  lea    -0x4(%rsp),%rsi
  lea    -0x8(%rsp),%r11
  jmp    L80
L50:
  cmp    %esi,%edx
  jl     L24
  mov    %ecx,%eax
  mov    %edx,%ecx
  mov    %eax,%edx
  lea    -0x4(%rsp),%r10
  lea    -0x8(%rsp),%rsi
L75:
  mov    (%rsi),%eax
  sub    %edx,%eax
  imul   %edi,%eax
  sub    %edx,%ecx
  cltd
  idiv   %ecx
  mov    %eax,(%rsi)
  mov    %edi,(%r10)
L52:
  mov    -0x4(%rsp),%eax
  mov    %eax,(%r8)
  mov    -0x8(%rsp),%eax
  mov    %eax,(%r9)
  mov    0x8(%rsp),%rax
  mov    -0xc(%rsp),%edx
  mov    %edx,(%rax)
  ret
L46:
  mov    -0xc(%rsp),%ecx
  cmp    %ecx,%esi
  jg     L2
  mov    %edx,%esi
  mov    %eax,%edx
  mov    %esi,%eax
  lea    -0x4(%rsp),%rsi
  jmp    L22
```

assistant: ```c
void setsat(int r, int g, int b, int s, int *dr, int *dg, int *db) {
  int *m[3] = {&r, &g, &b};
  int *t;
  if (*m[0] > *m[1])
    (t = m[0], m[0] = m[1], m[1] = t);
  if (*m[0] > *m[2])
    (t = m[0], m[0] = m[2], m[2] = t);
  if (*m[1] > *m[2])
    (t = m[1], m[1] = m[2], m[2] = t);
  if (*m[2] > *m[0]) {
    *m[1] = (*m[1] - *m[0]) * s / (*m[2] - *m[0]);
    *m[2] = s;
  } else {
    *m[1] = 0;
    *m[2] = 0;
  }
  *dr = r;
  *dg = g;
  *db = b;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<setsat>:
  endbr64
  mov    %esi,%eax
  mov    %edx,-0xc(%rsp)
  mov    %ecx,%r10d
  mov    %esi,%edx
  mov    %esi,-0x8(%rsp)
  mov    %edi,%ecx
  mov    -0xc(%rsp),%esi
  mov    %edi,-0x4(%rsp)
  cmp    %eax,%edi
  jg     L98
  cmp    %esi,%edi
  jle    L52
  cmp    %eax,%edi
  jl     L12
  mov    %edi,%edx
  lea    -0x8(%rsp),%r11
  lea    -0x4(%rsp),%rdi
  jmp    L61
  nop
L98:
  cmp    %esi,%eax
  jg     L8
  mov    %esi,%eax
  mov    %edx,%esi
  mov    %edi,%edx
  mov    %eax,%ecx
  lea    -0x4(%rsp),%rdi
L76:
  lea    -0xc(%rsp),%rax
  cmp    %ecx,%edx
  jle    L58
  lea    -0xc(%rsp),%r11
L61:
  mov    (%r11),%eax
  sub    %esi,%edx
  mov    %edx,%ecx
  sub    %esi,%eax
  imul   %r10d,%eax
  cltd
  idiv   %ecx
  mov    %eax,(%r11)
  mov    %r10d,(%rdi)
L103:
  mov    -0x4(%rsp),%eax
  mov    -0xc(%rsp),%edx
  mov    %eax,(%r8)
  mov    -0x8(%rsp),%eax
  mov    %eax,(%r9)
  mov    0x8(%rsp),%rax
  mov    %edx,(%rax)
  ret
  nop
L8:
  lea    -0x4(%rsp),%rax
  lea    -0x8(%rsp),%rdi
L58:
  cmp    %esi,%ecx
  jg     L105
  movl   $0x0,(%rdi)
  movl   $0x0,(%rax)
  jmp    L103
  nopl   0x0(%rax)
L52:
  mov    %esi,%eax
  mov    %edi,%esi
  lea    -0x8(%rsp),%rdi
  mov    %eax,%ecx
  jmp    L76
L105:
  mov    %rdi,%r11
  mov    %ecx,%edx
  mov    %rax,%rdi
  jmp    L61
L12:
  mov    %edx,%ecx
  lea    -0x8(%rsp),%rax
  lea    -0x4(%rsp),%rdi
  jmp    L58
```

assistant: ```c
void setsat(int r, int g, int b, int s, int *dr, int *dg, int *db) {
  int *m[3] = {&r, &g, &b};
  int *t;
  if (*m[0] > *m[1])
    (t = m[0], m[0] = m[1], m[1] = t);
  if (*m[0] > *m[2])
    (t = m[0], m[0] = m[2], m[2] = t);
  if (*m[1] > *m[2])
    (t = m[1], m[1] = m[2], m[2] = t);
  if (*m[2] > *m[0]) {
    *m[1] = (*m[1] - *m[0]) * s / (*m[2] - *m[0]);
    *m[2] = s;
  } else {
    *m[1] = 0;
    *m[2] = 0;
  }
  *dr = r;
  *dg = g;
  *db = b;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<setsat>:
  endbr64
  mov    %esi,%eax
  mov    %esi,-0x8(%rsp)
  mov    %ecx,%esi
  mov    %edx,-0xc(%rsp)
  mov    %edi,%edx
  mov    %edi,-0x4(%rsp)
  cmp    %eax,%edi
  jg     L42
  mov    -0xc(%rsp),%edi
  cmp    %edi,%edx
  jle    L10
  cmp    %eax,%edx
  jl     L57
  lea    -0x4(%rsp),%r10
  lea    -0x8(%rsp),%r11
L105:
  sub    %edi,%eax
  mov    %edx,%ecx
  imul   %esi,%eax
  sub    %edi,%ecx
  cltd
  idiv   %ecx
  mov    %eax,(%r11)
  mov    %esi,(%r10)
  jmp    L81
  nopl   0x0(%rax)
L42:
  mov    -0xc(%rsp),%ecx
  cmp    %ecx,%eax
  jg     L32
  mov    %ecx,%edi
  mov    %eax,%ecx
  lea    -0x4(%rsp),%r10
  mov    %edx,%eax
  cmp    %edi,%eax
  jg     L7
L27:
  lea    -0xc(%rsp),%rax
L15:
  cmp    %ecx,%edi
  jg     L6
  movl   $0x0,(%r10)
  movl   $0x0,(%rax)
L81:
  mov    -0x4(%rsp),%eax
  mov    -0xc(%rsp),%edx
  mov    %eax,(%r8)
  mov    -0x8(%rsp),%eax
  mov    %eax,(%r9)
  mov    0x8(%rsp),%rax
  mov    %edx,(%rax)
  ret
  nopw   0x0(%rax,%rax,1)
L32:
  mov    %edx,%edi
  lea    -0x4(%rsp),%rax
  lea    -0x8(%rsp),%r10
  jmp    L15
  xchg   %ax,%ax
L10:
  mov    %edx,%ecx
  lea    -0x8(%rsp),%r10
  cmp    %edi,%eax
  jle    L27
L7:
  lea    -0xc(%rsp),%r11
L94:
  mov    %eax,%edx
  mov    %ecx,%edi
  mov    (%r11),%eax
  jmp    L105
L6:
  mov    %r10,%r11
  mov    %rax,%r10
  mov    %edi,%eax
  jmp    L94
L57:
  mov    %edi,%ecx
  lea    -0x4(%rsp),%r10
  mov    %eax,%edi
  lea    -0x8(%rsp),%rax
  jmp    L15
```

assistant: ```c
void setsat(int r, int g, int b, int s, int *dr, int *dg, int *db) {
  int *m[3] = {&r, &g, &b};
  int *t;
  if (*m[0] > *m[1])
    (t = m[0], m[0] = m[1], m[1] = t);
  if (*m[0] > *m[2])
    (t = m[0], m[0] = m[2], m[2] = t);
  if (*m[1] > *m[2])
    (t = m[1], m[1] = m[2], m[2] = t);
  if (*m[2] > *m[0]) {
    *m[1] = (*m[1] - *m[0]) * s / (*m[2] - *m[0]);
    *m[2] = s;
  } else {
    *m[1] = 0;
    *m[2] = 0;
  }
  *dr = r;
  *dg = g;
  *db = b;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<list_strcmp>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %rsi,-0x10(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  je     L27
  cmpq   $0x0,-0x10(%rbp)
  jne    L0
L27:
  mov    $0xffffffff,%eax
  jmp    L30
L0:
  mov    -0x10(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L38
  mov    $0x1,%eax
  jmp    L30
L38:
  mov    $0x0,%eax
L30:
  leave
  ret
```

assistant: ```c
int list_strcmp(void *x, void *key) {
  if (!x || !key) {
    ;
    return -1;
  }
  if (!strcmp((char *)x, (char *)key))
    return 1;
  return 0;
}
```
user: Translate the below assembly code into C programming language:

```asm
<list_strcmp>:
  endbr64
  test   %rdi,%rdi
  je     L6
  test   %rsi,%rsi
  je     L6
  sub    $0x8,%rsp
  call   <strcmp@plt>
  test   %eax,%eax
  sete   %al
  movzbl %al,%eax
  add    $0x8,%rsp
  ret
L6:
  mov    $0xffffffff,%eax
  ret
```

assistant: ```c
int list_strcmp(void *x, void *key) {
  if (!x || !key) {
    ;
    return -1;
  }
  if (!strcmp((char *)x, (char *)key))
    return 1;
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<list_strcmp>:
  endbr64
  test   %rdi,%rdi
  je     L11
  test   %rsi,%rsi
  je     L11
  sub    $0x8,%rsp
  call   <strcmp@plt>
  test   %eax,%eax
  sete   %al
  add    $0x8,%rsp
  movzbl %al,%eax
  ret
  nopl   0x0(%rax)
L11:
  mov    $0xffffffff,%eax
  ret
```

assistant: ```c
int list_strcmp(void *x, void *key) {
  if (!x || !key) {
    ;
    return -1;
  }
  if (!strcmp((char *)x, (char *)key))
    return 1;
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<list_strcmp>:
  endbr64
  test   %rdi,%rdi
  je     L7
  test   %rsi,%rsi
  je     L7
  sub    $0x8,%rsp
  call   <strcmp@plt>
  test   %eax,%eax
  sete   %al
  add    $0x8,%rsp
  movzbl %al,%eax
  ret
  nopl   0x0(%rax)
L7:
  mov    $0xffffffff,%eax
  ret
```

assistant: ```c
int list_strcmp(void *x, void *key) {
  if (!x || !key) {
    ;
    return -1;
  }
  if (!strcmp((char *)x, (char *)key))
    return 1;
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<wcscat>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <wcslen@plt>
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  mov    -0x10(%rbp),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <wcscpy@plt>
  mov    -0x8(%rbp),%rax
  leave
  ret
```

assistant: ```c
wchar_t *wcscat(wchar_t *dest, const wchar_t *src) {
  wcscpy(dest + wcslen(dest), src);
  return dest;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<wcscat>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  mov    %rsi,%rbp
  call   <wcslen@plt>
  cltq
  lea    (%rbx,%rax,4),%rdi
  mov    %rbp,%rsi
  call   <wcscpy@plt>
  mov    %rbx,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
wchar_t *wcscat(wchar_t *dest, const wchar_t *src) {
  wcscpy(dest + wcslen(dest), src);
  return dest;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<wcscat>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %rsi,%rbp
  sub    $0x8,%rsp
  call   <wcslen@plt>
  mov    %rbp,%rsi
  cltq
  lea    (%r12,%rax,4),%rdi
  call   <wcscpy@plt>
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
wchar_t *wcscat(wchar_t *dest, const wchar_t *src) {
  wcscpy(dest + wcslen(dest), src);
  return dest;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<wcscat>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %rsi,%rbp
  sub    $0x8,%rsp
  call   <wcslen@plt>
  mov    %rbp,%rsi
  cltq
  lea    (%r12,%rax,4),%rdi
  call   <wcscpy@plt>
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
wchar_t *wcscat(wchar_t *dest, const wchar_t *src) {
  wcscpy(dest + wcslen(dest), src);
  return dest;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<rt_modbus_read_registers>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x38(%rbp),%rax
  lea    0x8(%rax),%rcx
  lea    -0x24(%rbp),%rax
  mov    $0x2,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  lea    -0x24(%rbp),%rax
  mov    %rax,%rdi
  call   <swap16@plt>
  mov    -0x38(%rbp),%rax
  lea    0x10(%rax),%rcx
  lea    -0x20(%rbp),%rax
  mov    $0x2,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  lea    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <swap16@plt>
  mov    -0x20(%rbp),%eax
  cmp    $0x78,%eax
  jle    L9
  mov    -0x38(%rbp),%rax
  add    $0x4,%rax
  movl   $0x83,(%rax)
  mov    -0x38(%rbp),%rax
  add    $0x8,%rax
  movl   $0x4,(%rax)
  mov    -0x38(%rbp),%rax
  mov    $0xffff,%edx
  mov    $0x5,%esi
  mov    %rax,%rdi
  call   <add_CRC@plt>
  mov    $0x5,%eax
  jmp    L47
L9:
  mov    -0x20(%rbp),%eax
  add    %eax,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x38(%rbp),%rax
  lea    0x8(%rax),%rdx
  mov    -0x14(%rbp),%eax
  mov    %eax,(%rdx)
  mov    -0x38(%rbp),%rax
  add    $0xc,%rax
  mov    %rax,-0x10(%rbp)
  movl   $0x0,-0x18(%rbp)
  jmp    L13
L28:
  mov    -0x24(%rbp),%edx
  mov    -0x18(%rbp),%eax
  add    %edx,%eax
  and    $0x1,%eax
  test   %eax,%eax
  je     L35
  movl   $0xaaaa,-0x1c(%rbp)
  jmp    L5
L35:
  movl   $0x5555,-0x1c(%rbp)
L5:
  lea    -0x1c(%rbp),%rax
  mov    %rax,%rdi
  call   <swap16@plt>
  lea    -0x1c(%rbp),%rcx
  mov    -0x10(%rbp),%rax
  mov    $0x2,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  addq   $0x8,-0x10(%rbp)
  addl   $0x1,-0x18(%rbp)
L13:
  mov    -0x20(%rbp),%eax
  cmp    %eax,-0x18(%rbp)
  jl     L28
  mov    -0x14(%rbp),%eax
  lea    0x5(%rax),%ecx
  mov    -0x38(%rbp),%rax
  mov    $0xffff,%edx
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <add_CRC@plt>
  mov    -0x14(%rbp),%eax
  add    $0x5,%eax
L47:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L34
  call   <__stack_chk_fail@plt>
L34:
  leave
  ret
```

assistant: ```c
int rt_modbus_read_registers(uint8_t *buf, int n) {
  uint16_t start_point;
  uint16_t num_points;
  int byte_count;
  uint8_t *p;
  int i;
  uint16_t tmp;
  memcpy(&start_point, buf + 2, 2);
  swap16(&start_point);
  memcpy(&num_points, buf + 4, 2);
  swap16(&num_points);
  if (num_points > 120) {
    buf[1] = 128 + (0x03);
    buf[2] = 4;
    add_CRC(buf, 5, 0xffff);
    return 5;
  }
  byte_count = num_points * 2;
  buf[2] = byte_count;
  p = buf + 3;
  for (i = 0; i < num_points; i++) {
    if ((start_point + i) % 2) {
      tmp = 0xAAAA;
    } else {
      tmp = 0x5555;
    }
    swap16(&tmp);
    memcpy(p, &tmp, 2);
    p += 2;
  }
  add_CRC(buf, 5 + byte_count, 0xffff);
  return (5 + byte_count);
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<rt_modbus_read_registers>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x20,%rsp
  mov    %rdi,%r13
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0x8(%rdi),%rsi
  lea    0xc(%rsp),%rbx
  mov    $0x2,%edx
  mov    %rbx,%rdi
  call   <memcpy@plt>
  mov    %rbx,%rdi
  call   <swap16@plt>
  lea    0x10(%r13),%rsi
  lea    0x10(%rsp),%rbx
  mov    $0x2,%edx
  mov    %rbx,%rdi
  call   <memcpy@plt>
  mov    %rbx,%rdi
  call   <swap16@plt>
  mov    0x10(%rsp),%eax
  cmp    $0x78,%eax
  jg     L8
  lea    (%rax,%rax,1),%r14d
  mov    %r14d,0x8(%r13)
  lea    0xc(%r13),%rbp
  test   %eax,%eax
  jle    L3
  mov    $0x0,%ebx
  lea    0x14(%rsp),%r12
L1:
  mov    %ebx,%eax
  add    0xc(%rsp),%eax
  and    $0x1,%eax
  cmp    $0x1,%eax
  sbb    %eax,%eax
  and    $0xffffaaab,%eax
  add    $0xaaaa,%eax
  mov    %eax,0x14(%rsp)
  mov    %r12,%rdi
  call   <swap16@plt>
  mov    $0x2,%edx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <memcpy@plt>
  add    $0x8,%rbp
  add    $0x1,%ebx
  cmp    %ebx,0x10(%rsp)
  jg     L1
L3:
  add    $0x5,%r14d
  mov    $0xffff,%edx
  mov    %r14d,%esi
  mov    %r13,%rdi
  call   <add_CRC@plt>
L4:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L25
  mov    %r14d,%eax
  add    $0x20,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L8:
  movl   $0x83,0x4(%r13)
  movl   $0x4,0x8(%r13)
  mov    $0xffff,%edx
  mov    $0x5,%esi
  mov    %r13,%rdi
  call   <add_CRC@plt>
  mov    $0x5,%r14d
  jmp    L4
L25:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int rt_modbus_read_registers(uint8_t *buf, int n) {
  uint16_t start_point;
  uint16_t num_points;
  int byte_count;
  uint8_t *p;
  int i;
  uint16_t tmp;
  memcpy(&start_point, buf + 2, 2);
  swap16(&start_point);
  memcpy(&num_points, buf + 4, 2);
  swap16(&num_points);
  if (num_points > 120) {
    buf[1] = 128 + (0x03);
    buf[2] = 4;
    add_CRC(buf, 5, 0xffff);
    return 5;
  }
  byte_count = num_points * 2;
  buf[2] = byte_count;
  p = buf + 3;
  for (i = 0; i < num_points; i++) {
    if ((start_point + i) % 2) {
      tmp = 0xAAAA;
    } else {
      tmp = 0x5555;
    }
    swap16(&tmp);
    memcpy(p, &tmp, 2);
    p += 2;
  }
  add_CRC(buf, 5 + byte_count, 0xffff);
  return (5 + byte_count);
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<rt_modbus_read_registers>:
  endbr64
  push   %r14
  lea    0x8(%rdi),%rsi
  mov    $0x2,%edx
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%rbp
  mov    %rbp,%rdi
  call   <memcpy@plt>
  mov    %rbp,%rdi
  lea    0x10(%rsp),%rbp
  call   <swap16@plt>
  lea    0x10(%r13),%rsi
  mov    $0x2,%edx
  mov    %rbp,%rdi
  call   <memcpy@plt>
  mov    %rbp,%rdi
  call   <swap16@plt>
  mov    0x10(%rsp),%eax
  cmp    $0x78,%eax
  jg     L9
  lea    (%rax,%rax,1),%r14d
  lea    0xc(%r13),%rbp
  mov    %r14d,0x8(%r13)
  test   %eax,%eax
  jle    L18
  xor    %ebx,%ebx
  lea    0x14(%rsp),%r12
  nopl   0x0(%rax,%rax,1)
L22:
  mov    0xc(%rsp),%eax
  mov    %r12,%rdi
  add    %ebx,%eax
  and    $0x1,%eax
  cmp    $0x1,%eax
  sbb    %eax,%eax
  add    $0x1,%ebx
  and    $0xffffaaab,%eax
  add    $0xaaaa,%eax
  mov    %eax,0x14(%rsp)
  call   <swap16@plt>
  mov    %rbp,%rdi
  mov    $0x2,%edx
  mov    %r12,%rsi
  call   <memcpy@plt>
  add    $0x8,%rbp
  cmp    %ebx,0x10(%rsp)
  jg     L22
L18:
  add    $0x5,%r14d
  mov    $0xffff,%edx
  mov    %r13,%rdi
  mov    %r14d,%esi
  call   <add_CRC@plt>
L6:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L10
  add    $0x20,%rsp
  mov    %r14d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   (%rax)
L9:
  mov    $0xffff,%edx
  mov    $0x5,%esi
  mov    %r13,%rdi
  movabs $0x400000083,%rax
  mov    %rax,0x4(%r13)
  mov    $0x5,%r14d
  call   <add_CRC@plt>
  jmp    L6
L10:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int rt_modbus_read_registers(uint8_t *buf, int n) {
  uint16_t start_point;
  uint16_t num_points;
  int byte_count;
  uint8_t *p;
  int i;
  uint16_t tmp;
  memcpy(&start_point, buf + 2, 2);
  swap16(&start_point);
  memcpy(&num_points, buf + 4, 2);
  swap16(&num_points);
  if (num_points > 120) {
    buf[1] = 128 + (0x03);
    buf[2] = 4;
    add_CRC(buf, 5, 0xffff);
    return 5;
  }
  byte_count = num_points * 2;
  buf[2] = byte_count;
  p = buf + 3;
  for (i = 0; i < num_points; i++) {
    if ((start_point + i) % 2) {
      tmp = 0xAAAA;
    } else {
      tmp = 0x5555;
    }
    swap16(&tmp);
    memcpy(p, &tmp, 2);
    p += 2;
  }
  add_CRC(buf, 5 + byte_count, 0xffff);
  return (5 + byte_count);
}
```