ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Translate the below assembly code into C programming language:

```asm
<encrypt>:
  endbr64
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  movabs $0x7afdb142472c3516,%rax
  mov    %rax,(%rsp)
  test   %esi,%esi
  jle    L32
  lea    -0x1(%rsi),%ecx
  mov    $0x16,%edx
  xor    %eax,%eax
  mov    $0x1,%esi
  add    %rdi,%rcx
  jmp    L38
  nopl   0x0(%rax)
L27:
  movslq %eax,%rdx
  add    $0x1,%rdi
  movzbl (%rsp,%rdx,1),%edx
L38:
  xor    %dl,(%rdi)
  lea    0x1(%rax),%edx
  cmp    $0x7,%eax
  mov    %edx,%eax
  cmove  %esi,%eax
  cmp    %rcx,%rdi
  jne    L27
L32:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L25
  add    $0x18,%rsp
  ret
L25:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void encrypt(char *array, int array_size) {
  int i;
  int j = 0;
  char secret[8] = {22, 53, 44, 71, 66, 177, 253, 122};
  for (i = 0; i < array_size; i++) {
    array[i] ^= secret[j];
    if (j == 7)
      j = 0;
    j++;
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<str2tel>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L12
L18:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbw %al,%dx
  mov    -0x4(%rbp),%eax
  cltq
  lea    (%rax,%rax,1),%rcx
  mov    -0x20(%rbp),%rax
  add    %rcx,%rax
  sub    $0x30,%edx
  mov    %dx,(%rax)
  addl   $0x1,-0x4(%rbp)
L12:
  cmpl   $0x9,-0x4(%rbp)
  jle    L18
  nop
  nop
  pop    %rbp
  ret
```

assistant: ```c
void str2tel(char *phone, unsigned short tel[]) {
  int i;
  for (i = 0; i < 10; i++) {
    tel[i] = phone[i] - 48;
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<str2tel>:
  endbr64
  mov    $0x0,%eax
L1:
  movsbw (%rdi,%rax,1),%dx
  sub    $0x30,%edx
  mov    %dx,(%rsi,%rax,2)
  add    $0x1,%rax
  cmp    $0xa,%rax
  jne    L1
  ret
```

assistant: ```c
void str2tel(char *phone, unsigned short tel[]) {
  int i;
  for (i = 0; i < 10; i++) {
    tel[i] = phone[i] - 48;
  }
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<str2tel>:
  endbr64
  xor    %eax,%eax
  cs nopw 0x0(%rax,%rax,1)
L8:
  movsbw (%rdi,%rax,1),%dx
  sub    $0x30,%edx
  mov    %dx,(%rsi,%rax,2)
  add    $0x1,%rax
  cmp    $0xa,%rax
  jne    L8
  ret
```

assistant: ```c
void str2tel(char *phone, unsigned short tel[]) {
  int i;
  for (i = 0; i < 10; i++) {
    tel[i] = phone[i] - 48;
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<str2tel>:
  endbr64
  movsbw (%rdi),%cx
  sub    $0x30,%ecx
  mov    %cx,(%rsi)
  movsbw 0x1(%rdi),%cx
  sub    $0x30,%ecx
  mov    %cx,0x2(%rsi)
  movsbw 0x2(%rdi),%cx
  sub    $0x30,%ecx
  mov    %cx,0x4(%rsi)
  movsbw 0x3(%rdi),%cx
  sub    $0x30,%ecx
  mov    %cx,0x6(%rsi)
  movsbw 0x4(%rdi),%cx
  sub    $0x30,%ecx
  mov    %cx,0x8(%rsi)
  movsbw 0x5(%rdi),%cx
  sub    $0x30,%ecx
  mov    %cx,0xa(%rsi)
  movsbw 0x6(%rdi),%cx
  sub    $0x30,%ecx
  mov    %cx,0xc(%rsi)
  movsbw 0x7(%rdi),%cx
  sub    $0x30,%ecx
  mov    %cx,0xe(%rsi)
  movsbw 0x8(%rdi),%cx
  sub    $0x30,%ecx
  mov    %cx,0x10(%rsi)
  movsbw 0x9(%rdi),%dx
  sub    $0x30,%edx
  mov    %dx,0x12(%rsi)
  ret
```

