ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<main01>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x200,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x1f8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rdi
  mov    $0x32,%ecx
  rep stos %rax,%es:(%rdi)
  lea    D14(%rip),%rsi
  lea    D15(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%r12
  mov    $0x0,%ebx
  lea    0x190(%rsp),%rbp
  jmp    L14
L48:
  mov    $0x64,%edx
  mov    $0x0,%esi
  mov    %rbp,%rdi
  call   <memset@plt>
  mov    %r12,%rdx
  mov    $0x64,%esi
  mov    %rbp,%rdi
  call   <fgets@plt>
  mov    %rbp,%rdi
  call   <atoi@plt>
  mov    %eax,(%rsp,%rbx,4)
  add    $0x1,%rbx
L14:
  mov    %r12,%rdi
  call   <feof@plt>
  test   %eax,%eax
  je     L48
  mov    %r12,%rdi
  call   <fclose@plt>
  mov    %rsp,%rdi
  mov    %ebx,%esi
  call   <pupple@plt>
  lea    D45(%rip),%rsi
  lea    D11(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%r12
  test   %ebx,%ebx
  jle    L33
  mov    %rsp,%rbp
  lea    -0x1(%rbx),%eax
  lea    0x4(%rsp,%rax,4),%r14
  lea    D7(%rip),%r13
L1:
  lea    0x190(%rsp),%rbx
  mov    $0x64,%edx
  mov    $0x0,%esi
  mov    %rbx,%rdi
  call   <memset@plt>
  mov    0x0(%rbp),%edx
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <sprintf@plt>
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <fputs@plt>
  add    $0x4,%rbp
  cmp    %r14,%rbp
  jne    L1
L33:
  mov    %r12,%rdi
  call   <fclose@plt>
  mov    0x1f8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L43
  mov    $0x0,%eax
  add    $0x200,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L43:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D14
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D15
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D45
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D11
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D7
type_infered: string

tool: D14: r

tool: D15: D:\temp\a.txt

tool: D45: w

tool: D11: D:\temp\b.txt

tool: D7: %d


assistant: ```c
int main01(void) {
  int index = 0;
  int array[100] = {0};
  char buf[100];
  FILE *p = fopen("D:\\temp\\a.txt", "r");
  while (!feof(p)) {
    memset(buf, 0, sizeof(buf));
    fgets(buf, sizeof(buf), p);
    array[index] = atoi(buf);
    index++;
  }
  fclose(p);
  pupple(array, index);
  p = fopen("D:\\temp\\b.txt", "w");
  int i;
  for (i = 0; i < index; i++) {
    memset(buf, 0, sizeof(buf));
    sprintf(buf, "%d\n", array[i]);
    fputs(buf, p);
  }
  fclose(p);
  return 0;
}
```
user: Translate the below assembly code into C programming language:

```asm
<main01>:
  endbr64
  push   %r14
  mov    $0x32,%ecx
  lea    D11(%rip),%rsi
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x200,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x1f8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbp
  lea    0x190(%rsp),%r12
  mov    %rbp,%rdi
  rep stos %rax,%es:(%rdi)
  lea    D14(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%r13
  jmp    L45
  cs nopw 0x0(%rax,%rax,1)
L40:
  mov    $0x64,%edx
  xor    %esi,%esi
  mov    %r12,%rdi
  call   <memset@plt>
  mov    %r13,%rdx
  mov    $0x64,%esi
  mov    %r12,%rdi
  call   <fgets@plt>
  mov    %r12,%rdi
  call   <atoi@plt>
  mov    %eax,0x0(%rbp,%rbx,4)
  add    $0x1,%rbx
L45:
  mov    %r13,%rdi
  mov    %ebx,%r14d
  call   <feof@plt>
  test   %eax,%eax
  je     L40
  mov    %r13,%rdi
  call   <fclose@plt>
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <pupple@plt>
  lea    D33(%rip),%rsi
  lea    D16(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%r12
  test   %ebx,%ebx
  je     L17
  lea    -0x1(%r14),%eax
  mov    %rbp,%rbx
  lea    D24(%rip),%r13
  lea    0x4(%rsp,%rax,4),%r14
  lea    0x190(%rsp),%rbp
  nopl   (%rax)
L39:
  mov    $0x64,%edx
  xor    %esi,%esi
  mov    %rbp,%rdi
  add    $0x4,%rbx
  call   <memset@plt>
  mov    -0x4(%rbx),%edx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <fputs@plt>
  cmp    %r14,%rbx
  jne    L39
L17:
  mov    %r12,%rdi
  call   <fclose@plt>
  mov    0x1f8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L3
  add    $0x200,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L3:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: label: D11
type_guessed: string
name: parse_data
arguments: label: D14
type_guessed: string
name: parse_data
arguments: label: D33
type_guessed: string
name: parse_data
arguments: label: D16
type_guessed: string
name: parse_data
arguments: label: D24
type_guessed: string

tool: D11: r

tool: D14: D:\temp\a.txt

tool: D33: w

tool: D16: D:\temp\b.txt

tool: D24: %d


assistant: ```c
int main01(void) {
  int index = 0;
  int array[100] = {0};
  char buf[100];
  FILE *p = fopen("D:\\temp\\a.txt", "r");
  while (!feof(p)) {
    memset(buf, 0, sizeof(buf));
    fgets(buf, sizeof(buf), p);
    array[index] = atoi(buf);
    index++;
  }
  fclose(p);
  pupple(array, index);
  p = fopen("D:\\temp\\b.txt", "w");
  int i;
  for (i = 0; i < index; i++) {
    memset(buf, 0, sizeof(buf));
    sprintf(buf, "%d\n", array[i]);
    fputs(buf, p);
  }
  fclose(p);
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<main01>:
  endbr64
  push   %r14
  mov    $0x32,%ecx
  lea    D2(%rip),%rsi
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x200,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x1f8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbp
  lea    0x190(%rsp),%r12
  mov    %rbp,%rdi
  rep stos %rax,%es:(%rdi)
  lea    D40(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%r13
  jmp    L31
  cs nopw 0x0(%rax,%rax,1)
L23:
  mov    $0x64,%edx
  xor    %esi,%esi
  mov    %r12,%rdi
  call   <memset@plt>
  mov    %r13,%rdx
  mov    $0x64,%esi
  mov    %r12,%rdi
  call   <fgets@plt>
  mov    %r12,%rdi
  call   <atoi@plt>
  mov    %eax,0x0(%rbp,%rbx,4)
  add    $0x1,%rbx
L31:
  mov    %r13,%rdi
  mov    %ebx,%r14d
  call   <feof@plt>
  test   %eax,%eax
  je     L23
  mov    %r13,%rdi
  call   <fclose@plt>
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <pupple@plt>
  lea    D47(%rip),%rsi
  lea    D16(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%r12
  test   %ebx,%ebx
  je     L36
  lea    -0x1(%r14),%eax
  mov    %rbp,%rbx
  lea    D21(%rip),%r13
  lea    0x4(%rsp,%rax,4),%r14
  lea    0x190(%rsp),%rbp
  nopl   (%rax)
L12:
  mov    $0x64,%edx
  xor    %esi,%esi
  mov    %rbp,%rdi
  add    $0x4,%rbx
  call   <memset@plt>
  mov    -0x4(%rbx),%edx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <fputs@plt>
  cmp    %r14,%rbx
  jne    L12
L36:
  mov    %r12,%rdi
  call   <fclose@plt>
  mov    0x1f8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  add    $0x200,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L0:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D2
type: string
name: disassemble_data
arguments: data_tag: D40
type: string
name: disassemble_data
arguments: data_tag: D47
type: string
name: disassemble_data
arguments: data_tag: D16
type: string
name: disassemble_data
arguments: data_tag: D21
type: string

tool: D2: r

tool: D40: D:\temp\a.txt

tool: D47: w

tool: D16: D:\temp\b.txt

tool: D21: %d


assistant: ```c
int main01(void) {
  int index = 0;
  int array[100] = {0};
  char buf[100];
  FILE *p = fopen("D:\\temp\\a.txt", "r");
  while (!feof(p)) {
    memset(buf, 0, sizeof(buf));
    fgets(buf, sizeof(buf), p);
    array[index] = atoi(buf);
    index++;
  }
  fclose(p);
  pupple(array, index);
  p = fopen("D:\\temp\\b.txt", "w");
  int i;
  for (i = 0; i < index; i++) {
    memset(buf, 0, sizeof(buf));
    sprintf(buf, "%d\n", array[i]);
    fputs(buf, p);
  }
  fclose(p);
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<memset>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  andl   $0xff,-0x1c(%rbp)
  jmp    L11
L12:
  mov    -0x1c(%rbp),%eax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  mov    %dl,(%rax)
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x8(%rbp)
L11:
  mov    -0x28(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  test   %rax,%rax
  jne    L12
  mov    -0x18(%rbp),%rax
  pop    %rbp
  ret
```

assistant: ```c
void *memset(void *p, int c, size_t n) {
  char *src = p;
  c = (c & 0xff);
  while (n--) {
    *src = c;
    *src++;
  }
  return (p);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<memset>:
  endbr64
  mov    %rdi,%rax
  test   %rdx,%rdx
  je     L9
  add    %rdi,%rdx
  mov    %rdi,%rcx
L3:
  mov    %sil,(%rcx)
  add    $0x1,%rcx
  cmp    %rcx,%rdx
  jne    L3
L9:
  ret
```

assistant: ```c
void *memset(void *p, int c, size_t n) {
  char *src = p;
  c = (c & 0xff);
  while (n--) {
    *src = c;
    *src++;
  }
  return (p);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<memset>:
  endbr64
  test   %rdx,%rdx
  je     L3
  sub    $0x8,%rsp
  movsbl %sil,%esi
  call   <memset@plt>
  add    $0x8,%rsp
  ret
  nopl   0x0(%rax,%rax,1)
L3:
  mov    %rdi,%rax
  ret
```

assistant: ```c
void *memset(void *p, int c, size_t n) {
  char *src = p;
  c = (c & 0xff);
  while (n--) {
    *src = c;
    *src++;
  }
  return (p);
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<memset>:
  endbr64
  test   %rdx,%rdx
  je     L0
  sub    $0x8,%rsp
  movsbl %sil,%esi
  call   <memset@plt>
  add    $0x8,%rsp
  ret
  nopl   0x0(%rax,%rax,1)
L0:
  mov    %rdi,%rax
  ret
```

assistant: ```c
void *memset(void *p, int c, size_t n) {
  char *src = p;
  c = (c & 0xff);
  while (n--) {
    *src = c;
    *src++;
  }
  return (p);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<print_usage_panel>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D3(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D20(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D37(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  nop
  pop    %rbp
  ret
```

tool_calls: name: parse_data
arguments: label: D9
type: string
name: parse_data
arguments: label: D3
type: string
name: parse_data
arguments: label: D20
type: string
name: parse_data
arguments: label: D37
type: string

tool: D9: usage: input_test [option]


tool: D3:   eg. ./panel_test key  


tool: D20:       ./panel_test vfd  


tool: D37:       ./panel_test all  


assistant: ```c
void print_usage_panel() {
  printf("usage: input_test [option]\n");
  printf("  eg. ./panel_test key  \n");
  printf("      ./panel_test vfd  \n");
  printf("      ./panel_test all  \n");
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<print_usage_panel>:
  endbr64
  sub    $0x8,%rsp
  lea    D18(%rip),%rdi
  call   <printf@plt>
  lea    D35(%rip),%rdi
  call   <printf@plt>
  lea    D39(%rip),%rdi
  call   <printf@plt>
  lea    D31(%rip),%rdi
  call   <printf@plt>
  add    $0x8,%rsp
  ret
```

tool_calls: name: read_data
arguments: data_tag: D18
type_guessed: string
name: read_data
arguments: data_tag: D35
type_guessed: string
name: read_data
arguments: data_tag: D39
type_guessed: string
name: read_data
arguments: data_tag: D31
type_guessed: string

tool: D18: usage: input_test [option]


tool: D35:   eg. ./panel_test key  


tool: D39:       ./panel_test vfd  


tool: D31:       ./panel_test all  


assistant: ```c
void print_usage_panel() {
  printf("usage: input_test [option]\n");
  printf("  eg. ./panel_test key  \n");
  printf("      ./panel_test vfd  \n");
  printf("      ./panel_test all  \n");
}
```
user: Translate the below assembly code into C programming language:

```asm
<print_usage_panel>:
  endbr64
  sub    $0x8,%rsp
  lea    D20(%rip),%rdi
  call   <printf@plt>
  lea    D11(%rip),%rdi
  call   <printf@plt>
  lea    D26(%rip),%rdi
  call   <printf@plt>
  lea    D22(%rip),%rdi
  add    $0x8,%rsp
  jmp    1050 <printf@plt>
```

tool_calls: name: read_data
arguments: tag: D20
type: string
name: read_data
arguments: tag: D11
type: string
name: read_data
arguments: tag: D26
type: string
name: read_data
arguments: tag: D22
type: string

tool: D20: usage: input_test [option]


tool: D11:   eg. ./panel_test key  


tool: D26:       ./panel_test vfd  


tool: D22:       ./panel_test all  


assistant: ```c
void print_usage_panel() {
  printf("usage: input_test [option]\n");
  printf("  eg. ./panel_test key  \n");
  printf("      ./panel_test vfd  \n");
  printf("      ./panel_test all  \n");
}
```
user: What is the c source code of the assembly code below:

```asm
<print_usage_panel>:
  endbr64
  sub    $0x8,%rsp
  lea    D17(%rip),%rdi
  call   <printf@plt>
  lea    D22(%rip),%rdi
  call   <printf@plt>
  lea    D35(%rip),%rdi
  call   <printf@plt>
  lea    D4(%rip),%rdi
  add    $0x8,%rsp
  jmp    1050 <printf@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D17
type_guessed: string
name: extract_symbolic_data
arguments: tag: D22
type_guessed: string
name: extract_symbolic_data
arguments: tag: D35
type_guessed: string
name: extract_symbolic_data
arguments: tag: D4
type_guessed: string

tool: D17: usage: input_test [option]


tool: D22:   eg. ./panel_test key  


tool: D35:       ./panel_test vfd  


tool: D4:       ./panel_test all  


assistant: ```c
void print_usage_panel() {
  printf("usage: input_test [option]\n");
  printf("  eg. ./panel_test key  \n");
  printf("      ./panel_test vfd  \n");
  printf("      ./panel_test all  \n");
}
```
user: Translate the below assembly code into C programming language:

```asm
<clamp_to>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  movss  %xmm0,-0x4(%rbp)
  movss  %xmm1,-0x8(%rbp)
  movss  %xmm2,-0xc(%rbp)
  movss  -0x8(%rbp),%xmm0
  comiss -0x4(%rbp),%xmm0
  jbe    L23
  movss  -0x8(%rbp),%xmm0
  jmp    L35
L23:
  movss  -0x4(%rbp),%xmm0
  comiss -0xc(%rbp),%xmm0
  jbe    L3
  movss  -0xc(%rbp),%xmm0
  jmp    L35
L3:
  movss  -0x4(%rbp),%xmm0
L35:
  pop    %rbp
  ret
```

assistant: ```c
float clamp_to(float value, float min, float max) {
  if (value < min)
    return min;
  if (value > max)
    return max;
  return value;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<clamp_to>:
  endbr64
  comiss %xmm0,%xmm1
  ja     L8
  minss  %xmm0,%xmm2
  movaps %xmm2,%xmm0
  ret
L8:
  movaps %xmm1,%xmm0
  ret
```

assistant: ```c
float clamp_to(float value, float min, float max) {
  if (value < min)
    return min;
  if (value > max)
    return max;
  return value;
}
```
user: What is the c source code of the assembly code below:

```asm
<clamp_to>:
  endbr64
  comiss %xmm0,%xmm1
  ja     L7
  minss  %xmm0,%xmm2
  movaps %xmm2,%xmm0
  ret
  nopl   0x0(%rax)
L7:
  movaps %xmm1,%xmm0
  ret
```

assistant: ```c
float clamp_to(float value, float min, float max) {
  if (value < min)
    return min;
  if (value > max)
    return max;
  return value;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<clamp_to>:
  endbr64
  comiss %xmm0,%xmm1
  ja     L9
  minss  %xmm0,%xmm2
  movaps %xmm2,%xmm0
  ret
  nopl   0x0(%rax)
L9:
  movaps %xmm1,%xmm0
  ret
```

assistant: ```c
float clamp_to(float value, float min, float max) {
  if (value < min)
    return min;
  if (value > max)
    return max;
  return value;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<get_integer>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  mov    -0x10(%rbp),%rcx
  mov    -0x4(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <write@plt>
  mov    -0x4(%rbp),%eax
  mov    $0x3ff,%edx
  lea    D12(%rip),%rcx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <read@plt>
  lea    D12(%rip),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  leave
  ret
```

assistant: ```c
int get_integer(int SD, char *request) {
  static char output[1024];
  write(SD, request, strlen(request));
  read(SD, output, 1024 - 1);
  return atoi(output);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<get_integer>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%ebx
  mov    %rsi,%rbp
  mov    %rsi,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  mov    %rbp,%rsi
  mov    %ebx,%edi
  call   <write@plt>
  mov    $0x3ff,%edx
  lea    D7(%rip),%rbp
  mov    %rbp,%rsi
  mov    %ebx,%edi
  call   <read@plt>
  mov    %rbp,%rdi
  call   <atoi@plt>
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
int get_integer(int SD, char *request) {
  static char output[1024];
  write(SD, request, strlen(request));
  read(SD, output, 1024 - 1);
  return atoi(output);
}
```
user: Translate the below assembly code into C programming language:

```asm
<get_integer>:
  endbr64
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %edi,%ebp
  mov    %rsi,%rdi
  sub    $0x8,%rsp
  call   <strlen@plt>
  mov    %r12,%rsi
  mov    %ebp,%edi
  lea    D1(%rip),%r12
  mov    %eax,%edx
  call   <write@plt>
  mov    %ebp,%edi
  mov    %r12,%rsi
  mov    $0x3ff,%edx
  call   <read@plt>
  add    $0x8,%rsp
  mov    %r12,%rdi
  pop    %rbp
  pop    %r12
  jmp    10b0 <atoi@plt>
```

assistant: ```c
int get_integer(int SD, char *request) {
  static char output[1024];
  write(SD, request, strlen(request));
  read(SD, output, 1024 - 1);
  return atoi(output);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<get_integer>:
  endbr64
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %edi,%ebp
  mov    %rsi,%rdi
  sub    $0x8,%rsp
  call   <strlen@plt>
  mov    %r12,%rsi
  mov    %ebp,%edi
  lea    D4(%rip),%r12
  mov    %eax,%edx
  call   <write@plt>
  mov    %ebp,%edi
  mov    %r12,%rsi
  mov    $0x3ff,%edx
  call   <read@plt>
  add    $0x8,%rsp
  mov    %r12,%rdi
  pop    %rbp
  pop    %r12
  jmp    10b0 <atoi@plt>
```

assistant: ```c
int get_integer(int SD, char *request) {
  static char output[1024];
  write(SD, request, strlen(request));
  read(SD, output, 1024 - 1);
  return atoi(output);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<get_test_ids>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %esi,-0x28(%rbp)
  mov    %rdx,-0x30(%rbp)
  mov    -0x24(%rbp),%eax
  sub    -0x28(%rbp),%eax
  mov    %eax,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x14(%rbp)
  jmp    L54
L31:
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movl   $0xffffffff,(%rax)
  addl   $0x1,-0x14(%rbp)
L54:
  mov    -0x14(%rbp),%eax
  cmp    -0xc(%rbp),%eax
  jl     L31
  movl   $0x0,-0x10(%rbp)
  movl   $0x0,-0x14(%rbp)
  jmp    L28
L11:
  mov    -0x28(%rbp),%edx
  mov    -0x30(%rbp),%rcx
  mov    -0x14(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <exist_in_list@plt>
  test   %eax,%eax
  jne    L22
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  mov    -0x14(%rbp),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x10(%rbp)
L22:
  addl   $0x1,-0x14(%rbp)
L28:
  mov    -0x14(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L11
  movl   $0x0,-0x14(%rbp)
  jmp    L56
L29:
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  not    %eax
  shr    $0x1f,%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  addl   $0x1,-0x14(%rbp)
L56:
  mov    -0x14(%rbp),%eax
  cmp    -0xc(%rbp),%eax
  jl     L29
  mov    -0x8(%rbp),%rax
  leave
  ret
```

assistant: ```c
int *get_test_ids(int k, int k_train, int *train_ids) {
  int k_test = k - k_train;
  int *test_ids = (int *)malloc(k_test * sizeof(int));
  int i;
  for (i = 0; i < k_test; i++)
    test_ids[i] = -1;
  int t = 0;
  for (i = 0; i < k; i++) {
    if (!exist_in_list(i, train_ids, k_train)) {
      test_ids[t] = i;
      t++;
    }
  }
  for (i = 0; i < k_test; i++)
    assert(test_ids[i] >= 0);
  return test_ids;
}
```
user: What is the c source code of the assembly code below?

```asm
<get_test_ids>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %edi,%ebp
  mov    %esi,%r14d
  mov    %rdx,0x8(%rsp)
  mov    %edi,%r13d
  sub    %esi,%r13d
  lea    0x0(,%r13,4),%edi
  call   <malloc@plt>
  mov    %rax,%r15
  test   %r13d,%r13d
  jle    L72
  mov    %r13d,%edx
  lea    (%rax,%rdx,4),%rdx
L0:
  movl   $0xffffffff,(%rax)
  add    $0x4,%rax
  cmp    %rax,%rdx
  jne    L0
  test   %ebp,%ebp
  jle    L28
L103:
  mov    $0x0,%r12d
  mov    $0x0,%ebx
  jmp    L106
L49:
  add    $0x1,%ebx
  cmp    %ebx,%ebp
  jle    L93
L106:
  mov    %r14d,%edx
  mov    0x8(%rsp),%rsi
  mov    %ebx,%edi
  call   <exist_in_list@plt>
  test   %eax,%eax
  jne    L49
  movslq %r12d,%rax
  mov    %ebx,(%r15,%rax,4)
  add    $0x1,%r12d
  jmp    L49
L93:
  test   %r13d,%r13d
  jle    L55
L28:
  mov    %r15,%rbp
  mov    $0x0,%ebx
L27:
  mov    0x0(%rbp),%edi
  not    %edi
  shr    $0x1f,%edi
  call   <assert@plt>
  add    $0x1,%ebx
  add    $0x4,%rbp
  cmp    %ebx,%r13d
  jg     L27
L55:
  mov    %r15,%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L72:
  test   %ebp,%ebp
  jg     L103
  jmp    L55
```

assistant: ```c
int *get_test_ids(int k, int k_train, int *train_ids) {
  int k_test = k - k_train;
  int *test_ids = (int *)malloc(k_test * sizeof(int));
  int i;
  for (i = 0; i < k_test; i++)
    test_ids[i] = -1;
  int t = 0;
  for (i = 0; i < k; i++) {
    if (!exist_in_list(i, train_ids, k_train)) {
      test_ids[t] = i;
      t++;
    }
  }
  for (i = 0; i < k_test; i++)
    assert(test_ids[i] >= 0);
  return test_ids;
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<get_test_ids>:
  endbr64
  push   %r15
  mov    %rdx,%r15
  push   %r14
  mov    %esi,%r14d
  push   %r13
  push   %r12
  mov    %edi,%r12d
  push   %rbp
  sub    %esi,%r12d
  push   %rbx
  mov    %edi,%ebx
  lea    0x0(,%r12,4),%edi
  sub    $0x18,%rsp
  call   <malloc@plt>
  mov    %rax,0x8(%rsp)
  test   %r12d,%r12d
  jle    L24
  movslq %r12d,%rbp
  mov    $0xff,%esi
  mov    %rax,%rdi
  lea    0x0(,%rbp,4),%rdx
  call   <memset@plt>
  test   %ebx,%ebx
  jle    L46
L45:
  xor    %ebp,%ebp
  xor    %r13d,%r13d
  nopl   0x0(%rax)
L56:
  mov    %r14d,%edx
  mov    %r15,%rsi
  mov    %r13d,%edi
  call   <exist_in_list@plt>
  test   %eax,%eax
  jne    L21
  mov    0x8(%rsp),%rcx
  movslq %ebp,%rax
  add    $0x1,%ebp
  mov    %r13d,(%rcx,%rax,4)
L21:
  add    $0x1,%r13d
  cmp    %r13d,%ebx
  jg     L56
  test   %r12d,%r12d
  jle    L1
L46:
  mov    0x8(%rsp),%rbp
  xor    %ebx,%ebx
  cs nopw 0x0(%rax,%rax,1)
L19:
  mov    0x0(%rbp),%edi
  add    $0x1,%ebx
  add    $0x4,%rbp
  not    %edi
  shr    $0x1f,%edi
  call   <assert@plt>
  cmp    %ebx,%r12d
  jg     L19
L1:
  mov    0x8(%rsp),%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L24:
  test   %ebx,%ebx
  jg     L45
  jmp    L1
```

assistant: ```c
int *get_test_ids(int k, int k_train, int *train_ids) {
  int k_test = k - k_train;
  int *test_ids = (int *)malloc(k_test * sizeof(int));
  int i;
  for (i = 0; i < k_test; i++)
    test_ids[i] = -1;
  int t = 0;
  for (i = 0; i < k; i++) {
    if (!exist_in_list(i, train_ids, k_train)) {
      test_ids[t] = i;
      t++;
    }
  }
  for (i = 0; i < k_test; i++)
    assert(test_ids[i] >= 0);
  return test_ids;
}
```