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

```asm
<set_rndc_stats>:
  endbr64
  mov    %rsi,%rdi
  mov    %rdx,%r9
  mov    %rcx,%rsi
  mov    $0x0,%ecx
  movslq %r8d,%r8
  jmp    L44
L71:
  mov    %rax,%rdx
  shr    %rdx
  and    $0x1,%eax
  or     %rax,%rdx
  pxor   %xmm0,%xmm0
  cvtsi2sd %rdx,%xmm0
  addsd  %xmm0,%xmm0
L15:
  movsd  %xmm0,(%rdi,%rcx,1)
L34:
  add    $0x8,%rcx
  cmp    $0x30,%rcx
  je     L58
L44:
  mov    (%rsi,%rcx,1),%rax
  mov    (%r9,%rcx,1),%rdx
  cmp    %rdx,%rax
  jb     L54
  sub    %rdx,%rax
  mov    $0x0,%edx
  div    %r8
  test   %rax,%rax
  js     L71
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
  jmp    L15
L54:
  movq   $0x0,(%rdi,%rcx,1)
  jmp    L34
L58:
  mov    0x30(%rsi),%rax
  test   %rax,%rax
  js     L41
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
L50:
  movsd  %xmm0,0x30(%rdi)
  ret
L41:
  mov    %rax,%rdx
  shr    %rdx
  and    $0x1,%eax
  or     %rax,%rdx
  pxor   %xmm0,%xmm0
  cvtsi2sd %rdx,%xmm0
  addsd  %xmm0,%xmm0
  jmp    L50
```

assistant: ```c
void set_rndc_stats(struct module *mod, double st_array[], unsigned long long pre_array[], unsigned long long cur_array[], int inter) {
  int i;
  for (i = 0; i < 6; i++) {
    if (cur_array[i] >= pre_array[i]) {
      st_array[i] = (cur_array[i] - pre_array[i]) / inter;
    } else {
      st_array[i] = 0;
    }
  }
  st_array[6] = cur_array[i];
}
```
user: What is the c source code of the assembly code below:

```asm
<set_rndc_stats>:
  endbr64
  mov    %rcx,%rdi
  mov    %rdx,%r9
  xor    %ecx,%ecx
  movslq %r8d,%r8
  pxor   %xmm1,%xmm1
  jmp    L30
  nopl   (%rax)
L16:
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
L38:
  movsd  %xmm0,(%rsi,%rcx,1)
  add    $0x8,%rcx
  cmp    $0x30,%rcx
  je     L48
L30:
  mov    (%rdi,%rcx,1),%rax
  mov    (%r9,%rcx,1),%rdx
  movapd %xmm1,%xmm0
  cmp    %rdx,%rax
  jb     L38
  sub    %rdx,%rax
  xor    %edx,%edx
  div    %r8
  test   %rax,%rax
  jns    L16
  mov    %rax,%rdx
  and    $0x1,%eax
  pxor   %xmm0,%xmm0
  shr    %rdx
  or     %rax,%rdx
  cvtsi2sd %rdx,%xmm0
  addsd  %xmm0,%xmm0
  movsd  %xmm0,(%rsi,%rcx,1)
  add    $0x8,%rcx
  cmp    $0x30,%rcx
  jne    L30
L48:
  mov    0x30(%rdi),%rax
  test   %rax,%rax
  js     L10
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
  movsd  %xmm0,0x30(%rsi)
  ret
  xchg   %ax,%ax
L10:
  mov    %rax,%rdx
  and    $0x1,%eax
  pxor   %xmm0,%xmm0
  shr    %rdx
  or     %rax,%rdx
  cvtsi2sd %rdx,%xmm0
  addsd  %xmm0,%xmm0
  movsd  %xmm0,0x30(%rsi)
  ret
```

assistant: ```c
void set_rndc_stats(struct module *mod, double st_array[], unsigned long long pre_array[], unsigned long long cur_array[], int inter) {
  int i;
  for (i = 0; i < 6; i++) {
    if (cur_array[i] >= pre_array[i]) {
      st_array[i] = (cur_array[i] - pre_array[i]) / inter;
    } else {
      st_array[i] = 0;
    }
  }
  st_array[6] = cur_array[i];
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<pci_bus_match>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x18(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <pci_match_device@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  je     L3
  mov    $0x1,%eax
  jmp    L12
L3:
  mov    $0x0,%eax
L12:
  leave
  ret
```

