ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 这段汇编代码用C语言表示是什么样的?

```asm
<count>:
  endbr64
  mov    $0x0,%edx
L8:
  movzbl (%rdi),%eax
  cmp    %sil,%al
  sete   %cl
  movzbl %cl,%ecx
  add    %ecx,%edx
  add    $0x1,%rdi
  test   %al,%al
  jne    L8
  mov    %edx,%eax
  ret
```

assistant: ```c
int count(char *tokens, char search) {
  char token;
  int count = 0;
  do {
    token = *tokens;
    if (token == search)
      count++;
    tokens++;
  } while (token != '\0');
  return count;
}
```
user: Translate the below assembly code into C programming language:

```asm
<count>:
  endbr64
  xor    %r8d,%r8d
  nopw   0x0(%rax,%rax,1)
L0:
  movzbl (%rdi),%eax
  xor    %edx,%edx
  cmp    %sil,%al
  sete   %dl
  add    $0x1,%rdi
  add    %edx,%r8d
  test   %al,%al
  jne    L0
  mov    %r8d,%eax
  ret
```

assistant: ```c
int count(char *tokens, char search) {
  char token;
  int count = 0;
  do {
    token = *tokens;
    if (token == search)
      count++;
    tokens++;
  } while (token != '\0');
  return count;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<count>:
  endbr64
  xor    %r8d,%r8d
  nopw   0x0(%rax,%rax,1)
L6:
  movzbl (%rdi),%eax
  xor    %edx,%edx
  cmp    %al,%sil
  sete   %dl
  add    $0x1,%rdi
  add    %edx,%r8d
  test   %al,%al
  jne    L6
  mov    %r8d,%eax
  ret
```

assistant: ```c
int count(char *tokens, char search) {
  char token;
  int count = 0;
  do {
    token = *tokens;
    if (token == search)
      count++;
    tokens++;
  } while (token != '\0');
  return count;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  movl   $0x0,-0x4(%rbp)
  movl   $0x0,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  je     L0
  movl   $0x5,-0x4(%rbp)
L0:
  mov    -0x4(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  jne    L10
  addl   $0x1,-0x4(%rbp)
L10:
  mov    $0x0,%eax
  pop    %rbp
  ret
```

assistant: ```c
int main() {
  unsigned int l = 0;
  l = 0;
  if (l % 2U)
    l = 5;
  if (!(l % 2U))
    l = l + 1;
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<main>:
  endbr64
  mov    $0x0,%eax
  ret
```

assistant: ```c
int main() {
  unsigned int l = 0;
  l = 0;
  if (l % 2U)
    l = 5;
  if (!(l % 2U))
    l = l + 1;
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<main>:
  endbr64
  xor    %eax,%eax
  ret
```

assistant: ```c
int main() {
  unsigned int l = 0;
  l = 0;
  if (l % 2U)
    l = 5;
  if (!(l % 2U))
    l = l + 1;
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<main>:
  endbr64
  xor    %eax,%eax
  ret
```

assistant: ```c
int main() {
  unsigned int l = 0;
  l = 0;
  if (l % 2U)
    l = 5;
  if (!(l % 2U))
    l = l + 1;
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<can_set_own_id>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    %esi,-0x8(%rbp)
  mov    -0x8(%rbp),%edx
  mov    -0x4(%rbp),%eax
  mov    $0x4501,%esi
  mov    %eax,%edi
  call   <ioctl@plt>
  test   %rax,%rax
  je     L11
  lea    D7(%rip),%rax
  mov    %rax,%rdi
  call   <perror@plt>
  mov    $0xffffffff,%eax
  jmp    L4
L11:
  mov    $0x0,%eax
L4:
  leave
  ret
```

tool_calls: name: read_data
arguments: data_tag: D7
type_guessed: string

tool: D7: Can Test Set ID: 

