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

```asm
<qecvt_mp>:
  endbr64
  push   %r13
  mov    %rsi,%r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  mov    %rcx,%rbx
  sub    $0x8,%rsp
  cmp    $0x22,%edi
  jg     L29
  test   %edi,%edi
  jle    L17
  push   0x38(%rsp)
  xor    %edx,%edx
  mov    %edi,%esi
  mov    %rcx,%rdi
  push   0x38(%rsp)
  call   <_qtoa@plt>
  add    $0x1,%eax
  mov    %eax,0x0(%r13)
  pop    %rax
  pop    %rdx
L34:
  xor    %eax,%eax
  cmpb   $0x2d,(%rbx)
  sete   %al
  mov    %eax,(%r12)
  add    $0x8,%rsp
  lea    0x1(%rbx),%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopw   0x0(%rax,%rax,1)
L17:
  push   0x38(%rsp)
  mov    $0x1,%esi
  mov    %rcx,%rdi
  xor    %edx,%edx
  push   0x38(%rsp)
  call   <_qtoa@plt>
  pop    %rcx
  pop    %rsi
  add    $0x1,%eax
  mov    %eax,0x0(%r13)
  movb   $0x0,0x1(%rbx)
  jmp    L34
  cs nopw 0x0(%rax,%rax,1)
L29:
  push   0x38(%rsp)
  xor    %edx,%edx
  mov    %rcx,%rdi
  mov    $0x22,%esi
  push   0x38(%rsp)
  call   <_qtoa@plt>
  mov    $0x53,%edx
  lea    0x23(%rbx),%rcx
  pop    %rdi
  add    $0x1,%eax
  cmp    $0x53,%ebp
  pop    %r8
  mov    %eax,0x0(%r13)
  lea    0x1(%rbp),%eax
  cltq
  cmovge %rdx,%rax
  add    %rbx,%rax
  cmp    %rax,%rcx
  je     L13
  sub    %rbx,%rax
  mov    $0x30,%esi
  mov    %rcx,%rdi
  lea    -0x23(%rax),%rbp
  mov    %rbp,%rdx
  call   <memset@plt>
  lea    (%rax,%rbp,1),%rax
L13:
  movb   $0x0,(%rax)
  jmp    L34
```

assistant: ```c
char *qecvt_mp(long double arg, int ndigits, int *decpt, int *sign, char *buffer) {
  if (ndigits > 34) {
    register char *p, *e;
    *decpt = _qtoa(buffer, 34, arg, 0) + 1;
    for (p = buffer + 35, e = buffer + 1 + (ndigits > 82 ? 82 : ndigits); p != e;)
      *p++ = '0';
    *p++ = '\0';
  } else if (ndigits <= 0) {
    *decpt = _qtoa(buffer, 1, arg, 0) + 1;
    buffer[1] = '\0';
  } else {
    *decpt = _qtoa(buffer, ndigits, arg, 0) + 1;
  }
  *sign = buffer[0] == '-';
  return buffer + 1;
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<eng_to_dec>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movabs $0x51553b415665525f,%rax
  mov    %rax,-0x13(%rbp)
  movw   $0x4b39,-0xb(%rbp)
  movb   $0x0,-0x9(%rbp)
  movl   $0x0,-0x18(%rbp)
  jmp    L10
L27:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  lea    (%rax,%rax,1),%edx
  mov    -0x28(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  add    %edx,%eax
  lea    -0xfa(%rax),%edx
  mov    -0x18(%rbp),%eax
  cltq
  movzbl -0x13(%rbp,%rax,1),%eax
  movsbl %al,%eax
  cmp    %eax,%edx
  jne    L24
  mov    -0x18(%rbp),%eax
  jmp    L43
L24:
  addl   $0x1,-0x18(%rbp)
L10:
  cmpl   $0x9,-0x18(%rbp)
  jle    L27
L43:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L36
  call   <__stack_chk_fail@plt>
L36:
  leave
  ret
```

