ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Converte this assembly snippet into its equivalent C code:

```asm
<read_next_int>:
  endbr64
  push   %r12
  mov    $0x14,%edx
  push   %rbp
  mov    %rsi,%rbp
  xor    %esi,%esi
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r12
  mov    %r12,%rdi
  call   <memset@plt>
  movslq 0x0(%rbp),%rdi
  xor    %eax,%eax
  movzbl (%rbx,%rdi,1),%ecx
  mov    %rdi,%rsi
  cmp    $0x2d,%cl
  je     L56
L68:
  cmp    $0x2b,%cl
  je     L98
L96:
  lea    -0x30(%rcx),%edx
  cmp    $0x9,%dl
  ja     L78
  movslq %esi,%rdi
  lea    0x1(%rsi),%edx
  sub    %rdi,%rax
  movslq %edx,%rdx
  add    %r12,%rax
  nopw   0x0(%rax,%rax,1)
L31:
  mov    %cl,-0x1(%rax,%rdx,1)
  mov    %edx,0x0(%rbp)
  movzbl (%rbx,%rdx,1),%ecx
  add    $0x1,%rdx
  lea    -0x30(%rcx),%esi
  cmp    $0x9,%sil
  jbe    L31
L82:
  mov    %r12,%rdi
  call   <atoi@plt>
L38:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L32
  add    $0x20,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L98:
  add    $0x1,%esi
  movslq %esi,%rdi
  mov    %esi,0x0(%rbp)
  movzbl (%rbx,%rdi,1),%ecx
  jmp    L96
L78:
  test   %eax,%eax
  je     L38
  jmp    L82
  nopl   (%rax)
L56:
  lea    0x1(%rbx,%rdi,1),%rcx
  movzbl (%rcx),%edi
  lea    -0x30(%rdi),%edx
  cmp    $0x9,%dl
  ja     L38
  add    $0x1,%esi
  movb   $0x2d,(%rsp)
  mov    $0x1,%eax
  mov    %esi,0x0(%rbp)
  movzbl (%rcx),%ecx
  jmp    L68
L32:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int read_next_int(const char *str, int *pos) {
  int opos = 0;
  char buf[20];
  memset(buf, 0, 20);
  if (str[*pos] == '-' && str[(*pos) + 1] >= '0' && str[(*pos) + 1] <= '9') {
    buf[opos] = str[*pos];
    (*pos)++;
    opos++;
  }
  if (str[*pos] == '+') {
    (*pos)++;
  }
  while (str[*pos] >= '0' && str[*pos] <= '9') {
    buf[opos] = str[*pos];
    (*pos)++;
    opos++;
  }
  if (opos == 0)
    return 0;
  return atoi(buf);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<read_next_int>:
  endbr64
  push   %r12
  mov    $0x14,%edx
  push   %rbp
  mov    %rsi,%rbp
  xor    %esi,%esi
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r12
  mov    %r12,%rdi
  call   <memset@plt>
  movslq 0x0(%rbp),%rdi
  xor    %eax,%eax
  movzbl (%rbx,%rdi,1),%ecx
  mov    %rdi,%rsi
  cmp    $0x2d,%cl
  je     L4
L88:
  cmp    $0x2b,%cl
  je     L16
L90:
  lea    -0x30(%rcx),%edx
  cmp    $0x9,%dl
  ja     L35
  movslq %esi,%rdi
  lea    0x1(%rsi),%edx
  sub    %rdi,%rax
  movslq %edx,%rdx
  add    %r12,%rax
  nopw   0x0(%rax,%rax,1)
L48:
  mov    %cl,-0x1(%rax,%rdx,1)
  mov    %edx,0x0(%rbp)
  movzbl (%rbx,%rdx,1),%ecx
  add    $0x1,%rdx
  lea    -0x30(%rcx),%esi
  cmp    $0x9,%sil
  jbe    L48
L56:
  mov    %r12,%rdi
  call   <atoi@plt>
L68:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L45
  add    $0x20,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L16:
  add    $0x1,%esi
  movslq %esi,%rdi
  mov    %esi,0x0(%rbp)
  movzbl (%rbx,%rdi,1),%ecx
  jmp    L90
L35:
  test   %eax,%eax
  je     L68
  jmp    L56
  nopl   (%rax)
L4:
  lea    0x1(%rbx,%rdi,1),%rcx
  movzbl (%rcx),%edi
  lea    -0x30(%rdi),%edx
  cmp    $0x9,%dl
  ja     L68
  add    $0x1,%esi
  movb   $0x2d,(%rsp)
  mov    $0x1,%eax
  mov    %esi,0x0(%rbp)
  movzbl (%rcx),%ecx
  jmp    L88
L45:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int read_next_int(const char *str, int *pos) {
  int opos = 0;
  char buf[20];
  memset(buf, 0, 20);
  if (str[*pos] == '-' && str[(*pos) + 1] >= '0' && str[(*pos) + 1] <= '9') {
    buf[opos] = str[*pos];
    (*pos)++;
    opos++;
  }
  if (str[*pos] == '+') {
    (*pos)++;
  }
  while (str[*pos] >= '0' && str[*pos] <= '9') {
    buf[opos] = str[*pos];
    (*pos)++;
    opos++;
  }
  if (opos == 0)
    return 0;
  return atoi(buf);
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<free_moves_single>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L3
L17:
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <free@plt>
  addl   $0x1,-0x4(%rbp)
L3:
  cmpl   $0x3f,-0x4(%rbp)
  jle    L17
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  nop
  leave
  ret
```

