ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 下面的汇编指令对应的C源代码是什么:

```asm
<dmatrix>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %edi,%r13d
  mov    %esi,%r12d
  mov    %edx,0x4(%rsp)
  mov    %esi,%eax
  sub    %edi,%eax
  lea    0x1(%rax),%r14d
  sub    %edx,%ecx
  lea    0x1(%rcx),%ebx
  lea    0x10(,%rax,8),%edi
  call   <malloc@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L57
L14:
  movslq %r13d,%rax
  mov    %rax,%rsi
  mov    %rax,0x8(%rsp)
  mov    $0x1,%eax
  sub    %rsi,%rax
  lea    0x0(%rbp,%rax,8),%r15
  imul   %ebx,%r14d
  lea    0x8(,%r14,8),%edi
  call   <malloc@plt>
  mov    %rax,0x8(%rbp)
  test   %rax,%rax
  je     L30
L6:
  movslq 0x4(%rsp),%rdx
  mov    $0x1,%eax
  sub    %rdx,%rax
  shl    $0x3,%rax
  add    %rax,0x8(%rbp)
  lea    0x1(%r13),%eax
  cmp    %eax,%r12d
  jl     L39
  movslq %ebx,%rbx
  shl    $0x3,%rbx
  cltq
  lea    (%r15,%rax,8),%rax
  sub    %r13d,%r12d
  lea    -0x1(%r12),%edx
  add    0x8(%rsp),%rdx
  lea    0x10(%r15,%rdx,8),%rcx
L51:
  mov    %rbx,%rdx
  add    -0x8(%rax),%rdx
  mov    %rdx,(%rax)
  add    $0x8,%rax
  cmp    %rcx,%rax
  jne    L51
L39:
  mov    %r15,%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L57:
  lea    D1(%rip),%rdi
  call   <printf@plt>
  jmp    L14
L30:
  lea    D8(%rip),%rdi
  call   <printf@plt>
  jmp    L6
```

tool_calls: name: disassemble_data
arguments: data_tag: D1
data_type: string
name: disassemble_data
arguments: data_tag: D8
data_type: string

tool: D1: ERROR: allocation failure 1 in dmatrix


tool: D8: ERROR: allocation failure 2 in dmatrix


assistant: ```c
double **dmatrix(int nrl, int nrh, int ncl, int nch) {
  int i, nrow = nrh - nrl + 1, ncol = nch - ncl + 1;
  double **m;
  m = (double **)malloc((unsigned)(nrow + 1) * sizeof(double *));
  if (!m) {
    printf("ERROR: allocation failure 1 in dmatrix\n");
  }
  m += 1;
  m -= nrl;
  m[nrl] = (double *)malloc((unsigned)((nrow * ncol + 1) * sizeof(double)));
  if (!m[nrl]) {
    printf("ERROR: allocation failure 2 in dmatrix\n");
  }
  m[nrl] += 1;
  m[nrl] -= ncl;
  for (i = nrl + 1; i <= nrh; i++)
    m[i] = m[i - 1] + ncol;
  return (m);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<dmatrix>:
  endbr64
  push   %r15
  mov    %esi,%eax
  push   %r14
  sub    %edi,%eax
  movslq %edx,%r14
  push   %r13
  sub    %r14d,%ecx
  lea    0x1(%rax),%r15d
  push   %r12
  mov    %edi,%r12d
  lea    0x10(,%rax,8),%edi
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  lea    0x1(%rcx),%ebx
  sub    $0x18,%rsp
  call   <malloc@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L43
L5:
  imul   %ebx,%r15d
  movslq %r12d,%rdx
  mov    $0x1,%eax
  sub    %rdx,%rax
  mov    %rdx,0x8(%rsp)
  lea    0x0(%r13,%rax,8),%r8
  lea    0x8(,%r15,8),%edi
  mov    %r8,(%rsp)
  call   <malloc@plt>
  mov    (%rsp),%r8
  mov    0x8(%rsp),%rdx
  test   %rax,%rax
  mov    %rax,0x8(%r13)
  je     L56
L4:
  mov    $0x1,%ecx
  sub    %r14,%rcx
  lea    (%rax,%rcx,8),%rax
  mov    %rax,0x8(%r13)
  lea    0x1(%r12),%eax
  cmp    %eax,%ebp
  jl     L22
  sub    %r12d,%ebp
  movslq %ebx,%rcx
  cltq
  lea    -0x1(%rbp),%esi
  shl    $0x3,%rcx
  lea    (%r8,%rax,8),%rax
  add    %rsi,%rdx
  lea    0x10(%r8,%rdx,8),%rsi
L58:
  mov    -0x8(%rax),%rdx
  add    $0x8,%rax
  add    %rcx,%rdx
  mov    %rdx,-0x8(%rax)
  cmp    %rsi,%rax
  jne    L58
L22:
  add    $0x18,%rsp
  mov    %r8,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L43:
  lea    D0(%rip),%rdi
  call   <printf@plt>
  jmp    L5
  nopl   0x0(%rax)
L56:
  lea    D3(%rip),%rdi
  mov    %r8,0x8(%rsp)
  mov    %rdx,(%rsp)
  call   <printf@plt>
  mov    0x8(%r13),%rax
  mov    0x8(%rsp),%r8
  mov    (%rsp),%rdx
  jmp    L4
```

