ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 下面的汇编指令对应的C源代码是什么：

```asm
<main>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rsi
  lea    D0(%rip),%rdi
  call   <scanf@plt>
  mov    0x4(%rsp),%eax
  sub    $0x1,%eax
  cmp    $0x3,%eax
  jbe    L7
  lea    D0(%rip),%rbx
L95:
  lea    0x4(%rsp),%rsi
  mov    %rbx,%rdi
  call   <scanf@plt>
  mov    0x4(%rsp),%eax
  sub    $0x1,%eax
  cmp    $0x3,%eax
  ja     L95
L7:
  mov    0x4(%rsp),%ebp
  cmp    $0x1,%ebp
  je     L72
  cmp    $0x2,%ebp
  je     L90
  cmp    $0x3,%ebp
  sete   %r13b
  movzbl %r13b,%r13d
  cmp    $0x4,%ebp
  je     L1
  mov    $0x0,%r12d
  mov    $0x0,%ebp
  jmp    L13
L141:
  lea    0x4(%rsp),%rsi
  mov    %rbx,%rdi
  call   <scanf@plt>
  mov    0x4(%rsp),%eax
  sub    $0x1,%eax
  cmp    $0x3,%eax
  ja     L141
  jmp    L111
L36:
  add    $0x1,%ebp
L89:
  lea    0x4(%rsp),%rsi
  mov    %rbx,%rdi
  call   <scanf@plt>
  mov    0x4(%rsp),%eax
  sub    $0x1,%eax
  cmp    $0x3,%eax
  ja     L141
L111:
  mov    0x4(%rsp),%eax
  cmp    $0x1,%eax
  je     L36
  cmp    $0x2,%eax
  je     L189
  cmp    $0x3,%eax
  je     L82
  cmp    $0x4,%eax
  jne    L89
L92:
  lea    D2(%rip),%rdi
  call   <puts@plt>
  mov    %ebp,%esi
  lea    D31(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %r12d,%esi
  lea    D64(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %r13d,%esi
  lea    D43(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L170
  mov    $0x0,%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L189:
  add    $0x1,%r12d
  jmp    L89
L82:
  add    $0x1,%r13d
  jmp    L89
L1:
  mov    $0x0,%r12d
  mov    $0x0,%ebp
  jmp    L92
L72:
  mov    $0x0,%r12d
L107:
  mov    $0x0,%r13d
L13:
  lea    D0(%rip),%rbx
  jmp    L89
L90:
  mov    $0x1,%r12d
  mov    $0x0,%ebp
  jmp    L107
L170:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_label: D0
type_infered: string
name: read_data
arguments: data_label: D2
type_infered: string
name: read_data
arguments: data_label: D31
type_infered: string
name: read_data
arguments: data_label: D64
type_infered: string
name: read_data
arguments: data_label: D43
type_infered: string

tool: D0: %d

tool: D2: MUITO OBRIGADO

tool: D31: Alcool: %d


tool: D64: Gasolina: %d


tool: D43: Diesel: %d


assistant: ```c
int main() {
  int x, a = 0, g = 0, d = 0;
  scanf("%d", &x);
  if (x < 1 || x > 4) {
    while (x < 1 || x > 4)
      scanf("%d", &x);
  }
  if (x == 1)
    a++;
  else if (x == 2)
    g++;
  else if (x == 3)
    d++;
  while (x != 4) {
    scanf("%d", &x);
    if (x < 1 || x > 4) {
      while (x < 1 || x > 4)
        scanf("%d", &x);
    }
    if (x == 1)
      a++;
    else if (x == 2)
      g++;
    else if (x == 3)
      d++;
  }
  printf("MUITO OBRIGADO\n");
  printf("Alcool: %d\n", a);
  printf("Gasolina: %d\n", g);
  printf("Diesel: %d\n", d);
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  lea    D49(%rip),%rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rbx
  mov    %rbx,%rsi
  jmp    L80
  nopl   0x0(%rax)
L104:
  mov    %rbx,%rsi
L80:
  mov    %rbp,%rdi
  call   <scanf@plt>
  mov    0x4(%rsp),%r12d
  lea    -0x1(%r12),%eax
  cmp    $0x3,%eax
  ja     L104
  cmp    $0x1,%r12d
  je     L86
  cmp    $0x2,%r12d
  je     L132
  xor    %r14d,%r14d
  cmp    $0x3,%r12d
  sete   %r14b
  xor    %r13d,%r13d
  cmp    $0x4,%r12d
  mov    $0x0,%r12d
  je     L49
L10:
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <scanf@plt>
  mov    0x4(%rsp),%eax
  lea    -0x1(%rax),%edx
  cmp    $0x3,%edx
  ja     L122
L48:
  cmp    $0x1,%eax
  je     L73
  cmp    $0x2,%eax
  je     L74
  cmp    $0x3,%eax
  je     L17
L49:
  lea    D30(%rip),%rdi
  call   <puts@plt>
  mov    %r12d,%esi
  lea    D39(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %r13d,%esi
  lea    D23(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  xor    %eax,%eax
  mov    %r14d,%esi
  lea    D45(%rip),%rdi
  call   <printf@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L162
  add    $0x10,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L122:
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <scanf@plt>
  mov    0x4(%rsp),%eax
  lea    -0x1(%rax),%edx
  cmp    $0x3,%edx
  ja     L122
  jmp    L48
L132:
  mov    $0x1,%r13d
  xor    %r12d,%r12d
L107:
  xor    %r14d,%r14d
  jmp    L10
  nopl   (%rax)
L73:
  add    $0x1,%r12d
  jmp    L10
  nopl   0x0(%rax)
L74:
  add    $0x1,%r13d
  jmp    L10
  nopl   0x0(%rax)
L17:
  add    $0x1,%r14d
  jmp    L10
L86:
  xor    %r13d,%r13d
  jmp    L107
L162:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D49
type_guessed: string
name: parse_data
arguments: data_tag: D30
type_guessed: string
name: parse_data
arguments: data_tag: D39
type_guessed: string
name: parse_data
arguments: data_tag: D23
type_guessed: string
name: parse_data
arguments: data_tag: D45
type_guessed: string

tool: D49: %d

tool: D30: MUITO OBRIGADO

tool: D39: Alcool: %d


tool: D23: Gasolina: %d


tool: D45: Diesel: %d


assistant: ```c
int main() {
  int x, a = 0, g = 0, d = 0;
  scanf("%d", &x);
  if (x < 1 || x > 4) {
    while (x < 1 || x > 4)
      scanf("%d", &x);
  }
  if (x == 1)
    a++;
  else if (x == 2)
    g++;
  else if (x == 3)
    d++;
  while (x != 4) {
    scanf("%d", &x);
    if (x < 1 || x > 4) {
      while (x < 1 || x > 4)
        scanf("%d", &x);
    }
    if (x == 1)
      a++;
    else if (x == 2)
      g++;
    else if (x == 3)
      d++;
  }
  printf("MUITO OBRIGADO\n");
  printf("Alcool: %d\n", a);
  printf("Gasolina: %d\n", g);
  printf("Diesel: %d\n", d);
  return 0;
}
```
user: What is the c source code of the assembly code below?

```asm
<main>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  lea    D23(%rip),%rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rbx
  mov    %rbx,%rsi
  jmp    L52
  nopl   0x0(%rax)
L155:
  mov    %rbx,%rsi
L52:
  mov    %rbp,%rdi
  call   <scanf@plt>
  mov    0x4(%rsp),%r12d
  lea    -0x1(%r12),%eax
  cmp    $0x3,%eax
  ja     L155
  cmp    $0x1,%r12d
  je     L94
  cmp    $0x2,%r12d
  je     L48
  xor    %r14d,%r14d
  cmp    $0x3,%r12d
  sete   %r14b
  xor    %r13d,%r13d
  cmp    $0x4,%r12d
  mov    $0x0,%r12d
  je     L26
L24:
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <scanf@plt>
  mov    0x4(%rsp),%eax
  lea    -0x1(%rax),%edx
  cmp    $0x3,%edx
  ja     L154
L41:
  cmp    $0x1,%eax
  je     L90
  cmp    $0x2,%eax
  je     L106
  cmp    $0x3,%eax
  je     L133
L26:
  lea    D0(%rip),%rdi
  call   <puts@plt>
  mov    %r12d,%esi
  lea    D44(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %r13d,%esi
  lea    D37(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  xor    %eax,%eax
  mov    %r14d,%esi
  lea    D38(%rip),%rdi
  call   <printf@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L111
  add    $0x10,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L154:
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <scanf@plt>
  mov    0x4(%rsp),%eax
  lea    -0x1(%rax),%edx
  cmp    $0x3,%edx
  ja     L154
  jmp    L41
L48:
  mov    $0x1,%r13d
  xor    %r12d,%r12d
L118:
  xor    %r14d,%r14d
  jmp    L24
  nopl   (%rax)
L90:
  add    $0x1,%r12d
  jmp    L24
  nopl   0x0(%rax)
L106:
  add    $0x1,%r13d
  jmp    L24
  nopl   0x0(%rax)
L133:
  add    $0x1,%r14d
  jmp    L24
L94:
  xor    %r13d,%r13d
  jmp    L118
L111:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D23
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D0
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D44
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D37
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D38
type_guessed: string

tool: D23: %d

tool: D0: MUITO OBRIGADO

tool: D44: Alcool: %d


tool: D37: Gasolina: %d


tool: D38: Diesel: %d


assistant: ```c
int main() {
  int x, a = 0, g = 0, d = 0;
  scanf("%d", &x);
  if (x < 1 || x > 4) {
    while (x < 1 || x > 4)
      scanf("%d", &x);
  }
  if (x == 1)
    a++;
  else if (x == 2)
    g++;
  else if (x == 3)
    d++;
  while (x != 4) {
    scanf("%d", &x);
    if (x < 1 || x > 4) {
      while (x < 1 || x > 4)
        scanf("%d", &x);
    }
    if (x == 1)
      a++;
    else if (x == 2)
      g++;
    else if (x == 3)
      d++;
  }
  printf("MUITO OBRIGADO\n");
  printf("Alcool: %d\n", a);
  printf("Gasolina: %d\n", g);
  printf("Diesel: %d\n", d);
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<values_equal_display_error>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x18(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  sete   %al
  movzbl %al,%eax
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  jne    L1
  mov    -0x20(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rax,%rsi
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  call   <print_error@plt>
L1:
  mov    -0x4(%rbp),%eax
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: label: D2
type_guessed: string

tool: D2: 0x%x != 0x%x


assistant: ```c
int values_equal_display_error(const void *const left, const void *const right) {
  const int equal = left == right;
  if (!equal) {
    print_error("0x%x != 0x%x\n", left, right);
  }
  return equal;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<values_equal_display_error>:
  endbr64
  push   %rbx
  cmp    %rsi,%rdi
  sete   %bl
  movzbl %bl,%ebx
  je     L8
  mov    %rsi,%rdx
  mov    %rdi,%rsi
  lea    D4(%rip),%rdi
  call   <print_error@plt>
L8:
  mov    %ebx,%eax
  pop    %rbx
  ret
```

tool_calls: name: extract_symbolic_data
arguments: label: D4
datatype: string

tool: D4: 0x%x != 0x%x


assistant: ```c
int values_equal_display_error(const void *const left, const void *const right) {
  const int equal = left == right;
  if (!equal) {
    print_error("0x%x != 0x%x\n", left, right);
  }
  return equal;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<values_equal_display_error>:
  endbr64
  push   %r12
  xor    %r12d,%r12d
  cmp    %rsi,%rdi
  sete   %r12b
  je     L8
  mov    %rsi,%rdx
  mov    %rdi,%rsi
  lea    D5(%rip),%rdi
  call   <print_error@plt>
L8:
  mov    %r12d,%eax
  pop    %r12
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D5
datatype: string

tool: D5: 0x%x != 0x%x


assistant: ```c
int values_equal_display_error(const void *const left, const void *const right) {
  const int equal = left == right;
  if (!equal) {
    print_error("0x%x != 0x%x\n", left, right);
  }
  return equal;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<values_equal_display_error>:
  endbr64
  push   %r12
  xor    %r12d,%r12d
  cmp    %rsi,%rdi
  sete   %r12b
  je     L1
  mov    %rsi,%rdx
  mov    %rdi,%rsi
  lea    D9(%rip),%rdi
  call   <print_error@plt>
L1:
  mov    %r12d,%eax
  pop    %r12
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D9
type_infered: string

tool: D9: 0x%x != 0x%x


assistant: ```c
int values_equal_display_error(const void *const left, const void *const right) {
  const int equal = left == right;
  if (!equal) {
    print_error("0x%x != 0x%x\n", left, right);
  }
  return equal;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<averageNumbersInArray>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movl   $0x0,-0xc(%rbp)
  jmp    L4
L16:
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  -0x8(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  addl   $0x1,-0xc(%rbp)
L4:
  mov    -0xc(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L16
  pxor   %xmm1,%xmm1
  cvtsi2sdl -0x1c(%rbp),%xmm1
  movsd  -0x8(%rbp),%xmm0
  divsd  %xmm1,%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  pop    %rbp
  ret
```

assistant: ```c
double averageNumbersInArray(double arr[], int length) {
  int i;
  double sum = 0;
  for (i = 0; i < length; i++) {
    sum += arr[i];
  }
  return sum / (double)length;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<averageNumbersInArray>:
  endbr64
  test   %esi,%esi
  jle    L28
  mov    %rdi,%rax
  lea    -0x1(%rsi),%edx
  lea    0x8(%rdi,%rdx,8),%rdx
  pxor   %xmm0,%xmm0
L8:
  addsd  (%rax),%xmm0
  add    $0x8,%rax
  cmp    %rdx,%rax
  jne    L8
L24:
  pxor   %xmm1,%xmm1
  cvtsi2sd %esi,%xmm1
  divsd  %xmm1,%xmm0
  ret
L28:
  pxor   %xmm0,%xmm0
  jmp    L24
```

assistant: ```c
double averageNumbersInArray(double arr[], int length) {
  int i;
  double sum = 0;
  for (i = 0; i < length; i++) {
    sum += arr[i];
  }
  return sum / (double)length;
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<averageNumbersInArray>:
  endbr64
  test   %esi,%esi
  jle    L2
  lea    -0x1(%rsi),%eax
  pxor   %xmm0,%xmm0
  lea    0x8(%rdi,%rax,8),%rax
  nopl   0x0(%rax)
L4:
  addsd  (%rdi),%xmm0
  add    $0x8,%rdi
  cmp    %rax,%rdi
  jne    L4
  pxor   %xmm1,%xmm1
  cvtsi2sd %esi,%xmm1
  divsd  %xmm1,%xmm0
  ret
  nopw   0x0(%rax,%rax,1)
L2:
  pxor   %xmm1,%xmm1
  pxor   %xmm0,%xmm0
  cvtsi2sd %esi,%xmm1
  divsd  %xmm1,%xmm0
  ret
```

assistant: ```c
double averageNumbersInArray(double arr[], int length) {
  int i;
  double sum = 0;
  for (i = 0; i < length; i++) {
    sum += arr[i];
  }
  return sum / (double)length;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<averageNumbersInArray>:
  endbr64
  test   %esi,%esi
  jle    L0
  cmp    $0x1,%esi
  je     L25
  mov    %esi,%edx
  mov    %rdi,%rax
  pxor   %xmm0,%xmm0
  shr    %edx
  sub    $0x1,%edx
  shl    $0x4,%rdx
  lea    0x10(%rdi,%rdx,1),%rdx
  nopl   0x0(%rax)
L4:
  movsd  (%rax),%xmm1
  add    $0x10,%rax
  addsd  %xmm1,%xmm0
  movsd  -0x8(%rax),%xmm1
  addsd  %xmm1,%xmm0
  cmp    %rdx,%rax
  jne    L4
  mov    %esi,%eax
  and    $0xfffffffe,%eax
  test   $0x1,%sil
  je     L29
L39:
  cltq
  addsd  (%rdi,%rax,8),%xmm0
L29:
  pxor   %xmm1,%xmm1
  cvtsi2sd %esi,%xmm1
  divsd  %xmm1,%xmm0
  ret
  nopl   0x0(%rax)
L0:
  pxor   %xmm1,%xmm1
  pxor   %xmm0,%xmm0
  cvtsi2sd %esi,%xmm1
  divsd  %xmm1,%xmm0
  ret
L25:
  pxor   %xmm0,%xmm0
  xor    %eax,%eax
  jmp    L39
```

assistant: ```c
double averageNumbersInArray(double arr[], int length) {
  int i;
  double sum = 0;
  for (i = 0; i < length; i++) {
    sum += arr[i];
  }
  return sum / (double)length;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<strpbrk>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  jmp    L8
L43:
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L51
L54:
  mov    -0xc(%rbp),%eax
  cmp    -0x10(%rbp),%eax
  jne    L51
  mov    -0x18(%rbp),%rax
  sub    $0x1,%rax
  jmp    L37
L51:
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  jne    L54
L8:
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,-0x10(%rbp)
  cmpl   $0x0,-0x10(%rbp)
  jne    L43
  mov    $0x0,%eax
L37:
  pop    %rbp
  ret
```

assistant: ```c
char *strpbrk(const char *s1, const char *s2) {
  const char *scanp;
  int c, sc;
  while ((c = *s1++) != 0) {
    for (scanp = s2; (sc = *scanp++) != 0;)
      if (sc == c)
        return ((char *)(s1 - 1));
  }
  return (NULL);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<strpbrk>:
  endbr64
  movsbl (%rdi),%ecx
  test   %ecx,%ecx
  je     L38
L42:
  mov    %rdi,%r8
  mov    %rsi,%rax
L9:
  add    $0x1,%rax
  movsbl -0x1(%rax),%edx
  test   %edx,%edx
  je     L39
  cmp    %ecx,%edx
  jne    L9
L45:
  mov    %r8,%rax
  ret
L39:
  movsbl 0x1(%r8),%ecx
  add    $0x1,%rdi
  test   %ecx,%ecx
  jne    L42
  mov    $0x0,%r8d
  jmp    L45
L38:
  mov    $0x0,%r8d
  jmp    L45
```

assistant: ```c
char *strpbrk(const char *s1, const char *s2) {
  const char *scanp;
  int c, sc;
  while ((c = *s1++) != 0) {
    for (scanp = s2; (sc = *scanp++) != 0;)
      if (sc == c)
        return ((char *)(s1 - 1));
  }
  return (NULL);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<strpbrk>:
  endbr64
  movsbl (%rdi),%ecx
  test   %ecx,%ecx
  je     L40
L44:
  mov    %rdi,%r8
  mov    %rsi,%rax
  jmp    L32
  nopl   0x0(%rax,%rax,1)
L9:
  cmp    %ecx,%edx
  je     L12
L32:
  movsbl (%rax),%edx
  add    $0x1,%rax
  test   %edx,%edx
  jne    L9
  movsbl 0x1(%rdi),%ecx
  add    $0x1,%rdi
  test   %ecx,%ecx
  jne    L44
L40:
  xor    %r8d,%r8d
L12:
  mov    %r8,%rax
  ret
```

assistant: ```c
char *strpbrk(const char *s1, const char *s2) {
  const char *scanp;
  int c, sc;
  while ((c = *s1++) != 0) {
    for (scanp = s2; (sc = *scanp++) != 0;)
      if (sc == c)
        return ((char *)(s1 - 1));
  }
  return (NULL);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<strpbrk>:
  endbr64
  movsbl (%rdi),%ecx
  test   %ecx,%ecx
  je     L17
L6:
  mov    %rdi,%r8
  mov    %rsi,%rax
  jmp    L41
  nopl   0x0(%rax,%rax,1)
L43:
  cmp    %ecx,%edx
  je     L16
L41:
  movsbl (%rax),%edx
  add    $0x1,%rax
  test   %edx,%edx
  jne    L43
  movsbl 0x1(%rdi),%ecx
  add    $0x1,%rdi
  test   %ecx,%ecx
  jne    L6
L17:
  xor    %r8d,%r8d
L16:
  mov    %r8,%rax
  ret
```

assistant: ```c
char *strpbrk(const char *s1, const char *s2) {
  const char *scanp;
  int c, sc;
  while ((c = *s1++) != 0) {
    for (scanp = s2; (sc = *scanp++) != 0;)
      if (sc == c)
        return ((char *)(s1 - 1));
  }
  return (NULL);
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<jdns_packet_name_isvalid>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  jle    L116
  cmpl   $0xff,-0x1c(%rbp)
  jle    L128
L116:
  mov    $0x0,%eax
  jmp    L88
L128:
  mov    -0x1c(%rbp),%eax
  cltq
  lea    -0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  je     L2
  mov    $0x0,%eax
  jmp    L88
L2:
  cmpl   $0x1,-0x1c(%rbp)
  jle    L40
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L40
  mov    $0x0,%eax
  jmp    L88
L40:
  movl   $0x0,-0x8(%rbp)
L78:
  mov    -0x8(%rbp),%eax
  mov    %eax,-0xc(%rbp)
  jmp    L52
L124:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  je     L71
  addl   $0x1,-0xc(%rbp)
L52:
  mov    -0xc(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L124
  jmp    L46
L71:
  nop
L46:
  mov    -0xc(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jge    L153
  mov    -0xc(%rbp),%eax
  sub    -0x8(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  jle    L29
  cmpl   $0x3f,-0x4(%rbp)
  jle    L24
L29:
  mov    $0x0,%eax
  jmp    L88
L24:
  mov    -0xc(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x8(%rbp)
  jmp    L78
L153:
  nop
  mov    $0x1,%eax
L88:
  pop    %rbp
  ret
```

assistant: ```c
int jdns_packet_name_isvalid(const unsigned char *name, int size) {
  int n, at, len;
  if (size < 1 || size > (256 - 1))
    return 0;
  if (name[size - 1] != '.')
    return 0;
  if (size > 1 && name[0] == '.')
    return 0;
  at = 0;
  while (1) {
    for (n = at; n < size; ++n) {
      if (name[n] == '.')
        break;
    }
    if (n >= size)
      break;
    len = n - at;
    if (len < 1 || len > 63)
      return 0;
    at = n + 1;
  }
  return 1;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<jdns_packet_name_isvalid>:
  endbr64
  lea    -0x1(%rsi),%edx
  mov    $0x0,%eax
  cmp    $0xfe,%edx
  ja     L22
  movslq %esi,%rdx
  cmpb   $0x2e,-0x1(%rdi,%rdx,1)
  jne    L22
  cmp    $0x1,%esi
  jle    L66
  cmpb   $0x2e,(%rdi)
  je     L22
  mov    $0x1,%edx
  mov    $0x0,%eax
  mov    $0x0,%r8d
  jmp    L96
L66:
  mov    $0x1,%edx
  mov    $0x0,%eax
  mov    $0x0,%r8d
  jmp    L96
L39:
  cmp    %eax,%esi
  jle    L91
  sub    %r8d,%ecx
  sub    $0x1,%ecx
  cmp    $0x3e,%ecx
  ja     L102
  mov    %edx,%r8d
  cmp    %edx,%esi
  jle    L6
L23:
  add    $0x1,%rax
  add    $0x1,%edx
L96:
  mov    %eax,%ecx
  cmpb   $0x2e,(%rdi,%rax,1)
  je     L39
  cmp    %edx,%esi
  jg     L23
  mov    $0x1,%eax
  ret
L6:
  mov    $0x1,%eax
  ret
L91:
  mov    $0x1,%eax
  ret
L102:
  mov    $0x0,%eax
L22:
  ret
```

assistant: ```c
int jdns_packet_name_isvalid(const unsigned char *name, int size) {
  int n, at, len;
  if (size < 1 || size > (256 - 1))
    return 0;
  if (name[size - 1] != '.')
    return 0;
  if (size > 1 && name[0] == '.')
    return 0;
  at = 0;
  while (1) {
    for (n = at; n < size; ++n) {
      if (name[n] == '.')
        break;
    }
    if (n >= size)
      break;
    len = n - at;
    if (len < 1 || len > 63)
      return 0;
    at = n + 1;
  }
  return 1;
}
```
user: What is the c source code of the assembly code below:

```asm
<jdns_packet_name_isvalid>:
  endbr64
  lea    -0x1(%rsi),%edx
  xor    %eax,%eax
  cmp    $0xfe,%edx
  ja     L79
  movslq %esi,%rdx
  cmpb   $0x2e,-0x1(%rdi,%rdx,1)
  jne    L79
  movzbl (%rdi),%ecx
  cmp    $0x1,%esi
  je     L103
  cmp    $0x2e,%cl
  je     L79
L103:
  mov    $0x1,%eax
  xor    %edx,%edx
  xor    %r8d,%r8d
  jmp    L10
  nopl   0x0(%rax)
L108:
  cmp    %eax,%esi
  jle    L16
L84:
  movslq %eax,%rcx
  add    $0x1,%edx
  add    $0x1,%eax
  movzbl (%rdi,%rcx,1),%ecx
L10:
  cmp    $0x2e,%cl
  jne    L108
  cmp    %edx,%esi
  jle    L16
  mov    %edx,%ecx
  sub    %r8d,%ecx
  sub    $0x1,%ecx
  cmp    $0x3e,%ecx
  ja     L63
  cmp    %eax,%esi
  jle    L16
  mov    %eax,%r8d
  jmp    L84
L63:
  xor    %eax,%eax
L79:
  ret
  nopl   0x0(%rax,%rax,1)
L16:
  mov    $0x1,%eax
  ret
```

assistant: ```c
int jdns_packet_name_isvalid(const unsigned char *name, int size) {
  int n, at, len;
  if (size < 1 || size > (256 - 1))
    return 0;
  if (name[size - 1] != '.')
    return 0;
  if (size > 1 && name[0] == '.')
    return 0;
  at = 0;
  while (1) {
    for (n = at; n < size; ++n) {
      if (name[n] == '.')
        break;
    }
    if (n >= size)
      break;
    len = n - at;
    if (len < 1 || len > 63)
      return 0;
    at = n + 1;
  }
  return 1;
}
```
user: Translate the below assembly code into C programming language:

```asm
<jdns_packet_name_isvalid>:
  endbr64
  lea    -0x1(%rsi),%edx
  xor    %eax,%eax
  cmp    $0xfe,%edx
  ja     L54
  movslq %esi,%rdx
  cmpb   $0x2e,-0x1(%rdi,%rdx,1)
  jne    L54
  cmp    $0x1,%esi
  je     L35
  cmpb   $0x2e,(%rdi)
  je     L54
L35:
  mov    $0x1,%edx
  xor    %eax,%eax
  xor    %r8d,%r8d
  jmp    L0
  nopl   0x0(%rax)
L32:
  add    $0x1,%rax
  add    $0x1,%edx
L0:
  cmpb   $0x2e,(%rdi,%rax,1)
  mov    %eax,%ecx
  je     L84
L22:
  cmp    %edx,%esi
  jg     L32
L14:
  mov    $0x1,%eax
  ret
L56:
  xor    %eax,%eax
L54:
  ret
  nopl   0x0(%rax)
L84:
  cmp    %eax,%esi
  jle    L14
  sub    %r8d,%ecx
  sub    $0x1,%ecx
  cmp    $0x3e,%ecx
  ja     L56
  mov    %edx,%r8d
  jmp    L22
```

assistant: ```c
int jdns_packet_name_isvalid(const unsigned char *name, int size) {
  int n, at, len;
  if (size < 1 || size > (256 - 1))
    return 0;
  if (name[size - 1] != '.')
    return 0;
  if (size > 1 && name[0] == '.')
    return 0;
  at = 0;
  while (1) {
    for (n = at; n < size; ++n) {
      if (name[n] == '.')
        break;
    }
    if (n >= size)
      break;
    len = n - at;
    if (len < 1 || len > 63)
      return 0;
    at = n + 1;
  }
  return 1;
}
```