assistant: ```c
void str2tel(char *phone, unsigned short tel[]) {
  int i;
  for (i = 0; i < 10; i++) {
    tel[i] = phone[i] - 48;
  }
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<GeneratePeers>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %esi,-0x28(%rbp)
  mov    %edx,-0x2c(%rbp)
  mov    %ecx,-0x30(%rbp)
  mov    -0x28(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x30(%rbp),%eax
  mov    %eax,%edi
  call   <sqrt@plt>
  mov    %eax,-0xc(%rbp)
  movl   $0x0,-0x10(%rbp)
  movl   $0x0,-0x14(%rbp)
  jmp    L62
L14:
  mov    -0x24(%rbp),%eax
  cltd
  idivl  -0x30(%rbp)
  mov    %eax,%ecx
  mov    -0x14(%rbp),%eax
  cltd
  idivl  -0x30(%rbp)
  cmp    %eax,%ecx
  je     L2
  mov    -0x24(%rbp),%eax
  cltd
  idivl  -0x30(%rbp)
  mov    %edx,%ecx
  mov    -0x14(%rbp),%eax
  cltd
  idivl  -0x30(%rbp)
  mov    %edx,%eax
  cmp    %eax,%ecx
  je     L2
  mov    -0x24(%rbp),%eax
  cltd
  idivl  -0x30(%rbp)
  cltd
  idivl  -0xc(%rbp)
  mov    %eax,%ecx
  mov    -0x14(%rbp),%eax
  cltd
  idivl  -0x30(%rbp)
  cltd
  idivl  -0xc(%rbp)
  cmp    %eax,%ecx
  jne    L53
  mov    -0x24(%rbp),%eax
  cltd
  idivl  -0x30(%rbp)
  mov    %edx,%eax
  cltd
  idivl  -0xc(%rbp)
  mov    %eax,%ecx
  mov    -0x14(%rbp),%eax
  cltd
  idivl  -0x30(%rbp)
  mov    %edx,%eax
  cltd
  idivl  -0xc(%rbp)
  cmp    %eax,%ecx
  jne    L53
L2:
  mov    -0x24(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  je     L53
  mov    -0x10(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x10(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  mov    -0x14(%rbp),%eax
  mov    %eax,(%rdx)
L53:
  addl   $0x1,-0x14(%rbp)
L62:
  mov    -0x14(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jle    L14
  mov    -0x8(%rbp),%rax
  leave
  ret
```