assistant: ```c
int can_set_own_id(int fd, canid_t id) {
  if (ioctl(fd, 0x4501, id) != 0) {
    perror("Can Test Set ID: ");
    return -1;
  }
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<can_set_own_id>:
  endbr64
  sub    $0x8,%rsp
  mov    %esi,%edx
  mov    $0x4501,%esi
  call   <ioctl@plt>
  test   %rax,%rax
  jne    L12
  mov    $0x0,%eax
L8:
  add    $0x8,%rsp
  ret
L12:
  lea    D0(%rip),%rdi
  call   <perror@plt>
  mov    $0xffffffff,%eax
  jmp    L8
```

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

tool: D0: Can Test Set ID: 

assistant: ```c
int can_set_own_id(int fd, canid_t id) {
  if (ioctl(fd, 0x4501, id) != 0) {
    perror("Can Test Set ID: ");
    return -1;
  }
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<can_set_own_id>:
  endbr64
  sub    $0x8,%rsp
  mov    %esi,%edx
  mov    $0x4501,%esi
  call   <ioctl@plt>
  test   %rax,%rax
  jne    L17
  xor    %eax,%eax
L1:
  add    $0x8,%rsp
  ret
L17:
  lea    D7(%rip),%rdi
  call   <perror@plt>
  mov    $0xffffffff,%eax
  jmp    L1
```

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

tool: D7: Can Test Set ID: 

assistant: ```c
int can_set_own_id(int fd, canid_t id) {
  if (ioctl(fd, 0x4501, id) != 0) {
    perror("Can Test Set ID: ");
    return -1;
  }
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<can_set_own_id>:
  endbr64
  sub    $0x8,%rsp
  mov    %esi,%edx
  mov    $0x4501,%esi
  call   <ioctl@plt>
  test   %rax,%rax
  jne    L17
  xor    %eax,%eax
L14:
  add    $0x8,%rsp
  ret
L17:
  lea    D0(%rip),%rdi
  call   <perror@plt>
  mov    $0xffffffff,%eax
  jmp    L14
```

tool_calls: name: disassemble_data
arguments: label: D0
type_guessed: string

tool: D0: Can Test Set ID: 

assistant: ```c
int can_set_own_id(int fd, canid_t id) {
  if (ioctl(fd, 0x4501, id) != 0) {
    perror("Can Test Set ID: ");
    return -1;
  }
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<killcomments>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  je     L10
  mov    -0x18(%rbp),%rax
  mov    $0x23,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  je     L10
  mov    -0x8(%rbp),%rax
  movb   $0x0,(%rax)
L10:
  nop
  leave
  ret
```

assistant: ```c
void killcomments(char *s) {
  char *p;
  if (s && (p = strchr(s, '#')))
    *p = '\0';
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<killcomments>:
  endbr64
  test   %rdi,%rdi
  je     L14
  sub    $0x8,%rsp
  mov    $0x23,%esi
  call   <strchr@plt>
  test   %rax,%rax
  je     L9
  movb   $0x0,(%rax)
L9:
  add    $0x8,%rsp
  ret
L14:
  ret
```

assistant: ```c
void killcomments(char *s) {
  char *p;
  if (s && (p = strchr(s, '#')))
    *p = '\0';
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<killcomments>:
  endbr64
  test   %rdi,%rdi
  je     L10
  sub    $0x8,%rsp
  mov    $0x23,%esi
  call   <strchr@plt>
  test   %rax,%rax
  je     L19
  movb   $0x0,(%rax)
L19:
  add    $0x8,%rsp
  ret
  nopl   0x0(%rax)
L10:
  ret
```

assistant: ```c
void killcomments(char *s) {
  char *p;
  if (s && (p = strchr(s, '#')))
    *p = '\0';
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<killcomments>:
  endbr64
  test   %rdi,%rdi
  je     L1
  sub    $0x8,%rsp
  mov    $0x23,%esi
  call   <strchr@plt>
  test   %rax,%rax
  je     L13
  movb   $0x0,(%rax)
L13:
  add    $0x8,%rsp
  ret
  nopl   0x0(%rax)
L1:
  ret
```

