ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<MP_display_light_intensity>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  lea    D15(%rip),%rdi
  call   <puts@plt>
  mov    $0x1,%esi
  mov    $0x3,%edi
  call   <MP_motor@plt>
L3:
  mov    $0x0,%edi
  call   <MP_anin@plt>
  mov    %eax,%r15d
  mov    $0x1,%edi
  call   <MP_anin@plt>
  mov    %eax,%r14d
  mov    $0x2,%edi
  call   <MP_anin@plt>
  mov    %eax,%r13d
  mov    $0x3,%edi
  call   <MP_anin@plt>
  mov    %eax,%r12d
  mov    $0x4,%edi
  call   <MP_anin@plt>
  mov    %eax,%ebp
  mov    $0x5,%edi
  call   <MP_anin@plt>
  mov    %eax,%ebx
  mov    $0x6,%edi
  call   <MP_anin@plt>
  mov    %eax,0xc(%rsp)
  mov    $0x7,%edi
  call   <MP_anin@plt>
  mov    %eax,%esi
  sub    $0x8,%rsp
  push   %r15
  push   %r14
  push   %r13
  mov    %r12d,%r9d
  mov    %ebp,%r8d
  mov    %ebx,%ecx
  mov    0x2c(%rsp),%edx
  lea    D11(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x20,%rsp
  jmp    L3
```

tool_calls: name: read_data
arguments: label: D15
type_infered: string
name: read_data
arguments: label: D11
type_infered: string

tool: D15: Helligkeitsanzeige der Fototransistoren 8..1:

tool: D11: %x, %x, %x, %x, %x, %x, %x, %x


assistant: ```c
void MP_display_light_intensity(void) {
  int PV_value = 0;
  printf("Helligkeitsanzeige der Fototransistoren 8..1:\n");
  MP_motor(3, 1);
  while (1) {
    printf("%x, %x, %x, %x, %x, %x, %x, %x\n", MP_anin(7), MP_anin(6), MP_anin(5), MP_anin(4), MP_anin(3), MP_anin(2), MP_anin(1), MP_anin(0));
  };
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<MP_display_light_intensity>:
  endbr64
  push   %r15
  lea    D19(%rip),%rdi
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  call   <puts@plt>
  mov    $0x1,%esi
  mov    $0x3,%edi
  call   <MP_motor@plt>
  nopl   (%rax)
L4:
  xor    %edi,%edi
  call   <MP_anin@plt>
  mov    $0x1,%edi
  mov    %eax,0xc(%rsp)
  call   <MP_anin@plt>
  mov    $0x2,%edi
  mov    %eax,%ebx
  call   <MP_anin@plt>
  mov    $0x3,%edi
  mov    %eax,%r15d
  call   <MP_anin@plt>
  mov    $0x4,%edi
  mov    %eax,%r14d
  call   <MP_anin@plt>
  mov    $0x5,%edi
  mov    %eax,%ebp
  call   <MP_anin@plt>
  mov    $0x6,%edi
  mov    %eax,%r13d
  call   <MP_anin@plt>
  mov    $0x7,%edi
  mov    %eax,%r12d
  call   <MP_anin@plt>
  sub    $0x8,%rsp
  mov    %r14d,%r9d
  mov    %ebp,%r8d
  mov    0x14(%rsp),%ecx
  mov    %eax,%esi
  mov    %r12d,%edx
  lea    D12(%rip),%rdi
  xor    %eax,%eax
  push   %rcx
  mov    %r13d,%ecx
  push   %rbx
  push   %r15
  call   <printf@plt>
  add    $0x20,%rsp
  jmp    L4
```

tool_calls: name: extract_symbolic_data
arguments: label: D19
data_type: string
name: extract_symbolic_data
arguments: label: D12
data_type: string

tool: D19: Helligkeitsanzeige der Fototransistoren 8..1:

tool: D12: %x, %x, %x, %x, %x, %x, %x, %x


assistant: ```c
void MP_display_light_intensity(void) {
  int PV_value = 0;
  printf("Helligkeitsanzeige der Fototransistoren 8..1:\n");
  MP_motor(3, 1);
  while (1) {
    printf("%x, %x, %x, %x, %x, %x, %x, %x\n", MP_anin(7), MP_anin(6), MP_anin(5), MP_anin(4), MP_anin(3), MP_anin(2), MP_anin(1), MP_anin(0));
  };
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<MP_display_light_intensity>:
  endbr64
  push   %r15
  lea    D6(%rip),%rdi
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  call   <puts@plt>
  mov    $0x1,%esi
  mov    $0x3,%edi
  call   <MP_motor@plt>
  nopl   (%rax)
L9:
  xor    %edi,%edi
  call   <MP_anin@plt>
  mov    $0x1,%edi
  mov    %eax,0xc(%rsp)
  call   <MP_anin@plt>
  mov    $0x2,%edi
  mov    %eax,%ebx
  call   <MP_anin@plt>
  mov    $0x3,%edi
  mov    %eax,%r15d
  call   <MP_anin@plt>
  mov    $0x4,%edi
  mov    %eax,%r14d
  call   <MP_anin@plt>
  mov    $0x5,%edi
  mov    %eax,%ebp
  call   <MP_anin@plt>
  mov    $0x6,%edi
  mov    %eax,%r13d
  call   <MP_anin@plt>
  mov    $0x7,%edi
  mov    %eax,%r12d
  call   <MP_anin@plt>
  sub    $0x8,%rsp
  mov    %r14d,%r9d
  mov    %ebp,%r8d
  mov    0x14(%rsp),%ecx
  mov    %eax,%esi
  mov    %r12d,%edx
  lea    D1(%rip),%rdi
  xor    %eax,%eax
  push   %rcx
  mov    %r13d,%ecx
  push   %rbx
  push   %r15
  call   <printf@plt>
  add    $0x20,%rsp
  jmp    L9
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D6
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D1
type_guessed: string

tool: D6: Helligkeitsanzeige der Fototransistoren 8..1:

tool: D1: %x, %x, %x, %x, %x, %x, %x, %x


assistant: ```c
void MP_display_light_intensity(void) {
  int PV_value = 0;
  printf("Helligkeitsanzeige der Fototransistoren 8..1:\n");
  MP_motor(3, 1);
  while (1) {
    printf("%x, %x, %x, %x, %x, %x, %x, %x\n", MP_anin(7), MP_anin(6), MP_anin(5), MP_anin(4), MP_anin(3), MP_anin(2), MP_anin(1), MP_anin(0));
  };
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<cookey>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xc0,%rsp
  mov    %rdi,-0xb8(%rbp)
  mov    %rsi,-0xc0(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x90(%rbp),%rax
  mov    %rax,-0xa0(%rbp)
  movl   $0x0,-0xa4(%rbp)
  jmp    L0
L23:
  mov    -0xb8(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,-0xb8(%rbp)
  mov    %rax,-0x98(%rbp)
  mov    -0x98(%rbp),%rax
  mov    (%rax),%eax
  cltq
  shl    $0x6,%rax
  and    $0x3f000000,%eax
  mov    %eax,%edx
  mov    -0xa0(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0xa0(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x98(%rbp),%rax
  mov    (%rax),%eax
  cltq
  shl    $0xa,%rax
  and    $0x3f0000,%eax
  or     %eax,%edx
  mov    -0xa0(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0xa0(%rbp),%rax
  mov    (%rax),%edx
  mov    -0xb8(%rbp),%rax
  mov    (%rax),%eax
  cltq
  sar    $0xa,%rax
  and    $0x3f00,%eax
  or     %eax,%edx
  mov    -0xa0(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0xa0(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,-0xa0(%rbp)
  mov    (%rax),%ecx
  mov    -0xb8(%rbp),%rdx
  mov    (%rdx),%edx
  movslq %edx,%rdx
  sar    $0x6,%rdx
  and    $0x3f,%edx
  or     %ecx,%edx
  mov    %edx,(%rax)
  mov    -0x98(%rbp),%rax
  mov    (%rax),%eax
  cltq
  shl    $0xc,%rax
  and    $0x3f000000,%eax
  mov    %eax,%edx
  mov    -0xa0(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0xa0(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x98(%rbp),%rax
  mov    (%rax),%eax
  cltq
  shl    $0x10,%rax
  and    $0x3f0000,%eax
  or     %eax,%edx
  mov    -0xa0(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0xa0(%rbp),%rax
  mov    (%rax),%edx
  mov    -0xb8(%rbp),%rax
  mov    (%rax),%eax
  cltq
  sar    $0x4,%rax
  and    $0x3f00,%eax
  or     %eax,%edx
  mov    -0xa0(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0xa0(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,-0xa0(%rbp)
  mov    (%rax),%ecx
  mov    -0xb8(%rbp),%rdx
  mov    (%rdx),%edx
  and    $0x3f,%edx
  or     %ecx,%edx
  mov    %edx,(%rax)
  addl   $0x1,-0xa4(%rbp)
  addq   $0x4,-0xb8(%rbp)
L0:
  cmpl   $0xf,-0xa4(%rbp)
  jle    L23
  lea    -0x90(%rbp),%rcx
  mov    -0xc0(%rbp),%rax
  mov    $0x80,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L7
  call   <__stack_chk_fail@plt>
L7:
  leave
  ret
```

assistant: ```c
void cookey(const uint32_t *raw1, uint32_t *keyout) {
  uint32_t *cook;
  const uint32_t *raw0;
  uint32_t dough[32];
  int i;
  cook = dough;
  for (i = 0; i < 16; i++, raw1++) {
    raw0 = raw1++;
    *cook = (*raw0 & 0x00fc0000L) << 6;
    *cook |= (*raw0 & 0x00000fc0L) << 10;
    *cook |= (*raw1 & 0x00fc0000L) >> 10;
    *cook++ |= (*raw1 & 0x00000fc0L) >> 6;
    *cook = (*raw0 & 0x0003f000L) << 12;
    *cook |= (*raw0 & 0x0000003fL) << 16;
    *cook |= (*raw1 & 0x0003f000L) >> 4;
    *cook++ |= (*raw1 & 0x0000003fL);
  }
  memcpy(keyout, dough, sizeof(dough));
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<cookey>:
  endbr64
  sub    $0x98,%rsp
  mov    %rdi,%r8
  mov    %rsi,%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x88(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rcx
  lea    0x80(%rsp),%rsi
L6:
  movslq (%r8),%rdx
  mov    0x4(%r8),%r10d
  movslq %r10d,%r9
  mov    %rdx,%rax
  shl    $0x6,%rax
  and    $0x3f000000,%eax
  mov    %rdx,%r11
  shl    $0xa,%r11
  and    $0x3f0000,%r11d
  or     %r11d,%eax
  mov    %r9,%r11
  sar    $0xa,%r11
  and    $0x3f00,%r11d
  or     %r11d,%eax
  mov    %r9,%r11
  sar    $0x6,%r11
  and    $0x3f,%r11d
  or     %r11d,%eax
  mov    %eax,(%rcx)
  add    $0x8,%rcx
  mov    %rdx,%rax
  shl    $0xc,%rax
  and    $0x3f000000,%eax
  shl    $0x10,%rdx
  and    $0x3f0000,%edx
  or     %edx,%eax
  and    $0x3f,%r10d
  or     %r10d,%eax
  sar    $0x4,%r9
  and    $0x3f00,%r9d
  or     %r9d,%eax
  mov    %eax,-0x4(%rcx)
  add    $0x8,%r8
  cmp    %rsi,%rcx
  jne    L6
  mov    %rsp,%rsi
  mov    $0x80,%edx
  call   <memcpy@plt>
  mov    0x88(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L7
  add    $0x98,%rsp
  ret
L7:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void cookey(const uint32_t *raw1, uint32_t *keyout) {
  uint32_t *cook;
  const uint32_t *raw0;
  uint32_t dough[32];
  int i;
  cook = dough;
  for (i = 0; i < 16; i++, raw1++) {
    raw0 = raw1++;
    *cook = (*raw0 & 0x00fc0000L) << 6;
    *cook |= (*raw0 & 0x00000fc0L) << 10;
    *cook |= (*raw1 & 0x00fc0000L) >> 10;
    *cook++ |= (*raw1 & 0x00000fc0L) >> 6;
    *cook = (*raw0 & 0x0003f000L) << 12;
    *cook |= (*raw0 & 0x0000003fL) << 16;
    *cook |= (*raw1 & 0x0003f000L) >> 4;
    *cook++ |= (*raw1 & 0x0000003fL);
  }
  memcpy(keyout, dough, sizeof(dough));
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<cookey>:
  endbr64
  push   %rbx
  mov    %rdi,%rcx
  mov    %rsi,%rdi
  sub    $0x90,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x88(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rsi
  lea    0x80(%rsp),%r8
  mov    %rsi,%rdx
  nopl   0x0(%rax,%rax,1)
L12:
  movslq (%rcx),%r11
  movslq 0x4(%rcx),%r9
  add    $0x8,%rdx
  add    $0x8,%rcx
  mov    %r11,%rax
  mov    %r11,%rbx
  mov    %r9,%r10
  shl    $0x6,%rax
  shl    $0xa,%rbx
  and    $0x3f,%r10d
  and    $0x3f0000,%ebx
  and    $0x3f000000,%eax
  or     %ebx,%eax
  mov    %r9,%rbx
  sar    $0xa,%rbx
  and    $0x3f00,%ebx
  or     %ebx,%eax
  mov    %r9,%rbx
  sar    $0x4,%r9
  sar    $0x6,%rbx
  and    $0x3f00,%r9d
  and    $0x3f,%ebx
  or     %ebx,%eax
  mov    %eax,-0x8(%rdx)
  mov    %r11,%rax
  shl    $0x10,%r11
  shl    $0xc,%rax
  and    $0x3f0000,%r11d
  and    $0x3f000000,%eax
  or     %r11d,%eax
  or     %r10d,%eax
  or     %r9d,%eax
  mov    %eax,-0x4(%rdx)
  cmp    %r8,%rdx
  jne    L12
  mov    $0x80,%edx
  call   <memcpy@plt>
  mov    0x88(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L3
  add    $0x90,%rsp
  pop    %rbx
  ret
L3:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void cookey(const uint32_t *raw1, uint32_t *keyout) {
  uint32_t *cook;
  const uint32_t *raw0;
  uint32_t dough[32];
  int i;
  cook = dough;
  for (i = 0; i < 16; i++, raw1++) {
    raw0 = raw1++;
    *cook = (*raw0 & 0x00fc0000L) << 6;
    *cook |= (*raw0 & 0x00000fc0L) << 10;
    *cook |= (*raw1 & 0x00fc0000L) >> 10;
    *cook++ |= (*raw1 & 0x00000fc0L) >> 6;
    *cook = (*raw0 & 0x0003f000L) << 12;
    *cook |= (*raw0 & 0x0000003fL) << 16;
    *cook |= (*raw1 & 0x0003f000L) >> 4;
    *cook++ |= (*raw1 & 0x0000003fL);
  }
  memcpy(keyout, dough, sizeof(dough));
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<test_fun>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %esi,-0x28(%rbp)
  mov    %edx,-0x2c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    $0x4,%edi
  call   <alloca@plt>
  mov    %rax,-0x20(%rbp)
  mov    $0x4,%edi
  call   <alloca@plt>
  mov    %rax,-0x18(%rbp)
  mov    $0x4,%edi
  call   <alloca@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x20(%rbp),%rax
  mov    -0x24(%rbp),%edx
  mov    %edx,(%rax)
  mov    -0x18(%rbp),%rax
  mov    -0x28(%rbp),%edx
  mov    %edx,(%rax)
  mov    -0x10(%rbp),%rax
  mov    -0x2c(%rbp),%edx
  mov    %edx,(%rax)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jg     L13
  mov    -0x10(%rbp),%rax
  mov    (%rax),%eax
  jmp    L22
L53:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jg     L58
  mov    -0x10(%rbp),%rax
  mov    (%rax),%eax
  jmp    L22
L58:
  mov    -0x10(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  add    %eax,%edx
  mov    -0x10(%rbp),%rax
  mov    %edx,(%rax)
L13:
  mov    -0x20(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x10(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jge    L53
  mov    -0x10(%rbp),%rax
  mov    (%rax),%eax
L22:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L52
  call   <__stack_chk_fail@plt>
L52:
  leave
  ret
```

assistant: ```c
int test_fun(int x, int y, int z) {
  int *x_ref = alloca(sizeof(int));
  int *y_ref = alloca(sizeof(int));
  int *z_ref = alloca(sizeof(int));
  *x_ref = x;
  *y_ref = y;
  *z_ref = z;
  if (*y_ref <= 0) {
    return *z_ref;
  }
  while (*x_ref >= *z_ref) {
    if (*y_ref <= 0) {
      return *z_ref;
    }
    *z_ref = *z_ref + *y_ref;
  }
  return *z_ref;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<test_fun>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x18,%rsp
  mov    %edi,%r15d
  mov    %esi,%r14d
  mov    %edx,%ebx
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  mov    $0x4,%edi
  call   <alloca@plt>
  mov    %rax,%r12
  mov    $0x4,%edi
  call   <alloca@plt>
  mov    %rax,%r13
  mov    $0x4,%edi
  call   <alloca@plt>
  mov    %r15d,(%r12)
  mov    %r14d,0x0(%r13)
  mov    %ebx,(%rax)
  mov    0x0(%r13),%edx
  test   %edx,%edx
  jle    L13
  cmp    (%r12),%ebx
  jg     L13
L2:
  add    %edx,%ebx
  mov    %ebx,(%rax)
  cmp    (%r12),%ebx
  jg     L13
  mov    0x0(%r13),%edx
  test   %edx,%edx
  jg     L2
L13:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L46
  mov    %ebx,%eax
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L46:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int test_fun(int x, int y, int z) {
  int *x_ref = alloca(sizeof(int));
  int *y_ref = alloca(sizeof(int));
  int *z_ref = alloca(sizeof(int));
  *x_ref = x;
  *y_ref = y;
  *z_ref = z;
  if (*y_ref <= 0) {
    return *z_ref;
  }
  while (*x_ref >= *z_ref) {
    if (*y_ref <= 0) {
      return *z_ref;
    }
    *z_ref = *z_ref + *y_ref;
  }
  return *z_ref;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<test_fun>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  mov    %edi,%r15d
  mov    $0x4,%edi
  push   %r14
  mov    %esi,%r14d
  push   %r13
  push   %r12
  mov    %edx,%r12d
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  call   <alloca@plt>
  mov    $0x4,%edi
  mov    %rax,%rbx
  call   <alloca@plt>
  mov    $0x4,%edi
  mov    %rax,%r13
  call   <alloca@plt>
  mov    %r15d,(%rbx)
  mov    %r14d,0x0(%r13)
  mov    %r12d,(%rax)
  mov    0x0(%r13),%edx
  test   %edx,%edx
  jle    L6
  cmp    (%rbx),%r12d
  jg     L6
  nopl   0x0(%rax,%rax,1)
L45:
  add    %edx,%r12d
  mov    %r12d,(%rax)
  cmp    (%rbx),%r12d
  jg     L6
  mov    0x0(%r13),%edx
  test   %edx,%edx
  jg     L45
L6:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L8
  lea    -0x28(%rbp),%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L8:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int test_fun(int x, int y, int z) {
  int *x_ref = alloca(sizeof(int));
  int *y_ref = alloca(sizeof(int));
  int *z_ref = alloca(sizeof(int));
  *x_ref = x;
  *y_ref = y;
  *z_ref = z;
  if (*y_ref <= 0) {
    return *z_ref;
  }
  while (*x_ref >= *z_ref) {
    if (*y_ref <= 0) {
      return *z_ref;
    }
    *z_ref = *z_ref + *y_ref;
  }
  return *z_ref;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<test_fun>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  mov    %edi,%r15d
  mov    $0x4,%edi
  push   %r14
  mov    %esi,%r14d
  push   %r13
  push   %r12
  mov    %edx,%r12d
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  call   <alloca@plt>
  mov    $0x4,%edi
  mov    %rax,%rbx
  call   <alloca@plt>
  mov    $0x4,%edi
  mov    %rax,%r13
  call   <alloca@plt>
  mov    %r15d,(%rbx)
  mov    %r14d,0x0(%r13)
  mov    %r12d,(%rax)
  mov    0x0(%r13),%edx
  test   %edx,%edx
  jle    L7
  cmp    (%rbx),%r12d
  jg     L7
  nopl   0x0(%rax,%rax,1)
L3:
  add    %edx,%r12d
  mov    %r12d,(%rax)
  cmp    (%rbx),%r12d
  jg     L7
  mov    0x0(%r13),%edx
  test   %edx,%edx
  jg     L3
L7:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L33
  lea    -0x28(%rbp),%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L33:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int test_fun(int x, int y, int z) {
  int *x_ref = alloca(sizeof(int));
  int *y_ref = alloca(sizeof(int));
  int *z_ref = alloca(sizeof(int));
  *x_ref = x;
  *y_ref = y;
  *z_ref = z;
  if (*y_ref <= 0) {
    return *z_ref;
  }
  while (*x_ref >= *z_ref) {
    if (*y_ref <= 0) {
      return *z_ref;
    }
    *z_ref = *z_ref + *y_ref;
  }
  return *z_ref;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<match_rating_codex>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,-0x10(%rbp)
  mov    $0x7,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L130
  mov    $0x0,%eax
  jmp    L22
L130:
  movb   $0x0,-0x22(%rbp)
  movq   $0x0,-0x20(%rbp)
  movq   $0x0,-0x18(%rbp)
  jmp    L133
L59:
  mov    -0x38(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <toupper@plt>
  mov    %al,-0x21(%rbp)
  cmpb   $0x20,-0x21(%rbp)
  je     L88
  cmpq   $0x0,-0x20(%rbp)
  je     L30
  cmpb   $0x41,-0x21(%rbp)
  je     L88
  cmpb   $0x45,-0x21(%rbp)
  je     L88
  cmpb   $0x49,-0x21(%rbp)
  je     L88
  cmpb   $0x4f,-0x21(%rbp)
  je     L88
  cmpb   $0x55,-0x21(%rbp)
  je     L88
L30:
  movzbl -0x21(%rbp),%eax
  cmp    -0x22(%rbp),%al
  je     L107
  cmpq   $0x6,-0x18(%rbp)
  jne    L52
  mov    -0x8(%rbp),%rax
  lea    0x3(%rax),%rdx
  mov    -0x8(%rbp),%rax
  movzbl 0x4(%rax),%eax
  mov    %al,(%rdx)
  mov    -0x8(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    -0x8(%rbp),%rax
  movzbl 0x5(%rax),%eax
  mov    %al,(%rdx)
  movq   $0x5,-0x18(%rbp)
L52:
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  mov    -0x8(%rbp),%rdx
  add    %rax,%rdx
  movzbl -0x21(%rbp),%eax
  mov    %al,(%rdx)
  jmp    L69
L88:
  nop
  jmp    L69
L107:
  nop
L69:
  addq   $0x1,-0x20(%rbp)
L133:
  mov    -0x20(%rbp),%rax
  cmp    -0x10(%rbp),%rax
  jae    L140
  cmpq   $0x6,-0x18(%rbp)
  jbe    L59
L140:
  mov    -0x8(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x8(%rbp),%rax
L22:
  leave
  ret
```

assistant: ```c
char *match_rating_codex(const char *str) {
  size_t len = strlen(str);
  size_t i, j;
  char c, prev;
  char *codex = malloc(7 * sizeof(char));
  if (!codex) {
    return NULL;
  }
  prev = '\0';
  for (i = 0, j = 0; i < len && j < 7; i++) {
    c = toupper(str[i]);
    if (c == ' ' || (i != 0 && (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U'))) {
      continue;
    }
    if (c == prev) {
      continue;
    }
    if (j == 6) {
      codex[3] = codex[4];
      codex[4] = codex[5];
      j = 5;
    }
    codex[j++] = c;
  }
  codex[j] = '\0';
  return codex;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<match_rating_codex>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r14
  call   <strlen@plt>
  mov    %rax,%r13
  mov    $0x7,%edi
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L57
  test   %r13,%r13
  je     L39
  mov    $0x0,%ebp
  mov    $0x0,%ebx
  mov    $0x5,%r15d
  jmp    L108
L11:
  test   %al,%al
  je     L109
L29:
  cmp    $0x6,%rbp
  je     L18
L111:
  mov    %al,(%r12,%rbp,1)
  lea    0x1(%rbp),%rbp
L109:
  add    $0x1,%rbx
  cmp    %rbx,%r13
  jbe    L56
  cmp    $0x6,%rbp
  ja     L56
L108:
  movsbl (%r14,%rbx,1),%edi
  call   <toupper@plt>
  cmp    $0x20,%al
  je     L109
  test   %rbx,%rbx
  je     L11
  lea    -0x41(%rax),%edx
  cmp    $0x14,%dl
  ja     L11
  mov    $0x104111,%ecx
  bt     %rdx,%rcx
  jae    L29
  jmp    L109
L18:
  movzbl 0x4(%r12),%edx
  mov    %dl,0x3(%r12)
  movzbl 0x5(%r12),%edx
  mov    %dl,0x4(%r12)
  mov    %r15,%rbp
  jmp    L111
L39:
  mov    %r13,%rbp
L56:
  movb   $0x0,(%r12,%rbp,1)
L57:
  mov    %r12,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
char *match_rating_codex(const char *str) {
  size_t len = strlen(str);
  size_t i, j;
  char c, prev;
  char *codex = malloc(7 * sizeof(char));
  if (!codex) {
    return NULL;
  }
  prev = '\0';
  for (i = 0, j = 0; i < len && j < 7; i++) {
    c = toupper(str[i]);
    if (c == ' ' || (i != 0 && (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U'))) {
      continue;
    }
    if (c == prev) {
      continue;
    }
    if (j == 6) {
      codex[3] = codex[4];
      codex[4] = codex[5];
      j = 5;
    }
    codex[j++] = c;
  }
  codex[j] = '\0';
  return codex;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<match_rating_codex>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  call   <strlen@plt>
  mov    $0x7,%edi
  mov    %rax,%r13
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L1
  test   %r13,%r13
  je     L48
  xor    %ebx,%ebx
  xor    %r14d,%r14d
  jmp    L71
  nopl   0x0(%rax)
L44:
  lea    -0x41(%rax),%edx
  cmp    $0x14,%dl
  ja     L112
  mov    $0x104111,%ecx
  bt     %rdx,%rcx
  jb     L107
L35:
  cmp    $0x6,%rbx
  je     L13
  mov    %rbx,%rdx
  add    $0x1,%rbx
L59:
  mov    %al,(%r12,%rdx,1)
L107:
  add    $0x1,%r14
  cmp    %r14,%r13
  je     L46
L71:
  movsbl 0x0(%rbp,%r14,1),%edi
  call   <toupper@plt>
  cmp    $0x20,%al
  je     L107
  test   %r14,%r14
  jne    L44
L112:
  test   %al,%al
  jne    L35
  add    $0x1,%r14
  cmp    %r14,%r13
  jne    L71
L46:
  add    %r12,%rbx
L85:
  movb   $0x0,(%rbx)
L1:
  pop    %rbx
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L13:
  movzbl 0x4(%r12),%edx
  mov    %dl,0x3(%r12)
  movzbl 0x5(%r12),%edx
  mov    %dl,0x4(%r12)
  mov    $0x5,%edx
  jmp    L59
  nopl   (%rax)
L48:
  mov    %rax,%rbx
  jmp    L85
```

assistant: ```c
char *match_rating_codex(const char *str) {
  size_t len = strlen(str);
  size_t i, j;
  char c, prev;
  char *codex = malloc(7 * sizeof(char));
  if (!codex) {
    return NULL;
  }
  prev = '\0';
  for (i = 0, j = 0; i < len && j < 7; i++) {
    c = toupper(str[i]);
    if (c == ' ' || (i != 0 && (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U'))) {
      continue;
    }
    if (c == prev) {
      continue;
    }
    if (j == 6) {
      codex[3] = codex[4];
      codex[4] = codex[5];
      j = 5;
    }
    codex[j++] = c;
  }
  codex[j] = '\0';
  return codex;
}
```