tool_calls: name: extract_symbolic_data
arguments: label: D0
type_infered: string
name: extract_symbolic_data
arguments: label: D3
type_infered: string

tool: D0: ERROR: allocation failure 1 in dmatrix


tool: D3: ERROR: allocation failure 2 in dmatrix


assistant: ```c
double **dmatrix(int nrl, int nrh, int ncl, int nch) {
  int i, nrow = nrh - nrl + 1, ncol = nch - ncl + 1;
  double **m;
  m = (double **)malloc((unsigned)(nrow + 1) * sizeof(double *));
  if (!m) {
    printf("ERROR: allocation failure 1 in dmatrix\n");
  }
  m += 1;
  m -= nrl;
  m[nrl] = (double *)malloc((unsigned)((nrow * ncol + 1) * sizeof(double)));
  if (!m[nrl]) {
    printf("ERROR: allocation failure 2 in dmatrix\n");
  }
  m[nrl] += 1;
  m[nrl] -= ncl;
  for (i = nrl + 1; i <= nrh; i++)
    m[i] = m[i - 1] + ncol;
  return (m);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<dmatrix>:
  endbr64
  push   %r15
  mov    %esi,%eax
  push   %r14
  movslq %edx,%r14
  sub    %edi,%eax
  push   %r13
  sub    %r14d,%ecx
  mov    %edi,%r13d
  lea    0x10(,%rax,8),%edi
  push   %r12
  lea    0x1(%rax),%r15d
  push   %rbp
  mov    %esi,%ebp
  lea    0x1(%rcx),%esi
  push   %rbx
  sub    $0x18,%rsp
  mov    %esi,0xc(%rsp)
  call   <malloc@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L4
L26:
  imul   0xc(%rsp),%r15d
  movslq %r13d,%rdx
  mov    $0x1,%eax
  sub    %rdx,%rax
  lea    (%rbx,%rax,8),%r12
  lea    0x8(,%r15,8),%edi
  call   <malloc@plt>
  mov    %rax,0x8(%rbx)
  test   %rax,%rax
  je     L14
L42:
  mov    $0x1,%edx
  movslq 0xc(%rsp),%rcx
  add    $0x1,%r13d
  sub    %r14,%rdx
  lea    (%rax,%rdx,8),%rdx
  shl    $0x3,%rcx
  movslq %r13d,%rax
  mov    %rdx,0x8(%rbx)
  cmp    %r13d,%ebp
  jl     L45
L46:
  add    %rcx,%rdx
  mov    %rdx,(%r12,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%ebp
  jge    L46
L45:
  add    $0x18,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L4:
  lea    D6(%rip),%rdi
  call   <printf@plt>
  jmp    L26
  nopl   0x0(%rax)
L14:
  lea    D7(%rip),%rdi
  call   <printf@plt>
  mov    0x8(%rbx),%rax
  jmp    L42
```

tool_calls: name: retrieve_data
arguments: data_label: D6
type_infered: string
name: retrieve_data
arguments: data_label: D7
type_infered: string

tool: D6: ERROR: allocation failure 1 in dmatrix


tool: D7: ERROR: allocation failure 2 in dmatrix