assistant: ```c
void killcomments(char *s) {
  char *p;
  if (s && (p = strchr(s, '#')))
    *p = '\0';
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<SetNonblocking>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    D10(%rip),%rax
  mov    (%rax),%edx
  mov    -0x14(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <fcntl@plt>
  mov    %eax,-0x4(%rbp)
  cmpl   $0xffffffff,-0x4(%rbp)
  jne    L31
  mov    $0xffffffff,%eax
  jmp    L30
L31:
  mov    D18(%rip),%rax
  mov    (%rax),%eax
  or     -0x4(%rbp),%eax
  mov    %eax,%edx
  mov    D1(%rip),%rax
  mov    (%rax),%ecx
  mov    -0x14(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <fcntl@plt>
  cmp    $0xffffffff,%eax
  jne    L38
  mov    $0xffffffff,%eax
  jmp    L30
L38:
  mov    $0x0,%eax
L30:
  leave
  ret
```

assistant: ```c
int SetNonblocking(int fd) {
  int flags;
  if ((flags = fcntl(fd, F_GETFL)) == -1) {
    return -1;
  }
  if ((fcntl(fd, F_SETFL, flags | O_NONBLOCK)) == -1) {
    return -1;
  }
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<SetNonblocking>:
  endbr64
  push   %rbx
  mov    %edi,%ebx
  mov    D10(%rip),%rax
  mov    (%rax),%esi
  mov    $0x0,%eax
  call   <fcntl@plt>
  cmp    $0xffffffff,%eax
  je     L3
  mov    D9(%rip),%rdx
  or     (%rdx),%eax
  mov    %eax,%edx
  mov    D22(%rip),%rax
  mov    (%rax),%esi
  mov    %ebx,%edi
  mov    $0x0,%eax
  call   <fcntl@plt>
  cmp    $0xffffffff,%eax
  sete   %al
  movzbl %al,%eax
  neg    %eax
L3:
  pop    %rbx
  ret
```

assistant: ```c
int SetNonblocking(int fd) {
  int flags;
  if ((flags = fcntl(fd, F_GETFL)) == -1) {
    return -1;
  }
  if ((fcntl(fd, F_SETFL, flags | O_NONBLOCK)) == -1) {
    return -1;
  }
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<SetNonblocking>:
  endbr64
  mov    D8(%rip),%rax
  push   %rbp
  mov    %edi,%ebp
  mov    (%rax),%esi
  xor    %eax,%eax
  call   <fcntl@plt>
  cmp    $0xffffffff,%eax
  je     L8
  mov    D24(%rip),%rdx
  mov    %ebp,%edi
  or     (%rdx),%eax
  mov    %eax,%edx
  mov    D29(%rip),%rax
  mov    (%rax),%esi
  xor    %eax,%eax
  call   <fcntl@plt>
  cmp    $0xffffffff,%eax
  sete   %al
  movzbl %al,%eax
  neg    %eax
L8:
  pop    %rbp
  ret
```

assistant: ```c
int SetNonblocking(int fd) {
  int flags;
  if ((flags = fcntl(fd, F_GETFL)) == -1) {
    return -1;
  }
  if ((fcntl(fd, F_SETFL, flags | O_NONBLOCK)) == -1) {
    return -1;
  }
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<SetNonblocking>:
  endbr64
  mov    D7(%rip),%rax
  push   %rbp
  mov    %edi,%ebp
  mov    (%rax),%esi
  xor    %eax,%eax
  call   <fcntl@plt>
  cmp    $0xffffffff,%eax
  je     L9
  mov    D25(%rip),%rdx
  mov    %ebp,%edi
  or     (%rdx),%eax
  mov    %eax,%edx
  mov    D11(%rip),%rax
  mov    (%rax),%esi
  xor    %eax,%eax
  call   <fcntl@plt>
  cmp    $0xffffffff,%eax
  sete   %al
  movzbl %al,%eax
  neg    %eax
L9:
  pop    %rbp
  ret
```

