ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请将以下的汇编代码转换成C语言代码:

```asm
<main>:
  endbr64
  push   %rbp
  movss  D74(%rip),%xmm0
  lea    D88(%rip),%rdi
  lea    D102(%rip),%rbp
  call   <printf@plt>
  movss  D74(%rip),%xmm0
  lea    D84(%rip),%rdi
  call   <printf@plt>
  movss  D79(%rip),%xmm0
  mov    %rbp,%rdi
  call   <printf@plt>
  movss  D40(%rip),%xmm0
  mov    %rbp,%rdi
  call   <printf@plt>
  movss  D79(%rip),%xmm0
  lea    D117(%rip),%rdi
  call   <printf@plt>
  movss  D79(%rip),%xmm0
  lea    D116(%rip),%rdi
  call   <printf@plt>
  movss  D79(%rip),%xmm0
  lea    D82(%rip),%rdi
  call   <printf@plt>
  xor    %eax,%eax
  pop    %rbp
  ret
```

tool_calls: name: parse_data
arguments: data_tag: D74
type_guessed: byte[4]
name: parse_data
arguments: data_tag: D88
type_guessed: string
name: parse_data
arguments: data_tag: D102
type_guessed: string
name: parse_data
arguments: data_tag: D84
type_guessed: string
name: parse_data
arguments: data_tag: D79
type_guessed: f32
name: parse_data
arguments: data_tag: D40
type_guessed: byte[4]
name: parse_data
arguments: data_tag: D117
type_guessed: string
name: parse_data
arguments: data_tag: D116
type_guessed: string
name: parse_data
arguments: data_tag: D82
type_guessed: string

tool: {"D74": [0x00,0x00,0x40,0x41]}

tool: D88: i=%d


tool: D102: d=%d


tool: D84: i=%f


tool: D79: 1.2345678988888

tool: {"D40": [0x00,0x00,0x80,0x3f]}

tool: D117: d=%.15f


tool: D116: f=%f


tool: D82: f=%.15f


assistant: ```c
int main(void) {
  int i = 12.34;
  double d = 1.2345678988888;
  float f = 1.2345678988888;
  printf("i=%d\n", i);
  printf("i=%f\n", i);
  printf("d=%d\n", d);
  printf("d=%d\n", (int)d);
  printf("d=%.15f\n", d);
  printf("f=%f\n", f);
  printf("f=%.15f\n", f);
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<main>:
  endbr64
  push   %rbp
  movss  D43(%rip),%xmm0
  lea    D38(%rip),%rdi
  lea    D96(%rip),%rbp
  call   <printf@plt>
  movss  D43(%rip),%xmm0
  lea    D64(%rip),%rdi
  call   <printf@plt>
  movss  D74(%rip),%xmm0
  mov    %rbp,%rdi
  call   <printf@plt>
  movss  D71(%rip),%xmm0
  mov    %rbp,%rdi
  call   <printf@plt>
  movss  D74(%rip),%xmm0
  lea    D104(%rip),%rdi
  call   <printf@plt>
  movss  D74(%rip),%xmm0
  lea    D117(%rip),%rdi
  call   <printf@plt>
  movss  D74(%rip),%xmm0
  lea    D77(%rip),%rdi
  call   <printf@plt>
  xor    %eax,%eax
  pop    %rbp
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D43
type_guessed: byte[4]
name: unpack_data
arguments: data_label: D38
type_guessed: string
name: unpack_data
arguments: data_label: D96
type_guessed: string
name: unpack_data
arguments: data_label: D64
type_guessed: string
name: unpack_data
arguments: data_label: D74
type_guessed: f32
name: unpack_data
arguments: data_label: D71
type_guessed: byte[4]
name: unpack_data
arguments: data_label: D104
type_guessed: string
name: unpack_data
arguments: data_label: D117
type_guessed: string
name: unpack_data
arguments: data_label: D77
type_guessed: string

tool: {"D43": [0x00,0x00,0x40,0x41]}

tool: D38: i=%d


tool: D96: d=%d


tool: D64: i=%f


tool: D74: 1.2345678988888

tool: {"D71": [0x00,0x00,0x80,0x3f]}

tool: D104: d=%.15f


tool: D117: f=%f


tool: D77: f=%.15f


assistant: ```c
int main(void) {
  int i = 12.34;
  double d = 1.2345678988888;
  float f = 1.2345678988888;
  printf("i=%d\n", i);
  printf("i=%f\n", i);
  printf("d=%d\n", d);
  printf("d=%d\n", (int)d);
  printf("d=%.15f\n", d);
  printf("f=%f\n", f);
  printf("f=%.15f\n", f);
  return 0;
}
```
user: Translate the below assembly code into C programming language:

```asm
<sig_getdatafromfile>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %esi,-0xc(%rbp)
  mov    %rdx,-0x18(%rbp)
  cmpl   $0x7,-0xc(%rbp)
  ja     L35
  mov    $0x0,%eax
  jmp    L13
