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

```asm
<CRCEvaluate>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  movl   $0xff,-0x24(%rbp)
  movl   $0xff,-0x20(%rbp)
  movq   $0x0,-0x8(%rbp)
  jmp    L7
L10:
  mov    -0x8(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x24(%rbp),%eax
  xor    %eax,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  sarl   $0x4,-0x18(%rbp)
  andl   $0xf,-0x18(%rbp)
  mov    -0x24(%rbp),%eax
  xor    %eax,-0x18(%rbp)
  mov    -0x20(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x18(%rbp),%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x18(%rbp),%eax
  shl    $0x4,%eax
  and    $0xff,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x18(%rbp),%eax
  sar    $0x4,%eax
  and    $0xf,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x14(%rbp),%eax
  or     -0x10(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x18(%rbp),%eax
  add    %eax,%eax
  and    $0xff,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x18(%rbp),%eax
  sar    $0x7,%eax
  and    $0x1,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x14(%rbp),%eax
  or     -0x10(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  andl   $0x1f,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  xor    %eax,-0x24(%rbp)
  mov    -0xc(%rbp),%eax
  and    $0xf0,%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  xor    %eax,-0x24(%rbp)
  mov    -0xc(%rbp),%eax
  add    %eax,%eax
  and    $0xff,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0xc(%rbp),%eax
  sar    $0x7,%eax
  and    $0x1,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x14(%rbp),%eax
  or     -0x10(%rbp),%eax
  mov    %eax,-0xc(%rbp)
  andl   $0xe0,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  xor    %eax,-0x20(%rbp)
  addq   $0x1,-0x8(%rbp)
L7:
  mov    -0x8(%rbp),%rax
  cmp    -0x40(%rbp),%rax
  jb     L10
  mov    -0x24(%rbp),%eax
  shl    $0x8,%eax
  and    $0xffff,%eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x20(%rbp),%eax
  movzbl %al,%eax
  or     %eax,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  pop    %rbp
  ret
```

assistant: ```c
uint16_t CRCEvaluate(uint8_t *datablock, uint32_t datalength) {
  uint32_t i;
  uint16_t crc_tot;
  uint8_t crchi, crclo;
  uint8_t a, b;
  uint8_t tmp1, tmp2;
  crchi = 0xFF;
  crclo = 0xFF;
  for (i = 0; i < datalength; i++) {
    a = datablock[i];
    a ^= crchi;
    crchi = a;
    a >>= 4;
    a &= 0x0F;
    a ^= crchi;
    crchi = crclo;
    crclo = a;
    tmp1 = ((a & 0x0F) << 4) & 0xF0;
    tmp2 = ((a & 0xF0) >> 4) & 0x0F;
    a = tmp1 | tmp2;
    b = a;
    tmp1 = ((a & 0x7F) << 1) & 0xFE;
    tmp2 = ((a & 0x80) >> 7) & 0x01;
    a = tmp1 | tmp2;
    a &= 0x1F;
    crchi ^= a;
    a = b & 0xF0;
    crchi ^= a;
    tmp1 = ((b & 0x7F) << 1) & 0xFE;
    tmp2 = ((b & 0x80) >> 7) & 0x01;
    b = tmp1 | tmp2;
    b &= 0xE0;
    crclo ^= b;
  }
  crc_tot = ((0x00FF & (uint16_t)crchi) << 8) & 0xFF00;
  crc_tot |= (0x00FF & (uint16_t)crclo);
  return (crc_tot);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<CRCEvaluate>:
  endbr64
  test   %rsi,%rsi
  je     L9
  mov    %rdi,%r8
  lea    (%rdi,%rsi,4),%r9
  mov    $0xff,%eax
  mov    $0xff,%edx
L29:
  xor    (%r8),%edx
  mov    %edx,%esi
  sar    $0x4,%esi
  and    $0xf,%esi
  xor    %edx,%esi
  mov    %esi,%edx
  shl    $0x4,%edx
  movzbl %dl,%edx
  mov    %esi,%ecx
  sar    $0x4,%ecx
  and    $0xf,%ecx
  or     %ecx,%edx
  lea    (%rdx,%rdx,1),%ecx
  movzbl %cl,%ecx
  mov    %edx,%edi
  sar    $0x7,%edi
  or     %ecx,%edi
  mov    %edi,%ecx
  and    $0x1f,%ecx
  and    $0xf0,%edx
  xor    %ecx,%edx
  xor    %eax,%edx
  and    $0xe0,%edi
  mov    %edi,%eax
  xor    %esi,%eax
  add    $0x4,%r8
  cmp    %r9,%r8
  jne    L29
L27:
  shl    $0x8,%edx
  movzwl %dx,%edx
  movzbl %al,%eax
  or     %edx,%eax
  ret
L9:
  mov    $0xff,%eax
  mov    $0xff,%edx
  jmp    L27
```

