ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 下面的汇编指令对应的C源代码是什么：

```asm
<alloc_data_matrix>:
  endbr64
  push   %r13
  push   %r12
  mov    %edi,%r12d
  push   %rbp
  lea    0x0(,%r12,8),%edi
  mov    %esi,%ebp
  push   %rbx
  sub    $0x8,%rsp
  call   <malloc@plt>
  test   %rax,%rax
  je     L16
  mov    %rax,%r13
  test   %r12d,%r12d
  jle    L11
  mov    %rax,%rbx
  lea    (%rax,%r12,8),%r12
  jmp    L25
  cs nopw 0x0(%rax,%rax,1)
L5:
  add    $0x8,%rbx
  cmp    %r12,%rbx
  je     L11
L25:
  mov    $0x8,%esi
  mov    %ebp,%edi
  call   <calloc@plt>
  mov    %rax,(%rbx)
  test   %rax,%rax
  jne    L5
L16:
  xor    %r13d,%r13d
L11:
  add    $0x8,%rsp
  mov    %r13,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
double **alloc_data_matrix(int rows, int cols) {
  double **dm = (double **)malloc(rows * sizeof(double *));
  if (dm == NULL)
    return NULL;
  int i;
  for (i = 0; i < rows; ++i) {
    dm[i] = (double *)calloc(cols, sizeof(double));
    if (dm[i] == NULL)
      return NULL;
  }
  return dm;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<alloc_data_matrix>:
  endbr64
  push   %r13
  push   %r12
  mov    %edi,%r12d
  push   %rbp
  lea    0x0(,%r12,8),%edi
  mov    %esi,%ebp
  push   %rbx
  sub    $0x8,%rsp
  call   <malloc@plt>
  test   %rax,%rax
  je     L13
  mov    %rax,%r13
  test   %r12d,%r12d
  jle    L27
  mov    %rax,%rbx
  lea    (%rax,%r12,8),%r12
  jmp    L7
  cs nopw 0x0(%rax,%rax,1)
L32:
  add    $0x8,%rbx
  cmp    %r12,%rbx
  je     L27
L7:
  mov    $0x8,%esi
  mov    %ebp,%edi
  call   <calloc@plt>
  mov    %rax,(%rbx)
  test   %rax,%rax
  jne    L32
L13:
  xor    %r13d,%r13d
L27:
  add    $0x8,%rsp
  mov    %r13,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
double **alloc_data_matrix(int rows, int cols) {
  double **dm = (double **)malloc(rows * sizeof(double *));
  if (dm == NULL)
    return NULL;
  int i;
  for (i = 0; i < rows; ++i) {
    dm[i] = (double *)calloc(cols, sizeof(double));
    if (dm[i] == NULL)
      return NULL;
  }
  return dm;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x3c(%rbp)
  movl   $0x1,-0x30(%rbp)
  movl   $0x2,-0x2c(%rbp)
  movl   $0x3,-0x28(%rbp)
  movl   $0x4,-0x24(%rbp)
  movl   $0x5,-0x20(%rbp)
  movl   $0x6,-0x1c(%rbp)
  movl   $0x7,-0x18(%rbp)
  movl   $0x8,-0x14(%rbp)
  movl   $0x9,-0x10(%rbp)
  movl   $0xa,-0xc(%rbp)
  movq   $0x0,-0x38(%rbp)
  mov    $0x0,%eax
  call   <creat_stack@plt>
  mov    %rax,-0x38(%rbp)
  movl   $0x0,-0x3c(%rbp)
  jmp    L10
L12:
  mov    -0x3c(%rbp),%eax
  cltq
  mov    -0x30(%rbp,%rax,4),%edx
  lea    -0x38(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <push_stack@plt>
  addl   $0x1,-0x3c(%rbp)
L10:
  cmpl   $0x9,-0x3c(%rbp)
  jle    L12
  movl   $0x0,-0x3c(%rbp)
  jmp    L16
L17:
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <pop_stack@plt>
  addl   $0x1,-0x3c(%rbp)
L16:
  cmpl   $0x9,-0x3c(%rbp)
  jle    L17
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L43
  call   <__stack_chk_fail@plt>
L43:
  leave
  ret
```