assistant: ```c
int eng_to_dec(char *digit) {
  char decode[] = "_ReVA;UQ9K";
  for (int i = 0; i < 10; i++) {
    if ((*digit * 2 + *(digit + 1) - 250) == decode[i]) {
      return i;
    }
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<eng_to_dec>:
  endbr64
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  movabs $0x51553b415665525f,%rax
  mov    %rax,0xd(%rsp)
  movw   $0x4b39,0x15(%rsp)
  movb   $0x0,0x17(%rsp)
  movsbl (%rdi),%edx
  movsbl 0x1(%rdi),%eax
  lea    -0xfa(%rax,%rdx,2),%edi
  mov    $0x0,%eax
  lea    0xd(%rsp),%rsi
L17:
  mov    %eax,%ecx
  movsbl (%rax,%rsi,1),%edx
  cmp    %edx,%edi
  je     L1
  add    $0x1,%rax
  cmp    $0xa,%rax
  jne    L17
L1:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L10
  mov    %ecx,%eax
  add    $0x28,%rsp
  ret
L10:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int eng_to_dec(char *digit) {
  char decode[] = "_ReVA;UQ9K";
  for (int i = 0; i < 10; i++) {
    if ((*digit * 2 + *(digit + 1) - 250) == decode[i]) {
      return i;
    }
  }
}
```
user: What is the c source code of the assembly code below?

```asm
<eng_to_dec>:
  endbr64
  sub    $0x28,%rsp
  movsbl (%rdi),%edx
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  movabs $0x51553b415665525f,%rax
  movb   $0x0,0x17(%rsp)
  mov    %rax,0xd(%rsp)
  mov    $0x4b39,%eax
  mov    %ax,0x15(%rsp)
  movsbl 0x1(%rdi),%eax
  lea    -0xfa(%rax,%rdx,2),%ecx
  xor    %eax,%eax
  mov    $0x5f,%edx
  jmp    L29
  nopl   0x0(%rax,%rax,1)
L4:
  movsbl 0xd(%rsp,%rax,1),%edx
L29:
  mov    %eax,%r8d
  cmp    %edx,%ecx
  je     L37
  add    $0x1,%rax
  cmp    $0xa,%rax
  jne    L4
L37:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L20
  mov    %r8d,%eax
  add    $0x28,%rsp
  ret
L20:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int eng_to_dec(char *digit) {
  char decode[] = "_ReVA;UQ9K";
  for (int i = 0; i < 10; i++) {
    if ((*digit * 2 + *(digit + 1) - 250) == decode[i]) {
      return i;
    }
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<eng_to_dec>:
  endbr64
  movsbl (%rdi),%edx
  movsbl 0x1(%rdi),%eax
  lea    -0xfa(%rax,%rdx,2),%eax
  cmp    $0x5f,%eax
  je     L84
  cmp    $0x52,%eax
  je     L92
  cmp    $0x65,%eax
  je     L5
  cmp    $0x56,%eax
  je     L30
  cmp    $0x41,%eax
  je     L29
  cmp    $0x3b,%eax
  je     L53
  cmp    $0x55,%eax
  je     L23
  cmp    $0x51,%eax
  je     L66
  cmp    $0x39,%eax
  je     L42
  cmp    $0x4b,%eax
  je     L13
  ret
L84:
  xor    %eax,%eax
  ret
L92:
  mov    $0x1,%eax
  ret
L5:
  mov    $0x2,%eax
  ret
L30:
  mov    $0x3,%eax
  ret
L29:
  mov    $0x4,%eax
  ret
L53:
  mov    $0x5,%eax
  ret
L23:
  mov    $0x6,%eax
  ret
L66:
  mov    $0x7,%eax
  ret
L42:
  mov    $0x8,%eax
  ret
L13:
  mov    $0x9,%eax
  ret
```

