ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<scan_rest>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L9
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    -0x20(%rbp),%rdx
  mov    %eax,(%rdx)
  jmp    L24
L14:
  addq   $0x1,-0x8(%rbp)
L24:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L14
L9:
  mov    -0x8(%rbp),%rax
  leave
  ret
```

assistant: ```c
char *scan_rest(char *arg, int *length) {
  char *p;
  p = arg + 1;
  if (isdigit(*p)) {
    *length = atoi(p);
    while (isdigit(*p)) {
      p++;
    }
  }
  return p;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<scan_rest>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rsi,%rbp
  lea    0x1(%rdi),%rbx
  movsbl 0x1(%rdi),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L15
L34:
  mov    %rbx,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L15:
  mov    %rbx,%rdi
  call   <atoi@plt>
  mov    %eax,0x0(%rbp)
  jmp    L7
L28:
  add    $0x1,%rbx
L7:
  movsbl (%rbx),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L28
  jmp    L34
```

assistant: ```c
char *scan_rest(char *arg, int *length) {
  char *p;
  p = arg + 1;
  if (isdigit(*p)) {
    *length = atoi(p);
    while (isdigit(*p)) {
      p++;
    }
  }
  return p;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<scan_rest>:
  endbr64
  push   %r12
  lea    0x1(%rdi),%r12
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x8,%rsp
  movsbl 0x1(%rdi),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L20
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L20:
  mov    %r12,%rdi
  call   <atoi@plt>
  mov    %eax,(%rbx)
  jmp    L13
  nopl   0x0(%rax)
L6:
  add    $0x1,%r12
L13:
  movsbl (%r12),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L6
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %r12
  ret
```

assistant: ```c
char *scan_rest(char *arg, int *length) {
  char *p;
  p = arg + 1;
  if (isdigit(*p)) {
    *length = atoi(p);
    while (isdigit(*p)) {
      p++;
    }
  }
  return p;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<scan_rest>:
  endbr64
  push   %r12
  lea    0x1(%rdi),%r12
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x8,%rsp
  movsbl 0x1(%rdi),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L28
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L28:
  mov    %r12,%rdi
  call   <atoi@plt>
  mov    %eax,(%rbx)
  jmp    L15
  nopl   0x0(%rax)
L5:
  add    $0x1,%r12
L15:
  movsbl (%r12),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L5
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %r12
  ret
```

assistant: ```c
char *scan_rest(char *arg, int *length) {
  char *p;
  p = arg + 1;
  if (isdigit(*p)) {
    *length = atoi(p);
    while (isdigit(*p)) {
      p++;
    }
  }
  return p;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<matrix_addition>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
  mov    %ecx,-0x28(%rbp)
  mov    %r8,-0x30(%rbp)
  movl   $0x0,-0x8(%rbp)
  jmp    L39
L6:
  movl   $0x0,-0x4(%rbp)
  jmp    L14
L34:
  mov    -0x28(%rbp),%eax
  imul   -0x8(%rbp),%eax
  mov    %eax,%edx
  mov    -0x4(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm1
  mov    -0x28(%rbp),%eax
  imul   -0x8(%rbp),%eax
  mov    %eax,%edx
  mov    -0x4(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm0
  mov    -0x28(%rbp),%eax
  imul   -0x8(%rbp),%eax
  mov    %eax,%edx
  mov    -0x4(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  addss  %xmm1,%xmm0
  movss  %xmm0,(%rax)
  addl   $0x1,-0x4(%rbp)
L14:
  mov    -0x4(%rbp),%eax
  cmp    -0x28(%rbp),%eax
  jl     L34
  addl   $0x1,-0x8(%rbp)
L39:
  mov    -0x8(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L6
  nop
  nop
  pop    %rbp
  ret
```

assistant: ```c
void matrix_addition(float *A, float *B, int m, int n, float *C) {
  int i, j;
  for (i = 0; i < m; i++)
    for (j = 0; j < n; j++)
      C[n * i + j] = A[n * i + j] + B[n * i + j];
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<matrix_addition>:
  endbr64
  test   %edx,%edx
  jle    L42
  push   %rbx
  mov    %edx,%r11d
  mov    $0x0,%r10d
  mov    $0x0,%r9d
  mov    %ecx,%ebx
  jmp    L9
L58:
  movslq %r10d,%rdx
  lea    0x0(,%rdx,4),%rax
  add    %rbx,%rdx
  shl    $0x2,%rdx
L57:
  movss  (%rdi,%rax,1),%xmm0
  addss  (%rsi,%rax,1),%xmm0
  movss  %xmm0,(%r8,%rax,1)
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L57
L10:
  add    $0x1,%r9d
  add    %ecx,%r10d
  cmp    %r9d,%r11d
  je     L1
L9:
  test   %ecx,%ecx
  jg     L58
  jmp    L10
L1:
  pop    %rbx
  ret
L42:
  ret
```

assistant: ```c
void matrix_addition(float *A, float *B, int m, int n, float *C) {
  int i, j;
  for (i = 0; i < m; i++)
    for (j = 0; j < n; j++)
      C[n * i + j] = A[n * i + j] + B[n * i + j];
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<matrix_addition>:
  endbr64
  test   %edx,%edx
  jle    L20
  mov    %ecx,%r10d
  push   %rbx
  mov    %edx,%r11d
  xor    %r9d,%r9d
  lea    -0x1(%r10),%ebx
  xor    %ecx,%ecx
  add    $0x1,%rbx
  nopl   0x0(%rax)
L23:
  test   %r10d,%r10d
  jle    L28
  movslq %r9d,%rdx
  lea    0x0(,%rdx,4),%rax
  add    %rbx,%rdx
  shl    $0x2,%rdx
  nopw   0x0(%rax,%rax,1)
L33:
  movss  (%rdi,%rax,1),%xmm0
  addss  (%rsi,%rax,1),%xmm0
  movss  %xmm0,(%r8,%rax,1)
  add    $0x4,%rax
  cmp    %rax,%rdx
  jne    L33
L28:
  add    $0x1,%ecx
  add    %r10d,%r9d
  cmp    %ecx,%r11d
  jne    L23
  pop    %rbx
  ret
L20:
  ret
```

assistant: ```c
void matrix_addition(float *A, float *B, int m, int n, float *C) {
  int i, j;
  for (i = 0; i < m; i++)
    for (j = 0; j < n; j++)
      C[n * i + j] = A[n * i + j] + B[n * i + j];
}
```
user: What is the c source code of the assembly code below?

```asm
<matrix_addition>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edx,-0x34(%rsp)
  test   %edx,%edx
  jle    L16
  mov    %ecx,%ebp
  test   %ecx,%ecx
  jle    L16
  movslq %ecx,%r15
  mov    %ecx,%r14d
  xor    %r12d,%r12d
  xor    %edx,%edx
  lea    0x0(,%r15,4),%rax
  and    $0xfffffffc,%r14d
  xor    %r11d,%r11d
  xor    %r13d,%r13d
  mov    %rax,-0x30(%rsp)
  lea    -0x1(%rcx),%eax
  mov    %eax,-0x18(%rsp)
  mov    %ecx,%eax
  shr    $0x2,%eax
  lea    -0x1(%rax),%ebx
  lea    0x4(%rsi),%rax
  mov    %rax,-0x20(%rsp)
  lea    0x4(%rdi),%rax
  add    $0x1,%rbx
  mov    %rax,-0x28(%rsp)
  mov    %ecx,%eax
  shl    $0x4,%rbx
  and    $0x3,%eax
  mov    %eax,-0x14(%rsp)
  mov    %ecx,%eax
  shl    $0x2,%rax
  mov    %rax,-0x10(%rsp)
  nopl   0x0(%rax,%rax,1)
L81:
  mov    %r8,%rax
  sub    -0x20(%rsp),%rax
  lea    (%r8,%r11,1),%rcx
  cmp    $0x8,%rax
  mov    %r8,%rax
  seta   %r9b
  sub    -0x28(%rsp),%rax
  cmp    $0x8,%rax
  seta   %al
  test   %al,%r9b
  je     L49
  cmp    $0x1,%ebp
  je     L49
  cmpl   $0x2,-0x18(%rsp)
  jbe    L110
  lea    (%r11,%rdi,1),%r10
  lea    (%r11,%rsi,1),%r9
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L20:
  movups (%r10,%rax,1),%xmm0
  movups (%r9,%rax,1),%xmm2
  addps  %xmm2,%xmm0
  movups %xmm0,(%rcx,%rax,1)
  add    $0x10,%rax
  cmp    %rbx,%rax
  jne    L20
  cmp    %ebp,%r14d
  je     L84
  mov    -0x14(%rsp),%eax
  mov    %eax,%r9d
  cmp    $0x1,%eax
  je     L135
  mov    %r14d,%ecx
  mov    %r14d,%eax
L11:
  add    %r12,%rcx
  movq   (%rdi,%rcx,4),%xmm0
  movq   (%rsi,%rcx,4),%xmm1
  addps  %xmm1,%xmm0
  movlps %xmm0,(%r8,%rcx,4)
  mov    %r9d,%ecx
  and    $0xfffffffe,%ecx
  add    %ecx,%eax
  cmp    %ecx,%r9d
  je     L84
L119:
  add    %edx,%eax
  cltq
  movss  (%rdi,%rax,4),%xmm0
  addss  (%rsi,%rax,4),%xmm0
  movss  %xmm0,(%r8,%rax,4)
L84:
  add    $0x1,%r13d
  add    -0x30(%rsp),%r11
  add    %ebp,%edx
  add    %r15,%r12
  cmp    %r13d,-0x34(%rsp)
  jne    L81
L16:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L49:
  mov    -0x10(%rsp),%rax
  lea    (%rax,%r11,1),%rcx
  mov    %r11,%rax
  nopl   0x0(%rax)
L126:
  movss  (%rdi,%rax,1),%xmm0
  addss  (%rsi,%rax,1),%xmm0
  movss  %xmm0,(%r8,%rax,1)
  add    $0x4,%rax
  cmp    %rax,%rcx
  jne    L126
  jmp    L84
L110:
  mov    %ebp,%r9d
  xor    %ecx,%ecx
  xor    %eax,%eax
  jmp    L11
L135:
  mov    %r14d,%eax
  jmp    L119
```

assistant: ```c
void matrix_addition(float *A, float *B, int m, int n, float *C) {
  int i, j;
  for (i = 0; i < m; i++)
    for (j = 0; j < n; j++)
      C[n * i + j] = A[n * i + j] + B[n * i + j];
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<isready>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x34(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <FD_ZERO@plt>
  lea    -0x28(%rbp),%rdx
  mov    -0x34(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <FD_SET@plt>
  movq   $0x0,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x34(%rbp),%eax
  lea    0x1(%rax),%edi
  lea    -0x20(%rbp),%rdx
  lea    -0x28(%rbp),%rax
  mov    %rdx,%r8
  mov    $0x0,%ecx
  mov    $0x0,%edx
  mov    %rax,%rsi
  call   <select@plt>
  mov    %eax,-0x24(%rbp)
  cmpl   $0x0,-0x24(%rbp)
  jns    L29
  mov    $0xffffffff,%eax
  jmp    L9
L29:
  lea    -0x28(%rbp),%rdx
  mov    -0x34(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <FD_ISSET@plt>
  test   %rax,%rax
  setne  %al
  movzbl %al,%eax
L9:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L15
  call   <__stack_chk_fail@plt>
L15:
  leave
  ret
```

assistant: ```c
int isready(int fd) {
  int rc;
  fd_set fds;
  struct timeval tv;
  FD_ZERO(&fds);
  FD_SET(fd, &fds);
  tv.tv_sec = tv.tv_usec = 0;
  rc = select(fd + 1, &fds, NULL, NULL, &tv);
  if (rc < 0)
    return -1;
  return FD_ISSET(fd, &fds) ? 1 : 0;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<isready>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %edi,%ebx
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%rbp
  mov    %rbp,%rdi
  call   <FD_ZERO@plt>
  mov    %rbp,%rsi
  mov    %ebx,%edi
  call   <FD_SET@plt>
  movq   $0x0,0x10(%rsp)
  movq   $0x0,0x18(%rsp)
  lea    0x1(%rbx),%edi
  lea    0x10(%rsp),%r8
  mov    $0x0,%ecx
  mov    $0x0,%edx
  mov    %rbp,%rsi
  call   <select@plt>
  mov    %eax,%edx
  mov    $0xffffffff,%eax
  test   %edx,%edx
  js     L4
  mov    %rbp,%rsi
  mov    %ebx,%edi
  call   <FD_ISSET@plt>
  test   %rax,%rax
  setne  %al
  movzbl %al,%eax
L4:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L17
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  ret
L17:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int isready(int fd) {
  int rc;
  fd_set fds;
  struct timeval tv;
  FD_ZERO(&fds);
  FD_SET(fd, &fds);
  tv.tv_sec = tv.tv_usec = 0;
  rc = select(fd + 1, &fds, NULL, NULL, &tv);
  if (rc < 0)
    return -1;
  return FD_ISSET(fd, &fds) ? 1 : 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<isready>:
  endbr64
  push   %r12
  push   %rbp
  mov    %edi,%ebp
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%r12
  mov    %r12,%rdi
  call   <FD_ZERO@plt>
  mov    %r12,%rsi
  mov    %ebp,%edi
  call   <FD_SET@plt>
  lea    0x10(%rsp),%r8
  lea    0x1(%rbp),%edi
  xor    %ecx,%ecx
  movq   $0x0,0x10(%rsp)
  xor    %edx,%edx
  mov    %r12,%rsi
  movq   $0x0,0x18(%rsp)
  call   <select@plt>
  mov    %eax,%r8d
  mov    $0xffffffff,%eax
  test   %r8d,%r8d
  js     L3
  mov    %r12,%rsi
  mov    %ebp,%edi
  call   <FD_ISSET@plt>
  test   %rax,%rax
  setne  %al
  movzbl %al,%eax
L3:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L16
  add    $0x38,%rsp
  pop    %rbp
  pop    %r12
  ret
L16:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int isready(int fd) {
  int rc;
  fd_set fds;
  struct timeval tv;
  FD_ZERO(&fds);
  FD_SET(fd, &fds);
  tv.tv_sec = tv.tv_usec = 0;
  rc = select(fd + 1, &fds, NULL, NULL, &tv);
  if (rc < 0)
    return -1;
  return FD_ISSET(fd, &fds) ? 1 : 0;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<isready>:
  endbr64
  push   %r12
  push   %rbp
  mov    %edi,%ebp
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%r12
  mov    %r12,%rdi
  call   <FD_ZERO@plt>
  mov    %r12,%rsi
  mov    %ebp,%edi
  call   <FD_SET@plt>
  pxor   %xmm0,%xmm0
  lea    0x10(%rsp),%r8
  xor    %ecx,%ecx
  lea    0x1(%rbp),%edi
  xor    %edx,%edx
  mov    %r12,%rsi
  movaps %xmm0,0x10(%rsp)
  call   <select@plt>
  mov    %eax,%r8d
  mov    $0xffffffff,%eax
  test   %r8d,%r8d
  js     L7
  mov    %r12,%rsi
  mov    %ebp,%edi
  call   <FD_ISSET@plt>
  test   %rax,%rax
  setne  %al
  movzbl %al,%eax
L7:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L9
  add    $0x38,%rsp
  pop    %rbp
  pop    %r12
  ret
L9:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int isready(int fd) {
  int rc;
  fd_set fds;
  struct timeval tv;
  FD_ZERO(&fds);
  FD_SET(fd, &fds);
  tv.tv_sec = tv.tv_usec = 0;
  rc = select(fd + 1, &fds, NULL, NULL, &tv);
  if (rc < 0)
    return -1;
  return FD_ISSET(fd, &fds) ? 1 : 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<WcAppNameToAppClass>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <WcxLastSlash@plt>
  cltq
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  je     L39
  mov    -0x10(%rbp),%rax
  add    $0x1,%rax
  jmp    L13
L39:
  mov    -0x18(%rbp),%rax
L13:
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <XtNewString@plt>
  cltq
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <islower@plt>
  test   %eax,%eax
  je     L5
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <toupper@plt>
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  mov    %dl,(%rax)
  jmp    L41
L5:
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <islower@plt>
  test   %eax,%eax
  je     L41
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <toupper@plt>
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  mov    %dl,(%rax)
L41:
  mov    -0x8(%rbp),%rax
  leave
  ret
```

assistant: ```c
char *WcAppNameToAppClass(appName)
char *appName;
{
  char *lastSlash = WcxLastSlash(appName);
  char *appClass = XtNewString(lastSlash ? lastSlash + 1 : appName);
  if (islower(appClass[0]))
    appClass[0] = toupper(appClass[0]);
  else if (islower(appClass[1]))
    appClass[1] = toupper(appClass[1]);
  return appClass;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<WcAppNameToAppClass>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  mov    $0x0,%eax
  call   <WcxLastSlash@plt>
  movslq %eax,%rdx
  add    $0x1,%rdx
  test   %eax,%eax
  cmovne %rdx,%rbx
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <XtNewString@plt>
  movslq %eax,%rbx
  movsbl (%rbx),%ebp
  mov    %ebp,%edi
  call   <islower@plt>
  test   %eax,%eax
  je     L11
  mov    %ebp,%edi
  call   <toupper@plt>
  mov    %al,(%rbx)
L18:
  mov    %rbx,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L11:
  movsbl 0x1(%rbx),%ebp
  mov    %ebp,%edi
  call   <islower@plt>
  test   %eax,%eax
  je     L18
  mov    %ebp,%edi
  call   <toupper@plt>
  mov    %al,0x1(%rbx)
  jmp    L18
```

assistant: ```c
char *WcAppNameToAppClass(appName)
char *appName;
{
  char *lastSlash = WcxLastSlash(appName);
  char *appClass = XtNewString(lastSlash ? lastSlash + 1 : appName);
  if (islower(appClass[0]))
    appClass[0] = toupper(appClass[0]);
  else if (islower(appClass[1]))
    appClass[1] = toupper(appClass[1]);
  return appClass;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<WcAppNameToAppClass>:
  endbr64
  push   %r12
  xor    %eax,%eax
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x8,%rsp
  call   <WcxLastSlash@plt>
  movslq %eax,%rdx
  add    $0x1,%rdx
  test   %eax,%eax
  cmovne %rdx,%rbp
  xor    %eax,%eax
  mov    %rbp,%rdi
  call   <XtNewString@plt>
  movslq %eax,%r12
  movsbl (%r12),%ebp
  mov    %ebp,%edi
  call   <islower@plt>
  test   %eax,%eax
  je     L12
  mov    %ebp,%edi
  call   <toupper@plt>
  mov    %al,(%r12)
L13:
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
  nopl   (%rax)
L12:
  movsbl 0x1(%r12),%ebp
  mov    %ebp,%edi
  call   <islower@plt>
  test   %eax,%eax
  je     L13
  mov    %ebp,%edi
  call   <toupper@plt>
  mov    %al,0x1(%r12)
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
char *WcAppNameToAppClass(appName)
char *appName;
{
  char *lastSlash = WcxLastSlash(appName);
  char *appClass = XtNewString(lastSlash ? lastSlash + 1 : appName);
  if (islower(appClass[0]))
    appClass[0] = toupper(appClass[0]);
  else if (islower(appClass[1]))
    appClass[1] = toupper(appClass[1]);
  return appClass;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<WcAppNameToAppClass>:
  endbr64
  push   %r12
  xor    %eax,%eax
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x8,%rsp
  call   <WcxLastSlash@plt>
  movslq %eax,%rdx
  add    $0x1,%rdx
  test   %eax,%eax
  cmovne %rdx,%rbp
  xor    %eax,%eax
  mov    %rbp,%rdi
  call   <XtNewString@plt>
  movslq %eax,%r12
  movsbl (%r12),%ebp
  mov    %ebp,%edi
  call   <islower@plt>
  test   %eax,%eax
  je     L17
  mov    %ebp,%edi
  call   <toupper@plt>
  mov    %al,(%r12)
L15:
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
  nopl   (%rax)
L17:
  movsbl 0x1(%r12),%ebp
  mov    %ebp,%edi
  call   <islower@plt>
  test   %eax,%eax
  je     L15
  mov    %ebp,%edi
  call   <toupper@plt>
  mov    %al,0x1(%r12)
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
char *WcAppNameToAppClass(appName)
char *appName;
{
  char *lastSlash = WcxLastSlash(appName);
  char *appClass = XtNewString(lastSlash ? lastSlash + 1 : appName);
  if (islower(appClass[0]))
    appClass[0] = toupper(appClass[0]);
  else if (islower(appClass[1]))
    appClass[1] = toupper(appClass[1]);
  return appClass;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<byteconvert>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  test   %rax,%rax
  js     L21
  pxor   %xmm0,%xmm0
  cvtsi2ss %rax,%xmm0
  jmp    L14
L21:
  mov    %rax,%rdx
  shr    %rdx
  and    $0x1,%eax
  or     %rax,%rdx
  pxor   %xmm0,%xmm0
  cvtsi2ss %rdx,%xmm0
  addss  %xmm0,%xmm0
L14:
  movss  %xmm0,-0x10(%rbp)
  movl   $0x0,-0xc(%rbp)
  jmp    L39
L0:
  movss  -0x10(%rbp),%xmm0
  movss  D10(%rip),%xmm1
  divss  %xmm1,%xmm0
  movss  %xmm0,-0x10(%rbp)
  addl   $0x1,-0xc(%rbp)
L39:
  movss  -0x10(%rbp),%xmm0
  movss  D10(%rip),%xmm1
  divss  %xmm1,%xmm0
  movss  D41(%rip),%xmm1
  comiss %xmm1,%xmm0
  jae    L0
  mov    $0x20,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0xc(%rbp),%eax
  cltq
  lea    D35(%rip),%rdx
  movzbl (%rax,%rdx,1),%eax
  movsbl %al,%edx
  mov    -0x10(%rbp),%ecx
  mov    -0x8(%rbp),%rax
  movd   %ecx,%xmm0
  lea    D25(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  mov    -0x8(%rbp),%rax
  leave
  ret
```

tool_calls: name: read_data
arguments: tag: D10
type_guessed: byte[4]
name: read_data
arguments: tag: D41
type_guessed: byte[4]
name: read_data
arguments: tag: D35
type_guessed: string
name: read_data
arguments: tag: D25
type_guessed: string

tool: {"D10": [0x00,0x00,0x7a,0x44]}

tool: {"D41": [0x00,0x00,0x80,0x3f]}

tool: D35: BKMGT

tool: D25: %.2f%c

assistant: ```c
char *byteconvert(unsigned long b_) {
  float b = (float)b_;
  int n = 0;
  while (b / 1000 >= 1) {
    b /= 1000;
    n++;
  }
  char *buffer = malloc(32);
  sprintf(buffer, "%.2f%c", b, "BKMGT"[n]);
  return buffer;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<byteconvert>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  test   %rdi,%rdi
  js     L9
  pxor   %xmm3,%xmm3
  cvtsi2ss %rdi,%xmm3
  movss  %xmm3,0xc(%rsp)
L49:
  movss  0xc(%rsp),%xmm0
  divss  D9(%rip),%xmm0
  mov    $0x0,%ebx
  movss  D9(%rip),%xmm2
  movss  D23(%rip),%xmm1
  comiss %xmm1,%xmm0
  jb     L35
L7:
  add    $0x1,%ebx
  movss  %xmm0,0xc(%rsp)
  divss  %xmm2,%xmm0
  comiss %xmm1,%xmm0
  jae    L7
L3:
  mov    $0x20,%edi
  call   <malloc@plt>
  mov    %rax,%rbp
  movslq %ebx,%rbx
  lea    D21(%rip),%rax
  movsbl (%rax,%rbx,1),%edx
  movss  0xc(%rsp),%xmm0
  lea    D34(%rip),%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  mov    %rbp,%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  ret
L9:
  mov    %rdi,%rax
  shr    %rax
  and    $0x1,%edi
  or     %rdi,%rax
  pxor   %xmm0,%xmm0
  cvtsi2ss %rax,%xmm0
  addss  %xmm0,%xmm0
  movss  %xmm0,0xc(%rsp)
  jmp    L49
L35:
  mov    $0x0,%ebx
  jmp    L3
```

tool_calls: name: disassemble_data
arguments: tag: D9
type_guessed: byte[4]
name: disassemble_data
arguments: tag: D23
type_guessed: byte[4]
name: disassemble_data
arguments: tag: D21
type_guessed: string
name: disassemble_data
arguments: tag: D34
type_guessed: string

tool: {"D9": [0x00,0x00,0x7a,0x44]}

tool: {"D23": [0x00,0x00,0x80,0x3f]}

tool: D21: BKMGT

tool: D34: %.2f%c

assistant: ```c
char *byteconvert(unsigned long b_) {
  float b = (float)b_;
  int n = 0;
  while (b / 1000 >= 1) {
    b /= 1000;
    n++;
  }
  char *buffer = malloc(32);
  sprintf(buffer, "%.2f%c", b, "BKMGT"[n]);
  return buffer;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<byteconvert>:
  endbr64
  push   %r12
  push   %rbx
  sub    $0x18,%rsp
  test   %rdi,%rdi
  js     L5
  pxor   %xmm0,%xmm0
  cvtsi2ss %rdi,%xmm0
L37:
  movss  D25(%rip),%xmm3
  movaps %xmm0,%xmm1
  movss  D27(%rip),%xmm2
  xor    %ebx,%ebx
  divss  %xmm3,%xmm1
  comiss %xmm2,%xmm1
  jb     L19
  nopl   0x0(%rax,%rax,1)
L16:
  movaps %xmm1,%xmm0
  add    $0x1,%ebx
  divss  %xmm3,%xmm1
  comiss %xmm2,%xmm1
  jae    L16
L19:
  mov    $0x20,%edi
  movss  %xmm0,0xc(%rsp)
  movslq %ebx,%rbx
  call   <malloc@plt>
  movss  0xc(%rsp),%xmm0
  lea    D21(%rip),%rsi
  mov    %rax,%r12
  lea    D14(%rip),%rax
  movsbl (%rax,%rbx,1),%edx
  mov    %r12,%rdi
  call   <sprintf@plt>
  add    $0x18,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %r12
  ret
L5:
  mov    %rdi,%rax
  and    $0x1,%edi
  pxor   %xmm0,%xmm0
  shr    %rax
  or     %rdi,%rax
  cvtsi2ss %rax,%xmm0
  addss  %xmm0,%xmm0
  jmp    L37
```

tool_calls: name: unpack_data
arguments: label: D25
type_guessed: byte[4]
name: unpack_data
arguments: label: D27
type_guessed: byte[4]
name: unpack_data
arguments: label: D21
type_guessed: string
name: unpack_data
arguments: label: D14
type_guessed: string

tool: {"D25": [0x00,0x00,0x7a,0x44]}

tool: {"D27": [0x00,0x00,0x80,0x3f]}

tool: D21: %.2f%c

tool: D14: BKMGT

assistant: ```c
char *byteconvert(unsigned long b_) {
  float b = (float)b_;
  int n = 0;
  while (b / 1000 >= 1) {
    b /= 1000;
    n++;
  }
  char *buffer = malloc(32);
  sprintf(buffer, "%.2f%c", b, "BKMGT"[n]);
  return buffer;
}
```