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

```asm
<ifa_make_sockaddr_mask>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rsi,%rbp
  test   %rsi,%rsi
  je     L19
  mov    %edi,%r12d
  mov    %edx,%r13d
  cmp    $0x80,%edi
  je     L38
  mov    $0x0,%eax
  cmp    $0x81,%edi
  jne    L55
  mov    %rsi,%rbx
  mov    $0x4,%edx
  mov    $0x0,%esi
  mov    %rbp,%rdi
  call   <memset@plt>
  mov    $0x20,%edx
L32:
  mov    %r12d,0x0(%rbp)
  cmp    %r13d,%edx
  cmovg  %r13d,%edx
  lea    0x7(%rdx),%eax
  test   %edx,%edx
  cmovns %edx,%eax
  sar    $0x3,%eax
  je     L10
  lea    -0x1(%rax),%eax
  lea    0x1(%rbx,%rax,1),%rax
L46:
  add    $0x1,%rbx
  movb   $0xff,-0x1(%rbx)
  cmp    %rax,%rbx
  jne    L46
L47:
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  shr    $0x1d,%ecx
  add    %ecx,%edx
  and    $0x7,%edx
  sub    %edx,%ecx
  lea    0x8(%rcx),%ecx
  mov    $0xffffffff,%edx
  shl    %cl,%edx
  mov    %dl,(%rax)
  mov    %rbp,%rax
L55:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L38:
  mov    %rsi,%rbx
  mov    $0x4,%edx
  mov    $0x0,%esi
  mov    %rbp,%rdi
  call   <memset@plt>
  mov    %r12d,%edx
  jmp    L32
L10:
  mov    %rbx,%rax
  jmp    L47
L19:
  mov    %rsi,%rax
  jmp    L55
```

assistant: ```c
struct sockaddr *ifa_make_sockaddr_mask(sa_family_t family, struct sockaddr *sa, uint32_t prefixlen) {
  unsigned i;
  char *p = NULL, c;
  uint32_t max_prefixlen = 0;
  if (sa == NULL)
    return NULL;
  switch (family) {
  case AF_INET:
    memset(&((struct sockaddr_in *)sa)->sin_addr, 0, sizeof(((struct sockaddr_in *)sa)->sin_addr));
    p = (char *)&((struct sockaddr_in *)sa)->sin_addr;
    max_prefixlen = 32;
    break;
  case AF_INET6:
    memset(&((struct sockaddr_in6 *)sa)->sin6_addr, 0, sizeof(((struct sockaddr_in6 *)sa)->sin6_addr));
    p = (char *)&((struct sockaddr_in6 *)sa)->sin6_addr;
    max_prefixlen = 128;
    break;
  default:
    return NULL;
  }
  sa->sa_family = family;
  if (p) {
    if (prefixlen > max_prefixlen)
      prefixlen = max_prefixlen;
    for (i = 0; i < (prefixlen / 8); i++)
      *p++ = 0xff;
    c = 0xff;
    c <<= (8 - (prefixlen % 8));
    *p = c;
  }
  return sa;
}
```
user: Translate the below assembly code into C programming language:

```asm
<ifa_make_sockaddr_mask>:
  endbr64
  test   %rsi,%rsi
  je     L48
  push   %r14
  mov    %edx,%r14d
  push   %r13
  push   %r12
  mov    %edi,%r12d
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  cmp    $0x80,%edi
  je     L4
  xor    %eax,%eax
  cmp    $0x81,%edi
  jne    L36
  mov    %rsi,%r13
  mov    $0x4,%edx
  xor    %esi,%esi
  mov    %rbp,%rdi
  call   <memset@plt>
  mov    $0x20,%ebx
L16:
  cmp    %r14d,%ebx
  mov    %r12d,0x0(%rbp)
  cmovg  %r14d,%ebx
  test   %ebx,%ebx
  lea    0x7(%rbx),%eax
  cmovns %ebx,%eax
  sar    $0x3,%eax
  je     L43
  mov    %eax,%r13d
  mov    $0xff,%esi
  mov    %rbp,%rdi
  mov    %r13,%rdx
  add    %rbp,%r13
  call   <memset@plt>
L43:
  mov    %ebx,%eax
  sar    $0x1f,%eax
  shr    $0x1d,%eax
  add    %eax,%ebx
  and    $0x7,%ebx
  sub    %ebx,%eax
  lea    0x8(%rax),%ecx
  mov    $0xffffffff,%eax
  shl    %cl,%eax
  mov    %al,0x0(%r13)
  mov    %rbp,%rax
L36:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  xchg   %ax,%ax
L4:
  mov    %rsi,%r13
  mov    $0x4,%edx
  xor    %esi,%esi
  mov    %rbp,%rdi
  call   <memset@plt>
  mov    $0x80,%ebx
  jmp    L16
  nopl   0x0(%rax)
L48:
  xor    %eax,%eax
  ret
```

