ylfeng/ReF-Decompile-dataset huggingface dataset:
user: What would the C source look like for the assembly code provided here:

```asm
<bar>:
  endbr64
  ret
```

assistant: ```c
void bar() {
  float f;
  double d;
  long double ld;
  f = __builtin_huge_valf();
  d = __builtin_huge_val();
  ld = __builtin_huge_vall();
  f = __builtin_nanf("");
  d = __builtin_nan("");
  ld = __builtin_nanl("");
  f = __builtin_nanf("0xAE98");
  d = __builtin_nan("0xAE98");
  ld = __builtin_nanl("0xAE98");
  f = __builtin_nansf("");
  d = __builtin_nans("");
  ld = __builtin_nansl("");
  f = __builtin_nansf("0xAE98");
  d = __builtin_nans("0xAE98");
  ld = __builtin_nansl("0xAE98");
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<bar>:
  endbr64
  ret
```

assistant: ```c
void bar() {
  float f;
  double d;
  long double ld;
  f = __builtin_huge_valf();
  d = __builtin_huge_val();
  ld = __builtin_huge_vall();
  f = __builtin_nanf("");
  d = __builtin_nan("");
  ld = __builtin_nanl("");
  f = __builtin_nanf("0xAE98");
  d = __builtin_nan("0xAE98");
  ld = __builtin_nanl("0xAE98");
  f = __builtin_nansf("");
  d = __builtin_nans("");
  ld = __builtin_nansl("");
  f = __builtin_nansf("0xAE98");
  d = __builtin_nans("0xAE98");
  ld = __builtin_nansl("0xAE98");
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<token_nextline>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  nop
L18:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <fgetc@plt>
  mov    %eax,-0x4(%rbp)
  mov    D11(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x4(%rbp)
  je     L5
  cmpl   $0xa,-0x4(%rbp)
  jne    L18
L5:
  cmpl   $0xa,-0x4(%rbp)
  jne    L26
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <token_incline@plt>
L26:
  mov    D11(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x4(%rbp)
  setne  %al
  movzbl %al,%eax
  leave
  ret
```

assistant: ```c
int token_nextline(FILE *f, int *linenum) {
  int c;
  while ((c = fgetc(f)) != EOF && c != '\n')
    ;
  if (c == '\n')
    token_incline(linenum);
  return (c != EOF);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<token_nextline>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbp
  mov    %rsi,%r12
L30:
  mov    %rbp,%rdi
  call   <fgetc@plt>
  mov    %eax,%ebx
  mov    D3(%rip),%rax
  cmp    %ebx,(%rax)
  je     L37
  cmp    $0xa,%ebx
  jne    L30
L37:
  cmp    $0xa,%ebx
  je     L36
L6:
  mov    D3(%rip),%rax
  cmp    %ebx,(%rax)
  setne  %al
  movzbl %al,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L36:
  mov    %r12,%rdi
  call   <token_incline@plt>
  jmp    L6
```

assistant: ```c
int token_nextline(FILE *f, int *linenum) {
  int c;
  while ((c = fgetc(f)) != EOF && c != '\n')
    ;
  if (c == '\n')
    token_incline(linenum);
  return (c != EOF);
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<token_nextline>:
  endbr64
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    D2(%rip),%rbp
  push   %rbx
  mov    %rdi,%rbx
  jmp    L18
  nopw   0x0(%rax,%rax,1)
L2:
  cmp    $0xa,%eax
  je     L25
L18:
  mov    %rbx,%rdi
  call   <fgetc@plt>
  cmp    %eax,0x0(%rbp)
  jne    L2
  cmp    $0xa,%eax
  je     L25
  mov    %eax,%edx
  pop    %rbx
  pop    %rbp
  cmp    %eax,%edx
  pop    %r12
  setne  %al
  movzbl %al,%eax
  ret
  cs nopw 0x0(%rax,%rax,1)
L25:
  mov    %r12,%rdi
  call   <token_incline@plt>
  mov    0x0(%rbp),%edx
  mov    $0xa,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  cmp    %eax,%edx
  setne  %al
  movzbl %al,%eax
  ret
```

