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

```asm
<usage>:
  endbr64
  push   %r12
  mov    %esi,%r12d
  lea    D1(%rip),%rsi
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x8,%rsp
  call   <fprintf@plt>
  mov    %rbp,%rdi
  lea    D56(%rip),%rsi
  call   <fprintf@plt>
  mov    %rbp,%rdi
  lea    D66(%rip),%rsi
  call   <fprintf@plt>
  mov    %rbp,%rdi
  lea    D33(%rip),%rsi
  call   <fprintf@plt>
  mov    %rbp,%rdi
  lea    D7(%rip),%rsi
  call   <fprintf@plt>
  mov    %rbp,%rdi
  lea    D16(%rip),%rsi
  call   <fprintf@plt>
  mov    %rbp,%rdi
  lea    D34(%rip),%rsi
  call   <fprintf@plt>
  add    $0x8,%rsp
  mov    %r12d,%edi
  pop    %rbp
  pop    %r12
  jmp    1070 <exit@plt>
```

tool_calls: name: parse_data
arguments: label: D1
data_type: string
name: parse_data
arguments: label: D56
data_type: string
name: parse_data
arguments: label: D66
data_type: string
name: parse_data
arguments: label: D33
data_type: string
name: parse_data
arguments: label: D7
data_type: string
name: parse_data
arguments: label: D16
data_type: string
name: parse_data
arguments: label: D34
data_type: string

tool: D1: Usage: dcplb_test [-h?v] [-s Start] -e End [-i Increment] 


tool: D56:         -h?            this help


tool: D66:         -v             print version info


tool: D33:         -s             Start Address


tool: D7:         -e             End Address


tool: D16:         -i             Increment


tool: D34: 
Example: dcplb_test -s 0 -e 33554432 -i 4096 


assistant: ```c
void usage(FILE *fp, int rc) {
  fprintf(fp, "Usage: dcplb_test [-h?v] [-s Start] -e End [-i Increment] \n");
  fprintf(fp, "        -h?            this help\n");
  fprintf(fp, "        -v             print version info\n");
  fprintf(fp, "        -s             Start Address\n");
  fprintf(fp, "        -e             End Address\n");
  fprintf(fp, "        -i             Increment\n");
  fprintf(fp, "\nExample: dcplb_test -s 0 -e 33554432 -i 4096 \n");
  exit(rc);
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<reset_bildschirm>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    $0x1,%edi
  call   <curs_set@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <wclear@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <wrefresh@plt>
  nop
  leave
  ret
```

assistant: ```c
void reset_bildschirm(WINDOW *fenster) {
  curs_set(1);
  wclear(fenster);
  wrefresh(fenster);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<reset_bildschirm>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  mov    $0x1,%edi
  call   <curs_set@plt>
  mov    %rbx,%rdi
  call   <wclear@plt>
  mov    %rbx,%rdi
  call   <wrefresh@plt>
  pop    %rbx
  ret
```

assistant: ```c
void reset_bildschirm(WINDOW *fenster) {
  curs_set(1);
  wclear(fenster);
  wrefresh(fenster);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<reset_bildschirm>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  mov    $0x1,%edi
  call   <curs_set@plt>
  mov    %rbp,%rdi
  call   <wclear@plt>
  mov    %rbp,%rdi
  pop    %rbp
  jmp    1070 <wrefresh@plt>
```

assistant: ```c
void reset_bildschirm(WINDOW *fenster) {
  curs_set(1);
  wclear(fenster);
  wrefresh(fenster);
}
```
user: What is the c source code of the assembly code below:

```asm
<reset_bildschirm>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  mov    $0x1,%edi
  call   <curs_set@plt>
  mov    %rbp,%rdi
  call   <wclear@plt>
  mov    %rbp,%rdi
  pop    %rbp
  jmp    1070 <wrefresh@plt>
```

assistant: ```c
void reset_bildschirm(WINDOW *fenster) {
  curs_set(1);
  wclear(fenster);
  wrefresh(fenster);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<lang_defVar>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <lang_getVarName@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x1c(%rbp),%edx
  mov    -0x8(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <lang__defVar@plt>
  leave
  ret
```

assistant: ```c
char lang_defVar(FILE *lang_in, int type) {
  char *name;
  name = lang_getVarName(lang_in);
  return lang__defVar(name, type);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<lang_defVar>:
  endbr64
  push   %rbx
  mov    %esi,%ebx
  call   <lang_getVarName@plt>
  mov    %rax,%rdi
  mov    %ebx,%esi
  call   <lang__defVar@plt>
  pop    %rbx
  ret
```