assistant: ```c
int *GeneratePeers(int current_cell, int number_of_peers, int grid_size, int sudoku_size) {
  int *peer_table = malloc(sizeof(int) * number_of_peers);
  int cell2, BoxSize = sqrt(sudoku_size), j = 0;
  for (cell2 = 0; cell2 <= grid_size; cell2++) {
    if (((current_cell / sudoku_size == cell2 / sudoku_size) || (current_cell % sudoku_size == cell2 % sudoku_size) || (current_cell / sudoku_size / BoxSize == cell2 / sudoku_size / BoxSize && current_cell % sudoku_size / BoxSize == cell2 % sudoku_size / BoxSize)) && (current_cell != cell2)) {
      peer_table[j++] = cell2;
    }
  }
  return peer_table;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<GeneratePeers>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%ebp
  mov    %edx,%r13d
  mov    %ecx,%ebx
  lea    0x0(,%rsi,4),%edi
  call   <malloc@plt>
  mov    %rax,%r12
  mov    %ebx,%edi
  call   <sqrt@plt>
  test   %r13d,%r13d
  js     L89
  mov    %eax,%edi
  mov    %ebp,%eax
  cltd
  idiv   %ebx
  mov    %eax,%r11d
  mov    %eax,%r14d
  add    $0x1,%r13d
  mov    $0x0,%r8d
  mov    $0x0,%ecx
  jmp    L15
L74:
  cmp    %ecx,%ebp
  je     L45
  movslq %r8d,%rax
  mov    %ecx,(%r12,%rax,4)
  lea    0x1(%r8),%r8d
L45:
  add    $0x1,%ecx
  cmp    %ecx,%r13d
  je     L89
L15:
  mov    %ecx,%eax
  cltd
  idiv   %ebx
  mov    %eax,%esi
  cmp    %eax,%r11d
  je     L74
  mov    %ebp,%eax
  cltd
  idiv   %ebx
  mov    %edx,%r15d
  mov    %edx,%r10d
  mov    %ecx,%eax
  cltd
  idiv   %ebx
  mov    %edx,%r9d
  cmp    %edx,%r15d
  je     L74
  mov    %r14d,%eax
  cltd
  idiv   %edi
  mov    %eax,%r15d
  mov    %esi,%eax
  cltd
  idiv   %edi
  cmp    %eax,%r15d
  jne    L45
  mov    %r10d,%eax
  cltd
  idiv   %edi
  mov    %eax,%r10d
  mov    %r9d,%eax
  cltd
  idiv   %edi
  cmp    %eax,%r10d
  jne    L45
  jmp    L74
L89:
  mov    %r12,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int *GeneratePeers(int current_cell, int number_of_peers, int grid_size, int sudoku_size) {
  int *peer_table = malloc(sizeof(int) * number_of_peers);
  int cell2, BoxSize = sqrt(sudoku_size), j = 0;
  for (cell2 = 0; cell2 <= grid_size; cell2++) {
    if (((current_cell / sudoku_size == cell2 / sudoku_size) || (current_cell % sudoku_size == cell2 % sudoku_size) || (current_cell / sudoku_size / BoxSize == cell2 / sudoku_size / BoxSize && current_cell % sudoku_size / BoxSize == cell2 % sudoku_size / BoxSize)) && (current_cell != cell2)) {
      peer_table[j++] = cell2;
    }
  }
  return peer_table;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<GeneratePeers>:
  endbr64
  push   %r14
  mov    %edx,%r14d
  push   %r13
  push   %r12
  push   %rbp
  mov    %edi,%ebp
  lea    0x0(,%rsi,4),%edi
  push   %rbx
  mov    %ecx,%ebx
  call   <malloc@plt>
  mov    %ebx,%edi
  mov    %rax,%r12
  call   <sqrt@plt>
  test   %r14d,%r14d
  js     L27
  mov    %eax,%edi
  mov    %ebp,%eax
  lea    0x1(%r14),%r10d
  xor    %r11d,%r11d
  cltd
  xor    %ecx,%ecx
  idiv   %ebx
  mov    %edx,%r13d
  mov    %eax,%r9d
  jmp    L20
  cs nopw 0x0(%rax,%rax,1)
L99:
  cmp    %edx,%r13d
  je     L57
  mov    %r9d,%eax
  cltd
  idiv   %edi
  mov    %eax,%r14d
  mov    %esi,%eax
  cltd
  idiv   %edi
  cmp    %eax,%r14d
  je     L83
L52:
  add    $0x1,%ecx
  cmp    %ecx,%r10d
  je     L27
L20:
  mov    %ecx,%eax
  cltd
  idiv   %ebx
  mov    %edx,%r8d
  mov    %eax,%esi
  cmp    %eax,%r9d
  jne    L99
L57:
  cmp    %ecx,%ebp
  je     L52
  movslq %r11d,%rax
  add    $0x1,%r11d
  mov    %ecx,(%r12,%rax,4)
  add    $0x1,%ecx
  cmp    %ecx,%r10d
  jne    L20
L27:
  pop    %rbx
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopw   0x0(%rax,%rax,1)
L83:
  mov    %r13d,%eax
  cltd
  idiv   %edi
  mov    %eax,%esi
  mov    %r8d,%eax
  cltd
  idiv   %edi
  cmp    %eax,%esi
  jne    L52
  jmp    L57
```

