ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<_casemod>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  mov    -0x14(%rbp),%eax
  cltd
  idivl  -0x18(%rbp)
  mov    %edx,%eax
  mov    %eax,%edx
  neg    %edx
  cmovns %edx,%eax
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  jns    L0
  mov    -0x18(%rbp),%eax
  sub    -0x4(%rbp),%eax
  mov    %eax,-0x4(%rbp)
L0:
  mov    -0x4(%rbp),%eax
  pop    %rbp
  ret
```

assistant: ```c
int _casemod(int x, int v) {
  int r = abs(x % v);
  if (x < 0)
    r = v - r;
  return r;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<_casemod>:
  endbr64
  mov    %edi,%eax
  cltd
  idiv   %esi
  mov    %edx,%eax
  neg    %eax
  cmovs  %edx,%eax
  sub    %eax,%esi
  test   %edi,%edi
  cmovs  %esi,%eax
  ret
```

assistant: ```c
int _casemod(int x, int v) {
  int r = abs(x % v);
  if (x < 0)
    r = v - r;
  return r;
}
```
user: Translate the below assembly code into C programming language:

```asm
<_casemod>:
  endbr64
  mov    %edi,%eax
  cltd
  idiv   %esi
  mov    %edx,%eax
  neg    %eax
  cmovs  %edx,%eax
  sub    %eax,%esi
  test   %edi,%edi
  cmovs  %esi,%eax
  ret
```

assistant: ```c
int _casemod(int x, int v) {
  int r = abs(x % v);
  if (x < 0)
    r = v - r;
  return r;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<_casemod>:
  endbr64
  mov    %edi,%eax
  cltd
  idiv   %esi
  mov    %edx,%eax
  neg    %eax
  cmovs  %edx,%eax
  sub    %eax,%esi
  test   %edi,%edi
  cmovs  %esi,%eax
  ret
```

assistant: ```c
int _casemod(int x, int v) {
  int r = abs(x % v);
  if (x < 0)
    r = v - r;
  return r;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    D6(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    -0x10(%rbp),%rdx
  lea    -0x14(%rbp),%rax
  mov    %rax,%rsi
  lea    D23(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  mov    -0x10(%rbp),%edx
  mov    -0x14(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <power@plt>
  mov    %eax,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  mov    %eax,%esi
  lea    D28(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L9
  call   <__stack_chk_fail@plt>
L9:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D6
datatype: string
name: disassemble_data
arguments: tag: D23
datatype: string
name: disassemble_data
arguments: tag: D28
datatype: string

tool: D6: enter the nos.: 

tool: D23: %d%d

tool: D28: Pow= %d

assistant: ```c
void main() {
  int a, b, c;
  printf("enter the nos.: ");
  scanf("%d%d", &a, &b);
  c = power(a, b);
  printf("Pow= %d", c);
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<main>:
  endbr64
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    D26(%rip),%rdi
  call   <printf@plt>
  lea    0x4(%rsp),%rdx
  mov    %rsp,%rsi
  lea    D7(%rip),%rdi
  call   <scanf@plt>
  mov    0x4(%rsp),%esi
  mov    (%rsp),%edi
  call   <power@plt>
  mov    %eax,%esi
  lea    D11(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L5
  add    $0x18,%rsp
  ret
L5:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: label: D26
type_guessed: string
name: parse_data
arguments: label: D7
type_guessed: string
name: parse_data
arguments: label: D11
type_guessed: string

tool: D26: enter the nos.: 

tool: D7: %d%d

tool: D11: Pow= %d

assistant: ```c
void main() {
  int a, b, c;
  printf("enter the nos.: ");
  scanf("%d%d", &a, &b);
  c = power(a, b);
  printf("Pow= %d", c);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<main>:
  endbr64
  sub    $0x18,%rsp
  lea    D16(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <printf@plt>
  lea    0x4(%rsp),%rdx
  mov    %rsp,%rsi
  lea    D13(%rip),%rdi
  call   <scanf@plt>
  mov    0x4(%rsp),%esi
  mov    (%rsp),%edi
  call   <power@plt>
  lea    D23(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L5
  add    $0x18,%rsp
  ret
L5:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D16
type: string
name: extract_symbolic_data
arguments: tag: D13
type: string
name: extract_symbolic_data
arguments: tag: D23
type: string

tool: D16: enter the nos.: 

tool: D13: %d%d

tool: D23: Pow= %d

assistant: ```c
void main() {
  int a, b, c;
  printf("enter the nos.: ");
  scanf("%d%d", &a, &b);
  c = power(a, b);
  printf("Pow= %d", c);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<main>:
  endbr64
  sub    $0x18,%rsp
  lea    D14(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <printf@plt>
  lea    0x4(%rsp),%rdx
  mov    %rsp,%rsi
  lea    D18(%rip),%rdi
  call   <scanf@plt>
  mov    0x4(%rsp),%esi
  mov    (%rsp),%edi
  call   <power@plt>
  lea    D23(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L9
  add    $0x18,%rsp
  ret
L9:
  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: D18
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D23
type_infered: string

tool: D14: enter the nos.: 

tool: D18: %d%d

tool: D23: Pow= %d

assistant: ```c
void main() {
  int a, b, c;
  printf("enter the nos.: ");
  scanf("%d%d", &a, &b);
  c = power(a, b);
  printf("Pow= %d", c);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<split_memory>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  cmpq   $0x0,-0x40(%rbp)
  je     L17
  cmpq   $0x0,-0x38(%rbp)
  jne    L90
L17:
  mov    $0xffffffff,%eax
  jmp    L12
L90:
  movl   $0x0,-0x24(%rbp)
  movl   $0x0,-0x20(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%ecx
  mov    -0x40(%rbp),%rax
  lea    D1(%rip),%rdx
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <get_char_count@plt>
  mov    %eax,-0x24(%rbp)
  mov    -0x24(%rbp),%eax
  add    $0x1,%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc_mem@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L72
  mov    $0xffffffff,%eax
  jmp    L12
L72:
  movl   $0x0,-0x1c(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  movl   $0x0,-0x24(%rbp)
  movl   $0x0,-0x20(%rbp)
  jmp    L66
L30:
  mov    -0x20(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0xa,%al
  je     L64
  addl   $0x1,-0x24(%rbp)
  jmp    L22
L64:
  mov    -0x24(%rbp),%edx
  mov    -0x18(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <get_formatted_string@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  je     L20
  mov    -0x1c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x1c(%rbp)
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x10(%rbp),%rax
  add    %rax,%rdx
  mov    -0x8(%rbp),%rax
  mov    %rax,(%rdx)
L20:
  mov    -0x24(%rbp),%eax
  cltq
  add    $0x1,%rax
  add    %rax,-0x18(%rbp)
  movl   $0x0,-0x24(%rbp)
L22:
  addl   $0x1,-0x20(%rbp)
L66:
  mov    -0x20(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L30
  mov    -0x38(%rbp),%rax
  mov    -0x10(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    $0x0,%eax
L12:
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: label: D1
datatype: string

tool: D1: 


assistant: ```c
int split_memory(char ***line_list, const char *mem) {
  if (NULL == mem || NULL == line_list) {
    return -1;
  }
  int len = 0;
  int i = 0;
  len = get_char_count(mem, strlen(mem), "\n");
  char **list = (char **)malloc_mem(sizeof(char *) * (len + 1));
  if (NULL == list) {
    return -1;
  }
  int cnt = 0;
  const char *pos = mem + 0;
  len = 0;
  for (i = 0; mem[i] != '\0'; i++) {
    if ('\n' != mem[i]) {
      len++;
      continue;
    };
    char *p = get_formatted_string(pos, len);
    if (NULL != p) {
      list[cnt++] = p;
    } else {
      ;
    }
    pos = pos + len + 1;
    len = 0;
  }
  *line_list = list;
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<split_memory>:
  endbr64
  test   %rsi,%rsi
  je     L61
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r15
  mov    %rsi,%r12
  test   %rdi,%rdi
  je     L82
  mov    %rsi,%rdi
  call   <strlen@plt>
  mov    %eax,%esi
  lea    D7(%rip),%rdx
  mov    %r12,%rdi
  call   <get_char_count@plt>
  lea    0x8(,%rax,8),%edi
  call   <malloc_mem@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L79
  movzbl (%r12),%eax
  test   %al,%al
  je     L37
  lea    0x1(%r12),%rbp
  mov    $0x0,%r14d
  mov    $0x0,%ebx
  jmp    L10
L70:
  mov    %ebx,%esi
  mov    %r12,%rdi
  call   <get_formatted_string@plt>
  test   %rax,%rax
  je     L26
  movslq %r14d,%rdx
  mov    %rax,0x0(%r13,%rdx,8)
  lea    0x1(%r14),%r14d
L26:
  movslq %ebx,%rbx
  lea    0x1(%r12,%rbx,1),%r12
  mov    $0x0,%ebx
L107:
  add    $0x1,%rbp
  movzbl -0x1(%rbp),%eax
  test   %al,%al
  je     L37
L10:
  cmp    $0xa,%al
  je     L70
  add    $0x1,%ebx
  jmp    L107
L37:
  mov    %r13,(%r15)
  mov    $0x0,%eax
L72:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L82:
  mov    $0xffffffff,%eax
  jmp    L72
L79:
  mov    $0xffffffff,%eax
  jmp    L72
L61:
  mov    $0xffffffff,%eax
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D7
data_type: string

tool: D7: 


assistant: ```c
int split_memory(char ***line_list, const char *mem) {
  if (NULL == mem || NULL == line_list) {
    return -1;
  }
  int len = 0;
  int i = 0;
  len = get_char_count(mem, strlen(mem), "\n");
  char **list = (char **)malloc_mem(sizeof(char *) * (len + 1));
  if (NULL == list) {
    return -1;
  }
  int cnt = 0;
  const char *pos = mem + 0;
  len = 0;
  for (i = 0; mem[i] != '\0'; i++) {
    if ('\n' != mem[i]) {
      len++;
      continue;
    };
    char *p = get_formatted_string(pos, len);
    if (NULL != p) {
      list[cnt++] = p;
    } else {
      ;
    }
    pos = pos + len + 1;
    len = 0;
  }
  *line_list = list;
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<split_memory>:
  endbr64
  test   %rsi,%rsi
  je     L24
  push   %r15
  push   %r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %rdi,%rdi
  je     L54
  mov    %rsi,%rdi
  mov    %rsi,%r14
  call   <strlen@plt>
  lea    D0(%rip),%rdx
  mov    %r14,%rdi
  mov    %eax,%esi
  call   <get_char_count@plt>
  lea    0x8(,%rax,8),%edi
  call   <malloc_mem@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L54
  movzbl (%r14),%eax
  test   %al,%al
  je     L71
  lea    0x1(%r14),%rbp
  xor    %r15d,%r15d
  xor    %ebx,%ebx
  jmp    L78
  nopw   0x0(%rax,%rax,1)
L96:
  movzbl 0x0(%rbp),%eax
  add    $0x1,%rbp
  add    $0x1,%ebx
  test   %al,%al
  je     L71
L78:
  cmp    $0xa,%al
  jne    L96
  mov    %ebx,%esi
  mov    %r14,%rdi
  call   <get_formatted_string@plt>
  test   %rax,%rax
  je     L76
  movslq %r15d,%rdx
  add    $0x1,%r15d
  mov    %rax,(%r12,%rdx,8)
L76:
  movzbl 0x0(%rbp),%eax
  movslq %ebx,%rbx
  add    $0x1,%rbp
  lea    0x1(%r14,%rbx,1),%r14
  xor    %ebx,%ebx
  test   %al,%al
  jne    L78
L71:
  mov    %r12,0x0(%r13)
  xor    %eax,%eax
L8:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L54:
  mov    $0xffffffff,%eax
  jmp    L8
L24:
  or     $0xffffffff,%eax
  ret
```

tool_calls: name: parse_data
arguments: tag: D0
type_guessed: string

tool: D0: 


assistant: ```c
int split_memory(char ***line_list, const char *mem) {
  if (NULL == mem || NULL == line_list) {
    return -1;
  }
  int len = 0;
  int i = 0;
  len = get_char_count(mem, strlen(mem), "\n");
  char **list = (char **)malloc_mem(sizeof(char *) * (len + 1));
  if (NULL == list) {
    return -1;
  }
  int cnt = 0;
  const char *pos = mem + 0;
  len = 0;
  for (i = 0; mem[i] != '\0'; i++) {
    if ('\n' != mem[i]) {
      len++;
      continue;
    };
    char *p = get_formatted_string(pos, len);
    if (NULL != p) {
      list[cnt++] = p;
    } else {
      ;
    }
    pos = pos + len + 1;
    len = 0;
  }
  *line_list = list;
  return 0;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<split_memory>:
  endbr64
  test   %rsi,%rsi
  je     L15
  push   %r15
  push   %r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %rdi,%rdi
  je     L17
  mov    %rsi,%rdi
  mov    %rsi,%r14
  call   <strlen@plt>
  lea    D7(%rip),%rdx
  mov    %r14,%rdi
  mov    %eax,%esi
  call   <get_char_count@plt>
  lea    0x8(,%rax,8),%edi
  call   <malloc_mem@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L17
  movzbl (%r14),%eax
  test   %al,%al
  je     L54
  lea    0x1(%r14),%rbp
  xor    %r15d,%r15d
  xor    %ebx,%ebx
  jmp    L32
  nopw   0x0(%rax,%rax,1)
L92:
  movzbl 0x0(%rbp),%eax
  add    $0x1,%rbp
  add    $0x1,%ebx
  test   %al,%al
  je     L54
L32:
  cmp    $0xa,%al
  jne    L92
  mov    %ebx,%esi
  mov    %r14,%rdi
  call   <get_formatted_string@plt>
  test   %rax,%rax
  je     L88
  movslq %r15d,%rdx
  add    $0x1,%r15d
  mov    %rax,(%r12,%rdx,8)
L88:
  movzbl 0x0(%rbp),%eax
  movslq %ebx,%rbx
  add    $0x1,%rbp
  lea    0x1(%r14,%rbx,1),%r14
  xor    %ebx,%ebx
  test   %al,%al
  jne    L32
L54:
  mov    %r12,0x0(%r13)
  xor    %eax,%eax
L36:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L17:
  mov    $0xffffffff,%eax
  jmp    L36
L15:
  or     $0xffffffff,%eax
  ret
```

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

tool: D7: 


assistant: ```c
int split_memory(char ***line_list, const char *mem) {
  if (NULL == mem || NULL == line_list) {
    return -1;
  }
  int len = 0;
  int i = 0;
  len = get_char_count(mem, strlen(mem), "\n");
  char **list = (char **)malloc_mem(sizeof(char *) * (len + 1));
  if (NULL == list) {
    return -1;
  }
  int cnt = 0;
  const char *pos = mem + 0;
  len = 0;
  for (i = 0; mem[i] != '\0'; i++) {
    if ('\n' != mem[i]) {
      len++;
      continue;
    };
    char *p = get_formatted_string(pos, len);
    if (NULL != p) {
      list[cnt++] = p;
    } else {
      ;
    }
    pos = pos + len + 1;
    len = 0;
  }
  *line_list = list;
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<to_ipv4>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x38(%rbp)
  movq   $0x0,-0x48(%rbp)
  movq   $0x0,-0x40(%rbp)
  cmpq   $0x0,-0x58(%rbp)
  jne    L23
  mov    $0x0,%eax
  jmp    L53
L23:
  mov    $0x4,%edi
  call   <pig_newseg@plt>
  mov    %rax,-0x38(%rbp)
  mov    -0x38(%rbp),%rax
  movl   $0x0,(%rax)
  lea    -0x30(%rbp),%rax
  mov    $0x14,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    -0x58(%rbp),%rax
  mov    %rax,-0x48(%rbp)
  jmp    L79
L8:
  mov    -0x48(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  je     L88
  mov    -0x48(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L27
L88:
  mov    -0x48(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L50
  mov    -0x48(%rbp),%rax
  movzbl (%rax),%eax
  lea    -0x30(%rbp),%rcx
  mov    -0x40(%rbp),%rdx
  add    %rcx,%rdx
  mov    %al,(%rdx)
L50:
  mov    -0x38(%rbp),%rax
  mov    (%rax),%eax
  shl    $0x8,%eax
  mov    %eax,%ebx
  lea    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  or     %eax,%ebx
  mov    %ebx,%edx
  mov    -0x38(%rbp),%rax
  mov    %edx,(%rax)
  movq   $0x0,-0x40(%rbp)
  lea    -0x30(%rbp),%rax
  mov    $0x14,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  jmp    L11
L27:
  mov    -0x48(%rbp),%rax
  movzbl (%rax),%eax
  lea    -0x30(%rbp),%rcx
  mov    -0x40(%rbp),%rdx
  add    %rcx,%rdx
  mov    %al,(%rdx)
  mov    -0x40(%rbp),%rax
  lea    0x1(%rax),%rcx
  movabs $0xcccccccccccccccd,%rdx
  mov    %rcx,%rax
  mul    %rdx
  mov    %rdx,%rax
  shr    $0x4,%rax
  mov    %rax,-0x40(%rbp)
  mov    -0x40(%rbp),%rdx
  mov    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  sub    %rax,%rcx
  mov    %rcx,%rdx
  mov    %rdx,-0x40(%rbp)
L11:
  addq   $0x1,-0x48(%rbp)
L79:
  mov    -0x48(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L8
  mov    -0x38(%rbp),%rax
L53:
  mov    -0x18(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L89
  call   <__stack_chk_fail@plt>
L89:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
unsigned int *to_ipv4(const char *data) {
  unsigned int *retval = NULL;
  const char *dp = NULL;
  char oct[20];
  size_t o = 0;
  if (data == NULL) {
    return NULL;
  }
  retval = (unsigned int *)pig_newseg(sizeof(unsigned int));
  *retval = 0;
  memset(oct, 0, sizeof(oct));
  for (dp = data; *dp != 0; dp++) {
    if (*dp == '.' || *(dp + 1) == 0) {
      if (*(dp + 1) == 0) {
        oct[o] = *dp;
      }
      *retval = ((*retval) << 8) | atoi(oct);
      o = 0;
      memset(oct, 0, sizeof(oct));
    } else {
      oct[o] = *dp;
      o = (o + 1) % sizeof(oct);
    }
  }
  return retval;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<to_ipv4>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x20,%rsp
  mov    %rdi,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L50
  mov    $0x4,%edi
  call   <pig_newseg@plt>
  mov    %rax,%r12
  movl   $0x0,(%rax)
  mov    %rsp,%rdi
  mov    $0x14,%edx
  mov    $0x0,%esi
  call   <memset@plt>
  movzbl (%rbx),%eax
  test   %al,%al
  je     L81
  mov    $0x0,%edx
  movabs $0xcccccccccccccccd,%r13
  jmp    L57
L16:
  cmpb   $0x0,0x1(%rbx)
  je     L21
L95:
  mov    (%r12),%ebp
  shl    $0x8,%ebp
  mov    %rsp,%r14
  mov    %r14,%rdi
  call   <atoi@plt>
  or     %eax,%ebp
  mov    %ebp,(%r12)
  mov    $0x14,%edx
  mov    $0x0,%esi
  mov    %r14,%rdi
  call   <memset@plt>
  mov    $0x0,%edx
L87:
  add    $0x1,%rbx
  movzbl (%rbx),%eax
  test   %al,%al
  je     L81
L57:
  cmp    $0x2e,%al
  je     L16
  cmpb   $0x0,0x1(%rbx)
  je     L21
  mov    %al,(%rsp,%rdx,1)
  lea    0x1(%rdx),%rcx
  mov    %rcx,%rax
  mul    %r13
  shr    $0x4,%rdx
  lea    (%rdx,%rdx,4),%rax
  shl    $0x2,%rax
  sub    %rax,%rcx
  mov    %rcx,%rdx
  jmp    L87
L21:
  mov    %al,(%rsp,%rdx,1)
  jmp    L95
L50:
  mov    %rdi,%r12
L81:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L6
  mov    %r12,%rax
  add    $0x20,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L6:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
unsigned int *to_ipv4(const char *data) {
  unsigned int *retval = NULL;
  const char *dp = NULL;
  char oct[20];
  size_t o = 0;
  if (data == NULL) {
    return NULL;
  }
  retval = (unsigned int *)pig_newseg(sizeof(unsigned int));
  *retval = 0;
  memset(oct, 0, sizeof(oct));
  for (dp = data; *dp != 0; dp++) {
    if (*dp == '.' || *(dp + 1) == 0) {
      if (*(dp + 1) == 0) {
        oct[o] = *dp;
      }
      *retval = ((*retval) << 8) | atoi(oct);
      o = 0;
      memset(oct, 0, sizeof(oct));
    } else {
      oct[o] = *dp;
      o = (o + 1) % sizeof(oct);
    }
  }
  return retval;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<to_ipv4>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L29
  mov    %rdi,%rbx
  mov    $0x4,%edi
  mov    %rsp,%r13
  call   <pig_newseg@plt>
  mov    $0x14,%edx
  xor    %esi,%esi
  mov    %r13,%rdi
  movl   $0x0,(%rax)
  mov    %rax,%r12
  call   <memset@plt>
  movzbl (%rbx),%eax
  test   %al,%al
  je     L66
  movabs $0xcccccccccccccccd,%r14
  xor    %edx,%edx
L30:
  movzbl 0x1(%rbx),%ecx
  cmp    $0x2e,%al
  je     L23
L99:
  test   %cl,%cl
  jne    L35
L28:
  mov    %al,(%rsp,%rdx,1)
L73:
  mov    (%r12),%ebp
  mov    %r13,%rdi
  add    $0x1,%rbx
  call   <atoi@plt>
  mov    $0x14,%edx
  xor    %esi,%esi
  mov    %r13,%rdi
  shl    $0x8,%ebp
  or     %eax,%ebp
  mov    %ebp,(%r12)
  call   <memset@plt>
  movzbl (%rbx),%eax
  test   %al,%al
  je     L66
  movzbl 0x1(%rbx),%ecx
  xor    %edx,%edx
  cmp    $0x2e,%al
  jne    L99
L23:
  test   %cl,%cl
  jne    L73
  jmp    L28
  cs nopw 0x0(%rax,%rax,1)
L35:
  lea    0x1(%rdx),%rsi
  mov    %al,(%rsp,%rdx,1)
  add    $0x1,%rbx
  mov    %rsi,%rax
  mul    %r14
  shr    $0x4,%rdx
  lea    (%rdx,%rdx,4),%rax
  shl    $0x2,%rax
  sub    %rax,%rsi
  mov    %ecx,%eax
  mov    %rsi,%rdx
  jmp    L30
  nopw   0x0(%rax,%rax,1)
L29:
  xor    %r12d,%r12d
  nopl   0x0(%rax,%rax,1)
L66:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L62
  add    $0x20,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L62:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
unsigned int *to_ipv4(const char *data) {
  unsigned int *retval = NULL;
  const char *dp = NULL;
  char oct[20];
  size_t o = 0;
  if (data == NULL) {
    return NULL;
  }
  retval = (unsigned int *)pig_newseg(sizeof(unsigned int));
  *retval = 0;
  memset(oct, 0, sizeof(oct));
  for (dp = data; *dp != 0; dp++) {
    if (*dp == '.' || *(dp + 1) == 0) {
      if (*(dp + 1) == 0) {
        oct[o] = *dp;
      }
      *retval = ((*retval) << 8) | atoi(oct);
      o = 0;
      memset(oct, 0, sizeof(oct));
    } else {
      oct[o] = *dp;
      o = (o + 1) % sizeof(oct);
    }
  }
  return retval;
}
```