ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Demonstrate the C code that generates the assembly output below:

```asm
<i2c_write_leuint64_array>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x28,%rsp
  mov    %edi,-0x4c(%rbp)
  mov    %esi,-0x50(%rbp)
  mov    %edx,%ebx
  mov    %rcx,%r14
  mov    %r8,%r13
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  lea    0x1(,%r8,8),%rax
  mov    %rax,-0x48(%rbp)
  mov    %rax,%rdi
  call   <alloca@plt>
  mov    %rax,%r15
  mov    %ebx,(%rax)
  test   %r13,%r13
  je     L21
  lea    0x4(%rax),%r12
  mov    $0x0,%ebx
L3:
  mov    (%r14,%rbx,8),%rsi
  mov    %r12,%rdi
  call   <__wleu64@plt>
  add    $0x1,%rbx
  add    $0x20,%r12
  cmp    %r13,%rbx
  jne    L3
L21:
  mov    $0x0,%r8d
  mov    -0x48(%rbp),%rcx
  mov    %r15,%rdx
  mov    -0x50(%rbp),%esi
  mov    -0x4c(%rbp),%edi
  call   <i2c_transact@plt>
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  jne    L20
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L20:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int i2c_write_leuint64_array(int fd, int chip_addr, int reg, uint64_t *values, size_t count) {
  int sz = sizeof(uint64_t);
  uint8_t *data = (uint8_t *)alloca(count * sz + 1);
  data[0] = reg;
  for (int i = 0; i < count; i++)
    __wleu64(&data[1 + i * sz], (uint64_t)values[i]);
  return i2c_transact(fd, chip_addr, data, count * sz + 1, 0);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<i2c_write_leuint64_array>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  mov    %edx,%r14d
  push   %r13
  push   %r12
  mov    %rcx,%r12
  push   %rbx
  mov    %r8,%rbx
  sub    $0x28,%rsp
  mov    %edi,-0x4c(%rbp)
  mov    %esi,-0x50(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  lea    0x1(,%r8,8),%rax
  mov    %rax,%rdi
  mov    %rax,-0x48(%rbp)
  call   <alloca@plt>
  mov    %r14d,(%rax)
  mov    %rax,%r13
  test   %rbx,%rbx
  je     L12
  lea    0x4(%rax),%r15
  xor    %r14d,%r14d
  nopl   0x0(%rax)
L10:
  mov    (%r12,%r14,8),%rsi
  mov    %r15,%rdi
  add    $0x1,%r14
  add    $0x20,%r15
  call   <__wleu64@plt>
  cmp    %r14,%rbx
  jne    L10
L12:
  mov    -0x48(%rbp),%rcx
  mov    -0x50(%rbp),%esi
  xor    %r8d,%r8d
  mov    %r13,%rdx
  mov    -0x4c(%rbp),%edi
  call   <i2c_transact@plt>
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  jne    L18
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L18:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int i2c_write_leuint64_array(int fd, int chip_addr, int reg, uint64_t *values, size_t count) {
  int sz = sizeof(uint64_t);
  uint8_t *data = (uint8_t *)alloca(count * sz + 1);
  data[0] = reg;
  for (int i = 0; i < count; i++)
    __wleu64(&data[1 + i * sz], (uint64_t)values[i]);
  return i2c_transact(fd, chip_addr, data, count * sz + 1, 0);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<i2c_write_leuint64_array>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  mov    %edx,%r14d
  push   %r13
  push   %r12
  mov    %rcx,%r12
  push   %rbx
  mov    %r8,%rbx
  sub    $0x28,%rsp
  mov    %edi,-0x4c(%rbp)
  mov    %esi,-0x50(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  lea    0x1(,%r8,8),%rax
  mov    %rax,%rdi
  mov    %rax,-0x48(%rbp)
  call   <alloca@plt>
  mov    %r14d,(%rax)
  mov    %rax,%r13
  test   %rbx,%rbx
  je     L25
  lea    0x4(%rax),%r15
  xor    %r14d,%r14d
  nopl   0x0(%rax)
L21:
  mov    (%r12,%r14,8),%rsi
  mov    %r15,%rdi
  add    $0x1,%r14
  add    $0x20,%r15
  call   <__wleu64@plt>
  cmp    %r14,%rbx
  jne    L21
L25:
  mov    -0x48(%rbp),%rcx
  mov    -0x50(%rbp),%esi
  xor    %r8d,%r8d
  mov    %r13,%rdx
  mov    -0x4c(%rbp),%edi
  call   <i2c_transact@plt>
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  jne    L3
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L3:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int i2c_write_leuint64_array(int fd, int chip_addr, int reg, uint64_t *values, size_t count) {
  int sz = sizeof(uint64_t);
  uint8_t *data = (uint8_t *)alloca(count * sz + 1);
  data[0] = reg;
  for (int i = 0; i < count; i++)
    __wleu64(&data[1 + i * sz], (uint64_t)values[i]);
  return i2c_transact(fd, chip_addr, data, count * sz + 1, 0);
}
```
user: Translate the below assembly code into C programming language:

```asm
<is_ris_tag>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <isupper@plt>
  test   %rax,%rax
  jne    L85
  mov    $0x0,%eax
  jmp    L108
L85:
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <isupper@plt>
  test   %rax,%rax
  jne    L30
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L30
  mov    $0x0,%eax
  jmp    L108
L30:
  mov    -0x8(%rbp),%rax
  add    $0x2,%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  je     L207
  mov    $0x0,%eax
  jmp    L108
L207:
  mov    -0x8(%rbp),%rax
  add    $0x3,%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  je     L57
  mov    $0x0,%eax
  jmp    L108
L57:
  mov    -0x8(%rbp),%rax
  add    $0x4,%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  jne    L200
  mov    -0x8(%rbp),%rax
  add    $0x5,%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  je     L167
  mov    -0x8(%rbp),%rax
  add    $0x5,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L167
  mov    -0x8(%rbp),%rax
  add    $0x5,%rax
  movzbl (%rax),%eax
  cmp    $0xa,%al
  je     L167
  mov    -0x8(%rbp),%rax
  add    $0x5,%rax
  movzbl (%rax),%eax
  cmp    $0xd,%al
  jne    L89
L167:
  mov    $0x1,%eax
  jmp    L108
L200:
  mov    -0x8(%rbp),%rax
  add    $0x4,%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  jne    L89
  mov    -0x8(%rbp),%rax
  add    $0x5,%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  je     L99
  mov    $0x0,%eax
  jmp    L108
L99:
  mov    -0x8(%rbp),%rax
  add    $0x6,%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  je     L2
  mov    -0x8(%rbp),%rax
  add    $0x6,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L2
  mov    -0x8(%rbp),%rax
  add    $0x6,%rax
  movzbl (%rax),%eax
  cmp    $0xa,%al
  je     L2
  mov    -0x8(%rbp),%rax
  add    $0x6,%rax
  movzbl (%rax),%eax
  cmp    $0xd,%al
  jne    L89
L2:
  mov    $0x1,%eax
  jmp    L108
L89:
  mov    $0x0,%eax
L108:
  leave
  ret
```