assistant: ```c
int *GeneratePeers(int current_cell, int number_of_peers, int grid_size, int sudoku_size) {
  int *peer_table = malloc(sizeof(int) * number_of_peers);
  int cell2, BoxSize = sqrt(sudoku_size), j = 0;
  for (cell2 = 0; cell2 <= grid_size; cell2++) {
    if (((current_cell / sudoku_size == cell2 / sudoku_size) || (current_cell % sudoku_size == cell2 % sudoku_size) || (current_cell / sudoku_size / BoxSize == cell2 / sudoku_size / BoxSize && current_cell % sudoku_size / BoxSize == cell2 % sudoku_size / BoxSize)) && (current_cell != cell2)) {
      peer_table[j++] = cell2;
    }
  }
  return peer_table;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<GeneratePeers>:
  endbr64
  push   %r14
  mov    %edx,%r14d
  push   %r13
  push   %r12
  push   %rbp
  mov    %edi,%ebp
  lea    0x0(,%rsi,4),%edi
  push   %rbx
  mov    %ecx,%ebx
  call   <malloc@plt>
  mov    %ebx,%edi
  mov    %rax,%r12
  call   <sqrt@plt>
  test   %r14d,%r14d
  js     L22
  mov    %eax,%edi
  mov    %ebp,%eax
  lea    0x1(%r14),%r10d
  xor    %r11d,%r11d
  cltd
  xor    %ecx,%ecx
  idiv   %ebx
  mov    %edx,%r13d
  mov    %eax,%r9d
  jmp    L93
  cs nopw 0x0(%rax,%rax,1)
L76:
  cmp    %edx,%r13d
  je     L73
  mov    %r9d,%eax
  cltd
  idiv   %edi
  mov    %eax,%r14d
  mov    %esi,%eax
  cltd
  idiv   %edi
  cmp    %eax,%r14d
  je     L32
L54:
  add    $0x1,%ecx
  cmp    %r10d,%ecx
  je     L22
L93:
  mov    %ecx,%eax
  cltd
  idiv   %ebx
  mov    %edx,%r8d
  mov    %eax,%esi
  cmp    %eax,%r9d
  jne    L76
L73:
  cmp    %ecx,%ebp
  je     L54
  movslq %r11d,%rax
  add    $0x1,%r11d
  mov    %ecx,(%r12,%rax,4)
  add    $0x1,%ecx
  cmp    %r10d,%ecx
  jne    L93
L22:
  pop    %rbx
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopw   0x0(%rax,%rax,1)
L32:
  mov    %r13d,%eax
  cltd
  idiv   %edi
  mov    %eax,%esi
  mov    %r8d,%eax
  cltd
  idiv   %edi
  cmp    %eax,%esi
  jne    L54
  jmp    L73
```

assistant: ```c
int *GeneratePeers(int current_cell, int number_of_peers, int grid_size, int sudoku_size) {
  int *peer_table = malloc(sizeof(int) * number_of_peers);
  int cell2, BoxSize = sqrt(sudoku_size), j = 0;
  for (cell2 = 0; cell2 <= grid_size; cell2++) {
    if (((current_cell / sudoku_size == cell2 / sudoku_size) || (current_cell % sudoku_size == cell2 % sudoku_size) || (current_cell / sudoku_size / BoxSize == cell2 / sudoku_size / BoxSize && current_cell % sudoku_size / BoxSize == cell2 % sudoku_size / BoxSize)) && (current_cell != cell2)) {
      peer_table[j++] = cell2;
    }
  }
  return peer_table;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<NameFilter>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x4(%rbp)
  jmp    L82
L117:
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  movzbl (%rax),%eax
  and    $0x7f,%eax
  mov    %al,-0x5(%rbp)
  cmpb   $0x20,-0x5(%rbp)
  jne    L51
  jmp    L82
L51:
  movsbl -0x5(%rbp),%eax
  mov    %eax,%edi
  call   <isprint@plt>
  test   %eax,%eax
  jne    L18
  movb   $0x5f,-0x5(%rbp)
L18:
  movsbl -0x5(%rbp),%eax
  cmp    $0x3a,%eax
  jg     L124
  cmp    $0x22,%eax
  jge    L46
  jmp    L30
L136:
  sub    $0x3f,%eax
  movabs $0x2000000020000001,%rdx
  mov    %eax,%ecx
  shr    %cl,%rdx
  mov    %rdx,%rax
  and    $0x1,%eax
  test   %rax,%rax
  setne  %al
  test   %al,%al
  jne    L123
  jmp    L30
L46:
  mov    %eax,%edx
  movabs $0x400d40400000000,%rax
  mov    %edx,%ecx
  shr    %cl,%rax
  and    $0x1,%eax
  test   %rax,%rax
  setne  %al
  test   %al,%al
  jne    L123
  jmp    L30
L124:
  cmp    $0x7c,%eax
  jg     L30
  cmp    $0x3f,%eax
  jge    L136
  jmp    L30
L123:
  movb   $0x5f,-0x5(%rbp)
  nop
L30:
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movzbl -0x5(%rbp),%edx
  mov    %dl,(%rax)
L82:
  mov    -0x4(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x4(%rbp)
  test   %eax,%eax
  jne    L117
  mov    -0x18(%rbp),%rax
  movb   $0x0,(%rax)
  nop
  leave
  ret
```