assistant: ```c
void free_moves_single(int **moves) {
  int source;
  for (source = 0; source < 64; source++) {
    free(moves[source]);
  }
  free(moves);
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<free_moves_single>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r12
  mov    %rdi,%rbx
  lea    0x200(%rdi),%rbp
L3:
  mov    (%rbx),%rdi
  call   <free@plt>
  add    $0x8,%rbx
  cmp    %rbp,%rbx
  jne    L3
  mov    %r12,%rdi
  call   <free@plt>
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void free_moves_single(int **moves) {
  int source;
  for (source = 0; source < 64; source++) {
    free(moves[source]);
  }
  free(moves);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<free_moves_single>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  lea    0x200(%rdi),%rbp
  push   %rbx
  mov    %rdi,%rbx
  nopl   (%rax)
L4:
  mov    (%rbx),%rdi
  add    $0x8,%rbx
  call   <free@plt>
  cmp    %rbp,%rbx
  jne    L4
  pop    %rbx
  mov    %r12,%rdi
  pop    %rbp
  pop    %r12
  jmp    1050 <free@plt>
```

assistant: ```c
void free_moves_single(int **moves) {
  int source;
  for (source = 0; source < 64; source++) {
    free(moves[source]);
  }
  free(moves);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<free_moves_single>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  lea    0x200(%rdi),%rbp
  push   %rbx
  mov    %rdi,%rbx
  nopl   (%rax)
L6:
  mov    (%rbx),%rdi
  add    $0x8,%rbx
  call   <free@plt>
  cmp    %rbp,%rbx
  jne    L6
  pop    %rbx
  mov    %r12,%rdi
  pop    %rbp
  pop    %r12
  jmp    1050 <free@plt>
```

assistant: ```c
void free_moves_single(int **moves) {
  int source;
  for (source = 0; source < 64; source++) {
    free(moves[source]);
  }
  free(moves);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<strdup_vprintf>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    -0x1c(%rbp),%edx
  mov    -0x10(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <va_copy@plt>
  mov    -0x10(%rbp),%edx
  mov    -0x18(%rbp),%rax
  mov    %edx,%ecx
  mov    %rax,%rdx
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <vsnprintf@plt>
  add    $0x1,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x10(%rbp),%eax
  mov    %eax,%edi
  call   <va_end@plt>
  mov    -0xc(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L5
  mov    $0x0,%eax
  jmp    L7
L5:
  mov    -0x1c(%rbp),%ecx
  mov    -0x18(%rbp),%rdx
  mov    -0xc(%rbp),%esi
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <vsnprintf@plt>
  mov    -0x8(%rbp),%rax
L7:
  leave
  ret
```