assistant: ```c
int pci_bus_match(struct pci_dev *pci_dev, struct pci_driver *pci_drv) {
  struct pci_device_id *found_id;
  found_id = pci_match_device(pci_drv, pci_dev);
  if (found_id) {
    return (1);
  }
  return (0);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<pci_bus_match>:
  endbr64
  sub    $0x8,%rsp
  mov    %rdi,%rax
  mov    %rsi,%rdi
  mov    %rax,%rsi
  call   <pci_match_device@plt>
  test   %rax,%rax
  setne  %al
  movzbl %al,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int pci_bus_match(struct pci_dev *pci_dev, struct pci_driver *pci_drv) {
  struct pci_device_id *found_id;
  found_id = pci_match_device(pci_drv, pci_dev);
  if (found_id) {
    return (1);
  }
  return (0);
}
```
user: What is the c source code of the assembly code below?

```asm
<pci_bus_match>:
  endbr64
  mov    %rdi,%r8
  sub    $0x8,%rsp
  mov    %rsi,%rdi
  mov    %r8,%rsi
  call   <pci_match_device@plt>
  test   %rax,%rax
  setne  %al
  add    $0x8,%rsp
  movzbl %al,%eax
  ret
```

assistant: ```c
int pci_bus_match(struct pci_dev *pci_dev, struct pci_driver *pci_drv) {
  struct pci_device_id *found_id;
  found_id = pci_match_device(pci_drv, pci_dev);
  if (found_id) {
    return (1);
  }
  return (0);
}
```
user: What is the c source code of the assembly code below:

```asm
<pci_bus_match>:
  endbr64
  mov    %rdi,%r8
  sub    $0x8,%rsp
  mov    %rsi,%rdi
  mov    %r8,%rsi
  call   <pci_match_device@plt>
  test   %rax,%rax
  setne  %al
  add    $0x8,%rsp
  movzbl %al,%eax
  ret
```

assistant: ```c
int pci_bus_match(struct pci_dev *pci_dev, struct pci_driver *pci_drv) {
  struct pci_device_id *found_id;
  found_id = pci_match_device(pci_drv, pci_dev);
  if (found_id) {
    return (1);
  }
  return (0);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<strtoul>:
  endbr64
  movq   $0x0,(%rsi)
  mov    $0xa,%r8d
  mov    $0x0,%edx
  cmpb   $0x30,(%rdi)
  jne    L160
  movzbl 0x1(%rdi),%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  je     L154
  cmp    $0x42,%al
  setne  %r8b
  movzbl %r8b,%r8d
  lea    0x2(,%r8,8),%r8
  sete   %dl
  movzbl %dl,%edx
  add    %rdx,%rdx
  jmp    L160
L94:
  movzbl (%rdi,%rdx,1),%eax
  sub    $0x30,%eax
  cmp    $0x1,%al
  ja     L87
L14:
  mov    %r8,%rcx
  imul   (%rsi),%rcx
  mov    %rcx,(%rsi)
  movzbl (%rdi,%rdx,1),%eax
  cmp    $0x39,%al
  jg     L165
  movsbl %al,%eax
  sub    $0x30,%eax
  cltq
  add    %rax,%rcx
L157:
  mov    %rcx,(%rsi)
  add    $0x1,%rdx
  cmp    $0x10,%rdx
  je     L87
L160:
  cmp    $0x2,%r8
  je     L94
  cmp    $0xa,%r8
  jne    L116
  movzbl (%rdi,%rdx,1),%eax
  sub    $0x30,%eax
  cmp    $0x9,%al
  jbe    L14
L87:
  test   %rdx,%rdx
  setne  %al
  movzbl %al,%eax
  ret
L116:
  cmp    $0x10,%r8
  jne    L14
  movzbl (%rdi,%rdx,1),%eax
  lea    -0x30(%rax),%ecx
  cmp    $0x9,%cl
  jbe    L14
  and    $0xffffffdf,%eax
  sub    $0x41,%eax
  cmp    $0x5,%al
  jbe    L14
  jmp    L87
L165:
  cmp    $0x5a,%al
  jg     L85
  movsbl %al,%eax
  sub    $0x37,%eax
  cltq
  add    %rax,%rcx
  jmp    L157
L85:
  movsbl %al,%eax
  sub    $0x57,%eax
  cltq
  add    %rax,%rcx
  jmp    L157
L154:
  mov    $0x10,%r8d
  mov    $0x2,%edx
  jmp    L160
```

