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

```asm
<main>:
  endbr64
  push   %rbx
  mov    $0xf,%edi
  movsd  D16(%rip),%xmm0
  call   <pow_@plt>
  movq   %xmm0,%rbx
  mov    $0xf,%edi
  call   <root@plt>
  movapd %xmm0,%xmm1
  movq   %rbx,%xmm0
  mov    $0xf,%esi
  lea    D15(%rip),%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  pop    %rbx
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D16
type_guessed: f64
name: disassemble_data
arguments: tag: D15
type_guessed: string

tool: D16: 3.14159

tool: D15: root(%d, %g) = %g


assistant: ```c
int main() {
  int n = 15;
  double x = pow_(3.14159, 15);
  printf("root(%d, %g) = %g\n", n, x, root(n, x));
  return 0;
}
```
user: What is the c source code of the assembly code below:

```asm
<main>:
  endbr64
  sub    $0x18,%rsp
  movsd  D12(%rip),%xmm0
  mov    $0xf,%edi
  call   <pow_@plt>
  mov    $0xf,%edi
  movsd  %xmm0,0x8(%rsp)
  call   <root@plt>
  movsd  0x8(%rsp),%xmm2
  mov    $0xf,%esi
  lea    D19(%rip),%rdi
  movapd %xmm0,%xmm1
  movapd %xmm2,%xmm0
  call   <printf@plt>
  xor    %eax,%eax
  add    $0x18,%rsp
  ret
```

tool_calls: name: retrieve_data
arguments: label: D12
type: f64
name: retrieve_data
arguments: label: D19
type: string

tool: D12: 3.14159

tool: D19: root(%d, %g) = %g


assistant: ```c
int main() {
  int n = 15;
  double x = pow_(3.14159, 15);
  printf("root(%d, %g) = %g\n", n, x, root(n, x));
  return 0;
}
```
user: What is the c source code of the assembly code below?

```asm
<main>:
  endbr64
  sub    $0x18,%rsp
  movsd  D9(%rip),%xmm0
  mov    $0xf,%edi
  call   <pow_@plt>
  mov    $0xf,%edi
  movsd  %xmm0,0x8(%rsp)
  call   <root@plt>
  movsd  0x8(%rsp),%xmm2
  mov    $0xf,%esi
  lea    D13(%rip),%rdi
  movapd %xmm0,%xmm1
  movapd %xmm2,%xmm0
  call   <printf@plt>
  xor    %eax,%eax
  add    $0x18,%rsp
  ret