assistant: ```c
int token_nextline(FILE *f, int *linenum) {
  int c;
  while ((c = fgetc(f)) != EOF && c != '\n')
    ;
  if (c == '\n')
    token_incline(linenum);
  return (c != EOF);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<token_nextline>:
  endbr64
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    D0(%rip),%rbp
  push   %rbx
  mov    %rdi,%rbx
  jmp    L38
  nopw   0x0(%rax,%rax,1)
L20:
  cmp    $0xa,%eax
  je     L1
L38:
  mov    %rbx,%rdi
  call   <fgetc@plt>
  cmp    %eax,0x0(%rbp)
  jne    L20
  cmp    $0xa,%eax
  je     L1
  mov    %eax,%edx
  pop    %rbx
  pop    %rbp
  cmp    %eax,%edx
  pop    %r12
  setne  %al
  movzbl %al,%eax
  ret
  cs nopw 0x0(%rax,%rax,1)
L1:
  mov    %r12,%rdi
  call   <token_incline@plt>
  mov    0x0(%rbp),%edx
  mov    $0xa,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  cmp    %eax,%edx
  setne  %al
  movzbl %al,%eax
  ret
```

assistant: ```c
int token_nextline(FILE *f, int *linenum) {
  int c;
  while ((c = fgetc(f)) != EOF && c != '\n')
    ;
  if (c == '\n')
    token_incline(linenum);
  return (c != EOF);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<WriteWord>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %esi,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  movzbl %al,%edx
  mov    -0x8(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <WriteByte@plt>
  mov    -0xc(%rbp),%eax
  sar    $0x8,%eax
  movzbl %al,%edx
  mov    -0x8(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <WriteByte@plt>
  nop
  leave
  ret
```

assistant: ```c
void WriteWord(FILE *fp, int w) {
  WriteByte(fp, ((w)&0xff));
  WriteByte(fp, (((w)&0xff00) >> 8));
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<WriteWord>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  mov    %esi,%ebx
  movzbl %sil,%esi
  call   <WriteByte@plt>
  movzbl %bh,%esi
  mov    %rbp,%rdi
  call   <WriteByte@plt>
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
void WriteWord(FILE *fp, int w) {
  WriteByte(fp, ((w)&0xff));
  WriteByte(fp, (((w)&0xff00) >> 8));
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<WriteWord>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %esi,%ebx
  movzbl %sil,%esi
  sub    $0x8,%rsp
  call   <WriteByte@plt>
  add    $0x8,%rsp
  movzbl %bh,%esi
  mov    %rbp,%rdi
  pop    %rbx
  pop    %rbp
  jmp    1050 <WriteByte@plt>
```

assistant: ```c
void WriteWord(FILE *fp, int w) {
  WriteByte(fp, ((w)&0xff));
  WriteByte(fp, (((w)&0xff00) >> 8));
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<WriteWord>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %esi,%ebx
  movzbl %sil,%esi
  sub    $0x8,%rsp
  call   <WriteByte@plt>
  add    $0x8,%rsp
  movzbl %bh,%esi
  mov    %rbp,%rdi
  pop    %rbx
  pop    %rbp
  jmp    1050 <WriteByte@plt>
```

assistant: ```c
void WriteWord(FILE *fp, int w) {
  WriteByte(fp, ((w)&0xff));
  WriteByte(fp, (((w)&0xff00) >> 8));
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<alloc_hash>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x30(%rbp),%rdx
  lea    -0x20(%rbp),%rax
  mov    -0x28(%rbp),%rcx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   *%rcx
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L7
  call   <__stack_chk_fail@plt>
L7:
  leave
  ret
```