assistant: ```c
int strtoul(const char *number, unsigned long *result) {
  unsigned long n, n_num, weight;
  *result = 0;
  if (((number[0] == '0') && (number[1] == 'x')) || ((number[0] == '0') && (number[1] == 'X'))) {
    weight = 16;
    n = 2;
  } else if (((number[0] == '0') && (number[1] == 'b')) || ((number[0] == '0') && (number[1] == 'B'))) {
    weight = 2;
    n = 2;
  } else {
    weight = 10;
    n = 0;
  }
  for (; n < 16; n++) {
    if ((weight == 02) && ((number[n] < '0') || (number[n] > '1')))
      break;
    if ((weight == 10) && ((number[n] < '0') || (number[n] > '9')))
      break;
    if ((weight == 16) && ((number[n] < '0') || (number[n] > '9')) && ((number[n] < 'a') || (number[n] > 'f')) && ((number[n] < 'A') || (number[n] > 'F')))
      break;
    *result = *result * weight;
    if (number[n] <= '9') {
      *result = *result + (number[n] - '0');
    } else if (number[n] <= 'Z') {
      *result = *result + (number[n] - 'A' + 10);
    } else {
      *result = *result + (number[n] - 'a' + 10);
    }
  }
  if (n == 0)
    return 0;
  return 1;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<strtoul>:
  endbr64
  mov    %rdi,%r8
  movq   $0x0,(%rsi)
  xor    %edx,%edx
  mov    $0xa,%edi
  cmpb   $0x30,(%r8)
  jne    L108
  jmp    L54
L77:
  sub    $0x30,%eax
  cltq
  add    %rax,%rcx
L172:
  add    $0x1,%rdx
  mov    %rcx,(%rsi)
  cmp    $0x10,%rdx
  je     L131
L108:
  cmp    $0x2,%rdi
  je     L125
  cmp    $0xa,%rdi
  jne    L110
  movzbl (%r8,%rdx,1),%eax
  sub    $0x30,%eax
  cmp    $0x9,%al
  ja     L59
L17:
  mov    (%rsi),%rcx
  imul   %rdi,%rcx
  mov    %rcx,(%rsi)
  movsbl (%r8,%rdx,1),%eax
  cmp    $0x39,%al
  jle    L77
  cmp    $0x5a,%al
  jg     L63
  sub    $0x37,%eax
  add    $0x1,%rdx
  movsbq %al,%rax
  add    %rax,%rcx
  mov    %rcx,(%rsi)
  cmp    $0x10,%rdx
  jne    L108
L131:
  mov    $0x1,%eax
  ret
  nopl   0x0(%rax)
L125:
  movzbl (%r8,%rdx,1),%eax
  sub    $0x30,%eax
  cmp    $0x1,%al
  jbe    L17
L59:
  xor    %eax,%eax
  test   %rdx,%rdx
  setne  %al
  ret
  nopl   (%rax)
L110:
  cmp    $0x10,%rdi
  jne    L17
  movzbl (%r8,%rdx,1),%eax
  lea    -0x30(%rax),%ecx
  cmp    $0x9,%cl
  jbe    L17
  and    $0xffffffdf,%eax
  sub    $0x41,%eax
  cmp    $0x5,%al
  jbe    L17
  jmp    L59
  nop
L63:
  sub    $0x57,%eax
  movsbq %al,%rax
  add    %rax,%rcx
  jmp    L172
  nop
L54:
  movzbl 0x1(%r8),%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  jne    L138
  mov    $0x10,%edi
  mov    $0x2,%edx
  jmp    L108
L138:
  xor    %edi,%edi
  cmp    $0x42,%al
  sete   %dl
  setne  %dil
  movzbl %dl,%edx
  lea    0x2(,%rdi,8),%rdi
  add    %rdx,%rdx
  jmp    L108
```