assistant: ```c
uint16_t CRCEvaluate(uint8_t *datablock, uint32_t datalength) {
  uint32_t i;
  uint16_t crc_tot;
  uint8_t crchi, crclo;
  uint8_t a, b;
  uint8_t tmp1, tmp2;
  crchi = 0xFF;
  crclo = 0xFF;
  for (i = 0; i < datalength; i++) {
    a = datablock[i];
    a ^= crchi;
    crchi = a;
    a >>= 4;
    a &= 0x0F;
    a ^= crchi;
    crchi = crclo;
    crclo = a;
    tmp1 = ((a & 0x0F) << 4) & 0xF0;
    tmp2 = ((a & 0xF0) >> 4) & 0x0F;
    a = tmp1 | tmp2;
    b = a;
    tmp1 = ((a & 0x7F) << 1) & 0xFE;
    tmp2 = ((a & 0x80) >> 7) & 0x01;
    a = tmp1 | tmp2;
    a &= 0x1F;
    crchi ^= a;
    a = b & 0xF0;
    crchi ^= a;
    tmp1 = ((b & 0x7F) << 1) & 0xFE;
    tmp2 = ((b & 0x80) >> 7) & 0x01;
    b = tmp1 | tmp2;
    b &= 0xE0;
    crclo ^= b;
  }
  crc_tot = ((0x00FF & (uint16_t)crchi) << 8) & 0xFF00;
  crc_tot |= (0x00FF & (uint16_t)crclo);
  return (crc_tot);
}
```
user: Translate the below assembly code into C programming language:

```asm
<CRCEvaluate>:
  endbr64
  test   %rsi,%rsi
  je     L3
  lea    (%rdi,%rsi,4),%r9
  mov    $0xff,%r8d
  mov    $0xff,%eax
  nopl   0x0(%rax,%rax,1)
L17:
  xor    (%rdi),%eax
  add    $0x4,%rdi
  mov    %eax,%ecx
  sar    $0x4,%ecx
  and    $0xf,%ecx
  xor    %eax,%ecx
  mov    %ecx,%edx
  mov    %ecx,%eax
  shl    $0x4,%edx
  sar    $0x4,%eax
  and    $0xf,%eax
  movzbl %dl,%edx
  or     %eax,%edx
  lea    (%rdx,%rdx,1),%eax
  mov    %edx,%esi
  and    $0xf0,%edx
  movzbl %al,%eax
  sar    $0x7,%esi
  or     %eax,%esi
  mov    %esi,%eax
  and    $0xe0,%esi
  and    $0x1f,%eax
  xor    %ecx,%esi
  xor    %edx,%eax
  xor    %r8d,%eax
  mov    %esi,%r8d
  cmp    %rdi,%r9
  jne    L17
  shl    $0x8,%eax
  movzbl %sil,%r8d
  movzwl %ax,%eax
  or     %r8d,%eax
  ret
  nopl   (%rax)
L3:
  mov    $0xffff,%eax
  ret
```