assistant: ```c
double **dmatrix(int nrl, int nrh, int ncl, int nch) {
  int i, nrow = nrh - nrl + 1, ncol = nch - ncl + 1;
  double **m;
  m = (double **)malloc((unsigned)(nrow + 1) * sizeof(double *));
  if (!m) {
    printf("ERROR: allocation failure 1 in dmatrix\n");
  }
  m += 1;
  m -= nrl;
  m[nrl] = (double *)malloc((unsigned)((nrow * ncol + 1) * sizeof(double)));
  if (!m[nrl]) {
    printf("ERROR: allocation failure 2 in dmatrix\n");
  }
  m[nrl] += 1;
  m[nrl] -= ncl;
  for (i = nrl + 1; i <= nrh; i++)
    m[i] = m[i - 1] + ncol;
  return (m);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<doIp>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movb   $0x8,-0x19(%rbp)
  lea    -0x10(%rbp),%rax
  mov    $0x8,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  movb   $0x0,-0x19(%rbp)
  jmp    L27
L18:
  movzbl -0x19(%rbp),%edx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x1a(%rbp)
  lea    -0x10(%rbp),%rax
  add    $0x3,%rax
  mov    %rax,-0x18(%rbp)
  movb   $0x4,-0x1c(%rbp)
L16:
  movb   $0x0,-0x1b(%rbp)
  jmp    L0
L30:
  movzbl -0x1b(%rbp),%edx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  movzbl -0x1b(%rbp),%ecx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  shr    %dl
  mov    %dl,(%rax)
  movzbl -0x1a(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  je     L8
  movzbl -0x1b(%rbp),%edx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  movzbl -0x1b(%rbp),%ecx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  or     $0xffffff80,%edx
  mov    %dl,(%rax)
L8:
  shrb   -0x1a(%rbp)
  addb   $0x4,-0x1b(%rbp)
L0:
  cmpb   $0x4,-0x1b(%rbp)
  jbe    L30
  subq   $0x1,-0x18(%rbp)
  subb   $0x1,-0x1c(%rbp)
  cmpb   $0x0,-0x1c(%rbp)
  jne    L16
  movzbl -0x19(%rbp),%eax
  add    $0x1,%eax
  mov    %al,-0x19(%rbp)
L27:
  cmpb   $0x7,-0x19(%rbp)
  jbe    L18
  lea    -0x10(%rbp),%rcx
  mov    -0x28(%rbp),%rax
  mov    $0x8,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L24
  call   <__stack_chk_fail@plt>
L24:
  leave
  ret
```

assistant: ```c
void doIp(unsigned char data[]) {
  unsigned char j, k;
  unsigned char val;
  unsigned char buf[8];
  unsigned char *p;
  unsigned char i = 8;
  memset(buf, 0, sizeof(buf));
  for (i = 0; i < 8; i++) {
    val = data[i];
    p = &buf[3];
    j = 4;
    do {
      for (k = 0; k <= 4; k += 4) {
        p[k] >>= 1;
        if (val & 1) {
          p[k] |= 0x80;
        }
        val >>= 1;
      }
      p--;
    } while (--j);
  }
  memcpy(data, buf, 8);
}
```
user: What is the c source code of the assembly code below:

```asm
<doIp>:
  endbr64
  push   %rbx
  sub    $0x10,%rsp
  mov    %rdi,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rdi
  mov    $0x8,%edx
  mov    $0x0,%esi
  call   <memset@plt>
  mov    %rbx,%r8
  lea    0x8(%rbx),%r9
  lea    -0x1(%rsp),%rdi
L22:
  movzbl (%r8),%ecx
  lea    0x3(%rsp),%rax
L21:
  movzbl (%rax),%edx
  shr    %dl
  mov    %edx,%esi
  or     $0xffffff80,%esi
  test   $0x1,%cl
  cmovne %esi,%edx
  mov    %dl,(%rax)
  movzbl 0x4(%rax),%edx
  shr    %dl
  mov    %edx,%esi
  or     $0xffffff80,%esi
  test   $0x2,%cl
  cmovne %esi,%edx
  mov    %dl,0x4(%rax)
  shr    $0x2,%cl
  sub    $0x1,%rax
  cmp    %rdi,%rax
  jne    L21
  add    $0x1,%r8
  cmp    %r9,%r8
  jne    L22
  mov    %rsp,%rsi
  mov    $0x8,%edx
  mov    %rbx,%rdi
  call   <memcpy@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L13
  add    $0x10,%rsp
  pop    %rbx
  ret
L13:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void doIp(unsigned char data[]) {
  unsigned char j, k;
  unsigned char val;
  unsigned char buf[8];
  unsigned char *p;
  unsigned char i = 8;
  memset(buf, 0, sizeof(buf));
  for (i = 0; i < 8; i++) {
    val = data[i];
    p = &buf[3];
    j = 4;
    do {
      for (k = 0; k <= 4; k += 4) {
        p[k] >>= 1;
        if (val & 1) {
          p[k] |= 0x80;
        }
        val >>= 1;
      }
      p--;
    } while (--j);
  }
  memcpy(data, buf, 8);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<doIp>:
  endbr64
  push   %r12
  mov    $0x8,%edx
  xor    %esi,%esi
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r12
  mov    %r12,%rdi
  call   <memset@plt>
  mov    %rbp,%r8
  lea    0x8(%rbp),%r10
  lea    0x3(%rsp),%r9
  lea    -0x1(%rsp),%rdi
  nopl   0x0(%rax)
L27:
  movzbl (%r8),%ecx
  mov    %r9,%rax
L14:
  movzbl (%rax),%edx
  shr    %dl
  mov    %edx,%esi
  or     $0xffffff80,%esi
  test   $0x1,%cl
  cmovne %esi,%edx
  mov    %dl,(%rax)
  movzbl 0x4(%rax),%edx
  shr    %dl
  mov    %edx,%esi
  or     $0xffffff80,%esi
  test   $0x2,%cl
  cmovne %esi,%edx
  sub    $0x1,%rax
  shr    $0x2,%cl
  mov    %dl,0x5(%rax)
  cmp    %rdi,%rax
  jne    L14
  add    $0x1,%r8
  cmp    %r8,%r10
  jne    L27
  mov    $0x8,%edx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <memcpy@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L4
  add    $0x18,%rsp
  pop    %rbp
  pop    %r12
  ret
L4:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void doIp(unsigned char data[]) {
  unsigned char j, k;
  unsigned char val;
  unsigned char buf[8];
  unsigned char *p;
  unsigned char i = 8;
  memset(buf, 0, sizeof(buf));
  for (i = 0; i < 8; i++) {
    val = data[i];
    p = &buf[3];
    j = 4;
    do {
      for (k = 0; k <= 4; k += 4) {
        p[k] >>= 1;
        if (val & 1) {
          p[k] |= 0x80;
        }
        val >>= 1;
      }
      p--;
    } while (--j);
  }
  memcpy(data, buf, 8);
}
```
user: Translate the below assembly code into C programming language:

```asm
<doIp>:
  endbr64
  push   %r14
  mov    $0x8,%edx
  xor    %esi,%esi
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  lea    0x8(%rbp),%r14
  mov    %rbp,%rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r12
  mov    %r12,%rdi
  call   <memset@plt>
  movzbl 0x3(%rsp),%r8d
  movzbl 0x7(%rsp),%edx
  movzbl 0x2(%rsp),%edi
  movzbl 0x6(%rsp),%r11d
  movzbl 0x1(%rsp),%esi
  movzbl 0x5(%rsp),%r10d
  movzbl (%rsp),%ecx
  movzbl 0x4(%rsp),%r9d
  nopw   0x0(%rax,%rax,1)
L18:
  movzbl (%rbx),%eax
  shr    %r8b
  mov    %r8d,%r13d
  or     $0xffffff80,%r13d
  test   $0x1,%al
  cmovne %r13d,%r8d
  shr    %dl
  mov    %edx,%r13d
  or     $0xffffff80,%r13d
  test   $0x2,%al
  cmovne %r13d,%edx
  shr    %dil
  mov    %edi,%r13d
  or     $0xffffff80,%r13d
  test   $0x4,%al
  cmovne %r13d,%edi
  shr    %r11b
  mov    %r11d,%r13d
  or     $0xffffff80,%r13d
  test   $0x8,%al
  cmovne %r13d,%r11d
  shr    %sil
  mov    %esi,%r13d
  or     $0xffffff80,%r13d
  test   $0x10,%al
  cmovne %r13d,%esi
  shr    %r10b
  mov    %r10d,%r13d
  or     $0xffffff80,%r13d
  test   $0x20,%al
  cmovne %r13d,%r10d
  shr    %cl
  mov    %ecx,%r13d
  or     $0xffffff80,%r13d
  test   $0x40,%al
  cmovne %r13d,%ecx
  shr    %r9b
  mov    %r9d,%r13d
  or     $0xffffff80,%r13d
  test   %al,%al
  cmovs  %r13d,%r9d
  add    $0x1,%rbx
  cmp    %r14,%rbx
  jne    L18
  movzbl %dl,%eax
  movzbl %r11b,%r11d
  movzbl %r10b,%r10d
  movzbl %r9b,%r9d
  shl    $0x8,%rax
  movzbl %r8b,%r8d
  movzbl %dil,%edi
  movzbl %sil,%esi
  or     %r11,%rax
  movzbl %cl,%ecx
  mov    $0x8,%edx
  shl    $0x8,%rax
  or     %r10,%rax
  shl    $0x8,%rax
  or     %r9,%rax
  shl    $0x8,%rax
  or     %r8,%rax
  shl    $0x8,%rax
  or     %rdi,%rax
  mov    %rbp,%rdi
  shl    $0x8,%rax
  or     %rsi,%rax
  mov    %r12,%rsi
  shl    $0x8,%rax
  or     %rcx,%rax
  mov    %rax,(%rsp)
  call   <memcpy@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L4
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L4:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void doIp(unsigned char data[]) {
  unsigned char j, k;
  unsigned char val;
  unsigned char buf[8];
  unsigned char *p;
  unsigned char i = 8;
  memset(buf, 0, sizeof(buf));
  for (i = 0; i < 8; i++) {
    val = data[i];
    p = &buf[3];
    j = 4;
    do {
      for (k = 0; k <= 4; k += 4) {
        p[k] >>= 1;
        if (val & 1) {
          p[k] |= 0x80;
        }
        val >>= 1;
      }
      p--;
    } while (--j);
  }
  memcpy(data, buf, 8);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x38(%rbp),%rax
  mov    %rax,%rsi
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x20(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  movl   $0x0,-0x30(%rbp)
  jmp    L3
L72:
  lea    -0x28(%rbp),%rdx
  lea    -0x34(%rbp),%rax
  mov    %rax,%rsi
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  mov    -0x34(%rbp),%eax
  cmp    $0x3,%eax
  je     L96
  cmp    $0x3,%eax
  jg     L28
  cmp    $0x1,%eax
  je     L11
  cmp    $0x2,%eax
  je     L34
  jmp    L28
L11:
  movsd  -0x28(%rbp),%xmm0
  movsd  -0x20(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x20(%rbp)
  jmp    L28
L34:
  movsd  -0x28(%rbp),%xmm0
  movsd  -0x18(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  jmp    L28
L96:
  movsd  -0x20(%rbp),%xmm0
  addsd  -0x18(%rbp),%xmm0
  movsd  %xmm0,-0x10(%rbp)
  movsd  -0x20(%rbp),%xmm0
  mulsd  -0x10(%rbp),%xmm0
  movsd  -0x28(%rbp),%xmm1
  mulsd  -0x20(%rbp),%xmm1
  subsd  %xmm1,%xmm0
  divsd  -0x10(%rbp),%xmm0
  movsd  %xmm0,-0x20(%rbp)
  movsd  -0x18(%rbp),%xmm0
  mulsd  -0x10(%rbp),%xmm0
  movsd  -0x28(%rbp),%xmm1
  mulsd  -0x18(%rbp),%xmm1
  subsd  %xmm1,%xmm0
  divsd  -0x10(%rbp),%xmm0
  movsd  %xmm0,-0x18(%rbp)
  nop
L28:
  addl   $0x1,-0x30(%rbp)
L3:
  mov    -0x38(%rbp),%eax
  cmp    %eax,-0x30(%rbp)
  jl     L72
  movsd  -0x18(%rbp),%xmm1
  movsd  D29(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  -0x20(%rbp),%xmm1
  addsd  -0x18(%rbp),%xmm1
  divsd  %xmm1,%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  call   <floor@plt>
  mov    %eax,-0x2c(%rbp)
  mov    -0x2c(%rbp),%eax
  mov    %eax,%esi
  lea    D17(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L20
  call   <__stack_chk_fail@plt>
L20:
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_label: D2
datatype: string
name: parse_data
arguments: data_label: D9
datatype: string
name: parse_data
arguments: data_label: D29
datatype: f64
name: parse_data
arguments: data_label: D17
datatype: string

tool: D2: %d

tool: D9: %d %lf

tool: D29: 100

tool: D17: %d


assistant: ```c
int main(void) {
  int n, i, t, ans;
  double w, c, s, wc;
  scanf("%d", &n);
  w = 0.0;
  c = 0.0;
  for (i = 0; i < n; i++) {
    scanf("%d %lf", &t, &s);
    switch (t) {
    case 1:
      w += s;
      break;
    case 2:
      c += s;
      break;
    case 3:
      wc = w + c;
      w = (w * wc - s * w) / wc;
      c = (c * wc - s * c) / wc;
      break;
    }
  }
  ans = (int)floor(100.0 * c / (w + c));
  printf("%d\n", ans);
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0x18(%rsp),%rsi
  lea    D29(%rip),%rdi
  call   <scanf@plt>
  cmpl   $0x0,0x18(%rsp)
  jle    L13
  pxor   %xmm6,%xmm6
  movsd  %xmm6,0x8(%rsp)
  movsd  %xmm6,(%rsp)
  mov    $0x0,%ebx
  lea    D16(%rip),%rbp
  jmp    L79
L9:
  movsd  0x8(%rsp),%xmm7
  addsd  0x20(%rsp),%xmm7
  movsd  %xmm7,0x8(%rsp)
L47:
  add    $0x1,%ebx
  cmp    %ebx,0x18(%rsp)
  jle    L30
L79:
  lea    0x20(%rsp),%rdx
  lea    0x1c(%rsp),%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  mov    0x1c(%rsp),%eax
  cmp    $0x2,%eax
  je     L9
  cmp    $0x3,%eax
  je     L8
  cmp    $0x1,%eax
  jne    L47
  movsd  (%rsp),%xmm6
  addsd  0x20(%rsp),%xmm6
  movsd  %xmm6,(%rsp)
  jmp    L47
L8:
  movsd  (%rsp),%xmm4
  movapd %xmm4,%xmm0
  movsd  0x8(%rsp),%xmm5
  addsd  %xmm5,%xmm0
  movsd  0x20(%rsp),%xmm1
  movapd %xmm4,%xmm2
  mulsd  %xmm0,%xmm2
  mulsd  %xmm1,%xmm4
  subsd  %xmm4,%xmm2
  divsd  %xmm0,%xmm2
  movsd  %xmm2,(%rsp)
  movapd %xmm5,%xmm2
  mulsd  %xmm0,%xmm2
  mulsd  %xmm5,%xmm1
  subsd  %xmm1,%xmm2
  divsd  %xmm0,%xmm2
  movsd  %xmm2,0x8(%rsp)
  jmp    L47
L13:
  pxor   %xmm7,%xmm7
  movsd  %xmm7,0x8(%rsp)
  movsd  %xmm7,(%rsp)
L30:
  movsd  0x8(%rsp),%xmm3
  movapd %xmm3,%xmm0
  mulsd  D19(%rip),%xmm0
  movsd  (%rsp),%xmm1
  addsd  %xmm3,%xmm1
  divsd  %xmm1,%xmm0
  call   <floor@plt>
  mov    %eax,%esi
  lea    D38(%rip),%rdi
  call   <printf@plt>
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L3
  mov    $0x0,%eax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  ret
L3:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D29
type: string
name: parse_data
arguments: data_tag: D16
type: string
name: parse_data
arguments: data_tag: D19
type: f64
name: parse_data
arguments: data_tag: D38
type: string

tool: D29: %d

tool: D16: %d %lf

tool: D19: 100

tool: D38: %d


assistant: ```c
int main(void) {
  int n, i, t, ans;
  double w, c, s, wc;
  scanf("%d", &n);
  w = 0.0;
  c = 0.0;
  for (i = 0; i < n; i++) {
    scanf("%d %lf", &t, &s);
    switch (t) {
    case 1:
      w += s;
      break;
    case 2:
      c += s;
      break;
    case 3:
      wc = w + c;
      w = (w * wc - s * w) / wc;
      c = (c * wc - s * c) / wc;
      break;
    }
  }
  ans = (int)floor(100.0 * c / (w + c));
  printf("%d\n", ans);
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<main>:
  endbr64
  push   %r13
  lea    D10(%rip),%rdi
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0x18(%rsp),%rsi
  call   <scanf@plt>
  mov    0x18(%rsp),%eax
  test   %eax,%eax
  jle    L36
  pxor   %xmm6,%xmm6
  lea    0x20(%rsp),%r13
  lea    0x1c(%rsp),%r12
  xor    %ebx,%ebx
  movsd  %xmm6,0x8(%rsp)
  lea    D16(%rip),%rbp
  movsd  %xmm6,(%rsp)
  jmp    L100
  nop
L51:
  cmp    $0x1,%eax
  je     L103
L17:
  add    $0x1,%ebx
  cmp    %ebx,0x18(%rsp)
  jle    L64
L100:
  mov    %r13,%rdx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <scanf@plt>
  mov    0x1c(%rsp),%eax
  cmp    $0x2,%eax
  je     L97
  cmp    $0x3,%eax
  jne    L51
  movsd  (%rsp),%xmm4
  movsd  0x8(%rsp),%xmm5
  add    $0x1,%ebx
  movsd  0x20(%rsp),%xmm1
  movapd %xmm4,%xmm0
  movapd %xmm4,%xmm2
  addsd  %xmm5,%xmm0
  mulsd  %xmm1,%xmm4
  mulsd  %xmm5,%xmm1
  mulsd  %xmm0,%xmm2
  subsd  %xmm4,%xmm2
  divsd  %xmm0,%xmm2
  movsd  %xmm2,(%rsp)
  movapd %xmm5,%xmm2
  mulsd  %xmm0,%xmm2
  subsd  %xmm1,%xmm2
  divsd  %xmm0,%xmm2
  movsd  %xmm2,0x8(%rsp)
  cmp    %ebx,0x18(%rsp)
  jg     L100
L64:
  movsd  0x8(%rsp),%xmm3
  movsd  D8(%rip),%xmm0
  movsd  (%rsp),%xmm1
  mulsd  %xmm3,%xmm0
  addsd  %xmm3,%xmm1
  divsd  %xmm1,%xmm0
  call   <floor@plt>
  lea    D31(%rip),%rdi
  mov    %eax,%esi
  call   <printf@plt>
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L45
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax,%rax,1)
L97:
  movsd  0x8(%rsp),%xmm7
  addsd  0x20(%rsp),%xmm7
  movsd  %xmm7,0x8(%rsp)
  jmp    L17
  nopw   0x0(%rax,%rax,1)
L103:
  movsd  (%rsp),%xmm6
  addsd  0x20(%rsp),%xmm6
  movsd  %xmm6,(%rsp)
  jmp    L17
L36:
  pxor   %xmm7,%xmm7
  movsd  %xmm7,0x8(%rsp)
  movsd  %xmm7,(%rsp)
  jmp    L64
L45:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: tag: D10
type_infered: string
name: read_data
arguments: tag: D16
type_infered: string
name: read_data
arguments: tag: D8
type_infered: f64
name: read_data
arguments: tag: D31
type_infered: string

tool: D10: %d

tool: D16: %d %lf

tool: D8: 100

tool: D31: %d


assistant: ```c
int main(void) {
  int n, i, t, ans;
  double w, c, s, wc;
  scanf("%d", &n);
  w = 0.0;
  c = 0.0;
  for (i = 0; i < n; i++) {
    scanf("%d %lf", &t, &s);
    switch (t) {
    case 1:
      w += s;
      break;
    case 2:
      c += s;
      break;
    case 3:
      wc = w + c;
      w = (w * wc - s * w) / wc;
      c = (c * wc - s * c) / wc;
      break;
    }
  }
  ans = (int)floor(100.0 * c / (w + c));
  printf("%d\n", ans);
  return 0;
}
```