assistant: ```c
int strtoul(const char *number, unsigned long *result) {
  unsigned long n, n_num, weight;
  *result = 0;
  if (((number[0] == '0') && (number[1] == 'x')) || ((number[0] == '0') && (number[1] == 'X'))) {
    weight = 16;
    n = 2;
  } else if (((number[0] == '0') && (number[1] == 'b')) || ((number[0] == '0') && (number[1] == 'B'))) {
    weight = 2;
    n = 2;
  } else {
    weight = 10;
    n = 0;
  }
  for (; n < 16; n++) {
    if ((weight == 02) && ((number[n] < '0') || (number[n] > '1')))
      break;
    if ((weight == 10) && ((number[n] < '0') || (number[n] > '9')))
      break;
    if ((weight == 16) && ((number[n] < '0') || (number[n] > '9')) && ((number[n] < 'a') || (number[n] > 'f')) && ((number[n] < 'A') || (number[n] > 'F')))
      break;
    *result = *result * weight;
    if (number[n] <= '9') {
      *result = *result + (number[n] - '0');
    } else if (number[n] <= 'Z') {
      *result = *result + (number[n] - 'A' + 10);
    } else {
      *result = *result + (number[n] - 'a' + 10);
    }
  }
  if (n == 0)
    return 0;
  return 1;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<foo>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  movss  %xmm0,-0x14(%rbp)
  movss  %xmm1,-0x18(%rbp)
  movl   $0x0,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  test   %eax,%eax
  jne    L14
  movss  -0x14(%rbp),%xmm0
  jmp    L15
L14:
  movss  -0x18(%rbp),%xmm0
L15:
  pop    %rbp
  ret
```

assistant: ```c
float foo(float x, float y) {
  volatile int i = 0;
  return i == 0 ? x : y;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<foo>:
  endbr64
  movl   $0x0,-0x4(%rsp)
  mov    -0x4(%rsp),%eax
  test   %eax,%eax
  je     L9
  movaps %xmm1,%xmm0
L9:
  ret
```

assistant: ```c
float foo(float x, float y) {
  volatile int i = 0;
  return i == 0 ? x : y;
}
```
user: Translate the below assembly code into C programming language:

```asm
<foo>:
  endbr64
  movl   $0x0,-0x4(%rsp)
  mov    -0x4(%rsp),%eax
  test   %eax,%eax
  je     L6
  movaps %xmm1,%xmm0
L6:
  ret
```

assistant: ```c
float foo(float x, float y) {
  volatile int i = 0;
  return i == 0 ? x : y;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<foo>:
  endbr64
  movl   $0x0,-0x4(%rsp)
  mov    -0x4(%rsp),%eax
  test   %eax,%eax
  je     L7
  movaps %xmm1,%xmm0
L7:
  ret
```

assistant: ```c
float foo(float x, float y) {
  volatile int i = 0;
  return i == 0 ? x : y;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<extended_fgets>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    D49(%rip),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  je     L4
  mov    D49(%rip),%rax
  mov    (%rax),%rdx
  mov    -0x1c(%rbp),%ecx
  mov    -0x18(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <fgets@plt>
  mov    %rax,-0x8(%rbp)
  mov    D26(%rip),%rax
  mov    (%rax),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fputs@plt>
  jmp    L11
L4:
  mov    -0x28(%rbp),%rdx
  mov    -0x1c(%rbp),%ecx
  mov    -0x18(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <fgets@plt>
  mov    %rax,-0x8(%rbp)
L11:
  mov    D39(%rip),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  je     L28
  mov    D39(%rip),%rax
  mov    (%rax),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fputs@plt>
L28:
  mov    -0x8(%rbp),%rax
  leave
  ret
```