assistant: ```c
uint16_t CRCEvaluate(uint8_t *datablock, uint32_t datalength) {
  uint32_t i;
  uint16_t crc_tot;
  uint8_t crchi, crclo;
  uint8_t a, b;
  uint8_t tmp1, tmp2;
  crchi = 0xFF;
  crclo = 0xFF;
  for (i = 0; i < datalength; i++) {
    a = datablock[i];
    a ^= crchi;
    crchi = a;
    a >>= 4;
    a &= 0x0F;
    a ^= crchi;
    crchi = crclo;
    crclo = a;
    tmp1 = ((a & 0x0F) << 4) & 0xF0;
    tmp2 = ((a & 0xF0) >> 4) & 0x0F;
    a = tmp1 | tmp2;
    b = a;
    tmp1 = ((a & 0x7F) << 1) & 0xFE;
    tmp2 = ((a & 0x80) >> 7) & 0x01;
    a = tmp1 | tmp2;
    a &= 0x1F;
    crchi ^= a;
    a = b & 0xF0;
    crchi ^= a;
    tmp1 = ((b & 0x7F) << 1) & 0xFE;
    tmp2 = ((b & 0x80) >> 7) & 0x01;
    b = tmp1 | tmp2;
    b &= 0xE0;
    crclo ^= b;
  }
  crc_tot = ((0x00FF & (uint16_t)crchi) << 8) & 0xFF00;
  crc_tot |= (0x00FF & (uint16_t)crclo);
  return (crc_tot);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<CRCEvaluate>:
  endbr64
  test   %rsi,%rsi
  je     L4
  lea    (%rdi,%rsi,4),%r9
  mov    $0xff,%r8d
  mov    $0xff,%eax
  nopl   0x0(%rax,%rax,1)
L3:
  xor    (%rdi),%eax
  add    $0x4,%rdi
  mov    %eax,%ecx
  sar    $0x4,%ecx
  and    $0xf,%ecx
  xor    %eax,%ecx
  mov    %ecx,%edx
  mov    %ecx,%eax
  shl    $0x4,%edx
  sar    $0x4,%eax
  and    $0xf,%eax
  movzbl %dl,%edx
  or     %eax,%edx
  lea    (%rdx,%rdx,1),%eax
  mov    %edx,%esi
  and    $0xf0,%edx
  movzbl %al,%eax
  sar    $0x7,%esi
  or     %eax,%esi
  mov    %esi,%eax
  and    $0xe0,%esi
  and    $0x1f,%eax
  xor    %ecx,%esi
  xor    %edx,%eax
  xor    %r8d,%eax
  mov    %esi,%r8d
  cmp    %rdi,%r9
  jne    L3
  shl    $0x8,%eax
  movzbl %sil,%r8d
  movzwl %ax,%eax
  or     %r8d,%eax
  ret
  nopl   (%rax)
L4:
  mov    $0xffff,%eax
  ret
```