assistant: ```c
int is_ris_tag(const char *buf) {
  if (!isupper((unsigned char)buf[0]))
    return 0;
  if (!(isupper((unsigned char)buf[1]) || isdigit((unsigned char)buf[1])))
    return 0;
  if (buf[2] != ' ')
    return 0;
  if (buf[3] != ' ')
    return 0;
  if (buf[4] == '-') {
    if (buf[5] == ' ' || buf[5] == '\0' || buf[5] == '\n' || buf[5] == '\r')
      return 1;
  } else if (buf[4] == ' ') {
    if (buf[5] != '-')
      return 0;
    if (buf[6] == ' ' || buf[6] == '\0' || buf[6] == '\n' || buf[6] == '\r')
      return 1;
  }
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<is_ris_tag>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  movzbl (%rdi),%edi
  call   <isupper@plt>
  mov    %rax,%rdx
  mov    $0x0,%eax
  test   %rdx,%rdx
  jne    L87
L3:
  pop    %rbx
  ret
L87:
  movzbl 0x1(%rbx),%edi
  call   <isupper@plt>
  test   %rax,%rax
  je     L47
L21:
  mov    $0x0,%eax
  cmpb   $0x20,0x2(%rbx)
  jne    L3
  cmpb   $0x20,0x3(%rbx)
  jne    L3
  movzbl 0x4(%rbx),%edx
  cmp    $0x2d,%dl
  je     L89
  mov    $0x0,%eax
  cmp    $0x20,%dl
  jne    L3
  cmpb   $0x2d,0x5(%rbx)
  jne    L3
  movzbl 0x6(%rbx),%ecx
  mov    $0x1,%eax
  cmp    $0x20,%cl
  ja     L36
  movabs $0x100002401,%rax
  shr    %cl,%rax
  xor    $0x1,%rax
  and    $0x1,%eax
L36:
  xor    $0x1,%eax
  movzbl %al,%eax
  jmp    L3
L47:
  movzbl 0x1(%rbx),%edi
  call   <isdigit@plt>
  mov    %rax,%rdx
  mov    $0x0,%eax
  test   %rdx,%rdx
  jne    L21
  jmp    L3
L89:
  movzbl 0x5(%rbx),%ecx
  mov    $0x1,%eax
  cmp    $0x20,%cl
  ja     L40
  movabs $0x100002401,%rax
  shr    %cl,%rax
  xor    $0x1,%rax
  and    $0x1,%eax
L40:
  xor    $0x1,%eax
  movzbl %al,%eax
  jmp    L3
```

assistant: ```c
int is_ris_tag(const char *buf) {
  if (!isupper((unsigned char)buf[0]))
    return 0;
  if (!(isupper((unsigned char)buf[1]) || isdigit((unsigned char)buf[1])))
    return 0;
  if (buf[2] != ' ')
    return 0;
  if (buf[3] != ' ')
    return 0;
  if (buf[4] == '-') {
    if (buf[5] == ' ' || buf[5] == '\0' || buf[5] == '\n' || buf[5] == '\r')
      return 1;
  } else if (buf[4] == ' ') {
    if (buf[5] != '-')
      return 0;
    if (buf[6] == ' ' || buf[6] == '\0' || buf[6] == '\n' || buf[6] == '\r')
      return 1;
  }
  return 0;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<is_ris_tag>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  movzbl (%rdi),%edi
  call   <isupper@plt>
  test   %rax,%rax
  jne    L97
L94:
  xor    %eax,%eax
L86:
  pop    %rbx
  ret
  nopl   0x0(%rax)
L97:
  movzbl 0x1(%rbx),%edi
  call   <isupper@plt>
  test   %rax,%rax
  je     L3
L35:
  cmpb   $0x20,0x2(%rbx)
  jne    L94
  cmpb   $0x20,0x3(%rbx)
  jne    L94
  movzbl 0x4(%rbx),%eax
  cmp    $0x2d,%al
  je     L69
  cmp    $0x20,%al
  jne    L94
  cmpb   $0x2d,0x5(%rbx)
  jne    L94
  movzbl 0x6(%rbx),%ecx
  xor    %eax,%eax
  cmp    $0x20,%cl
  ja     L86
L33:
  movabs $0xfffffffeffffdbfe,%rax
  pop    %rbx
  sar    %cl,%rax
  and    $0x1,%eax
  xor    $0x1,%eax
  movzbl %al,%eax
  ret
  nop
L3:
  movzbl 0x1(%rbx),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L35
  xor    %eax,%eax
  jmp    L86
  nopw   0x0(%rax,%rax,1)
L69:
  movzbl 0x5(%rbx),%ecx
  xor    %eax,%eax
  cmp    $0x20,%cl
  jbe    L33
  pop    %rbx
  ret
```