assistant: ```c
char lang_defVar(FILE *lang_in, int type) {
  char *name;
  name = lang_getVarName(lang_in);
  return lang__defVar(name, type);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<lang_defVar>:
  endbr64
  push   %rbp
  mov    %esi,%ebp
  call   <lang_getVarName@plt>
  mov    %ebp,%esi
  pop    %rbp
  mov    %rax,%rdi
  jmp    1060 <lang__defVar@plt>
```

assistant: ```c
char lang_defVar(FILE *lang_in, int type) {
  char *name;
  name = lang_getVarName(lang_in);
  return lang__defVar(name, type);
}
```
user: Translate the below assembly code into C programming language:

```asm
<lang_defVar>:
  endbr64
  push   %rbp
  mov    %esi,%ebp
  call   <lang_getVarName@plt>
  mov    %ebp,%esi
  pop    %rbp
  mov    %rax,%rdi
  jmp    1060 <lang__defVar@plt>
```

assistant: ```c
char lang_defVar(FILE *lang_in, int type) {
  char *name;
  name = lang_getVarName(lang_in);
  return lang__defVar(name, type);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<decode>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  movl   $0x0,-0x4(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L35
L14:
  mov    -0x4(%rbp),%eax
  sar    $0x4,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rsi
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jle    L37
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x57,%eax
  cltq
  jmp    L4
L37:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  cltq
L4:
  mov    -0x4(%rbp),%edx
  shl    $0x2,%edx
  xor    $0x4,%edx
  and    $0x3f,%edx
  mov    %edx,%ecx
  shl    %cl,%rax
  mov    %rax,%rdx
  mov    -0x4(%rbp),%eax
  sar    $0x4,%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x20(%rbp),%rax
  add    %rcx,%rax
  or     %rsi,%rdx
  mov    %rdx,(%rax)
  addl   $0x1,-0x4(%rbp)
L35:
  cmpl   $0x20,-0x4(%rbp)
  jne    L14
  nop
  nop
  pop    %rbp
  ret
```

assistant: ```c
void decode(char *hash, long long out[2]) {
  int i = 0;
  for (i = 0; i ^ 32; ++i)
    out[i >> 4] |= (long long)(hash[i] > '9' ? hash[i] - 'W' : hash[i] - '0') << ((i ^ 1) << 2 & 0x3f);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<decode>:
  endbr64
  mov    %rsi,%r8
  mov    $0x0,%edx
  jmp    L7
L12:
  movsbl %al,%eax
  sub    $0x30,%eax
  cltq
L31:
  shl    $0x2,%ecx
  xor    $0x4,%ecx
  shl    %cl,%rax
  or     %r9,%rax
  mov    %rax,(%rsi)
  add    $0x1,%rdx
  cmp    $0x20,%rdx
  je     L13
L7:
  mov    %edx,%ecx
  mov    %edx,%eax
  sar    $0x4,%eax
  cltq
  lea    (%r8,%rax,8),%rsi
  mov    (%rsi),%r9
  movzbl (%rdi,%rdx,1),%eax
  cmp    $0x39,%al
  jle    L12
  movsbl %al,%eax
  sub    $0x57,%eax
  cltq
  jmp    L31
L13:
  ret
```

assistant: ```c
void decode(char *hash, long long out[2]) {
  int i = 0;
  for (i = 0; i ^ 32; ++i)
    out[i >> 4] |= (long long)(hash[i] > '9' ? hash[i] - 'W' : hash[i] - '0') << ((i ^ 1) << 2 & 0x3f);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<decode>:
  endbr64
  mov    %rsi,%r8
  xor    %edx,%edx
  jmp    L3
  nopl   0x0(%rax,%rax,1)
L32:
  sub    $0x57,%eax
  movsbq %al,%rax
L36:
  shl    $0x2,%ecx
  add    $0x1,%rdx
  xor    $0x4,%ecx
  and    $0x3f,%ecx
  shl    %cl,%rax
  or     %r9,%rax
  mov    %rax,(%rsi)
  cmp    $0x20,%rdx
  je     L6
L3:
  mov    %edx,%eax
  mov    %edx,%ecx
  sar    $0x4,%eax
  cltq
  lea    (%r8,%rax,8),%rsi
  movsbl (%rdi,%rdx,1),%eax
  mov    (%rsi),%r9
  cmp    $0x39,%al
  jg     L32
  sub    $0x30,%eax
  cltq
  jmp    L36
  nopw   0x0(%rax,%rax,1)
L6:
  ret
```