assistant: ```c
char *extended_fgets(char *line, int size, FILE *file) {
  extern FILE *save_file;
  extern FILE *playback_file;
  char *result;
  if (playback_file != NULL) {
    result = fgets(line, size, playback_file);
    fputs(line, stdout);
  } else
    result = fgets(line, size, file);
  if (save_file != NULL)
    fputs(line, save_file);
  return (result);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<extended_fgets>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  mov    D15(%rip),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  je     L1
  mov    %rax,%rdx
  call   <fgets@plt>
  mov    %rax,%rbp
  mov    D17(%rip),%rax
  mov    (%rax),%rsi
  mov    %rbx,%rdi
  call   <fputs@plt>
L3:
  mov    D14(%rip),%rax
  mov    (%rax),%rsi
  test   %rsi,%rsi
  je     L11
  mov    %rbx,%rdi
  call   <fputs@plt>
L11:
  mov    %rbp,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L1:
  call   <fgets@plt>
  mov    %rax,%rbp
  jmp    L3
```

assistant: ```c
char *extended_fgets(char *line, int size, FILE *file) {
  extern FILE *save_file;
  extern FILE *playback_file;
  char *result;
  if (playback_file != NULL) {
    result = fgets(line, size, playback_file);
    fputs(line, stdout);
  } else
    result = fgets(line, size, file);
  if (save_file != NULL)
    fputs(line, save_file);
  return (result);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<extended_fgets>:
  endbr64
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x8,%rsp
  mov    D27(%rip),%rax
  mov    (%rax),%r8
  test   %r8,%r8
  je     L15
  mov    %r8,%rdx
  call   <fgets@plt>
  mov    %rbp,%rdi
  mov    %rax,%r12
  mov    D14(%rip),%rax
  mov    (%rax),%rsi
  call   <fputs@plt>
L19:
  mov    D17(%rip),%rax
  mov    (%rax),%rsi
  test   %rsi,%rsi
  je     L5
  mov    %rbp,%rdi
  call   <fputs@plt>
L5:
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L15:
  call   <fgets@plt>
  mov    %rax,%r12
  jmp    L19
```

assistant: ```c
char *extended_fgets(char *line, int size, FILE *file) {
  extern FILE *save_file;
  extern FILE *playback_file;
  char *result;
  if (playback_file != NULL) {
    result = fgets(line, size, playback_file);
    fputs(line, stdout);
  } else
    result = fgets(line, size, file);
  if (save_file != NULL)
    fputs(line, save_file);
  return (result);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<extended_fgets>:
  endbr64
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x8,%rsp
  mov    D14(%rip),%rax
  mov    (%rax),%r8
  test   %r8,%r8
  je     L26
  mov    %r8,%rdx
  call   <fgets@plt>
  mov    %rbp,%rdi
  mov    %rax,%r12
  mov    D9(%rip),%rax
  mov    (%rax),%rsi
  call   <fputs@plt>
L14:
  mov    D21(%rip),%rax
  mov    (%rax),%rsi
  test   %rsi,%rsi
  je     L2
  mov    %rbp,%rdi
  call   <fputs@plt>
L2:
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L26:
  call   <fgets@plt>
  mov    %rax,%r12
  jmp    L14
```

assistant: ```c
char *extended_fgets(char *line, int size, FILE *file) {
  extern FILE *save_file;
  extern FILE *playback_file;
  char *result;
  if (playback_file != NULL) {
    result = fgets(line, size, playback_file);
    fputs(line, stdout);
  } else
    result = fgets(line, size, file);
  if (save_file != NULL)
    fputs(line, save_file);
  return (result);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<OSGLineFromFile>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  movl   $0x80,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  cmpq   $0x0,-0x28(%rbp)
  je     L51
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <ferror@plt>
  test   %rax,%rax
  jne    L51
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <feof@plt>
  test   %rax,%rax
  je     L22
L51:
  mov    $0x0,%eax
  jmp    L93
L22:
  mov    -0x14(%rbp),%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
L103:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <fgetc@plt>
  mov    %eax,-0xc(%rbp)
  mov    D7(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0xc(%rbp)
  je     L38
  cmpl   $0x0,-0xc(%rbp)
  je     L38
  cmpl   $0xa,-0xc(%rbp)
  je     L38
  cmpl   $0xd,-0xc(%rbp)
  je     L40
  mov    -0x10(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x10(%rbp)
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    -0xc(%rbp),%edx
  mov    %dl,(%rax)
  mov    -0x14(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x10(%rbp)
  jl     L103
  subl   $0xffffff80,-0x14(%rbp)
  mov    -0x14(%rbp),%edx
  mov    -0x8(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    %rax,-0x8(%rbp)
  jmp    L103
L40:
  nop
  jmp    L103
L38:
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x8(%rbp),%rax
L93:
  leave
  ret
```

