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

```asm
<meny>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0xc(%rbp)
  jmp    L2
L47:
  lea    D42(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D56(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D1(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D7(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    -0x10(%rbp),%rax
  mov    %rax,%rsi
  lea    D5(%rip),%rax
  mov    %rax,%rdi
  call   <min_input@plt>
  mov    -0x10(%rbp),%eax
  cmp    $0x1,%eax
  je     L45
  mov    -0x10(%rbp),%eax
  cmp    $0x2,%eax
  je     L45
  mov    -0x10(%rbp),%eax
  cmp    $0x3,%eax
  jne    L17
L45:
  mov    -0x10(%rbp),%eax
  jmp    L52
L17:
  lea    D50(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
L2:
  cmpl   $0x0,-0xc(%rbp)
  je     L47
L52:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L36
  call   <__stack_chk_fail@plt>
L36:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D42
type: string
name: retrieve_data
arguments: tag: D56
type: string
name: retrieve_data
arguments: tag: D1
type: string
name: retrieve_data
arguments: tag: D7
type: string
name: retrieve_data
arguments: tag: D5
type: string
name: retrieve_data
arguments: tag: D50
type: string

tool: D42: 
Velg 1 for aa avslutte


tool: D56: Velg 2 for aa legge sammen to tall, a + b


tool: D1: Velg 3 for aa multiplisere to tall, a x b


tool: D7: 


tool: D5: Velg:

tool: D50: Ugyldig valg, velg 1, 2 eller 3


assistant: ```c
int meny() {
  int valg;
  int valg_ok = 0;
  while (valg_ok == 0) {
    printf("\nVelg 1 for aa avslutte\n");
    printf("Velg 2 for aa legge sammen to tall, a + b\n");
    printf("Velg 3 for aa multiplisere to tall, a x b\n");
    printf("\n");
    min_input("Velg:", &valg);
    if (valg == 1 || valg == 2 || valg == 3) {
      return valg;
    } else {
      printf("Ugyldig valg, velg 1, 2 eller 3\n");
    }
  }
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<meny>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    D59(%rip),%r13
  lea    D42(%rip),%r12
  lea    D11(%rip),%rbp
  lea    D10(%rip),%rbx
  jmp    L25
L22:
  lea    D55(%rip),%rdi
  call   <printf@plt>
L25:
  mov    %r13,%rdi
  call   <printf@plt>
  mov    %r12,%rdi
  call   <printf@plt>
  mov    %rbp,%rdi
  call   <printf@plt>
  mov    %rbx,%rdi
  call   <printf@plt>
  lea    0x4(%rsp),%rsi
  lea    D4(%rip),%rdi
  call   <min_input@plt>
  mov    0x4(%rsp),%eax
  lea    -0x1(%rax),%edx
  cmp    $0x2,%edx
  ja     L22
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L13
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L13:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_label: D59
type_infered: string
name: read_data
arguments: data_label: D42
type_infered: string
name: read_data
arguments: data_label: D11
type_infered: string
name: read_data
arguments: data_label: D10
type_infered: string
name: read_data
arguments: data_label: D55
type_infered: string
name: read_data
arguments: data_label: D4
type_infered: string

tool: D59: 
Velg 1 for aa avslutte


tool: D42: Velg 2 for aa legge sammen to tall, a + b


tool: D11: Velg 3 for aa multiplisere to tall, a x b


tool: D10: 


tool: D55: Ugyldig valg, velg 1, 2 eller 3


tool: D4: Velg:

assistant: ```c
int meny() {
  int valg;
  int valg_ok = 0;
  while (valg_ok == 0) {
    printf("\nVelg 1 for aa avslutte\n");
    printf("Velg 2 for aa legge sammen to tall, a + b\n");
    printf("Velg 3 for aa multiplisere to tall, a x b\n");
    printf("\n");
    min_input("Velg:", &valg);
    if (valg == 1 || valg == 2 || valg == 3) {
      return valg;
    } else {
      printf("Ugyldig valg, velg 1, 2 eller 3\n");
    }
  }
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<meny>:
  endbr64
  push   %r15
  lea    D51(%rip),%r15
  push   %r14
  lea    D43(%rip),%r14
  push   %r13
  lea    D40(%rip),%r13
  push   %r12
  lea    D27(%rip),%r12
  push   %rbp
  push   %rbx
  lea    D6(%rip),%rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rbp
  jmp    L18
  nopl   0x0(%rax)
L0:
  lea    D4(%rip),%rdi
  call   <printf@plt>
L18:
  mov    %r15,%rdi
  call   <printf@plt>
  mov    %r14,%rdi
  call   <printf@plt>
  mov    %r13,%rdi
  call   <printf@plt>
  mov    %r12,%rdi
  call   <printf@plt>
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <min_input@plt>
  mov    0x4(%rsp),%eax
  lea    -0x1(%rax),%edx
  cmp    $0x2,%edx
  ja     L0
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L23
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L23:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D51
type: string
name: disassemble_data
arguments: data_tag: D43
type: string
name: disassemble_data
arguments: data_tag: D40
type: string
name: disassemble_data
arguments: data_tag: D27
type: string
name: disassemble_data
arguments: data_tag: D6
type: string
name: disassemble_data
arguments: data_tag: D4
type: string

tool: D51: 
Velg 1 for aa avslutte


tool: D43: Velg 2 for aa legge sammen to tall, a + b


tool: D40: Velg 3 for aa multiplisere to tall, a x b


tool: D27: 


tool: D6: Velg:

tool: D4: Ugyldig valg, velg 1, 2 eller 3


assistant: ```c
int meny() {
  int valg;
  int valg_ok = 0;
  while (valg_ok == 0) {
    printf("\nVelg 1 for aa avslutte\n");
    printf("Velg 2 for aa legge sammen to tall, a + b\n");
    printf("Velg 3 for aa multiplisere to tall, a x b\n");
    printf("\n");
    min_input("Velg:", &valg);
    if (valg == 1 || valg == 2 || valg == 3) {
      return valg;
    } else {
      printf("Ugyldig valg, velg 1, 2 eller 3\n");
    }
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<meny>:
  endbr64
  push   %r15
  lea    D4(%rip),%r15
  push   %r14
  lea    D50(%rip),%r14
  push   %r13
  lea    D33(%rip),%r13
  push   %r12
  lea    D43(%rip),%r12
  push   %rbp
  push   %rbx
  lea    D24(%rip),%rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rbp
  jmp    L19
  nopl   0x0(%rax)
L18:
  lea    D49(%rip),%rdi
  call   <printf@plt>
L19:
  mov    %r15,%rdi
  call   <printf@plt>
  mov    %r14,%rdi
  call   <printf@plt>
  mov    %r13,%rdi
  call   <printf@plt>
  mov    %r12,%rdi
  call   <printf@plt>
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <min_input@plt>
  mov    0x4(%rsp),%eax
  lea    -0x1(%rax),%edx
  cmp    $0x2,%edx
  ja     L18
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L4
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L4:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D4
datatype: string
name: unpack_data
arguments: data_tag: D50
datatype: string
name: unpack_data
arguments: data_tag: D33
datatype: string
name: unpack_data
arguments: data_tag: D43
datatype: string
name: unpack_data
arguments: data_tag: D24
datatype: string
name: unpack_data
arguments: data_tag: D49
datatype: string

tool: D4: 
Velg 1 for aa avslutte


tool: D50: Velg 2 for aa legge sammen to tall, a + b


tool: D33: Velg 3 for aa multiplisere to tall, a x b


tool: D43: 


tool: D24: Velg:

tool: D49: Ugyldig valg, velg 1, 2 eller 3


assistant: ```c
int meny() {
  int valg;
  int valg_ok = 0;
  while (valg_ok == 0) {
    printf("\nVelg 1 for aa avslutte\n");
    printf("Velg 2 for aa legge sammen to tall, a + b\n");
    printf("Velg 3 for aa multiplisere to tall, a x b\n");
    printf("\n");
    min_input("Velg:", &valg);
    if (valg == 1 || valg == 2 || valg == 3) {
      return valg;
    } else {
      printf("Ugyldig valg, velg 1, 2 eller 3\n");
    }
  }
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  movq   $0x0,-0x18(%rbp)
  movb   $0x5,-0x26(%rbp)
  jmp    L40
L135:
  addq   $0x1,-0x18(%rbp)
L40:
  movzbl -0x26(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %dl,-0x26(%rbp)
  test   %al,%al
  jne    L135
  movb   $0x0,-0x26(%rbp)
  movb   $0x5,-0x25(%rbp)
  jmp    L19
L66:
  addq   $0x1,-0x18(%rbp)
L19:
  movzbl -0x25(%rbp),%eax
  mov    %eax,%edx
  sub    $0x1,%edx
  mov    %dl,-0x25(%rbp)
  test   %al,%al
  jne    L66
  movb   $0x0,-0x25(%rbp)
  movw   $0x5,-0x24(%rbp)
  jmp    L113
L37:
  addq   $0x1,-0x18(%rbp)
L113:
  movzwl -0x24(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %dx,-0x24(%rbp)
  test   %ax,%ax
  jne    L37
  movw   $0x0,-0x24(%rbp)
  movw   $0x5,-0x22(%rbp)
  jmp    L111
L51:
  addq   $0x1,-0x18(%rbp)
L111:
  movzwl -0x22(%rbp),%eax
  mov    %eax,%edx
  sub    $0x1,%edx
  mov    %dx,-0x22(%rbp)
  test   %ax,%ax
  jne    L51
  movw   $0x0,-0x22(%rbp)
  movl   $0x5,-0x20(%rbp)
  jmp    L116
L69:
  addq   $0x1,-0x18(%rbp)
L116:
  mov    -0x20(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x20(%rbp)
  test   %eax,%eax
  jne    L69
  movl   $0x0,-0x20(%rbp)
  movl   $0x5,-0x1c(%rbp)
  jmp    L117
L62:
  addq   $0x1,-0x18(%rbp)
L117:
  mov    -0x1c(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x1c(%rbp)
  test   %eax,%eax
  jne    L62
  movl   $0x0,-0x1c(%rbp)
  movq   $0x5,-0x10(%rbp)
  jmp    L65
L112:
  addq   $0x1,-0x18(%rbp)
L65:
  mov    -0x10(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  test   %rax,%rax
  jne    L112
  movq   $0x0,-0x10(%rbp)
  movq   $0x5,-0x8(%rbp)
  jmp    L105
L102:
  addq   $0x1,-0x18(%rbp)
L105:
  mov    -0x8(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  test   %rax,%rax
  jne    L102
  movq   $0x0,-0x8(%rbp)
  mov    $0x0,%eax
  pop    %rbp
  ret
```

assistant: ```c
int main() {
  unsigned long long int cont;
  unsigned char a;
  signed char b;
  unsigned short int c;
  signed short int d;
  unsigned int e;
  signed int f;
  unsigned long long int g;
  signed long long int h;
  cont = 0;
  a = 5;
  while (a--)
    cont++;
  a = 0;
  b = 5;
  while (b--)
    cont++;
  b = 0;
  c = 5;
  while (c--)
    cont++;
  c = 0;
  d = 5;
  while (d--)
    cont++;
  d = 0;
  e = 5;
  while (e--)
    cont++;
  e = 0;
  f = 5;
  while (f--)
    cont++;
  f = 0;
  g = 5;
  while (g--)
    cont++;
  g = 0;
  h = 5;
  while (h--)
    cont++;
  h = 0;
  return 0;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<main>:
  endbr64
  mov    $0x0,%eax
  ret
```

assistant: ```c
int main() {
  unsigned long long int cont;
  unsigned char a;
  signed char b;
  unsigned short int c;
  signed short int d;
  unsigned int e;
  signed int f;
  unsigned long long int g;
  signed long long int h;
  cont = 0;
  a = 5;
  while (a--)
    cont++;
  a = 0;
  b = 5;
  while (b--)
    cont++;
  b = 0;
  c = 5;
  while (c--)
    cont++;
  c = 0;
  d = 5;
  while (d--)
    cont++;
  d = 0;
  e = 5;
  while (e--)
    cont++;
  e = 0;
  f = 5;
  while (f--)
    cont++;
  f = 0;
  g = 5;
  while (g--)
    cont++;
  g = 0;
  h = 5;
  while (h--)
    cont++;
  h = 0;
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<main>:
  endbr64
  xor    %eax,%eax
  ret
```

assistant: ```c
int main() {
  unsigned long long int cont;
  unsigned char a;
  signed char b;
  unsigned short int c;
  signed short int d;
  unsigned int e;
  signed int f;
  unsigned long long int g;
  signed long long int h;
  cont = 0;
  a = 5;
  while (a--)
    cont++;
  a = 0;
  b = 5;
  while (b--)
    cont++;
  b = 0;
  c = 5;
  while (c--)
    cont++;
  c = 0;
  d = 5;
  while (d--)
    cont++;
  d = 0;
  e = 5;
  while (e--)
    cont++;
  e = 0;
  f = 5;
  while (f--)
    cont++;
  f = 0;
  g = 5;
  while (g--)
    cont++;
  g = 0;
  h = 5;
  while (h--)
    cont++;
  h = 0;
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<main>:
  endbr64
  xor    %eax,%eax
  ret
```

assistant: ```c
int main() {
  unsigned long long int cont;
  unsigned char a;
  signed char b;
  unsigned short int c;
  signed short int d;
  unsigned int e;
  signed int f;
  unsigned long long int g;
  signed long long int h;
  cont = 0;
  a = 5;
  while (a--)
    cont++;
  a = 0;
  b = 5;
  while (b--)
    cont++;
  b = 0;
  c = 5;
  while (c--)
    cont++;
  c = 0;
  d = 5;
  while (d--)
    cont++;
  d = 0;
  e = 5;
  while (e--)
    cont++;
  e = 0;
  f = 5;
  while (f--)
    cont++;
  f = 0;
  g = 5;
  while (g--)
    cont++;
  g = 0;
  h = 5;
  while (h--)
    cont++;
  h = 0;
  return 0;
}
```
user: What is the c source code of the assembly code below:

```asm
<djbHash>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  movl   $0x1505,-0x8(%rbp)
  movl   $0x0,-0x4(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L6
L14:
  mov    -0x8(%rbp),%eax
  shl    $0x5,%eax
  mov    %eax,%edx
  mov    -0x8(%rbp),%eax
  add    %eax,%edx
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  add    %edx,%eax
  mov    %eax,-0x8(%rbp)
  addq   $0x1,-0x18(%rbp)
  addl   $0x1,-0x4(%rbp)
L6:
  mov    -0x4(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jb     L14
  mov    -0x8(%rbp),%eax
  pop    %rbp
  ret
```

assistant: ```c
unsigned int djbHash(char *str, unsigned int len) {
  unsigned int hash = 5381;
  unsigned int i = 0;
  for (i = 0; i < len; str++, i++) {
    hash = ((hash << 5) + hash) + (*str);
  }
  return hash;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<djbHash>:
  endbr64
  test   %esi,%esi
  je     L14
  mov    %esi,%esi
  lea    (%rdi,%rsi,1),%rcx
  mov    $0x1505,%eax
L16:
  mov    %eax,%edx
  shl    $0x5,%edx
  add    %edx,%eax
  movsbl (%rdi),%edx
  add    %edx,%eax
  add    $0x1,%rdi
  cmp    %rcx,%rdi
  jne    L16
  ret
L14:
  mov    $0x1505,%eax
  ret
```

assistant: ```c
unsigned int djbHash(char *str, unsigned int len) {
  unsigned int hash = 5381;
  unsigned int i = 0;
  for (i = 0; i < len; str++, i++) {
    hash = ((hash << 5) + hash) + (*str);
  }
  return hash;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<djbHash>:
  endbr64
  test   %esi,%esi
  je     L13
  mov    %esi,%esi
  mov    $0x1505,%eax
  lea    (%rdi,%rsi,1),%rcx
  nopl   0x0(%rax,%rax,1)
L17:
  mov    %eax,%edx
  add    $0x1,%rdi
  shl    $0x5,%edx
  add    %edx,%eax
  movsbl -0x1(%rdi),%edx
  add    %edx,%eax
  cmp    %rdi,%rcx
  jne    L17
  ret
  nop
L13:
  mov    $0x1505,%eax
  ret
```

assistant: ```c
unsigned int djbHash(char *str, unsigned int len) {
  unsigned int hash = 5381;
  unsigned int i = 0;
  for (i = 0; i < len; str++, i++) {
    hash = ((hash << 5) + hash) + (*str);
  }
  return hash;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<djbHash>:
  endbr64
  test   %esi,%esi
  je     L8
  mov    %esi,%esi
  mov    $0x1505,%eax
  lea    (%rdi,%rsi,1),%rcx
  nopl   0x0(%rax,%rax,1)
L15:
  mov    %eax,%edx
  add    $0x1,%rdi
  shl    $0x5,%edx
  add    %edx,%eax
  movsbl -0x1(%rdi),%edx
  add    %edx,%eax
  cmp    %rdi,%rcx
  jne    L15
  ret
  nop
L8:
  mov    $0x1505,%eax
  ret
```

assistant: ```c
unsigned int djbHash(char *str, unsigned int len) {
  unsigned int hash = 5381;
  unsigned int i = 0;
  for (i = 0; i < len; str++, i++) {
    hash = ((hash << 5) + hash) + (*str);
  }
  return hash;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<match_string_until>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,%eax
  mov    %edx,-0x20(%rbp)
  mov    %rcx,-0x28(%rbp)
  mov    %al,-0x1c(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L48
  mov    $0x0,%eax
  jmp    L63
L48:
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L64
L72:
  addq   $0x1,-0x18(%rbp)
L64:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L86
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    %al,-0x1c(%rbp)
  jne    L72
L86:
  cmpq   $0x0,-0x18(%rbp)
  jne    L26
  mov    $0x0,%eax
  jmp    L63
L26:
  mov    -0x18(%rbp),%rax
  sub    -0x8(%rbp),%rax
  add    $0x1,%eax
  mov    %eax,%edi
  call   <alloc@plt>
  mov    -0x28(%rbp),%rdx
  mov    %rax,(%rdx)
  mov    -0x18(%rbp),%rax
  sub    -0x8(%rbp),%rax
  mov    %eax,%edx
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  mov    -0x8(%rbp),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x18(%rbp),%rax
  sub    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  cmpl   $0x0,-0x20(%rbp)
  je     L60
  addq   $0x1,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  jmp    L63
L60:
  mov    -0x18(%rbp),%rax
L63:
  leave
  ret
```

assistant: ```c
const char *match_string_until(const char *p, char c, int consume, char **result) {
  if (!p)
    return 0;
  const char *start = p;
  while (*p && *p != c)
    ++p;
  if (!p)
    return 0;
  *result = alloc(p - start + 1);
  memcpy(*result, start, p - start);
  (*result)[p - start] = '\0';
  return consume ? ++p : p;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<match_string_until>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbp
  test   %rdi,%rdi
  je     L13
  mov    %edx,%r13d
  mov    %rcx,%r12
  mov    %esi,%edx
  movzbl (%rdi),%eax
  cmp    %sil,%al
  je     L38
  test   %al,%al
  je     L38
  mov    %rdi,%rbx
L46:
  add    $0x1,%rbx
  movzbl (%rbx),%eax
  cmp    %dl,%al
  je     L22
  test   %al,%al
  jne    L46
L22:
  mov    %rbx,%r14
  sub    %rbp,%r14
  lea    0x1(%r14),%edi
  call   <alloc@plt>
  mov    %rax,%rdi
  mov    %rax,(%r12)
  mov    %r14d,%edx
  mov    %rbp,%rsi
  call   <memcpy@plt>
  mov    (%r12),%rax
  movb   $0x0,(%rax,%r14,1)
  cmp    $0x1,%r13d
  sbb    $0xffffffffffffffff,%rbx
L21:
  mov    %rbx,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L38:
  mov    %rbp,%rbx
  jmp    L22
L13:
  mov    %rdi,%rbx
  jmp    L21
```

assistant: ```c
const char *match_string_until(const char *p, char c, int consume, char **result) {
  if (!p)
    return 0;
  const char *start = p;
  while (*p && *p != c)
    ++p;
  if (!p)
    return 0;
  *result = alloc(p - start + 1);
  memcpy(*result, start, p - start);
  (*result)[p - start] = '\0';
  return consume ? ++p : p;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<match_string_until>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %rdi,%rdi
  je     L66
  movzbl (%rdi),%eax
  mov    %rdi,%rbp
  mov    %edx,%r13d
  mov    %rcx,%rbx
  cmp    %sil,%al
  je     L63
  test   %al,%al
  je     L63
  mov    %esi,%edx
  mov    %rdi,%r12
  jmp    L75
  nopw   0x0(%rax,%rax,1)
L40:
  test   %al,%al
  je     L76
L75:
  movzbl 0x1(%r12),%eax
  add    $0x1,%r12
  cmp    %dl,%al
  jne    L40
L76:
  mov    %r12,%r14
  sub    %rbp,%r14
  lea    0x1(%r14),%edi
  mov    %r14d,%r15d
L29:
  call   <alloc@plt>
  mov    %r15d,%edx
  mov    %rbp,%rsi
  mov    %rax,(%rbx)
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    (%rbx),%rax
  cmp    $0x1,%r13d
  sbb    $0xffffffffffffffff,%r12
  movb   $0x0,(%rax,%r14,1)
L10:
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L63:
  mov    %rbp,%r12
  xor    %r14d,%r14d
  xor    %r15d,%r15d
  mov    $0x1,%edi
  jmp    L29
L66:
  xor    %r12d,%r12d
  jmp    L10
```

assistant: ```c
const char *match_string_until(const char *p, char c, int consume, char **result) {
  if (!p)
    return 0;
  const char *start = p;
  while (*p && *p != c)
    ++p;
  if (!p)
    return 0;
  *result = alloc(p - start + 1);
  memcpy(*result, start, p - start);
  (*result)[p - start] = '\0';
  return consume ? ++p : p;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<match_string_until>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %rdi,%rdi
  je     L11
  movzbl (%rdi),%eax
  mov    %rdi,%rbp
  mov    %edx,%r13d
  mov    %rcx,%rbx
  cmp    %sil,%al
  je     L53
  test   %al,%al
  je     L53
  mov    %esi,%edx
  mov    %rdi,%r12
  jmp    L31
  nopw   0x0(%rax,%rax,1)
L13:
  test   %al,%al
  je     L3
L31:
  movzbl 0x1(%r12),%eax
  add    $0x1,%r12
  cmp    %dl,%al
  jne    L13
L3:
  mov    %r12,%r14
  sub    %rbp,%r14
  lea    0x1(%r14),%edi
  mov    %r14d,%r15d
L70:
  call   <alloc@plt>
  mov    %r15d,%edx
  mov    %rbp,%rsi
  mov    %rax,(%rbx)
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    (%rbx),%rax
  cmp    $0x1,%r13d
  sbb    $0xffffffffffffffff,%r12
  movb   $0x0,(%rax,%r14,1)
L37:
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L53:
  mov    %rbp,%r12
  xor    %r14d,%r14d
  xor    %r15d,%r15d
  mov    $0x1,%edi
  jmp    L70
L11:
  xor    %r12d,%r12d
  jmp    L37
```

assistant: ```c
const char *match_string_until(const char *p, char c, int consume, char **result) {
  if (!p)
    return 0;
  const char *start = p;
  while (*p && *p != c)
    ++p;
  if (!p)
    return 0;
  *result = alloc(p - start + 1);
  memcpy(*result, start, p - start);
  (*result)[p - start] = '\0';
  return consume ? ++p : p;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<_write_escaped>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %edx,-0x28(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x18(%rbp)
  jmp    L28
L63:
  mov    -0x30(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x30(%rbp)
  movzbl (%rax),%eax
  mov    %al,-0x19(%rbp)
  movzbl -0x19(%rbp),%eax
  movsbl %al,%eax
  cmp    $0x7d,%eax
  je     L64
  cmp    $0x7e,%eax
  jne    L29
  movb   $0x7d,-0xa(%rbp)
  movb   $0x5e,-0x9(%rbp)
  lea    -0xa(%rbp),%rcx
  mov    -0x24(%rbp),%eax
  mov    $0x2,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <checked_write@plt>
  addq   $0x1,-0x18(%rbp)
  jmp    L28
L64:
  movb   $0x7d,-0xa(%rbp)
  movb   $0x5d,-0x9(%rbp)
  lea    -0xa(%rbp),%rcx
  mov    -0x24(%rbp),%eax
  mov    $0x2,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <checked_write@plt>
  addq   $0x1,-0x18(%rbp)
  jmp    L28
L29:
  lea    -0x19(%rbp),%rcx
  mov    -0x24(%rbp),%eax
  mov    $0x1,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <checked_write@plt>
L28:
  mov    -0x28(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x28(%rbp)
  test   %eax,%eax
  jne    L63
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L68
  call   <__stack_chk_fail@plt>
L68:
  leave
  ret
```

assistant: ```c
void _write_escaped(int fd, char *buf, ssize_t n) {
  uint8_t out[2];
  size_t escaped = 0;
  while (n--) {
    char c = *buf++;
    switch (c) {
    case (0x7E):
      out[0] = (0x7D);
      out[1] = ((0x7E) ^ 0x20);
      checked_write(fd, out, 2);
      escaped++;
      break;
    case (0x7D):
      out[0] = (0x7D);
      out[1] = ((0x7D) ^ 0x20);
      checked_write(fd, out, 2);
      escaped++;
      break;
    default:
      checked_write(fd, &c, 1);
    }
  }
}
```