assistant: ```c
uint16_t CRCEvaluate(uint8_t *datablock, uint32_t datalength) {
  uint32_t i;
  uint16_t crc_tot;
  uint8_t crchi, crclo;
  uint8_t a, b;
  uint8_t tmp1, tmp2;
  crchi = 0xFF;
  crclo = 0xFF;
  for (i = 0; i < datalength; i++) {
    a = datablock[i];
    a ^= crchi;
    crchi = a;
    a >>= 4;
    a &= 0x0F;
    a ^= crchi;
    crchi = crclo;
    crclo = a;
    tmp1 = ((a & 0x0F) << 4) & 0xF0;
    tmp2 = ((a & 0xF0) >> 4) & 0x0F;
    a = tmp1 | tmp2;
    b = a;
    tmp1 = ((a & 0x7F) << 1) & 0xFE;
    tmp2 = ((a & 0x80) >> 7) & 0x01;
    a = tmp1 | tmp2;
    a &= 0x1F;
    crchi ^= a;
    a = b & 0xF0;
    crchi ^= a;
    tmp1 = ((b & 0x7F) << 1) & 0xFE;
    tmp2 = ((b & 0x80) >> 7) & 0x01;
    b = tmp1 | tmp2;
    b &= 0xE0;
    crclo ^= b;
  }
  crc_tot = ((0x00FF & (uint16_t)crchi) << 8) & 0xFF00;
  crc_tot |= (0x00FF & (uint16_t)crclo);
  return (crc_tot);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<Uart_Printf>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x1a0,%rsp
  mov    %edi,-0x194(%rbp)
  mov    %rsi,-0x1a0(%rbp)
  mov    %rdx,-0xa0(%rbp)
  mov    %rcx,-0x98(%rbp)
  mov    %r8,-0x90(%rbp)
  mov    %r9,-0x88(%rbp)
  test   %al,%al
  je     L16
  movaps %xmm0,-0x80(%rbp)
  movaps %xmm1,-0x70(%rbp)
  movaps %xmm2,-0x60(%rbp)
  movaps %xmm3,-0x50(%rbp)
  movaps %xmm4,-0x40(%rbp)
  movaps %xmm5,-0x30(%rbp)
  movaps %xmm6,-0x20(%rbp)
  movaps %xmm7,-0x10(%rbp)
L16:
  mov    %fs:0x28,%rax
  mov    %rax,-0xb8(%rbp)
  xor    %eax,%eax
  mov    -0x1a0(%rbp),%rdx
  mov    -0x184(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <va_start@plt>
  mov    -0x184(%rbp),%edx
  mov    -0x1a0(%rbp),%rcx
  lea    -0x180(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <vsprintf@plt>
  lea    -0x180(%rbp),%rdx
  mov    -0x194(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <Uart_Print@plt>
  mov    -0x184(%rbp),%eax
  mov    %eax,%edi
  call   <va_end@plt>
  nop
  mov    -0xb8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L11
  call   <__stack_chk_fail@plt>
L11:
  leave
  ret
```

assistant: ```c
void Uart_Printf(int Ch, char *format, ...) {
  char Str[200];
  va_list ap;
  va_start(ap, format);
  vsprintf(Str, format, ap);
  Uart_Print(Ch, Str);
  va_end(ap);
}
```
user: Translate the below assembly code into C programming language:

```asm
<Uart_Printf>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xd8,%rsp
  mov    %edi,%r12d
  mov    %rsi,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0xc8(%rsp)
  xor    %eax,%eax
  mov    $0x0,%ebp
  mov    %ebp,%edi
  call   <va_start@plt>
  mov    %rsp,%r13
  mov    %ebp,%edx
  mov    %rbx,%rsi
  mov    %r13,%rdi
  call   <vsprintf@plt>
  mov    %r13,%rsi
  mov    %r12d,%edi
  call   <Uart_Print@plt>
  mov    %ebp,%edi
  call   <va_end@plt>
  mov    0xc8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L6
  add    $0xd8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L6:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void Uart_Printf(int Ch, char *format, ...) {
  char Str[200];
  va_list ap;
  va_start(ap, format);
  vsprintf(Str, format, ap);
  Uart_Print(Ch, Str);
  va_end(ap);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<Uart_Printf>:
  endbr64
  push   %r14
  push   %r13
  mov    %edi,%r13d
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  mov    %r12d,%edi
  mov    %rsi,%rbp
  sub    $0xd8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xc8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r14
  call   <va_start@plt>
  mov    %r12d,%edx
  mov    %rbp,%rsi
  mov    %r14,%rdi
  call   <vsprintf@plt>
  mov    %r13d,%edi
  mov    %r14,%rsi
  call   <Uart_Print@plt>
  mov    %r12d,%edi
  call   <va_end@plt>
  mov    0xc8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L4
  add    $0xd8,%rsp
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L4:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void Uart_Printf(int Ch, char *format, ...) {
  char Str[200];
  va_list ap;
  va_start(ap, format);
  vsprintf(Str, format, ap);
  Uart_Print(Ch, Str);
  va_end(ap);
}
```
user: What is the c source code of the assembly code below?