assistant: ```c
void NameFilter(char *host, char *atari) {
  int len = strlen(atari);
  while (len--) {
    char c = *(atari++) & 0x7F;
    if (c == ' ')
      continue;
    if (!isprint(c))
      c = '_';
    switch (c) {
    case '*':
    case ':':
    case '\"':
    case ',':
    case '.':
    case '|':
    case '?':
    case '/':
    case '\\':
      c = '_';
      break;
    }
    *(host++) = c;
  }
  *host = '\0';
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<NameFilter>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r12
  mov    %rsi,%rbp
  mov    %rsi,%rdi
  call   <strlen@plt>
  test   %eax,%eax
  je     L42
  mov    %eax,%eax
  lea    0x0(%rbp,%rax,1),%r13
  movabs $0x2000000020000001,%r15
  mov    $0x5f,%r14d
  jmp    L29
L71:
  lea    -0x3f(%rbx),%ecx
  cmp    $0x3d,%cl
  ja     L84
  mov    %r15,%rax
  shr    %cl,%rax
  test   $0x1,%al
  cmovne %r14d,%ebx
  jmp    L84
L86:
  mov    $0x5f,%ebx
L84:
  mov    %bl,(%r12)
  lea    0x1(%r12),%r12
L8:
  cmp    %rbp,%r13
  je     L42
L29:
  add    $0x1,%rbp
  movzbl -0x1(%rbp),%ebx
  and    $0x7f,%ebx
  cmp    $0x20,%bl
  je     L8
  movsbl %bl,%edi
  call   <isprint@plt>
  test   %eax,%eax
  je     L86
  cmp    $0x3a,%bl
  jg     L71
  cmp    $0x21,%bl
  jle    L84
  movabs $0x400d40400000000,%rax
  mov    %ebx,%ecx
  shr    %cl,%rax
  test   $0x1,%al
  cmovne %r14d,%ebx
  jmp    L84
L42:
  movb   $0x0,(%r12)
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void NameFilter(char *host, char *atari) {
  int len = strlen(atari);
  while (len--) {
    char c = *(atari++) & 0x7F;
    if (c == ' ')
      continue;
    if (!isprint(c))
      c = '_';
    switch (c) {
    case '*':
    case ':':
    case '\"':
    case ',':
    case '.':
    case '|':
    case '?':
    case '/':
    case '\\':
      c = '_';
      break;
    }
    *(host++) = c;
  }
  *host = '\0';
}
```
user: Translate the below assembly code into C programming language:

```asm
<NameFilter>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  mov    %rsi,%rdi
  push   %r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <strlen@plt>
  test   %eax,%eax
  je     L32
  mov    %eax,%eax
  mov    $0x5f,%r13d
  lea    0x0(%rbp,%rax,1),%r12
  jmp    L43
  nopw   0x0(%rax,%rax,1)
L70:
  cmp    $0x3a,%bl
  jg     L41
  cmp    $0x21,%bl
  jle    L80
  movabs $0x400d40400000000,%rax
  mov    %r15d,%ecx
  shr    %cl,%rax
  test   $0x1,%al
  cmovne %r13d,%ebx
L80:
  mov    %bl,(%r14)
  add    $0x1,%r14
L56:
  cmp    %rbp,%r12
  je     L32
L43:
  movzbl 0x0(%rbp),%ebx
  add    $0x1,%rbp
  and    $0x7f,%ebx
  cmp    $0x20,%bl
  je     L56
  movsbl %bl,%r15d
  mov    %r15d,%edi
  call   <isprint@plt>
  test   %eax,%eax
  jne    L70
  mov    $0x5f,%ebx
  jmp    L80
  nopl   0x0(%rax,%rax,1)
L41:
  lea    -0x3f(%rbx),%ecx
  cmp    $0x3d,%cl
  ja     L80
  movabs $0x2000000020000001,%rax
  shr    %cl,%rax
  test   $0x1,%al
  cmovne %r13d,%ebx
  jmp    L80
  nopl   (%rax)
L32:
  movb   $0x0,(%r14)
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void NameFilter(char *host, char *atari) {
  int len = strlen(atari);
  while (len--) {
    char c = *(atari++) & 0x7F;
    if (c == ' ')
      continue;
    if (!isprint(c))
      c = '_';
    switch (c) {
    case '*':
    case ':':
    case '\"':
    case ',':
    case '.':
    case '|':
    case '?':
    case '/':
    case '\\':
      c = '_';
      break;
    }
    *(host++) = c;
  }
  *host = '\0';
}
```
user: What is the c source code of the assembly code below?