L35:
  mov    -0x8(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,%edi
  call   <ntohl@plt>
  mov    -0x18(%rbp),%rdx
  mov    %eax,(%rdx)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,%eax
  lea    0x8(%rax),%rdx
  mov    -0xc(%rbp),%eax
  cmp    %rax,%rdx
  jbe    L25
  mov    $0x0,%eax
  jmp    L13
L25:
  mov    -0x8(%rbp),%rax
  add    $0x4,%rax
L13:
  leave
  ret
```

assistant: ```c
char *sig_getdatafromfile(char *filedata, unsigned int filelen, unsigned int *datalen) {
  if (filelen < 8)
    return NULL;
  *datalen = ntohl(*(unsigned int *)filedata);
  if (sizeof(*datalen) + *datalen + sizeof(unsigned int) > filelen)
    return NULL;
  return filedata + sizeof(*datalen);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<sig_getdatafromfile>:
  endbr64
  mov    $0x0,%eax
  cmp    $0x7,%esi
  jbe    L9
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbp
  mov    %esi,%ebx
  mov    %rdx,%r12
  mov    (%rdi),%edi
  call   <ntohl@plt>
  mov    %eax,(%r12)
  mov    %eax,%eax
  add    $0x8,%rax
  mov    %ebx,%ebx
  add    $0x4,%rbp
  cmp    %rbx,%rax
  mov    $0x0,%eax
  cmovbe %rbp,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L9:
  ret
```

assistant: ```c
char *sig_getdatafromfile(char *filedata, unsigned int filelen, unsigned int *datalen) {
  if (filelen < 8)
    return NULL;
  *datalen = ntohl(*(unsigned int *)filedata);
  if (sizeof(*datalen) + *datalen + sizeof(unsigned int) > filelen)
    return NULL;
  return filedata + sizeof(*datalen);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<sig_getdatafromfile>:
  endbr64
  push   %r12
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  cmp    $0x7,%ebp
  jbe    L1
  mov    %rdi,%rbx
  mov    (%rdi),%edi
  mov    %rdx,%r12
  call   <ntohl@plt>
  mov    %eax,(%r12)
  mov    %eax,%eax
  add    $0x8,%rax
  cmp    %rbp,%rax
  ja     L1
  lea    0x4(%rbx),%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L1:
  pop    %rbx
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
char *sig_getdatafromfile(char *filedata, unsigned int filelen, unsigned int *datalen) {
  if (filelen < 8)
    return NULL;
  *datalen = ntohl(*(unsigned int *)filedata);
  if (sizeof(*datalen) + *datalen + sizeof(unsigned int) > filelen)
    return NULL;
  return filedata + sizeof(*datalen);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<sig_getdatafromfile>:
  endbr64
  push   %r12
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  cmp    $0x7,%ebp
  jbe    L3
  mov    %rdi,%rbx
  mov    (%rdi),%edi
  mov    %rdx,%r12
  call   <ntohl@plt>
  mov    %eax,(%r12)
  mov    %eax,%eax
  add    $0x8,%rax
  cmp    %rbp,%rax
  ja     L3
  lea    0x4(%rbx),%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L3:
  pop    %rbx
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
char *sig_getdatafromfile(char *filedata, unsigned int filelen, unsigned int *datalen) {
  if (filelen < 8)
    return NULL;
  *datalen = ntohl(*(unsigned int *)filedata);
  if (sizeof(*datalen) + *datalen + sizeof(unsigned int) > filelen)
    return NULL;
  return filedata + sizeof(*datalen);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<simplePNG_write>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %esi,-0x4c(%rbp)
  mov    %edx,-0x50(%rbp)
  mov    %rcx,-0x58(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x48(%rbp),%rax
  lea    D9(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <__simplePNG__sfopen@plt>
  mov    %rax,-0x38(%rbp)
  movl   $0x89,-0x30(%rbp)
  movl   $0x50,-0x2c(%rbp)
  movl   $0x4e,-0x28(%rbp)
  movl   $0x47,-0x24(%rbp)
  movl   $0xd,-0x20(%rbp)
  movl   $0xa,-0x1c(%rbp)
  movl   $0x1a,-0x18(%rbp)
  movl   $0xa,-0x14(%rbp)
  mov    -0x38(%rbp),%rdx
  lea    -0x30(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x8,%edx
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <fwrite@plt>
  mov    -0x58(%rbp),%rcx
  mov    -0x50(%rbp),%edx
  mov    -0x4c(%rbp),%esi
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <__simplePNG_write_IHDR@plt>
  mov    -0x58(%rbp),%rcx
  mov    -0x50(%rbp),%edx
  mov    -0x4c(%rbp),%esi
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <__simplePNG_write_IDAT@plt>
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <__simplePNG_write_IEND@plt>
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L2
  call   <__stack_chk_fail@plt>
L2:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D9
type_infered: string

tool: D9: wb

assistant: ```c
int simplePNG_write(char const *filename, uint32_t width, uint32_t height, uint8_t const *rgb_image) {
  FILE *f = __simplePNG__sfopen(filename, "wb");
  uint8_t png_header[8] = {0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a};
  fwrite(png_header, 1, 8, f);
  __simplePNG_write_IHDR(f, width, height, rgb_image);
  __simplePNG_write_IDAT(f, width, height, rgb_image);
  __simplePNG_write_IEND(f);
  fclose(f);
  return 0;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<simplePNG_write>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %esi,%ebp
  mov    %edx,%r12d
  mov    %rcx,%r13
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    D7(%rip),%rsi
  call   <__simplePNG__sfopen@plt>
  mov    %rax,%rbx
  movl   $0x89,(%rsp)
  movl   $0x50,0x4(%rsp)
  movl   $0x4e,0x8(%rsp)
  movl   $0x47,0xc(%rsp)
  movl   $0xd,0x10(%rsp)
  movl   $0xa,0x14(%rsp)
  movl   $0x1a,0x18(%rsp)
  movl   $0xa,0x1c(%rsp)
  mov    %rsp,%rdi
  mov    %rax,%rcx
  mov    $0x8,%edx
  mov    $0x1,%esi
  call   <fwrite@plt>
  mov    %r13,%rcx
  mov    %r12d,%edx
  mov    %ebp,%esi
  mov    %rbx,%rdi
  call   <__simplePNG_write_IHDR@plt>
  mov    %r13,%rcx
  mov    %r12d,%edx
  mov    %ebp,%esi
  mov    %rbx,%rdi
  call   <__simplePNG_write_IDAT@plt>
  mov    %rbx,%rdi
  call   <__simplePNG_write_IEND@plt>
  mov    %rbx,%rdi
  call   <fclose@plt>
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L2
  mov    $0x0,%eax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L2:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D7
type_guessed: string

tool: D7: wb

assistant: ```c
int simplePNG_write(char const *filename, uint32_t width, uint32_t height, uint8_t const *rgb_image) {
  FILE *f = __simplePNG__sfopen(filename, "wb");
  uint8_t png_header[8] = {0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a};
  fwrite(png_header, 1, 8, f);
  __simplePNG_write_IHDR(f, width, height, rgb_image);
  __simplePNG_write_IDAT(f, width, height, rgb_image);
  __simplePNG_write_IEND(f);
  fclose(f);
  return 0;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<simplePNG_write>:
  endbr64
  push   %r14
  mov    %rcx,%r14
  push   %r13
  mov    %edx,%r13d
  push   %r12
  mov    %esi,%r12d
  lea    D7(%rip),%rsi
  push   %rbp
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  call   <__simplePNG__sfopen@plt>
  mov    %rsp,%rdi
  mov    $0x8,%edx
  mov    $0x1,%esi
  mov    %rax,%rbp
  movabs $0x5000000089,%rax
  mov    %rax,(%rsp)
  mov    %rbp,%rcx
  movabs $0x470000004e,%rax
  mov    %rax,0x8(%rsp)
  movabs $0xa0000000d,%rax
  mov    %rax,0x10(%rsp)
  add    $0xd,%rax
  mov    %rax,0x18(%rsp)
  call   <fwrite@plt>
  mov    %r14,%rcx
  mov    %r13d,%edx
  mov    %r12d,%esi
  mov    %rbp,%rdi
  call   <__simplePNG_write_IHDR@plt>
  mov    %r14,%rcx
  mov    %r13d,%edx
  mov    %r12d,%esi
  mov    %rbp,%rdi
  call   <__simplePNG_write_IDAT@plt>
  mov    %rbp,%rdi
  call   <__simplePNG_write_IEND@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L1
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L1:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: label: D7
type_infered: string

tool: D7: wb

assistant: ```c
int simplePNG_write(char const *filename, uint32_t width, uint32_t height, uint8_t const *rgb_image) {
  FILE *f = __simplePNG__sfopen(filename, "wb");
  uint8_t png_header[8] = {0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a};
  fwrite(png_header, 1, 8, f);
  __simplePNG_write_IHDR(f, width, height, rgb_image);
  __simplePNG_write_IDAT(f, width, height, rgb_image);
  __simplePNG_write_IEND(f);
  fclose(f);
  return 0;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<simplePNG_write>:
  endbr64
  push   %r14
  mov    %rcx,%r14
  push   %r13
  mov    %edx,%r13d
  push   %r12
  mov    %esi,%r12d
  lea    D18(%rip),%rsi
  push   %rbp
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  call   <__simplePNG__sfopen@plt>
  movdqa D15(%rip),%xmm0
  mov    %rsp,%rdi
  mov    $0x8,%edx
  mov    %rax,%rbp
  mov    %rax,%rcx
  mov    $0x1,%esi
  movaps %xmm0,(%rsp)
  movdqa D8(%rip),%xmm0
  movaps %xmm0,0x10(%rsp)
  call   <fwrite@plt>
  mov    %r14,%rcx
  mov    %r13d,%edx
  mov    %r12d,%esi
  mov    %rbp,%rdi
  call   <__simplePNG_write_IHDR@plt>
  mov    %r14,%rcx
  mov    %r13d,%edx
  mov    %r12d,%esi
  mov    %rbp,%rdi
  call   <__simplePNG_write_IDAT@plt>
  mov    %rbp,%rdi
  call   <__simplePNG_write_IEND@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L4
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L4:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_tag: D18
type: string
name: retrieve_data
arguments: data_tag: D15
type: byte[16]
name: retrieve_data
arguments: data_tag: D8
type: byte[16]

tool: D18: wb

tool: {"D15": [0x89,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x4e,0x00,0x00,0x00,0x47,0x00,0x00,0x00]}

tool: {"D8": [0x0d,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x1a,0x00,0x00,0x00,0x0a,0x00,0x00,0x00]}

assistant: ```c
int simplePNG_write(char const *filename, uint32_t width, uint32_t height, uint8_t const *rgb_image) {
  FILE *f = __simplePNG__sfopen(filename, "wb");
  uint8_t png_header[8] = {0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a};
  fwrite(png_header, 1, 8, f);
  __simplePNG_write_IHDR(f, width, height, rgb_image);
  __simplePNG_write_IDAT(f, width, height, rgb_image);
  __simplePNG_write_IEND(f);
  fclose(f);
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<select_sort>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L46
L17:
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x10(%rbp),%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x10(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x4(%rbp)
  jmp    L10
L9:
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0xc(%rbp)
  jle    L47
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x4(%rbp),%eax
  mov    %eax,-0x8(%rbp)
L47:
  addl   $0x1,-0x4(%rbp)
L10:
  mov    -0x4(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L9
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    -0x8(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x18(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0xc(%rbp),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x10(%rbp)
L46:
  mov    -0x10(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L17
  nop
  nop
  pop    %rbp
  ret
```

assistant: ```c
void select_sort(int *a, int a_len) {
  for (int i = 0; i < a_len; i++) {
    int min = a[i];
    int min_pos = i;
    for (int j = i + 1; j < a_len; j++) {
      if (a[j] < min) {
        min = a[j];
        min_pos = j;
      }
    }
    a[min_pos] = a[i];
    a[i] = min;
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<select_sort>:
  endbr64
  test   %esi,%esi
  jle    L53
  push   %rbp
  push   %rbx
  lea    -0x1(%rsi),%ebp
  mov    %ebp,%ebx
  mov    $0x0,%r9d
  jmp    L32
L34:
  add    $0x1,%rax
  cmp    %eax,%esi
  jle    L58
L19:
  mov    (%rdi,%rax,4),%edx
  cmp    %ecx,%edx
  jge    L34
  mov    %eax,%r8d
  mov    %edx,%ecx
  jmp    L34
L17:
  movslq %ebp,%rbp
  mov    %r10d,(%rdi,%rbp,4)
  mov    %r10d,(%rdi,%rbx,4)
  pop    %rbx
  pop    %rbp
  ret
L58:
  movslq %r8d,%r8
  mov    %r10d,(%rdi,%r8,4)
  mov    %ecx,(%rdi,%r9,4)
  mov    %r11,%r9
L32:
  mov    %r9d,%r8d
  mov    (%rdi,%r9,4),%r10d
  cmp    %rbx,%r9
  je     L17
  lea    0x1(%r9),%r11
  mov    %r11,%rax
  mov    %r10d,%ecx
  jmp    L19
L53:
  ret
```

assistant: ```c
void select_sort(int *a, int a_len) {
  for (int i = 0; i < a_len; i++) {
    int min = a[i];
    int min_pos = i;
    for (int j = i + 1; j < a_len; j++) {
      if (a[j] < min) {
        min = a[j];
        min_pos = j;
      }
    }
    a[min_pos] = a[i];
    a[i] = min;
  }
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<select_sort>:
  endbr64
  test   %esi,%esi
  jle    L7
  xor    %r9d,%r9d
  push   %rbx
  lea    -0x1(%rsi),%ebx
  mov    (%rdi,%r9,4),%r10d
  movslq %r9d,%r8
  cmp    %rbx,%r9
  je     L8
  nopl   0x0(%rax,%rax,1)
L35:
  lea    0x1(%r9),%r11
  mov    %r10d,%ecx
  mov    %r11,%rax
  nopw   0x0(%rax,%rax,1)
L41:
  mov    (%rdi,%rax,4),%edx
  cmp    %ecx,%edx
  jge    L45
  movslq %eax,%r8
  mov    %edx,%ecx
L45:
  add    $0x1,%rax
  cmp    %eax,%esi
  jg     L41
  mov    %r10d,(%rdi,%r8,4)
  mov    %ecx,(%rdi,%r9,4)
  mov    %r11,%r9
  mov    (%rdi,%r9,4),%r10d
  movslq %r9d,%r8
  cmp    %rbx,%r9
  jne    L35
L8:
  pop    %rbx
  ret
L7:
  ret
```

assistant: ```c
void select_sort(int *a, int a_len) {
  for (int i = 0; i < a_len; i++) {
    int min = a[i];
    int min_pos = i;
    for (int j = i + 1; j < a_len; j++) {
      if (a[j] < min) {
        min = a[j];
        min_pos = j;
      }
    }
    a[min_pos] = a[i];
    a[i] = min;
  }
}
```
user: What is the c source code of the assembly code below?

```asm
<select_sort>:
  endbr64
  test   %esi,%esi
  jle    L22
  mov    (%rdi),%r10d
  movslq %esi,%r11
  mov    $0x1,%r9d
  cmp    $0x1,%esi
  je     L22
  nopl   0x0(%rax)
L21:
  lea    -0x1(%r9),%r8d
  mov    %r9,%rax
  mov    %r10d,%ecx
  nopw   0x0(%rax,%rax,1)
L20:
  mov    (%rdi,%rax,4),%edx
  cmp    %edx,%ecx
  jle    L12
  mov    %eax,%r8d
  mov    %edx,%ecx
L12:
  add    $0x1,%rax
  cmp    %eax,%esi
  jg     L20
  movslq %r8d,%r8
  mov    %r10d,(%rdi,%r8,4)
  mov    (%rdi,%r9,4),%r10d
  mov    %ecx,-0x4(%rdi,%r9,4)
  add    $0x1,%r9
  cmp    %r11,%r9
  jne    L21
L22:
  ret
```

assistant: ```c
void select_sort(int *a, int a_len) {
  for (int i = 0; i < a_len; i++) {
    int min = a[i];
    int min_pos = i;
    for (int j = i + 1; j < a_len; j++) {
      if (a[j] < min) {
        min = a[j];
        min_pos = j;
      }
    }
    a[min_pos] = a[i];
    a[i] = min;
  }
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<_pico_stristr>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,-0x8(%rbp)
  jmp    L49
L41:
  mov    -0x8(%rbp),%rdx
  mov    -0x20(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncasecmp@plt>
  test   %eax,%eax
  je     L5
  addq   $0x1,-0x18(%rbp)
L49:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L41
  jmp    L15
L5:
  nop
L15:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L43
  movq   $0x0,-0x18(%rbp)
L43:
  mov    -0x18(%rbp),%rax
  leave
  ret
```

assistant: ```c
char *_pico_stristr(char *str, const char *substr) {
  const size_t sublen = strlen(substr);
  while (*str) {
    if (!strncasecmp(str, substr, sublen))
      break;
    str++;
  }
  if (!(*str))
    str = NULL;
  return str;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<_pico_stristr>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  mov    %rsi,%r12
  mov    %rsi,%rdi
  call   <strlen@plt>
  mov    %rax,%r13
  movzbl (%rbx),%ebp
  test   %bpl,%bpl
  je     L10
L37:
  mov    %r13,%rdx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <strncasecmp@plt>
  test   %eax,%eax
  je     L11
  add    $0x1,%rbx
  movzbl (%rbx),%ebp
  test   %bpl,%bpl
  jne    L37
  mov    $0x0,%ebx
  jmp    L2
L11:
  test   %bpl,%bpl
  mov    $0x0,%eax
  cmove  %rax,%rbx
L2:
  mov    %rbx,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L10:
  mov    $0x0,%ebx
  jmp    L2
```

assistant: ```c
char *_pico_stristr(char *str, const char *substr) {
  const size_t sublen = strlen(substr);
  while (*str) {
    if (!strncasecmp(str, substr, sublen))
      break;
    str++;
  }
  if (!(*str))
    str = NULL;
  return str;
}
```
user: Translate the below assembly code into C programming language:

```asm
<_pico_stristr>:
  endbr64
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    %rsi,%rdi
  call   <strlen@plt>
  cmpb   $0x0,(%rbx)
  je     L2
  mov    %rax,%r12
  jmp    L6
L29:
  add    $0x1,%rbx
  cmpb   $0x0,(%rbx)
  je     L2
L6:
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <strncasecmp@plt>
  test   %eax,%eax
  jne    L29
  mov    %rbx,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L2:
  pop    %rbx
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
char *_pico_stristr(char *str, const char *substr) {
  const size_t sublen = strlen(substr);
  while (*str) {
    if (!strncasecmp(str, substr, sublen))
      break;
    str++;
  }
  if (!(*str))
    str = NULL;
  return str;
}
```
user: Translate the below assembly code into C programming language:

```asm
<_pico_stristr>:
  endbr64
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    %rsi,%rdi
  call   <strlen@plt>
  cmpb   $0x0,(%rbx)
  je     L27
  mov    %rax,%r12
  jmp    L39
L18:
  add    $0x1,%rbx
  cmpb   $0x0,(%rbx)
  je     L27
L39:
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <strncasecmp@plt>
  test   %eax,%eax
  jne    L18
  mov    %rbx,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L27:
  pop    %rbx
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
char *_pico_stristr(char *str, const char *substr) {
  const size_t sublen = strlen(substr);
  while (*str) {
    if (!strncasecmp(str, substr, sublen))
      break;
    str++;
  }
  if (!(*str))
    str = NULL;
  return str;
}
```