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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    %rsi,-0x10(%rbp)
  lea    D41(%rip),%rax
  mov    %rax,%rsi
  lea    D8(%rip),%rax
  mov    %rax,%rdi
  call   <myFindString@plt>
  test   %rax,%rax
  je     L10
  lea    D41(%rip),%rax
  jmp    L12
L10:
  lea    D23(%rip),%rax
L12:
  mov    %rax,%rsi
  lea    D34(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D41
data_type: string
name: retrieve_data
arguments: data_label: D8
data_type: string
name: retrieve_data
arguments: data_label: D23
data_type: string
name: retrieve_data
arguments: data_label: D34
data_type: string

tool: D41: TRUE

tool: D8: isTRUE?

tool: D23: FALSE

tool: D34: %s


assistant: ```c
int main(int argc, const char *argv[]) {
  printf("%s\n", (myFindString("isTRUE?", "TRUE")) ? "TRUE" : "FALSE");
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  lea    D28(%rip),%rsi
  lea    D43(%rip),%rdi
  call   <myFindString@plt>
  test   %rax,%rax
  lea    D28(%rip),%rsi
  lea    D41(%rip),%rax
  cmove  %rax,%rsi
  lea    D49(%rip),%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: disassemble_data
arguments: label: D28
data_type: string
name: disassemble_data
arguments: label: D43
data_type: string
name: disassemble_data
arguments: label: D41
data_type: string
name: disassemble_data
arguments: label: D49
data_type: string

tool: D28: TRUE

tool: D43: isTRUE?

tool: D41: FALSE

tool: D49: %s


assistant: ```c
int main(int argc, const char *argv[]) {
  printf("%s\n", (myFindString("isTRUE?", "TRUE")) ? "TRUE" : "FALSE");
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<main>:
  endbr64
  push   %rbx
  lea    D13(%rip),%rbx
  lea    D23(%rip),%rdi
  mov    %rbx,%rsi
  call   <myFindString@plt>
  lea    D4(%rip),%rdi
  test   %rax,%rax
  lea    D24(%rip),%rax
  cmovne %rbx,%rax
  mov    %rax,%rsi
  call   <printf@plt>
  xor    %eax,%eax
  pop    %rbx
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D13
type: string
name: unpack_data
arguments: data_label: D23
type: string
name: unpack_data
arguments: data_label: D4
type: string
name: unpack_data
arguments: data_label: D24
type: string

tool: D13: TRUE

tool: D23: isTRUE?

tool: D4: %s


tool: D24: FALSE

assistant: ```c
int main(int argc, const char *argv[]) {
  printf("%s\n", (myFindString("isTRUE?", "TRUE")) ? "TRUE" : "FALSE");
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<main>:
  endbr64
  push   %rbx
  lea    D21(%rip),%rbx
  lea    D33(%rip),%rdi
  mov    %rbx,%rsi
  call   <myFindString@plt>
  lea    D39(%rip),%rdi
  test   %rax,%rax
  lea    D22(%rip),%rax
  cmovne %rbx,%rax
  mov    %rax,%rsi
  call   <printf@plt>
  xor    %eax,%eax
  pop    %rbx
  ret
```

tool_calls: name: disassemble_data
arguments: label: D21
type_infered: string
name: disassemble_data
arguments: label: D33
type_infered: string
name: disassemble_data
arguments: label: D39
type_infered: string
name: disassemble_data
arguments: label: D22
type_infered: string

tool: D21: TRUE

tool: D33: isTRUE?

tool: D39: %s


tool: D22: FALSE

assistant: ```c
int main(int argc, const char *argv[]) {
  printf("%s\n", (myFindString("isTRUE?", "TRUE")) ? "TRUE" : "FALSE");
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<sun_set>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <solar_noon@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <daylight_seconds@plt>
  mov    %rax,%rdx
  shr    $0x3f,%rdx
  add    %rdx,%rax
  sar    %rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  add    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  leave
  ret
```

assistant: ```c
time_t sun_set(const time_t *timer) {
  long n;
  time_t t;
  t = solar_noon(timer);
  n = daylight_seconds(timer) / 2L;
  t += n;
  return t;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<sun_set>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  call   <solar_noon@plt>
  mov    %rax,%rbp
  mov    %rbx,%rdi
  call   <daylight_seconds@plt>
  mov    %rax,%rdx
  shr    $0x3f,%rdx
  lea    (%rdx,%rax,1),%rax
  sar    %rax
  add    %rbp,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
time_t sun_set(const time_t *timer) {
  long n;
  time_t t;
  t = solar_noon(timer);
  n = daylight_seconds(timer) / 2L;
  t += n;
  return t;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<sun_set>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <solar_noon@plt>
  mov    %rbp,%rdi
  mov    %rax,%rbx
  call   <daylight_seconds@plt>
  add    $0x8,%rsp
  mov    %rax,%rdx
  shr    $0x3f,%rdx
  add    %rdx,%rax
  sar    %rax
  add    %rbx,%rax
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
time_t sun_set(const time_t *timer) {
  long n;
  time_t t;
  t = solar_noon(timer);
  n = daylight_seconds(timer) / 2L;
  t += n;
  return t;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<sun_set>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <solar_noon@plt>
  mov    %rbp,%rdi
  mov    %rax,%rbx
  call   <daylight_seconds@plt>
  add    $0x8,%rsp
  mov    %rax,%rdx
  shr    $0x3f,%rdx
  add    %rdx,%rax
  sar    %rax
  add    %rbx,%rax
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
time_t sun_set(const time_t *timer) {
  long n;
  time_t t;
  t = solar_noon(timer);
  n = daylight_seconds(timer) / 2L;
  t += n;
  return t;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<add_string_to_binary_exponential_buffer>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  movl   $0x0,-0x1c(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L15
L4:
  mov    -0x30(%rbp),%rax
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <binary_exponential_buffer_increment@plt>
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <binary_exponential_buffer_size@plt>
  movslq %eax,%rbx
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <binary_exponential_buffer_data@plt>
  add    %rbx,%rax
  sub    $0x1,%rax
  mov    %rax,%rdx
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0x1c(%rbp)
  addq   $0x1,-0x18(%rbp)
L15:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L4
  nop
  nop
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
void add_string_to_binary_exponential_buffer(void *dest, struct binary_exponential_buffer *b) {
  unsigned int i = 0;
  unsigned char *str = (unsigned char *)dest;
  while (*str) {
    binary_exponential_buffer_increment(b, 1);
    ((unsigned char *)binary_exponential_buffer_data(b))[binary_exponential_buffer_size(b) - 1] = *str;
    i++;
    str++;
  }
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<add_string_to_binary_exponential_buffer>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbp
  mov    %rsi,%r12
  cmpb   $0x0,(%rdi)
  je     L7
L12:
  mov    $0x1,%esi
  mov    %r12,%rdi
  call   <binary_exponential_buffer_increment@plt>
  mov    %r12,%rdi
  call   <binary_exponential_buffer_size@plt>
  mov    %eax,%ebx
  mov    %r12,%rdi
  call   <binary_exponential_buffer_data@plt>
  movzbl 0x0(%rbp),%edx
  movslq %ebx,%rbx
  mov    %dl,-0x1(%rbx,%rax,1)
  add    $0x1,%rbp
  cmpb   $0x0,0x0(%rbp)
  jne    L12
L7:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void add_string_to_binary_exponential_buffer(void *dest, struct binary_exponential_buffer *b) {
  unsigned int i = 0;
  unsigned char *str = (unsigned char *)dest;
  while (*str) {
    binary_exponential_buffer_increment(b, 1);
    ((unsigned char *)binary_exponential_buffer_data(b))[binary_exponential_buffer_size(b) - 1] = *str;
    i++;
    str++;
  }
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<add_string_to_binary_exponential_buffer>:
  endbr64
  cmpb   $0x0,(%rdi)
  je     L17
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  nopl   0x0(%rax,%rax,1)
L14:
  mov    $0x1,%esi
  mov    %r12,%rdi
  add    $0x1,%rbp
  call   <binary_exponential_buffer_increment@plt>
  mov    %r12,%rdi
  call   <binary_exponential_buffer_size@plt>
  mov    %r12,%rdi
  movslq %eax,%rbx
  call   <binary_exponential_buffer_data@plt>
  movzbl -0x1(%rbp),%edx
  mov    %dl,-0x1(%rbx,%rax,1)
  cmpb   $0x0,0x0(%rbp)
  jne    L14
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nop
L17:
  ret
```

assistant: ```c
void add_string_to_binary_exponential_buffer(void *dest, struct binary_exponential_buffer *b) {
  unsigned int i = 0;
  unsigned char *str = (unsigned char *)dest;
  while (*str) {
    binary_exponential_buffer_increment(b, 1);
    ((unsigned char *)binary_exponential_buffer_data(b))[binary_exponential_buffer_size(b) - 1] = *str;
    i++;
    str++;
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<add_string_to_binary_exponential_buffer>:
  endbr64
  cmpb   $0x0,(%rdi)
  je     L9
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  nopl   0x0(%rax,%rax,1)
L0:
  mov    $0x1,%esi
  mov    %r12,%rdi
  add    $0x1,%rbp
  call   <binary_exponential_buffer_increment@plt>
  mov    %r12,%rdi
  call   <binary_exponential_buffer_size@plt>
  mov    %r12,%rdi
  movslq %eax,%rbx
  call   <binary_exponential_buffer_data@plt>
  movzbl -0x1(%rbp),%edx
  mov    %dl,-0x1(%rbx,%rax,1)
  cmpb   $0x0,0x0(%rbp)
  jne    L0
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nop
L9:
  ret
```

assistant: ```c
void add_string_to_binary_exponential_buffer(void *dest, struct binary_exponential_buffer *b) {
  unsigned int i = 0;
  unsigned char *str = (unsigned char *)dest;
  while (*str) {
    binary_exponential_buffer_increment(b, 1);
    ((unsigned char *)binary_exponential_buffer_data(b))[binary_exponential_buffer_size(b) - 1] = *str;
    i++;
    str++;
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<set_sint16>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x8(%rbp)
  mov    %esi,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  mov    %dl,(%rax)
  mov    -0xc(%rbp),%eax
  sar    $0x8,%eax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  mov    %dl,(%rax)
  nop
  pop    %rbp
  ret
```

assistant: ```c
void set_sint16(char *buf, const int16_t val) {
  buf[0] = (val >> 0) & 0xFF;
  buf[1] = (val >> 8) & 0xFF;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<set_sint16>:
  endbr64
  mov    %esi,%eax
  mov    %sil,(%rdi)
  movzbl %ah,%eax
  mov    %al,0x1(%rdi)
  ret
```

assistant: ```c
void set_sint16(char *buf, const int16_t val) {
  buf[0] = (val >> 0) & 0xFF;
  buf[1] = (val >> 8) & 0xFF;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<set_sint16>:
  endbr64
  mov    %si,(%rdi)
  ret
```

assistant: ```c
void set_sint16(char *buf, const int16_t val) {
  buf[0] = (val >> 0) & 0xFF;
  buf[1] = (val >> 8) & 0xFF;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<processA>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %rsi,-0x20(%rbp)
  movl   $0x2,-0x4(%rbp)
  lea    D14(%rip),%rax
  mov    %rax,%rdi
  call   <print@plt>
  jmp    L11
L6:
  lea    D6(%rip),%rax
  mov    %rax,%rdi
  call   <print@plt>
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <printNum@plt>
  mov    $0x0,%eax
  call   <printNewLine@plt>
  subl   $0x1,-0x4(%rbp)
L11:
  cmpl   $0x0,-0x4(%rbp)
  jg     L6
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: unpack_data
arguments: label: D14
type: string
name: unpack_data
arguments: label: D6
type: string

tool: D14: Scheduler process A is running


tool: D6: Scheduler process A: row 

assistant: ```c
int processA(int argc, char **argv) {
  int counter = 2;
  print("Scheduler process A is running\n");
  while (counter > 0) {
    print("Scheduler process A: row ");
    printNum(counter);
    printNewLine();
    counter--;
  }
  return 0;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<processA>:
  endbr64
  push   %rbx
  lea    D14(%rip),%rdi
  call   <print@plt>
  lea    D6(%rip),%rbx
  mov    %rbx,%rdi
  call   <print@plt>
  mov    $0x2,%edi
  call   <printNum@plt>
  mov    $0x0,%eax
  call   <printNewLine@plt>
  mov    %rbx,%rdi
  call   <print@plt>
  mov    $0x1,%edi
  call   <printNum@plt>
  mov    $0x0,%eax
  call   <printNewLine@plt>
  mov    $0x0,%eax
  pop    %rbx
  ret
```

tool_calls: name: read_data
arguments: label: D14
data_type: string
name: read_data
arguments: label: D6
data_type: string

tool: D14: Scheduler process A is running


tool: D6: Scheduler process A: row 

assistant: ```c
int processA(int argc, char **argv) {
  int counter = 2;
  print("Scheduler process A is running\n");
  while (counter > 0) {
    print("Scheduler process A: row ");
    printNum(counter);
    printNewLine();
    counter--;
  }
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<processA>:
  endbr64
  push   %rbp
  lea    D1(%rip),%rdi
  lea    D17(%rip),%rbp
  call   <print@plt>
  mov    %rbp,%rdi
  call   <print@plt>
  mov    $0x2,%edi
  call   <printNum@plt>
  xor    %eax,%eax
  call   <printNewLine@plt>
  mov    %rbp,%rdi
  call   <print@plt>
  mov    $0x1,%edi
  call   <printNum@plt>
  xor    %eax,%eax
  call   <printNewLine@plt>
  xor    %eax,%eax
  pop    %rbp
  ret
```

tool_calls: name: extract_symbolic_data
arguments: label: D1
type_guessed: string
name: extract_symbolic_data
arguments: label: D17
type_guessed: string

tool: D1: Scheduler process A is running


tool: D17: Scheduler process A: row 

assistant: ```c
int processA(int argc, char **argv) {
  int counter = 2;
  print("Scheduler process A is running\n");
  while (counter > 0) {
    print("Scheduler process A: row ");
    printNum(counter);
    printNewLine();
    counter--;
  }
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<processA>:
  endbr64
  push   %rbp
  lea    D8(%rip),%rdi
  lea    D13(%rip),%rbp
  call   <print@plt>
  mov    %rbp,%rdi
  call   <print@plt>
  mov    $0x2,%edi
  call   <printNum@plt>
  xor    %eax,%eax
  call   <printNewLine@plt>
  mov    %rbp,%rdi
  call   <print@plt>
  mov    $0x1,%edi
  call   <printNum@plt>
  xor    %eax,%eax
  call   <printNewLine@plt>
  xor    %eax,%eax
  pop    %rbp
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D8
type_infered: string
name: retrieve_data
arguments: data_tag: D13
type_infered: string

tool: D8: Scheduler process A is running


tool: D13: Scheduler process A: row 

assistant: ```c
int processA(int argc, char **argv) {
  int counter = 2;
  print("Scheduler process A is running\n");
  while (counter > 0) {
    print("Scheduler process A: row ");
    printNum(counter);
    printNewLine();
    counter--;
  }
  return 0;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<create_server_socket>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x30(%rbp),%rax
  mov    $0x28,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    D2(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x20(%rbp)
  mov    D29(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x24(%rbp)
  mov    D16(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x10(%rbp)
  lea    -0x40(%rbp),%rcx
  lea    -0x30(%rbp),%rdx
  mov    -0x58(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <getaddrinfo@plt>
  mov    %eax,-0x44(%rbp)
  cmpl   $0x0,-0x44(%rbp)
  je     L85
  mov    -0x44(%rbp),%eax
  jmp    L72
L85:
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x38(%rbp)
  jmp    L103
L12:
  mov    -0x38(%rbp),%rax
  mov    0x8(%rax),%edx
  mov    -0x38(%rbp),%rax
  mov    0xc(%rax),%ecx
  mov    -0x38(%rbp),%rax
  mov    0x10(%rax),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <socket@plt>
  mov    %eax,-0x48(%rbp)
  cmpl   $0xffffffff,-0x48(%rbp)
  je     L79
  mov    -0x38(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x38(%rbp),%rax
  mov    0x4(%rax),%ecx
  mov    -0x48(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <bind@plt>
  test   %rax,%rax
  je     L30
  mov    -0x48(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  jmp    L107
L79:
  nop
L107:
  mov    -0x38(%rbp),%rax
  mov    0x18(%rax),%rax
  mov    %rax,-0x38(%rbp)
L103:
  cmpq   $0x0,-0x38(%rbp)
  jne    L12
  jmp    L7
L30:
  nop
L7:
  cmpq   $0x0,-0x38(%rbp)
  jne    L26
  mov    $0xffffffff,%eax
  jmp    L72
L26:
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <freeaddrinfo@plt>
  mov    -0x48(%rbp),%eax
L72:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L97
  call   <__stack_chk_fail@plt>
L97:
  leave
  ret
```

assistant: ```c
int create_server_socket(char *port) {
  int server_socket, ret;
  struct addrinfo hints, *srvinfo, *p;
  memset(&hints, 0, sizeof(hints));
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_flags = AI_PASSIVE;
  ret = getaddrinfo(NULL, port, &hints, &srvinfo);
  if (ret != 0) {
    return ret;
  }
  for (p = srvinfo; p != NULL; p = p->ai_next) {
    server_socket = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
    if (server_socket == -1) {
      continue;
    }
    if ((bind(server_socket, p->ai_addr, p->ai_addrlen)) == 0) {
      break;
    }
    close(server_socket);
  }
  if (p == NULL) {
    return -1;
  }
  freeaddrinfo(srvinfo);
  return server_socket;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<create_server_socket>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%rbp
  mov    $0x28,%edx
  mov    $0x0,%esi
  mov    %rbp,%rdi
  call   <memset@plt>
  mov    D21(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,0x20(%rsp)
  mov    D22(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,0x1c(%rsp)
  mov    D16(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,0x30(%rsp)
  lea    0x8(%rsp),%rcx
  mov    %rbp,%rdx
  mov    %rbx,%rsi
  mov    $0x0,%edi
  call   <getaddrinfo@plt>
  mov    %eax,%ebp
  test   %eax,%eax
  jne    L36
  mov    0x8(%rsp),%rbx
  test   %rbx,%rbx
  jne    L32
L77:
  mov    $0xffffffff,%ebp
  jmp    L36
L11:
  mov    0x18(%rbx),%rbx
  test   %rbx,%rbx
  je     L77
L32:
  mov    0x8(%rbx),%edx
  mov    0xc(%rbx),%esi
  mov    0x10(%rbx),%edi
  call   <socket@plt>
  mov    %eax,%ebp
  cmp    $0xffffffff,%eax
  je     L11
  mov    0x4(%rbx),%esi
  mov    (%rbx),%edx
  mov    %eax,%edi
  call   <bind@plt>
  test   %rax,%rax
  je     L57
  mov    %ebp,%edi
  call   <close@plt>
  jmp    L11
L57:
  mov    0x8(%rsp),%rdi
  call   <freeaddrinfo@plt>
L36:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L78
  mov    %ebp,%eax
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  ret
L78:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int create_server_socket(char *port) {
  int server_socket, ret;
  struct addrinfo hints, *srvinfo, *p;
  memset(&hints, 0, sizeof(hints));
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_flags = AI_PASSIVE;
  ret = getaddrinfo(NULL, port, &hints, &srvinfo);
  if (ret != 0) {
    return ret;
  }
  for (p = srvinfo; p != NULL; p = p->ai_next) {
    server_socket = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
    if (server_socket == -1) {
      continue;
    }
    if ((bind(server_socket, p->ai_addr, p->ai_addrlen)) == 0) {
      break;
    }
    close(server_socket);
  }
  if (p == NULL) {
    return -1;
  }
  freeaddrinfo(srvinfo);
  return server_socket;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<create_server_socket>:
  endbr64
  push   %r12
  mov    $0x28,%edx
  xor    %esi,%esi
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x40,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%r12
  mov    %r12,%rdi
  call   <memset@plt>
  mov    %rbp,%rsi
  lea    0x8(%rsp),%rcx
  mov    %r12,%rdx
  mov    D16(%rip),%rax
  xor    %edi,%edi
  mov    (%rax),%eax
  mov    %eax,0x20(%rsp)
  mov    D14(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,0x1c(%rsp)
  mov    D11(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,0x30(%rsp)
  call   <getaddrinfo@plt>
  mov    %eax,%ebp
  test   %eax,%eax
  jne    L2
  mov    0x8(%rsp),%rbx
  test   %rbx,%rbx
  je     L55
  nopl   0x0(%rax)
L28:
  mov    0x8(%rbx),%edx
  mov    0xc(%rbx),%esi
  mov    0x10(%rbx),%edi
  call   <socket@plt>
  mov    %eax,%ebp
  cmp    $0xffffffff,%eax
  je     L68
  mov    0x4(%rbx),%esi
  mov    (%rbx),%edx
  mov    %eax,%edi
  call   <bind@plt>
  test   %rax,%rax
  je     L8
  mov    %ebp,%edi
  call   <close@plt>
L68:
  mov    0x18(%rbx),%rbx
  test   %rbx,%rbx
  jne    L28
L55:
  mov    $0xffffffff,%ebp
L2:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L65
  add    $0x40,%rsp
  mov    %ebp,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  cs nopw 0x0(%rax,%rax,1)
L8:
  mov    0x8(%rsp),%rdi
  call   <freeaddrinfo@plt>
  jmp    L2
L65:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int create_server_socket(char *port) {
  int server_socket, ret;
  struct addrinfo hints, *srvinfo, *p;
  memset(&hints, 0, sizeof(hints));
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_flags = AI_PASSIVE;
  ret = getaddrinfo(NULL, port, &hints, &srvinfo);
  if (ret != 0) {
    return ret;
  }
  for (p = srvinfo; p != NULL; p = p->ai_next) {
    server_socket = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
    if (server_socket == -1) {
      continue;
    }
    if ((bind(server_socket, p->ai_addr, p->ai_addrlen)) == 0) {
      break;
    }
    close(server_socket);
  }
  if (p == NULL) {
    return -1;
  }
  freeaddrinfo(srvinfo);
  return server_socket;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<create_server_socket>:
  endbr64
  push   %r12
  mov    $0x28,%edx
  xor    %esi,%esi
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x40,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%r12
  mov    %r12,%rdi
  call   <memset@plt>
  mov    %rbp,%rsi
  lea    0x8(%rsp),%rcx
  xor    %edi,%edi
  mov    D17(%rip),%rax
  mov    D22(%rip),%rdx
  mov    (%rax),%eax
  movd   (%rdx),%xmm0
  mov    %r12,%rdx
  movd   %eax,%xmm1
  mov    D7(%rip),%rax
  punpckldq %xmm1,%xmm0
  mov    (%rax),%eax
  movq   %xmm0,0x1c(%rsp)
  mov    %eax,0x30(%rsp)
  call   <getaddrinfo@plt>
  mov    %eax,%ebp
  test   %eax,%eax
  jne    L4
  mov    0x8(%rsp),%rbx
  test   %rbx,%rbx
  je     L15
  nopl   0x0(%rax)
L34:
  mov    0x8(%rbx),%edx
  mov    0xc(%rbx),%esi
  mov    0x10(%rbx),%edi
  call   <socket@plt>
  mov    %eax,%ebp
  cmp    $0xffffffff,%eax
  je     L57
  mov    0x4(%rbx),%esi
  mov    (%rbx),%edx
  mov    %eax,%edi
  call   <bind@plt>
  test   %rax,%rax
  je     L63
  mov    %ebp,%edi
  call   <close@plt>
L57:
  mov    0x18(%rbx),%rbx
  test   %rbx,%rbx
  jne    L34
L15:
  mov    $0xffffffff,%ebp
L4:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L41
  add    $0x40,%rsp
  mov    %ebp,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  xchg   %ax,%ax
L63:
  mov    0x8(%rsp),%rdi
  call   <freeaddrinfo@plt>
  jmp    L4
L41:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int create_server_socket(char *port) {
  int server_socket, ret;
  struct addrinfo hints, *srvinfo, *p;
  memset(&hints, 0, sizeof(hints));
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_flags = AI_PASSIVE;
  ret = getaddrinfo(NULL, port, &hints, &srvinfo);
  if (ret != 0) {
    return ret;
  }
  for (p = srvinfo; p != NULL; p = p->ai_next) {
    server_socket = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
    if (server_socket == -1) {
      continue;
    }
    if ((bind(server_socket, p->ai_addr, p->ai_addrlen)) == 0) {
      break;
    }
    close(server_socket);
  }
  if (p == NULL) {
    return -1;
  }
  freeaddrinfo(srvinfo);
  return server_socket;
}
```