assistant: ```c
int eng_to_dec(char *digit) {
  char decode[] = "_ReVA;UQ9K";
  for (int i = 0; i < 10; i++) {
    if ((*digit * 2 + *(digit + 1) - 250) == decode[i]) {
      return i;
    }
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<ParseNumber>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  movl   $0x0,-0x8(%rbp)
  movl   $0x0,-0x4(%rbp)
  movl   $0x0,-0xc(%rbp)
  jmp    L157
L45:
  cmpb   $0x2f,-0xd(%rbp)
  jle    L152
  cmpb   $0x39,-0xd(%rbp)
  jg     L152
  mov    -0x8(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  mov    %eax,%edx
  movsbl -0xd(%rbp),%eax
  sub    $0x30,%eax
  add    %edx,%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x4(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  mov    %eax,-0x4(%rbp)
  jmp    L38
L152:
  cmpb   $0x4b,-0xd(%rbp)
  jne    L6
  mov    -0x8(%rbp),%eax
  imul   $0x3e8,%eax,%eax
  mov    %eax,-0x8(%rbp)
  jmp    L145
L6:
  cmpb   $0x4d,-0xd(%rbp)
  jne    L80
  mov    -0x8(%rbp),%eax
  imul   $0xf4240,%eax,%eax
  mov    %eax,-0x8(%rbp)
  jmp    L145
L80:
  cmpb   $0x47,-0xd(%rbp)
  jne    L50
  mov    -0x8(%rbp),%eax
  imul   $0x3b9aca00,%eax,%eax
  mov    %eax,-0x8(%rbp)
  jmp    L145
L50:
  cmpb   $0x2c,-0xd(%rbp)
  je     L115
  cmpb   $0x2e,-0xd(%rbp)
  jne    L119
L115:
  movl   $0x1,-0x4(%rbp)
  jmp    L38
L119:
  mov    $0xffffffff,%eax
  jmp    L52
L38:
  addl   $0x1,-0xc(%rbp)
L157:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0xd(%rbp)
  cmpb   $0x0,-0xd(%rbp)
  jne    L45
L145:
  cmpl   $0x0,-0x4(%rbp)
  je     L68
  mov    -0x8(%rbp),%eax
  cltd
  idivl  -0x4(%rbp)
  mov    %eax,-0x8(%rbp)
L68:
  mov    -0x8(%rbp),%eax
L52:
  pop    %rbp
  ret
```

assistant: ```c
int ParseNumber(char *numberstring) {
  int i, number, decimals;
  char c;
  number = 0;
  decimals = 0;
  i = 0;
  while ((c = numberstring[i]) != '\0') {
    if (c >= '0' && c <= '9') {
      number = (number * 10 + ((int)c - 48));
      decimals = (decimals * 10);
    } else if (c == 'K') {
      number = (number * 1000);
      break;
    } else if (c == 'M') {
      number = (number * 1000000);
      break;
    } else if (c == 'G') {
      number = (number * 1000000000);
      break;
    } else if (c == ',' || c == '.')
      decimals = 1;
    else
      return (-1);
    i++;
  }
  if (decimals != 0)
    number = (number / decimals);
  return number;
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<ParseNumber>:
  endbr64
  movzbl (%rdi),%ecx
  test   %cl,%cl
  je     L18
  add    $0x1,%rdi
  mov    $0x0,%esi
  mov    $0x0,%eax
  lea    D4(%rip),%r8
  mov    $0x1,%r9d
L75:
  lea    -0x2c(%rcx),%edx
  cmp    $0x21,%dl
  ja     L28
  movzbl %dl,%edx
  movslq (%r8,%rdx,4),%rdx
  add    %r8,%rdx
  notrack jmp *%rdx
  lea    (%rax,%rax,4),%eax
  movsbl %cl,%ecx
  lea    -0x30(%rcx,%rax,2),%eax
  lea    (%rsi,%rsi,4),%esi
  add    %esi,%esi
L54:
  add    $0x1,%rdi
  movzbl -0x1(%rdi),%ecx
  test   %cl,%cl
  jne    L75
  jmp    L65
  imul   $0x3e8,%eax,%eax
L65:
  test   %esi,%esi
  je     L63
  cltd
  idiv   %esi
  ret
  imul   $0xf4240,%eax,%eax
  jmp    L65
  imul   $0x3b9aca00,%eax,%eax
  jmp    L65
  mov    %r9d,%esi
  jmp    L54
L18:
  mov    $0x0,%eax
  ret
L28:
  mov    $0xffffffff,%eax
L63:
  ret
```