assistant: ```c
int is_ris_tag(const char *buf) {
  if (!isupper((unsigned char)buf[0]))
    return 0;
  if (!(isupper((unsigned char)buf[1]) || isdigit((unsigned char)buf[1])))
    return 0;
  if (buf[2] != ' ')
    return 0;
  if (buf[3] != ' ')
    return 0;
  if (buf[4] == '-') {
    if (buf[5] == ' ' || buf[5] == '\0' || buf[5] == '\n' || buf[5] == '\r')
      return 1;
  } else if (buf[4] == ' ') {
    if (buf[5] != '-')
      return 0;
    if (buf[6] == ' ' || buf[6] == '\0' || buf[6] == '\n' || buf[6] == '\r')
      return 1;
  }
  return 0;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<is_ris_tag>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  movzbl (%rdi),%edi
  call   <isupper@plt>
  test   %rax,%rax
  jne    L104
L48:
  xor    %eax,%eax
L49:
  pop    %rbx
  ret
  nopl   0x0(%rax)
L104:
  movzbl 0x1(%rbx),%edi
  call   <isupper@plt>
  test   %rax,%rax
  je     L19
L93:
  cmpb   $0x20,0x2(%rbx)
  jne    L48
  cmpb   $0x20,0x3(%rbx)
  jne    L48
  movzbl 0x4(%rbx),%eax
  cmp    $0x2d,%al
  je     L94
  cmp    $0x20,%al
  jne    L48
  cmpb   $0x2d,0x5(%rbx)
  jne    L48
  movzbl 0x6(%rbx),%ecx
  xor    %eax,%eax
  cmp    $0x20,%cl
  ja     L49
L92:
  movabs $0xfffffffeffffdbfe,%rax
  pop    %rbx
  sar    %cl,%rax
  and    $0x1,%eax
  xor    $0x1,%eax
  movzbl %al,%eax
  ret
  nop
L19:
  movzbl 0x1(%rbx),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L93
  xor    %eax,%eax
  jmp    L49
  nopw   0x0(%rax,%rax,1)
L94:
  movzbl 0x5(%rbx),%ecx
  xor    %eax,%eax
  cmp    $0x20,%cl
  jbe    L92
  pop    %rbx
  ret
```

assistant: ```c
int is_ris_tag(const char *buf) {
  if (!isupper((unsigned char)buf[0]))
    return 0;
  if (!(isupper((unsigned char)buf[1]) || isdigit((unsigned char)buf[1])))
    return 0;
  if (buf[2] != ' ')
    return 0;
  if (buf[3] != ' ')
    return 0;
  if (buf[4] == '-') {
    if (buf[5] == ' ' || buf[5] == '\0' || buf[5] == '\n' || buf[5] == '\r')
      return 1;
  } else if (buf[4] == ' ') {
    if (buf[5] != '-')
      return 0;
    if (buf[6] == ' ' || buf[6] == '\0' || buf[6] == '\n' || buf[6] == '\r')
      return 1;
  }
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<same_encoding>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <is_encoding_utf8@plt>
  test   %rax,%rax
  je     L8
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <is_encoding_utf8@plt>
  test   %rax,%rax
  je     L8
  mov    $0x1,%eax
  jmp    L9
L8:
  mov    -0x10(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcasecmp@plt>
  test   %eax,%eax
  sete   %al
  movzbl %al,%eax
L9:
  leave
  ret
```

assistant: ```c
int same_encoding(const char *src, const char *dst) {
  if (is_encoding_utf8(src) && is_encoding_utf8(dst))
    return 1;
  return !strcasecmp(src, dst);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<same_encoding>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  mov    %rsi,%rbp
  call   <is_encoding_utf8@plt>
  test   %rax,%rax
  jne    L11
L2:
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <strcasecmp@plt>
  test   %eax,%eax
  sete   %al
  movzbl %al,%eax
L1:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L11:
  mov    %rbp,%rdi
  call   <is_encoding_utf8@plt>
  mov    %rax,%rdx
  mov    $0x1,%eax
  test   %rdx,%rdx
  je     L2
  jmp    L1
```