assistant: ```c
struct sockaddr *ifa_make_sockaddr_mask(sa_family_t family, struct sockaddr *sa, uint32_t prefixlen) {
  unsigned i;
  char *p = NULL, c;
  uint32_t max_prefixlen = 0;
  if (sa == NULL)
    return NULL;
  switch (family) {
  case AF_INET:
    memset(&((struct sockaddr_in *)sa)->sin_addr, 0, sizeof(((struct sockaddr_in *)sa)->sin_addr));
    p = (char *)&((struct sockaddr_in *)sa)->sin_addr;
    max_prefixlen = 32;
    break;
  case AF_INET6:
    memset(&((struct sockaddr_in6 *)sa)->sin6_addr, 0, sizeof(((struct sockaddr_in6 *)sa)->sin6_addr));
    p = (char *)&((struct sockaddr_in6 *)sa)->sin6_addr;
    max_prefixlen = 128;
    break;
  default:
    return NULL;
  }
  sa->sa_family = family;
  if (p) {
    if (prefixlen > max_prefixlen)
      prefixlen = max_prefixlen;
    for (i = 0; i < (prefixlen / 8); i++)
      *p++ = 0xff;
    c = 0xff;
    c <<= (8 - (prefixlen % 8));
    *p = c;
  }
  return sa;
}
```
user: Translate the below assembly code into C programming language:

```asm
<ifa_make_sockaddr_mask>:
  endbr64
  test   %rsi,%rsi
  je     L37
  push   %r14
  mov    %edx,%r14d
  push   %r13
  push   %r12
  mov    %edi,%r12d
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  cmp    $0x80,%edi
  je     L17
  xor    %eax,%eax
  cmp    $0x81,%edi
  jne    L38
  mov    %rsi,%r13
  mov    $0x4,%edx
  xor    %esi,%esi
  mov    %rbp,%rdi
  call   <memset@plt>
  mov    $0x20,%ebx
L16:
  cmp    %r14d,%ebx
  mov    %r12d,0x0(%rbp)
  cmovg  %r14d,%ebx
  test   %ebx,%ebx
  lea    0x7(%rbx),%eax
  cmovns %ebx,%eax
  sar    $0x3,%eax
  je     L9
  mov    %eax,%r13d
  mov    $0xff,%esi
  mov    %rbp,%rdi
  mov    %r13,%rdx
  add    %rbp,%r13
  call   <memset@plt>
L9:
  mov    %ebx,%eax
  sar    $0x1f,%eax
  shr    $0x1d,%eax
  add    %eax,%ebx
  and    $0x7,%ebx
  sub    %ebx,%eax
  lea    0x8(%rax),%ecx
  mov    $0xffffffff,%eax
  shl    %cl,%eax
  mov    %al,0x0(%r13)
  mov    %rbp,%rax
L38:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  xchg   %ax,%ax
L17:
  mov    %rsi,%r13
  mov    $0x4,%edx
  xor    %esi,%esi
  mov    %rbp,%rdi
  call   <memset@plt>
  mov    $0x80,%ebx
  jmp    L16
  nopl   0x0(%rax)
L37:
  xor    %eax,%eax
  ret
```

