ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<format_readable_mask>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdx,0x18(%rsp)
  mov    %rcx,0x10(%rsp)
  movb   $0x0,(%rdx)
  test   %esi,%esi
  je     L105
  movl   $0x1,0xc(%rsp)
  mov    %rdi,%r13
  mov    %esi,%ebp
  xor    %ebx,%ebx
  xor    %r14d,%r14d
  xor    %r15d,%r15d
  mov    $0x1,%r12d
  jmp    L96
  nopl   0x0(%rax)
L58:
  mov    %r15d,%edx
  mov    %cl,0xb(%rsp)
  and    $0x1,%edx
  test   %eax,%eax
  jne    L19
  test   %dl,%dl
  je     L19
  mov    0xc(%rsp),%r8d
  lea    -0x1(%rbx),%ecx
  lea    0x10(%rsp),%rsi
  mov    %r14d,%edx
  lea    0x18(%rsp),%rdi
  xor    %r15d,%r15d
  call   <write_range@plt>
  movl   $0x0,0xc(%rsp)
  movzbl 0xb(%rsp),%r9d
  mov    %eax,%r12d
L45:
  add    $0x1,%ebx
  test   %r12d,%r12d
  setne  %al
  cmp    %ebx,%ebp
  jbe    L68
L81:
  test   %al,%al
  je     L88
L96:
  mov    %ebx,%esi
  mov    %r13,%rdi
  call   <test_mask_bit@plt>
  mov    %r15d,%edx
  test   %eax,%eax
  setne  %cl
  xor    $0x1,%edx
  and    %dl,%cl
  mov    %ecx,%r9d
  je     L58
  mov    %ebx,%r14d
  add    $0x1,%ebx
  test   %r12d,%r12d
  mov    $0x1,%r15d
  setne  %al
  cmp    %ebx,%ebp
  ja     L81
L68:
  test   %al,%al
  je     L88
  test   %r9b,%r9b
  je     L88
  mov    0xc(%rsp),%r8d
  lea    -0x1(%rbp),%ecx
  lea    0x10(%rsp),%rsi
  mov    %r14d,%edx
  lea    0x18(%rsp),%rdi
  call   <write_range@plt>
  mov    %eax,%r12d
L88:
  add    $0x28,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L19:
  mov    %edx,%r9d
  jmp    L45
  nopl   0x0(%rax,%rax,1)
L105:
  mov    $0x1,%r12d
  jmp    L88