assistant: ```c
char *OSGLineFromFile(FILE *f) {
  int c;
  int mlen = 128;
  int len = 0;
  if (!f || ferror(f) || feof(f))
    return 0;
  char *ret = malloc(mlen);
  while (1) {
    c = fgetc(f);
    if (c == EOF || c == 0 || c == '\n')
      break;
    if (c == '\r')
      continue;
    ret[len++] = c;
    if (len >= mlen - 1) {
      mlen += 128;
      ret = realloc(ret, mlen);
    }
  }
  ret[len] = 0;
  return ret;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<OSGLineFromFile>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r13
  test   %rdi,%rdi
  je     L60
  call   <ferror@plt>
  mov    $0x0,%r12d
  test   %rax,%rax
  jne    L50
  mov    %r13,%rdi
  call   <feof@plt>
  test   %rax,%rax
  jne    L50
  mov    $0x80,%edi
  call   <malloc@plt>
  mov    %rax,%r12
  mov    $0x0,%ebx
  mov    $0x80,%r14d
  jmp    L11
L35:
  add    $0x1,%rbx
L11:
  mov    %ebx,%ebp
  mov    %ebx,%r15d
L30:
  mov    %r13,%rdi
  call   <fgetc@plt>
  mov    D7(%rip),%rdx
  cmp    %eax,(%rdx)
  je     L32
  test   %eax,%eax
  je     L32
  cmp    $0xa,%eax
  je     L32
  cmp    $0xd,%eax
  je     L30
  mov    %al,(%r12,%rbx,1)
  lea    -0x1(%r14),%eax
  add    $0x1,%ebp
  cmp    %ebp,%eax
  jg     L35
  sub    $0xffffff80,%r14d
  mov    %r14d,%esi
  mov    %r12,%rdi
  call   <realloc@plt>
  mov    %rax,%r12
  jmp    L35
L32:
  movslq %r15d,%r15
  movb   $0x0,(%r12,%r15,1)
L50:
  mov    %r12,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L60:
  mov    %rdi,%r12
  jmp    L50
```

assistant: ```c
char *OSGLineFromFile(FILE *f) {
  int c;
  int mlen = 128;
  int len = 0;
  if (!f || ferror(f) || feof(f))
    return 0;
  char *ret = malloc(mlen);
  while (1) {
    c = fgetc(f);
    if (c == EOF || c == 0 || c == '\n')
      break;
    if (c == '\r')
      continue;
    ret[len++] = c;
    if (len >= mlen - 1) {
      mlen += 128;
      ret = realloc(ret, mlen);
    }
  }
  ret[len] = 0;
  return ret;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<OSGLineFromFile>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %rdi,%rdi
  je     L3
  mov    %rdi,%rbp
  call   <ferror@plt>
  test   %rax,%rax
  jne    L3
  mov    %rbp,%rdi
  call   <feof@plt>
  test   %rax,%rax
  jne    L3
  mov    $0x80,%edi
  xor    %r15d,%r15d
  mov    $0x80,%r12d
  call   <malloc@plt>
  mov    %rax,%r14
  jmp    L88
  nopl   (%rax)
L22:
  add    $0x1,%r15
L88:
  mov    %r15d,%ebx
  movslq %r15d,%r13
L0:
  mov    %rbp,%rdi
  call   <fgetc@plt>
  mov    D0(%rip),%rdx
  cmp    %eax,(%rdx)
  je     L32
  test   %eax,%eax
  je     L32
  cmp    $0xa,%eax
  je     L32
  cmp    $0xd,%eax
  je     L0
  mov    %al,(%r14,%r15,1)
  add    $0x1,%ebx
  lea    -0x1(%r12),%eax
  cmp    %ebx,%eax
  jg     L22
  sub    $0xffffff80,%r12d
  mov    %r14,%rdi
  mov    %r12d,%esi
  call   <realloc@plt>
  mov    %rax,%r14
  jmp    L22
  nop
L3:
  xor    %r14d,%r14d
L16:
  add    $0x8,%rsp
  mov    %r14,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L32:
  movb   $0x0,(%r14,%r13,1)
  jmp    L16
```

