ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请将以下的汇编代码转换成C语言代码:

```asm
<rewrite_component>:
  endbr64
  mov    %rsi,%rax
  test   %r8d,%r8d
  jle    L41
  movslq %edx,%rdx
  cmp    $0x1,%ecx
  jne    L153
  lea    (%rdi,%rdx,1),%rcx
  lea    0x1(%rax),%rdi
  mov    %r8d,%r9d
  mov    %rcx,%rdx
  lea    -0x1(%r8),%esi
  sub    %rdi,%rdx
  cmp    $0xe,%rdx
  jbe    L22
  cmp    $0x6,%esi
  jbe    L22
  cmp    $0xe,%esi
  jbe    L173
  mov    %r8d,%esi
  xor    %edx,%edx
  shr    $0x4,%esi
  shl    $0x4,%rsi
  nopl   0x0(%rax)
L78:
  movdqu (%rax,%rdx,1),%xmm0
  movups %xmm0,(%rcx,%rdx,1)
  add    $0x10,%rdx
  cmp    %rdx,%rsi
  jne    L78
  mov    %r8d,%esi
  and    $0xfffffff0,%esi
  mov    %esi,%edx
  cmp    %esi,%r8d
  je     L41
  mov    %r8d,%r9d
  sub    %esi,%r9d
  lea    -0x1(%r9),%edi
  cmp    $0x6,%edi
  jbe    L4
L95:
  mov    (%rax,%rsi,1),%rdi
  mov    %rdi,(%rcx,%rsi,1)
  mov    %r9d,%esi
  and    $0xfffffff8,%esi
  add    %esi,%edx
  cmp    %esi,%r9d
  je     L41
L4:
  movslq %edx,%rsi
  movzbl (%rax,%rsi,1),%edi
  mov    %dil,(%rcx,%rsi,1)
  lea    0x1(%rdx),%esi
  cmp    %esi,%r8d
  jle    L41
  movslq %esi,%rsi
  movzbl (%rax,%rsi,1),%edi
  mov    %dil,(%rcx,%rsi,1)
  lea    0x2(%rdx),%esi
  cmp    %esi,%r8d
  jle    L41
  movslq %esi,%rsi
  movzbl (%rax,%rsi,1),%edi
  mov    %dil,(%rcx,%rsi,1)
  lea    0x3(%rdx),%esi
  cmp    %esi,%r8d
  jle    L41
  movslq %esi,%rsi
  movzbl (%rax,%rsi,1),%edi
  mov    %dil,(%rcx,%rsi,1)
  lea    0x4(%rdx),%esi
  cmp    %esi,%r8d
  jle    L41
  movslq %esi,%rsi
  movzbl (%rax,%rsi,1),%edi
  mov    %dil,(%rcx,%rsi,1)
  lea    0x5(%rdx),%esi
  cmp    %esi,%r8d
  jle    L41
  movslq %esi,%rsi
  add    $0x6,%edx
  movzbl (%rax,%rsi,1),%edi
  mov    %dil,(%rcx,%rsi,1)
  cmp    %edx,%r8d
  jle    L41
  movslq %edx,%rdx
  movzbl (%rax,%rdx,1),%eax
  mov    %al,(%rcx,%rdx,1)
  ret
  nopl   0x0(%rax)
L22:
  mov    %r8d,%r8d
  xor    %edx,%edx
  nopl   (%rax)
L83:
  movzbl (%rax,%rdx,1),%esi
  mov    %sil,(%rcx,%rdx,1)
  add    $0x1,%rdx
  cmp    %r8,%rdx
  jne    L83
L41:
  ret
  nopw   0x0(%rax,%rax,1)
L153:
  movslq %ecx,%rsi
  lea    -0x1(%r8),%ecx
  add    %rdi,%rdx
  lea    0x1(%rax,%rcx,1),%rdi
  nop
L171:
  movzbl (%rax),%ecx
  add    $0x1,%rax
  mov    %cl,(%rdx)
  add    %rsi,%rdx
  cmp    %rdi,%rax
  jne    L171
  ret
L173:
  xor    %esi,%esi
  xor    %edx,%edx
  jmp    L95
```