assistant: ```c
int ParseNumber(char *numberstring) {
  int i, number, decimals;
  char c;
  number = 0;
  decimals = 0;
  i = 0;
  while ((c = numberstring[i]) != '\0') {
    if (c >= '0' && c <= '9') {
      number = (number * 10 + ((int)c - 48));
      decimals = (decimals * 10);
    } else if (c == 'K') {
      number = (number * 1000);
      break;
    } else if (c == 'M') {
      number = (number * 1000000);
      break;
    } else if (c == 'G') {
      number = (number * 1000000000);
      break;
    } else if (c == ',' || c == '.')
      decimals = 1;
    else
      return (-1);
    i++;
  }
  if (decimals != 0)
    number = (number / decimals);
  return number;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<ParseNumber>:
  endbr64
  movzbl (%rdi),%ecx
  test   %cl,%cl
  je     L9
  add    $0x1,%rdi
  xor    %esi,%esi
  lea    D1(%rip),%r8
  xor    %eax,%eax
L17:
  lea    -0x2c(%rcx),%edx
  cmp    $0x21,%dl
  ja     L7
  movzbl %dl,%edx
  movslq (%r8,%rdx,4),%rdx
  add    %r8,%rdx
  notrack jmp *%rdx
  nopl   0x0(%rax,%rax,1)
L7:
  mov    $0xffffffff,%eax
L71:
  ret
  xchg   %ax,%ax
  sub    $0x30,%ecx
  lea    (%rax,%rax,4),%eax
  lea    (%rsi,%rsi,4),%esi
  movsbl %cl,%ecx
  add    %esi,%esi
  lea    (%rcx,%rax,2),%eax
L18:
  movzbl (%rdi),%ecx
  add    $0x1,%rdi
  test   %cl,%cl
  jne    L17
  jmp    L28
  xchg   %ax,%ax
  imul   $0xf4240,%eax,%eax
L28:
  test   %esi,%esi
  je     L71
  cltd
  idiv   %esi
  ret
  xchg   %ax,%ax
  imul   $0x3e8,%eax,%eax
  jmp    L28
  nopl   0x0(%rax,%rax,1)
  imul   $0x3b9aca00,%eax,%eax
  jmp    L28
  nopl   0x0(%rax,%rax,1)
  mov    $0x1,%esi
  jmp    L18
  nopw   0x0(%rax,%rax,1)
L9:
  xor    %eax,%eax
  ret
```

assistant: ```c
int ParseNumber(char *numberstring) {
  int i, number, decimals;
  char c;
  number = 0;
  decimals = 0;
  i = 0;
  while ((c = numberstring[i]) != '\0') {
    if (c >= '0' && c <= '9') {
      number = (number * 10 + ((int)c - 48));
      decimals = (decimals * 10);
    } else if (c == 'K') {
      number = (number * 1000);
      break;
    } else if (c == 'M') {
      number = (number * 1000000);
      break;
    } else if (c == 'G') {
      number = (number * 1000000000);
      break;
    } else if (c == ',' || c == '.')
      decimals = 1;
    else
      return (-1);
    i++;
  }
  if (decimals != 0)
    number = (number / decimals);
  return number;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<ParseNumber>:
  endbr64
  movzbl (%rdi),%ecx
  test   %cl,%cl
  je     L71
  add    $0x1,%rdi
  xor    %esi,%esi
  lea    D4(%rip),%r8
  xor    %eax,%eax
L59:
  lea    -0x2c(%rcx),%edx
  cmp    $0x21,%dl
  ja     L16
  movzbl %dl,%edx
  movslq (%r8,%rdx,4),%rdx
  add    %r8,%rdx
  notrack jmp *%rdx
  nopl   0x0(%rax,%rax,1)
L16:
  mov    $0xffffffff,%eax
L70:
  ret
  xchg   %ax,%ax
  sub    $0x30,%ecx
  lea    (%rax,%rax,4),%eax
  lea    (%rsi,%rsi,4),%esi
  movsbl %cl,%ecx
  add    %esi,%esi
  lea    (%rcx,%rax,2),%eax
L61:
  movzbl (%rdi),%ecx
  add    $0x1,%rdi
  test   %cl,%cl
  jne    L59
  jmp    L13
  xchg   %ax,%ax
  imul   $0xf4240,%eax,%eax
L13:
  test   %esi,%esi
  je     L70
  cltd
  idiv   %esi
  ret
  xchg   %ax,%ax
  imul   $0x3e8,%eax,%eax
  jmp    L13
  nopl   0x0(%rax,%rax,1)
  imul   $0x3b9aca00,%eax,%eax
  jmp    L13
  nopl   0x0(%rax,%rax,1)
  mov    $0x1,%esi
  jmp    L61
  nopw   0x0(%rax,%rax,1)
L71:
  xor    %eax,%eax
  ret
```