assistant: ```c
void decode(char *hash, long long out[2]) {
  int i = 0;
  for (i = 0; i ^ 32; ++i)
    out[i >> 4] |= (long long)(hash[i] > '9' ? hash[i] - 'W' : hash[i] - '0') << ((i ^ 1) << 2 & 0x3f);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<decode>:
  endbr64
  xor    %edx,%edx
  cs nopw 0x0(%rax,%rax,1)
L26:
  mov    %edx,%eax
  sar    $0x4,%eax
  cltq
  lea    (%rsi,%rax,8),%r8
  movsbl (%rdi,%rdx,1),%eax
  mov    (%r8),%r9
  cmp    $0x39,%al
  jle    L16
  lea    0x0(,%rdx,4),%ecx
  sub    $0x57,%eax
  add    $0x1,%rdx
  xor    $0x4,%ecx
  movsbq %al,%rax
  and    $0x3f,%ecx
  shl    %cl,%rax
  or     %r9,%rax
  mov    %rax,(%r8)
  cmp    $0x20,%rdx
  jne    L26
  ret
  xchg   %ax,%ax
L16:
  lea    0x0(,%rdx,4),%ecx
  sub    $0x30,%eax
  add    $0x1,%rdx
  xor    $0x4,%ecx
  cltq
  and    $0x3f,%ecx
  shl    %cl,%rax
  or     %r9,%rax
  mov    %rax,(%r8)
  cmp    $0x20,%rdx
  jne    L26
  ret
```

assistant: ```c
void decode(char *hash, long long out[2]) {
  int i = 0;
  for (i = 0; i ^ 32; ++i)
    out[i >> 4] |= (long long)(hash[i] > '9' ? hash[i] - 'W' : hash[i] - '0') << ((i ^ 1) << 2 & 0x3f);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<load>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %rcx,-0x30(%rbp)
  mov    %r8d,-0x20(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x1c(%rbp),%edx
  mov    -0x4(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <IMIN@plt>
  mov    %eax,%edx
  mov    -0x28(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x4(%rbp),%eax
  leave
  ret
```

assistant: ```c
int load(char *recp, int recsize, char const *buf, char const *udata __attribute__((unused)), int uleng __attribute__((unused))) {
  int buflen = strlen(buf);
  memcpy(recp, buf, IMIN(buflen, recsize));
  return buflen;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<load>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r12
  mov    %esi,%r13d
  mov    %rdx,%rbp
  mov    %rdx,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  mov    %r13d,%esi
  mov    %eax,%edi
  call   <IMIN@plt>
  mov    %eax,%edx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <memcpy@plt>
  mov    %ebx,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
int load(char *recp, int recsize, char const *buf, char const *udata __attribute__((unused)), int uleng __attribute__((unused))) {
  int buflen = strlen(buf);
  memcpy(recp, buf, IMIN(buflen, recsize));
  return buflen;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<load>:
  endbr64
  push   %r14
  mov    %esi,%r14d
  push   %r13
  mov    %rdi,%r13
  mov    %rdx,%rdi
  push   %r12
  push   %rbp
  mov    %rdx,%rbp
  sub    $0x8,%rsp
  call   <strlen@plt>
  mov    %r14d,%esi
  mov    %eax,%edi
  mov    %eax,%r12d
  call   <IMIN@plt>
  mov    %rbp,%rsi
  mov    %r13,%rdi
  mov    %eax,%edx
  call   <memcpy@plt>
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
int load(char *recp, int recsize, char const *buf, char const *udata __attribute__((unused)), int uleng __attribute__((unused))) {
  int buflen = strlen(buf);
  memcpy(recp, buf, IMIN(buflen, recsize));
  return buflen;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<load>:
  endbr64
  push   %r14
  mov    %esi,%r14d
  push   %r13
  mov    %rdi,%r13
  mov    %rdx,%rdi
  push   %r12
  push   %rbp
  mov    %rdx,%rbp
  sub    $0x8,%rsp
  call   <strlen@plt>
  mov    %r14d,%esi
  mov    %eax,%edi
  mov    %eax,%r12d
  call   <IMIN@plt>
  mov    %rbp,%rsi
  mov    %r13,%rdi
  mov    %eax,%edx
  call   <memcpy@plt>
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
int load(char *recp, int recsize, char const *buf, char const *udata __attribute__((unused)), int uleng __attribute__((unused))) {
  int buflen = strlen(buf);
  memcpy(recp, buf, IMIN(buflen, recsize));
  return buflen;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<test_list_free_null_params>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  movl   $0x0,-0x8(%rbp)
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <list_free@plt>
  mov    %eax,-0x4(%rbp)
  cmpl   $0x1,-0x4(%rbp)
  jne    L1
  movl   $0x1,-0x8(%rbp)
L1:
  mov    -0x8(%rbp),%eax
  leave
  ret
```