assistant: ```c
int same_encoding(const char *src, const char *dst) {
  if (is_encoding_utf8(src) && is_encoding_utf8(dst))
    return 1;
  return !strcasecmp(src, dst);
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<same_encoding>:
  endbr64
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x8,%rsp
  call   <is_encoding_utf8@plt>
  test   %rax,%rax
  jne    L13
L16:
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <strcasecmp@plt>
  test   %eax,%eax
  sete   %al
  add    $0x8,%rsp
  movzbl %al,%eax
  pop    %rbp
  pop    %r12
  ret
  cs nopw 0x0(%rax,%rax,1)
L13:
  mov    %r12,%rdi
  call   <is_encoding_utf8@plt>
  test   %rax,%rax
  je     L16
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
int same_encoding(const char *src, const char *dst) {
  if (is_encoding_utf8(src) && is_encoding_utf8(dst))
    return 1;
  return !strcasecmp(src, dst);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<same_encoding>:
  endbr64
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x8,%rsp
  call   <is_encoding_utf8@plt>
  test   %rax,%rax
  jne    L11
L10:
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <strcasecmp@plt>
  test   %eax,%eax
  sete   %al
  add    $0x8,%rsp
  movzbl %al,%eax
  pop    %rbp
  pop    %r12
  ret
  cs nopw 0x0(%rax,%rax,1)
L11:
  mov    %r12,%rdi
  call   <is_encoding_utf8@plt>
  test   %rax,%rax
  je     L10
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
int same_encoding(const char *src, const char *dst) {
  if (is_encoding_utf8(src) && is_encoding_utf8(dst))
    return 1;
  return !strcasecmp(src, dst);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  movl   $0x0,-0x4(%rbp)
  addl   $0x1,-0x4(%rbp)
  mov    $0x0,%eax
  pop    %rbp
  ret
```

assistant: ```c
main() {
  int i = 0;
  i++;
}
```
user: What is the c source code of the assembly code below?

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

assistant: ```c
main() {
  int i = 0;
  i++;
}
```
user: What would the C source look like for the assembly code provided here:

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

assistant: ```c
main() {
  int i = 0;
  i++;
}
```
user: 请从给定的汇编指令推导出C源代码：

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

assistant: ```c
main() {
  int i = 0;
  i++;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<zsleep_millisecond>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %edi,-0x24(%rbp)
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x1c(%rbp)
  mov    $0x0,%eax
  call   <zmillisecond@plt>
  mov    %rax,%rdx
  mov    -0x1c(%rbp),%eax
  cltq
  add    %rdx,%rax
  add    $0x1,%rax
  mov    %rax,-0x18(%rbp)
  jmp    L0
L10:
  mov    -0x1c(%rbp),%eax
  mov    %eax,%edx
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <poll@plt>
  mov    -0x18(%rbp),%rax
  mov    %eax,%ebx
  mov    $0x0,%eax
  call   <zmillisecond@plt>
  mov    %eax,%edx
  mov    %ebx,%eax
  sub    %edx,%eax
  mov    %eax,-0x1c(%rbp)
L0:
  cmpl   $0x0,-0x1c(%rbp)
  jg     L10
  nop
  nop
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
void zsleep_millisecond(int delay) {
  int left = delay;
  long end = zmillisecond() + left + 1;
  while (left > 0) {
    poll(0, 0, left);
    left = end - zmillisecond();
  }
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<zsleep_millisecond>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%ebx
  mov    $0x0,%eax
  call   <zmillisecond@plt>
  movslq %ebx,%rdx
  lea    0x1(%rdx,%rax,1),%rbp
  test   %ebx,%ebx
  jle    L6
L7:
  mov    %ebx,%edx
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <poll@plt>
  mov    $0x0,%eax
  call   <zmillisecond@plt>
  mov    %ebp,%ebx
  sub    %eax,%ebx
  test   %ebx,%ebx
  jg     L7
L6:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
void zsleep_millisecond(int delay) {
  int left = delay;
  long end = zmillisecond() + left + 1;
  while (left > 0) {
    poll(0, 0, left);
    left = end - zmillisecond();
  }
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<zsleep_millisecond>:
  endbr64
  push   %rbx
  xor    %eax,%eax
  sub    $0x10,%rsp
  mov    %edi,0xc(%rsp)
  call   <zmillisecond@plt>
  mov    0xc(%rsp),%edx
  lea    0x1(%rdx,%rax,1),%ebx
  test   %edx,%edx
  jle    L7
L11:
  xor    %esi,%esi
  xor    %edi,%edi
  call   <poll@plt>
  xor    %eax,%eax
  call   <zmillisecond@plt>
  mov    %ebx,%edx
  sub    %eax,%edx
  test   %edx,%edx
  jg     L11
L7:
  add    $0x10,%rsp
  pop    %rbx
  ret
```

