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

```asm
<EMACIntClear>:
  endbr64
  mov    %esi,%eax
  or     $0x10000,%eax
  test   $0x4045,%esi
  cmovne %eax,%esi
  mov    %esi,%eax
  or     $0x80,%ah
  test   $0x27ba,%esi
  cmovne %eax,%esi
  test   $0x7fffffff,%esi
  je     L10
  lea    0xc14(%rdi),%eax
  cltq
  mov    %esi,%edx
  and    $0x7fffffff,%edx
  mov    %edx,(%rax)
L10:
  test   %esi,%esi
  js     L0
L11:
  ret
L0:
  add    $0xfd8,%edi
  movslq %edi,%rdi
  mov    (%rdi),%eax
  or     $0x1,%eax
  mov    %eax,(%rdi)
  jmp    L11
```

assistant: ```c
void EMACIntClear(uint32_t ui32Base, uint32_t ui32IntFlags) {
  ;
  if (ui32IntFlags & (0x00000001 | 0x00000040 | 0x00004000 | 0x00000004)) {
    ui32IntFlags |= 0x00010000;
  }
  if (ui32IntFlags & (0x00000002 | 0x00000008 | 0x00000010 | 0x00000020 | 0x00000080 | 0x00000100 | 0x00000200 | 0x00000400 | 0x00002000)) {
    ui32IntFlags |= 0x00008000;
  }
  if (ui32IntFlags & ~0x80000000) {
    (*((volatile uint32_t *)(ui32Base + 0x00000C14))) = (ui32IntFlags & ~0x80000000);
  }
  if (ui32IntFlags & 0x80000000) {
    (*((volatile uint32_t *)(ui32Base + 0x00000FD8))) |= 0x00000001;
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<EMACIntClear>:
  endbr64
  mov    %esi,%eax
  or     $0x10000,%eax
  test   $0x4045,%esi
  cmovne %eax,%esi
  mov    %esi,%eax
  or     $0x80,%ah
  test   $0x27ba,%esi
  cmovne %eax,%esi
  mov    %esi,%edx
  and    $0x7fffffff,%edx
  je     L14
  lea    0xc14(%rdi),%eax
  cltq
  mov    %edx,(%rax)
L14:
  test   %esi,%esi
  js     L8
  ret
  nopl   0x0(%rax,%rax,1)
L8:
  add    $0xfd8,%edi
  movslq %edi,%rdi
  mov    (%rdi),%eax
  or     $0x1,%eax
  mov    %eax,(%rdi)
  ret
```

assistant: ```c
void EMACIntClear(uint32_t ui32Base, uint32_t ui32IntFlags) {
  ;
  if (ui32IntFlags & (0x00000001 | 0x00000040 | 0x00004000 | 0x00000004)) {
    ui32IntFlags |= 0x00010000;
  }
  if (ui32IntFlags & (0x00000002 | 0x00000008 | 0x00000010 | 0x00000020 | 0x00000080 | 0x00000100 | 0x00000200 | 0x00000400 | 0x00002000)) {
    ui32IntFlags |= 0x00008000;
  }
  if (ui32IntFlags & ~0x80000000) {
    (*((volatile uint32_t *)(ui32Base + 0x00000C14))) = (ui32IntFlags & ~0x80000000);
  }
  if (ui32IntFlags & 0x80000000) {
    (*((volatile uint32_t *)(ui32Base + 0x00000FD8))) |= 0x00000001;
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<EMACIntClear>:
  endbr64
  mov    %esi,%eax
  or     $0x10000,%eax
  test   $0x4045,%esi
  cmovne %eax,%esi
  mov    %esi,%eax
  or     $0x80,%ah
  test   $0x27ba,%esi
  cmovne %eax,%esi
  mov    %esi,%edx
  and    $0x7fffffff,%edx
  je     L10
  lea    0xc14(%rdi),%eax
  cltq
  mov    %edx,(%rax)
L10:
  test   %esi,%esi
  js     L5
  ret
  nopl   0x0(%rax,%rax,1)
L5:
  add    $0xfd8,%edi
  movslq %edi,%rdi
  mov    (%rdi),%eax
  or     $0x1,%eax
  mov    %eax,(%rdi)
  ret
```