assistant: ```c
bool test_list_free_null_params(void) {
  bool pass = false;
  unsigned int res = list_free(NULL, NULL);
  if (res == 1) {
    pass = true;
  }
  return pass;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<test_list_free_null_params>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <list_free@plt>
  cmp    $0x1,%eax
  sete   %al
  movzbl %al,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
bool test_list_free_null_params(void) {
  bool pass = false;
  unsigned int res = list_free(NULL, NULL);
  if (res == 1) {
    pass = true;
  }
  return pass;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<test_list_free_null_params>:
  endbr64
  sub    $0x8,%rsp
  xor    %esi,%esi
  xor    %edi,%edi
  call   <list_free@plt>
  cmp    $0x1,%eax
  sete   %al
  add    $0x8,%rsp
  movzbl %al,%eax
  ret
```

assistant: ```c
bool test_list_free_null_params(void) {
  bool pass = false;
  unsigned int res = list_free(NULL, NULL);
  if (res == 1) {
    pass = true;
  }
  return pass;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<test_list_free_null_params>:
  endbr64
  sub    $0x8,%rsp
  xor    %esi,%esi
  xor    %edi,%edi
  call   <list_free@plt>
  cmp    $0x1,%eax
  sete   %al
  add    $0x8,%rsp
  movzbl %al,%eax
  ret
```

assistant: ```c
bool test_list_free_null_params(void) {
  bool pass = false;
  unsigned int res = list_free(NULL, NULL);
  if (res == 1) {
    pass = true;
  }
  return pass;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<addrtok>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  movl   $0x0,-0xc(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L193
L142:
  addq   $0x1,-0x8(%rbp)
L193:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L137
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x3a,%al
  jne    L142
L137:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x3a,%al
  jne    L17
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movb   $0x0,(%rax)
  mov    -0x20(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <inet_aton@plt>
  test   %eax,%eax
  jne    L47
  jmp    L188
L17:
  mov    $0x0,%eax
  jmp    L22
L188:
  mov    $0x0,%eax
  jmp    L22
L47:
  movl   $0x0,-0x10(%rbp)
  jmp    L192
L26:
  mov    -0xc(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  sub    $0x30,%eax
  mov    %eax,-0xc(%rbp)
  addl   $0x1,-0x10(%rbp)
  addq   $0x1,-0x8(%rbp)
L192:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L26
  jmp    L175
L35:
  addq   $0x1,-0x8(%rbp)
L175:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L35
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L18
  mov    $0x0,%eax
  jmp    L22
L18:
  cmpl   $0x0,-0x10(%rbp)
  jle    L38
  cmpl   $0x5,-0x10(%rbp)
  jle    L144
L38:
  mov    $0x0,%eax
  jmp    L22
L144:
  cmpl   $0x0,-0xc(%rbp)
  je     L179
  cmpl   $0xffff,-0xc(%rbp)
  jbe    L174
L179:
  mov    $0x0,%eax
  jmp    L22
L174:
  mov    -0xc(%rbp),%eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%rax
  mov    %dx,(%rax)
  mov    $0x1,%eax
L22:
  leave
  ret
```

assistant: ```c
int addrtok(char *buf, struct in_addr *addr, unsigned short *port) {
  char *p;
  int digits;
  unsigned int tmp = 0;
  p = buf;
  while ((*p != '\0') && (*p != ':'))
    p++;
  if (*p == ':')
    *p++ = 0;
  else
    return 0;
  if (!inet_aton(buf, addr))
    return 0;
  for (digits = 0; isdigit(*p); digits++, p++) {
    tmp *= 10;
    tmp += (*p - '0');
  }
  while (isspace(*p))
    p++;
  if (*p != '\0')
    return 0;
  if (digits < 1 || digits > 5)
    return 0;
  if (tmp < 1 || tmp > 65535)
    return 0;
  *port = (unsigned short)tmp;
  return 1;
}
```
user: What is the c source code of the assembly code below:

```asm
<addrtok>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdx,%r12
  movzbl (%rdi),%edx
  test   %dl,%dl
  je     L0
  cmp    $0x3a,%dl
  je     L0
  mov    %rdi,%rbx
L103:
  add    $0x1,%rbx
  movzbl (%rbx),%edx
  test   %dl,%dl
  je     L37
  cmp    $0x3a,%dl
  jne    L103
L37:
  mov    $0x0,%eax
  cmp    $0x3a,%dl
  je     L42
L108:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L0:
  mov    %rdi,%rbx
  jmp    L37
L42:
  movb   $0x0,(%rbx)
  call   <inet_aton@plt>
  test   %eax,%eax
  je     L108
  add    $0x1,%rbx
  mov    $0x0,%ebp
  mov    $0x0,%r13d
  jmp    L107
L99:
  lea    0x0(%rbp,%rbp,4),%edx
  movsbl (%rbx),%eax
  lea    -0x30(%rax,%rdx,2),%ebp
  add    $0x1,%r13d
  add    $0x1,%rbx
L107:
  movsbl (%rbx),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L99
  jmp    L70
L94:
  add    $0x1,%rbx
L70:
  movsbl (%rbx),%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L94
  cmpb   $0x0,(%rbx)
  jne    L108
  sub    $0x1,%r13d
  cmp    $0x4,%r13d
  ja     L108
  lea    -0x1(%rbp),%edx
  cmp    $0xfffe,%edx
  ja     L108
  mov    %bp,(%r12)
  mov    $0x1,%eax
  jmp    L108
```