assistant: ```c
void rewrite_component(unsigned char *darray, const unsigned char *sarray, int ncomp, int totcomp, int csize) {
  int i;
  for (i = 0; i < csize; i++)
    *(darray + (i * totcomp) + ncomp) = *(sarray + i);
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<float128_rem>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpl   $0xffffffc1,-0x1c(%rbp)
  jl     L17
  mov    -0x1c(%rbp),%eax
  neg    %eax
  mov    %eax,%edx
  lea    -0x18(%rbp),%rax
  mov    %rax,%rsi
  mov    %edx,%edi
  call   <shift128Right@plt>
L17:
  lea    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <add128@plt>
  nop
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L19
  call   <__stack_chk_fail@plt>
L19:
  leave
  ret
```

assistant: ```c
float128_rem() {
  signed int expDiff;
  long long int aSig1;
  long long int sigMean1;
  if (-64 < expDiff)
    shift128Right(-expDiff, &aSig1);
  add128(&sigMean1);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<float128_rem>:
  endbr64
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0x8(%rsp),%rsi
  mov    $0x0,%edi
  call   <shift128Right@plt>
  lea    0x10(%rsp),%rdi
  call   <add128@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L1
  mov    $0x0,%eax
  add    $0x28,%rsp
  ret
L1:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
float128_rem() {
  signed int expDiff;
  long long int aSig1;
  long long int sigMean1;
  if (-64 < expDiff)
    shift128Right(-expDiff, &aSig1);
  add128(&sigMean1);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<float128_rem>:
  endbr64
  sub    $0x28,%rsp
  xor    %edi,%edi
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0x8(%rsp),%rsi
  call   <shift128Right@plt>
  lea    0x10(%rsp),%rdi
  call   <add128@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L3
  xor    %eax,%eax
  add    $0x28,%rsp
  ret
L3:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
float128_rem() {
  signed int expDiff;
  long long int aSig1;
  long long int sigMean1;
  if (-64 < expDiff)
    shift128Right(-expDiff, &aSig1);
  add128(&sigMean1);
}
```
user: Translate the below assembly code into C programming language:

```asm
<float128_rem>:
  endbr64
  sub    $0x28,%rsp
  xor    %edi,%edi
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0x8(%rsp),%rsi
  call   <shift128Right@plt>
  lea    0x10(%rsp),%rdi
  call   <add128@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  xor    %eax,%eax
  add    $0x28,%rsp
  ret
L0:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
float128_rem() {
  signed int expDiff;
  long long int aSig1;
  long long int sigMean1;
  if (-64 < expDiff)
    shift128Right(-expDiff, &aSig1);
  add128(&sigMean1);
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<print_help>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rsi
  lea    D0(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D3(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    -0x8(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  mov    %rax,%rsi
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  nop
  leave
  ret
```

tool_calls: name: unpack_data
arguments: tag: D0
type_guessed: string
name: unpack_data
arguments: tag: D3
type_guessed: string
name: unpack_data
arguments: tag: D9
type_guessed: string

tool: D0: Usage: %s [-n] DEVNAME COMMAND


tool: D3: Usage: '-n' is an optional argument if you want to push a new line at the end of the text

tool: D9: Usage: Will require 'sudo' to run if the executable is not setuid root ( to set 'setuid root' do: sudo chown root:root %s ; sudo chmod u+s %s )


assistant: ```c
void print_help(char *prog_name) {
  printf("Usage: %s [-n] DEVNAME COMMAND\n", prog_name);
  printf("Usage: '-n' is an optional argument if you want to push a new line at the end of the text\n");
  printf("Usage: Will require 'sudo' to run if the executable is not setuid root ( to set 'setuid root' do: sudo chown root:root %s ; sudo chmod u+s %s )\n", prog_name, prog_name);
  exit(1);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<print_help>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  mov    %rdi,%rsi
  lea    D15(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D12(%rip),%rdi
  call   <puts@plt>
  mov    %rbx,%rdx
  mov    %rbx,%rsi
  lea    D22(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  pop    %rbx
  ret
```

tool_calls: name: disassemble_data
arguments: label: D15
type: string
name: disassemble_data
arguments: label: D12
type: string
name: disassemble_data
arguments: label: D22
type: string

tool: D15: Usage: %s [-n] DEVNAME COMMAND