assistant: ```c
struct sockaddr *ifa_make_sockaddr_mask(sa_family_t family, struct sockaddr *sa, uint32_t prefixlen) {
  unsigned i;
  char *p = NULL, c;
  uint32_t max_prefixlen = 0;
  if (sa == NULL)
    return NULL;
  switch (family) {
  case AF_INET:
    memset(&((struct sockaddr_in *)sa)->sin_addr, 0, sizeof(((struct sockaddr_in *)sa)->sin_addr));
    p = (char *)&((struct sockaddr_in *)sa)->sin_addr;
    max_prefixlen = 32;
    break;
  case AF_INET6:
    memset(&((struct sockaddr_in6 *)sa)->sin6_addr, 0, sizeof(((struct sockaddr_in6 *)sa)->sin6_addr));
    p = (char *)&((struct sockaddr_in6 *)sa)->sin6_addr;
    max_prefixlen = 128;
    break;
  default:
    return NULL;
  }
  sa->sa_family = family;
  if (p) {
    if (prefixlen > max_prefixlen)
      prefixlen = max_prefixlen;
    for (i = 0; i < (prefixlen / 8); i++)
      *p++ = 0xff;
    c = 0xff;
    c <<= (8 - (prefixlen % 8));
    *p = c;
  }
  return sa;
}
```
user: What is the c source code of the assembly code below?

```asm
<f>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %esi,-0xc(%rbp)
  mov    -0xc(%rbp),%edx
  mov    -0x8(%rbp),%rax
  mov    %rax,%rsi
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    -0xc(%rbp),%eax
  imul   %eax,%eax
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  leave
  ret
```

tool_calls: name: read_data
arguments: data_label: D2
type: string

tool: D2: str is: %s
n is: %d