```asm
<NameFilter>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  mov    %rsi,%rdi
  push   %r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <strlen@plt>
  test   %eax,%eax
  je     L42
  mov    %eax,%eax
  mov    $0x5f,%r13d
  lea    0x0(%rbp,%rax,1),%r12
  jmp    L34
  nopw   0x0(%rax,%rax,1)
L93:
  cmp    $0x3a,%bl
  jg     L38
  cmp    $0x21,%bl
  jle    L76
  movabs $0x400d40400000000,%rax
  mov    %r15d,%ecx
  shr    %cl,%rax
  test   $0x1,%al
  cmovne %r13d,%ebx
L76:
  mov    %bl,(%r14)
  add    $0x1,%r14
L49:
  cmp    %rbp,%r12
  je     L42
L34:
  movzbl 0x0(%rbp),%ebx
  add    $0x1,%rbp
  and    $0x7f,%ebx
  cmp    $0x20,%bl
  je     L49
  movsbl %bl,%r15d
  mov    %r15d,%edi
  call   <isprint@plt>
  test   %eax,%eax
  jne    L93
  mov    $0x5f,%ebx
  jmp    L76
  nopl   0x0(%rax,%rax,1)
L38:
  lea    -0x3f(%rbx),%ecx
  cmp    $0x3d,%cl
  ja     L76
  movabs $0x2000000020000001,%rax
  shr    %cl,%rax
  test   $0x1,%al
  cmovne %r13d,%ebx
  jmp    L76
  nopl   (%rax)
L42:
  movb   $0x0,(%r14)
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void NameFilter(char *host, char *atari) {
  int len = strlen(atari);
  while (len--) {
    char c = *(atari++) & 0x7F;
    if (c == ' ')
      continue;
    if (!isprint(c))
      c = '_';
    switch (c) {
    case '*':
    case ':':
    case '\"':
    case ',':
    case '.':
    case '|':
    case '?':
    case '/':
    case '\\':
      c = '_';
      break;
    }
    *(host++) = c;
  }
  *host = '\0';
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<delete_realloc>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %edx,-0x20(%rbp)
  mov    -0x1c(%rbp),%eax
  mov    %eax,-0xc(%rbp)
  jmp    L14
L18:
  mov    -0xc(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    -0xc(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x18(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0xc(%rbp)
L14:
  mov    -0x20(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0xc(%rbp)
  jl     L18
  mov    -0x20(%rbp),%eax
  sub    $0x1,%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  nop
  leave
  ret
```

assistant: ```c
void delete_realloc(int *arr, int index, int size) {
  int i;
  for (i = index; i < size - 1; ++i)
    arr[i] = arr[i + 1];
  int *tmp = realloc(arr, (size - 1) * sizeof(int));
  arr = tmp;
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<delete_realloc>:
  endbr64
  sub    $0x8,%rsp
  lea    -0x1(%rdx),%r8d
  cmp    %r8d,%esi
  jge    L8
  movslq %esi,%rcx
  lea    (%rdi,%rcx,4),%rax
  sub    $0x2,%edx
  sub    %esi,%edx
  add    %rcx,%rdx
  lea    0x4(%rdi,%rdx,4),%rcx
L5:
  mov    0x4(%rax),%edx
  mov    %edx,(%rax)
  add    $0x4,%rax
  cmp    %rcx,%rax
  jne    L5
L8:
  lea    0x0(,%r8,4),%esi
  call   <realloc@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void delete_realloc(int *arr, int index, int size) {
  int i;
  for (i = index; i < size - 1; ++i)
    arr[i] = arr[i + 1];
  int *tmp = realloc(arr, (size - 1) * sizeof(int));
  arr = tmp;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<delete_realloc>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  lea    -0x1(%rdx),%ebx
  sub    $0x8,%rsp
  cmp    %ebx,%esi
  jge    L2
  movslq %esi,%rdi
  sub    $0x2,%edx
  shl    $0x2,%rdi
  sub    %esi,%edx
  lea    0x4(,%rdx,4),%rdx
  lea    0x4(%rbp,%rdi,1),%rsi
  add    %rbp,%rdi
  call   <memmove@plt>
L2:
  add    $0x8,%rsp
  lea    0x0(,%rbx,4),%esi
  mov    %rbp,%rdi
  pop    %rbx
  pop    %rbp
  jmp    1060 <realloc@plt>
```