tool: D12: Usage: '-n' is an optional argument if you want to push a new line at the end of the text

tool: D22: Usage: Will require 'sudo' to run if the executable is not setuid root ( to set 'setuid root' do: sudo chown root:root %s ; sudo chmod u+s %s )


assistant: ```c
void print_help(char *prog_name) {
  printf("Usage: %s [-n] DEVNAME COMMAND\n", prog_name);
  printf("Usage: '-n' is an optional argument if you want to push a new line at the end of the text\n");
  printf("Usage: Will require 'sudo' to run if the executable is not setuid root ( to set 'setuid root' do: sudo chown root:root %s ; sudo chmod u+s %s )\n", prog_name, prog_name);
  exit(1);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<print_help>:
  endbr64
  push   %rbp
  mov    %rdi,%rsi
  mov    %rdi,%rbp
  xor    %eax,%eax
  lea    D9(%rip),%rdi
  call   <printf@plt>
  lea    D8(%rip),%rdi
  call   <puts@plt>
  mov    %rbp,%rdx
  mov    %rbp,%rsi
  xor    %eax,%eax
  lea    D22(%rip),%rdi
  call   <printf@plt>
  mov    $0x1,%edi
  pop    %rbp
  jmp    1090 <exit@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D9
type: string
name: parse_data
arguments: data_tag: D8
type: string
name: parse_data
arguments: data_tag: D22
type: string

tool: D9: Usage: %s [-n] DEVNAME COMMAND


tool: D8: Usage: '-n' is an optional argument if you want to push a new line at the end of the text

tool: D22: Usage: Will require 'sudo' to run if the executable is not setuid root ( to set 'setuid root' do: sudo chown root:root %s ; sudo chmod u+s %s )


assistant: ```c
void print_help(char *prog_name) {
  printf("Usage: %s [-n] DEVNAME COMMAND\n", prog_name);
  printf("Usage: '-n' is an optional argument if you want to push a new line at the end of the text\n");
  printf("Usage: Will require 'sudo' to run if the executable is not setuid root ( to set 'setuid root' do: sudo chown root:root %s ; sudo chmod u+s %s )\n", prog_name, prog_name);
  exit(1);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<print_help>:
  endbr64
  push   %rbp
  mov    %rdi,%rsi
  mov    %rdi,%rbp
  xor    %eax,%eax
  lea    D16(%rip),%rdi
  call   <printf@plt>
  lea    D9(%rip),%rdi
  call   <puts@plt>
  mov    %rbp,%rdx
  mov    %rbp,%rsi
  xor    %eax,%eax
  lea    D28(%rip),%rdi
  call   <printf@plt>
  mov    $0x1,%edi
  pop    %rbp
  jmp    1090 <exit@plt>
```

tool_calls: name: read_data
arguments: tag: D16
type_infered: string
name: read_data
arguments: tag: D9
type_infered: string
name: read_data
arguments: tag: D28
type_infered: string

tool: D16: Usage: %s [-n] DEVNAME COMMAND


tool: D9: Usage: '-n' is an optional argument if you want to push a new line at the end of the text

tool: D28: Usage: Will require 'sudo' to run if the executable is not setuid root ( to set 'setuid root' do: sudo chown root:root %s ; sudo chmod u+s %s )


assistant: ```c
void print_help(char *prog_name) {
  printf("Usage: %s [-n] DEVNAME COMMAND\n", prog_name);
  printf("Usage: '-n' is an optional argument if you want to push a new line at the end of the text\n");
  printf("Usage: Will require 'sudo' to run if the executable is not setuid root ( to set 'setuid root' do: sudo chown root:root %s ; sudo chmod u+s %s )\n", prog_name, prog_name);
  exit(1);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<inet_str_to_hex>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    D9(%rip),%rax
  mov    (%rax),%eax
  lea    -0xc(%rbp),%rdx
  mov    -0x18(%rbp),%rcx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <inet_pton@plt>
  mov    -0xc(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L9
  call   <__stack_chk_fail@plt>
L9:
  leave
  ret
```

assistant: ```c
unsigned int inet_str_to_hex(char *str) {
  struct in_addr sa;
  inet_pton(AF_INET, str, &sa);
  return sa.s_addr;
}
```
user: Translate the below assembly code into C programming language:

```asm
<inet_str_to_hex>:
  endbr64
  sub    $0x18,%rsp
  mov    %rdi,%rsi
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rdx
  mov    D6(%rip),%rax
  mov    (%rax),%edi
  call   <inet_pton@plt>
  mov    0x4(%rsp),%eax
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L5
  add    $0x18,%rsp
  ret
L5:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
unsigned int inet_str_to_hex(char *str) {
  struct in_addr sa;
  inet_pton(AF_INET, str, &sa);
  return sa.s_addr;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<inet_str_to_hex>:
  endbr64
  sub    $0x18,%rsp
  mov    %rdi,%rsi
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    D3(%rip),%rax
  lea    0x4(%rsp),%rdx
  mov    (%rax),%edi
  call   <inet_pton@plt>
  mov    0x4(%rsp),%eax
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L6
  add    $0x18,%rsp
  ret
L6:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
unsigned int inet_str_to_hex(char *str) {
  struct in_addr sa;
  inet_pton(AF_INET, str, &sa);
  return sa.s_addr;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<inet_str_to_hex>:
  endbr64
  sub    $0x18,%rsp
  mov    %rdi,%rsi
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    D3(%rip),%rax
  lea    0x4(%rsp),%rdx
  mov    (%rax),%edi
  call   <inet_pton@plt>
  mov    0x4(%rsp),%eax
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L9
  add    $0x18,%rsp
  ret
L9:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
unsigned int inet_str_to_hex(char *str) {
  struct in_addr sa;
  inet_pton(AF_INET, str, &sa);
  return sa.s_addr;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<get_irqcpu_nr>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %esi,-0x28(%rbp)
  movl   $0x0,-0x14(%rbp)
  lea    D84(%rip),%rax
  mov    %rax,%rsi
  lea    D60(%rip),%rax
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L54
  mov    $0x0,%eax
  jmp    L1
L54:
  mov    D5(%rip),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x28(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  lea    0x80(%rax),%edx
  mov    D5(%rip),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    %rax,D41(%rip)
  mov    D41(%rip),%rax
  test   %rax,%rax
  jne    L5
  lea    D41(%rip),%rax
  mov    %rax,%rdi
  call   <perror@plt>
  mov    $0x4,%edi
  call   <exit@plt>
L5:
  cmpq   $0x0,-0x8(%rbp)
  jne    L76
  mov    -0x28(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  lea    0x80(%rax),%edx
  mov    D41(%rip),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  jmp    L76
L45:
  mov    D41(%rip),%rax
  add    $0x2,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L76
  addl   $0x1,-0x14(%rbp)
L76:
  mov    -0x28(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  lea    0x80(%rax),%ecx
  mov    D41(%rip),%rax
  mov    -0x10(%rbp),%rdx
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  je     L23
  mov    -0x24(%rbp),%eax
  cmp    %eax,-0x14(%rbp)
  jb     L45
L23:
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    -0x14(%rbp),%eax
L1:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_tag: D84
type_guessed: string
name: disassemble_data
arguments: data_tag: D60
type_guessed: string
name: disassemble_data
arguments: data_tag: D41
type_guessed: string

tool: D84: r

tool: D60: /proc/interrupts

tool: D41: realloc

assistant: ```c
int get_irqcpu_nr(int max_nr_irqcpu, int cpu_nr) {
  FILE *fp;
  static char *line;
  unsigned int irq = 0;
  if ((fp = fopen("/proc/interrupts", "r")) == NULL)
    return 0;
  do {
    char *_p_;
    _p_ = line;
    if (128 + 11 * cpu_nr) {
      if ((line = (char *)realloc(line, (128 + 11 * cpu_nr))) == NULL) {
        perror("realloc");
        exit(4);
      }
      if (!_p_)
        memset(line, 0, (128 + 11 * cpu_nr));
    }
  } while (0);
  while ((fgets(line, 128 + 11 * cpu_nr, fp) != NULL) && (irq < max_nr_irqcpu)) {
    if (isdigit(line[2]))
      irq++;
  }
  fclose(fp);
  return irq;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<get_irqcpu_nr>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,%r12d
  mov    %esi,%ebx
  lea    D1(%rip),%rsi
  lea    D2(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%rbp
  mov    $0x0,%eax
  test   %rbp,%rbp
  je     L72
  mov    D78(%rip),%r14
  lea    (%rbx,%rbx,4),%eax
  lea    0x80(%rbx,%rax,2),%r13d
  mov    %r13d,%esi
  mov    %r14,%rdi
  call   <realloc@plt>
  mov    %rax,D0(%rip)
  test   %rax,%rax
  je     L29
L38:
  test   %r14,%r14
  je     L44
L70:
  mov    $0x0,%ebx
  jmp    L1
L29:
  lea    D0(%rip),%rdi
  call   <perror@plt>
  mov    $0x4,%edi
  call   <exit@plt>
  jmp    L38
L44:
  mov    %r13d,%edx
  mov    $0x0,%esi
  mov    D0(%rip),%rdi
  call   <memset@plt>
  jmp    L70
L48:
  mov    D0(%rip),%rax
  movsbl 0x2(%rax),%edi
  call   <isdigit@plt>
  cmp    $0x1,%rax
  sbb    $0xffffffff,%ebx
L1:
  mov    %rbp,%rdx
  mov    %r13d,%esi
  mov    D0(%rip),%rdi
  call   <fgets@plt>
  test   %rax,%rax
  je     L31
  cmp    %ebx,%r12d
  ja     L48
L31:
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    %ebx,%eax
L72:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

tool_calls: name: read_data
arguments: tag: D1
type_infered: string
name: read_data
arguments: tag: D2
type_infered: string
name: read_data
arguments: tag: D0
type_infered: string

tool: D1: r

tool: D2: /proc/interrupts

tool: D0: realloc

assistant: ```c
int get_irqcpu_nr(int max_nr_irqcpu, int cpu_nr) {
  FILE *fp;
  static char *line;
  unsigned int irq = 0;
  if ((fp = fopen("/proc/interrupts", "r")) == NULL)
    return 0;
  do {
    char *_p_;
    _p_ = line;
    if (128 + 11 * cpu_nr) {
      if ((line = (char *)realloc(line, (128 + 11 * cpu_nr))) == NULL) {
        perror("realloc");
        exit(4);
      }
      if (!_p_)
        memset(line, 0, (128 + 11 * cpu_nr));
    }
  } while (0);
  while ((fgets(line, 128 + 11 * cpu_nr, fp) != NULL) && (irq < max_nr_irqcpu)) {
    if (isdigit(line[2]))
      irq++;
  }
  fclose(fp);
  return irq;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<get_irqcpu_nr>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  mov    %edi,%r12d
  lea    D27(%rip),%rdi
  push   %rbp
  push   %rbx
  mov    %esi,%ebx
  lea    D33(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%rbp
  xor    %eax,%eax
  test   %rbp,%rbp
  je     L24
  mov    D32(%rip),%r14
  lea    (%rbx,%rbx,4),%eax
  lea    0x80(%rbx,%rax,2),%r13d
  mov    %r14,%rdi
  mov    %r13d,%esi
  call   <realloc@plt>
  mov    %rax,D30(%rip)
  mov    %rax,%rdi
  test   %rax,%rax
  je     L79
L38:
  test   %r14,%r14
  je     L4
L66:
  xor    %ebx,%ebx
  jmp    L29
  nopl   0x0(%rax,%rax,1)
L1:
  cmp    %ebx,%r12d
  jbe    L67
  mov    D30(%rip),%rax
  movsbl 0x2(%rax),%edi
  call   <isdigit@plt>
  mov    D30(%rip),%rdi
  cmp    $0x1,%rax
  sbb    $0xffffffff,%ebx
L29:
  mov    %rbp,%rdx
  mov    %r13d,%esi
  call   <fgets@plt>
  test   %rax,%rax
  jne    L1
L67:
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    %ebx,%eax
L24:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  xchg   %ax,%ax
L4:
  mov    %r13d,%edx
  xor    %esi,%esi
  call   <memset@plt>
  mov    D30(%rip),%rdi
  jmp    L66
  nopl   0x0(%rax,%rax,1)
L79:
  lea    D30(%rip),%rdi
  call   <perror@plt>
  mov    $0x4,%edi
  call   <exit@plt>
  mov    D30(%rip),%rdi
  jmp    L38
```

tool_calls: name: extract_symbolic_data
arguments: label: D27
type_infered: string
name: extract_symbolic_data
arguments: label: D33
type_infered: string
name: extract_symbolic_data
arguments: label: D30
type_infered: string

tool: D27: /proc/interrupts

tool: D33: r

tool: D30: realloc

assistant: ```c
int get_irqcpu_nr(int max_nr_irqcpu, int cpu_nr) {
  FILE *fp;
  static char *line;
  unsigned int irq = 0;
  if ((fp = fopen("/proc/interrupts", "r")) == NULL)
    return 0;
  do {
    char *_p_;
    _p_ = line;
    if (128 + 11 * cpu_nr) {
      if ((line = (char *)realloc(line, (128 + 11 * cpu_nr))) == NULL) {
        perror("realloc");
        exit(4);
      }
      if (!_p_)
        memset(line, 0, (128 + 11 * cpu_nr));
    }
  } while (0);
  while ((fgets(line, 128 + 11 * cpu_nr, fp) != NULL) && (irq < max_nr_irqcpu)) {
    if (isdigit(line[2]))
      irq++;
  }
  fclose(fp);
  return irq;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<get_irqcpu_nr>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  mov    %edi,%r12d
  lea    D9(%rip),%rdi
  push   %rbp
  push   %rbx
  mov    %esi,%ebx
  lea    D65(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%rbp
  xor    %eax,%eax
  test   %rbp,%rbp
  je     L23
  mov    D56(%rip),%r14
  lea    (%rbx,%rbx,4),%eax
  lea    0x80(%rbx,%rax,2),%r13d
  mov    %r14,%rdi
  mov    %r13d,%esi
  call   <realloc@plt>
  mov    %rax,D40(%rip)
  mov    %rax,%rdi
  test   %rax,%rax
  je     L56
L69:
  test   %r14,%r14
  je     L64
L20:
  xor    %ebx,%ebx
  jmp    L49
  nopl   0x0(%rax,%rax,1)
L32:
  cmp    %ebx,%r12d
  jbe    L27
  mov    D40(%rip),%rax
  movsbl 0x2(%rax),%edi
  call   <isdigit@plt>
  mov    D40(%rip),%rdi
  cmp    $0x1,%rax
  sbb    $0xffffffff,%ebx
L49:
  mov    %rbp,%rdx
  mov    %r13d,%esi
  call   <fgets@plt>
  test   %rax,%rax
  jne    L32
L27:
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    %ebx,%eax
L23:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  xchg   %ax,%ax
L64:
  mov    %r13d,%edx
  xor    %esi,%esi
  call   <memset@plt>
  mov    D40(%rip),%rdi
  jmp    L20
  nopl   0x0(%rax,%rax,1)
L56:
  lea    D40(%rip),%rdi
  call   <perror@plt>
  mov    $0x4,%edi
  call   <exit@plt>
  mov    D40(%rip),%rdi
  jmp    L69
```

tool_calls: name: retrieve_data
arguments: tag: D9
data_type: string
name: retrieve_data
arguments: tag: D65
data_type: string
name: retrieve_data
arguments: tag: D40
data_type: string

tool: D9: /proc/interrupts

tool: D65: r

tool: D40: realloc

assistant: ```c
int get_irqcpu_nr(int max_nr_irqcpu, int cpu_nr) {
  FILE *fp;
  static char *line;
  unsigned int irq = 0;
  if ((fp = fopen("/proc/interrupts", "r")) == NULL)
    return 0;
  do {
    char *_p_;
    _p_ = line;
    if (128 + 11 * cpu_nr) {
      if ((line = (char *)realloc(line, (128 + 11 * cpu_nr))) == NULL) {
        perror("realloc");
        exit(4);
      }
      if (!_p_)
        memset(line, 0, (128 + 11 * cpu_nr));
    }
  } while (0);
  while ((fgets(line, 128 + 11 * cpu_nr, fp) != NULL) && (irq < max_nr_irqcpu)) {
    if (isdigit(line[2]))
      irq++;
  }
  fclose(fp);
  return irq;
}
```