```asm
<Uart_Printf>:
  endbr64
  push   %r14
  push   %r13
  mov    %edi,%r13d
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  mov    %r12d,%edi
  mov    %rsi,%rbp
  sub    $0xd8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xc8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r14
  call   <va_start@plt>
  mov    %r12d,%edx
  mov    %rbp,%rsi
  mov    %r14,%rdi
  call   <vsprintf@plt>
  mov    %r13d,%edi
  mov    %r14,%rsi
  call   <Uart_Print@plt>
  mov    %r12d,%edi
  call   <va_end@plt>
  mov    0xc8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L7
  add    $0xd8,%rsp
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L7:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void Uart_Printf(int Ch, char *format, ...) {
  char Str[200];
  va_list ap;
  va_start(ap, format);
  vsprintf(Str, format, ap);
  Uart_Print(Ch, Str);
  va_end(ap);
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<fus_vm_reset>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <fus_vm_cleanup@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <fus_vm_init@plt>
  leave
  ret
```

assistant: ```c
int fus_vm_reset(struct fus_vm_t *vm) {
  fus_vm_cleanup(vm);
  return fus_vm_init(vm);
}
```
user: Translate the below assembly code into C programming language:

```asm
<fus_vm_reset>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  call   <fus_vm_cleanup@plt>
  mov    %rbx,%rdi
  call   <fus_vm_init@plt>
  pop    %rbx
  ret
```

assistant: ```c
int fus_vm_reset(struct fus_vm_t *vm) {
  fus_vm_cleanup(vm);
  return fus_vm_init(vm);
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<fus_vm_reset>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  call   <fus_vm_cleanup@plt>
  mov    %rbp,%rdi
  pop    %rbp
  jmp    1060 <fus_vm_init@plt>
```

assistant: ```c
int fus_vm_reset(struct fus_vm_t *vm) {
  fus_vm_cleanup(vm);
  return fus_vm_init(vm);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<fus_vm_reset>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  call   <fus_vm_cleanup@plt>
  mov    %rbp,%rdi
  pop    %rbp
  jmp    1060 <fus_vm_init@plt>
```

assistant: ```c
int fus_vm_reset(struct fus_vm_t *vm) {
  fus_vm_cleanup(vm);
  return fus_vm_init(vm);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<COM_RandShuffle>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  cmpl   $0x1,-0x1c(%rbp)
  jle    L29
  movl   $0x0,-0xc(%rbp)
  jmp    L25
L11:
  mov    $0x0,%eax
  call   <COM_Rand@plt>
  mov    -0xc(%rbp),%edx
  add    %edx,%eax
  cltd
  idivl  -0x1c(%rbp)
  mov    %edx,-0x8(%rbp)
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x4(%rbp)
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    -0x8(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x18(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x4(%rbp),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0xc(%rbp)
L25:
  mov    -0x1c(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0xc(%rbp)
  jl     L11
L29:
  nop
  leave
  ret
```

assistant: ```c
void COM_RandShuffle(int *array, int n) {
  if (n > 1) {
    for (int i = 0; i < n - 1; i++) {
      int j = (i + COM_Rand()) % n;
      int t = array[j];
      array[j] = array[i];
      array[i] = t;
    }
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<COM_RandShuffle>:
  endbr64
  cmp    $0x1,%esi
  jle    L9
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  mov    %esi,%r12d
  lea    -0x1(%rsi),%r13d
  mov    $0x0,%ebx
L18:
  mov    $0x0,%eax
  call   <COM_Rand@plt>
  add    %ebx,%eax
  cltd
  idiv   %r12d
  movslq %edx,%rdx
  lea    0x0(%rbp,%rdx,4),%rax
  mov    (%rax),%edx
  mov    0x0(%rbp,%rbx,4),%ecx
  mov    %ecx,(%rax)
  mov    %edx,0x0(%rbp,%rbx,4)
  add    $0x1,%rbx
  cmp    %r13,%rbx
  jne    L18
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L9:
  ret
```

