ylfeng/ReF-Decompile-dataset huggingface dataset:
user: What is the c source code of the assembly code below?

```asm
<togglerandom>:
  endbr64
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  lea    D18(%rip),%rax
  mov    %rsp,%rdi
  movq   $0x0,0x10(%rsp)
  mov    %rax,(%rsp)
  lea    D3(%rip),%rax
  mov    %rax,0x8(%rsp)
  call   <exec@plt>
  xor    %eax,%eax
  call   <updateisrandom@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L9
  add    $0x28,%rsp
  ret
L9:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D18
type_infered: string
name: unpack_data
arguments: label: D3
type_infered: string

tool: D18: mmusicd

tool: D3: random

assistant: ```c
void togglerandom() {
  char *random[3] = {"mmusicd", "random", NULL};
  exec(random);
  updateisrandom();
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<togglerandom>:
  endbr64
  sub    $0x28,%rsp
  lea    D10(%rip),%rdx
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  lea    D2(%rip),%rax
  movq   %rdx,%xmm0
  mov    %rsp,%rdi
  movq   $0x0,0x10(%rsp)
  movq   %rax,%xmm1
  punpcklqdq %xmm1,%xmm0
  movaps %xmm0,(%rsp)
  call   <exec@plt>
  xor    %eax,%eax
  call   <updateisrandom@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L3
  add    $0x28,%rsp
  ret
L3:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_tag: D10
type_guessed: string
name: retrieve_data
arguments: data_tag: D2
type_guessed: string

tool: D10: mmusicd

tool: D2: random

assistant: ```c
void togglerandom() {
  char *random[3] = {"mmusicd", "random", NULL};
  exec(random);
  updateisrandom();
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    D17(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,%edi
  call   <sysconf@plt>
  cmp    $0x30db0,%rax
  jne    L5
  mov    D12(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,%edi
  call   <sysconf@plt>
  cmp    $0x30daf,%rax
  jg     L2
L5:
  mov    $0x4,%edi
  call   <exit@plt>
L2:
  mov    $0x5,%edi
  call   <exit@plt>
  mov    $0x0,%eax
  pop    %rbp
  ret
```

assistant: ```c
int main(void) {
  if (sysconf(_SC_ASYNCHRONOUS_IO) != 200112L || sysconf(_SC_MONOTONIC_CLOCK) < 200112L)
    exit(4);
  exit(5);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    D13(%rip),%rax
  mov    (%rax),%edi
  call   <sysconf@plt>
  cmp    $0x30db0,%rax
  je     L12
L8:
  mov    $0x4,%edi
  call   <exit@plt>
L11:
  mov    $0x5,%edi
  call   <exit@plt>
  mov    $0x0,%eax
  add    $0x8,%rsp
  ret
L12:
  mov    D16(%rip),%rax
  mov    (%rax),%edi
  call   <sysconf@plt>
  cmp    $0x30daf,%rax
  jg     L11
  jmp    L8
```

assistant: ```c
int main(void) {
  if (sysconf(_SC_ASYNCHRONOUS_IO) != 200112L || sysconf(_SC_MONOTONIC_CLOCK) < 200112L)
    exit(4);
  exit(5);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    D19(%rip),%rax
  mov    (%rax),%edi
  call   <sysconf@plt>
  cmp    $0x30db0,%rax
  je     L2
L26:
  mov    $0x4,%edi
  call   <exit@plt>
L19:
  mov    $0x5,%edi
  call   <exit@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
L2:
  mov    D3(%rip),%rax
  mov    (%rax),%edi
  call   <sysconf@plt>
  cmp    $0x30daf,%rax
  jle    L26
  jmp    L19
```

assistant: ```c
int main(void) {
  if (sysconf(_SC_ASYNCHRONOUS_IO) != 200112L || sysconf(_SC_MONOTONIC_CLOCK) < 200112L)
    exit(4);
  exit(5);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    D8(%rip),%rax
  mov    (%rax),%edi
  call   <sysconf@plt>
  cmp    $0x30db0,%rax
  je     L9
L8:
  mov    $0x4,%edi
  call   <exit@plt>
L2:
  mov    $0x5,%edi
  call   <exit@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
L9:
  mov    D17(%rip),%rax
  mov    (%rax),%edi
  call   <sysconf@plt>
  cmp    $0x30daf,%rax
  jle    L8
  jmp    L2
```

assistant: ```c
int main(void) {
  if (sysconf(_SC_ASYNCHRONOUS_IO) != 200112L || sysconf(_SC_MONOTONIC_CLOCK) < 200112L)
    exit(4);
  exit(5);
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0x1,%eax
  pop    %rbp
  ret
```

assistant: ```c
int main(void) {
  "a" != 'b';
  return 1;
}
```
user: 请从给定的汇编指令推导出C源代码:

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

assistant: ```c
int main(void) {
  "a" != 'b';
  return 1;
}
```
user: Translate the below assembly code into C programming language:

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

assistant: ```c
int main(void) {
  "a" != 'b';
  return 1;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x54474741,-0x17(%rbp)
  movw   $0x4241,-0x13(%rbp)
  movb   $0x0,-0x11(%rbp)
  movabs $0x42594158545847,%rax
  mov    %rax,-0x10(%rbp)
  lea    -0x17(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x20(%rbp)
  lea    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x1c(%rbp)
  mov    -0x1c(%rbp),%ecx
  mov    -0x20(%rbp),%edx
  lea    -0x10(%rbp),%rsi
  lea    -0x17(%rbp),%rax
  mov    %rax,%rdi
  call   <lcs@plt>
  mov    %eax,%esi
  lea    D5(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L7
  call   <__stack_chk_fail@plt>
L7:
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D5
type_infered: string

tool: D5: Length of LCS is %dn

assistant: ```c
int main() {
  char X[] = "AGGTAB";
  char Y[] = "GXTXAYB";
  int m = strlen(X);
  int n = strlen(Y);
  printf("Length of LCS is %dn", lcs(X, Y, m, n));
  return 0;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<main>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  movl   $0x54474741,0x9(%rsp)
  movw   $0x4241,0xd(%rsp)
  movb   $0x0,0xf(%rsp)
  movabs $0x42594158545847,%rax
  mov    %rax,0x10(%rsp)
  lea    0x9(%rsp),%rbp
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  lea    0x10(%rsp),%r12
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %eax,%ecx
  mov    %ebx,%edx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <lcs@plt>
  mov    %eax,%esi
  lea    D1(%rip),%rdi
  call   <printf@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L8
  mov    $0x0,%eax
  add    $0x20,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L8:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D1
datatype: string

tool: D1: Length of LCS is %dn

assistant: ```c
int main() {
  char X[] = "AGGTAB";
  char Y[] = "GXTXAYB";
  int m = strlen(X);
  int n = strlen(Y);
  printf("Length of LCS is %dn", lcs(X, Y, m, n));
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<main>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0x9(%rsp),%rbp
  mov    $0x4241,%eax
  lea    0x10(%rsp),%r13
  mov    %ax,0xd(%rsp)
  mov    %rbp,%rdi
  movabs $0x42594158545847,%rax
  movl   $0x54474741,0x9(%rsp)
  movb   $0x0,0xf(%rsp)
  mov    %rax,0x10(%rsp)
  call   <strlen@plt>
  mov    %r13,%rdi
  mov    %eax,%r12d
  call   <strlen@plt>
  mov    %r13,%rsi
  mov    %rbp,%rdi
  mov    %r12d,%edx
  mov    %eax,%ecx
  call   <lcs@plt>
  lea    D8(%rip),%rdi
  mov    %eax,%esi
  call   <printf@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L1
  add    $0x20,%rsp
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L1:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_tag: D8
type_infered: string

tool: D8: Length of LCS is %dn

assistant: ```c
int main() {
  char X[] = "AGGTAB";
  char Y[] = "GXTXAYB";
  int m = strlen(X);
  int n = strlen(Y);
  printf("Length of LCS is %dn", lcs(X, Y, m, n));
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0x9(%rsp),%rbp
  mov    $0x4241,%eax
  lea    0x10(%rsp),%r13
  mov    %ax,0xd(%rsp)
  mov    %rbp,%rdi
  movabs $0x42594158545847,%rax
  movl   $0x54474741,0x9(%rsp)
  movb   $0x0,0xf(%rsp)
  mov    %rax,0x10(%rsp)
  call   <strlen@plt>
  mov    %r13,%rdi
  mov    %eax,%r12d
  call   <strlen@plt>
  mov    %r13,%rsi
  mov    %rbp,%rdi
  mov    %r12d,%edx
  mov    %eax,%ecx
  call   <lcs@plt>
  lea    D7(%rip),%rdi
  mov    %eax,%esi
  call   <printf@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L5
  add    $0x20,%rsp
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L5:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D7
type_infered: string

tool: D7: Length of LCS is %dn

assistant: ```c
int main() {
  char X[] = "AGGTAB";
  char Y[] = "GXTXAYB";
  int m = strlen(X);
  int n = strlen(Y);
  printf("Length of LCS is %dn", lcs(X, Y, m, n));
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<next_permutation>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <assert@plt>
  cmpl   $0x0,-0x1c(%rbp)
  setg   %al
  movzbl %al,%eax
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <assert@plt>
  cmpl   $0x2,-0x1c(%rbp)
  jg     L89
  mov    $0x0,%eax
  jmp    L59
L89:
  mov    -0x1c(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0xc(%rbp)
  jmp    L66
L36:
  subl   $0x1,-0xc(%rbp)
L66:
  mov    -0xc(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jl     L55
  cmpl   $0x0,-0xc(%rbp)
  jg     L36
L55:
  cmpl   $0x0,-0xc(%rbp)
  jne    L76
  mov    -0x1c(%rbp),%edx
  mov    -0x18(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <reverse@plt>
  mov    $0x0,%eax
  jmp    L59
L76:
  mov    -0xc(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x1c(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x8(%rbp)
  jmp    L29
L65:
  subl   $0x1,-0x8(%rbp)
L29:
  mov    -0x8(%rbp),%eax
  cmp    -0x4(%rbp),%eax
  jle    L82
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jl     L65
L82:
  mov    -0x4(%rbp),%edx
  mov    -0x8(%rbp),%ecx
  mov    -0x18(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <swap@plt>
  mov    -0x1c(%rbp),%eax
  sub    -0xc(%rbp),%eax
  mov    -0xc(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x18(%rbp),%rdx
  add    %rcx,%rdx
  mov    %eax,%esi
  mov    %rdx,%rdi
  mov    $0x0,%eax
  call   <reverse@plt>
  mov    $0x1,%eax
L59:
  leave
  ret
```

assistant: ```c
int next_permutation(int *perm, int length) {
  assert(perm);
  assert(length > 0);
  if (length <= 2)
    return 0;
  int last = length - 1;
  while ((perm[last - 1] >= perm[last]) && (last > 0))
    last--;
  if (last == 0) {
    reverse(perm, length);
    return 0;
  }
  int h = last - 1;
  int i = length - 1;
  while ((i > h) && (perm[i] < perm[h]))
    i--;
  swap(perm, i, h);
  reverse(perm + last, length - last);
  return 1;
}
```
user: Translate the below assembly code into C programming language:

```asm
<next_permutation>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r13
  mov    %esi,%r12d
  mov    $0x0,%eax
  call   <assert@plt>
  test   %r12d,%r12d
  setg   %dil
  movzbl %dil,%edi
  mov    $0x0,%eax
  call   <assert@plt>
  mov    $0x0,%ebx
  cmp    $0x2,%r12d
  jle    L3
  lea    -0x1(%r12),%esi
  movslq %esi,%rax
  lea    0x0(,%rax,4),%rdx
  lea    0x0(%r13,%rdx,1),%rbp
  mov    0x0(%rbp),%edi
  cmp    %edi,-0x4(%r13,%rdx,1)
  jl     L72
  lea    -0x4(%r13,%rax,4),%rax
  mov    %esi,%ebx
L27:
  sub    $0x1,%ebx
  mov    %rax,%rbp
  sub    $0x4,%rax
  mov    0x0(%rbp),%ecx
  cmp    %ecx,-0x4(%rbp)
  jl     L41
  test   %ebx,%ebx
  jg     L27
L41:
  test   %ebx,%ebx
  je     L69
L73:
  lea    -0x1(%rbx),%edi
  cmp    %ebx,%r12d
  jle    L97
  movslq %edi,%rax
  mov    0x0(%r13,%rax,4),%ecx
  lea    0x0(%r13,%rdx,1),%rax
  mov    %edi,%edx
L43:
  cmp    %ecx,(%rax)
  jge    L97
  sub    $0x1,%esi
  sub    $0x4,%rax
  cmp    %edx,%esi
  jne    L43
  mov    %edx,%esi
L97:
  mov    %edi,%edx
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <swap@plt>
  mov    %r12d,%esi
  sub    %ebx,%esi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <reverse@plt>
  mov    $0x1,%ebx
L3:
  mov    %ebx,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L69:
  mov    %r12d,%esi
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <reverse@plt>
  jmp    L3
L72:
  mov    %esi,%ebx
  jmp    L73
```

assistant: ```c
int next_permutation(int *perm, int length) {
  assert(perm);
  assert(length > 0);
  if (length <= 2)
    return 0;
  int last = length - 1;
  while ((perm[last - 1] >= perm[last]) && (last > 0))
    last--;
  if (last == 0) {
    reverse(perm, length);
    return 0;
  }
  int h = last - 1;
  int i = length - 1;
  while ((i > h) && (perm[i] < perm[h]))
    i--;
  swap(perm, i, h);
  reverse(perm + last, length - last);
  return 1;
}
```
user: Translate the below assembly code into C programming language:

```asm
<next_permutation>:
  endbr64
  push   %r14
  xor    %eax,%eax
  push   %r13
  mov    %esi,%r13d
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x8,%rsp
  call   <assert@plt>
  xor    %edi,%edi
  test   %r13d,%r13d
  setg   %dil
  xor    %eax,%eax
  call   <assert@plt>
  xor    %eax,%eax
  cmp    $0x2,%r13d
  jle    L84
  lea    -0x1(%r13),%esi
  movslq %esi,%rax
  lea    0x0(,%rax,4),%rdx
  lea    0x0(%rbp,%rdx,1),%r12
  mov    (%r12),%edi
  cmp    %edi,-0x4(%rbp,%rdx,1)
  jl     L91
  lea    -0x4(%rbp,%rax,4),%rdx
  mov    %esi,%ecx
  jmp    L33
  nopl   0x0(%rax,%rax,1)
L7:
  sub    $0x4,%rdx
  test   %ecx,%ecx
  je     L34
L33:
  mov    (%rdx),%r9d
  sub    $0x1,%ecx
  mov    %rdx,%r12
  cmp    %r9d,-0x4(%rdx)
  jge    L7
  test   %ecx,%ecx
  je     L34
  mov    %r13d,%r14d
  sub    %ecx,%r14d
L52:
  lea    -0x1(%rcx),%r8d
  cmp    %ecx,%r13d
  jle    L85
  movslq %r8d,%rdx
  mov    0x0(%rbp,%rdx,4),%edx
  jmp    L103
  nopl   0x0(%rax,%rax,1)
L83:
  lea    -0x1(%rax),%esi
  cmp    %eax,%ecx
  jge    L85
  mov    -0x4(%rbp,%rax,4),%edi
  sub    $0x1,%rax
L103:
  mov    %eax,%esi
  cmp    %edi,%edx
  jg     L83
L85:
  mov    %r8d,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <swap@plt>
  mov    %r14d,%esi
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <reverse@plt>
  mov    $0x1,%eax
L84:
  add    $0x8,%rsp
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L34:
  mov    %r13d,%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <reverse@plt>
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L91:
  mov    %esi,%ecx
  mov    $0x1,%r14d
  jmp    L52
```

assistant: ```c
int next_permutation(int *perm, int length) {
  assert(perm);
  assert(length > 0);
  if (length <= 2)
    return 0;
  int last = length - 1;
  while ((perm[last - 1] >= perm[last]) && (last > 0))
    last--;
  if (last == 0) {
    reverse(perm, length);
    return 0;
  }
  int h = last - 1;
  int i = length - 1;
  while ((i > h) && (perm[i] < perm[h]))
    i--;
  swap(perm, i, h);
  reverse(perm + last, length - last);
  return 1;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<next_permutation>:
  endbr64
  push   %r14
  xor    %eax,%eax
  push   %r13
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x8,%rsp
  call   <assert@plt>
  xor    %edi,%edi
  test   %r12d,%r12d
  setg   %dil
  xor    %eax,%eax
  call   <assert@plt>
  xor    %eax,%eax
  cmp    $0x2,%r12d
  jle    L30
  lea    -0x1(%r12),%r8d
  movslq %r8d,%rdx
  lea    0x0(,%rdx,4),%rax
  lea    0x0(%rbp,%rax,1),%rsi
  mov    -0x4(%rbp,%rax,1),%ecx
  cmp    (%rsi),%ecx
  jl     L10
  lea    -0x4(%rbp,%rdx,4),%rdx
  mov    %r8d,%eax
  jmp    L20
  nopl   0x0(%rax,%rax,1)
L13:
  sub    $0x4,%rdx
  test   %eax,%eax
  je     L88
L20:
  mov    %ecx,%edi
  mov    -0x4(%rdx),%ecx
  sub    $0x1,%eax
  mov    %rdx,%r13
  cmp    %edi,%ecx
  jge    L13
  test   %eax,%eax
  je     L88
  mov    %r12d,%r14d
  sub    %eax,%r14d
L47:
  lea    -0x1(%rax),%r9d
  cmp    %eax,%r12d
  jle    L69
  movslq %r9d,%rdx
  mov    0x0(%rbp,%rdx,4),%edi
  mov    %rsi,%rdx
  jmp    L40
  xchg   %ax,%ax
L55:
  lea    -0x1(%r8),%ecx
  sub    $0x4,%rdx
  cmp    %r8d,%eax
  mov    %ecx,%r8d
  je     L69
L40:
  cmp    %edi,(%rdx)
  jl     L55
L69:
  mov    %r8d,%esi
  mov    %r9d,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <swap@plt>
  mov    %r14d,%esi
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <reverse@plt>
  mov    $0x1,%eax
L30:
  add    $0x8,%rsp
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopw   0x0(%rax,%rax,1)
L88:
  mov    %r12d,%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <reverse@plt>
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L10:
  mov    %r8d,%eax
  mov    %rsi,%r13
  mov    $0x1,%r14d
  jmp    L47
```

assistant: ```c
int next_permutation(int *perm, int length) {
  assert(perm);
  assert(length > 0);
  if (length <= 2)
    return 0;
  int last = length - 1;
  while ((perm[last - 1] >= perm[last]) && (last > 0))
    last--;
  if (last == 0) {
    reverse(perm, length);
    return 0;
  }
  int h = last - 1;
  int i = length - 1;
  while ((i > h) && (perm[i] < perm[h]))
    i--;
  swap(perm, i, h);
  reverse(perm + last, length - last);
  return 1;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<apdu_recv>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %rcx,-0x40(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movb   $0xff,-0x14(%rbp)
  movq   $0x0,-0x10(%rbp)
  jmp    L88
L28:
  lea    -0x15(%rbp),%rdi
  lea    -0x10(%rbp),%rcx
  lea    -0x14(%rbp),%rdx
  lea    -0x13(%rbp),%rsi
  mov    -0x24(%rbp),%eax
  mov    %rdi,%r8
  mov    %eax,%edi
  call   <alpar_recv@plt>
  mov    %ax,-0x12(%rbp)
  cmpw   $0x0,-0x12(%rbp)
  jns    L88
  mov    $0xffffffff,%eax
  jmp    L74
L88:
  movzbl -0x14(%rbp),%eax
  test   %al,%al
  jne    L28
  movzbl -0x13(%rbp),%eax
  cmp    $0xe0,%al
  jne    L68
  mov    $0xffffffff,%eax
  jmp    L74
L68:
  mov    -0x10(%rbp),%rdx
  movswq -0x12(%rbp),%rax
  sub    $0x2,%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0x30(%rbp),%rax
  mov    %dl,(%rax)
  mov    -0x10(%rbp),%rdx
  movswq -0x12(%rbp),%rax
  sub    $0x1,%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0x38(%rbp),%rax
  mov    %dl,(%rax)
  cmpw   $0x2,-0x12(%rbp)
  jle    L14
  movzwl -0x12(%rbp),%eax
  sub    $0x2,%eax
  movswl %ax,%edx
  mov    -0x10(%rbp),%rcx
  mov    -0x40(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
L14:
  mov    -0x10(%rbp),%rax
  test   %rax,%rax
  je     L34
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L34:
  movswl -0x12(%rbp),%eax
  sub    $0x2,%eax
L74:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L75
  call   <__stack_chk_fail@plt>
L75:
  leave
  ret
```

assistant: ```c
int apdu_recv(int fd, unsigned char *sw1, unsigned char *sw2, unsigned char *data) {
  unsigned char lrc, *packet, command, ack;
  short int len;
  command = 0xff;
  packet = NULL;
  while (command != 0x00) {
    len = alpar_recv(fd, &ack, &command, &packet, &lrc);
    if (len < 0)
      return -1;
  }
  if (ack == 0xE0)
    return -1;
  *sw1 = packet[len - 2];
  *sw2 = packet[len - 1];
  if (len - 2 > 0)
    memcpy(data, packet, len - 2);
  if (packet)
    free(packet);
  return (len - 2);
}
```
user: Translate the below assembly code into C programming language:

```asm
<apdu_recv>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %edi,%ebp
  mov    %rsi,%r14
  mov    %rdx,%r13
  mov    %rcx,%r15
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  movb   $0xff,0xe(%rsp)
  movq   $0x0,0x10(%rsp)
  lea    0xd(%rsp),%r12
L15:
  lea    0x10(%rsp),%rcx
  lea    0xe(%rsp),%rdx
  lea    0xf(%rsp),%rsi
  mov    %r12,%r8
  mov    %ebp,%edi
  call   <alpar_recv@plt>
  mov    %eax,%ebx
  test   %ax,%ax
  js     L35
  cmpb   $0x0,0xe(%rsp)
  jne    L15
  cmpb   $0xe0,0xf(%rsp)
  je     L50
  mov    0x10(%rsp),%rsi
  movswq %ax,%rax
  movzbl -0x2(%rsi,%rax,1),%edx
  mov    %dl,(%r14)
  movzbl -0x1(%rsi,%rax,1),%eax
  mov    %al,0x0(%r13)
  cmp    $0x2,%bx
  jg     L27
L76:
  mov    0x10(%rsp),%rdi
  test   %rdi,%rdi
  je     L46
  call   <free@plt>
L46:
  movswl %bx,%eax
  sub    $0x2,%eax
L0:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L8
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L27:
  lea    -0x2(%rbx),%edx
  movswl %dx,%edx
  mov    %r15,%rdi
  call   <memcpy@plt>
  jmp    L76
L35:
  mov    $0xffffffff,%eax
  jmp    L0
L50:
  mov    $0xffffffff,%eax
  jmp    L0
L8:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int apdu_recv(int fd, unsigned char *sw1, unsigned char *sw2, unsigned char *data) {
  unsigned char lrc, *packet, command, ack;
  short int len;
  command = 0xff;
  packet = NULL;
  while (command != 0x00) {
    len = alpar_recv(fd, &ack, &command, &packet, &lrc);
    if (len < 0)
      return -1;
  }
  if (ack == 0xE0)
    return -1;
  *sw1 = packet[len - 2];
  *sw2 = packet[len - 1];
  if (len - 2 > 0)
    memcpy(data, packet, len - 2);
  if (packet)
    free(packet);
  return (len - 2);
}
```