assistant: ```c
int SetNonblocking(int fd) {
  int flags;
  if ((flags = fcntl(fd, F_GETFL)) == -1) {
    return -1;
  }
  if ((fcntl(fd, F_SETFL, flags | O_NONBLOCK)) == -1) {
    return -1;
  }
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<benchmark>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    $0x0,%eax
  call   <tic@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x18(%rbp)
  movl   $0x0,-0x24(%rbp)
  jmp    L28
L15:
  mov    $0x0,%eax
  call   <rand_double@plt>
  movsd  D6(%rip),%xmm1
  mulsd  %xmm1,%xmm0
  movsd  D12(%rip),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  movq   %rax,%xmm0
  call   <tanh@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x20(%rbp)
  movsd  -0x20(%rbp),%xmm0
  ucomisd -0x20(%rbp),%xmm0
  jnp    L48
  lea    D8(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  jmp    L44
L48:
  addl   $0x1,-0x24(%rbp)
L28:
  cmpl   $0xf423f,-0x24(%rbp)
  jle    L15
L44:
  mov    $0x0,%eax
  call   <tic@plt>
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  subsd  -0x18(%rbp),%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movsd  -0x20(%rbp),%xmm0
  ucomisd -0x20(%rbp),%xmm0
  jnp    L34
  lea    D8(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
L34:
  movsd  -0x8(%rbp),%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  leave
  ret
```

tool_calls: name: read_data
arguments: data_tag: D6
type: f64
name: read_data
arguments: data_tag: D12
type: f64
name: read_data
arguments: data_tag: D8
type: string

tool: D6: 10

tool: D12: 5

tool: D8: should not return NaN