assistant: ```c
void COM_RandShuffle(int *array, int n) {
  if (n > 1) {
    for (int i = 0; i < n - 1; i++) {
      int j = (i + COM_Rand()) % n;
      int t = array[j];
      array[j] = array[i];
      array[i] = t;
    }
  }
}
```
user: What is the c source code of the assembly code below?

```asm
<COM_RandShuffle>:
  endbr64
  cmp    $0x1,%esi
  jle    L18
  push   %r13
  mov    %rdi,%r13
  push   %r12
  lea    -0x1(%rsi),%r12d
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x8,%rsp
  xchg   %ax,%ax
L16:
  xor    %eax,%eax
  call   <COM_Rand@plt>
  mov    0x0(%r13,%rbx,4),%ecx
  add    %ebx,%eax
  cltd
  idiv   %ebp
  movslq %edx,%rdx
  lea    0x0(%r13,%rdx,4),%rax
  mov    (%rax),%edx
  mov    %ecx,(%rax)
  mov    %edx,0x0(%r13,%rbx,4)
  add    $0x1,%rbx
  cmp    %r12,%rbx
  jne    L16
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  cs nopw 0x0(%rax,%rax,1)
L18:
  ret
```

assistant: ```c
void COM_RandShuffle(int *array, int n) {
  if (n > 1) {
    for (int i = 0; i < n - 1; i++) {
      int j = (i + COM_Rand()) % n;
      int t = array[j];
      array[j] = array[i];
      array[i] = t;
    }
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<COM_RandShuffle>:
  endbr64
  cmp    $0x1,%esi
  jle    L13
  push   %r13
  mov    %rdi,%r13
  push   %r12
  lea    -0x1(%rsi),%r12d
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x8,%rsp
  xchg   %ax,%ax
L2:
  xor    %eax,%eax
  call   <COM_Rand@plt>
  mov    0x0(%r13,%rbx,4),%ecx
  add    %ebx,%eax
  cltd
  idiv   %ebp
  movslq %edx,%rdx
  lea    0x0(%r13,%rdx,4),%rax
  mov    (%rax),%edx
  mov    %ecx,(%rax)
  mov    %edx,0x0(%r13,%rbx,4)
  add    $0x1,%rbx
  cmp    %r12,%rbx
  jne    L2
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  cs nopw 0x0(%rax,%rax,1)
L13:
  ret
```

assistant: ```c
void COM_RandShuffle(int *array, int n) {
  if (n > 1) {
    for (int i = 0; i < n - 1; i++) {
      int j = (i + COM_Rand()) % n;
      int t = array[j];
      array[j] = array[i];
      array[i] = t;
    }
  }
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<do_swap2>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  movzbl 0x1(%rax),%eax
  mov    %al,-0x9(%rbp)
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  mov    -0x8(%rbp),%rax
  movzbl -0x9(%rbp),%edx
  mov    %dl,(%rax)
  nop
  pop    %rbp
  ret
```

assistant: ```c
void do_swap2(void *i) {
  char *p = (char *)i;
  char tmp;
  tmp = p[1];
  p[1] = p[0];
  p[0] = tmp;
}
```
user: Translate the below assembly code into C programming language:

```asm
<do_swap2>:
  endbr64
  movzbl 0x1(%rdi),%eax
  movzbl (%rdi),%edx
  mov    %dl,0x1(%rdi)
  mov    %al,(%rdi)
  ret
```

assistant: ```c
void do_swap2(void *i) {
  char *p = (char *)i;
  char tmp;
  tmp = p[1];
  p[1] = p[0];
  p[0] = tmp;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<do_swap2>:
  endbr64
  rolw   $0x8,(%rdi)
  ret
```

assistant: ```c
void do_swap2(void *i) {
  char *p = (char *)i;
  char tmp;
  tmp = p[1];
  p[1] = p[0];
  p[0] = tmp;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<do_swap2>:
  endbr64
  rolw   $0x8,(%rdi)
  ret
```