assistant: ```c
void delete_realloc(int *arr, int index, int size) {
  int i;
  for (i = index; i < size - 1; ++i)
    arr[i] = arr[i + 1];
  int *tmp = realloc(arr, (size - 1) * sizeof(int));
  arr = tmp;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<delete_realloc>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  lea    -0x1(%rdx),%ebx
  sub    $0x8,%rsp
  cmp    %ebx,%esi
  jge    L2
  movslq %esi,%rdi
  sub    $0x2,%edx
  shl    $0x2,%rdi
  sub    %esi,%edx
  lea    0x4(,%rdx,4),%rdx
  lea    0x4(%rbp,%rdi,1),%rsi
  add    %rbp,%rdi
  call   <memmove@plt>
L2:
  add    $0x8,%rsp
  lea    0x0(,%rbx,4),%esi
  mov    %rbp,%rdi
  pop    %rbx
  pop    %rbp
  jmp    1060 <realloc@plt>
```

assistant: ```c
void delete_realloc(int *arr, int index, int size) {
  int i;
  for (i = index; i < size - 1; ++i)
    arr[i] = arr[i + 1];
  int *tmp = realloc(arr, (size - 1) * sizeof(int));
  arr = tmp;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<RKMath_Distance>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
  movl   $0x0,-0x8(%rbp)
  pxor   %xmm0,%xmm0
  movss  %xmm0,-0x4(%rbp)
  jmp    L2
L3:
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm1
  subss  %xmm1,%xmm0
  movd   %xmm0,%eax
  mov    $0x2,%edi
  movd   %eax,%xmm0
  call   <powf@plt>
  movss  -0x4(%rbp),%xmm1
  addss  %xmm1,%xmm0
  movss  %xmm0,-0x4(%rbp)
  addl   $0x1,-0x8(%rbp)
L2:
  mov    -0x8(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L3
  mov    -0x4(%rbp),%eax
  movd   %eax,%xmm0
  call   <sqrtf@plt>
  leave
  ret
```

assistant: ```c
float RKMath_Distance(const float vec_a[], const float vec_b[], const int size) {
  int i = 0;
  float retval = 0;
  while (i < size) {
    retval = powf((vec_b[i] - vec_a[i]), 2) + retval;
    i++;
  }
  return sqrtf(retval);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<RKMath_Distance>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  test   %edx,%edx
  jle    L19
  mov    %rdi,%r12
  mov    %rsi,%r13
  mov    %edx,%ebp
  mov    $0x0,%ebx
  pxor   %xmm2,%xmm2
  movss  %xmm2,0xc(%rsp)
L31:
  movss  0x0(%r13,%rbx,4),%xmm0
  subss  (%r12,%rbx,4),%xmm0
  mov    $0x2,%edi
  call   <powf@plt>
  addss  0xc(%rsp),%xmm0
  movss  %xmm0,0xc(%rsp)
  add    $0x1,%rbx
  cmp    %rbp,%rbx
  jne    L31
  pxor   %xmm0,%xmm0
  ucomiss 0xc(%rsp),%xmm0
  ja     L29
L24:
  movss  0xc(%rsp),%xmm0
  sqrtss %xmm0,%xmm0
L22:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L19:
  pxor   %xmm4,%xmm4
  movss  %xmm4,0xc(%rsp)
  jmp    L24
L29:
  movss  0xc(%rsp),%xmm0
  call   <sqrtf@plt>
  jmp    L22
```

assistant: ```c
float RKMath_Distance(const float vec_a[], const float vec_b[], const int size) {
  int i = 0;
  float retval = 0;
  while (i < size) {
    retval = powf((vec_b[i] - vec_a[i]), 2) + retval;
    i++;
  }
  return sqrtf(retval);
}
```