assistant: ```c
void zsleep_millisecond(int delay) {
  int left = delay;
  long end = zmillisecond() + left + 1;
  while (left > 0) {
    poll(0, 0, left);
    left = end - zmillisecond();
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<zsleep_millisecond>:
  endbr64
  push   %rbx
  xor    %eax,%eax
  sub    $0x10,%rsp
  mov    %edi,0xc(%rsp)
  call   <zmillisecond@plt>
  mov    0xc(%rsp),%edx
  lea    0x1(%rdx,%rax,1),%ebx
  test   %edx,%edx
  jle    L12
L9:
  xor    %esi,%esi
  xor    %edi,%edi
  call   <poll@plt>
  xor    %eax,%eax
  call   <zmillisecond@plt>
  mov    %ebx,%edx
  sub    %eax,%edx
  test   %edx,%edx
  jg     L9
L12:
  add    $0x10,%rsp
  pop    %rbx
  ret
```

assistant: ```c
void zsleep_millisecond(int delay) {
  int left = delay;
  long end = zmillisecond() + left + 1;
  while (left > 0) {
    poll(0, 0, left);
    left = end - zmillisecond();
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<map2MP3Frequency>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x4(%rbp)
  cmpl   $0x1f40,-0x4(%rbp)
  jg     L67
  mov    $0x1f40,%eax
  jmp    L28
L67:
  cmpl   $0x2b11,-0x4(%rbp)
  jg     L116
  mov    $0x2b11,%eax
  jmp    L28
L116:
  cmpl   $0x2ee0,-0x4(%rbp)
  jg     L131
  mov    $0x2ee0,%eax
  jmp    L28
L131:
  cmpl   $0x3e80,-0x4(%rbp)
  jg     L133
  mov    $0x3e80,%eax
  jmp    L28
L133:
  cmpl   $0x5622,-0x4(%rbp)
  jg     L85
  mov    $0x5622,%eax
  jmp    L28
L85:
  cmpl   $0x5dc0,-0x4(%rbp)
  jg     L40
  mov    $0x5dc0,%eax
  jmp    L28
L40:
  cmpl   $0x7d00,-0x4(%rbp)
  jg     L132
  mov    $0x7d00,%eax
  jmp    L28
L132:
  cmpl   $0xac44,-0x4(%rbp)
  jg     L29
  mov    $0xac44,%eax
  jmp    L28
L29:
  mov    $0xbb80,%eax
L28:
  pop    %rbp
  ret
```