assistant: ```c
void alloc_hash(void (*func)(unsigned char *, void *), void *arg) {
  unsigned char c[20];
  (*func)(c, arg);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<alloc_hash>:
  endbr64
  sub    $0x28,%rsp
  mov    %rdi,%rax
  mov    %fs:0x28,%rdx
  mov    %rdx,0x18(%rsp)
  xor    %edx,%edx
  mov    %rsp,%rdi
  call   *%rax
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L2
  add    $0x28,%rsp
  ret
L2:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void alloc_hash(void (*func)(unsigned char *, void *), void *arg) {
  unsigned char c[20];
  (*func)(c, arg);
}
```
user: Translate the below assembly code into C programming language:

```asm
<alloc_hash>:
  endbr64
  sub    $0x28,%rsp
  mov    %rdi,%r8
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rdi
  call   *%r8
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L2
  add    $0x28,%rsp
  ret
L2:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void alloc_hash(void (*func)(unsigned char *, void *), void *arg) {
  unsigned char c[20];
  (*func)(c, arg);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<alloc_hash>:
  endbr64
  sub    $0x28,%rsp
  mov    %rdi,%r8
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rdi
  call   *%r8
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  add    $0x28,%rsp
  ret
L0:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void alloc_hash(void (*func)(unsigned char *, void *), void *arg) {
  unsigned char c[20];
  (*func)(c, arg);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<update_nextconf>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strdup@plt>
  mov    %rax,-0x30(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  lea    -0x30(%rbp),%rax
  lea    D17(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strsep@plt>
  mov    %rax,-0x20(%rbp)
  lea    -0x30(%rbp),%rax
  lea    D17(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strsep@plt>
  mov    %rax,-0x18(%rbp)
  lea    -0x30(%rbp),%rax
  lea    D17(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strsep@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x38(%rbp),%rax
  lea    D28(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L79
  cmpq   $0x0,-0x20(%rbp)
  je     L63
  cmpq   $0x0,-0x18(%rbp)
  je     L63
  cmpq   $0x0,-0x10(%rbp)
  je     L63
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L63
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L63
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L63
  mov    -0x38(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  mov    %rdx,%rcx
  lea    D43(%rip),%rdx
  mov    $0x1a5,%esi
  mov    %rax,%rdi
  call   <snprintf@plt>
  jmp    L79
L63:
  mov    -0x38(%rbp),%rax
  mov    %rax,%rsi
  lea    D4(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
L79:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L41
  call   <__stack_chk_fail@plt>
L41:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: tag: D17
type: string
name: unpack_data
arguments: tag: D28
type: string
name: unpack_data
arguments: tag: D43
type: string
name: unpack_data
arguments: tag: D4
type: string

tool: D17: :

tool: D28: -

tool: D43: %s

tool: D4: Bad next_settings '%s': should be for example 'mmcblk0p1:vfat:flipflop.txt'


assistant: ```c
void update_nextconf(const char *val, char *next_settings) {
  char *work = strdup(val);
  char *free_work = work;
  char *dev = strsep(&work, ":");
  char *fstype = strsep(&work, ":");
  char *file = strsep(&work, ":");
  if (strcmp(val, "-") == 0) {
  } else if (dev && fstype && file && *dev && *fstype && *file) {
    snprintf(next_settings, 421, "%s", val);
  } else {
    printf("Bad next_settings '%s': should be for example 'mmcblk0p1:vfat:flipflop.txt'\n", val);
  }
  free(free_work);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<update_nextconf>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,%rbx
  mov    %rsi,0x8(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  call   <strdup@plt>
  mov    %rax,%rbp
  mov    %rax,0x10(%rsp)
  lea    0x10(%rsp),%r12
  lea    D28(%rip),%r13
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <strsep@plt>
  mov    %rax,%r14
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <strsep@plt>
  mov    %rax,%r15
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <strsep@plt>
  mov    %rax,%r12
  lea    D25(%rip),%rsi
  mov    %rbx,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L28
  test   %r14,%r14
  setne  %dl
  test   %r15,%r15
  setne  %al
  test   %al,%dl
  je     L5
  test   %r12,%r12
  je     L5
  cmpb   $0x0,(%r14)
  je     L5
  cmpb   $0x0,(%r15)
  je     L5
  cmpb   $0x0,(%r12)
  jne    L62
L5:
  mov    %rbx,%rsi
  lea    D11(%rip),%rdi
  call   <printf@plt>
L28:
  mov    %rbp,%rdi
  call   <free@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L53
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L62:
  mov    %rbx,%rcx
  lea    D23(%rip),%rdx
  mov    $0x1a5,%esi
  mov    0x8(%rsp),%rdi
  call   <snprintf@plt>
  jmp    L28
L53:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D28
type_infered: string
name: disassemble_data
arguments: data_label: D25
type_infered: string
name: disassemble_data
arguments: data_label: D11
type_infered: string
name: disassemble_data
arguments: data_label: D23
type_infered: string

tool: D28: :

tool: D25: -

tool: D11: Bad next_settings '%s': should be for example 'mmcblk0p1:vfat:flipflop.txt'


tool: D23: %s

assistant: ```c
void update_nextconf(const char *val, char *next_settings) {
  char *work = strdup(val);
  char *free_work = work;
  char *dev = strsep(&work, ":");
  char *fstype = strsep(&work, ":");
  char *file = strsep(&work, ":");
  if (strcmp(val, "-") == 0) {
  } else if (dev && fstype && file && *dev && *fstype && *file) {
    snprintf(next_settings, 421, "%s", val);
  } else {
    printf("Bad next_settings '%s': should be for example 'mmcblk0p1:vfat:flipflop.txt'\n", val);
  }
  free(free_work);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<update_nextconf>:
  endbr64
  push   %r15
  lea    D17(%rip),%r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rsi,0x8(%rsp)
  lea    0x10(%rsp),%r13
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  call   <strdup@plt>
  mov    %r13,%rdi
  mov    %r15,%rsi
  mov    %rax,0x10(%rsp)
  mov    %rax,%r12
  call   <strsep@plt>
  mov    %r13,%rdi
  mov    %r15,%rsi
  mov    %rax,%rbx
  call   <strsep@plt>
  mov    %r13,%rdi
  mov    %r15,%rsi
  mov    %rax,%r14
  call   <strsep@plt>
  lea    D10(%rip),%rsi
  mov    %rbp,%rdi
  mov    %rax,%r13
  call   <strcmp@plt>
  test   %rax,%rax
  je     L49
  test   %rbx,%rbx
  setne  %dl
  test   %r14,%r14
  setne  %al
  test   %al,%dl
  je     L74
  test   %r13,%r13
  je     L74
  cmpb   $0x0,(%rbx)
  je     L74
  cmpb   $0x0,(%r14)
  je     L74
  cmpb   $0x0,0x0(%r13)
  jne    L76
  nopl   0x0(%rax,%rax,1)
L74:
  mov    %rbp,%rsi
  lea    D8(%rip),%rdi
  call   <printf@plt>
L49:
  mov    %r12,%rdi
  call   <free@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L23
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L76:
  mov    0x8(%rsp),%rdi
  mov    %rbp,%rcx
  mov    $0x1a5,%esi
  lea    D7(%rip),%rdx
  call   <snprintf@plt>
  jmp    L49
L23:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D17
datatype: string
name: unpack_data
arguments: data_tag: D10
datatype: string
name: unpack_data
arguments: data_tag: D8
datatype: string
name: unpack_data
arguments: data_tag: D7
datatype: string

tool: D17: :

tool: D10: -

tool: D8: Bad next_settings '%s': should be for example 'mmcblk0p1:vfat:flipflop.txt'


tool: D7: %s

assistant: ```c
void update_nextconf(const char *val, char *next_settings) {
  char *work = strdup(val);
  char *free_work = work;
  char *dev = strsep(&work, ":");
  char *fstype = strsep(&work, ":");
  char *file = strsep(&work, ":");
  if (strcmp(val, "-") == 0) {
  } else if (dev && fstype && file && *dev && *fstype && *file) {
    snprintf(next_settings, 421, "%s", val);
  } else {
    printf("Bad next_settings '%s': should be for example 'mmcblk0p1:vfat:flipflop.txt'\n", val);
  }
  free(free_work);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<update_nextconf>:
  endbr64
  push   %r15
  lea    D29(%rip),%r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rsi,0x8(%rsp)
  lea    0x10(%rsp),%r13
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  call   <strdup@plt>
  mov    %r13,%rdi
  mov    %r15,%rsi
  mov    %rax,0x10(%rsp)
  mov    %rax,%r12
  call   <strsep@plt>
  mov    %r13,%rdi
  mov    %r15,%rsi
  mov    %rax,%rbx
  call   <strsep@plt>
  mov    %r13,%rdi
  mov    %r15,%rsi
  mov    %rax,%r14
  call   <strsep@plt>
  lea    D13(%rip),%rsi
  mov    %rbp,%rdi
  mov    %rax,%r13
  call   <strcmp@plt>
  test   %rax,%rax
  je     L30
  test   %rbx,%rbx
  setne  %dl
  test   %r14,%r14
  setne  %al
  test   %al,%dl
  je     L49
  test   %r13,%r13
  je     L49
  cmpb   $0x0,(%rbx)
  je     L49
  cmpb   $0x0,(%r14)
  je     L49
  cmpb   $0x0,0x0(%r13)
  jne    L36
  nopl   0x0(%rax,%rax,1)
L49:
  mov    %rbp,%rsi
  lea    D25(%rip),%rdi
  call   <printf@plt>
L30:
  mov    %r12,%rdi
  call   <free@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L33
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L36:
  mov    0x8(%rsp),%rdi
  mov    %rbp,%rcx
  mov    $0x1a5,%esi
  lea    D35(%rip),%rdx
  call   <snprintf@plt>
  jmp    L30
L33:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_label: D29
datatype: string
name: read_data
arguments: data_label: D13
datatype: string
name: read_data
arguments: data_label: D25
datatype: string
name: read_data
arguments: data_label: D35
datatype: string

tool: D29: :

tool: D13: -

tool: D25: Bad next_settings '%s': should be for example 'mmcblk0p1:vfat:flipflop.txt'


tool: D35: %s

assistant: ```c
void update_nextconf(const char *val, char *next_settings) {
  char *work = strdup(val);
  char *free_work = work;
  char *dev = strsep(&work, ":");
  char *fstype = strsep(&work, ":");
  char *file = strsep(&work, ":");
  if (strcmp(val, "-") == 0) {
  } else if (dev && fstype && file && *dev && *fstype && *file) {
    snprintf(next_settings, 421, "%s", val);
  } else {
    printf("Bad next_settings '%s': should be for example 'mmcblk0p1:vfat:flipflop.txt'\n", val);
  }
  free(free_work);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<nmatch>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L75
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2a,%al
  jne    L75
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <nmatch>
  mov    %eax,%ebx
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    -0x20(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <nmatch>
  add    %ebx,%eax
  jmp    L21
L75:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L20
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2a,%al
  jne    L20
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    -0x20(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <nmatch>
  jmp    L21
L20:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%edx
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  jne    L125
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L125
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L125
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    -0x20(%rbp),%rax
  add    $0x1,%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <nmatch>
  jmp    L21
L125:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%edx
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  jne    L40
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L40
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L40
  mov    $0x1,%eax
  jmp    L21
L40:
  mov    $0x0,%eax
L21:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
int nmatch(char *s1, char *s2) {
  char *tmp1;
  char *tmp2;
  tmp1 = s1;
  tmp2 = s2;
  if (*tmp1 != '\0' && *tmp2 == '*')
    return (nmatch(tmp1 + 1, tmp2) + nmatch(tmp1, tmp2 + 1));
  if (*tmp1 == '\0' && *tmp2 == '*')
    return (nmatch(tmp1, tmp2 + 1));
  if (*tmp1 == *tmp2 && *tmp1 != '\0' && *tmp2 != '\0')
    return (nmatch(tmp1 + 1, tmp2 + 1));
  if (*tmp1 == *tmp2 && *tmp1 == '\0' && *tmp2 == '\0')
    return (1);
  return (0);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<nmatch>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbp
  mov    %rsi,%rbx
  movzbl (%rdi),%ecx
  test   %cl,%cl
  je     L52
  movzbl (%rsi),%edx
  cmp    $0x2a,%dl
  je     L16
  cmp    %dl,%cl
  sete   %sil
  test   %dl,%dl
  je     L50
  test   %sil,%sil
  je     L50
  lea    0x1(%rbx),%rsi
  lea    0x1(%rdi),%rdi
  call   <nmatch>
  jmp    L13
L16:
  lea    0x1(%rdi),%rdi
  call   <nmatch>
  mov    %eax,%r12d
  lea    0x1(%rbx),%rsi
  mov    %rbp,%rdi
  call   <nmatch>
  add    %r12d,%eax
  jmp    L13
L52:
  movzbl (%rsi),%edx
  test   %dl,%dl
  sete   %sil
  cmp    $0x2a,%dl
  je     L24
L50:
  or     %dl,%cl
  sete   %al
  movzbl %al,%eax
  and    %esi,%eax
L13:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L24:
  lea    0x1(%rbx),%rsi
  call   <nmatch>
  jmp    L13
```

assistant: ```c
int nmatch(char *s1, char *s2) {
  char *tmp1;
  char *tmp2;
  tmp1 = s1;
  tmp2 = s2;
  if (*tmp1 != '\0' && *tmp2 == '*')
    return (nmatch(tmp1 + 1, tmp2) + nmatch(tmp1, tmp2 + 1));
  if (*tmp1 == '\0' && *tmp2 == '*')
    return (nmatch(tmp1, tmp2 + 1));
  if (*tmp1 == *tmp2 && *tmp1 != '\0' && *tmp2 != '\0')
    return (nmatch(tmp1 + 1, tmp2 + 1));
  if (*tmp1 == *tmp2 && *tmp1 == '\0' && *tmp2 == '\0')
    return (1);
  return (0);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<nmatch>:
  endbr64
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  movzbl (%rdi),%edx
  lea    0x1(%rsi),%rbx
  nopl   (%rax)
L19:
  movzbl -0x1(%rbx),%eax
  lea    -0x1(%rbx),%rsi
  test   %dl,%dl
  jne    L8
  cmp    $0x2a,%al
  je     L47
  cmp    $0x1,%al
  adc    $0x0,%r12d
L28:
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  cs nopw 0x0(%rax,%rax,1)
L8:
  cmp    $0x2a,%al
  je     L44
  cmp    %al,%dl
  jne    L28
  movzbl 0x1(%rbp),%edx
  add    $0x1,%rbp
L47:
  add    $0x1,%rbx
  jmp    L19
  cs nopw 0x0(%rax,%rax,1)
L44:
  lea    0x1(%rbp),%rdi
  add    $0x1,%rbx
  call   <nmatch>
  movzbl 0x0(%rbp),%edx
  add    %eax,%r12d
  jmp    L19
```

assistant: ```c
int nmatch(char *s1, char *s2) {
  char *tmp1;
  char *tmp2;
  tmp1 = s1;
  tmp2 = s2;
  if (*tmp1 != '\0' && *tmp2 == '*')
    return (nmatch(tmp1 + 1, tmp2) + nmatch(tmp1, tmp2 + 1));
  if (*tmp1 == '\0' && *tmp2 == '*')
    return (nmatch(tmp1, tmp2 + 1));
  if (*tmp1 == *tmp2 && *tmp1 != '\0' && *tmp2 != '\0')
    return (nmatch(tmp1 + 1, tmp2 + 1));
  if (*tmp1 == *tmp2 && *tmp1 == '\0' && *tmp2 == '\0')
    return (1);
  return (0);
}
```