assistant: ```c
void EMACIntClear(uint32_t ui32Base, uint32_t ui32IntFlags) {
  ;
  if (ui32IntFlags & (0x00000001 | 0x00000040 | 0x00004000 | 0x00000004)) {
    ui32IntFlags |= 0x00010000;
  }
  if (ui32IntFlags & (0x00000002 | 0x00000008 | 0x00000010 | 0x00000020 | 0x00000080 | 0x00000100 | 0x00000200 | 0x00000400 | 0x00002000)) {
    ui32IntFlags |= 0x00008000;
  }
  if (ui32IntFlags & ~0x80000000) {
    (*((volatile uint32_t *)(ui32Base + 0x00000C14))) = (ui32IntFlags & ~0x80000000);
  }
  if (ui32IntFlags & 0x80000000) {
    (*((volatile uint32_t *)(ui32Base + 0x00000FD8))) |= 0x00000001;
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<beta>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x38,%rsp
  movsd  %xmm0,-0x28(%rbp)
  movsd  %xmm1,-0x30(%rbp)
  mov    $0x0,%eax
  call   <uniform@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x18(%rbp)
  movsd  -0x28(%rbp),%xmm0
  addsd  -0x30(%rbp),%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  call   <tgamma@plt>
  movq   %xmm0,%rbx
  mov    -0x28(%rbp),%rax
  movq   %rax,%xmm0
  call   <tgamma@plt>
  movsd  %xmm0,-0x38(%rbp)
  mov    -0x30(%rbp),%rax
  movq   %rax,%xmm0
  call   <tgamma@plt>
  mulsd  -0x38(%rbp),%xmm0
  movq   %rbx,%xmm2
  divsd  %xmm0,%xmm2
  movsd  %xmm2,-0x38(%rbp)
  movsd  -0x28(%rbp),%xmm0
  movsd  D13(%rip),%xmm1
  subsd  %xmm1,%xmm0
  movq   %xmm0,%rdx
  movsd  -0x18(%rbp),%xmm0
  cvttsd2si %xmm0,%eax
  movq   %rdx,%xmm0
  mov    %eax,%edi
  call   <pow@plt>
  mulsd  -0x38(%rbp),%xmm0
  movsd  %xmm0,-0x38(%rbp)
  movsd  -0x30(%rbp),%xmm0
  movsd  D13(%rip),%xmm1
  movapd %xmm0,%xmm4
  subsd  %xmm1,%xmm4
  movq   %xmm4,%rdx
  movsd  D13(%rip),%xmm0
  subsd  -0x18(%rbp),%xmm0
  cvttsd2si %xmm0,%eax
  movq   %rdx,%xmm0
  mov    %eax,%edi
  call   <pow@plt>
  mulsd  -0x38(%rbp),%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D13
type_infered: byte[8]

tool: {"D13": [0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f]}

assistant: ```c
double beta(double a, double b) {
  double x = uniform();
  return ((tgamma(a + b) / (tgamma(a) * tgamma(b))) * pow(x, a - 1) * pow(1 - x, b - 1));
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<beta>:
  endbr64
  push   %r14
  push   %rbx
  sub    $0x28,%rsp
  movsd  %xmm0,(%rsp)
  movsd  %xmm1,0x8(%rsp)
  mov    $0x0,%eax
  call   <uniform@plt>
  movsd  %xmm0,0x10(%rsp)
  movsd  (%rsp),%xmm2
  addsd  0x8(%rsp),%xmm2
  movapd %xmm2,%xmm0
  call   <tgamma@plt>
  movq   %xmm0,%rbx
  movsd  (%rsp),%xmm0
  call   <tgamma@plt>
  movq   %xmm0,%r14
  movsd  0x8(%rsp),%xmm0
  call   <tgamma@plt>
  movq   %r14,%xmm6
  mulsd  %xmm6,%xmm0
  movq   %rbx,%xmm4
  divsd  %xmm0,%xmm4
  movsd  %xmm4,0x18(%rsp)
  movsd  (%rsp),%xmm5
  subsd  D14(%rip),%xmm5
  movapd %xmm5,%xmm0
  cvttsd2si 0x10(%rsp),%edi
  call   <pow@plt>
  mulsd  0x18(%rsp),%xmm0
  movsd  %xmm0,(%rsp)
  movsd  0x8(%rsp),%xmm7
  subsd  D14(%rip),%xmm7
  movapd %xmm7,%xmm0
  movsd  D14(%rip),%xmm1
  subsd  0x10(%rsp),%xmm1
  cvttsd2si %xmm1,%edi
  call   <pow@plt>
  mulsd  (%rsp),%xmm0
  add    $0x28,%rsp
  pop    %rbx
  pop    %r14
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D14
type_guessed: byte[8]

tool: {"D14": [0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f]}

assistant: ```c
double beta(double a, double b) {
  double x = uniform();
  return ((tgamma(a + b) / (tgamma(a) * tgamma(b))) * pow(x, a - 1) * pow(1 - x, b - 1));
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<beta>:
  endbr64
  sub    $0x38,%rsp
  xor    %eax,%eax
  movsd  %xmm1,0x10(%rsp)
  movsd  %xmm0,0x8(%rsp)
  call   <uniform@plt>
  movsd  0x8(%rsp),%xmm3
  addsd  0x10(%rsp),%xmm3
  movsd  %xmm0,0x18(%rsp)
  movapd %xmm3,%xmm0
  call   <tgamma@plt>
  movsd  %xmm0,0x28(%rsp)
  movsd  0x8(%rsp),%xmm0
  call   <tgamma@plt>
  movsd  %xmm0,0x20(%rsp)
  movsd  0x10(%rsp),%xmm0
  call   <tgamma@plt>
  movsd  0x20(%rsp),%xmm1
  movsd  0x28(%rsp),%xmm2
  cvttsd2si 0x18(%rsp),%edi
  movsd  0x8(%rsp),%xmm3
  mulsd  %xmm0,%xmm1
  subsd  D7(%rip),%xmm3
  movapd %xmm3,%xmm0
  divsd  %xmm1,%xmm2
  movsd  %xmm2,0x20(%rsp)
  call   <pow@plt>
  movsd  0x20(%rsp),%xmm5
  movsd  D7(%rip),%xmm1
  subsd  0x18(%rsp),%xmm1
  mulsd  %xmm0,%xmm5
  movsd  0x10(%rsp),%xmm0
  subsd  D7(%rip),%xmm0
  cvttsd2si %xmm1,%edi
  movsd  %xmm5,0x8(%rsp)
  call   <pow@plt>
  mulsd  0x8(%rsp),%xmm0
  add    $0x38,%rsp
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D7
datatype: byte[8]

tool: {"D7": [0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f]}

assistant: ```c
double beta(double a, double b) {
  double x = uniform();
  return ((tgamma(a + b) / (tgamma(a) * tgamma(b))) * pow(x, a - 1) * pow(1 - x, b - 1));
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<beta>:
  endbr64
  sub    $0x38,%rsp
  xor    %eax,%eax
  movsd  %xmm1,0x10(%rsp)
  movsd  %xmm0,0x8(%rsp)
  call   <uniform@plt>
  movsd  0x8(%rsp),%xmm3
  addsd  0x10(%rsp),%xmm3
  movsd  %xmm0,0x18(%rsp)
  movapd %xmm3,%xmm0
  call   <tgamma@plt>
  movsd  %xmm0,0x28(%rsp)
  movsd  0x8(%rsp),%xmm0
  call   <tgamma@plt>
  movsd  %xmm0,0x20(%rsp)
  movsd  0x10(%rsp),%xmm0
  call   <tgamma@plt>
  movsd  0x20(%rsp),%xmm1
  movsd  0x28(%rsp),%xmm2
  cvttsd2si 0x18(%rsp),%edi
  movsd  0x8(%rsp),%xmm3
  mulsd  %xmm0,%xmm1
  subsd  D22(%rip),%xmm3
  movapd %xmm3,%xmm0
  divsd  %xmm1,%xmm2
  movsd  %xmm2,0x20(%rsp)
  call   <pow@plt>
  movsd  0x20(%rsp),%xmm5
  movsd  D22(%rip),%xmm1
  subsd  0x18(%rsp),%xmm1
  mulsd  %xmm0,%xmm5
  movsd  0x10(%rsp),%xmm0
  subsd  D22(%rip),%xmm0
  cvttsd2si %xmm1,%edi
  movsd  %xmm5,0x8(%rsp)
  call   <pow@plt>
  mulsd  0x8(%rsp),%xmm0
  add    $0x38,%rsp
  ret
```

tool_calls: name: disassemble_data
arguments: label: D22
type_infered: byte[8]

tool: {"D22": [0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f]}

assistant: ```c
double beta(double a, double b) {
  double x = uniform();
  return ((tgamma(a + b) / (tgamma(a) * tgamma(b))) * pow(x, a - 1) * pow(1 - x, b - 1));
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<gen_doubles>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L15
L12:
  mov    $0x0,%eax
  call   <random@plt>
  mov    %eax,%edx
  mov    D13(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,%ecx
  shr    $0x1f,%ecx
  add    %ecx,%eax
  sar    %eax
  neg    %eax
  add    %edx,%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  mov    D13(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  add    $0x1,%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  mov    -0x4(%rbp),%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  divsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x4(%rbp)
L15:
  mov    -0x4(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jb     L12
  nop
  nop
  leave
  ret
```

assistant: ```c
void gen_doubles(double *val, unsigned card) {
  unsigned i;
  for (i = 0; i < card; i++) {
    val[i] = (double)(random() - (LONG_MAX / 2)) / ((LONG_MAX / 2) + 1);
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<gen_doubles>:
  endbr64
  test   %esi,%esi
  je     L8
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  lea    -0x1(%rsi),%eax
  lea    0x8(%rdi,%rax,8),%r12
  mov    $0x1,%ebp
L9:
  mov    $0x0,%eax
  call   <random@plt>
  mov    D2(%rip),%rdx
  mov    (%rdx),%ecx
  mov    %ecx,%edx
  shr    $0x1f,%edx
  add    %ecx,%edx
  sar    %edx
  neg    %edx
  add    %edx,%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  mov    %ebp,%eax
  sub    %edx,%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
  add    $0x8,%rbx
  cmp    %r12,%rbx
  jne    L9
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L8:
  ret
```

assistant: ```c
void gen_doubles(double *val, unsigned card) {
  unsigned i;
  for (i = 0; i < card; i++) {
    val[i] = (double)(random() - (LONG_MAX / 2)) / ((LONG_MAX / 2) + 1);
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<gen_doubles>:
  endbr64
  test   %esi,%esi
  je     L13
  push   %r13
  lea    -0x1(%rsi),%eax
  mov    %rdi,%r13
  push   %r12
  lea    0x8(%rdi,%rax,8),%r12
  push   %rbp
  push   %rbx
  mov    $0x1,%ebx
  sub    $0x8,%rsp
  mov    D0(%rip),%rbp
  nopl   0x0(%rax)
L14:
  xor    %eax,%eax
  add    $0x8,%r13
  call   <random@plt>
  mov    0x0(%rbp),%ecx
  pxor   %xmm0,%xmm0
  pxor   %xmm1,%xmm1
  mov    %ecx,%edx
  shr    $0x1f,%edx
  add    %ecx,%edx
  sar    %edx
  neg    %edx
  add    %edx,%eax
  cvtsi2sd %eax,%xmm0
  mov    %ebx,%eax
  sub    %edx,%eax
  cvtsi2sd %eax,%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%r13)
  cmp    %r12,%r13
  jne    L14
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L13:
  ret
```

assistant: ```c
void gen_doubles(double *val, unsigned card) {
  unsigned i;
  for (i = 0; i < card; i++) {
    val[i] = (double)(random() - (LONG_MAX / 2)) / ((LONG_MAX / 2) + 1);
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<gen_doubles>:
  endbr64
  test   %esi,%esi
  je     L7
  push   %r13
  lea    -0x1(%rsi),%eax
  mov    %rdi,%r13
  push   %r12
  lea    0x8(%rdi,%rax,8),%r12
  push   %rbp
  push   %rbx
  mov    $0x1,%ebx
  sub    $0x8,%rsp
  mov    D4(%rip),%rbp
  nopl   0x0(%rax)
L9:
  xor    %eax,%eax
  add    $0x8,%r13
  call   <random@plt>
  mov    0x0(%rbp),%ecx
  pxor   %xmm0,%xmm0
  pxor   %xmm1,%xmm1
  mov    %ecx,%edx
  shr    $0x1f,%edx
  add    %ecx,%edx
  sar    %edx
  neg    %edx
  add    %edx,%eax
  cvtsi2sd %eax,%xmm0
  mov    %ebx,%eax
  sub    %edx,%eax
  cvtsi2sd %eax,%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%r13)
  cmp    %r12,%r13
  jne    L9
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L7:
  ret
```

assistant: ```c
void gen_doubles(double *val, unsigned card) {
  unsigned i;
  for (i = 0; i < card; i++) {
    val[i] = (double)(random() - (LONG_MAX / 2)) / ((LONG_MAX / 2) + 1);
  }
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<find_escaped>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,%rbx
  mov    %rsi,-0x38(%rbp)
  mov    %rdx,-0x40(%rbp)
  mov    %ecx,-0x44(%rbp)
  mov    -0x38(%rbp),%rax
  movzbl (%rax),%r13d
  cmpq   $0x0,-0x40(%rbp)
  je     L158
  mov    -0x40(%rbp),%rax
  movzbl (%rax),%eax
  jmp    L162
L158:
  mov    $0x0,%eax
L162:
  mov    %eax,%r12d
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x28(%rbp)
  cmpq   $0x0,-0x40(%rbp)
  je     L183
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  jmp    L40
L183:
  mov    $0x0,%eax
L40:
  mov    %eax,-0x24(%rbp)
  jmp    L86
L10:
  add    $0x1,%rbx
L86:
  movzbl (%rbx),%eax
  test   %al,%al
  je     L35
  movzbl (%rbx),%eax
  cmp    %al,%r13b
  je     L35
  movzbl (%rbx),%eax
  cmp    %al,%r12b
  jne    L10
L35:
  movzbl (%rbx),%eax
  test   %al,%al
  je     L177
  test   %r12b,%r12b
  je     L42
  mov    -0x24(%rbp),%edx
  mov    -0x40(%rbp),%rax
  mov    %rax,%rsi
  mov    %rbx,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L42
  mov    -0x24(%rbp),%eax
  cltq
  add    %rax,%rbx
  jmp    L25
L42:
  mov    -0x28(%rbp),%edx
  mov    -0x38(%rbp),%rax
  mov    %rax,%rsi
  mov    %rbx,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  je     L172
  add    $0x1,%rbx
L25:
  movzbl (%rbx),%eax
  test   %al,%al
  jne    L86
  jmp    L109
L177:
  nop
  jmp    L109
L172:
  nop
L109:
  movzbl (%rbx),%eax
  test   %al,%al
  jne    L62
  mov    $0x0,%eax
  jmp    L186
L62:
  cmpl   $0x0,-0x44(%rbp)
  je     L26
  movb   $0x0,(%rbx)
L26:
  mov    -0x28(%rbp),%eax
  cltq
  add    %rbx,%rax
L186:
  add    $0x38,%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %rbp
  ret
```

assistant: ```c
char *find_escaped(register char *s, char *search, char *escape, int mark) {
  register char first = *search;
  register char first_escape = (escape != NULL ? *escape : '\0');
  int searchlen = strlen(search);
  int escapelen = (escape != NULL ? strlen(escape) : 0);
  do {
    while (*s && *s != first && *s != first_escape)
      s++;
    if (!*s)
      break;
    if (first_escape && !strncmp(s, escape, escapelen)) {
      s += escapelen;
      continue;
    }
    if (!strncmp(s, search, searchlen))
      break;
    s++;
  } while (*s != '\0');
  if (*s == '\0')
    return NULL;
  if (mark)
    *s = '\0';
  return s + searchlen;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<find_escaped>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%rbx
  mov    %rsi,%r14
  mov    %rdx,%r15
  mov    %ecx,0xc(%rsp)
  movzbl (%rsi),%r12d
  test   %rdx,%rdx
  je     L121
  movzbl (%rdx),%ebp
  mov    %rsi,%rdi
  call   <strlen@plt>
  mov    %eax,%r13d
  mov    %r15,%rdi
  call   <strlen@plt>
  mov    %eax,0x8(%rsp)
L65:
  movslq 0x8(%rsp),%rax
  mov    %rax,(%rsp)
  jmp    L126
L119:
  add    $0x1,%rbx
  jmp    L126
L125:
  mov    %r13d,%edx
  mov    %r14,%rsi
  mov    %rbx,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  je     L129
  add    $0x1,%rbx
L135:
  cmpb   $0x0,(%rbx)
  je     L47
L126:
  movzbl (%rbx),%eax
  cmp    %r12b,%al
  setne  %cl
  test   %al,%al
  setne  %dl
  test   %dl,%cl
  je     L25
  cmp    %bpl,%al
  jne    L119
L25:
  test   %al,%al
  je     L47
  test   %bpl,%bpl
  je     L125
  mov    0x8(%rsp),%edx
  mov    %r15,%rsi
  mov    %rbx,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L125
  add    (%rsp),%rbx
  jmp    L135
L129:
  cmpb   $0x0,(%rbx)
  je     L114
  cmpl   $0x0,0xc(%rsp)
  je     L151
  movb   $0x0,(%rbx)
L151:
  movslq %r13d,%r13
  lea    (%rbx,%r13,1),%rax
L138:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L114:
  mov    $0x0,%eax
  jmp    L138
L47:
  mov    $0x0,%eax
  jmp    L138
L121:
  mov    %rsi,%rdi
  call   <strlen@plt>
  mov    %eax,%r13d
  mov    $0x0,%ebp
  movl   $0x0,0x8(%rsp)
  jmp    L65
```

assistant: ```c
char *find_escaped(register char *s, char *search, char *escape, int mark) {
  register char first = *search;
  register char first_escape = (escape != NULL ? *escape : '\0');
  int searchlen = strlen(search);
  int escapelen = (escape != NULL ? strlen(escape) : 0);
  do {
    while (*s && *s != first && *s != first_escape)
      s++;
    if (!*s)
      break;
    if (first_escape && !strncmp(s, escape, escapelen)) {
      s += escapelen;
      continue;
    }
    if (!strncmp(s, search, searchlen))
      break;
    s++;
  } while (*s != '\0');
  if (*s == '\0')
    return NULL;
  if (mark)
    *s = '\0';
  return s + searchlen;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<find_escaped>:
  endbr64
  push   %r15
  mov    %rdi,%r15
  push   %r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  movzbl (%rsi),%eax
  mov    %ecx,0xc(%rsp)
  mov    %al,0xb(%rsp)
  test   %rdx,%rdx
  je     L106
  mov    %rsi,%rdi
  movzbl (%rdx),%ebx
  call   <strlen@plt>
  mov    %r13,%rdi
  movslq %eax,%rbp
  call   <strlen@plt>
  mov    %eax,%r14d
L35:
  movzbl (%r15),%eax
  test   %al,%al
  je     L65
  movslq %r14d,%rcx
  mov    %rcx,(%rsp)
  nopw   0x0(%rax,%rax,1)
L142:
  cmp    %bl,%al
  je     L139
  cmp    %al,0xb(%rsp)
  je     L139
  movzbl 0x1(%r15),%eax
  test   %al,%al
  jne    L33
L65:
  xor    %eax,%eax
L158:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L139:
  test   %bl,%bl
  je     L138
  mov    %r14d,%edx
  mov    %r13,%rsi
  mov    %r15,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  je     L157
L138:
  mov    %ebp,%edx
  mov    %r12,%rsi
  mov    %r15,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  je     L86
  add    $0x1,%r15
L3:
  movzbl (%r15),%eax
  test   %al,%al
  jne    L142
  xor    %eax,%eax
  jmp    L158
  nopw   0x0(%rax,%rax,1)
L157:
  add    (%rsp),%r15
  jmp    L3
  cs nopw 0x0(%rax,%rax,1)
L86:
  cmpb   $0x0,(%r15)
  je     L65
  mov    0xc(%rsp),%eax
  test   %eax,%eax
  jne    L127
L66:
  add    $0x18,%rsp
  lea    (%r15,%rbp,1),%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L127:
  movb   $0x0,(%r15)
  jmp    L66
  xchg   %ax,%ax
L106:
  mov    %rsi,%rdi
  xor    %ebx,%ebx
  xor    %r14d,%r14d
  call   <strlen@plt>
  movslq %eax,%rbp
  jmp    L35
L33:
  add    $0x1,%r15
  jmp    L142
```

assistant: ```c
char *find_escaped(register char *s, char *search, char *escape, int mark) {
  register char first = *search;
  register char first_escape = (escape != NULL ? *escape : '\0');
  int searchlen = strlen(search);
  int escapelen = (escape != NULL ? strlen(escape) : 0);
  do {
    while (*s && *s != first && *s != first_escape)
      s++;
    if (!*s)
      break;
    if (first_escape && !strncmp(s, escape, escapelen)) {
      s += escapelen;
      continue;
    }
    if (!strncmp(s, search, searchlen))
      break;
    s++;
  } while (*s != '\0');
  if (*s == '\0')
    return NULL;
  if (mark)
    *s = '\0';
  return s + searchlen;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<find_escaped>:
  endbr64
  push   %r15
  mov    %rdi,%r15
  push   %r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  movzbl (%rsi),%eax
  mov    %ecx,0xc(%rsp)
  mov    %al,0xb(%rsp)
  test   %rdx,%rdx
  je     L132
  mov    %rsi,%rdi
  movzbl (%rdx),%ebx
  call   <strlen@plt>
  mov    %r13,%rdi
  movslq %eax,%rbp
  call   <strlen@plt>
  mov    %eax,%r14d
L78:
  movzbl (%r15),%eax
  test   %al,%al
  je     L131
  movslq %r14d,%rcx
  mov    %rcx,(%rsp)
  nopw   0x0(%rax,%rax,1)
L150:
  cmp    %bl,%al
  je     L117
  cmp    %al,0xb(%rsp)
  je     L117
  movzbl 0x1(%r15),%eax
  test   %al,%al
  jne    L12
L131:
  xor    %eax,%eax
L147:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L117:
  test   %bl,%bl
  je     L135
  mov    %r14d,%edx
  mov    %r13,%rsi
  mov    %r15,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  je     L104
L135:
  mov    %ebp,%edx
  mov    %r12,%rsi
  mov    %r15,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  je     L15
  add    $0x1,%r15
L91:
  movzbl (%r15),%eax
  test   %al,%al
  jne    L150
  xor    %eax,%eax
  jmp    L147
  nopw   0x0(%rax,%rax,1)
L104:
  add    (%rsp),%r15
  jmp    L91
  cs nopw 0x0(%rax,%rax,1)
L15:
  cmpb   $0x0,(%r15)
  je     L131
  mov    0xc(%rsp),%eax
  test   %eax,%eax
  jne    L120
L88:
  add    $0x18,%rsp
  lea    (%r15,%rbp,1),%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L120:
  movb   $0x0,(%r15)
  jmp    L88
  xchg   %ax,%ax
L132:
  mov    %rsi,%rdi
  xor    %ebx,%ebx
  xor    %r14d,%r14d
  call   <strlen@plt>
  movslq %eax,%rbp
  jmp    L78
L12:
  add    $0x1,%r15
  jmp    L150
```

assistant: ```c
char *find_escaped(register char *s, char *search, char *escape, int mark) {
  register char first = *search;
  register char first_escape = (escape != NULL ? *escape : '\0');
  int searchlen = strlen(search);
  int escapelen = (escape != NULL ? strlen(escape) : 0);
  do {
    while (*s && *s != first && *s != first_escape)
      s++;
    if (!*s)
      break;
    if (first_escape && !strncmp(s, escape, escapelen)) {
      s += escapelen;
      continue;
    }
    if (!strncmp(s, search, searchlen))
      break;
    s++;
  } while (*s != '\0');
  if (*s == '\0')
    return NULL;
  if (mark)
    *s = '\0';
  return s + searchlen;
}
```