ylfeng/ReF-Decompile-dataset huggingface dataset:
user: What would the C source look like for the assembly code provided here?

```asm
<epk_parse_config>:
  endbr64
  push   %r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x210,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x208(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r12
  nop
L177:
  mov    %rbp,%rdx
  mov    $0x200,%esi
  mov    %r12,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  je     L63
  mov    %r12,%rdi
  call   <strlen@plt>
  cmp    $0x1ff,%eax
  je     L171
L24:
  movsbl (%rsp),%edi
  mov    %r12,%rbx
  test   %dil,%dil
  jne    L132
  jmp    L40
  nopl   (%rax)
L138:
  movsbl 0x1(%rbx),%edi
  add    $0x1,%rbx
  test   %dil,%dil
  je     L40
L132:
  call   <isspace@plt>
  test   %rax,%rax
  jne    L138
  movzbl (%rbx),%eax
  cmp    $0x23,%al
  je     L177
  jmp    L1
  nopl   0x0(%rax)
L169:
  movzbl 0x1(%rbx),%eax
  add    $0x1,%rbx
L1:
  test   %al,%al
  je     L144
  cmp    $0x3d,%al
  jne    L169
L47:
  movzbl 0x1(%rbx),%eax
  movb   $0x0,(%rbx)
  lea    0x1(%rbx),%rdi
  test   %al,%al
  je     L65
  cmp    $0x23,%al
  je     L65
  mov    %rdi,%rax
  nopw   0x0(%rax,%rax,1)
L57:
  movzbl 0x1(%rax),%edx
  add    $0x1,%rax
  test   %dl,%dl
  je     L10
  cmp    $0x23,%dl
  jne    L57
L10:
  movb   $0x0,(%rax)
  call   <epk_format@plt>
  mov    %r12,%rdi
  mov    %eax,%r14d
  call   <epk_format@plt>
  mov    %r14d,%esi
  mov    %eax,%edi
  call   <epk_conf_set@plt>
  jmp    L177
  nopl   0x0(%rax,%rax,1)
L171:
  cmpb   $0xa,0x1ff(%rsp)
  je     L24
  mov    %r12,%rdx
  mov    %r13,%rsi
  lea    D1(%rip),%rdi
  call   <elg_warning@plt>
L63:
  mov    0x208(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L61
  add    $0x210,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L144:
  cmp    $0x3d,%al
  je     L47
  nopl   0x0(%rax,%rax,1)
L40:
  movb   $0x0,-0x1(%rbx)
  lea    -0x1(%rbx),%rsi
  mov    %r13,%rdx
  mov    %r12,%rdi
  call   <epk_check_syntax@plt>
  jmp    L177
L65:
  mov    %rdi,%rax
  jmp    L10
L61:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: tag: D1
datatype: string

tool: D1: Syntax error in %s::%s (Skipped parsing at overlong line)


assistant: ```c
void epk_parse_config(FILE *cfgFile, char *fname) {
  char buf[512], *it, *val;
  while (fgets(buf, 512, cfgFile)) {
    if ((strlen(buf) == 512 - 1) && (buf[512 - 1] != '\n')) {
      elg_warning("Syntax error in %s::%s (Skipped parsing at overlong line)\n", fname, buf);
      break;
    } else {
      it = buf;
      while (*it && isspace(*it)) {
        it++;
      }
      if (*it == '#') {
        continue;
      }
      while (*it && *it != '=') {
        it++;
      }
      if (*it != '=') {
        *--it = 0;
        epk_check_syntax(buf, it, fname);
        continue;
      }
      *it++ = 0;
      val = it;
      while (*it && *it != '#') {
        it++;
      }
      *it = 0;
      epk_conf_set(epk_format(buf), epk_format(val));
    }
  }
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<palette8torgb32>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
  mov    %rcx,-0x30(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L13
L5:
  mov    -0x4(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  shl    $0x2,%eax
  cltq
  add    $0x2,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x20(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x4(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  shl    $0x2,%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    -0x20(%rbp),%rdx
  add    $0x4,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x4(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  shl    $0x2,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    -0x20(%rbp),%rdx
  add    $0x8,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  addq   $0x10,-0x20(%rbp)
  addl   $0x1,-0x4(%rbp)
L13:
  mov    -0x4(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jb     L5
  nop
  nop
  pop    %rbp
  ret
```

assistant: ```c
void palette8torgb32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) {
  unsigned i;
  for (i = 0; i < num_pixels; i++) {
    dst[0] = palette[src[i] * 4 + 2];
    dst[1] = palette[src[i] * 4 + 1];
    dst[2] = palette[src[i] * 4 + 0];
    dst += 4;
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<palette8torgb32>:
  endbr64
  mov    %rsi,%rax
  test   %edx,%edx
  je     L13
  mov    %edx,%edx
  shl    $0x4,%rdx
  lea    (%rsi,%rdx,1),%rsi
L7:
  mov    (%rdi),%edx
  shl    $0x2,%edx
  movslq %edx,%rdx
  mov    0x8(%rcx,%rdx,4),%edx
  mov    %edx,(%rax)
  mov    (%rdi),%edx
  shl    $0x2,%edx
  movslq %edx,%rdx
  mov    0x4(%rcx,%rdx,4),%edx
  mov    %edx,0x4(%rax)
  mov    (%rdi),%edx
  shl    $0x2,%edx
  movslq %edx,%rdx
  mov    (%rcx,%rdx,4),%edx
  mov    %edx,0x8(%rax)
  add    $0x10,%rax
  add    $0x4,%rdi
  cmp    %rsi,%rax
  jne    L7
L13:
  ret
```

assistant: ```c
void palette8torgb32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) {
  unsigned i;
  for (i = 0; i < num_pixels; i++) {
    dst[0] = palette[src[i] * 4 + 2];
    dst[1] = palette[src[i] * 4 + 1];
    dst[2] = palette[src[i] * 4 + 0];
    dst += 4;
  }
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<palette8torgb32>:
  endbr64
  mov    %rsi,%rax
  test   %edx,%edx
  je     L8
  mov    %edx,%edx
  shl    $0x4,%rdx
  lea    (%rsi,%rdx,1),%rsi
  nopl   (%rax)
L3:
  mov    (%rdi),%edx
  add    $0x10,%rax
  add    $0x4,%rdi
  shl    $0x2,%edx
  movslq %edx,%rdx
  mov    0x8(%rcx,%rdx,4),%edx
  mov    %edx,-0x10(%rax)
  mov    -0x4(%rdi),%edx
  shl    $0x2,%edx
  movslq %edx,%rdx
  mov    0x4(%rcx,%rdx,4),%edx
  mov    %edx,-0xc(%rax)
  mov    -0x4(%rdi),%edx
  shl    $0x2,%edx
  movslq %edx,%rdx
  mov    (%rcx,%rdx,4),%edx
  mov    %edx,-0x8(%rax)
  cmp    %rsi,%rax
  jne    L3
L8:
  ret
```

assistant: ```c
void palette8torgb32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) {
  unsigned i;
  for (i = 0; i < num_pixels; i++) {
    dst[0] = palette[src[i] * 4 + 2];
    dst[1] = palette[src[i] * 4 + 1];
    dst[2] = palette[src[i] * 4 + 0];
    dst += 4;
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<palette8torgb32>:
  endbr64
  mov    %rsi,%rax
  test   %edx,%edx
  je     L1
  mov    %edx,%edx
  shl    $0x4,%rdx
  lea    (%rsi,%rdx,1),%rsi
  nopl   (%rax)
L7:
  mov    (%rdi),%edx
  add    $0x10,%rax
  add    $0x4,%rdi
  shl    $0x2,%edx
  movslq %edx,%rdx
  mov    0x8(%rcx,%rdx,4),%edx
  mov    %edx,-0x10(%rax)
  mov    -0x4(%rdi),%edx
  shl    $0x2,%edx
  movslq %edx,%rdx
  mov    0x4(%rcx,%rdx,4),%edx
  mov    %edx,-0xc(%rax)
  mov    -0x4(%rdi),%edx
  shl    $0x2,%edx
  movslq %edx,%rdx
  mov    (%rcx,%rdx,4),%edx
  mov    %edx,-0x8(%rax)
  cmp    %rsi,%rax
  jne    L7
L1:
  ret
```

assistant: ```c
void palette8torgb32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) {
  unsigned i;
  for (i = 0; i < num_pixels; i++) {
    dst[0] = palette[src[i] * 4 + 2];
    dst[1] = palette[src[i] * 4 + 1];
    dst[2] = palette[src[i] * 4 + 0];
    dst += 4;
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<ftp_getrc>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x18(%rbp)
  jmp    L86
L8:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L142
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jle    L103
L142:
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  jmp    L86
L103:
  mov    -0x10(%rbp),%rax
  add    $0x3,%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  jne    L112
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <strdup@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <enough_mem@plt>
  jmp    L9
L112:
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L86:
  mov    -0x24(%rbp),%eax
  mov    %eax,%edi
  call   <ftp_readline@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L8
L9:
  cmpq   $0x0,-0x10(%rbp)
  je     L102
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L136
L102:
  mov    $0x0,%eax
  jmp    L49
L136:
  lea    -0x1c(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  lea    D0(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sscanf@plt>
  cmpq   $0x0,-0x30(%rbp)
  je     L125
  mov    -0x30(%rbp),%rax
  mov    -0x18(%rbp),%rdx
  mov    %rdx,(%rax)
  jmp    L140
L125:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L140:
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  movq   $0x0,-0x18(%rbp)
  mov    -0x1c(%rbp),%eax
  cmp    $0x63,%eax
  jle    L20
  mov    -0x1c(%rbp),%eax
  jmp    L49
L20:
  mov    $0x0,%eax
L49:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L67
  call   <__stack_chk_fail@plt>
L67:
  leave
  ret
```

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

tool: D0: %d 

assistant: ```c
int ftp_getrc(int fd, char **data) {
  char *line;
  char *tmp = 0;
  int response;
  while ((line = ftp_readline(fd))) {
    if (line[0] < '0' || line[0] > '9') {
      free(line);
      continue;
    }
    if (line[3] == ' ') {
      tmp = strdup(line);
      enough_mem(tmp);
      break;
    }
    free(line);
  }
  if (!line || !*line)
    return 0;
  sscanf(line, "%d ", &response);
  if (data) {
    *data = tmp;
  } else {
    free(tmp);
  }
  free(line);
  tmp = 0;
  if (response >= 100)
    return response;
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<ftp_getrc>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %edi,%ebp
  mov    %rsi,%r12
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  jmp    L33
L35:
  mov    %rbx,%rdi
  call   <free@plt>
L33:
  mov    %ebp,%edi
  call   <ftp_readline@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L49
  movzbl (%rbx),%eax
  sub    $0x30,%eax
  cmp    $0x9,%al
  ja     L35
  cmpb   $0x20,0x3(%rbx)
  je     L4
  mov    %rbx,%rdi
  call   <free@plt>
  jmp    L33
L4:
  mov    %rbx,%rdi
  call   <strdup@plt>
  mov    %rax,%rbp
  mov    %rax,%rdi
  call   <enough_mem@plt>
  mov    $0x0,%eax
  cmpb   $0x0,(%rbx)
  je     L1
  lea    0x4(%rsp),%rdx
  lea    D2(%rip),%rsi
  mov    %rbx,%rdi
  call   <sscanf@plt>
  test   %r12,%r12
  je     L52
  mov    %rbp,(%r12)
L69:
  mov    %rbx,%rdi
  call   <free@plt>
  mov    0x4(%rsp),%eax
  cmp    $0x63,%eax
  mov    $0x0,%edx
  cmovle %edx,%eax
  jmp    L1
L49:
  mov    $0x0,%eax
L1:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L82
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L52:
  mov    %rbp,%rdi
  call   <free@plt>
  jmp    L69
L82:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: label: D2
type_infered: string

tool: D2: %d 

assistant: ```c
int ftp_getrc(int fd, char **data) {
  char *line;
  char *tmp = 0;
  int response;
  while ((line = ftp_readline(fd))) {
    if (line[0] < '0' || line[0] > '9') {
      free(line);
      continue;
    }
    if (line[3] == ' ') {
      tmp = strdup(line);
      enough_mem(tmp);
      break;
    }
    free(line);
  }
  if (!line || !*line)
    return 0;
  sscanf(line, "%d ", &response);
  if (data) {
    *data = tmp;
  } else {
    free(tmp);
  }
  free(line);
  tmp = 0;
  if (response >= 100)
    return response;
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<ftp_getrc>:
  endbr64
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  push   %rbx
  mov    %edi,%ebx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  jmp    L79
  nopl   (%rax)
L37:
  movzbl 0x0(%rbp),%eax
  mov    %rbp,%rdi
  sub    $0x30,%eax
  cmp    $0x9,%al
  ja     L22
  cmpb   $0x20,0x3(%rbp)
  je     L49
L22:
  call   <free@plt>
L79:
  mov    %ebx,%edi
  call   <ftp_readline@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  jne    L37
L11:
  xor    %eax,%eax
L55:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L13
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L49:
  call   <strdup@plt>
  mov    %rax,%rdi
  mov    %rax,%r13
  call   <enough_mem@plt>
  cmpb   $0x0,0x0(%rbp)
  je     L11
  lea    0x4(%rsp),%rdx
  lea    D6(%rip),%rsi
  mov    %rbp,%rdi
  call   <sscanf@plt>
  test   %r12,%r12
  je     L71
  mov    %r13,(%r12)
L98:
  mov    %rbp,%rdi
  call   <free@plt>
  mov    0x4(%rsp),%eax
  cmp    $0x63,%eax
  jle    L11
  jmp    L55
L71:
  mov    %r13,%rdi
  call   <free@plt>
  jmp    L98
L13:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D6
type_infered: string

tool: D6: %d 

assistant: ```c
int ftp_getrc(int fd, char **data) {
  char *line;
  char *tmp = 0;
  int response;
  while ((line = ftp_readline(fd))) {
    if (line[0] < '0' || line[0] > '9') {
      free(line);
      continue;
    }
    if (line[3] == ' ') {
      tmp = strdup(line);
      enough_mem(tmp);
      break;
    }
    free(line);
  }
  if (!line || !*line)
    return 0;
  sscanf(line, "%d ", &response);
  if (data) {
    *data = tmp;
  } else {
    free(tmp);
  }
  free(line);
  tmp = 0;
  if (response >= 100)
    return response;
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<ftp_getrc>:
  endbr64
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  push   %rbx
  mov    %edi,%ebx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  jmp    L71
  nopl   (%rax)
L84:
  movzbl 0x0(%rbp),%eax
  mov    %rbp,%rdi
  sub    $0x30,%eax
  cmp    $0x9,%al
  ja     L98
  cmpb   $0x20,0x3(%rbp)
  je     L35
L98:
  call   <free@plt>
L71:
  mov    %ebx,%edi
  call   <ftp_readline@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  jne    L84
L14:
  xor    %eax,%eax
L86:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L79
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L35:
  call   <strdup@plt>
  mov    %rax,%rdi
  mov    %rax,%r13
  call   <enough_mem@plt>
  cmpb   $0x0,0x0(%rbp)
  je     L14
  lea    0x4(%rsp),%rdx
  lea    D9(%rip),%rsi
  mov    %rbp,%rdi
  call   <sscanf@plt>
  test   %r12,%r12
  je     L52
  mov    %r13,(%r12)
L5:
  mov    %rbp,%rdi
  call   <free@plt>
  mov    0x4(%rsp),%eax
  cmp    $0x63,%eax
  jle    L14
  jmp    L86
L52:
  mov    %r13,%rdi
  call   <free@plt>
  jmp    L5
L79:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D9
type: string

tool: D9: %d 

assistant: ```c
int ftp_getrc(int fd, char **data) {
  char *line;
  char *tmp = 0;
  int response;
  while ((line = ftp_readline(fd))) {
    if (line[0] < '0' || line[0] > '9') {
      free(line);
      continue;
    }
    if (line[3] == ' ') {
      tmp = strdup(line);
      enough_mem(tmp);
      break;
    }
    free(line);
  }
  if (!line || !*line)
    return 0;
  sscanf(line, "%d ", &response);
  if (data) {
    *data = tmp;
  } else {
    free(tmp);
  }
  free(line);
  tmp = 0;
  if (response >= 100)
    return response;
  return 0;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<bchg_handler>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <ea_alterable_na@plt>
  test   %eax,%eax
  jne    L66
  mov    $0xffffffff,%eax
  jmp    L79
L66:
  mov    -0x4(%rbp),%eax
  and    $0x100,%eax
  test   %eax,%eax
  jne    L49
  mov    -0x4(%rbp),%eax
  sar    $0x9,%eax
  and    $0x7,%eax
  cmp    $0x4,%eax
  je     L49
  mov    $0xffffffff,%eax
  jmp    L79
L49:
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <is_checking@plt>
  test   %rax,%rax
  je     L85
  mov    $0x0,%eax
  jmp    L79
L85:
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <ea_address@plt>
  test   %rax,%rax
  je     L74
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D30(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  jmp    L3
L74:
  lea    D4(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D33(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
L3:
  mov    $0x0,%eax
L79:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D2
datatype: string
name: disassemble_data
arguments: tag: D30
datatype: string
name: disassemble_data
arguments: tag: D4
datatype: string
name: disassemble_data
arguments: tag: D33
datatype: string

tool: D2: 	{
		uint8_t result = EV^(1<<(OP&7));


tool: D30: 		SET_Z_FLAG((result>>(OP&7))&1);


tool: D4: 	{
		uint32_t result = EV^(1<<(OP&31));


tool: D33: 		SET_Z_FLAG((result>>(OP&31))&1);


assistant: ```c
int bchg_handler(int opcode) {
  if (!ea_alterable_na(opcode))
    return -1;
  if ((opcode & 0x100) == 0 && ((opcode >> 9) & 7) != 4)
    return -1;
  if (is_checking(opcode))
    return 0;
  if (ea_address(opcode)) {
    printf("\t{\n\t\tuint8_t result = EV^(1<<(OP&7));\n");
    printf("\t\tSET_Z_FLAG((result>>(OP&7))&1);\n");
  } else {
    printf("\t{\n\t\tuint32_t result = EV^(1<<(OP&31));\n");
    printf("\t\tSET_Z_FLAG((result>>(OP&31))&1);\n");
  }
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<bchg_handler>:
  endbr64
  push   %rbx
  mov    %edi,%ebx
  call   <ea_alterable_na@plt>
  test   %eax,%eax
  je     L2
  test   $0x1,%bh
  jne    L0
  mov    %ebx,%eax
  sar    $0x9,%eax
  and    $0x7,%eax
  cmp    $0x4,%eax
  jne    L64
L0:
  mov    %ebx,%edi
  call   <is_checking@plt>
  mov    %rax,%rdx
  mov    $0x0,%eax
  test   %rdx,%rdx
  je     L60
L65:
  pop    %rbx
  ret
L60:
  mov    %ebx,%edi
  call   <ea_address@plt>
  test   %rax,%rax
  je     L33
  lea    D34(%rip),%rdi
  call   <printf@plt>
  lea    D19(%rip),%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  jmp    L65
L33:
  lea    D36(%rip),%rdi
  call   <printf@plt>
  lea    D0(%rip),%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  jmp    L65
L2:
  mov    $0xffffffff,%eax
  jmp    L65
L64:
  mov    $0xffffffff,%eax
  jmp    L65
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D34
data_type: string
name: extract_symbolic_data
arguments: data_label: D19
data_type: string
name: extract_symbolic_data
arguments: data_label: D36
data_type: string
name: extract_symbolic_data
arguments: data_label: D0
data_type: string

tool: D34: 	{
		uint8_t result = EV^(1<<(OP&7));


tool: D19: 		SET_Z_FLAG((result>>(OP&7))&1);


tool: D36: 	{
		uint32_t result = EV^(1<<(OP&31));


tool: D0: 		SET_Z_FLAG((result>>(OP&31))&1);


assistant: ```c
int bchg_handler(int opcode) {
  if (!ea_alterable_na(opcode))
    return -1;
  if ((opcode & 0x100) == 0 && ((opcode >> 9) & 7) != 4)
    return -1;
  if (is_checking(opcode))
    return 0;
  if (ea_address(opcode)) {
    printf("\t{\n\t\tuint8_t result = EV^(1<<(OP&7));\n");
    printf("\t\tSET_Z_FLAG((result>>(OP&7))&1);\n");
  } else {
    printf("\t{\n\t\tuint32_t result = EV^(1<<(OP&31));\n");
    printf("\t\tSET_Z_FLAG((result>>(OP&31))&1);\n");
  }
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<bchg_handler>:
  endbr64
  push   %r12
  push   %rbp
  mov    %edi,%ebp
  sub    $0x8,%rsp
  call   <ea_alterable_na@plt>
  test   %eax,%eax
  je     L37
  test   $0x100,%ebp
  jne    L42
  mov    %ebp,%eax
  sar    $0x9,%eax
  and    $0x7,%eax
  cmp    $0x4,%eax
  jne    L37
L42:
  mov    %ebp,%edi
  xor    %r12d,%r12d
  call   <is_checking@plt>
  test   %rax,%rax
  je     L52
L0:
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L52:
  mov    %ebp,%edi
  call   <ea_address@plt>
  test   %rax,%rax
  je     L16
  lea    D3(%rip),%rdi
  call   <printf@plt>
  lea    D39(%rip),%rdi
  call   <printf@plt>
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  ret
  nop
L16:
  lea    D8(%rip),%rdi
  call   <printf@plt>
  lea    D1(%rip),%rdi
  call   <printf@plt>
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L37:
  mov    $0xffffffff,%r12d
  jmp    L0
```

tool_calls: name: retrieve_data
arguments: tag: D3
data_type: string
name: retrieve_data
arguments: tag: D39
data_type: string
name: retrieve_data
arguments: tag: D8
data_type: string
name: retrieve_data
arguments: tag: D1
data_type: string

tool: D3: 	{
		uint8_t result = EV^(1<<(OP&7));


tool: D39: 		SET_Z_FLAG((result>>(OP&7))&1);


tool: D8: 	{
		uint32_t result = EV^(1<<(OP&31));


tool: D1: 		SET_Z_FLAG((result>>(OP&31))&1);


assistant: ```c
int bchg_handler(int opcode) {
  if (!ea_alterable_na(opcode))
    return -1;
  if ((opcode & 0x100) == 0 && ((opcode >> 9) & 7) != 4)
    return -1;
  if (is_checking(opcode))
    return 0;
  if (ea_address(opcode)) {
    printf("\t{\n\t\tuint8_t result = EV^(1<<(OP&7));\n");
    printf("\t\tSET_Z_FLAG((result>>(OP&7))&1);\n");
  } else {
    printf("\t{\n\t\tuint32_t result = EV^(1<<(OP&31));\n");
    printf("\t\tSET_Z_FLAG((result>>(OP&31))&1);\n");
  }
  return 0;
}
```
user: Translate the below assembly code into C programming language:

```asm
<bchg_handler>:
  endbr64
  push   %r12
  push   %rbp
  mov    %edi,%ebp
  sub    $0x8,%rsp
  call   <ea_alterable_na@plt>
  test   %eax,%eax
  je     L58
  test   $0x100,%ebp
  jne    L34
  mov    %ebp,%eax
  sar    $0x9,%eax
  and    $0x7,%eax
  cmp    $0x4,%eax
  jne    L58
L34:
  mov    %ebp,%edi
  xor    %r12d,%r12d
  call   <is_checking@plt>
  test   %rax,%rax
  je     L42
L39:
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L42:
  mov    %ebp,%edi
  call   <ea_address@plt>
  test   %rax,%rax
  je     L53
  lea    D25(%rip),%rdi
  call   <printf@plt>
  lea    D9(%rip),%rdi
  call   <printf@plt>
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  ret
  nop
L53:
  lea    D13(%rip),%rdi
  call   <printf@plt>
  lea    D30(%rip),%rdi
  call   <printf@plt>
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L58:
  mov    $0xffffffff,%r12d
  jmp    L39
```

tool_calls: name: extract_symbolic_data
arguments: label: D25
type: string
name: extract_symbolic_data
arguments: label: D9
type: string
name: extract_symbolic_data
arguments: label: D13
type: string
name: extract_symbolic_data
arguments: label: D30
type: string

tool: D25: 	{
		uint8_t result = EV^(1<<(OP&7));


tool: D9: 		SET_Z_FLAG((result>>(OP&7))&1);


tool: D13: 	{
		uint32_t result = EV^(1<<(OP&31));


tool: D30: 		SET_Z_FLAG((result>>(OP&31))&1);


assistant: ```c
int bchg_handler(int opcode) {
  if (!ea_alterable_na(opcode))
    return -1;
  if ((opcode & 0x100) == 0 && ((opcode >> 9) & 7) != 4)
    return -1;
  if (is_checking(opcode))
    return 0;
  if (ea_address(opcode)) {
    printf("\t{\n\t\tuint8_t result = EV^(1<<(OP&7));\n");
    printf("\t\tSET_Z_FLAG((result>>(OP&7))&1);\n");
  } else {
    printf("\t{\n\t\tuint32_t result = EV^(1<<(OP&31));\n");
    printf("\t\tSET_Z_FLAG((result>>(OP&31))&1);\n");
  }
  return 0;
}
```