assistant: ```c
char *strdup_vprintf(const char *format, va_list ap) {
  va_list ap2;
  int size;
  char *buffer;
  va_copy(ap2, ap);
  size = vsnprintf(NULL, 0, format, ap2) + 1;
  va_end(ap2);
  buffer = (char *)malloc(size + 1);
  if (!buffer)
    return NULL;
  vsnprintf(buffer, size, format, ap);
  return buffer;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<strdup_vprintf>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  mov    %esi,%r12d
  mov    $0x0,%r13d
  mov    %r13d,%edi
  call   <va_copy@plt>
  mov    %r13d,%ecx
  mov    %rbp,%rdx
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <vsnprintf@plt>
  mov    %eax,%ebx
  mov    %r13d,%edi
  call   <va_end@plt>
  lea    0x2(%rbx),%edi
  call   <malloc@plt>
  mov    $0x0,%r13d
  test   %rax,%rax
  je     L8
  mov    %rax,%rdi
  mov    %rax,%r13
  lea    0x1(%rbx),%esi
  mov    %r12d,%ecx
  mov    %rbp,%rdx
  call   <vsnprintf@plt>
L8:
  mov    %r13,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
char *strdup_vprintf(const char *format, va_list ap) {
  va_list ap2;
  int size;
  char *buffer;
  va_copy(ap2, ap);
  size = vsnprintf(NULL, 0, format, ap2) + 1;
  va_end(ap2);
  buffer = (char *)malloc(size + 1);
  if (!buffer)
    return NULL;
  vsnprintf(buffer, size, format, ap);
  return buffer;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<strdup_vprintf>:
  endbr64
  push   %r14
  xor    %r14d,%r14d
  push   %r13
  mov    %rdi,%r13
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  mov    %ebp,%edi
  call   <va_copy@plt>
  mov    %ebp,%ecx
  mov    %r13,%rdx
  xor    %esi,%esi
  xor    %edi,%edi
  call   <vsnprintf@plt>
  mov    %ebp,%edi
  mov    %eax,%ebx
  call   <va_end@plt>
  lea    0x2(%rbx),%edi
  call   <malloc@plt>
  test   %rax,%rax
  je     L7
  lea    0x1(%rbx),%esi
  mov    %r12d,%ecx
  mov    %r13,%rdx
  mov    %rax,%rdi
  mov    %rax,%r14
  call   <vsnprintf@plt>
L7:
  pop    %rbx
  mov    %r14,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
char *strdup_vprintf(const char *format, va_list ap) {
  va_list ap2;
  int size;
  char *buffer;
  va_copy(ap2, ap);
  size = vsnprintf(NULL, 0, format, ap2) + 1;
  va_end(ap2);
  buffer = (char *)malloc(size + 1);
  if (!buffer)
    return NULL;
  vsnprintf(buffer, size, format, ap);
  return buffer;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<strdup_vprintf>:
  endbr64
  push   %r14
  xor    %r14d,%r14d
  push   %r13
  mov    %rdi,%r13
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  mov    %ebp,%edi
  call   <va_copy@plt>
  mov    %ebp,%ecx
  mov    %r13,%rdx
  xor    %esi,%esi
  xor    %edi,%edi
  call   <vsnprintf@plt>
  mov    %ebp,%edi
  mov    %eax,%ebx
  call   <va_end@plt>
  lea    0x2(%rbx),%edi
  call   <malloc@plt>
  test   %rax,%rax
  je     L1
  lea    0x1(%rbx),%esi
  mov    %r12d,%ecx
  mov    %r13,%rdx
  mov    %rax,%rdi
  mov    %rax,%r14
  call   <vsnprintf@plt>
L1:
  pop    %rbx
  mov    %r14,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
char *strdup_vprintf(const char *format, va_list ap) {
  va_list ap2;
  int size;
  char *buffer;
  va_copy(ap2, ap);
  size = vsnprintf(NULL, 0, format, ap2) + 1;
  va_end(ap2);
  buffer = (char *)malloc(size + 1);
  if (!buffer)
    return NULL;
  vsnprintf(buffer, size, format, ap);
  return buffer;
}
```
user: Translate the below assembly code into C programming language:

```asm
<TIM1_TRG_COM_TIM17_ISR>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0x0,%eax
  call   <TIM1_TRG_COM_ISR@plt>
  mov    $0x0,%eax
  call   <TIM17_ISR@plt>
  nop
  pop    %rbp
  ret
```

assistant: ```c
void TIM1_TRG_COM_TIM17_ISR(void) {
  TIM1_TRG_COM_ISR();
  TIM17_ISR();
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<TIM1_TRG_COM_TIM17_ISR>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x0,%eax
  call   <TIM1_TRG_COM_ISR@plt>
  mov    $0x0,%eax
  call   <TIM17_ISR@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void TIM1_TRG_COM_TIM17_ISR(void) {
  TIM1_TRG_COM_ISR();
  TIM17_ISR();
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<TIM1_TRG_COM_TIM17_ISR>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <TIM1_TRG_COM_ISR@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  jmp    1060 <TIM17_ISR@plt>
```

assistant: ```c
void TIM1_TRG_COM_TIM17_ISR(void) {
  TIM1_TRG_COM_ISR();
  TIM17_ISR();
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<TIM1_TRG_COM_TIM17_ISR>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <TIM1_TRG_COM_ISR@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  jmp    1060 <TIM17_ISR@plt>
```

assistant: ```c
void TIM1_TRG_COM_TIM17_ISR(void) {
  TIM1_TRG_COM_ISR();
  TIM17_ISR();
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<tosFilename_split>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,%rbx
  mov    %rsi,%r12
  mov    %rdx,%rbp
  mov    %rcx,%r13
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  test   %rsi,%rsi
  je     L41
  movb   $0x0,(%rsi)
L41:
  test   %rbp,%rbp
  je     L127
  movb   $0x0,0x0(%rbp)
L127:
  test   %r13,%r13
  je     L63
  movb   $0x0,0x0(%r13)
L63:
  lea    0x14(%rsp),%rcx
  lea    0x10(%rsp),%rdx
  lea    0xc(%rsp),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <tosFilename_getSlashDotLen@plt>
  mov    0xc(%rsp),%edx
  movslq %edx,%rax
  movzbl (%rbx,%rax,1),%eax
  sub    $0x2f,%eax
  cmp    $0x2d,%al
  ja     L14
  movabs $0x200000000801,%rcx
  bt     %rax,%rcx
  jae    L14
  test   %r12,%r12
  je     L114
  add    $0x1,%edx
  mov    %rbx,%rcx
  mov    $0x0,%esi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <tosString_extract@plt>
L114:
  test   %rbp,%rbp
  je     L111
  mov    0xc(%rsp),%esi
  lea    -0x1(%rsi),%eax
  mov    0x10(%rsp),%edx
  sub    %eax,%edx
  add    $0x1,%esi
  mov    %rbx,%rcx
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <tosString_extract@plt>
L111:
  mov    0x10(%rsp),%esi
  movslq %esi,%rax
  cmpb   $0x2e,(%rbx,%rax,1)
  jne    L88
  test   %r13,%r13
  jne    L30
L88:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L104
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L14:
  test   %rbp,%rbp
  je     L111
  mov    0x10(%rsp),%eax
  sub    %edx,%eax
  mov    %rbx,%rcx
  mov    %eax,%edx
  mov    $0x0,%esi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <tosString_extract@plt>
  jmp    L111
L30:
  mov    0x14(%rsp),%edx
  sub    %esi,%edx
  add    $0x1,%esi
  mov    %rbx,%rcx
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <tosString_extract@plt>
  jmp    L88
L104:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void tosFilename_split(const char *pszFilename, char *pszPath, char *pszName, char *pszExtension) {
  int slash, dot, len;
  if (pszPath != ((void *)0))
    *pszPath = '\0';
  if (pszName != ((void *)0))
    *pszName = '\0';
  if (pszExtension != ((void *)0))
    *pszExtension = '\0';
  tosFilename_getSlashDotLen(pszFilename, &slash, &dot, &len);
  if ((pszFilename[slash] == '\\') || (pszFilename[slash] == '/') || (pszFilename[slash] == ':')) {
    if (pszPath != ((void *)0))
      tosString_extract(pszPath, 0, slash + 1, pszFilename);
    if (pszName != ((void *)0))
      tosString_extract(pszName, slash + 1, dot - (slash - 1), pszFilename);
  } else if (pszName != ((void *)0))
    tosString_extract(pszName, 0, dot - slash, pszFilename);
  if ((pszFilename[dot] == '.') && (pszExtension != ((void *)0)))
    tosString_extract(pszExtension, dot + 1, len - dot, pszFilename);
}
```
user: Translate the below assembly code into C programming language:

```asm
<tosFilename_split>:
  endbr64
  push   %r14
  mov    %rcx,%r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %rdx,%rbp
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  test   %rsi,%rsi
  je     L123
  movb   $0x0,(%rsi)
L123:
  test   %rbp,%rbp
  je     L48
  movb   $0x0,0x0(%rbp)
L48:
  test   %r14,%r14
  je     L115
  movb   $0x0,(%r14)
L115:
  lea    0x14(%rsp),%rcx
  lea    0x10(%rsp),%rdx
  mov    %r12,%rdi
  xor    %eax,%eax
  lea    0xc(%rsp),%rsi
  call   <tosFilename_getSlashDotLen@plt>
  movslq 0xc(%rsp),%rax
  mov    %rax,%rcx
  movzbl (%r12,%rax,1),%eax
  sub    $0x2f,%eax
  cmp    $0x2d,%al
  jbe    L83
L112:
  mov    0x10(%rsp),%edx
  test   %rbp,%rbp
  je     L121
  sub    %ecx,%edx
  xor    %esi,%esi
  mov    %r12,%rcx
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <tosString_extract@plt>
  mov    0x10(%rsp),%edx
L121:
  movslq %edx,%rax
  cmpb   $0x2e,(%r12,%rax,1)
  jne    L37
  test   %r14,%r14
  jne    L26
L37:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L28
  add    $0x28,%rsp
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nop
L83:
  movabs $0xffffdffffffff7fe,%rdx
  bt     %rax,%rdx
  jb     L112
  test   %r13,%r13
  je     L41
  lea    0x1(%rcx),%edx
  xor    %esi,%esi
  mov    %r12,%rcx
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <tosString_extract@plt>
L41:
  mov    0x10(%rsp),%edx
  test   %rbp,%rbp
  je     L121
  mov    0xc(%rsp),%esi
  mov    %r12,%rcx
  mov    %rbp,%rdi
  lea    -0x1(%rsi),%eax
  add    $0x1,%esi
  sub    %eax,%edx
  xor    %eax,%eax
  call   <tosString_extract@plt>
  mov    0x10(%rsp),%edx
  jmp    L121
  nop
L26:
  mov    0x14(%rsp),%r8d
  lea    0x1(%rdx),%esi
  mov    %r12,%rcx
  mov    %r14,%rdi
  xor    %eax,%eax
  sub    %edx,%r8d
  mov    %r8d,%edx
  call   <tosString_extract@plt>
  jmp    L37
L28:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void tosFilename_split(const char *pszFilename, char *pszPath, char *pszName, char *pszExtension) {
  int slash, dot, len;
  if (pszPath != ((void *)0))
    *pszPath = '\0';
  if (pszName != ((void *)0))
    *pszName = '\0';
  if (pszExtension != ((void *)0))
    *pszExtension = '\0';
  tosFilename_getSlashDotLen(pszFilename, &slash, &dot, &len);
  if ((pszFilename[slash] == '\\') || (pszFilename[slash] == '/') || (pszFilename[slash] == ':')) {
    if (pszPath != ((void *)0))
      tosString_extract(pszPath, 0, slash + 1, pszFilename);
    if (pszName != ((void *)0))
      tosString_extract(pszName, slash + 1, dot - (slash - 1), pszFilename);
  } else if (pszName != ((void *)0))
    tosString_extract(pszName, 0, dot - slash, pszFilename);
  if ((pszFilename[dot] == '.') && (pszExtension != ((void *)0)))
    tosString_extract(pszExtension, dot + 1, len - dot, pszFilename);
}
```
user: What is the c source code of the assembly code below:

```asm
<tosFilename_split>:
  endbr64
  push   %r14
  mov    %rcx,%r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %rdx,%rbp
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  test   %rsi,%rsi
  je     L62
  movb   $0x0,(%rsi)
L62:
  test   %rbp,%rbp
  je     L25
  movb   $0x0,0x0(%rbp)
L25:
  test   %r14,%r14
  je     L11
  movb   $0x0,(%r14)
L11:
  lea    0x14(%rsp),%rcx
  lea    0x10(%rsp),%rdx
  mov    %r12,%rdi
  xor    %eax,%eax
  lea    0xc(%rsp),%rsi
  call   <tosFilename_getSlashDotLen@plt>
  movslq 0xc(%rsp),%rax
  mov    %rax,%rcx
  movzbl (%r12,%rax,1),%eax
  sub    $0x2f,%eax
  cmp    $0x2d,%al
  jbe    L83
L123:
  mov    0x10(%rsp),%edx
  test   %rbp,%rbp
  je     L82
  sub    %ecx,%edx
  xor    %esi,%esi
  mov    %r12,%rcx
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <tosString_extract@plt>
  mov    0x10(%rsp),%edx
L82:
  movslq %edx,%rax
  cmpb   $0x2e,(%r12,%rax,1)
  jne    L5
  test   %r14,%r14
  jne    L49
L5:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L9
  add    $0x28,%rsp
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nop
L83:
  movabs $0xffffdffffffff7fe,%rdx
  bt     %rax,%rdx
  jb     L123
  test   %r13,%r13
  je     L104
  lea    0x1(%rcx),%edx
  xor    %esi,%esi
  mov    %r12,%rcx
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <tosString_extract@plt>
L104:
  mov    0x10(%rsp),%edx
  test   %rbp,%rbp
  je     L82
  mov    0xc(%rsp),%esi
  mov    %r12,%rcx
  mov    %rbp,%rdi
  lea    -0x1(%rsi),%eax
  add    $0x1,%esi
  sub    %eax,%edx
  xor    %eax,%eax
  call   <tosString_extract@plt>
  mov    0x10(%rsp),%edx
  jmp    L82
  nop
L49:
  mov    0x14(%rsp),%r8d
  lea    0x1(%rdx),%esi
  mov    %r12,%rcx
  mov    %r14,%rdi
  xor    %eax,%eax
  sub    %edx,%r8d
  mov    %r8d,%edx
  call   <tosString_extract@plt>
  jmp    L5
L9:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void tosFilename_split(const char *pszFilename, char *pszPath, char *pszName, char *pszExtension) {
  int slash, dot, len;
  if (pszPath != ((void *)0))
    *pszPath = '\0';
  if (pszName != ((void *)0))
    *pszName = '\0';
  if (pszExtension != ((void *)0))
    *pszExtension = '\0';
  tosFilename_getSlashDotLen(pszFilename, &slash, &dot, &len);
  if ((pszFilename[slash] == '\\') || (pszFilename[slash] == '/') || (pszFilename[slash] == ':')) {
    if (pszPath != ((void *)0))
      tosString_extract(pszPath, 0, slash + 1, pszFilename);
    if (pszName != ((void *)0))
      tosString_extract(pszName, slash + 1, dot - (slash - 1), pszFilename);
  } else if (pszName != ((void *)0))
    tosString_extract(pszName, 0, dot - slash, pszFilename);
  if ((pszFilename[dot] == '.') && (pszExtension != ((void *)0)))
    tosString_extract(pszExtension, dot + 1, len - dot, pszFilename);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    $0x11,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
L17:
  mov    D2(%rip),%rax
  mov    (%rax),%edx
  mov    -0x10(%rbp),%rax
  mov    %edx,%ecx
  mov    $0x10,%edx
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <fread@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x10(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0xa,(%rax)
  mov    D9(%rip),%rax
  mov    (%rax),%edx
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rsi
  mov    -0x10(%rbp),%rax
  mov    %edx,%ecx
  mov    %rsi,%rdx
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <fwrite@plt>
  mov    -0x8(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L2
  cmpq   $0x0,-0x8(%rbp)
  je     L2
  jmp    L17
L2:
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0x0,%eax
  leave
  ret
```