assistant: ```c
int main() {
  int temp = 0;
  int array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  struct node *p_top = NULL;
  p_top = creat_stack();
  for (temp = 0; temp < 10; temp++) {
    push_stack(&p_top, array[temp]);
  }
  for (temp = 0; temp < 10; temp++) {
    pop_stack(p_top);
  }
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<main>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x40,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  movl   $0x1,0x10(%rsp)
  movl   $0x2,0x14(%rsp)
  movl   $0x3,0x18(%rsp)
  movl   $0x4,0x1c(%rsp)
  movl   $0x5,0x20(%rsp)
  movl   $0x6,0x24(%rsp)
  movl   $0x7,0x28(%rsp)
  movl   $0x8,0x2c(%rsp)
  movl   $0x9,0x30(%rsp)
  movl   $0xa,0x34(%rsp)
  movq   $0x0,0x8(%rsp)
  call   <creat_stack@plt>
  mov    %rax,0x8(%rsp)
  lea    0x10(%rsp),%rbx
  lea    0x38(%rsp),%r12
  lea    0x8(%rsp),%rbp
L7:
  mov    (%rbx),%esi
  mov    %rbp,%rdi
  call   <push_stack@plt>
  add    $0x4,%rbx
  cmp    %r12,%rbx
  jne    L7
  mov    $0xa,%ebx
L24:
  mov    0x8(%rsp),%rdi
  call   <pop_stack@plt>
  sub    $0x1,%ebx
  jne    L24
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L11
  mov    $0x0,%eax
  add    $0x40,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L11:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int main() {
  int temp = 0;
  int array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  struct node *p_top = NULL;
  p_top = creat_stack();
  for (temp = 0; temp < 10; temp++) {
    push_stack(&p_top, array[temp]);
  }
  for (temp = 0; temp < 10; temp++) {
    pop_stack(p_top);
  }
  return 0;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<main>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x40,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  lea    0x14(%rsp),%rbx
  lea    0x38(%rsp),%r12
  movabs $0x400000003,%rax
  mov    %rax,0x18(%rsp)
  lea    0x8(%rsp),%rbp
  movabs $0x600000005,%rax
  mov    %rax,0x20(%rsp)
  movabs $0x800000007,%rax
  mov    %rax,0x28(%rsp)
  movabs $0xa00000009,%rax
  mov    %rax,0x30(%rsp)
  xor    %eax,%eax
  movl   $0x2,0x14(%rsp)
  movq   $0x0,0x8(%rsp)
  call   <creat_stack@plt>
  mov    $0x1,%esi
  mov    %rax,0x8(%rsp)
  jmp    L23
  nopl   0x0(%rax,%rax,1)
L18:
  mov    (%rbx),%esi
  add    $0x4,%rbx
L23:
  mov    %rbp,%rdi
  call   <push_stack@plt>
  cmp    %r12,%rbx
  jne    L18
  mov    $0xa,%ebx
  nopl   0x0(%rax,%rax,1)
L13:
  mov    0x8(%rsp),%rdi
  call   <pop_stack@plt>
  sub    $0x1,%ebx
  jne    L13
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L8
  add    $0x40,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L8:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int main() {
  int temp = 0;
  int array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  struct node *p_top = NULL;
  p_top = creat_stack();
  for (temp = 0; temp < 10; temp++) {
    push_stack(&p_top, array[temp]);
  }
  for (temp = 0; temp < 10; temp++) {
    pop_stack(p_top);
  }
  return 0;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<main>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x40,%rsp
  movdqa D7(%rip),%xmm0
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%rbx
  lea    0x38(%rsp),%r12
  mov    D12(%rip),%rax
  movaps %xmm0,0x10(%rsp)
  movdqa D17(%rip),%xmm0
  lea    0x8(%rsp),%rbp
  mov    %rax,0x30(%rsp)
  xor    %eax,%eax
  movq   $0x0,0x8(%rsp)
  movaps %xmm0,0x20(%rsp)
  call   <creat_stack@plt>
  mov    %rax,0x8(%rsp)
  cs nopw 0x0(%rax,%rax,1)
L26:
  mov    (%rbx),%esi
  mov    %rbp,%rdi
  add    $0x4,%rbx
  call   <push_stack@plt>
  cmp    %rbx,%r12
  jne    L26
  mov    $0xa,%ebx
  nopl   0x0(%rax,%rax,1)
L23:
  mov    0x8(%rsp),%rdi
  call   <pop_stack@plt>
  sub    $0x1,%ebx
  jne    L23
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L3
  add    $0x40,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L3:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D7
datatype: byte[16]
name: parse_data
arguments: data_label: D12
datatype: byte[8]
name: parse_data
arguments: data_label: D17
datatype: byte[16]

tool: {"D7": [0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x04,0x00,0x00,0x00]}

tool: {"D12": [0x09,0x00,0x00,0x00,0x0a,0x00,0x00,0x00]}

tool: {"D17": [0x05,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x08,0x00,0x00,0x00]}

assistant: ```c
int main() {
  int temp = 0;
  int array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  struct node *p_top = NULL;
  p_top = creat_stack();
  for (temp = 0; temp < 10; temp++) {
    push_stack(&p_top, array[temp]);
  }
  for (temp = 0; temp < 10; temp++) {
    pop_stack(p_top);
  }
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<cbor_write_int>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %esi,-0xc(%rbp)
  mov    %edx,-0x10(%rbp)
  cmpl   $0x0,-0x10(%rbp)
  jns    L7
  mov    -0x10(%rbp),%eax
  neg    %eax
  mov    %eax,%edx
  mov    -0xc(%rbp),%ecx
  mov    -0x8(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <cbor_write_nint@plt>
  jmp    L6
L7:
  mov    -0x10(%rbp),%edx
  mov    -0xc(%rbp),%ecx
  mov    -0x8(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <cbor_write_pint@plt>
L6:
  leave
  ret
```

assistant: ```c
unsigned char *cbor_write_int(unsigned char *data, unsigned int size, int value) {
  if (value < 0) {
    return cbor_write_nint(data, size, (unsigned int)(-value));
  } else {
    return cbor_write_pint(data, size, (unsigned int)(value));
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<cbor_write_int>:
  endbr64
  sub    $0x8,%rsp
  test   %edx,%edx
  js     L15
  call   <cbor_write_pint@plt>
L8:
  add    $0x8,%rsp
  ret
L15:
  neg    %edx
  call   <cbor_write_nint@plt>
  jmp    L8
```

assistant: ```c
unsigned char *cbor_write_int(unsigned char *data, unsigned int size, int value) {
  if (value < 0) {
    return cbor_write_nint(data, size, (unsigned int)(-value));
  } else {
    return cbor_write_pint(data, size, (unsigned int)(value));
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<cbor_write_int>:
  endbr64
  test   %edx,%edx
  js     L0
  jmp    1070 <cbor_write_pint@plt>
  nopl   (%rax)
L0:
  neg    %edx
  jmp    1060 <cbor_write_nint@plt>
```

assistant: ```c
unsigned char *cbor_write_int(unsigned char *data, unsigned int size, int value) {
  if (value < 0) {
    return cbor_write_nint(data, size, (unsigned int)(-value));
  } else {
    return cbor_write_pint(data, size, (unsigned int)(value));
  }
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<cbor_write_int>:
  endbr64
  test   %edx,%edx
  js     L8
  jmp    1070 <cbor_write_pint@plt>
  nopl   (%rax)
L8:
  neg    %edx
  jmp    1060 <cbor_write_nint@plt>
```

assistant: ```c
unsigned char *cbor_write_int(unsigned char *data, unsigned int size, int value) {
  if (value < 0) {
    return cbor_write_nint(data, size, (unsigned int)(-value));
  } else {
    return cbor_write_pint(data, size, (unsigned int)(value));
  }
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<sha1_hash>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  add    $0xffffffffffffff80,%rsp
  mov    %rdi,-0x78(%rbp)
  mov    %rsi,-0x80(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x78(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%ecx
  lea    -0x60(%rbp),%rdx
  mov    -0x78(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <SHA1@plt>
  movl   $0x0,-0x64(%rbp)
  jmp    L7
L10:
  mov    -0x64(%rbp),%eax
  cltq
  movzbl -0x60(%rbp,%rax,1),%eax
  movzbl %al,%eax
  mov    -0x64(%rbp),%edx
  add    %edx,%edx
  movslq %edx,%rdx
  lea    -0x40(%rbp),%rcx
  add    %rdx,%rcx
  mov    %eax,%edx
  lea    D0(%rip),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <sprintf@plt>
  addl   $0x1,-0x64(%rbp)
L7:
  mov    -0x64(%rbp),%eax
  cmp    $0x13,%eax
  jbe    L10
  lea    -0x40(%rbp),%rdx
  mov    -0x80(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0x80(%rbp),%rax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L13
  call   <__stack_chk_fail@plt>
L13:
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D0
datatype: string

tool: D0: %02x

assistant: ```c
char *sha1_hash(char *input_url, char *hashed_url) {
  unsigned char hashed_160bits[20];
  char hashed_hex[41];
  int i;
  SHA1(input_url, strlen(input_url), hashed_160bits);
  for (i = 0; i < sizeof(hashed_160bits); i++)
    sprintf(hashed_hex + i * 2, "%02x", hashed_160bits[i]);
  strcpy(hashed_url, hashed_hex);
  return hashed_url;
}
```
user: Translate the below assembly code into C programming language:

```asm
<sha1_hash>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x60,%rsp
  mov    %rdi,%rbx
  mov    %rsi,%r13
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  call   <strlen@plt>
  mov    %eax,%esi
  mov    %rsp,%rbp
  mov    %rbp,%rdx
  mov    %rbx,%rdi
  call   <SHA1@plt>
  lea    0x20(%rsp),%rbx
  lea    0x48(%rsp),%r14
  lea    D7(%rip),%r12
L18:
  movzbl 0x0(%rbp),%edx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <sprintf@plt>
  add    $0x1,%rbp
  add    $0x2,%rbx
  cmp    %r14,%rbx
  jne    L18
  lea    0x20(%rsp),%rsi
  mov    %r13,%rdi
  call   <strcpy@plt>
  mov    0x58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L6
  mov    %r13,%rax
  add    $0x60,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L6:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: tag: D7
type: string

tool: D7: %02x

assistant: ```c
char *sha1_hash(char *input_url, char *hashed_url) {
  unsigned char hashed_160bits[20];
  char hashed_hex[41];
  int i;
  SHA1(input_url, strlen(input_url), hashed_160bits);
  for (i = 0; i < sizeof(hashed_160bits); i++)
    sprintf(hashed_hex + i * 2, "%02x", hashed_160bits[i]);
  strcpy(hashed_url, hashed_hex);
  return hashed_url;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<sha1_hash>:
  endbr64
  push   %r15
  push   %r14
  mov    %rsi,%r14
  push   %r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  sub    $0x68,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbp
  lea    0x20(%rsp),%r15
  lea    0x48(%rsp),%r13
  call   <strlen@plt>
  mov    %r12,%rdi
  mov    %rbp,%rdx
  mov    %r15,%rbx
  mov    %eax,%esi
  lea    D7(%rip),%r12
  call   <SHA1@plt>
  nopl   0x0(%rax)
L14:
  movzbl 0x0(%rbp),%edx
  mov    %rbx,%rdi
  mov    %r12,%rsi
  add    $0x2,%rbx
  add    $0x1,%rbp
  call   <sprintf@plt>
  cmp    %r13,%rbx
  jne    L14
  mov    %r15,%rsi
  mov    %r14,%rdi
  call   <strcpy@plt>
  mov    0x58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L18
  add    $0x68,%rsp
  mov    %r14,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L18:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D7
datatype: string

tool: D7: %02x

assistant: ```c
char *sha1_hash(char *input_url, char *hashed_url) {
  unsigned char hashed_160bits[20];
  char hashed_hex[41];
  int i;
  SHA1(input_url, strlen(input_url), hashed_160bits);
  for (i = 0; i < sizeof(hashed_160bits); i++)
    sprintf(hashed_hex + i * 2, "%02x", hashed_160bits[i]);
  strcpy(hashed_url, hashed_hex);
  return hashed_url;
}
```
user: What is the c source code of the assembly code below?

```asm
<sha1_hash>:
  endbr64
  push   %r15
  push   %r14
  mov    %rsi,%r14
  push   %r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  sub    $0x68,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbp
  lea    0x20(%rsp),%r15
  lea    0x48(%rsp),%r13
  call   <strlen@plt>
  mov    %r12,%rdi
  mov    %rbp,%rdx
  mov    %r15,%rbx
  mov    %eax,%esi
  lea    D5(%rip),%r12
  call   <SHA1@plt>
  nopl   0x0(%rax)
L1:
  movzbl 0x0(%rbp),%edx
  mov    %rbx,%rdi
  mov    %r12,%rsi
  add    $0x2,%rbx
  add    $0x1,%rbp
  call   <sprintf@plt>
  cmp    %r13,%rbx
  jne    L1
  mov    %r15,%rsi
  mov    %r14,%rdi
  call   <strcpy@plt>
  mov    0x58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L17
  add    $0x68,%rsp
  mov    %r14,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L17:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: tag: D5
type_guessed: string

tool: D5: %02x

assistant: ```c
char *sha1_hash(char *input_url, char *hashed_url) {
  unsigned char hashed_160bits[20];
  char hashed_hex[41];
  int i;
  SHA1(input_url, strlen(input_url), hashed_160bits);
  for (i = 0; i < sizeof(hashed_160bits); i++)
    sprintf(hashed_hex + i * 2, "%02x", hashed_160bits[i]);
  strcpy(hashed_url, hashed_hex);
  return hashed_url;
}
```
user: Translate the below assembly code into C programming language:

```asm
<get_run_queue_size>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xb0,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0xac(%rbp)
  lea    D8(%rip),%rax
  mov    %rax,%rdi
  call   <opendir@plt>
  mov    %rax,-0xa8(%rbp)
  cmpq   $0x0,-0xa8(%rbp)
  jne    L86
  mov    $0x0,%eax
  jmp    L77
L52:
  mov    -0xa0(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %eax,%eax
  jne    L56
  jmp    L86
L56:
  mov    -0xa0(%rbp),%rax
  mov    (%rax),%rdx
  lea    -0x90(%rbp),%rax
  lea    D14(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  lea    -0x90(%rbp),%rax
  lea    D6(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x98(%rbp)
  cmpq   $0x0,-0x98(%rbp)
  jne    L26
  mov    -0xac(%rbp),%eax
  jmp    L77
L26:
  lea    -0x90(%rbp),%rsi
  lea    -0x50(%rbp),%rcx
  lea    -0xb0(%rbp),%rdx
  mov    -0x98(%rbp),%rax
  mov    %rsi,%r8
  lea    D33(%rip),%rsi
  mov    %rax,%rdi
  call   <fscanf@plt>
  movzbl -0x90(%rbp),%eax
  cmp    $0x52,%al
  jne    L28
  addl   $0x1,-0xac(%rbp)
L28:
  mov    -0x98(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
L86:
  mov    -0xa8(%rbp),%rax
  mov    %rax,%rdi
  call   <readdir@plt>
  mov    %rax,-0xa0(%rbp)
  cmpq   $0x0,-0xa0(%rbp)
  jne    L52
  mov    -0xa8(%rbp),%rax
  mov    %rax,%rdi
  call   <closedir@plt>
  mov    -0xac(%rbp),%eax
L77:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L13
  call   <__stack_chk_fail@plt>
L13:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: label: D8
type_guessed: string
name: disassemble_data
arguments: label: D14
type_guessed: string
name: disassemble_data
arguments: label: D6
type_guessed: string
name: disassemble_data
arguments: label: D33
type_guessed: string

tool: D8: /proc

tool: D14: /proc/%s/stat

tool: D6: r

tool: D33: %d %s %s

assistant: ```c
unsigned int get_run_queue_size() {
  int dummy_i;
  unsigned int length = 0;
  FILE *fp;
  DIR *dp;
  struct dirent *de;
  char txt[64], dummy_str[64];
  if ((dp = opendir("/proc")) == NULL)
    return (0);
  while ((de = readdir(dp)) != NULL) {
    if (!isdigit(de->d_name[0]))
      continue;
    sprintf(txt, "/proc/%s/stat", de->d_name);
    if ((fp = fopen(txt, "r")) == NULL)
      return (length);
    fscanf(fp, "%d %s %s", &dummy_i, dummy_str, txt);
    if (txt[0] == 'R')
      ++length;
    fclose(fp);
  }
  closedir(dp);
  return (length);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<get_run_queue_size>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xa8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x98(%rsp)
  xor    %eax,%eax
  lea    D6(%rip),%rdi
  call   <opendir@plt>
  test   %rax,%rax
  je     L21
  mov    %rax,%r12
  mov    $0x0,%r13d
  lea    0x10(%rsp),%rbp
  lea    D37(%rip),%r15
  lea    D34(%rip),%r14
L44:
  mov    %r12,%rdi
  call   <readdir@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L12
  mov    (%rbx),%rax
  movsbl (%rax),%edi
  call   <isdigit@plt>
  test   %eax,%eax
  je     L44
  mov    (%rbx),%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <fopen@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L48
  lea    0x50(%rsp),%rcx
  lea    0xc(%rsp),%rdx
  mov    %rbp,%r8
  lea    D0(%rip),%rsi
  mov    %rax,%rdi
  call   <fscanf@plt>
  cmpb   $0x52,0x10(%rsp)
  sete   %al
  movzbl %al,%eax
  add    %eax,%r13d
  mov    %rbx,%rdi
  call   <fclose@plt>
  jmp    L44
L12:
  mov    %r12,%rdi
  call   <closedir@plt>
L48:
  mov    0x98(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L61
  mov    %r13d,%eax
  add    $0xa8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L21:
  mov    $0x0,%r13d
  jmp    L48
L61:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D6
data_type: string
name: retrieve_data
arguments: label: D37
data_type: string
name: retrieve_data
arguments: label: D34
data_type: string
name: retrieve_data
arguments: label: D0
data_type: string

tool: D6: /proc

tool: D37: /proc/%s/stat

tool: D34: r

tool: D0: %d %s %s

assistant: ```c
unsigned int get_run_queue_size() {
  int dummy_i;
  unsigned int length = 0;
  FILE *fp;
  DIR *dp;
  struct dirent *de;
  char txt[64], dummy_str[64];
  if ((dp = opendir("/proc")) == NULL)
    return (0);
  while ((de = readdir(dp)) != NULL) {
    if (!isdigit(de->d_name[0]))
      continue;
    sprintf(txt, "/proc/%s/stat", de->d_name);
    if ((fp = fopen(txt, "r")) == NULL)
      return (length);
    fscanf(fp, "%d %s %s", &dummy_i, dummy_str, txt);
    if (txt[0] == 'R')
      ++length;
    fclose(fp);
  }
  closedir(dp);
  return (length);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<get_run_queue_size>:
  endbr64
  push   %r15
  lea    D2(%rip),%rdi
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xa8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x98(%rsp)
  xor    %eax,%eax
  call   <opendir@plt>
  test   %rax,%rax
  je     L7
  mov    %rax,%rbp
  xor    %r12d,%r12d
  lea    0x10(%rsp),%rbx
  lea    D17(%rip),%r14
  lea    D10(%rip),%r13
  cs nopw 0x0(%rax,%rax,1)
L17:
  mov    %rbp,%rdi
  call   <readdir@plt>
  mov    %rax,%r15
  test   %rax,%rax
  je     L52
L66:
  mov    (%r15),%rax
  movsbl (%rax),%edi
  call   <isdigit@plt>
  test   %eax,%eax
  je     L17
  mov    (%r15),%rdx
  mov    %r14,%rsi
  mov    %rbx,%rdi
  call   <sprintf@plt>
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <fopen@plt>
  mov    %rax,%r15
  test   %rax,%rax
  je     L1
  lea    0x50(%rsp),%rcx
  lea    0xc(%rsp),%rdx
  mov    %rbx,%r8
  mov    %rax,%rdi
  lea    D31(%rip),%rsi
  call   <fscanf@plt>
  xor    %eax,%eax
  cmpb   $0x52,0x10(%rsp)
  mov    %r15,%rdi
  sete   %al
  add    %eax,%r12d
  call   <fclose@plt>
  mov    %rbp,%rdi
  call   <readdir@plt>
  mov    %rax,%r15
  test   %rax,%rax
  jne    L66
L52:
  mov    %rbp,%rdi
  call   <closedir@plt>
L1:
  mov    0x98(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L33
  add    $0xa8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L7:
  xor    %r12d,%r12d
  jmp    L1
L33:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: label: D2
data_type: string
name: parse_data
arguments: label: D17
data_type: string
name: parse_data
arguments: label: D10
data_type: string
name: parse_data
arguments: label: D31
data_type: string

tool: D2: /proc

tool: D17: /proc/%s/stat

tool: D10: r

tool: D31: %d %s %s

assistant: ```c
unsigned int get_run_queue_size() {
  int dummy_i;
  unsigned int length = 0;
  FILE *fp;
  DIR *dp;
  struct dirent *de;
  char txt[64], dummy_str[64];
  if ((dp = opendir("/proc")) == NULL)
    return (0);
  while ((de = readdir(dp)) != NULL) {
    if (!isdigit(de->d_name[0]))
      continue;
    sprintf(txt, "/proc/%s/stat", de->d_name);
    if ((fp = fopen(txt, "r")) == NULL)
      return (length);
    fscanf(fp, "%d %s %s", &dummy_i, dummy_str, txt);
    if (txt[0] == 'R')
      ++length;
    fclose(fp);
  }
  closedir(dp);
  return (length);
}
```