assistant: ```c
float f(char *str, int n) {
  printf("str is: %s\nn is: %d\n", str, n);
  return n * n;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<f>:
  endbr64
  push   %rbx
  mov    %esi,%ebx
  mov    %esi,%edx
  mov    %rdi,%rsi
  lea    D7(%rip),%rdi
  call   <printf@plt>
  imul   %ebx,%ebx
  pxor   %xmm0,%xmm0
  cvtsi2ss %ebx,%xmm0
  pop    %rbx
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D7
type_guessed: string

tool: D7: str is: %s
n is: %d


assistant: ```c
float f(char *str, int n) {
  printf("str is: %s\nn is: %d\n", str, n);
  return n * n;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<f>:
  endbr64
  push   %rbx
  mov    %esi,%ebx
  mov    %esi,%edx
  mov    %rdi,%rsi
  imul   %ebx,%ebx
  lea    D5(%rip),%rdi
  call   <printf@plt>
  pxor   %xmm0,%xmm0
  cvtsi2ss %ebx,%xmm0
  pop    %rbx
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D5
data_type: string

tool: D5: str is: %s
n is: %d


assistant: ```c
float f(char *str, int n) {
  printf("str is: %s\nn is: %d\n", str, n);
  return n * n;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<f>:
  endbr64
  push   %rbx
  mov    %esi,%ebx
  mov    %esi,%edx
  mov    %rdi,%rsi
  imul   %ebx,%ebx
  lea    D3(%rip),%rdi
  call   <printf@plt>
  pxor   %xmm0,%xmm0
  cvtsi2ss %ebx,%xmm0
  pop    %rbx
  ret
```

tool_calls: name: parse_data
arguments: data_label: D3
type: string

tool: D3: str is: %s
n is: %d


assistant: ```c
float f(char *str, int n) {
  printf("str is: %s\nn is: %d\n", str, n);
  return n * n;
}
```
user: What is the c source code of the assembly code below?

```asm
<AMI_SelfTest>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  movl   $0x0,-0x4(%rbp)
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  call   <AMI_LOG@plt>
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <checkOTP@plt>
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  je     L59
  mov    -0x4(%rbp),%eax
  jmp    L21
L59:
  lea    D30(%rip),%rax
  mov    %rax,%rdi
  call   <AMI_LOG@plt>
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <checkTempSensor@plt>
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  je     L25
  mov    -0x4(%rbp),%eax
  jmp    L21
L25:
  lea    D28(%rip),%rax
  mov    %rax,%rdi
  call   <AMI_LOG@plt>
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <checkMIElement1@plt>
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  je     L84
  mov    -0x4(%rbp),%eax
  jmp    L21
L84:
  lea    D18(%rip),%rax
  mov    %rax,%rdi
  call   <AMI_LOG@plt>
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <checkMIElement2@plt>
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  je     L82
  mov    -0x4(%rbp),%eax
  jmp    L21
L82:
  lea    D47(%rip),%rax
  mov    %rax,%rdi
  call   <AMI_LOG@plt>
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <checkDigitalCircuit@plt>
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  je     L97
  mov    -0x4(%rbp),%eax
  jmp    L21
L97:
  mov    $0x0,%eax
L21:
  leave
  ret
```

tool_calls: name: read_data
arguments: label: D2
data_type: string
name: read_data
arguments: label: D30
data_type: string
name: read_data
arguments: label: D28
data_type: string
name: read_data
arguments: label: D18
data_type: string
name: read_data
arguments: label: D47
data_type: string

tool: D2: ----- OTP Check -----

tool: D30: -----TEMP Check -----

tool: D28: ----- MI Element Check 1 -----

tool: D18: ----- MI Element Check 2 -----

tool: D47: ----- Digital Circuit Check -----

assistant: ```c
int AMI_SelfTest(void *i2c_hnd) {
  int ret = 0;
  AMI_LOG("----- OTP Check -----");
  ret = checkOTP(i2c_hnd);
  if (ret != 0)
    return ret;
  AMI_LOG("-----TEMP Check -----");
  ret = checkTempSensor(i2c_hnd);
  if (ret != 0)
    return ret;
  AMI_LOG("----- MI Element Check 1 -----");
  ret = checkMIElement1(i2c_hnd);
  if (ret != 0)
    return ret;
  AMI_LOG("----- MI Element Check 2 -----");
  ret = checkMIElement2(i2c_hnd);
  if (ret != 0)
    return ret;
  AMI_LOG("----- Digital Circuit Check -----");
  ret = checkDigitalCircuit(i2c_hnd);
  if (ret != 0)
    return ret;
  return 0;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<AMI_SelfTest>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  lea    D6(%rip),%rdi
  call   <AMI_LOG@plt>
  mov    %rbx,%rdi
  call   <checkOTP@plt>
  test   %eax,%eax
  je     L5
L9:
  pop    %rbx
  ret
L5:
  lea    D13(%rip),%rdi
  call   <AMI_LOG@plt>
  mov    %rbx,%rdi
  call   <checkTempSensor@plt>
  test   %eax,%eax
  jne    L9
  lea    D30(%rip),%rdi
  call   <AMI_LOG@plt>
  mov    %rbx,%rdi
  call   <checkMIElement1@plt>
  test   %eax,%eax
  jne    L9
  lea    D39(%rip),%rdi
  call   <AMI_LOG@plt>
  mov    %rbx,%rdi
  call   <checkMIElement2@plt>
  test   %eax,%eax
  jne    L9
  lea    D16(%rip),%rdi
  call   <AMI_LOG@plt>
  mov    %rbx,%rdi
  call   <checkDigitalCircuit@plt>
  jmp    L9
```

tool_calls: name: read_data
arguments: data_label: D6
data_type: string
name: read_data
arguments: data_label: D13
data_type: string
name: read_data
arguments: data_label: D30
data_type: string
name: read_data
arguments: data_label: D39
data_type: string
name: read_data
arguments: data_label: D16
data_type: string

tool: D6: ----- OTP Check -----

tool: D13: -----TEMP Check -----

tool: D30: ----- MI Element Check 1 -----

tool: D39: ----- MI Element Check 2 -----

tool: D16: ----- Digital Circuit Check -----

assistant: ```c
int AMI_SelfTest(void *i2c_hnd) {
  int ret = 0;
  AMI_LOG("----- OTP Check -----");
  ret = checkOTP(i2c_hnd);
  if (ret != 0)
    return ret;
  AMI_LOG("-----TEMP Check -----");
  ret = checkTempSensor(i2c_hnd);
  if (ret != 0)
    return ret;
  AMI_LOG("----- MI Element Check 1 -----");
  ret = checkMIElement1(i2c_hnd);
  if (ret != 0)
    return ret;
  AMI_LOG("----- MI Element Check 2 -----");
  ret = checkMIElement2(i2c_hnd);
  if (ret != 0)
    return ret;
  AMI_LOG("----- Digital Circuit Check -----");
  ret = checkDigitalCircuit(i2c_hnd);
  if (ret != 0)
    return ret;
  return 0;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<AMI_SelfTest>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  lea    D9(%rip),%rdi
  call   <AMI_LOG@plt>
  mov    %rbp,%rdi
  call   <checkOTP@plt>
  test   %eax,%eax
  je     L14
L26:
  pop    %rbp
  ret
  nopw   0x0(%rax,%rax,1)
L14:
  lea    D4(%rip),%rdi
  call   <AMI_LOG@plt>
  mov    %rbp,%rdi
  call   <checkTempSensor@plt>
  test   %eax,%eax
  jne    L26
  lea    D23(%rip),%rdi
  call   <AMI_LOG@plt>
  mov    %rbp,%rdi
  call   <checkMIElement1@plt>
  test   %eax,%eax
  jne    L26
  lea    D34(%rip),%rdi
  call   <AMI_LOG@plt>
  mov    %rbp,%rdi
  call   <checkMIElement2@plt>
  test   %eax,%eax
  jne    L26
  lea    D0(%rip),%rdi
  call   <AMI_LOG@plt>
  mov    %rbp,%rdi
  pop    %rbp
  jmp    10a0 <checkDigitalCircuit@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D9
data_type: string
name: extract_symbolic_data
arguments: tag: D4
data_type: string
name: extract_symbolic_data
arguments: tag: D23
data_type: string
name: extract_symbolic_data
arguments: tag: D34
data_type: string
name: extract_symbolic_data
arguments: tag: D0
data_type: string

tool: D9: ----- OTP Check -----

tool: D4: -----TEMP Check -----

tool: D23: ----- MI Element Check 1 -----

tool: D34: ----- MI Element Check 2 -----

tool: D0: ----- Digital Circuit Check -----

assistant: ```c
int AMI_SelfTest(void *i2c_hnd) {
  int ret = 0;
  AMI_LOG("----- OTP Check -----");
  ret = checkOTP(i2c_hnd);
  if (ret != 0)
    return ret;
  AMI_LOG("-----TEMP Check -----");
  ret = checkTempSensor(i2c_hnd);
  if (ret != 0)
    return ret;
  AMI_LOG("----- MI Element Check 1 -----");
  ret = checkMIElement1(i2c_hnd);
  if (ret != 0)
    return ret;
  AMI_LOG("----- MI Element Check 2 -----");
  ret = checkMIElement2(i2c_hnd);
  if (ret != 0)
    return ret;
  AMI_LOG("----- Digital Circuit Check -----");
  ret = checkDigitalCircuit(i2c_hnd);
  if (ret != 0)
    return ret;
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<AMI_SelfTest>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  lea    D20(%rip),%rdi
  call   <AMI_LOG@plt>
  mov    %rbp,%rdi
  call   <checkOTP@plt>
  test   %eax,%eax
  je     L15
L25:
  pop    %rbp
  ret
  nopw   0x0(%rax,%rax,1)
L15:
  lea    D4(%rip),%rdi
  call   <AMI_LOG@plt>
  mov    %rbp,%rdi
  call   <checkTempSensor@plt>
  test   %eax,%eax
  jne    L25
  lea    D39(%rip),%rdi
  call   <AMI_LOG@plt>
  mov    %rbp,%rdi
  call   <checkMIElement1@plt>
  test   %eax,%eax
  jne    L25
  lea    D2(%rip),%rdi
  call   <AMI_LOG@plt>
  mov    %rbp,%rdi
  call   <checkMIElement2@plt>
  test   %eax,%eax
  jne    L25
  lea    D1(%rip),%rdi
  call   <AMI_LOG@plt>
  mov    %rbp,%rdi
  pop    %rbp
  jmp    10a0 <checkDigitalCircuit@plt>
```

tool_calls: name: unpack_data
arguments: tag: D20
datatype: string
name: unpack_data
arguments: tag: D4
datatype: string
name: unpack_data
arguments: tag: D39
datatype: string
name: unpack_data
arguments: tag: D2
datatype: string
name: unpack_data
arguments: tag: D1
datatype: string

tool: D20: ----- OTP Check -----

tool: D4: -----TEMP Check -----

tool: D39: ----- MI Element Check 1 -----

tool: D2: ----- MI Element Check 2 -----

tool: D1: ----- Digital Circuit Check -----

assistant: ```c
int AMI_SelfTest(void *i2c_hnd) {
  int ret = 0;
  AMI_LOG("----- OTP Check -----");
  ret = checkOTP(i2c_hnd);
  if (ret != 0)
    return ret;
  AMI_LOG("-----TEMP Check -----");
  ret = checkTempSensor(i2c_hnd);
  if (ret != 0)
    return ret;
  AMI_LOG("----- MI Element Check 1 -----");
  ret = checkMIElement1(i2c_hnd);
  if (ret != 0)
    return ret;
  AMI_LOG("----- MI Element Check 2 -----");
  ret = checkMIElement2(i2c_hnd);
  if (ret != 0)
    return ret;
  AMI_LOG("----- Digital Circuit Check -----");
  ret = checkDigitalCircuit(i2c_hnd);
  if (ret != 0)
    return ret;
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<safe_copy_esccode>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    %rdx,-0x18(%rbp)
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    -0x18(%rbp),%rdx
  mov    -0x10(%rbp),%rsi
  mov    $0x1fff,%ecx
  mov    %eax,%edi
  call   <safe_copy_chr@plt>
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rdx
  mov    -0x8(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  cmp    $0x5b,%al
  jne    L46
L13:
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    -0x18(%rbp),%rdx
  mov    -0x10(%rbp),%rsi
  mov    $0x1fff,%ecx
  mov    %eax,%edi
  call   <safe_copy_chr@plt>
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rdx
  mov    -0x8(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  and    $0xf0,%eax
  cmp    $0x30,%eax
  je     L13
  jmp    L46
L34:
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    -0x18(%rbp),%rdx
  mov    -0x10(%rbp),%rsi
  mov    $0x1fff,%ecx
  mov    %eax,%edi
  call   <safe_copy_chr@plt>
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rdx
  mov    -0x8(%rbp),%rax
  mov    %rdx,(%rax)
L46:
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  and    $0xf0,%eax
  cmp    $0x20,%eax
  je     L34
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L11
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    -0x18(%rbp),%rdx
  mov    -0x10(%rbp),%rsi
  mov    $0x1fff,%ecx
  mov    %eax,%edi
  call   <safe_copy_chr@plt>
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rdx
  mov    -0x8(%rbp),%rax
  mov    %rdx,(%rax)
L11:
  nop
  leave
  ret
```

assistant: ```c
void safe_copy_esccode(char **s, char *buff, char **bufc) {
  safe_copy_chr((**s), (buff), (bufc), (8192 - 1));
  ++(*s);
  if (**s == '[') {
    do {
      safe_copy_chr((**s), (buff), (bufc), (8192 - 1));
      ++(*s);
    } while ((**s & 0xf0) == 0x30);
  }
  while ((**s & 0xf0) == 0x20) {
    safe_copy_chr((**s), (buff), (bufc), (8192 - 1));
    ++(*s);
  }
  if (**s) {
    safe_copy_chr((**s), (buff), (bufc), (8192 - 1));
    ++(*s);
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<safe_copy_esccode>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    %rsi,%rbp
  mov    %rdx,%r12
  mov    (%rdi),%rax
  movsbl (%rax),%edi
  mov    $0x1fff,%ecx
  call   <safe_copy_chr@plt>
  mov    (%rbx),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,(%rbx)
  cmpb   $0x5b,0x1(%rax)
  je     L30
L27:
  mov    (%rbx),%rax
  movzbl (%rax),%eax
  movsbl %al,%edi
  mov    %eax,%edx
  and    $0xf0,%edx
  cmp    $0x20,%edx
  jne    L65
L29:
  mov    $0x1fff,%ecx
  mov    %r12,%rdx
  mov    %rbp,%rsi
  call   <safe_copy_chr@plt>
  mov    (%rbx),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,(%rbx)
  movzbl 0x1(%rax),%eax
  movsbl %al,%edi
  mov    %eax,%edx
  and    $0xf0,%edx
  cmp    $0x20,%edx
  je     L29
L65:
  test   %al,%al
  jne    L19
L47:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L30:
  mov    (%rbx),%rax
  movsbl (%rax),%edi
  mov    $0x1fff,%ecx
  mov    %r12,%rdx
  mov    %rbp,%rsi
  call   <safe_copy_chr@plt>
  mov    (%rbx),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,(%rbx)
  movsbl 0x1(%rax),%eax
  and    $0xf0,%eax
  cmp    $0x30,%eax
  je     L30
  jmp    L27
L19:
  mov    $0x1fff,%ecx
  mov    %r12,%rdx
  mov    %rbp,%rsi
  call   <safe_copy_chr@plt>
  addq   $0x1,(%rbx)
  jmp    L47
```

assistant: ```c
void safe_copy_esccode(char **s, char *buff, char **bufc) {
  safe_copy_chr((**s), (buff), (bufc), (8192 - 1));
  ++(*s);
  if (**s == '[') {
    do {
      safe_copy_chr((**s), (buff), (bufc), (8192 - 1));
      ++(*s);
    } while ((**s & 0xf0) == 0x30);
  }
  while ((**s & 0xf0) == 0x20) {
    safe_copy_chr((**s), (buff), (bufc), (8192 - 1));
    ++(*s);
  }
  if (**s) {
    safe_copy_chr((**s), (buff), (bufc), (8192 - 1));
    ++(*s);
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<safe_copy_esccode>:
  endbr64
  push   %r12
  mov    $0x1fff,%ecx
  mov    %rdx,%r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    (%rdi),%rax
  mov    %rdi,%rbx
  movsbl (%rax),%edi
  call   <safe_copy_chr@plt>
  mov    (%rbx),%rax
  mov    $0x5b,%r8d
  lea    0x1(%rax),%rdx
  mov    %rdx,(%rbx)
  movzbl 0x1(%rax),%eax
  cmp    $0x5b,%al
  je     L21
  mov    %eax,%edx
  movsbl %al,%edi
  and    $0xf0,%edx
  jmp    L47
  cs nopw 0x0(%rax,%rax,1)
L54:
  mov    %r12,%rdx
  mov    $0x1fff,%ecx
  mov    %rbp,%rsi
  call   <safe_copy_chr@plt>
  mov    (%rbx),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,(%rbx)
  movsbl 0x1(%rax),%edi
  mov    %edi,%edx
  mov    %edi,%eax
  and    $0xf0,%edx
L47:
  cmp    $0x20,%edx
  je     L54
  test   %al,%al
  jne    L57
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  cs nopw 0x0(%rax,%rax,1)
L21:
  mov    %r8d,%edi
  mov    %r12,%rdx
  mov    $0x1fff,%ecx
  mov    %rbp,%rsi
  call   <safe_copy_chr@plt>
  mov    (%rbx),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,(%rbx)
  movsbl 0x1(%rax),%r8d
  mov    %r8d,%edx
  mov    %r8d,%eax
  mov    %r8d,%edi
  and    $0xf0,%edx
  cmp    $0x30,%edx
  je     L21
  jmp    L47
  nopl   0x0(%rax,%rax,1)
L57:
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    $0x1fff,%ecx
  call   <safe_copy_chr@plt>
  addq   $0x1,(%rbx)
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void safe_copy_esccode(char **s, char *buff, char **bufc) {
  safe_copy_chr((**s), (buff), (bufc), (8192 - 1));
  ++(*s);
  if (**s == '[') {
    do {
      safe_copy_chr((**s), (buff), (bufc), (8192 - 1));
      ++(*s);
    } while ((**s & 0xf0) == 0x30);
  }
  while ((**s & 0xf0) == 0x20) {
    safe_copy_chr((**s), (buff), (bufc), (8192 - 1));
    ++(*s);
  }
  if (**s) {
    safe_copy_chr((**s), (buff), (bufc), (8192 - 1));
    ++(*s);
  }
}
```