assistant: ```c
int main() {
  char *bufor = malloc(sizeof(char) * 17);
  size_t r;
  for (;;) {
    r = fread(bufor, sizeof(char), 16, stdin);
    bufor[r] = '\n';
    fwrite(bufor, sizeof(char), r + 1, stdout);
    if (bufor[r - 1] == '\0' || r == 0)
      break;
  };
  free(bufor);
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<main>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    $0x11,%edi
  call   <malloc@plt>
  mov    %rax,%rbp
  mov    D13(%rip),%r12
L3:
  mov    (%r12),%ecx
  mov    $0x10,%edx
  mov    $0x1,%esi
  mov    %rbp,%rdi
  call   <fread@plt>
  mov    %rax,%rbx
  movb   $0xa,0x0(%rbp,%rax,1)
  lea    0x1(%rax),%rdx
  mov    D0(%rip),%rax
  mov    (%rax),%ecx
  mov    $0x1,%esi
  mov    %rbp,%rdi
  call   <fwrite@plt>
  cmpb   $0x0,-0x1(%rbp,%rbx,1)
  je     L6
  test   %rbx,%rbx
  jne    L3
L6:
  mov    %rbp,%rdi
  call   <free@plt>
  mov    $0x0,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
int main() {
  char *bufor = malloc(sizeof(char) * 17);
  size_t r;
  for (;;) {
    r = fread(bufor, sizeof(char), 16, stdin);
    bufor[r] = '\n';
    fwrite(bufor, sizeof(char), r + 1, stdout);
    if (bufor[r - 1] == '\0' || r == 0)
      break;
  };
  free(bufor);
  return 0;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<main>:
  endbr64
  push   %r13
  mov    $0x11,%edi
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <malloc@plt>
  mov    D13(%rip),%r13
  mov    D0(%rip),%r12
  mov    %rax,%rbp
  jmp    L15
  nopl   0x0(%rax,%rax,1)
L20:
  test   %rbx,%rbx
  je     L8
L15:
  mov    0x0(%r13),%ecx
  mov    $0x10,%edx
  mov    $0x1,%esi
  mov    %rbp,%rdi
  call   <fread@plt>
  mov    $0x1,%esi
  mov    %rbp,%rdi
  movb   $0xa,0x0(%rbp,%rax,1)
  mov    (%r12),%ecx
  mov    %rax,%rbx
  lea    0x1(%rax),%rdx
  call   <fwrite@plt>
  cmpb   $0x0,-0x1(%rbp,%rbx,1)
  jne    L20
L8:
  mov    %rbp,%rdi
  call   <free@plt>
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
int main() {
  char *bufor = malloc(sizeof(char) * 17);
  size_t r;
  for (;;) {
    r = fread(bufor, sizeof(char), 16, stdin);
    bufor[r] = '\n';
    fwrite(bufor, sizeof(char), r + 1, stdout);
    if (bufor[r - 1] == '\0' || r == 0)
      break;
  };
  free(bufor);
  return 0;
}
```