ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<fread_endian>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r12
  mov    %rdx,%rbp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  cmp    $0x1,%esi
  je     L149
  mov    %esi,%ebx
  mov    %ecx,%r13d
  cmp    $0x2,%esi
  je     L38
  cmp    $0x4,%esi
  je     L88
  movb   $0x0,(%rdi)
  mov    $0x0,%eax
L21:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L177
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L149:
  lea    0x4(%rsp),%rdi
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    $0x1,%esi
  call   <fread@plt>
  cmp    $0x1,%eax
  jne    L97
  movzbl 0x4(%rsp),%edx
  mov    %dl,(%r12)
  jmp    L21
L38:
  lea    0x4(%rsp),%rdi
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    $0x1,%esi
  call   <fread@plt>
  cmp    $0x1,%eax
  jne    L57
  lea    0x5(%rsp),%rdi
  mov    %rbp,%rcx
  mov    $0x1,%edx
  mov    $0x1,%esi
  call   <fread@plt>
  cmp    $0x1,%eax
  jne    L190
  movzbl 0x5(%rsp),%esi
  movzbl 0x4(%rsp),%edi
  mov    %r13d,%edx
  call   <endian2@plt>
  mov    %al,(%r12)
  mov    %ebx,%eax
  jmp    L21
L88:
  lea    0x4(%rsp),%rdi
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    $0x1,%esi
  call   <fread@plt>
  cmp    $0x1,%eax
  jne    L18
  lea    0x5(%rsp),%rdi
  mov    %rbp,%rcx
  mov    $0x1,%edx
  mov    $0x1,%esi
  call   <fread@plt>
  cmp    $0x1,%eax
  jne    L123
  lea    0x6(%rsp),%rdi
  mov    %rbp,%rcx
  mov    $0x1,%edx
  mov    $0x1,%esi
  call   <fread@plt>
  cmp    $0x1,%eax
  jne    L195
  lea    0x7(%rsp),%rdi
  mov    %rbp,%rcx
  mov    $0x1,%edx
  mov    $0x1,%esi
  call   <fread@plt>
  cmp    $0x1,%eax
  jne    L84
  movzbl 0x7(%rsp),%ecx
  movzbl 0x6(%rsp),%edx
  movzbl 0x5(%rsp),%esi
  movzbl 0x4(%rsp),%edi
  mov    %r13d,%r8d
  call   <endian4@plt>
  mov    %al,(%r12)
  mov    %ebx,%eax
  jmp    L21
L97:
  mov    $0xffffffff,%eax
  jmp    L21
L57:
  mov    $0xffffffff,%eax
  jmp    L21
L190:
  mov    $0xffffffff,%eax
  jmp    L21
L18:
  mov    $0xffffffff,%eax
  jmp    L21
L123:
  mov    $0xffffffff,%eax
  jmp    L21
L195:
  mov    $0xffffffff,%eax
  jmp    L21
L84:
  mov    $0xffffffff,%eax
  jmp    L21