assistant: ```c
char *OSGLineFromFile(FILE *f) {
  int c;
  int mlen = 128;
  int len = 0;
  if (!f || ferror(f) || feof(f))
    return 0;
  char *ret = malloc(mlen);
  while (1) {
    c = fgetc(f);
    if (c == EOF || c == 0 || c == '\n')
      break;
    if (c == '\r')
      continue;
    ret[len++] = c;
    if (len >= mlen - 1) {
      mlen += 128;
      ret = realloc(ret, mlen);
    }
  }
  ret[len] = 0;
  return ret;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<OSGLineFromFile>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %rdi,%rdi
  je     L11
  mov    %rdi,%rbp
  call   <ferror@plt>
  test   %rax,%rax
  jne    L11
  mov    %rbp,%rdi
  call   <feof@plt>
  test   %rax,%rax
  jne    L11
  mov    $0x80,%edi
  xor    %r15d,%r15d
  mov    $0x80,%r12d
  call   <malloc@plt>
  mov    %rax,%r14
  jmp    L7
  nopl   (%rax)
L53:
  add    $0x1,%r15
L7:
  mov    %r15d,%ebx
  movslq %r15d,%r13
L87:
  mov    %rbp,%rdi
  call   <fgetc@plt>
  mov    D5(%rip),%rdx
  cmp    %eax,(%rdx)
  je     L92
  test   %eax,%eax
  je     L92
  cmp    $0xa,%eax
  je     L92
  cmp    $0xd,%eax
  je     L87
  mov    %al,(%r14,%r15,1)
  add    $0x1,%ebx
  lea    -0x1(%r12),%eax
  cmp    %ebx,%eax
  jg     L53
  sub    $0xffffff80,%r12d
  mov    %r14,%rdi
  mov    %r12d,%esi
  call   <realloc@plt>
  mov    %rax,%r14
  jmp    L53
  nop
L11:
  xor    %r14d,%r14d
L21:
  add    $0x8,%rsp
  mov    %r14,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L92:
  movb   $0x0,(%r14,%r13,1)
  jmp    L21
```

assistant: ```c
char *OSGLineFromFile(FILE *f) {
  int c;
  int mlen = 128;
  int len = 0;
  if (!f || ferror(f) || feof(f))
    return 0;
  char *ret = malloc(mlen);
  while (1) {
    c = fgetc(f);
    if (c == EOF || c == 0 || c == '\n')
      break;
    if (c == '\r')
      continue;
    ret[len++] = c;
    if (len >= mlen - 1) {
      mlen += 128;
      ret = realloc(ret, mlen);
    }
  }
  ret[len] = 0;
  return ret;
}
```
user: What is the c source code of the assembly code below:

```asm
<del_split_array>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L12
L19:
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <free@plt>
  addl   $0x1,-0x4(%rbp)
L12:
  mov    -0x4(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L19
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  nop
  leave
  ret
```

assistant: ```c
void del_split_array(char **arr, int count) {
  int i;
  for (i = 0; i < count; i++)
    free(arr[i]);
  free(arr);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<del_split_array>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r12
  test   %esi,%esi
  jle    L3
  mov    %rdi,%rbx
  lea    -0x1(%rsi),%eax
  lea    0x8(%rdi,%rax,8),%rbp
L12:
  mov    (%rbx),%rdi
  call   <free@plt>
  add    $0x8,%rbx
  cmp    %rbp,%rbx
  jne    L12
L3:
  mov    %r12,%rdi
  call   <free@plt>
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void del_split_array(char **arr, int count) {
  int i;
  for (i = 0; i < count; i++)
    free(arr[i]);
  free(arr);
}
```