assistant: ```c
int addrtok(char *buf, struct in_addr *addr, unsigned short *port) {
  char *p;
  int digits;
  unsigned int tmp = 0;
  p = buf;
  while ((*p != '\0') && (*p != ':'))
    p++;
  if (*p == ':')
    *p++ = 0;
  else
    return 0;
  if (!inet_aton(buf, addr))
    return 0;
  for (digits = 0; isdigit(*p); digits++, p++) {
    tmp *= 10;
    tmp += (*p - '0');
  }
  while (isspace(*p))
    p++;
  if (*p != '\0')
    return 0;
  if (digits < 1 || digits > 5)
    return 0;
  if (tmp < 1 || tmp > 65535)
    return 0;
  *port = (unsigned short)tmp;
  return 1;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<addrtok>:
  endbr64
  push   %r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  movzbl (%rdi),%eax
  test   %al,%al
  je     L101
  cmp    $0x3a,%al
  je     L101
  nopw   0x0(%rax,%rax,1)
L67:
  movzbl 0x1(%rbx),%eax
  add    $0x1,%rbx
  test   %al,%al
  je     L101
  cmp    $0x3a,%al
  jne    L67
L103:
  movb   $0x0,(%rbx)
  call   <inet_aton@plt>
  test   %eax,%eax
  je     L136
  add    $0x1,%rbx
  xor    %ebp,%ebp
  xor    %r13d,%r13d
  jmp    L65
  nop
L104:
  movsbl (%rbx),%eax
  lea    0x0(%rbp,%rbp,4),%edx
  add    $0x1,%r13d
  add    $0x1,%rbx
  lea    -0x30(%rax,%rdx,2),%ebp
L65:
  movsbl (%rbx),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L104
  movsbl (%rbx),%edi
  call   <isspace@plt>
  test   %rax,%rax
  je     L18
  nopl   (%rax)
L91:
  movsbl 0x1(%rbx),%edi
  add    $0x1,%rbx
  call   <isspace@plt>
  test   %rax,%rax
  jne    L91
L18:
  cmpb   $0x0,(%rbx)
  jne    L136
  sub    $0x1,%r13d
  cmp    $0x4,%r13d
  ja     L136
  lea    -0x1(%rbp),%eax
  cmp    $0xfffe,%eax
  ja     L136
  mov    %bp,(%r12)
  mov    $0x1,%eax
  jmp    L129
  nopw   0x0(%rax,%rax,1)
L101:
  cmp    $0x3a,%al
  je     L103
L136:
  xor    %eax,%eax
L129:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
int addrtok(char *buf, struct in_addr *addr, unsigned short *port) {
  char *p;
  int digits;
  unsigned int tmp = 0;
  p = buf;
  while ((*p != '\0') && (*p != ':'))
    p++;
  if (*p == ':')
    *p++ = 0;
  else
    return 0;
  if (!inet_aton(buf, addr))
    return 0;
  for (digits = 0; isdigit(*p); digits++, p++) {
    tmp *= 10;
    tmp += (*p - '0');
  }
  while (isspace(*p))
    p++;
  if (*p != '\0')
    return 0;
  if (digits < 1 || digits > 5)
    return 0;
  if (tmp < 1 || tmp > 65535)
    return 0;
  *port = (unsigned short)tmp;
  return 1;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<addrtok>:
  endbr64
  push   %r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  movzbl (%rdi),%eax
  test   %al,%al
  je     L84
  cmp    $0x3a,%al
  je     L84
  nopw   0x0(%rax,%rax,1)
L135:
  movzbl 0x1(%rbx),%eax
  add    $0x1,%rbx
  test   %al,%al
  je     L84
  cmp    $0x3a,%al
  jne    L135
L117:
  movb   $0x0,(%rbx)
  call   <inet_aton@plt>
  test   %eax,%eax
  je     L10
  add    $0x1,%rbx
  xor    %ebp,%ebp
  xor    %r13d,%r13d
  jmp    L27
  nop
L49:
  movsbl (%rbx),%eax
  lea    0x0(%rbp,%rbp,4),%edx
  add    $0x1,%r13d
  add    $0x1,%rbx
  lea    -0x30(%rax,%rdx,2),%ebp
L27:
  movsbl (%rbx),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L49
  movsbl (%rbx),%edi
  call   <isspace@plt>
  test   %rax,%rax
  je     L137
  nopl   (%rax)
L45:
  movsbl 0x1(%rbx),%edi
  add    $0x1,%rbx
  call   <isspace@plt>
  test   %rax,%rax
  jne    L45
L137:
  cmpb   $0x0,(%rbx)
  jne    L10
  sub    $0x1,%r13d
  cmp    $0x4,%r13d
  ja     L10
  lea    -0x1(%rbp),%eax
  cmp    $0xfffe,%eax
  ja     L10
  mov    %bp,(%r12)
  mov    $0x1,%eax
  jmp    L60
  nopw   0x0(%rax,%rax,1)
L84:
  cmp    $0x3a,%al
  je     L117
L10:
  xor    %eax,%eax
L60:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
int addrtok(char *buf, struct in_addr *addr, unsigned short *port) {
  char *p;
  int digits;
  unsigned int tmp = 0;
  p = buf;
  while ((*p != '\0') && (*p != ':'))
    p++;
  if (*p == ':')
    *p++ = 0;
  else
    return 0;
  if (!inet_aton(buf, addr))
    return 0;
  for (digits = 0; isdigit(*p); digits++, p++) {
    tmp *= 10;
    tmp += (*p - '0');
  }
  while (isspace(*p))
    p++;
  if (*p != '\0')
    return 0;
  if (digits < 1 || digits > 5)
    return 0;
  if (tmp < 1 || tmp > 65535)
    return 0;
  *port = (unsigned short)tmp;
  return 1;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<__imlib_IsRealFile>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0xc(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <stat@plt>
  cmp    $0xffffffff,%eax
  je     L16
  mov    -0xc(%rbp),%eax
  mov    %eax,%edi
  call   <S_ISREG@plt>
  test   %rax,%rax
  je     L16
  mov    $0x1,%eax
  jmp    L24
L16:
  mov    $0x0,%eax
L24:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L20
  call   <__stack_chk_fail@plt>
L20:
  leave
  ret
```

assistant: ```c
int __imlib_IsRealFile(const char *s) {
  struct stat st;
  return ((stat(s, &st) != -1) && (S_ISREG(st.st_mode)));
}
```
user: What is the c source code of the assembly code below?

```asm
<__imlib_IsRealFile>:
  endbr64
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rsi
  call   <stat@plt>
  mov    %eax,%edx
  mov    $0x0,%eax
  cmp    $0xffffffff,%edx
  jne    L14
L7:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L11
  add    $0x18,%rsp
  ret
L14:
  mov    0x4(%rsp),%edi
  call   <S_ISREG@plt>
  test   %rax,%rax
  setne  %al
  movzbl %al,%eax
  jmp    L7
L11:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int __imlib_IsRealFile(const char *s) {
  struct stat st;
  return ((stat(s, &st) != -1) && (S_ISREG(st.st_mode)));
}
```