assistant: ```c
int map2MP3Frequency(int freq) {
  if (freq <= 8000)
    return 8000;
  if (freq <= 11025)
    return 11025;
  if (freq <= 12000)
    return 12000;
  if (freq <= 16000)
    return 16000;
  if (freq <= 22050)
    return 22050;
  if (freq <= 24000)
    return 24000;
  if (freq <= 32000)
    return 32000;
  if (freq <= 44100)
    return 44100;
  return 48000;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<map2MP3Frequency>:
  endbr64
  mov    $0x1f40,%eax
  cmp    $0x1f40,%edi
  jle    L25
  mov    $0x2b11,%eax
  cmp    $0x2b11,%edi
  jle    L25
  mov    $0x2ee0,%eax
  cmp    $0x2ee0,%edi
  jle    L25
  mov    $0x3e80,%eax
  cmp    $0x3e80,%edi
  jle    L25
  mov    $0x5622,%eax
  cmp    $0x5622,%edi
  jle    L25
  mov    $0x5dc0,%eax
  cmp    $0x5dc0,%edi
  jle    L25
  mov    $0x7d00,%eax
  cmp    $0x7d00,%edi
  jle    L25
  cmp    $0xac44,%edi
  mov    $0xbb80,%eax
  mov    $0xac44,%edx
  cmovle %edx,%eax
L25:
  ret
```

assistant: ```c
int map2MP3Frequency(int freq) {
  if (freq <= 8000)
    return 8000;
  if (freq <= 11025)
    return 11025;
  if (freq <= 12000)
    return 12000;
  if (freq <= 16000)
    return 16000;
  if (freq <= 22050)
    return 22050;
  if (freq <= 24000)
    return 24000;
  if (freq <= 32000)
    return 32000;
  if (freq <= 44100)
    return 44100;
  return 48000;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<map2MP3Frequency>:
  endbr64
  mov    $0x1f40,%eax
  cmp    $0x1f40,%edi
  jle    L29
  mov    $0x2b11,%eax
  cmp    $0x2b11,%edi
  jle    L29
  mov    $0x2ee0,%eax
  cmp    $0x2ee0,%edi
  jle    L29
  mov    $0x3e80,%eax
  cmp    $0x3e80,%edi
  jle    L29
  mov    $0x5622,%eax
  cmp    $0x5622,%edi
  jle    L29
  mov    $0x5dc0,%eax
  cmp    $0x5dc0,%edi
  jle    L29
  mov    $0x7d00,%eax
  cmp    $0x7d00,%edi
  jle    L29
  cmp    $0xac44,%edi
  mov    $0xbb80,%eax
  mov    $0xac44,%edx
  cmovle %edx,%eax
L29:
  ret
```

assistant: ```c
int map2MP3Frequency(int freq) {
  if (freq <= 8000)
    return 8000;
  if (freq <= 11025)
    return 11025;
  if (freq <= 12000)
    return 12000;
  if (freq <= 16000)
    return 16000;
  if (freq <= 22050)
    return 22050;
  if (freq <= 24000)
    return 24000;
  if (freq <= 32000)
    return 32000;
  if (freq <= 44100)
    return 44100;
  return 48000;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<map2MP3Frequency>:
  endbr64
  mov    $0x1f40,%eax
  cmp    $0x1f40,%edi
  jle    L13
  mov    $0x2b11,%eax
  cmp    $0x2b11,%edi
  jle    L13
  mov    $0x2ee0,%eax
  cmp    $0x2ee0,%edi
  jle    L13
  mov    $0x3e80,%eax
  cmp    $0x3e80,%edi
  jle    L13
  mov    $0x5622,%eax
  cmp    $0x5622,%edi
  jle    L13
  mov    $0x5dc0,%eax
  cmp    $0x5dc0,%edi
  jle    L13
  mov    $0x7d00,%eax
  cmp    $0x7d00,%edi
  jle    L13
  cmp    $0xac44,%edi
  mov    $0xbb80,%eax
  mov    $0xac44,%edx
  cmovle %edx,%eax
L13:
  ret
```

assistant: ```c
int map2MP3Frequency(int freq) {
  if (freq <= 8000)
    return 8000;
  if (freq <= 11025)
    return 11025;
  if (freq <= 12000)
    return 12000;
  if (freq <= 16000)
    return 16000;
  if (freq <= 22050)
    return 22050;
  if (freq <= 24000)
    return 24000;
  if (freq <= 32000)
    return 32000;
  if (freq <= 44100)
    return 44100;
  return 48000;
}
```