L177:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int fread_endian(ulong *x, int bytes, FILE *fp, int endian) {
  unsigned char u1, u2, u3, u4;
  if (bytes == 1) {
    if (fread(&u1, 1, 1, fp) != 1)
      return -1;
    *x = u1;
    return 1;
  } else if (bytes == 2) {
    if (fread(&u1, 1, 1, fp) != 1)
      return -1;
    if (fread(&u2, 1, 1, fp) != 1)
      return -1;
    *x = endian2(u1, u2, endian);
    return 2;
  } else if (bytes == 4) {
    if (fread(&u1, 1, 1, fp) != 1)
      return -1;
    if (fread(&u2, 1, 1, fp) != 1)
      return -1;
    if (fread(&u3, 1, 1, fp) != 1)
      return -1;
    if (fread(&u4, 1, 1, fp) != 1)
      return -1;
    *x = endian4(u1, u2, u3, u4, endian);
    return 4;
  } else {
    *x = 0;
    return 0;
  }
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<fread_endian>:
  endbr64
  push   %r13
  push   %r12
  mov    %rdx,%r12
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  cmp    $0x1,%esi
  je     L110
  mov    %ecx,%r13d
  cmp    $0x2,%esi
  je     L81
  cmp    $0x4,%esi
  je     L14
  movb   $0x0,(%rdi)
  xor    %eax,%eax
L3:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L65
  add    $0x10,%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  ret
L14:
  mov    %rdx,%rcx
  lea    0x4(%rsp),%rdi
  mov    $0x1,%edx
  mov    $0x1,%esi
  call   <fread@plt>
  cmp    $0x1,%eax
  jne    L67
  lea    0x5(%rsp),%rdi
  mov    %r12,%rcx
  mov    $0x1,%edx
  mov    $0x1,%esi
  call   <fread@plt>
  cmp    $0x1,%eax
  jne    L67
  lea    0x6(%rsp),%rdi
  mov    %r12,%rcx
  mov    $0x1,%edx
  mov    $0x1,%esi
  call   <fread@plt>
  cmp    $0x1,%eax
  jne    L67
  lea    0x7(%rsp),%rdi
  mov    %r12,%rcx
  mov    $0x1,%edx
  mov    $0x1,%esi
  call   <fread@plt>
  cmp    $0x1,%eax
  jne    L67
  movzbl 0x7(%rsp),%ecx
  movzbl 0x6(%rsp),%edx
  mov    %r13d,%r8d
  movzbl 0x5(%rsp),%esi
  movzbl 0x4(%rsp),%edi
  call   <endian4@plt>
  mov    %al,(%rbx)
  mov    $0x4,%eax
  jmp    L3
L110:
  mov    %rdx,%rcx
  lea    0x4(%rsp),%rdi
  mov    $0x1,%edx
  call   <fread@plt>
  cmp    $0x1,%eax
  jne    L67
  movzbl 0x4(%rsp),%edx
  mov    %dl,(%rbx)
  jmp    L3
  nopl   0x0(%rax,%rax,1)
L67:
  mov    $0xffffffff,%eax
  jmp    L3
  nopw   0x0(%rax,%rax,1)
L81:
  mov    %rdx,%rcx
  lea    0x4(%rsp),%rdi
  mov    $0x1,%edx
  mov    $0x1,%esi
  call   <fread@plt>
  cmp    $0x1,%eax
  jne    L67
  lea    0x5(%rsp),%rdi
  mov    %r12,%rcx
  mov    $0x1,%edx
  mov    $0x1,%esi
  call   <fread@plt>
  cmp    $0x1,%eax
  jne    L67
  movzbl 0x5(%rsp),%esi
  movzbl 0x4(%rsp),%edi
  mov    %r13d,%edx
  call   <endian2@plt>
  mov    %al,(%rbx)
  mov    $0x2,%eax
  jmp    L3
L65:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int fread_endian(ulong *x, int bytes, FILE *fp, int endian) {
  unsigned char u1, u2, u3, u4;
  if (bytes == 1) {
    if (fread(&u1, 1, 1, fp) != 1)
      return -1;
    *x = u1;
    return 1;
  } else if (bytes == 2) {
    if (fread(&u1, 1, 1, fp) != 1)
      return -1;
    if (fread(&u2, 1, 1, fp) != 1)
      return -1;
    *x = endian2(u1, u2, endian);
    return 2;
  } else if (bytes == 4) {
    if (fread(&u1, 1, 1, fp) != 1)
      return -1;
    if (fread(&u2, 1, 1, fp) != 1)
      return -1;
    if (fread(&u3, 1, 1, fp) != 1)
      return -1;
    if (fread(&u4, 1, 1, fp) != 1)
      return -1;
    *x = endian4(u1, u2, u3, u4, endian);
    return 4;
  } else {
    *x = 0;
    return 0;
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<fread_endian>:
  endbr64
  push   %r13
  push   %r12
  mov    %rdx,%r12
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  cmp    $0x1,%esi
  je     L23
  mov    %ecx,%r13d
  cmp    $0x2,%esi
  je     L128
  cmp    $0x4,%esi
  je     L93
  movb   $0x0,(%rdi)
  xor    %eax,%eax
L55:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L64
  add    $0x10,%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  ret
L93:
  mov    %rdx,%rcx
  lea    0x4(%rsp),%rdi
  mov    $0x1,%edx
  mov    $0x1,%esi
  call   <fread@plt>
  cmp    $0x1,%eax
  jne    L123
  lea    0x5(%rsp),%rdi
  mov    %r12,%rcx
  mov    $0x1,%edx
  mov    $0x1,%esi
  call   <fread@plt>
  cmp    $0x1,%eax
  jne    L123
  lea    0x6(%rsp),%rdi
  mov    %r12,%rcx
  mov    $0x1,%edx
  mov    $0x1,%esi
  call   <fread@plt>
  cmp    $0x1,%eax
  jne    L123
  lea    0x7(%rsp),%rdi
  mov    %r12,%rcx
  mov    $0x1,%edx
  mov    $0x1,%esi
  call   <fread@plt>
  cmp    $0x1,%eax
  jne    L123
  movzbl 0x7(%rsp),%ecx
  movzbl 0x6(%rsp),%edx
  mov    %r13d,%r8d
  movzbl 0x5(%rsp),%esi
  movzbl 0x4(%rsp),%edi
  call   <endian4@plt>
  mov    %al,(%rbx)
  mov    $0x4,%eax
  jmp    L55
L23:
  mov    %rdx,%rcx
  lea    0x4(%rsp),%rdi
  mov    $0x1,%edx
  call   <fread@plt>
  cmp    $0x1,%eax
  jne    L123
  movzbl 0x4(%rsp),%edx
  mov    %dl,(%rbx)
  jmp    L55
  nopl   0x0(%rax,%rax,1)
L123:
  mov    $0xffffffff,%eax
  jmp    L55
  nopw   0x0(%rax,%rax,1)
L128:
  mov    %rdx,%rcx
  lea    0x4(%rsp),%rdi
  mov    $0x1,%edx
  mov    $0x1,%esi
  call   <fread@plt>
  cmp    $0x1,%eax
  jne    L123
  lea    0x5(%rsp),%rdi
  mov    %r12,%rcx
  mov    $0x1,%edx
  mov    $0x1,%esi
  call   <fread@plt>
  cmp    $0x1,%eax
  jne    L123
  movzbl 0x5(%rsp),%esi
  movzbl 0x4(%rsp),%edi
  mov    %r13d,%edx
  call   <endian2@plt>
  mov    %al,(%rbx)
  mov    $0x2,%eax
  jmp    L55
L64:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int fread_endian(ulong *x, int bytes, FILE *fp, int endian) {
  unsigned char u1, u2, u3, u4;
  if (bytes == 1) {
    if (fread(&u1, 1, 1, fp) != 1)
      return -1;
    *x = u1;
    return 1;
  } else if (bytes == 2) {
    if (fread(&u1, 1, 1, fp) != 1)
      return -1;
    if (fread(&u2, 1, 1, fp) != 1)
      return -1;
    *x = endian2(u1, u2, endian);
    return 2;
  } else if (bytes == 4) {
    if (fread(&u1, 1, 1, fp) != 1)
      return -1;
    if (fread(&u2, 1, 1, fp) != 1)
      return -1;
    if (fread(&u3, 1, 1, fp) != 1)
      return -1;
    if (fread(&u4, 1, 1, fp) != 1)
      return -1;
    *x = endian4(u1, u2, u3, u4, endian);
    return 4;
  } else {
    *x = 0;
    return 0;
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<ConvertCommandID>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,%eax
  mov    %al,-0x4(%rbp)
  movsbl -0x4(%rbp),%eax
  cmp    $0x4,%eax
  ja     L50
  mov    %eax,%eax
  lea    0x0(,%rax,4),%rdx
  lea    D40(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D40(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  lea    D49(%rip),%rax
  jmp    L6
  lea    D68(%rip),%rax
  jmp    L6
  lea    D77(%rip),%rax
  jmp    L6
  lea    D36(%rip),%rax
  jmp    L6
  lea    D28(%rip),%rax
  jmp    L6
L50:
  lea    D15(%rip),%rax
L6:
  pop    %rbp
  ret
```

tool_calls: name: read_data
arguments: label: D49
data_type: string
name: read_data
arguments: label: D68
data_type: string
name: read_data
arguments: label: D77
data_type: string
name: read_data
arguments: label: D36
data_type: string
name: read_data
arguments: label: D28
data_type: string
name: read_data
arguments: label: D15
data_type: string

tool: D49: Nothing/Ping

tool: D68: Turn on

tool: D77: Turn off

tool: D36: Change level

tool: D28: Get info

tool: D15: Unknown

assistant: ```c
const char *ConvertCommandID(char cmd) {
  switch (cmd) {
  case 0:
    return "Nothing/Ping";
  case 2:
    return "Turn on";
  case 3:
    return "Turn off";
  case 4:
    return "Change level";
  case 1:
    return "Get info";
  }
  return "Unknown";
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<ConvertCommandID>:
  endbr64
  cmp    $0x4,%dil
  ja     L2
  movzbl %dil,%edi
  lea    D6(%rip),%rdx
  movslq (%rdx,%rdi,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
  lea    D15(%rip),%rax
  ret
  lea    D5(%rip),%rax
  ret
  lea    D66(%rip),%rax
  ret
  lea    D11(%rip),%rax
  ret
L2:
  lea    D60(%rip),%rax
  ret
  lea    D50(%rip),%rax
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D15
type_infered: string
name: unpack_data
arguments: data_label: D5
type_infered: string
name: unpack_data
arguments: data_label: D66
type_infered: string
name: unpack_data
arguments: data_label: D11
type_infered: string
name: unpack_data
arguments: data_label: D60
type_infered: string
name: unpack_data
arguments: data_label: D50
type_infered: string

tool: D15: Turn on

tool: D5: Turn off

tool: D66: Change level

tool: D11: Get info

tool: D60: Unknown

tool: D50: Nothing/Ping

assistant: ```c
const char *ConvertCommandID(char cmd) {
  switch (cmd) {
  case 0:
    return "Nothing/Ping";
  case 2:
    return "Turn on";
  case 3:
    return "Turn off";
  case 4:
    return "Change level";
  case 1:
    return "Get info";
  }
  return "Unknown";
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<ConvertCommandID>:
  endbr64
  cmp    $0x4,%dil
  ja     L8
  lea    D6(%rip),%rdx
  movzbl %dil,%edi
  movslq (%rdx,%rdi,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
  nop
  lea    D64(%rip),%rax
  ret
  nopl   0x0(%rax,%rax,1)
  lea    D66(%rip),%rax
  ret
  nopl   0x0(%rax,%rax,1)
  lea    D65(%rip),%rax
  ret
  nopl   0x0(%rax,%rax,1)
  lea    D51(%rip),%rax
  ret
  nopl   0x0(%rax,%rax,1)
  lea    D49(%rip),%rax
  ret
L8:
  lea    D16(%rip),%rax
  ret
```

tool_calls: name: unpack_data
arguments: tag: D64
type_infered: string
name: unpack_data
arguments: tag: D66
type_infered: string
name: unpack_data
arguments: tag: D65
type_infered: string
name: unpack_data
arguments: tag: D51
type_infered: string
name: unpack_data
arguments: tag: D49
type_infered: string
name: unpack_data
arguments: tag: D16
type_infered: string

tool: D64: Turn on

tool: D66: Nothing/Ping

tool: D65: Get info

tool: D51: Turn off

tool: D49: Change level

tool: D16: Unknown

assistant: ```c
const char *ConvertCommandID(char cmd) {
  switch (cmd) {
  case 0:
    return "Nothing/Ping";
  case 2:
    return "Turn on";
  case 3:
    return "Turn off";
  case 4:
    return "Change level";
  case 1:
    return "Get info";
  }
  return "Unknown";
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<ConvertCommandID>:
  endbr64
  cmp    $0x4,%dil
  ja     L0
  lea    D8(%rip),%rdx
  movzbl %dil,%edi
  movslq (%rdx,%rdi,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
  nop
  lea    D48(%rip),%rax
  ret
  nopl   0x0(%rax,%rax,1)
  lea    D2(%rip),%rax
  ret
  nopl   0x0(%rax,%rax,1)
  lea    D47(%rip),%rax
  ret
  nopl   0x0(%rax,%rax,1)
  lea    D54(%rip),%rax
  ret
  nopl   0x0(%rax,%rax,1)
  lea    D11(%rip),%rax
  ret
L0:
  lea    D41(%rip),%rax
  ret
```

tool_calls: name: read_data
arguments: data_label: D48
datatype: string
name: read_data
arguments: data_label: D2
datatype: string
name: read_data
arguments: data_label: D47
datatype: string
name: read_data
arguments: data_label: D54
datatype: string
name: read_data
arguments: data_label: D11
datatype: string
name: read_data
arguments: data_label: D41
datatype: string

tool: D48: Turn on

tool: D2: Nothing/Ping

tool: D47: Get info

tool: D54: Turn off

tool: D11: Change level

tool: D41: Unknown

assistant: ```c
const char *ConvertCommandID(char cmd) {
  switch (cmd) {
  case 0:
    return "Nothing/Ping";
  case 2:
    return "Turn on";
  case 3:
    return "Turn off";
  case 4:
    return "Change level";
  case 1:
    return "Get info";
  }
  return "Unknown";
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<strhazit>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x20(%rbp),%rax
  mov    (%rax),%rcx
  mov    -0x4(%rbp),%edx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L23
  mov    $0x0,%eax
  jmp    L18
L23:
  mov    -0x20(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x4(%rbp),%eax
  cltq
  add    %rax,%rdx
  mov    -0x20(%rbp),%rax
  mov    %rdx,(%rax)
  jmp    L29
L8:
  mov    -0x20(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rdx
  mov    -0x20(%rbp),%rax
  mov    %rdx,(%rax)
L29:
  mov    -0x20(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L8
  mov    $0x1,%eax
L18:
  leave
  ret
```

assistant: ```c
bool strhazit(const char *str, const char **p) {
  int len = strlen(str);
  if (strncmp(str, *p, len))
    return false;
  for (*p += len; isspace(**p); ++*p)
    ;
  return true;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<strhazit>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r12
  mov    %rsi,%rbp
  call   <strlen@plt>
  mov    %eax,%ebx
  mov    %eax,%edx
  mov    0x0(%rbp),%rsi
  mov    %r12,%rdi
  call   <strncmp@plt>
  mov    %rax,%rdx
  mov    $0x0,%eax
  test   %rdx,%rdx
  jne    L28
  movslq %ebx,%rax
  add    0x0(%rbp),%rax
  jmp    L10
L13:
  mov    0x0(%rbp),%rax
  add    $0x1,%rax
L10:
  mov    %rax,0x0(%rbp)
  movsbl (%rax),%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L13
  mov    $0x1,%eax
L28:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
bool strhazit(const char *str, const char **p) {
  int len = strlen(str);
  if (strncmp(str, *p, len))
    return false;
  for (*p += len; isspace(**p); ++*p)
    ;
  return true;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<strhazit>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  call   <strlen@plt>
  mov    0x0(%rbp),%rsi
  mov    %r12,%rdi
  mov    %eax,%edx
  mov    %eax,%ebx
  call   <strncmp@plt>
  mov    %rax,%r8
  xor    %eax,%eax
  test   %r8,%r8
  jne    L6
  movslq %ebx,%rax
  add    0x0(%rbp),%rax
  jmp    L20
  cs nopw 0x0(%rax,%rax,1)
L28:
  mov    0x0(%rbp),%rax
  add    $0x1,%rax
L20:
  mov    %rax,0x0(%rbp)
  movsbl (%rax),%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L28
  mov    $0x1,%eax
L6:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
bool strhazit(const char *str, const char **p) {
  int len = strlen(str);
  if (strncmp(str, *p, len))
    return false;
  for (*p += len; isspace(**p); ++*p)
    ;
  return true;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<strhazit>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  call   <strlen@plt>
  mov    0x0(%rbp),%rsi
  mov    %r12,%rdi
  mov    %eax,%edx
  mov    %eax,%ebx
  call   <strncmp@plt>
  mov    %rax,%r8
  xor    %eax,%eax
  test   %r8,%r8
  jne    L22
  movslq %ebx,%rax
  add    0x0(%rbp),%rax
  jmp    L9
  cs nopw 0x0(%rax,%rax,1)
L6:
  mov    0x0(%rbp),%rax
  add    $0x1,%rax
L9:
  mov    %rax,0x0(%rbp)
  movsbl (%rax),%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L6
  mov    $0x1,%eax
L22:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
bool strhazit(const char *str, const char **p) {
  int len = strlen(str);
  if (strncmp(str, *p, len))
    return false;
  for (*p += len; isspace(**p); ++*p)
    ;
  return true;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<GPMCReadTypeSelect>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x4(%rbp)
  mov    %esi,-0x8(%rbp)
  mov    %edx,-0xc(%rbp)
  mov    -0x8(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  shl    $0x4,%eax
  mov    %eax,%edx
  mov    -0x4(%rbp),%eax
  add    %edx,%eax
  add    $0x60,%eax
  mov    %eax,%eax
  mov    (%rax),%ecx
  mov    -0x8(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  shl    $0x4,%eax
  mov    %eax,%edx
  mov    -0x4(%rbp),%eax
  add    %edx,%eax
  add    $0x60,%eax
  mov    %eax,%eax
  mov    %rax,%rdx
  mov    %ecx,%eax
  and    $0xdfffffff,%eax
  mov    %eax,(%rdx)
  mov    -0x8(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  shl    $0x4,%eax
  mov    %eax,%edx
  mov    -0x4(%rbp),%eax
  add    %edx,%eax
  add    $0x60,%eax
  mov    %eax,%eax
  mov    (%rax),%ecx
  mov    -0xc(%rbp),%eax
  shl    $0x1d,%eax
  and    $0x20000000,%eax
  mov    %eax,%esi
  mov    -0x8(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  shl    $0x4,%eax
  mov    %eax,%edx
  mov    -0x4(%rbp),%eax
  add    %edx,%eax
  add    $0x60,%eax
  mov    %eax,%eax
  mov    %rax,%rdx
  mov    %ecx,%eax
  or     %esi,%eax
  mov    %eax,(%rdx)
  nop
  pop    %rbp
  ret
```

assistant: ```c
void GPMCReadTypeSelect(unsigned int baseAddr, unsigned int csNum, unsigned int readType) {
  (*((volatile unsigned int *)(baseAddr + (0x60 + (csNum * (0x30)))))) &= ~(0x20000000u);
  (*((volatile unsigned int *)(baseAddr + (0x60 + (csNum * (0x30)))))) |= ((readType << (0x0000001Du)) & (0x20000000u));
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<GPMCReadTypeSelect>:
  endbr64
  lea    (%rsi,%rsi,2),%eax
  shl    $0x4,%eax
  lea    0x60(%rax,%rdi,1),%eax
  mov    (%eax),%ecx
  and    $0xdfffffff,%ecx
  mov    %ecx,(%eax)
  mov    (%eax),%ecx
  shl    $0x1d,%edx
  and    $0x20000000,%edx
  or     %ecx,%edx
  mov    %edx,(%eax)
  ret
```

assistant: ```c
void GPMCReadTypeSelect(unsigned int baseAddr, unsigned int csNum, unsigned int readType) {
  (*((volatile unsigned int *)(baseAddr + (0x60 + (csNum * (0x30)))))) &= ~(0x20000000u);
  (*((volatile unsigned int *)(baseAddr + (0x60 + (csNum * (0x30)))))) |= ((readType << (0x0000001Du)) & (0x20000000u));
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<GPMCReadTypeSelect>:
  endbr64
  lea    (%rsi,%rsi,2),%eax
  shl    $0x1d,%edx
  shl    $0x4,%eax
  and    $0x20000000,%edx
  lea    0x60(%rax,%rdi,1),%eax
  mov    (%eax),%ecx
  and    $0xdfffffff,%ecx
  mov    %ecx,(%eax)
  mov    (%eax),%ecx
  or     %ecx,%edx
  mov    %edx,(%eax)
  ret
```

assistant: ```c
void GPMCReadTypeSelect(unsigned int baseAddr, unsigned int csNum, unsigned int readType) {
  (*((volatile unsigned int *)(baseAddr + (0x60 + (csNum * (0x30)))))) &= ~(0x20000000u);
  (*((volatile unsigned int *)(baseAddr + (0x60 + (csNum * (0x30)))))) |= ((readType << (0x0000001Du)) & (0x20000000u));
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<GPMCReadTypeSelect>:
  endbr64
  lea    (%rsi,%rsi,2),%eax
  shl    $0x1d,%edx
  shl    $0x4,%eax
  and    $0x20000000,%edx
  lea    0x60(%rax,%rdi,1),%eax
  mov    (%eax),%ecx
  and    $0xdfffffff,%ecx
  mov    %ecx,(%eax)
  mov    (%eax),%ecx
  or     %ecx,%edx
  mov    %edx,(%eax)
  ret
```

assistant: ```c
void GPMCReadTypeSelect(unsigned int baseAddr, unsigned int csNum, unsigned int readType) {
  (*((volatile unsigned int *)(baseAddr + (0x60 + (csNum * (0x30)))))) &= ~(0x20000000u);
  (*((volatile unsigned int *)(baseAddr + (0x60 + (csNum * (0x30)))))) |= ((readType << (0x0000001Du)) & (0x20000000u));
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x28(%rbp)
  movl   $0xbebc200,-0x24(%rbp)
  movq   $0x0,-0x20(%rbp)
  movq   $0x0,-0x18(%rbp)
  movq   $0x0,-0x10(%rbp)
  movl   $0x75,-0x1c(%rbp)
  lea    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <sigemptyset@plt>
  mov    D0(%rip),%rax
  mov    (%rax),%edx
  lea    -0x30(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <sigaddset@plt>
  lea    -0x20(%rbp),%rdx
  lea    -0x2c(%rbp),%rax
  mov    %rdx,%r8
  mov    $0x0,%ecx
  mov    $0x0,%edx
  mov    %rax,%rsi
  mov    $0x1,%edi
  call   <select@plt>
  movq   $0x0,-0x18(%rbp)
  movl   $0x71,-0x1c(%rbp)
  lea    -0x20(%rbp),%rax
  mov    %rax,%r8
  mov    $0x0,%ecx
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    $0x1,%edi
  call   <select@plt>
  movq   $0x0,-0x18(%rbp)
  movl   $0x78,-0x1c(%rbp)
  lea    -0x20(%rbp),%rdx
  lea    -0x2c(%rbp),%rax
  mov    %rdx,%r8
  mov    $0x0,%ecx
  mov    $0x0,%edx
  mov    %rax,%rsi
  mov    $0xffffffff,%edi
  call   <select@plt>
  movq   $0x0,-0x18(%rbp)
  movl   $0x79,-0x1c(%rbp)
  lea    -0x20(%rbp),%rax
  mov    %rax,%r8
  mov    $0x0,%ecx
  mov    $0x0,%edx
  mov    $0xffffffffffffffff,%rsi
  mov    $0x1,%edi
  call   <select@plt>
  movq   $0x0,-0x18(%rbp)
  movl   $0x7a,-0x1c(%rbp)
  lea    -0x20(%rbp),%rdx
  lea    -0x2c(%rbp),%rax
  mov    %rdx,%r8
  mov    $0x0,%ecx
  mov    $0xffffffffffffffff,%rdx
  mov    %rax,%rsi
  mov    $0x1,%edi
  call   <select@plt>
  movq   $0x0,-0x18(%rbp)
  movl   $0x7b,-0x1c(%rbp)
  lea    -0x20(%rbp),%rdx
  lea    -0x2c(%rbp),%rax
  mov    %rdx,%r8
  mov    $0xffffffffffffffff,%rcx
  mov    $0x0,%edx
  mov    %rax,%rsi
  mov    $0x1,%edi
  call   <select@plt>
  lea    -0x2c(%rbp),%rax
  mov    $0xffffffffffffffff,%r8
  mov    $0x0,%ecx
  mov    $0x0,%edx
  mov    %rax,%rsi
  mov    $0x1,%edi
  call   <select@plt>
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L4
  call   <__stack_chk_fail@plt>
L4:
  leave
  ret
```

assistant: ```c
int main() {
  int fd;
  struct timespec tim = {0, 200000000};
  sigset_t sigs;
  fd_set rfds;
  struct timeval tv = {0, 117};
  sigemptyset(&sigs);
  sigaddset(&sigs, SIGUSR2);
  select(1, &rfds, NULL, NULL, &tv);
  tv.tv_sec = 0;
  tv.tv_usec = 113;
  select(1, NULL, NULL, NULL, &tv);
  tv.tv_sec = 0;
  tv.tv_usec = 120;
  select(-1, &rfds, NULL, NULL, &tv);
  tv.tv_sec = 0;
  tv.tv_usec = 121;
  select(1, (fd_set *)-1, NULL, NULL, &tv);
  tv.tv_sec = 0;
  tv.tv_usec = 122;
  select(1, &rfds, (fd_set *)-1, NULL, &tv);
  tv.tv_sec = 0;
  tv.tv_usec = 123;
  select(1, &rfds, NULL, (fd_set *)-1, &tv);
  select(1, &rfds, NULL, NULL, (struct timeval *)-1);
  return 0;
}
```