assistant: ```c
int ParseNumber(char *numberstring) {
  int i, number, decimals;
  char c;
  number = 0;
  decimals = 0;
  i = 0;
  while ((c = numberstring[i]) != '\0') {
    if (c >= '0' && c <= '9') {
      number = (number * 10 + ((int)c - 48));
      decimals = (decimals * 10);
    } else if (c == 'K') {
      number = (number * 1000);
      break;
    } else if (c == 'M') {
      number = (number * 1000000);
      break;
    } else if (c == 'G') {
      number = (number * 1000000000);
      break;
    } else if (c == ',' || c == '.')
      decimals = 1;
    else
      return (-1);
    i++;
  }
  if (decimals != 0)
    number = (number / decimals);
  return number;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<rightTrim>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  sub    $0x1,%eax
  mov    %eax,-0x4(%rbp)
  jmp    L18
L27:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  subl   $0x1,-0x4(%rbp)
L18:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isspace@plt>
  test   %rax,%rax
  je     L10
  cmpl   $0x0,-0x4(%rbp)
  jns    L27
L10:
  mov    -0x18(%rbp),%rax
  leave
  ret
```

assistant: ```c
char *rightTrim(char *str) {
  int pos;
  pos = strlen(str) - 1;
  while (isspace(str[pos]) && pos >= 0) {
    str[pos] = '\0';
    pos--;
  }
  return str;
}
```
user: Translate the below assembly code into C programming language:

```asm
<rightTrim>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  call   <strlen@plt>
  lea    -0x1(%rax),%ebx
  movslq %ebx,%rbx
L27:
  movsbl 0x0(%rbp,%rbx,1),%edi
  call   <isspace@plt>
  test   %ebx,%ebx
  js     L4
  test   %rax,%rax
  je     L4
  movb   $0x0,0x0(%rbp,%rbx,1)
  sub    $0x1,%rbx
  jmp    L27
L4:
  mov    %rbp,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
char *rightTrim(char *str) {
  int pos;
  pos = strlen(str) - 1;
  while (isspace(str[pos]) && pos >= 0) {
    str[pos] = '\0';
    pos--;
  }
  return str;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<rightTrim>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  push   %rbx
  sub    $0x8,%rsp
  call   <strlen@plt>
  lea    -0x1(%rax),%ebx
  movslq %ebx,%rbx
  jmp    L25
  nopl   0x0(%rax,%rax,1)
L7:
  test   %rax,%rax
  je     L6
  movb   $0x0,(%r12,%rbx,1)
  sub    $0x1,%rbx
L25:
  movsbl (%r12,%rbx,1),%edi
  call   <isspace@plt>
  test   %ebx,%ebx
  jns    L7
L6:
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %r12
  ret
```

assistant: ```c
char *rightTrim(char *str) {
  int pos;
  pos = strlen(str) - 1;
  while (isspace(str[pos]) && pos >= 0) {
    str[pos] = '\0';
    pos--;
  }
  return str;
}
```
user: Translate the below assembly code into C programming language:

```asm
<rightTrim>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  push   %rbx
  sub    $0x8,%rsp
  call   <strlen@plt>
  lea    -0x1(%rax),%ebx
  movslq %ebx,%rbx
  jmp    L2
  nopl   0x0(%rax,%rax,1)
L21:
  test   %rax,%rax
  je     L6
  movb   $0x0,(%r12,%rbx,1)
  sub    $0x1,%rbx
L2:
  movsbl (%r12,%rbx,1),%edi
  call   <isspace@plt>
  test   %ebx,%ebx
  jns    L21
L6:
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %r12
  ret
```

assistant: ```c
char *rightTrim(char *str) {
  int pos;
  pos = strlen(str) - 1;
  while (isspace(str[pos]) && pos >= 0) {
    str[pos] = '\0';
    pos--;
  }
  return str;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<INR_MDIO_write_b>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  mov    %edx,-0x1c(%rbp)
  mov    %ecx,-0x20(%rbp)
  movl   $0x0,-0x4(%rbp)
  movl   $0x0,-0x8(%rbp)
  mov    -0x14(%rbp),%eax
  shl    $0x1a,%eax
  and    $0x4000000,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%eax
  shl    $0x15,%eax
  and    $0x3e00000,%eax
  or     %eax,%edx
  mov    -0x1c(%rbp),%eax
  shl    $0x10,%eax
  and    $0x1f0000,%eax
  or     %edx,%eax
  or     -0x20(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  mov    $0x100,%esi
  mov    %eax,%edi
  call   <INR_PCI_MMI_write@plt>
  mov    $0x32,%edi
  call   <usleep@plt>
  jmp    L22
L35:
  addl   $0x1,-0x8(%rbp)
  cmpl   $0xa,-0x8(%rbp)
  jg     L9
L22:
  mov    $0x0,%edi
  call   <INR_MDIO_read_b@plt>
  test   %rax,%rax
  jne    L35
  jmp    L12
L9:
  nop
L12:
  nop
  leave
  ret
```

