ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Converte this assembly snippet into its equivalent C code:

```asm
<scroll>:
  endbr64
  push   %r14
  mov    $0x8,%edi
  push   %r13
  lea    D13(%rip),%r13
  push   %r12
  lea    D8(%rip),%r12
  push   %rbp
  push   %rbx
  call   <malloc@plt>
  mov    $0x8,%edi
  mov    %rax,%rbp
  call   <malloc@plt>
  lea    D12(%rip),%rsi
  mov    %rax,%rbx
  mov    %rax,%rdi
  call   <strcpy@plt>
  lea    0x1(%rbx),%r14
  nopw   0x0(%rax,%rax,1)
L5:
  mov    %rbx,%rsi
  mov    %r13,%rdi
  call   <printf@plt>
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <strcpy@plt>
  mov    $0x1,%edx
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <strncat@plt>
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <strcpy@plt>
  mov    $0x7a120,%edi
  call   <retardo@plt>
  mov    %r12,%rdi
  call   <system@plt>
  jmp    L5
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D13
datatype: string
name: extract_symbolic_data
arguments: data_label: D8
datatype: string
name: extract_symbolic_data
arguments: data_label: D12
datatype: string

tool: D13: %s

tool: D8: cls

tool: D12: este programa te permitira evaluar cualquier funcion            

assistant: ```c
void scroll(void) {
  char *cad = "este programa te permitira evaluar cualquier funcion            ";
  char *temp, *newcad;
  temp = (char *)malloc(sizeof(strlen(cad)));
  newcad = (char *)malloc(sizeof(strlen(cad)));
  strcpy(newcad, cad);
  while (1) {
    printf("%s", newcad);
    strcpy(temp, &newcad[1]);
    strncat(temp, &newcad[0], 1);
    strcpy(newcad, temp);
    retardo(500000);
    system("cls");
  }
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<ai_card>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  mov    $0x4,%esi
  mov    %eax,%edi
  call   <data_getresource@plt>
  test   %eax,%eax
  jle    L38
  mov    -0x4(%rbp),%eax
  mov    $0x1,%esi
  mov    %eax,%edi
  call   <data_getresource@plt>
  test   %eax,%eax
  jle    L38
  mov    -0x4(%rbp),%eax
  mov    $0x2,%esi
  mov    %eax,%edi
  call   <data_getresource@plt>
  test   %eax,%eax
  jle    L38
  mov    $0x0,%eax
  call   <devcards_remaining@plt>
  test   %rax,%rax
  jne    L16
L38:
  mov    $0x0,%eax
  jmp    L7
L16:
  mov    -0x4(%rbp),%eax
  mov    $0x4,%esi
  mov    %eax,%edi
  call   <data_getresource@plt>
  cmp    $0x2,%eax
  jg     L34
  mov    -0x4(%rbp),%eax
  mov    $0x4,%esi
  mov    %eax,%edi
  call   <data_getresource@plt>
  cmp    $0x2,%eax
  jne    L75
  mov    -0x4(%rbp),%eax
  mov    $0x1,%esi
  mov    %eax,%edi
  call   <data_getresource@plt>
  cmp    $0x2,%eax
  jne    L75
L34:
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <ai_canupgrade@plt>
  test   %rax,%rax
  je     L75
  mov    $0x0,%eax
  jmp    L7
L75:
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <devcards_buy@plt>
  mov    -0x4(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,%edi
  call   <itoa@plt>
  mov    %rax,%rsi
  lea    D14(%rip),%rax
  mov    %rax,%rdi
  call   <cat@plt>
  mov    %rax,%rdx
  lea    D7(%rip),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <cat@plt>
  mov    %rax,%rdi
  call   <map_setmessage@plt>
  mov    $0x1,%eax
L7:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D14
datatype: string
name: disassemble_data
arguments: data_label: D7
datatype: string

tool: D14: Player 

tool: D7:  purchased a dev card

assistant: ```c
int ai_card(int player) {
  if (data_getresource(player, 4) < 1 || data_getresource(player, 1) < 1 || data_getresource(player, 2) < 1 || devcards_remaining() == 0) {
    return 0;
  }
  if ((data_getresource(player, 4) >= 3 || (data_getresource(player, 4) == 2 && data_getresource(player, 1) == 2)) && ai_canupgrade(player)) {
    return 0;
  }
  devcards_buy(player);
  map_setmessage(cat(cat("Player ", itoa(player + 1)), " purchased a dev card"));
  return 1;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<ai_card>:
  endbr64
  push   %rbx
  mov    %edi,%ebx
  mov    $0x4,%esi
  call   <data_getresource@plt>
  mov    %eax,%edx
  mov    $0x0,%eax
  test   %edx,%edx
  jle    L13
  mov    $0x1,%esi
  mov    %ebx,%edi
  call   <data_getresource@plt>
  mov    %eax,%edx
  mov    $0x0,%eax
  test   %edx,%edx
  jle    L13
  mov    $0x2,%esi
  mov    %ebx,%edi
  call   <data_getresource@plt>
  mov    %eax,%edx
  mov    $0x0,%eax
  test   %edx,%edx
  jle    L13
  call   <devcards_remaining@plt>
  mov    %rax,%rdx
  mov    $0x0,%eax
  test   %rdx,%rdx
  jne    L82
L13:
  pop    %rbx
  ret
L82:
  mov    $0x4,%esi
  mov    %ebx,%edi
  call   <data_getresource@plt>
  cmp    $0x2,%eax
  jg     L9
  mov    $0x4,%esi
  mov    %ebx,%edi
  call   <data_getresource@plt>
  cmp    $0x2,%eax
  je     L70
L23:
  mov    %ebx,%edi
  call   <devcards_buy@plt>
  lea    0x1(%rbx),%edi
  call   <itoa@plt>
  mov    %rax,%rsi
  lea    D17(%rip),%rdi
  call   <cat@plt>
  mov    %rax,%rdi
  lea    D4(%rip),%rsi
  call   <cat@plt>
  mov    %rax,%rdi
  call   <map_setmessage@plt>
  mov    $0x1,%eax
  jmp    L13
L70:
  mov    $0x1,%esi
  mov    %ebx,%edi
  call   <data_getresource@plt>
  cmp    $0x2,%eax
  jne    L23
L9:
  mov    %ebx,%edi
  call   <ai_canupgrade@plt>
  mov    %rax,%rdx
  mov    $0x0,%eax
  test   %rdx,%rdx
  je     L23
  jmp    L13
```

tool_calls: name: retrieve_data
arguments: data_label: D17
datatype: string
name: retrieve_data
arguments: data_label: D4
datatype: string

tool: D17: Player 

tool: D4:  purchased a dev card

assistant: ```c
int ai_card(int player) {
  if (data_getresource(player, 4) < 1 || data_getresource(player, 1) < 1 || data_getresource(player, 2) < 1 || devcards_remaining() == 0) {
    return 0;
  }
  if ((data_getresource(player, 4) >= 3 || (data_getresource(player, 4) == 2 && data_getresource(player, 1) == 2)) && ai_canupgrade(player)) {
    return 0;
  }
  devcards_buy(player);
  map_setmessage(cat(cat("Player ", itoa(player + 1)), " purchased a dev card"));
  return 1;
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<ai_card>:
  endbr64
  push   %rbx
  mov    $0x4,%esi
  mov    %edi,%ebx
  call   <data_getresource@plt>
  test   %eax,%eax
  jle    L63
  mov    $0x1,%esi
  mov    %ebx,%edi
  call   <data_getresource@plt>
  test   %eax,%eax
  jle    L63
  mov    $0x2,%esi
  mov    %ebx,%edi
  call   <data_getresource@plt>
  test   %eax,%eax
  jle    L63
  xor    %eax,%eax
  call   <devcards_remaining@plt>
  test   %rax,%rax
  je     L63
  mov    $0x4,%esi
  mov    %ebx,%edi
  call   <data_getresource@plt>
  cmp    $0x2,%eax
  jg     L79
  mov    $0x4,%esi
  mov    %ebx,%edi
  call   <data_getresource@plt>
  cmp    $0x2,%eax
  jne    L14
  mov    $0x1,%esi
  mov    %ebx,%edi
  call   <data_getresource@plt>
  cmp    $0x2,%eax
  je     L79
L14:
  mov    %ebx,%edi
  call   <devcards_buy@plt>
  lea    0x1(%rbx),%edi
  call   <itoa@plt>
  lea    D5(%rip),%rdi
  mov    %rax,%rsi
  call   <cat@plt>
  lea    D9(%rip),%rsi
  mov    %rax,%rdi
  call   <cat@plt>
  mov    %rax,%rdi
  call   <map_setmessage@plt>
  mov    $0x1,%eax
  pop    %rbx
  ret
  nopl   0x0(%rax)
L79:
  mov    %ebx,%edi
  call   <ai_canupgrade@plt>
  test   %rax,%rax
  je     L14
L63:
  xor    %eax,%eax
  pop    %rbx
  ret
```

tool_calls: name: disassemble_data
arguments: label: D5
data_type: string
name: disassemble_data
arguments: label: D9
data_type: string

tool: D5: Player 

tool: D9:  purchased a dev card

assistant: ```c
int ai_card(int player) {
  if (data_getresource(player, 4) < 1 || data_getresource(player, 1) < 1 || data_getresource(player, 2) < 1 || devcards_remaining() == 0) {
    return 0;
  }
  if ((data_getresource(player, 4) >= 3 || (data_getresource(player, 4) == 2 && data_getresource(player, 1) == 2)) && ai_canupgrade(player)) {
    return 0;
  }
  devcards_buy(player);
  map_setmessage(cat(cat("Player ", itoa(player + 1)), " purchased a dev card"));
  return 1;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<ai_card>:
  endbr64
  push   %rbx
  mov    $0x4,%esi
  mov    %edi,%ebx
  call   <data_getresource@plt>
  test   %eax,%eax
  jle    L32
  mov    $0x1,%esi
  mov    %ebx,%edi
  call   <data_getresource@plt>
  test   %eax,%eax
  jle    L32
  mov    $0x2,%esi
  mov    %ebx,%edi
  call   <data_getresource@plt>
  test   %eax,%eax
  jle    L32
  xor    %eax,%eax
  call   <devcards_remaining@plt>
  test   %rax,%rax
  je     L32
  mov    $0x4,%esi
  mov    %ebx,%edi
  call   <data_getresource@plt>
  cmp    $0x2,%eax
  jg     L11
  mov    $0x4,%esi
  mov    %ebx,%edi
  call   <data_getresource@plt>
  cmp    $0x2,%eax
  jne    L19
  mov    $0x1,%esi
  mov    %ebx,%edi
  call   <data_getresource@plt>
  cmp    $0x2,%eax
  je     L11
L19:
  mov    %ebx,%edi
  call   <devcards_buy@plt>
  lea    0x1(%rbx),%edi
  call   <itoa@plt>
  lea    D8(%rip),%rdi
  mov    %rax,%rsi
  call   <cat@plt>
  lea    D0(%rip),%rsi
  mov    %rax,%rdi
  call   <cat@plt>
  mov    %rax,%rdi
  call   <map_setmessage@plt>
  mov    $0x1,%eax
  pop    %rbx
  ret
  nopl   0x0(%rax)
L11:
  mov    %ebx,%edi
  call   <ai_canupgrade@plt>
  test   %rax,%rax
  je     L19
L32:
  xor    %eax,%eax
  pop    %rbx
  ret
```

tool_calls: name: parse_data
arguments: label: D8
type_guessed: string
name: parse_data
arguments: label: D0
type_guessed: string

tool: D8: Player 

tool: D0:  purchased a dev card

assistant: ```c
int ai_card(int player) {
  if (data_getresource(player, 4) < 1 || data_getresource(player, 1) < 1 || data_getresource(player, 2) < 1 || devcards_remaining() == 0) {
    return 0;
  }
  if ((data_getresource(player, 4) >= 3 || (data_getresource(player, 4) == 2 && data_getresource(player, 1) == 2)) && ai_canupgrade(player)) {
    return 0;
  }
  devcards_buy(player);
  map_setmessage(cat(cat("Player ", itoa(player + 1)), " purchased a dev card"));
  return 1;
}
```
user: What is the c source code of the assembly code below:

```asm
<corsika_get_m_overburden>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  movsd  %xmm0,-0x18(%rbp)
  mov    %rdi,-0x20(%rbp)
  mov    %rsi,-0x28(%rbp)
  mov    %rdx,-0x30(%rbp)
  mov    %rcx,-0x38(%rbp)
  mov    %r8,-0x40(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movl   $0x0,-0x10(%rbp)
  movl   $0x0,-0xc(%rbp)
  jmp    L25
L10:
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  comisd -0x18(%rbp),%xmm0
  setae  %al
  xor    $0x1,%eax
  test   %al,%al
  je     L9
  mov    -0xc(%rbp),%eax
  mov    %eax,-0x10(%rbp)
L9:
  addl   $0x1,-0xc(%rbp)
L25:
  cmpl   $0x4,-0xc(%rbp)
  jle    L10
  cmpl   $0x4,-0x10(%rbp)
  jne    L44
  mov    -0x20(%rbp),%rax
  add    $0x20,%rax
  movsd  (%rax),%xmm0
  mov    -0x28(%rbp),%rax
  add    $0x20,%rax
  movsd  (%rax),%xmm1
  mov    -0x30(%rbp),%rax
  add    $0x20,%rax
  movsd  (%rax),%xmm2
  divsd  %xmm2,%xmm1
  mulsd  -0x18(%rbp),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  jmp    L4
L44:
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm3
  movsd  %xmm3,-0x48(%rbp)
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm4
  movsd  %xmm4,-0x50(%rbp)
  movsd  -0x18(%rbp),%xmm0
  movq   D5(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  divsd  %xmm1,%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  call   <exp@plt>
  mulsd  -0x50(%rbp),%xmm0
  addsd  -0x48(%rbp),%xmm0
  movsd  %xmm0,-0x8(%rbp)
L4:
  movsd  -0x8(%rbp),%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D5
type_guessed: f32[2]

tool: {"D5": [0.0,-0.0]}

assistant: ```c
double corsika_get_m_overburden(double h_cm, double *a, double *b, double *c, double *t, double *hl) {
  double res = 0.0;
  int layer = 0;
  int i;
  for (i = 0; i < 5; ++i)
    if (!(h_cm <= hl[i]))
      layer = i;
  if (layer == 4)
    res = a[4] - b[4] / c[4] * h_cm;
  else
    res = a[layer] + b[layer] * exp(-h_cm / c[layer]);
  return res;
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<corsika_get_m_overburden>:
  endbr64
  mov    $0x0,%eax
  mov    $0x0,%ecx
L15:
  movsd  (%r8,%rax,8),%xmm1
  comisd %xmm0,%xmm1
  cmovb  %eax,%ecx
  add    $0x1,%rax
  cmp    $0x5,%rax
  jne    L15
  cmp    $0x4,%ecx
  jne    L12
  movsd  0x20(%rsi),%xmm1
  divsd  0x20(%rdx),%xmm1
  mulsd  %xmm0,%xmm1
  movsd  0x20(%rdi),%xmm0
  subsd  %xmm1,%xmm0
  ret
L12:
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  movslq %ecx,%rcx
  mov    (%rdi,%rcx,8),%rbp
  mov    (%rsi,%rcx,8),%rbx
  xorpd  D8(%rip),%xmm0
  divsd  (%rdx,%rcx,8),%xmm0
  call   <exp@plt>
  movq   %rbx,%xmm2
  mulsd  %xmm0,%xmm2
  movapd %xmm2,%xmm0
  movq   %rbp,%xmm3
  addsd  %xmm3,%xmm0
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

tool_calls: name: read_data
arguments: tag: D8
datatype: f32[4]

tool: {"D8": [0.0,-0.0,0.0,0.0]}

assistant: ```c
double corsika_get_m_overburden(double h_cm, double *a, double *b, double *c, double *t, double *hl) {
  double res = 0.0;
  int layer = 0;
  int i;
  for (i = 0; i < 5; ++i)
    if (!(h_cm <= hl[i]))
      layer = i;
  if (layer == 4)
    res = a[4] - b[4] / c[4] * h_cm;
  else
    res = a[layer] + b[layer] * exp(-h_cm / c[layer]);
  return res;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<corsika_get_m_overburden>:
  endbr64
  xor    %eax,%eax
  xor    %ecx,%ecx
L17:
  movsd  (%r8,%rax,8),%xmm1
  comisd %xmm0,%xmm1
  cmovb  %eax,%ecx
  add    $0x1,%rax
  cmp    $0x5,%rax
  jne    L17
  cmp    $0x4,%ecx
  jne    L4
  movsd  0x20(%rsi),%xmm1
  divsd  0x20(%rdx),%xmm1
  mulsd  %xmm0,%xmm1
  movsd  0x20(%rdi),%xmm0
  subsd  %xmm1,%xmm0
  ret
  nopl   0x0(%rax)
L4:
  movslq %ecx,%rcx
  sub    $0x18,%rsp
  xorpd  D8(%rip),%xmm0
  movsd  (%rdi,%rcx,8),%xmm2
  movsd  (%rsi,%rcx,8),%xmm3
  divsd  (%rdx,%rcx,8),%xmm0
  movsd  %xmm2,(%rsp)
  movsd  %xmm3,0x8(%rsp)
  call   <exp@plt>
  mulsd  0x8(%rsp),%xmm0
  addsd  (%rsp),%xmm0
  add    $0x18,%rsp
  ret
```

tool_calls: name: read_data
arguments: data_tag: D8
type: f32[4]

tool: {"D8": [0.0,-0.0,0.0,0.0]}

assistant: ```c
double corsika_get_m_overburden(double h_cm, double *a, double *b, double *c, double *t, double *hl) {
  double res = 0.0;
  int layer = 0;
  int i;
  for (i = 0; i < 5; ++i)
    if (!(h_cm <= hl[i]))
      layer = i;
  if (layer == 4)
    res = a[4] - b[4] / c[4] * h_cm;
  else
    res = a[layer] + b[layer] * exp(-h_cm / c[layer]);
  return res;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<corsika_get_m_overburden>:
  endbr64
  movsd  0x8(%r8),%xmm1
  mov    %rdi,%rcx
  mov    $0x2,%edi
  comisd %xmm0,%xmm1
  movsd  0x10(%r8),%xmm1
  setb   %al
  comisd %xmm0,%xmm1
  movsd  0x18(%r8),%xmm1
  movzbl %al,%eax
  cmovb  %rdi,%rax
  comisd %xmm0,%xmm1
  movsd  0x20(%r8),%xmm1
  jae    L17
  comisd %xmm0,%xmm1
  jae    L7
L0:
  movsd  0x20(%rsi),%xmm1
  divsd  0x20(%rdx),%xmm1
  mulsd  %xmm0,%xmm1
  movsd  0x20(%rcx),%xmm0
  subsd  %xmm1,%xmm0
  ret
  nopw   0x0(%rax,%rax,1)
L17:
  comisd %xmm0,%xmm1
  jb     L0
L21:
  sub    $0x18,%rsp
  movsd  (%rcx,%rax,8),%xmm2
  movsd  (%rsi,%rax,8),%xmm3
  xorpd  D9(%rip),%xmm0
  divsd  (%rdx,%rax,8),%xmm0
  movsd  %xmm2,(%rsp)
  movsd  %xmm3,0x8(%rsp)
  call   <exp@plt>
  mulsd  0x8(%rsp),%xmm0
  addsd  (%rsp),%xmm0
  add    $0x18,%rsp
  ret
  nopl   0x0(%rax)
L7:
  mov    $0x3,%eax
  jmp    L21
```

tool_calls: name: retrieve_data
arguments: data_label: D9
type_infered: f32[4]

tool: {"D9": [0.0,-0.0,0.0,0.0]}

assistant: ```c
double corsika_get_m_overburden(double h_cm, double *a, double *b, double *c, double *t, double *hl) {
  double res = 0.0;
  int layer = 0;
  int i;
  for (i = 0; i < 5; ++i)
    if (!(h_cm <= hl[i]))
      layer = i;
  if (layer == 4)
    res = a[4] - b[4] / c[4] * h_cm;
  else
    res = a[layer] + b[layer] * exp(-h_cm / c[layer]);
  return res;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<send_message>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %edi,-0x44(%rbp)
  mov    %esi,-0x48(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x12(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  movq   $0x0,-0x20(%rbp)
  lea    -0x12(%rbp),%rax
  mov    $0xa,%esi
  mov    %rax,%rdi
  call   <bzero@plt>
  lea    -0x31(%rbp),%rcx
  mov    -0x44(%rbp),%eax
  mov    $0x1,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <read@plt>
  mov    %eax,-0x30(%rbp)
L39:
  cmpl   $0x0,-0x30(%rbp)
  jg     L1
  mov    $0xffffffff,%eax
  jmp    L48
L1:
  movzbl -0x31(%rbp),%eax
  cmp    $0x3b,%al
  je     L41
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  movzbl -0x31(%rbp),%edx
  mov    %dl,(%rax)
  lea    -0x31(%rbp),%rcx
  mov    -0x44(%rbp),%eax
  mov    $0x1,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <read@plt>
  mov    %eax,-0x30(%rbp)
  jmp    L39
L41:
  nop
  lea    -0x12(%rbp),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    %eax,-0x2c(%rbp)
  cmpl   $0x0,-0x2c(%rbp)
  jne    L44
  mov    $0x0,%eax
  jmp    L48
L44:
  cmpl   $0xffffffff,-0x2c(%rbp)
  jne    L127
  mov    $0xffffffff,%eax
  jmp    L48
L127:
  mov    -0x2c(%rbp),%eax
  add    $0x1,%eax
  mov    $0x1,%esi
  mov    %eax,%edi
  call   <calloc@plt>
  mov    %rax,-0x20(%rbp)
  mov    -0x2c(%rbp),%edx
  mov    -0x20(%rbp),%rcx
  mov    -0x44(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <read@plt>
  mov    %eax,-0x30(%rbp)
  cmpl   $0x0,-0x30(%rbp)
  jns    L49
  mov    $0xffffffff,%eax
  jmp    L48
L49:
  mov    -0x2c(%rbp),%edx
  mov    -0x20(%rbp),%rcx
  mov    -0x48(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <write_net@plt>
  mov    %eax,-0x30(%rbp)
  mov    -0x30(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jne    L57
  mov    $0x0,%eax
  jmp    L48
L57:
  mov    $0xffffffff,%eax
L48:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L27
  call   <__stack_chk_fail@plt>
L27:
  leave
  ret
```

assistant: ```c
int send_message(int incoming, int network) {
  char size[10];
  char ch;
  char *ptr = size, *buffer = 0;
  int ret, len;
  bzero(size, sizeof(size));
  ret = read(incoming, &ch, 1);
  while (1) {
    if (ret <= 0)
      return -1;
    if (ch == ';')
      break;
    *ptr++ = ch;
    ret = read(incoming, &ch, 1);
  }
  len = atoi(size);
  if (len == 0)
    return 0;
  if (len == -1)
    return -1;
  buffer = (char *)calloc(len + 1, 1);
  ret = read(incoming, buffer, len);
  if (ret < 0)
    return -1;
  ret = write_net(network, buffer, len);
  return (ret == len) ? 0 : -1;
}
```
user: What is the c source code of the assembly code below:

```asm
<send_message>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %edi,%ebp
  mov    %esi,%r13d
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0xe(%rsp),%rdi
  mov    $0xa,%esi
  call   <bzero@plt>
  lea    0xd(%rsp),%rsi
  mov    $0x1,%edx
  mov    %ebp,%edi
  call   <read@plt>
  test   %eax,%eax
  jle    L49
  lea    0xe(%rsp),%rbx
  lea    0xd(%rsp),%r12
L48:
  movzbl 0xd(%rsp),%eax
  cmp    $0x3b,%al
  je     L61
  add    $0x1,%rbx
  mov    %al,-0x1(%rbx)
  mov    $0x1,%edx
  mov    %r12,%rsi
  mov    %ebp,%edi
  call   <read@plt>
  test   %eax,%eax
  jg     L48
  mov    $0xffffffff,%ebx
L24:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L15
  mov    %ebx,%eax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L61:
  lea    0xe(%rsp),%rdi
  call   <atoi@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  je     L24
  cmp    $0xffffffff,%eax
  je     L24
  lea    0x1(%rax),%edi
  mov    $0x1,%esi
  call   <calloc@plt>
  mov    %rax,%r12
  mov    %ebx,%edx
  mov    %rax,%rsi
  mov    %ebp,%edi
  call   <read@plt>
  test   %eax,%eax
  js     L83
  mov    %ebx,%edx
  mov    %r12,%rsi
  mov    %r13d,%edi
  call   <write_net@plt>
  cmp    %eax,%ebx
  setne  %bl
  movzbl %bl,%ebx
  neg    %ebx
  jmp    L24
L49:
  mov    $0xffffffff,%ebx
  jmp    L24
L83:
  mov    $0xffffffff,%ebx
  jmp    L24
L15:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int send_message(int incoming, int network) {
  char size[10];
  char ch;
  char *ptr = size, *buffer = 0;
  int ret, len;
  bzero(size, sizeof(size));
  ret = read(incoming, &ch, 1);
  while (1) {
    if (ret <= 0)
      return -1;
    if (ch == ';')
      break;
    *ptr++ = ch;
    ret = read(incoming, &ch, 1);
  }
  len = atoi(size);
  if (len == 0)
    return 0;
  if (len == -1)
    return -1;
  buffer = (char *)calloc(len + 1, 1);
  ret = read(incoming, buffer, len);
  if (ret < 0)
    return -1;
  ret = write_net(network, buffer, len);
  return (ret == len) ? 0 : -1;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<send_message>:
  endbr64
  push   %r14
  mov    %esi,%r14d
  mov    $0xa,%esi
  push   %r13
  push   %r12
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0xe(%rsp),%r13
  lea    0xd(%rsp),%r12
  mov    %r13,%rdi
  mov    %r13,%rbx
  call   <bzero@plt>
  mov    $0x1,%edx
  mov    %r12,%rsi
  mov    %ebp,%edi
  call   <read@plt>
  test   %eax,%eax
  jg     L34
  jmp    L46
  nopl   0x0(%rax)
L57:
  mov    %al,(%rbx)
  mov    $0x1,%edx
  mov    %r12,%rsi
  mov    %ebp,%edi
  add    $0x1,%rbx
  call   <read@plt>
  test   %eax,%eax
  jle    L46
L34:
  movzbl 0xd(%rsp),%eax
  cmp    $0x3b,%al
  jne    L57
  mov    %r13,%rdi
  call   <atoi@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  je     L4
  cmp    $0xffffffff,%eax
  je     L46
  lea    0x1(%rax),%edi
  mov    $0x1,%esi
  call   <calloc@plt>
  mov    %r12d,%edx
  mov    %ebp,%edi
  mov    %rax,%rsi
  mov    %rax,%r13
  call   <read@plt>
  test   %eax,%eax
  js     L46
  mov    %r12d,%edx
  mov    %r13,%rsi
  mov    %r14d,%edi
  call   <write_net@plt>
  cmp    %eax,%r12d
  setne  %r12b
  movzbl %r12b,%r12d
  neg    %r12d
  jmp    L4
  nopl   (%rax)
L46:
  mov    $0xffffffff,%r12d
L4:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L16
  add    $0x20,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L16:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int send_message(int incoming, int network) {
  char size[10];
  char ch;
  char *ptr = size, *buffer = 0;
  int ret, len;
  bzero(size, sizeof(size));
  ret = read(incoming, &ch, 1);
  while (1) {
    if (ret <= 0)
      return -1;
    if (ch == ';')
      break;
    *ptr++ = ch;
    ret = read(incoming, &ch, 1);
  }
  len = atoi(size);
  if (len == 0)
    return 0;
  if (len == -1)
    return -1;
  buffer = (char *)calloc(len + 1, 1);
  ret = read(incoming, buffer, len);
  if (ret < 0)
    return -1;
  ret = write_net(network, buffer, len);
  return (ret == len) ? 0 : -1;
}
```