assistant: ```c
void do_swap2(void *i) {
  char *p = (char *)i;
  char tmp;
  tmp = p[1];
  p[1] = p[0];
  p[0] = tmp;
}
```
user: Translate the below assembly code into C programming language:

```asm
<pmu_reset_solar_short>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0xe30,%esi
  mov    $0xe,%edi
  call   <pmu_reg_write@plt>
  mov    $0xc30,%esi
  mov    $0xe,%edi
  call   <pmu_reg_write@plt>
  nop
  pop    %rbp
  ret
```

assistant: ```c
void pmu_reset_solar_short() {
  pmu_reg_write(0x0E, ((0 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8) | (3 << 4) | (0)));
  pmu_reg_write(0x0E, ((0 << 12) | (1 << 11) | (1 << 10) | (0 << 9) | (0 << 8) | (3 << 4) | (0)));
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<pmu_reset_solar_short>:
  endbr64
  sub    $0x8,%rsp
  mov    $0xe30,%esi
  mov    $0xe,%edi
  call   <pmu_reg_write@plt>
  mov    $0xc30,%esi
  mov    $0xe,%edi
  call   <pmu_reg_write@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void pmu_reset_solar_short() {
  pmu_reg_write(0x0E, ((0 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8) | (3 << 4) | (0)));
  pmu_reg_write(0x0E, ((0 << 12) | (1 << 11) | (1 << 10) | (0 << 9) | (0 << 8) | (3 << 4) | (0)));
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<pmu_reset_solar_short>:
  endbr64
  sub    $0x8,%rsp
  mov    $0xe30,%esi
  mov    $0xe,%edi
  call   <pmu_reg_write@plt>
  mov    $0xc30,%esi
  mov    $0xe,%edi
  add    $0x8,%rsp
  jmp    1050 <pmu_reg_write@plt>
```

assistant: ```c
void pmu_reset_solar_short() {
  pmu_reg_write(0x0E, ((0 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8) | (3 << 4) | (0)));
  pmu_reg_write(0x0E, ((0 << 12) | (1 << 11) | (1 << 10) | (0 << 9) | (0 << 8) | (3 << 4) | (0)));
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<pmu_reset_solar_short>:
  endbr64
  sub    $0x8,%rsp
  mov    $0xe30,%esi
  mov    $0xe,%edi
  call   <pmu_reg_write@plt>
  mov    $0xc30,%esi
  mov    $0xe,%edi
  add    $0x8,%rsp
  jmp    1050 <pmu_reg_write@plt>
```

assistant: ```c
void pmu_reset_solar_short() {
  pmu_reg_write(0x0E, ((0 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8) | (3 << 4) | (0)));
  pmu_reg_write(0x0E, ((0 << 12) | (1 << 11) | (1 << 10) | (0 << 9) | (0 << 8) | (3 << 4) | (0)));
}
```
user: Translate the below assembly code into C programming language:

```asm
<intorder>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x10(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x8(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  setle  %al
  movzbl %al,%eax
  pop    %rbp
  ret
```

assistant: ```c
int intorder(void *x, void *y) {
  int *a = x, *b = y;
  return *a <= *b;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<intorder>:
  endbr64
  mov    (%rsi),%eax
  cmp    %eax,(%rdi)
  setle  %al
  movzbl %al,%eax
  ret
```

assistant: ```c
int intorder(void *x, void *y) {
  int *a = x, *b = y;
  return *a <= *b;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<intorder>:
  endbr64
  mov    (%rsi),%eax
  cmp    %eax,(%rdi)
  setle  %al
  movzbl %al,%eax
  ret
```

assistant: ```c
int intorder(void *x, void *y) {
  int *a = x, *b = y;
  return *a <= *b;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<intorder>:
  endbr64
  mov    (%rsi),%eax
  cmp    %eax,(%rdi)
  setle  %al
  movzbl %al,%eax
  ret
```

assistant: ```c
int intorder(void *x, void *y) {
  int *a = x, *b = y;
  return *a <= *b;
}
```