assistant: ```c
void INR_MDIO_write_b(uint8_t write, uint8_t PHY_addr, uint8_t REG_addr, uint16_t data) {
  uint32_t value = 0, i = 0;
  value = ((1 & write) << 26) | ((PHY_addr & 0x1f) << 21) | ((REG_addr & 0x1f) << 16) | (data);
  INR_PCI_MMI_write(value, ((0x00 << 0) | (0x0001 << 8)));
  usleep(50);
  while (INR_MDIO_read_b(NULL)) {
    i++;
    if (i > 10)
      break;
  }
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<INR_MDIO_write_b>:
  endbr64
  push   %rbx
  shl    $0x10,%edx
  and    $0x1f0000,%edx
  or     %ecx,%edx
  shl    $0x15,%esi
  and    $0x3e00000,%esi
  or     %esi,%edx
  shl    $0x1a,%edi
  and    $0x4000000,%edi
  or     %edx,%edi
  mov    $0x100,%esi
  call   <INR_PCI_MMI_write@plt>
  mov    $0x32,%edi
  call   <usleep@plt>
  mov    $0xb,%ebx
L14:
  mov    $0x0,%edi
  call   <INR_MDIO_read_b@plt>
  test   %rax,%rax
  je     L12
  sub    $0x1,%ebx
  jne    L14
L12:
  pop    %rbx
  ret
```

assistant: ```c
void INR_MDIO_write_b(uint8_t write, uint8_t PHY_addr, uint8_t REG_addr, uint16_t data) {
  uint32_t value = 0, i = 0;
  value = ((1 & write) << 26) | ((PHY_addr & 0x1f) << 21) | ((REG_addr & 0x1f) << 16) | (data);
  INR_PCI_MMI_write(value, ((0x00 << 0) | (0x0001 << 8)));
  usleep(50);
  while (INR_MDIO_read_b(NULL)) {
    i++;
    if (i > 10)
      break;
  }
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<INR_MDIO_write_b>:
  endbr64
  shl    $0x10,%edx
  shl    $0x15,%esi
  push   %rbx
  mov    $0xb,%ebx
  and    $0x1f0000,%edx
  and    $0x3e00000,%esi
  shl    $0x1a,%edi
  or     %ecx,%edx
  and    $0x4000000,%edi
  or     %esi,%edx
  mov    $0x100,%esi
  or     %edx,%edi
  call   <INR_PCI_MMI_write@plt>
  mov    $0x32,%edi
  call   <usleep@plt>
  nop
L9:
  xor    %edi,%edi
  call   <INR_MDIO_read_b@plt>
  test   %rax,%rax
  je     L5
  sub    $0x1,%ebx
  jne    L9
L5:
  pop    %rbx
  ret
```

assistant: ```c
void INR_MDIO_write_b(uint8_t write, uint8_t PHY_addr, uint8_t REG_addr, uint16_t data) {
  uint32_t value = 0, i = 0;
  value = ((1 & write) << 26) | ((PHY_addr & 0x1f) << 21) | ((REG_addr & 0x1f) << 16) | (data);
  INR_PCI_MMI_write(value, ((0x00 << 0) | (0x0001 << 8)));
  usleep(50);
  while (INR_MDIO_read_b(NULL)) {
    i++;
    if (i > 10)
      break;
  }
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<INR_MDIO_write_b>:
  endbr64
  shl    $0x10,%edx
  shl    $0x15,%esi
  push   %rbx
  mov    $0xb,%ebx
  and    $0x1f0000,%edx
  and    $0x3e00000,%esi
  shl    $0x1a,%edi
  or     %ecx,%edx
  and    $0x4000000,%edi
  or     %esi,%edx
  mov    $0x100,%esi
  or     %edx,%edi
  call   <INR_PCI_MMI_write@plt>
  mov    $0x32,%edi
  call   <usleep@plt>
  nop
L9:
  xor    %edi,%edi
  call   <INR_MDIO_read_b@plt>
  test   %rax,%rax
  je     L2
  sub    $0x1,%ebx
  jne    L9
L2:
  pop    %rbx
  ret
```