assistant: ```c
double benchmark() {
  double elapsed;
  double x;
  double y;
  double t;
  int i;
  t = tic();
  for (i = 0; i < 1000000; i++) {
    x = (rand_double() * 10.0) - 5.0;
    y = tanh(x);
    if (y != y) {
      printf("should not return NaN\n");
      break;
    }
  }
  elapsed = tic() - t;
  if (y != y) {
    printf("should not return NaN\n");
  }
  return elapsed;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<benchmark>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    $0x0,%eax
  call   <tic@plt>
  movq   %xmm0,%r12
  mov    $0xf4240,%ebx
L11:
  mov    $0x0,%eax
  call   <rand_double@plt>
  mulsd  D3(%rip),%xmm0
  subsd  D21(%rip),%xmm0
  call   <tanh@plt>
  ucomisd %xmm0,%xmm0
  jp     L8
  sub    $0x1,%ebx
  jne    L11
  mov    $0x0,%eax
  call   <tic@plt>
  movq   %r12,%xmm2
  subsd  %xmm2,%xmm0
  movq   %xmm0,%rbx
  jmp    L16
L8:
  lea    D13(%rip),%rbp
  mov    %rbp,%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  call   <tic@plt>
  movq   %r12,%xmm1
  subsd  %xmm1,%xmm0
  movq   %xmm0,%rbx
  mov    %rbp,%rdi
  call   <printf@plt>
L16:
  movq   %rbx,%xmm0
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

tool_calls: name: read_data
arguments: data_tag: D3
datatype: f64
name: read_data
arguments: data_tag: D21
datatype: f64
name: read_data
arguments: data_tag: D13
datatype: string

tool: D3: 10

tool: D21: 5

tool: D13: should not return NaN


assistant: ```c
double benchmark() {
  double elapsed;
  double x;
  double y;
  double t;
  int i;
  t = tic();
  for (i = 0; i < 1000000; i++) {
    x = (rand_double() * 10.0) - 5.0;
    y = tanh(x);
    if (y != y) {
      printf("should not return NaN\n");
      break;
    }
  }
  elapsed = tic() - t;
  if (y != y) {
    printf("should not return NaN\n");
  }
  return elapsed;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<benchmark>:
  endbr64
  push   %rbp
  xor    %eax,%eax
  push   %rbx
  mov    $0xf4240,%ebx
  sub    $0x18,%rsp
  call   <tic@plt>
  movsd  %xmm0,0x8(%rsp)
  jmp    L4
  xchg   %ax,%ax
L12:
  sub    $0x1,%ebx
  je     L26
L4:
  xor    %eax,%eax
  call   <rand_double@plt>
  mulsd  D23(%rip),%xmm0
  subsd  D1(%rip),%xmm0
  call   <tanh@plt>
  ucomisd %xmm0,%xmm0
  jnp    L12
  lea    D29(%rip),%rbp
  mov    %rbp,%rdi
  call   <printf@plt>
  xor    %eax,%eax
  call   <tic@plt>
  subsd  0x8(%rsp),%xmm0
  mov    %rbp,%rdi
  movsd  %xmm0,0x8(%rsp)
  call   <printf@plt>
  movsd  0x8(%rsp),%xmm0
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  ret
  xchg   %ax,%ax
L26:
  xor    %eax,%eax
  call   <tic@plt>
  subsd  0x8(%rsp),%xmm0
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D23
type_infered: f64
name: extract_symbolic_data
arguments: data_label: D1
type_infered: f64
name: extract_symbolic_data
arguments: data_label: D29
type_infered: string

tool: D23: 10

tool: D1: 5

tool: D29: should not return NaN


assistant: ```c
double benchmark() {
  double elapsed;
  double x;
  double y;
  double t;
  int i;
  t = tic();
  for (i = 0; i < 1000000; i++) {
    x = (rand_double() * 10.0) - 5.0;
    y = tanh(x);
    if (y != y) {
      printf("should not return NaN\n");
      break;
    }
  }
  elapsed = tic() - t;
  if (y != y) {
    printf("should not return NaN\n");
  }
  return elapsed;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<benchmark>:
  endbr64
  push   %rbp
  xor    %eax,%eax
  push   %rbx
  mov    $0xf4240,%ebx
  sub    $0x18,%rsp
  call   <tic@plt>
  movsd  %xmm0,0x8(%rsp)
  jmp    L21
  xchg   %ax,%ax
L27:
  sub    $0x1,%ebx
  je     L17
L21:
  xor    %eax,%eax
  call   <rand_double@plt>
  mulsd  D10(%rip),%xmm0
  subsd  D12(%rip),%xmm0
  call   <tanh@plt>
  ucomisd %xmm0,%xmm0
  jnp    L27
  lea    D21(%rip),%rbp
  mov    %rbp,%rdi
  call   <printf@plt>
  xor    %eax,%eax
  call   <tic@plt>
  subsd  0x8(%rsp),%xmm0
  mov    %rbp,%rdi
  movsd  %xmm0,0x8(%rsp)
  call   <printf@plt>
  movsd  0x8(%rsp),%xmm0
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  ret
  xchg   %ax,%ax
L17:
  xor    %eax,%eax
  call   <tic@plt>
  subsd  0x8(%rsp),%xmm0
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

tool_calls: name: disassemble_data
arguments: label: D10
type_infered: f64
name: disassemble_data
arguments: label: D12
type_infered: f64
name: disassemble_data
arguments: label: D21
type_infered: string

tool: D10: 10

tool: D12: 5

tool: D21: should not return NaN


assistant: ```c
double benchmark() {
  double elapsed;
  double x;
  double y;
  double t;
  int i;
  t = tic();
  for (i = 0; i < 1000000; i++) {
    x = (rand_double() * 10.0) - 5.0;
    y = tanh(x);
    if (y != y) {
      printf("should not return NaN\n");
      break;
    }
  }
  elapsed = tic() - t;
  if (y != y) {
    printf("should not return NaN\n");
  }
  return elapsed;
}
```
user: What is the c source code of the assembly code below:

```asm
<Window_With_Name>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x10(%rbp)
  lea    -0x18(%rbp),%rdx
  mov    -0x40(%rbp),%rcx
  mov    -0x38(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <XFetchName@plt>
  test   %rax,%rax
  je     L78
  mov    -0x18(%rbp),%rax
  mov    -0x48(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L78
  mov    -0x40(%rbp),%rax
  jmp    L104
L78:
  lea    -0x30(%rbp),%r8
  lea    -0x28(%rbp),%rdi
  lea    -0x20(%rbp),%rcx
  lea    -0x20(%rbp),%rdx
  mov    -0x40(%rbp),%rsi
  mov    -0x38(%rbp),%rax
  mov    %r8,%r9
  mov    %rdi,%r8
  mov    %rax,%rdi
  call   <XQueryTree@plt>
  test   %eax,%eax
  jne    L40
  mov    $0x0,%eax
  jmp    L104
L40:
  movl   $0x0,-0x2c(%rbp)
  jmp    L13
L20:
  mov    -0x28(%rbp),%rdx
  mov    -0x2c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rdx,%rax
  mov    (%rax),%rcx
  mov    -0x48(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <Window_With_Name>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L100
  addl   $0x1,-0x2c(%rbp)
L13:
  mov    -0x2c(%rbp),%edx
  mov    -0x30(%rbp),%eax
  cmp    %eax,%edx
  jb     L20
  jmp    L62
L100:
  nop
L62:
  mov    -0x28(%rbp),%rax
  test   %rax,%rax
  je     L82
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <XFree@plt>
L82:
  mov    -0x10(%rbp),%rax
L104:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L53
  call   <__stack_chk_fail@plt>
L53:
  leave
  ret
```

assistant: ```c
Window Window_With_Name(Display *dpy, Window top, char *name) {
  Window *children, dummy;
  unsigned int nchildren;
  int i;
  Window w = 0;
  char *window_name;
  if (XFetchName(dpy, top, &window_name) && !strcmp(window_name, name))
    return (top);
  if (!XQueryTree(dpy, top, &dummy, &dummy, &children, &nchildren))
    return (0);
  for (i = 0; i < nchildren; i++) {
    w = Window_With_Name(dpy, children[i], name);
    if (w)
      break;
  }
  if (children)
    XFree((char *)children);
  return (w);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<Window_With_Name>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,%r12
  mov    %rsi,%rbx
  mov    %rdx,%r13
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0x20(%rsp),%rdx
  call   <XFetchName@plt>
  test   %rax,%rax
  je     L49
  mov    %r13,%rsi
  mov    0x20(%rsp),%rdi
  call   <strcmp@plt>
  mov    %rbx,%rbp
  test   %eax,%eax
  je     L26
L49:
  lea    0x18(%rsp),%rdx
  lea    0xc(%rsp),%r9
  lea    0x10(%rsp),%r8
  mov    %rdx,%rcx
  mov    %rbx,%rsi
  mov    %r12,%rdi
  call   <XQueryTree@plt>
  mov    $0x0,%ebp
  test   %eax,%eax
  je     L26
  cmpl   $0x0,0xc(%rsp)
  je     L69
  mov    $0x0,%ebx
  jmp    L21
L66:
  add    $0x1,%rbx
  cmp    %ebx,0xc(%rsp)
  jbe    L67
L21:
  mov    0x10(%rsp),%rax
  mov    (%rax,%rbx,8),%rsi
  mov    %r13,%rdx
  mov    %r12,%rdi
  call   <Window_With_Name>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L66
L67:
  mov    0x10(%rsp),%rdi
  test   %rdi,%rdi
  je     L26
  call   <XFree@plt>
L26:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L53
  mov    %rbp,%rax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L69:
  mov    $0x0,%ebp
  jmp    L67
L53:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
Window Window_With_Name(Display *dpy, Window top, char *name) {
  Window *children, dummy;
  unsigned int nchildren;
  int i;
  Window w = 0;
  char *window_name;
  if (XFetchName(dpy, top, &window_name) && !strcmp(window_name, name))
    return (top);
  if (!XQueryTree(dpy, top, &dummy, &dummy, &children, &nchildren))
    return (0);
  for (i = 0; i < nchildren; i++) {
    w = Window_With_Name(dpy, children[i], name);
    if (w)
      break;
  }
  if (children)
    XFree((char *)children);
  return (w);
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<Window_With_Name>:
  endbr64
  push   %r14
  mov    %rdx,%r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0x20(%rsp),%rdx
  call   <XFetchName@plt>
  test   %rax,%rax
  je     L36
  mov    0x20(%rsp),%rdi
  mov    %r14,%rsi
  mov    %r13,%r12
  call   <strcmp@plt>
  test   %eax,%eax
  je     L70
L36:
  lea    0x18(%rsp),%rdx
  lea    0xc(%rsp),%r9
  mov    %r13,%rsi
  mov    %rbp,%rdi
  lea    0x10(%rsp),%r8
  mov    %rdx,%rcx
  xor    %r12d,%r12d
  call   <XQueryTree@plt>
  test   %eax,%eax
  je     L70
  mov    0xc(%rsp),%eax
  test   %eax,%eax
  je     L29
  xor    %ebx,%ebx
L21:
  mov    0x10(%rsp),%rax
  mov    %r14,%rdx
  mov    %rbp,%rdi
  mov    (%rax,%rbx,8),%rsi
  call   <Window_With_Name>
  mov    %rax,%r12
  test   %rax,%rax
  jne    L77
  add    $0x1,%rbx
  cmp    %ebx,0xc(%rsp)
  ja     L21
L29:
  xor    %r12d,%r12d
L77:
  mov    0x10(%rsp),%rdi
  test   %rdi,%rdi
  je     L70
  call   <XFree@plt>
L70:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L75
  add    $0x30,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L75:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
Window Window_With_Name(Display *dpy, Window top, char *name) {
  Window *children, dummy;
  unsigned int nchildren;
  int i;
  Window w = 0;
  char *window_name;
  if (XFetchName(dpy, top, &window_name) && !strcmp(window_name, name))
    return (top);
  if (!XQueryTree(dpy, top, &dummy, &dummy, &children, &nchildren))
    return (0);
  for (i = 0; i < nchildren; i++) {
    w = Window_With_Name(dpy, children[i], name);
    if (w)
      break;
  }
  if (children)
    XFree((char *)children);
  return (w);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<Window_With_Name>:
  endbr64
  push   %r14
  mov    %rdx,%r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0x20(%rsp),%rdx
  call   <XFetchName@plt>
  test   %rax,%rax
  je     L6
  mov    0x20(%rsp),%rdi
  mov    %r14,%rsi
  mov    %r13,%r12
  call   <strcmp@plt>
  test   %eax,%eax
  je     L74
L6:
  lea    0x18(%rsp),%rdx
  lea    0xc(%rsp),%r9
  mov    %r13,%rsi
  mov    %rbp,%rdi
  lea    0x10(%rsp),%r8
  mov    %rdx,%rcx
  xor    %r12d,%r12d
  call   <XQueryTree@plt>
  test   %eax,%eax
  je     L74
  mov    0xc(%rsp),%eax
  test   %eax,%eax
  je     L37
  xor    %ebx,%ebx
L56:
  mov    0x10(%rsp),%rax
  mov    %r14,%rdx
  mov    %rbp,%rdi
  mov    (%rax,%rbx,8),%rsi
  call   <Window_With_Name>
  mov    %rax,%r12
  test   %rax,%rax
  jne    L40
  add    $0x1,%rbx
  cmp    %ebx,0xc(%rsp)
  ja     L56
L37:
  xor    %r12d,%r12d
L40:
  mov    0x10(%rsp),%rdi
  test   %rdi,%rdi
  je     L74
  call   <XFree@plt>
L74:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L25
  add    $0x30,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L25:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
Window Window_With_Name(Display *dpy, Window top, char *name) {
  Window *children, dummy;
  unsigned int nchildren;
  int i;
  Window w = 0;
  char *window_name;
  if (XFetchName(dpy, top, &window_name) && !strcmp(window_name, name))
    return (top);
  if (!XQueryTree(dpy, top, &dummy, &dummy, &children, &nchildren))
    return (0);
  for (i = 0; i < nchildren; i++) {
    w = Window_With_Name(dpy, children[i], name);
    if (w)
      break;
  }
  if (children)
    XFree((char *)children);
  return (w);
}
```