```

assistant: ```c
bool format_readable_mask(const struct filter_mask *mask, unsigned int fa_entry_count, char *string, size_t length) {
  bool ok = true;
  bool in_range = false;
  bool first = true;
  unsigned int range_start = 0;
  *string = '\0';
  for (unsigned int id = 0; ok && id < fa_entry_count; id++) {
    bool set = test_mask_bit(mask, id);
    if (set && !in_range) {
      in_range = true;
      range_start = id;
    } else if (!set && in_range) {
      ok = write_range(&string, &length, range_start, id - 1, first);
      in_range = false;
      first = false;
    }
  }
  if (ok && in_range)
    ok = write_range(&string, &length, range_start, fa_entry_count - 1, first);
  return ok;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0x0,%esi
  mov    $0x1,%edi
  call   <test@plt>
  mov    $0x0,%edi
  call   <exit@plt>
  mov    $0x0,%eax
  pop    %rbp
  ret
```

assistant: ```c
int main(void) {
  test(1, 0);
  exit(0);
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x0,%esi
  mov    $0x1,%edi
  call   <test@plt>
  mov    $0x0,%edi
  call   <exit@plt>
  mov    $0x0,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int main(void) {
  test(1, 0);
  exit(0);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  xor    %esi,%esi
  mov    $0x1,%edi
  call   <test@plt>
  xor    %edi,%edi
  call   <exit@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int main(void) {
  test(1, 0);
  exit(0);
}
```
user: What is the c source code of the assembly code below?

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  xor    %esi,%esi
  mov    $0x1,%edi
  call   <test@plt>
  xor    %edi,%edi
  call   <exit@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int main(void) {
  test(1, 0);
  exit(0);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<_Transfer>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x4(%rbp)
  mov    %esi,-0x8(%rbp)
  mov    %edx,-0xc(%rbp)
  mov    %rcx,-0x18(%rbp)
  mov    -0xc(%rbp),%edx
  mov    -0x8(%rbp),%ecx
  mov    -0x4(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <_CanTransfer@plt>
  test   %eax,%eax
  jne    L6
  mov    $0x1,%eax
  jmp    L17
L6:
  mov    -0x18(%rbp),%rcx
  mov    -0xc(%rbp),%edx
  mov    -0x8(%rbp),%esi
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <Bank_Transfer@plt>
L17:
  leave
  ret
```

assistant: ```c
int _Transfer(int Source, int Destination, int Ammount, const char *Reason) {
  if (!_CanTransfer(Source, Destination, Ammount))
    return 1;
  return Bank_Transfer(Source, Destination, Ammount, Reason);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<_Transfer>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%ebx
  mov    %esi,%ebp
  mov    %edx,%r12d
  mov    %rcx,%r13
  call   <_CanTransfer@plt>
  mov    %eax,%edx
  mov    $0x1,%eax
  test   %edx,%edx
  jne    L1
L12:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L1:
  mov    %r13,%rcx
  mov    %r12d,%edx
  mov    %ebp,%esi
  mov    %ebx,%edi
  call   <Bank_Transfer@plt>
  jmp    L12
```

assistant: ```c
int _Transfer(int Source, int Destination, int Ammount, const char *Reason) {
  if (!_CanTransfer(Source, Destination, Ammount))
    return 1;
  return Bank_Transfer(Source, Destination, Ammount, Reason);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<_Transfer>:
  endbr64
  push   %r14
  mov    %rcx,%r14
  push   %r13
  mov    %edx,%r13d
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  mov    %edi,%ebp
  sub    $0x8,%rsp
  call   <_CanTransfer@plt>
  test   %eax,%eax
  jne    L0
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L0:
  add    $0x8,%rsp
  mov    %r14,%rcx
  mov    %r13d,%edx
  mov    %r12d,%esi
  mov    %ebp,%edi
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  jmp    1060 <Bank_Transfer@plt>
```

assistant: ```c
int _Transfer(int Source, int Destination, int Ammount, const char *Reason) {
  if (!_CanTransfer(Source, Destination, Ammount))
    return 1;
  return Bank_Transfer(Source, Destination, Ammount, Reason);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<_Transfer>:
  endbr64
  push   %r14
  mov    %rcx,%r14
  push   %r13
  mov    %edx,%r13d
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  mov    %edi,%ebp
  sub    $0x8,%rsp
  call   <_CanTransfer@plt>
  test   %eax,%eax
  jne    L4
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L4:
  add    $0x8,%rsp
  mov    %r14,%rcx
  mov    %r13d,%edx
  mov    %r12d,%esi
  mov    %ebp,%edi
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  jmp    1060 <Bank_Transfer@plt>
```

assistant: ```c
int _Transfer(int Source, int Destination, int Ammount, const char *Reason) {
  if (!_CanTransfer(Source, Destination, Ammount))
    return 1;
  return Bank_Transfer(Source, Destination, Ammount, Reason);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<xmalloc>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L5
  lea    D1(%rip),%rax
  mov    %rax,%rdi
  call   <raiseerror@plt>
L5:
  mov    -0x8(%rbp),%rax
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D1
type_guessed: string

tool: D1: malloc returned NULL

assistant: ```c
void *xmalloc(size_t size) {
  void *p;
  p = malloc(size);
  if (p == NULL)
    raiseerror("malloc returned NULL");
  return p;
}
```
user: What is the c source code of the assembly code below?

```asm
<xmalloc>:
  endbr64
  push   %rbx
  call   <malloc@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L3
L0:
  mov    %rbx,%rax
  pop    %rbx
  ret
L3:
  lea    D7(%rip),%rdi
  call   <raiseerror@plt>
  jmp    L0
```

tool_calls: name: disassemble_data
arguments: label: D7
type_infered: string

tool: D7: malloc returned NULL

assistant: ```c
void *xmalloc(size_t size) {
  void *p;
  p = malloc(size);
  if (p == NULL)
    raiseerror("malloc returned NULL");
  return p;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<xmalloc>:
  endbr64
  push   %r12
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L18
L0:
  mov    %r12,%rax
  pop    %r12
  ret
L18:
  lea    D6(%rip),%rdi
  call   <raiseerror@plt>
  jmp    L0
```

tool_calls: name: retrieve_data
arguments: tag: D6
type: string

tool: D6: malloc returned NULL

assistant: ```c
void *xmalloc(size_t size) {
  void *p;
  p = malloc(size);
  if (p == NULL)
    raiseerror("malloc returned NULL");
  return p;
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<xmalloc>:
  endbr64
  push   %r12
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L12
L6:
  mov    %r12,%rax
  pop    %r12
  ret
L12:
  lea    D6(%rip),%rdi
  call   <raiseerror@plt>
  jmp    L6
```

tool_calls: name: parse_data
arguments: label: D6
type_guessed: string

tool: D6: malloc returned NULL

assistant: ```c
void *xmalloc(size_t size) {
  void *p;
  p = malloc(size);
  if (p == NULL)
    raiseerror("malloc returned NULL");
  return p;
}
```
user: What is the c source code of the assembly code below:

```asm
<ui_getaccel>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    $0x0,%eax
  call   <accel_get_status@plt>
  mov    %al,-0x5(%rbp)
  movzbl -0x5(%rbp),%eax
  mov    %eax,%esi
  lea    D20(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <armprintf@plt>
  movl   $0x0,-0x4(%rbp)
  jmp    L10
L6:
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <accel_get_output@plt>
  mov    %eax,%esi
  lea    D6(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <armprintf@plt>
  addl   $0x1,-0x4(%rbp)
L10:
  cmpl   $0x2,-0x4(%rbp)
  jle    L6
  lea    D25(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <armprintf@plt>
  nop
  leave
  ret
```

tool_calls: name: parse_data
arguments: tag: D20
type: string
name: parse_data
arguments: tag: D6
type: string
name: parse_data
arguments: tag: D25
type: string

tool: D20: Accelerometer status: %d 

tool: D6:  %d

tool: D25: 

assistant: ```c
void ui_getaccel(char *cmdstr) {
  int i;
  unsigned char status = accel_get_status();
  armprintf("Accelerometer status: %d ", status);
  for (i = 0; i < 3; i++)
    armprintf(" %d", accel_get_output(i));
  armprintf("\r");
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<ui_getaccel>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    $0x0,%eax
  call   <accel_get_status@plt>
  movzbl %al,%esi
  lea    D21(%rip),%rdi
  mov    $0x0,%eax
  call   <armprintf@plt>
  mov    $0x0,%ebx
  lea    D2(%rip),%rbp
L7:
  mov    %ebx,%edi
  call   <accel_get_output@plt>
  mov    %eax,%esi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <armprintf@plt>
  add    $0x1,%ebx
  cmp    $0x3,%ebx
  jne    L7
  lea    D12(%rip),%rdi
  mov    $0x0,%eax
  call   <armprintf@plt>
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

tool_calls: name: parse_data
arguments: label: D21
datatype: string
name: parse_data
arguments: label: D2
datatype: string
name: parse_data
arguments: label: D12
datatype: string

tool: D21: Accelerometer status: %d 

tool: D2:  %d

tool: D12: 

assistant: ```c
void ui_getaccel(char *cmdstr) {
  int i;
  unsigned char status = accel_get_status();
  armprintf("Accelerometer status: %d ", status);
  for (i = 0; i < 3; i++)
    armprintf(" %d", accel_get_output(i));
  armprintf("\r");
}
```
user: What is the c source code of the assembly code below?

```asm
<ui_getaccel>:
  endbr64
  push   %rbp
  xor    %eax,%eax
  lea    D20(%rip),%rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x8,%rsp
  call   <accel_get_status@plt>
  lea    D11(%rip),%rdi
  movzbl %al,%esi
  xor    %eax,%eax
  call   <armprintf@plt>
L7:
  mov    %ebx,%edi
  add    $0x1,%ebx
  call   <accel_get_output@plt>
  mov    %rbp,%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <armprintf@plt>
  cmp    $0x3,%ebx
  jne    L7
  add    $0x8,%rsp
  lea    D3(%rip),%rdi
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  jmp    1070 <armprintf@plt>
```

tool_calls: name: unpack_data
arguments: tag: D20
type_guessed: string
name: unpack_data
arguments: tag: D11
type_guessed: string
name: unpack_data
arguments: tag: D3
type_guessed: string

tool: D20:  %d

tool: D11: Accelerometer status: %d 

tool: D3: 

assistant: ```c
void ui_getaccel(char *cmdstr) {
  int i;
  unsigned char status = accel_get_status();
  armprintf("Accelerometer status: %d ", status);
  for (i = 0; i < 3; i++)
    armprintf(" %d", accel_get_output(i));
  armprintf("\r");
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<ui_getaccel>:
  endbr64
  push   %rbp
  xor    %eax,%eax
  lea    D13(%rip),%rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x8,%rsp
  call   <accel_get_status@plt>
  lea    D9(%rip),%rdi
  movzbl %al,%esi
  xor    %eax,%eax
  call   <armprintf@plt>
L7:
  mov    %ebx,%edi
  add    $0x1,%ebx
  call   <accel_get_output@plt>
  mov    %rbp,%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <armprintf@plt>
  cmp    $0x3,%ebx
  jne    L7
  add    $0x8,%rsp
  lea    D12(%rip),%rdi
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  jmp    1070 <armprintf@plt>
```

tool_calls: name: read_data
arguments: data_tag: D13
data_type: string
name: read_data
arguments: data_tag: D9
data_type: string
name: read_data
arguments: data_tag: D12
data_type: string

tool: D13:  %d

tool: D9: Accelerometer status: %d 

tool: D12: 

assistant: ```c
void ui_getaccel(char *cmdstr) {
  int i;
  unsigned char status = accel_get_status();
  armprintf("Accelerometer status: %d ", status);
  for (i = 0; i < 3; i++)
    armprintf(" %d", accel_get_output(i));
  armprintf("\r");
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<StripLeadingWhitespace>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  movq   $0x0,-0x8(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  je     L2
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  jmp    L54
L33:
  cmpq   $0x0,-0x8(%rbp)
  jne    L19
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isspace@plt>
  test   %eax,%eax
  jne    L19
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x8(%rbp)
L19:
  addq   $0x1,-0x10(%rbp)
L54:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L33
  cmpq   $0x0,-0x8(%rbp)
  jne    L22
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x8(%rbp)
L22:
  mov    -0x10(%rbp),%rax
  add    $0x1,%rax
  sub    -0x8(%rbp),%rax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memmove@plt>
  jmp    L56
L2:
  nop
L56:
  leave
  ret
```

assistant: ```c
void StripLeadingWhitespace(char *str) {
  char *ptr, *start = NULL;
  if (!str)
    return;
  for (ptr = str; *ptr != '\0'; ptr++) {
    if ((!start) && (!isspace(*ptr)))
      start = ptr;
  }
  if (!start)
    start = ptr;
  memmove(str, start, ptr + 1 - start);
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<StripLeadingWhitespace>:
  endbr64
  test   %rdi,%rdi
  je     L67
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r12
  movzbl (%rdi),%edi
  test   %dil,%dil
  je     L43
  mov    %r12,%rbx
  mov    $0x0,%ebp
  jmp    L35
L39:
  add    $0x1,%rbx
  movzbl (%rbx),%edi
  test   %dil,%dil
  je     L53
L35:
  test   %rbp,%rbp
  jne    L39
  movsbl %dil,%edi
  call   <isspace@plt>
  test   %eax,%eax
  cmove  %rbx,%rbp
  jmp    L39
L53:
  test   %rbp,%rbp
  cmove  %rbx,%rbp
L9:
  lea    0x1(%rbx),%rdx
  sub    %ebp,%edx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <memmove@plt>
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L43:
  mov    %r12,%rbx
  mov    %r12,%rbp
  jmp    L9
L67:
  ret
```

assistant: ```c
void StripLeadingWhitespace(char *str) {
  char *ptr, *start = NULL;
  if (!str)
    return;
  for (ptr = str; *ptr != '\0'; ptr++) {
    if ((!start) && (!isspace(*ptr)))
      start = ptr;
  }
  if (!start)
    start = ptr;
  memmove(str, start, ptr + 1 - start);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<StripLeadingWhitespace>:
  endbr64
  test   %rdi,%rdi
  je     L3
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  movsbl (%rdi),%edi
  test   %dil,%dil
  je     L2
  mov    %rbp,%rbx
  xor    %esi,%esi
  jmp    L7
  nopl   0x0(%rax)
L69:
  mov    %rdx,%rbx
L7:
  test   %rsi,%rsi
  je     L66
L82:
  movsbl 0x1(%rbx),%edi
  lea    0x1(%rbx),%rdx
  test   %dil,%dil
  jne    L69
L18:
  add    $0x8,%rsp
  add    $0x1,%rdx
  mov    %rbp,%rdi
  pop    %rbx
  sub    %esi,%edx
  pop    %rbp
  jmp    1070 <memmove@plt>
  nopl   0x0(%rax)
L66:
  call   <isspace@plt>
  test   %eax,%eax
  je     L24
  movsbl 0x1(%rbx),%edi
  add    $0x1,%rbx
  test   %dil,%dil
  jne    L66
  mov    %rbx,%rdx
  mov    %rbx,%rsi
  jmp    L18
  cs nopw 0x0(%rax,%rax,1)
L24:
  mov    %rbx,%rsi
  jmp    L82
  nopl   (%rax)
L3:
  ret
  nopl   0x0(%rax)
L2:
  mov    %rbp,%rdx
  mov    %rbp,%rsi
  jmp    L18
```

assistant: ```c
void StripLeadingWhitespace(char *str) {
  char *ptr, *start = NULL;
  if (!str)
    return;
  for (ptr = str; *ptr != '\0'; ptr++) {
    if ((!start) && (!isspace(*ptr)))
      start = ptr;
  }
  if (!start)
    start = ptr;
  memmove(str, start, ptr + 1 - start);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<StripLeadingWhitespace>:
  endbr64
  test   %rdi,%rdi
  je     L3
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  movsbl (%rdi),%edi
  test   %dil,%dil
  je     L89
  mov    %rbp,%rbx
  xor    %esi,%esi
L86:
  test   %rsi,%rsi
  je     L19
  cmpb   $0x0,0x1(%rbx)
  lea    0x1(%rbx),%rdx
  je     L75
L45:
  add    $0x1,%rdx
  cmpb   $0x0,(%rdx)
  jne    L45
L75:
  add    $0x8,%rsp
  add    $0x1,%rdx
  mov    %rbp,%rdi
  pop    %rbx
  sub    %esi,%edx
  pop    %rbp
  jmp    1070 <memmove@plt>
  nopl   0x0(%rax,%rax,1)
L19:
  call   <isspace@plt>
  test   %eax,%eax
  je     L102
  movsbl 0x1(%rbx),%edi
  add    $0x1,%rbx
  test   %dil,%dil
  jne    L19
  mov    %rbx,%rdx
  mov    %rbx,%rsi
  jmp    L75
  xchg   %ax,%ax
L102:
  movsbl 0x1(%rbx),%edi
  lea    0x1(%rbx),%rdx
  mov    %rbx,%rsi
  test   %dil,%dil
  je     L75
  mov    %rdx,%rbx
  jmp    L86
  nopl   (%rax)
L3:
  ret
  nopl   0x0(%rax)
L89:
  mov    %rbp,%rdx
  mov    %rbp,%rsi
  jmp    L75
```

assistant: ```c
void StripLeadingWhitespace(char *str) {
  char *ptr, *start = NULL;
  if (!str)
    return;
  for (ptr = str; *ptr != '\0'; ptr++) {
    if ((!start) && (!isspace(*ptr)))
      start = ptr;
  }
  if (!start)
    start = ptr;
  memmove(str, start, ptr + 1 - start);
}
```
user: Translate the below assembly code into C programming language:

```asm
<msleep>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
L23:
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x10624dd3,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x6,%edx
  sar    $0x1f,%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x10624dd3,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x6,%edx
  mov    %eax,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%edx
  imul   $0x3e8,%edx,%ecx
  sub    %ecx,%eax
  mov    %eax,%edx
  imul   $0x3e8,%edx,%eax
  mov    %eax,-0xc(%rbp)
  lea    -0x10(%rbp),%rax
  mov    %rax,%r8
  mov    $0x0,%ecx
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <select@plt>
  mov    %eax,-0x14(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  jns    L36
  mov    D5(%rip),%rax
  mov    (%rax),%rdx
  mov    D8(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  je     L23
L36:
  cmpl   $0x0,-0x14(%rbp)
  jns    L20
  mov    $0x0,%edi
  call   <error@plt>
L20:
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L35
  call   <__stack_chk_fail@plt>
L35:
  leave
  ret
```

assistant: ```c
void msleep(int ms) {
  struct timeval tv;
  int v;
  do {
    tv.tv_sec = ms / 1000;
    tv.tv_usec = (ms % 1000) * 1000;
    v = select(0, NULL, NULL, NULL, &tv);
  } while ((v < 0) && (errno == EINTR));
  if (v < 0)
    error(NULL);
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<msleep>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %edi,%ebx
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  movslq %edi,%rbp
  imul   $0x10624dd3,%rbp,%rbp
  sar    $0x26,%rbp
  mov    %edi,%eax
  sar    $0x1f,%eax
  sub    %eax,%ebp
  imul   $0x3e8,%ebp,%eax
  sub    %eax,%ebx
  imul   $0x3e8,%ebx,%ebx
  mov    %rsp,%r12
L17:
  mov    %ebp,(%rsp)
  mov    %ebx,0x4(%rsp)
  mov    %r12,%r8
  mov    $0x0,%ecx
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <select@plt>
  test   %eax,%eax
  jns    L18
  mov    D7(%rip),%rdx
  mov    D5(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,(%rdx)
  je     L17
  mov    $0x0,%edi
  call   <error@plt>
L18:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L19
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L19:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void msleep(int ms) {
  struct timeval tv;
  int v;
  do {
    tv.tv_sec = ms / 1000;
    tv.tv_usec = (ms % 1000) * 1000;
    v = select(0, NULL, NULL, NULL, &tv);
  } while ((v < 0) && (errno == EINTR));
  if (v < 0)
    error(NULL);
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<msleep>:
  endbr64
  push   %r12
  push   %rbp
  movslq %edi,%rbp
  push   %rbx
  mov    %rbp,%rbx
  imul   $0x10624dd3,%rbp,%rbp
  sub    $0x10,%rsp
  sar    $0x26,%rbp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %ebx,%eax
  mov    %rsp,%r12
  sar    $0x1f,%eax
  sub    %eax,%ebp
  imul   $0x3e8,%ebp,%eax
  sub    %eax,%ebx
  imul   $0x3e8,%ebx,%ebx
  jmp    L27
  nopw   0x0(%rax,%rax,1)
L38:
  mov    D6(%rip),%rax
  mov    D16(%rip),%rdx
  mov    (%rax),%rax
  cmp    %rax,(%rdx)
  jne    L21
L27:
  xor    %ecx,%ecx
  xor    %edx,%edx
  xor    %esi,%esi
  xor    %edi,%edi
  mov    %r12,%r8
  mov    %ebp,(%rsp)
  mov    %ebx,0x4(%rsp)
  call   <select@plt>
  test   %eax,%eax
  js     L38
L35:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L4
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopw   0x0(%rax,%rax,1)
L21:
  xor    %edi,%edi
  call   <error@plt>
  jmp    L35
L4:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void msleep(int ms) {
  struct timeval tv;
  int v;
  do {
    tv.tv_sec = ms / 1000;
    tv.tv_usec = (ms % 1000) * 1000;
    v = select(0, NULL, NULL, NULL, &tv);
  } while ((v < 0) && (errno == EINTR));
  if (v < 0)
    error(NULL);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<msleep>:
  endbr64
  push   %r14
  mov    %edi,%edx
  push   %rbx
  sar    $0x1f,%edx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  movslq %edi,%rax
  mov    %rsp,%rbx
  imul   $0x10624dd3,%rax,%rax
  sar    $0x26,%rax
  sub    %edx,%eax
  imul   $0x3e8,%eax,%edx
  movd   %eax,%xmm0
  sub    %edx,%edi
  imul   $0x3e8,%edi,%edi
  movd   %edi,%xmm1
  punpckldq %xmm1,%xmm0
  movq   %xmm0,%r14
  jmp    L38
  nopl   0x0(%rax)
L41:
  mov    D4(%rip),%rax
  mov    D7(%rip),%rdx
  mov    (%rax),%rax
  cmp    %rax,(%rdx)
  jne    L30
L38:
  xor    %ecx,%ecx
  xor    %edx,%edx
  xor    %esi,%esi
  xor    %edi,%edi
  mov    %rbx,%r8
  mov    %r14,(%rsp)
  call   <select@plt>
  test   %eax,%eax
  js     L41
L47:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L29
  add    $0x18,%rsp
  pop    %rbx
  pop    %r14
  ret
  xchg   %ax,%ax
L30:
  xor    %edi,%edi
  call   <error@plt>
  jmp    L47
L29:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void msleep(int ms) {
  struct timeval tv;
  int v;
  do {
    tv.tv_sec = ms / 1000;
    tv.tv_usec = (ms % 1000) * 1000;
    v = select(0, NULL, NULL, NULL, &tv);
  } while ((v < 0) && (errno == EINTR));
  if (v < 0)
    error(NULL);
}
```