assistant: ```c
void INR_MDIO_write_b(uint8_t write, uint8_t PHY_addr, uint8_t REG_addr, uint16_t data) {
  uint32_t value = 0, i = 0;
  value = ((1 & write) << 26) | ((PHY_addr & 0x1f) << 21) | ((REG_addr & 0x1f) << 16) | (data);
  INR_PCI_MMI_write(value, ((0x00 << 0) | (0x0001 << 8)));
  usleep(50);
  while (INR_MDIO_read_b(NULL)) {
    i++;
    if (i > 10)
      break;
  }
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<bit_array_mask>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  cmpq   $0x0,-0x28(%rbp)
  je     L55
  cmpq   $0x0,-0x30(%rbp)
  je     L55
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  movq   $0x0,-0x18(%rbp)
  jmp    L57
L12:
  mov    -0x18(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <bit_array_test@plt>
  test   %rax,%rax
  je     L42
  mov    -0x38(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <bit_array_clear@plt>
L42:
  addq   $0x1,-0x18(%rbp)
  addq   $0x1,-0x38(%rbp)
L57:
  mov    -0x10(%rbp),%rax
  mov    (%rax),%rax
  cmp    %rax,-0x38(%rbp)
  jae    L55
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  cmp    %rax,-0x18(%rbp)
  jb     L12
L55:
  nop
  leave
  ret
```

assistant: ```c
void bit_array_mask(void *dest, void *source, size_t offset) {
  if (dest && source) {
    size_t *dsize = (size_t *)dest;
    size_t *ssize = (size_t *)source;
    size_t soffset = 0;
    while (offset < *dsize && soffset < *ssize) {
      if (bit_array_test(source, soffset)) {
        bit_array_clear(dest, offset);
      }
      soffset++;
      offset++;
    }
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<bit_array_mask>:
  endbr64
  test   %rdi,%rdi
  je     L16
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r13
  mov    %rsi,%r12
  mov    %rdx,%rbp
  test   %rsi,%rsi
  je     L19
  mov    $0x0,%ebx
  cmp    (%rdi),%rdx
  jb     L3
L19:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L23:
  add    $0x1,%rbx
  add    $0x1,%rbp
  cmp    %rbp,0x0(%r13)
  jbe    L19
L3:
  cmp    %rbx,(%r12)
  jbe    L19
  mov    %rbx,%rsi
  mov    %r12,%rdi
  call   <bit_array_test@plt>
  test   %rax,%rax
  je     L23
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <bit_array_clear@plt>
  jmp    L23
L16:
  ret
```

assistant: ```c
void bit_array_mask(void *dest, void *source, size_t offset) {
  if (dest && source) {
    size_t *dsize = (size_t *)dest;
    size_t *ssize = (size_t *)source;
    size_t soffset = 0;
    while (offset < *dsize && soffset < *ssize) {
      if (bit_array_test(source, soffset)) {
        bit_array_clear(dest, offset);
      }
      soffset++;
      offset++;
    }
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<bit_array_mask>:
  endbr64
  test   %rdi,%rdi
  je     L48
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %rsi,%rsi
  je     L52
  mov    %rdi,%r13
  mov    %rdx,%rbp
  xor    %ebx,%ebx
  cmp    (%rdi),%rdx
  jb     L23
L52:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax,%rax,1)
L44:
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <bit_array_clear@plt>
L43:
  add    $0x1,%rbx
  add    $0x1,%rbp
  cmp    %rbp,0x0(%r13)
  jbe    L52
L23:
  cmp    %rbx,(%r12)
  jbe    L52
  mov    %rbx,%rsi
  mov    %r12,%rdi
  call   <bit_array_test@plt>
  test   %rax,%rax
  je     L43
  jmp    L44
  nopl   0x0(%rax)
L48:
  ret
```

assistant: ```c
void bit_array_mask(void *dest, void *source, size_t offset) {
  if (dest && source) {
    size_t *dsize = (size_t *)dest;
    size_t *ssize = (size_t *)source;
    size_t soffset = 0;
    while (offset < *dsize && soffset < *ssize) {
      if (bit_array_test(source, soffset)) {
        bit_array_clear(dest, offset);
      }
      soffset++;
      offset++;
    }
  }
}
```