```

tool_calls: name: disassemble_data
arguments: label: D9
type: f64
name: disassemble_data
arguments: label: D13
type: string

tool: D9: 3.14159

tool: D13: root(%d, %g) = %g


assistant: ```c
int main() {
  int n = 15;
  double x = pow_(3.14159, 15);
  printf("root(%d, %g) = %g\n", n, x, root(n, x));
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<kv_break_after_key>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  je     L31
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L4
L31:
  mov    $0x0,%eax
  jmp    L22
L4:
  mov    -0x8(%rbp),%rax
  lea    D4(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L10
  mov    -0x8(%rbp),%rax
  lea    D12(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L18
L10:
  mov    $0x1,%eax
  jmp    L22
L18:
  mov    $0x0,%eax
L22:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D4
type_infered: string
name: unpack_data
arguments: data_tag: D12
type_infered: string

tool: D4: id

tool: D12: mic

assistant: ```c
int kv_break_after_key(char const *key) {
  if (!key || !*key)
    return 0;
  if (!strcmp(key, "id") || !strcmp(key, "mic"))
    return 1;
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<kv_break_after_key>:
  endbr64
  test   %rdi,%rdi
  je     L26
  push   %rbx
  mov    %rdi,%rbx
  mov    $0x0,%eax
  cmpb   $0x0,(%rdi)
  je     L9
  lea    D17(%rip),%rsi
  call   <strcmp@plt>
  mov    %eax,%edx
  mov    $0x1,%eax
  test   %edx,%edx
  je     L9
  lea    D2(%rip),%rsi
  mov    %rbx,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  sete   %al
  movzbl %al,%eax
L9:
  pop    %rbx
  ret
L26:
  mov    $0x0,%eax
  ret
```

tool_calls: name: read_data
arguments: tag: D17
type_infered: string
name: read_data
arguments: tag: D2
type_infered: string

tool: D17: id

tool: D2: mic

assistant: ```c
int kv_break_after_key(char const *key) {
  if (!key || !*key)
    return 0;
  if (!strcmp(key, "id") || !strcmp(key, "mic"))
    return 1;
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<kv_break_after_key>:
  endbr64
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L48
  cmpb   $0x0,(%rdi)
  je     L39
  cmpb   $0x69,(%rdi)
  je     L34
L38:
  sub    $0x8,%rsp
  lea    D8(%rip),%rsi
  call   <strcmp@plt>
  test   %eax,%eax
  sete   %al
  add    $0x8,%rsp
  movzbl %al,%eax
  ret
  nopw   0x0(%rax,%rax,1)
L34:
  cmpb   $0x64,0x1(%rdi)
  jne    L38
  cmpb   $0x0,0x2(%rdi)
  mov    $0x1,%eax
  jne    L38
L39:
  ret
  nopw   0x0(%rax,%rax,1)
L48:
  ret
```

tool_calls: name: parse_data
arguments: data_label: D8
data_type: string

tool: D8: mic

assistant: ```c
int kv_break_after_key(char const *key) {
  if (!key || !*key)
    return 0;
  if (!strcmp(key, "id") || !strcmp(key, "mic"))
    return 1;
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<kv_break_after_key>:
  endbr64
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L47
  cmpb   $0x0,(%rdi)
  je     L20
  cmpb   $0x69,(%rdi)
  je     L33
L41:
  sub    $0x8,%rsp
  lea    D3(%rip),%rsi
  call   <strcmp@plt>
  test   %eax,%eax
  sete   %al
  add    $0x8,%rsp
  movzbl %al,%eax
  ret
  nopw   0x0(%rax,%rax,1)
L33:
  cmpb   $0x64,0x1(%rdi)
  jne    L41
  cmpb   $0x0,0x2(%rdi)
  mov    $0x1,%eax
  jne    L41
L20:
  ret
  nopw   0x0(%rax,%rax,1)
L47:
  ret
```

tool_calls: name: read_data
arguments: tag: D3
type_infered: string

tool: D3: mic

assistant: ```c
int kv_break_after_key(char const *key) {
  if (!key || !*key)
    return 0;
  if (!strcmp(key, "id") || !strcmp(key, "mic"))
    return 1;
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<yy_1_ValueNqStar>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x8(%rbp)
  mov    %esi,-0xc(%rbp)
  nop
  pop    %rbp
  ret
```

assistant: ```c
void yy_1_ValueNqStar(char *yytext, int yyleng) {
  ;
  ;
}
```
user: What is the c source code of the assembly code below?

```asm
<yy_1_ValueNqStar>:
  endbr64
  ret
```

assistant: ```c
void yy_1_ValueNqStar(char *yytext, int yyleng) {
  ;
  ;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<yy_1_ValueNqStar>:
  endbr64
  ret
```

assistant: ```c
void yy_1_ValueNqStar(char *yytext, int yyleng) {
  ;
  ;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<yy_1_ValueNqStar>:
  endbr64
  ret
```

assistant: ```c
void yy_1_ValueNqStar(char *yytext, int yyleng) {
  ;
  ;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<_d_parse_int>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %esi,-0xc(%rbp)
  mov    %rdx,-0x18(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    -0x18(%rbp),%rdx
  mov    %eax,(%rdx)
  mov    $0x0,%eax
  leave
  ret
```

assistant: ```c
int _d_parse_int(char *v, int l, void *s) {
  *(int *)s = atoi(v);
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<_d_parse_int>:
  endbr64
  push   %rbx
  mov    %rdx,%rbx
  call   <atoi@plt>
  mov    %eax,(%rbx)
  mov    $0x0,%eax
  pop    %rbx
  ret
```

assistant: ```c
int _d_parse_int(char *v, int l, void *s) {
  *(int *)s = atoi(v);
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<_d_parse_int>:
  endbr64
  push   %rbx
  mov    %rdx,%rbx
  call   <atoi@plt>
  mov    %eax,(%rbx)
  xor    %eax,%eax
  pop    %rbx
  ret
```

assistant: ```c
int _d_parse_int(char *v, int l, void *s) {
  *(int *)s = atoi(v);
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<_d_parse_int>:
  endbr64
  push   %rbx
  mov    %rdx,%rbx
  call   <atoi@plt>
  mov    %eax,(%rbx)
  xor    %eax,%eax
  pop    %rbx
  ret
```

assistant: ```c
int _d_parse_int(char *v, int l, void *s) {
  *(int *)s = atoi(v);
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<nearest>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %edx,-0x34(%rbp)
  mov    %ecx,-0x38(%rbp)
  mov    %r8,-0x40(%rbp)
  movl   $0xffffffff,-0x18(%rbp)
  movsd  D3(%rip),%xmm0
  movsd  %xmm0,-0x10(%rbp)
  movl   $0x0,-0x14(%rbp)
  jmp    L38
L27:
  mov    -0x14(%rbp),%eax
  imul   -0x38(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x38(%rbp),%edx
  mov    -0x28(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <dist@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x8(%rbp)
  movsd  -0x10(%rbp),%xmm0
  comisd -0x8(%rbp),%xmm0
  jbe    L21
  movsd  -0x8(%rbp),%xmm0
  movsd  %xmm0,-0x10(%rbp)
  mov    -0x14(%rbp),%eax
  mov    %eax,-0x18(%rbp)
L21:
  addl   $0x1,-0x14(%rbp)
L38:
  mov    -0x14(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jl     L27
  cmpq   $0x0,-0x40(%rbp)
  je     L14
  pxor   %xmm0,%xmm0
  cvtsd2ss -0x10(%rbp),%xmm0
  mov    -0x40(%rbp),%rax
  movss  %xmm0,(%rax)
L14:
  mov    -0x18(%rbp),%eax
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_tag: D3
type_guessed: f64

tool: D3: 1000000000000

assistant: ```c
int nearest(float *s, float *cents, int c, int f, float *dd) {
  int rc = -1;
  double d = 1e12;
  for (int i = 0; i < c; i++) {
    double t = dist(s, cents + i * f, f);
    if (t < d) {
      d = t;
      rc = i;
    }
  }
  if (dd)
    *dd = d;
  return rc;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<nearest>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %r8,0x18(%rsp)
  test   %edx,%edx
  jle    L20
  mov    %rdi,%r15
  mov    %edx,%r13d
  mov    %ecx,%r14d
  movslq %ecx,%rax
  shl    $0x2,%rax
  mov    %rax,0x10(%rsp)
  mov    %rsi,%rbp
  mov    $0x0,%ebx
  movsd  D13(%rip),%xmm2
  movsd  %xmm2,0x8(%rsp)
  mov    $0xffffffff,%r12d
L24:
  mov    %r14d,%edx
  mov    %rbp,%rsi
  mov    %r15,%rdi
  call   <dist@plt>
  movsd  0x8(%rsp),%xmm1
  comisd %xmm0,%xmm1
  minsd  %xmm1,%xmm0
  movsd  %xmm0,0x8(%rsp)
  cmova  %ebx,%r12d
  add    $0x1,%ebx
  add    0x10(%rsp),%rbp
  cmp    %ebx,%r13d
  jne    L24
L30:
  mov    0x18(%rsp),%rax
  test   %rax,%rax
  je     L4
  pxor   %xmm0,%xmm0
  cvtsd2ss 0x8(%rsp),%xmm0
  movss  %xmm0,(%rax)
L4:
  mov    %r12d,%eax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L20:
  movsd  D13(%rip),%xmm3
  movsd  %xmm3,0x8(%rsp)
  mov    $0xffffffff,%r12d
  jmp    L30
```

tool_calls: name: unpack_data
arguments: tag: D13
type: f64

tool: D13: 1000000000000

assistant: ```c
int nearest(float *s, float *cents, int c, int f, float *dd) {
  int rc = -1;
  double d = 1e12;
  for (int i = 0; i < c; i++) {
    double t = dist(s, cents + i * f, f);
    if (t < d) {
      d = t;
      rc = i;
    }
  }
  if (dd)
    *dd = d;
  return rc;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<nearest>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %edx,0x14(%rsp)
  mov    %r8,0x18(%rsp)
  test   %edx,%edx
  jle    L32
  movslq %ecx,%r13
  movsd  D10(%rip),%xmm1
  mov    %rdi,%r12
  mov    %ecx,%ebp
  shl    $0x2,%r13
  mov    %rsi,%rbx
  xor    %r15d,%r15d
  mov    $0xffffffff,%r14d
  nopl   0x0(%rax,%rax,1)
L2:
  mov    %rbx,%rsi
  mov    %ebp,%edx
  mov    %r12,%rdi
  movsd  %xmm1,0x8(%rsp)
  call   <dist@plt>
  movsd  0x8(%rsp),%xmm1
  comisd %xmm0,%xmm1
  minsd  %xmm1,%xmm0
  cmova  %r15d,%r14d
  movapd %xmm0,%xmm1
  add    $0x1,%r15d
  add    %r13,%rbx
  cmp    %r15d,0x14(%rsp)
  jne    L2
L37:
  mov    0x18(%rsp),%rax
  test   %rax,%rax
  je     L20
  cvtsd2ss %xmm1,%xmm1
  movss  %xmm1,(%rax)
L20:
  add    $0x28,%rsp
  mov    %r14d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L32:
  movsd  D10(%rip),%xmm1
  mov    $0xffffffff,%r14d
  jmp    L37
```

tool_calls: name: unpack_data
arguments: data_tag: D10
type: f64

tool: D10: 1000000000000

assistant: ```c
int nearest(float *s, float *cents, int c, int f, float *dd) {
  int rc = -1;
  double d = 1e12;
  for (int i = 0; i < c; i++) {
    double t = dist(s, cents + i * f, f);
    if (t < d) {
      d = t;
      rc = i;
    }
  }
  if (dd)
    *dd = d;
  return rc;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<nearest>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %edx,0x14(%rsp)
  mov    %r8,0x18(%rsp)
  test   %edx,%edx
  jle    L12
  movslq %ecx,%r13
  movsd  D13(%rip),%xmm1
  mov    %rdi,%r12
  mov    %ecx,%ebp
  shl    $0x2,%r13
  mov    %rsi,%rbx
  xor    %r15d,%r15d
  mov    $0xffffffff,%r14d
  nopl   0x0(%rax,%rax,1)
L15:
  mov    %rbx,%rsi
  mov    %ebp,%edx
  mov    %r12,%rdi
  movsd  %xmm1,0x8(%rsp)
  call   <dist@plt>
  movsd  0x8(%rsp),%xmm1
  comisd %xmm0,%xmm1
  minsd  %xmm1,%xmm0
  cmova  %r15d,%r14d
  movapd %xmm0,%xmm1
  add    $0x1,%r15d
  add    %r13,%rbx
  cmp    %r15d,0x14(%rsp)
  jne    L15
L31:
  mov    0x18(%rsp),%rax
  test   %rax,%rax
  je     L21
  cvtsd2ss %xmm1,%xmm1
  movss  %xmm1,(%rax)
L21:
  add    $0x28,%rsp
  mov    %r14d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L12:
  movsd  D13(%rip),%xmm1
  mov    $0xffffffff,%r14d
  jmp    L31
```

tool_calls: name: unpack_data
arguments: data_tag: D13
type_infered: f64

tool: D13: 1000000000000

assistant: ```c
int nearest(float *s, float *cents, int c, int f, float *dd) {
  int rc = -1;
  double d = 1e12;
  for (int i = 0; i < c; i++) {
    double t = dist(s, cents + i * f, f);
    if (t < d) {
      d = t;
      rc = i;
    }
  }
  if (dd)
    *dd = d;
  return rc;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<diminuto_escape_trim>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %rcx,-0x30(%rbp)
  mov    -0x30(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strnlen@plt>
  mov    %rax,-0x30(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x30(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x10(%rbp)
  jmp    L117
L120:
  subq   $0x1,-0x10(%rbp)
  subq   $0x1,-0x8(%rbp)
L117:
  cmpq   $0x0,-0x8(%rbp)
  je     L105
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  je     L120
L105:
  cmpq   $0x0,-0x8(%rbp)
  je     L69
  mov    -0x30(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  je     L69
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x5c,%al
  jne    L69
  cmpq   $0x1,-0x8(%rbp)
  jbe    L38
  mov    -0x10(%rbp),%rax
  sub    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x5c,%al
  je     L69
L38:
  addq   $0x1,-0x10(%rbp)
  addq   $0x1,-0x8(%rbp)
L69:
  mov    -0x28(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jae    L70
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x8(%rbp)
L70:
  mov    -0x8(%rbp),%rdx
  mov    -0x20(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  cmpq   $0x0,-0x28(%rbp)
  je     L128
  mov    -0x28(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jbe    L3
  mov    -0x18(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  jmp    L128
L3:
  mov    -0x28(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jne    L128
  subq   $0x1,-0x8(%rbp)
  mov    -0x18(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
L128:
  mov    -0x8(%rbp),%rax
  leave
  ret
```

assistant: ```c
size_t diminuto_escape_trim(char *to, const char *from, size_t tsize, size_t fsize) {
  const char *ff;
  size_t size;
  fsize = strnlen(from, fsize);
  size = fsize;
  ff = from + fsize - 1;
  while ((0 < size) && (' ' == *ff)) {
    --ff;
    --size;
  }
  if (0 == size) {
  } else if (fsize == size) {
  } else if ((*ff != '\\') || ((size > 1) && (*(ff - 1) == '\\'))) {
  } else {
    ++ff;
    ++size;
  }
  if (tsize < size) {
    size = tsize;
  }
  strncpy(to, from, size);
  if (tsize == 0) {
  } else if (tsize > size) {
    to[size] = '\0';
  } else if (tsize == size) {
    to[--size] = '\0';
  } else {
  }
  return size;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<diminuto_escape_trim>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r13
  mov    %rsi,%r12
  mov    %rdx,%rbp
  mov    %rcx,%rsi
  mov    %r12,%rdi
  call   <strnlen@plt>
  lea    -0x1(%r12,%rax,1),%rdx
  mov    %rax,%rbx
  test   %rax,%rax
  je     L118
L30:
  cmpb   $0x20,(%rdx)
  jne    L33
  sub    $0x1,%rdx
  sub    $0x1,%rbx
  jne    L30
L118:
  cmp    %rbp,%rbx
  mov    %rbp,%r14
  cmovbe %rbx,%r14
  mov    %r14,%rdx
  mov    %r12,%rsi
  mov    %r13,%rdi
  call   <strncpy@plt>
  test   %rbp,%rbp
  je     L27
  cmp    %rbp,%r14
  jae    L75
  movb   $0x0,0x0(%r13,%r14,1)
L27:
  mov    %r14,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L33:
  cmp    %rbx,%rax
  je     L118
  test   %rbx,%rbx
  je     L118
  cmpb   $0x5c,(%rdx)
  jne    L118
  cmp    $0x1,%rbx
  jbe    L36
  cmpb   $0x5c,-0x1(%rdx)
  je     L118
L36:
  add    $0x1,%rbx
  jmp    L118
L75:
  cmp    %rbp,%rbx
  jb     L27
  movb   $0x0,-0x1(%r13,%r14,1)
  sub    $0x1,%r14
  jmp    L27
```

assistant: ```c
size_t diminuto_escape_trim(char *to, const char *from, size_t tsize, size_t fsize) {
  const char *ff;
  size_t size;
  fsize = strnlen(from, fsize);
  size = fsize;
  ff = from + fsize - 1;
  while ((0 < size) && (' ' == *ff)) {
    --ff;
    --size;
  }
  if (0 == size) {
  } else if (fsize == size) {
  } else if ((*ff != '\\') || ((size > 1) && (*(ff - 1) == '\\'))) {
  } else {
    ++ff;
    ++size;
  }
  if (tsize < size) {
    size = tsize;
  }
  strncpy(to, from, size);
  if (tsize == 0) {
  } else if (tsize > size) {
    to[size] = '\0';
  } else if (tsize == size) {
    to[--size] = '\0';
  } else {
  }
  return size;
}
```
user: What is the c source code of the assembly code below:

```asm
<diminuto_escape_trim>:
  endbr64
  push   %r14
  mov    %rsi,%r14
  mov    %rcx,%rsi
  push   %r13
  mov    %rdi,%r13
  mov    %r14,%rdi
  push   %r12
  push   %rbp
  mov    %rdx,%rbp
  push   %rbx
  call   <strnlen@plt>
  mov    %rax,%r12
  mov    %rax,%rcx
  lea    -0x1(%r14,%rax,1),%rax
  mov    %r12,%rbx
  test   %r12,%r12
  jne    L115
  jmp    L117
  nopl   (%rax)
L41:
  sub    $0x1,%rax
  sub    $0x1,%rbx
  je     L70
L115:
  movzbl (%rax),%edx
  cmp    $0x20,%dl
  je     L41
  cmp    %rbx,%rcx
  je     L111
  cmp    $0x5c,%dl
  je     L134
L111:
  cmp    %rbx,%rbp
  mov    %rbx,%r12
  cmovbe %rbp,%r12
L117:
  mov    %r12,%rdx
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <strncpy@plt>
  test   %rbp,%rbp
  je     L138
  cmp    %r12,%rbp
  jbe    L13
L48:
  movb   $0x0,0x0(%r13,%r12,1)
L138:
  pop    %rbx
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax,%rax,1)
L13:
  cmp    %rbp,%rbx
  jb     L138
  sub    $0x1,%r12
  jmp    L48
  nopl   0x0(%rax,%rax,1)
L70:
  xor    %r12d,%r12d
  jmp    L117
  nopl   (%rax)
L134:
  cmp    $0x1,%rbx
  je     L57
  cmpb   $0x5c,-0x1(%rax)
  je     L111
L57:
  add    $0x1,%rbx
  mov    %rbp,%r12
  cmp    %rbp,%rbx
  cmovbe %rbx,%r12
  jmp    L117
```

assistant: ```c
size_t diminuto_escape_trim(char *to, const char *from, size_t tsize, size_t fsize) {
  const char *ff;
  size_t size;
  fsize = strnlen(from, fsize);
  size = fsize;
  ff = from + fsize - 1;
  while ((0 < size) && (' ' == *ff)) {
    --ff;
    --size;
  }
  if (0 == size) {
  } else if (fsize == size) {
  } else if ((*ff != '\\') || ((size > 1) && (*(ff - 1) == '\\'))) {
  } else {
    ++ff;
    ++size;
  }
  if (tsize < size) {
    size = tsize;
  }
  strncpy(to, from, size);
  if (tsize == 0) {
  } else if (tsize > size) {
    to[size] = '\0';
  } else if (tsize == size) {
    to[--size] = '\0';
  } else {
  }
  return size;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<diminuto_escape_trim>:
  endbr64
  push   %r14
  mov    %rsi,%r14
  mov    %rcx,%rsi
  push   %r13
  mov    %rdi,%r13
  mov    %r14,%rdi
  push   %r12
  push   %rbp
  mov    %rdx,%rbp
  push   %rbx
  call   <strnlen@plt>
  mov    %rax,%r12
  mov    %rax,%rcx
  lea    -0x1(%r14,%rax,1),%rax
  mov    %r12,%rbx
  test   %r12,%r12
  jne    L9
  jmp    L62
  nopl   (%rax)
L1:
  sub    $0x1,%rax
  sub    $0x1,%rbx
  je     L113
L9:
  movzbl (%rax),%edx
  cmp    $0x20,%dl
  je     L1
  cmp    %rbx,%rcx
  je     L26
  cmp    $0x5c,%dl
  je     L53
L26:
  cmp    %rbx,%rbp
  mov    %rbx,%r12
  cmovbe %rbp,%r12
L62:
  mov    %r12,%rdx
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <strncpy@plt>
  test   %rbp,%rbp
  je     L71
  cmp    %rbp,%r12
  jae    L72
L24:
  movb   $0x0,0x0(%r13,%r12,1)
L71:
  pop    %rbx
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax,%rax,1)
L72:
  cmp    %rbp,%rbx
  jb     L71
  sub    $0x1,%r12
  jmp    L24
  nopl   0x0(%rax,%rax,1)
L113:
  xor    %r12d,%r12d
  jmp    L62
  nopl   (%rax)
L53:
  cmp    $0x1,%rbx
  je     L83
  cmpb   $0x5c,-0x1(%rax)
  je     L26
L83:
  add    $0x1,%rbx
  mov    %rbp,%r12
  cmp    %rbp,%rbx
  cmovbe %rbx,%r12
  jmp    L62
```

assistant: ```c
size_t diminuto_escape_trim(char *to, const char *from, size_t tsize, size_t fsize) {
  const char *ff;
  size_t size;
  fsize = strnlen(from, fsize);
  size = fsize;
  ff = from + fsize - 1;
  while ((0 < size) && (' ' == *ff)) {
    --ff;
    --size;
  }
  if (0 == size) {
  } else if (fsize == size) {
  } else if ((*ff != '\\') || ((size > 1) && (*(ff - 1) == '\\'))) {
  } else {
    ++ff;
    ++size;
  }
  if (tsize < size) {
    size = tsize;
  }
  strncpy(to, from, size);
  if (tsize == 0) {
  } else if (tsize > size) {
    to[size] = '\0';
  } else if (tsize == size) {
    to[--size] = '\0';
  } else {
  }
  return size;
}
```