ylfeng/ReF-Decompile-dataset huggingface dataset:
user: What would the C source look like for the assembly code provided here:

```asm
<durationtolong>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rdi,(%rsp)
  mov    $0x0,%r12d
  mov    %rsp,%rbp
  lea    D9(%rip),%r13
L79:
  mov    (%rsp),%rbx
  cmpb   $0x0,(%rbx)
  je     L55
  mov    $0xa,%edx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <strtol@plt>
  mov    (%rsp),%rdx
  cmp    %rbx,%rdx
  je     L55
  test   %eax,%eax
  je     L79
  lea    0x1(%rdx),%rcx
  mov    %rcx,(%rsp)
  movzbl (%rdx),%ecx
  test   %cl,%cl
  je     L5
  lea    -0x4d(%rcx),%edx
  cmp    $0x2c,%dl
  ja     L79
  ja     L79
  movzbl %dl,%ecx
  movslq 0x0(%r13,%rcx,4),%rdx
  add    %r13,%rdx
  notrack jmp *%rdx
L5:
  mov    %rdx,(%rsp)
  add    %eax,%r12d
  jmp    L79
  imul   $0x3c,%eax,%eax
  add    %eax,%r12d
  jmp    L79
  imul   $0xe10,%eax,%eax
  add    %eax,%r12d
  jmp    L79
  imul   $0x15180,%eax,%eax
  add    %eax,%r12d
  jmp    L79
  imul   $0x93a80,%eax,%eax
  add    %eax,%r12d
  jmp    L79
  imul   $0x278d00,%eax,%eax
  add    %eax,%r12d
  jmp    L79
  imul   $0x1e187e0,%eax,%eax
  add    %eax,%r12d
  jmp    L79
L55:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L6
  mov    %r12d,%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L6:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int durationtolong(const char *string) {
  int total = 0;
  int current = 0;
  char *ch = (char *)string, *och;
  while (*ch) {
    och = ch;
    current = strtol(ch, &ch, 10);
    if (och == ch)
      break;
    if (current) {
      switch (*ch++) {
      case '\0':
        ch--;
      case 's':
        total += current;
        break;
      case 'm':
        total += (current * 60);
        break;
      case 'h':
        total += (current * 3600);
        break;
      case 'd':
        total += (current * 86400);
        break;
      case 'w':
        total += (current * 604800);
        break;
      case 'M':
        total += (current * 2592000);
        break;
      case 'y':
        total += (current * 31557600);
      }
    }
  }
  return total;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<durationtolong>:
  endbr64
  push   %r13
  lea    D9(%rip),%r13
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbp
  mov    %rdi,(%rsp)
  jmp    L116
  nopl   0x0(%rax)
L12:
  mov    $0xa,%edx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <strtol@plt>
  mov    (%rsp),%rdx
  cmp    %rbx,%rdx
  je     L94
  mov    %rdx,%rbx
  test   %eax,%eax
  jne    L136
L116:
  cmpb   $0x0,(%rbx)
  jne    L12
L94:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L81
  add    $0x18,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nop
L136:
  lea    0x1(%rdx),%rbx
  mov    %rbx,(%rsp)
  movzbl (%rdx),%ecx
  test   %cl,%cl
  je     L125
  lea    -0x4d(%rcx),%edx
  cmp    $0x2c,%dl
  ja     L116
  movzbl %dl,%edx
  movslq 0x0(%r13,%rdx,4),%rdx
  add    %r13,%rdx
  notrack jmp *%rdx
  imul   $0x1e187e0,%eax,%eax
L69:
  add    %eax,%r12d
  jmp    L116
  imul   $0x3c,%eax,%eax
  add    %eax,%r12d
  jmp    L116
  imul   $0xe10,%eax,%eax
  add    %eax,%r12d
  jmp    L116
  imul   $0x15180,%eax,%eax
  add    %eax,%r12d
  jmp    L116
  imul   $0x278d00,%eax,%eax
  add    %eax,%r12d
  jmp    L116
  imul   $0x93a80,%eax,%eax
  add    %eax,%r12d
  jmp    L116
L125:
  mov    %rdx,(%rsp)
  mov    %rdx,%rbx
  jmp    L69
L81:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int durationtolong(const char *string) {
  int total = 0;
  int current = 0;
  char *ch = (char *)string, *och;
  while (*ch) {
    och = ch;
    current = strtol(ch, &ch, 10);
    if (och == ch)
      break;
    if (current) {
      switch (*ch++) {
      case '\0':
        ch--;
      case 's':
        total += current;
        break;
      case 'm':
        total += (current * 60);
        break;
      case 'h':
        total += (current * 3600);
        break;
      case 'd':
        total += (current * 86400);
        break;
      case 'w':
        total += (current * 604800);
        break;
      case 'M':
        total += (current * 2592000);
        break;
      case 'y':
        total += (current * 31557600);
      }
    }
  }
  return total;
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<durationtolong>:
  endbr64
  push   %r13
  lea    D3(%rip),%r13
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbp
  mov    %rdi,(%rsp)
  jmp    L6
  nopl   0x0(%rax)
L52:
  mov    $0xa,%edx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <strtol@plt>
  mov    (%rsp),%rdx
  cmp    %rbx,%rdx
  je     L29
  mov    %rdx,%rbx
  test   %eax,%eax
  jne    L128
L6:
  cmpb   $0x0,(%rbx)
  jne    L52
L29:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L34
  add    $0x18,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nop
L128:
  lea    0x1(%rdx),%rbx
  mov    %rbx,(%rsp)
  movzbl (%rdx),%ecx
  test   %cl,%cl
  je     L85
  lea    -0x4d(%rcx),%edx
  cmp    $0x2c,%dl
  ja     L6
  movzbl %dl,%edx
  movslq 0x0(%r13,%rdx,4),%rdx
  add    %r13,%rdx
  notrack jmp *%rdx
  imul   $0x1e187e0,%eax,%eax
L89:
  add    %eax,%r12d
  jmp    L6
  imul   $0x3c,%eax,%eax
  add    %eax,%r12d
  jmp    L6
  imul   $0xe10,%eax,%eax
  add    %eax,%r12d
  jmp    L6
  imul   $0x15180,%eax,%eax
  add    %eax,%r12d
  jmp    L6
  imul   $0x278d00,%eax,%eax
  add    %eax,%r12d
  jmp    L6
  imul   $0x93a80,%eax,%eax
  add    %eax,%r12d
  jmp    L6
L85:
  mov    %rdx,(%rsp)
  mov    %rdx,%rbx
  jmp    L89
L34:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int durationtolong(const char *string) {
  int total = 0;
  int current = 0;
  char *ch = (char *)string, *och;
  while (*ch) {
    och = ch;
    current = strtol(ch, &ch, 10);
    if (och == ch)
      break;
    if (current) {
      switch (*ch++) {
      case '\0':
        ch--;
      case 's':
        total += current;
        break;
      case 'm':
        total += (current * 60);
        break;
      case 'h':
        total += (current * 3600);
        break;
      case 'd':
        total += (current * 86400);
        break;
      case 'w':
        total += (current * 604800);
        break;
      case 'M':
        total += (current * 2592000);
        break;
      case 'y':
        total += (current * 31557600);
      }
    }
  }
  return total;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<Str2BCD>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,%eax
  mov    %al,-0x24(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  je     L28
  cmpq   $0x0,-0x20(%rbp)
  je     L28
  movl   $0x0,-0x4(%rbp)
  movl   $0x0,-0x8(%rbp)
  jmp    L21
L43:
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0xb(%rbp)
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  and    $0xf,%eax
  mov    %al,-0xa(%rbp)
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  shr    $0x4,%al
  mov    %al,-0x9(%rbp)
  cmpb   $0x9,-0x9(%rbp)
  ja     L5
  mov    -0x4(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x4(%rbp)
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl -0x9(%rbp),%edx
  add    $0x30,%edx
  mov    %dl,(%rax)
  jmp    L68
L5:
  mov    -0x4(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x4(%rbp)
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl -0x9(%rbp),%edx
  add    $0x37,%edx
  mov    %dl,(%rax)
L68:
  cmpb   $0x9,-0xa(%rbp)
  ja     L64
  mov    -0x4(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x4(%rbp)
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl -0xa(%rbp),%edx
  add    $0x30,%edx
  mov    %dl,(%rax)
  jmp    L66
L64:
  mov    -0x4(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x4(%rbp)
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl -0xa(%rbp),%edx
  add    $0x37,%edx
  mov    %dl,(%rax)
L66:
  addl   $0x1,-0x8(%rbp)
L21:
  movzbl -0x24(%rbp),%eax
  cmp    %eax,-0x8(%rbp)
  jl     L43
  jmp    L47
L28:
  nop
L47:
  pop    %rbp
  ret
```

assistant: ```c
void Str2BCD(unsigned char *dst, char *src, unsigned char length) {
  int i, j;
  unsigned char lo_nibble, hi_nibble;
  char c;
  if ((dst == NULL) || (src == NULL)) {
    return;
  }
  j = 0;
  for (i = 0; i < length; i++) {
    c = src[i];
    lo_nibble = src[i] & 0x0f;
    hi_nibble = (src[i] >> 4) & 0x0f;
    if ((hi_nibble >= 0x0) && (hi_nibble <= 0x09)) {
      dst[j++] = hi_nibble + 0x30;
    } else {
      dst[j++] = hi_nibble + 'A' - 10;
    }
    if ((lo_nibble >= 0x0) && (lo_nibble <= 0x09)) {
      dst[j++] = lo_nibble + 0x30;
    } else {
      dst[j++] = lo_nibble + 'A' - 10;
    }
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<Str2BCD>:
  endbr64
  mov    %rdi,%r9
  mov    %rsi,%r10
  test   %rdi,%rdi
  je     L40
  test   %rsi,%rsi
  je     L40
  and    $0xff,%edx
  je     L40
  mov    $0x1,%r8d
  mov    $0x0,%eax
  jmp    L15
L52:
  mov    %r8d,%esi
  add    $0x37,%edi
  mov    %dil,(%r9,%rax,2)
  jmp    L64
L48:
  movslq %esi,%rsi
  add    $0x37,%ecx
  mov    %cl,(%r9,%rsi,1)
L18:
  add    $0x1,%rax
  add    $0x2,%r8d
  cmp    %eax,%edx
  jle    L40
L15:
  movzbl (%r10,%rax,1),%esi
  mov    %esi,%ecx
  and    $0xf,%ecx
  mov    %esi,%edi
  shr    $0x4,%dil
  cmp    $0x9f,%sil
  ja     L52
  mov    %r8d,%esi
  add    $0x30,%edi
  mov    %dil,(%r9,%rax,2)
L64:
  cmp    $0x9,%cl
  ja     L48
  movslq %esi,%rsi
  add    $0x30,%ecx
  mov    %cl,(%r9,%rsi,1)
  jmp    L18
L40:
  ret
```

assistant: ```c
void Str2BCD(unsigned char *dst, char *src, unsigned char length) {
  int i, j;
  unsigned char lo_nibble, hi_nibble;
  char c;
  if ((dst == NULL) || (src == NULL)) {
    return;
  }
  j = 0;
  for (i = 0; i < length; i++) {
    c = src[i];
    lo_nibble = src[i] & 0x0f;
    hi_nibble = (src[i] >> 4) & 0x0f;
    if ((hi_nibble >= 0x0) && (hi_nibble <= 0x09)) {
      dst[j++] = hi_nibble + 0x30;
    } else {
      dst[j++] = hi_nibble + 'A' - 10;
    }
    if ((lo_nibble >= 0x0) && (lo_nibble <= 0x09)) {
      dst[j++] = lo_nibble + 0x30;
    } else {
      dst[j++] = lo_nibble + 'A' - 10;
    }
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<Str2BCD>:
  endbr64
  mov    %rdi,%r8
  mov    %rsi,%r10
  test   %rdi,%rdi
  je     L25
  test   %rsi,%rsi
  je     L25
  and    $0xff,%edx
  je     L25
  xor    %ecx,%ecx
  xchg   %ax,%ax
L19:
  movzbl (%r10,%rcx,1),%eax
  mov    %eax,%esi
  shr    $0x4,%al
  lea    0x30(%rax),%r9d
  and    $0xf,%esi
  lea    0x37(%rax),%edi
  cmp    $0x9,%al
  mov    %r9d,%eax
  cmova  %edi,%eax
  cmp    $0x9,%sil
  lea    0x30(%rsi),%edi
  mov    %al,(%r8,%rcx,2)
  lea    0x37(%rsi),%eax
  cmovbe %edi,%eax
  mov    %al,0x1(%r8,%rcx,2)
  add    $0x1,%rcx
  cmp    %ecx,%edx
  jg     L19
L25:
  ret
```

assistant: ```c
void Str2BCD(unsigned char *dst, char *src, unsigned char length) {
  int i, j;
  unsigned char lo_nibble, hi_nibble;
  char c;
  if ((dst == NULL) || (src == NULL)) {
    return;
  }
  j = 0;
  for (i = 0; i < length; i++) {
    c = src[i];
    lo_nibble = src[i] & 0x0f;
    hi_nibble = (src[i] >> 4) & 0x0f;
    if ((hi_nibble >= 0x0) && (hi_nibble <= 0x09)) {
      dst[j++] = hi_nibble + 0x30;
    } else {
      dst[j++] = hi_nibble + 'A' - 10;
    }
    if ((lo_nibble >= 0x0) && (lo_nibble <= 0x09)) {
      dst[j++] = lo_nibble + 0x30;
    } else {
      dst[j++] = lo_nibble + 'A' - 10;
    }
  }
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<hang>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
L7:
  cli
  hlt
  jmp    L7
```

assistant: ```c
void hang() {
  for (;;)
    __asm__ volatile("cli\n"
                     "hlt\n");
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<hang>:
  endbr64
L2:
  cli
  hlt
  jmp    L2
```

assistant: ```c
void hang() {
  for (;;)
    __asm__ volatile("cli\n"
                     "hlt\n");
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<hang>:
  endbr64
  nopl   0x0(%rax)
L6:
  cli
  hlt
  jmp    L6
```

assistant: ```c
void hang() {
  for (;;)
    __asm__ volatile("cli\n"
                     "hlt\n");
}
```
user: Translate the below assembly code into C programming language:

```asm
<hang>:
  endbr64
  nopl   0x0(%rax)
L7:
  cli
  hlt
  jmp    L7
```

assistant: ```c
void hang() {
  for (;;)
    __asm__ volatile("cli\n"
                     "hlt\n");
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<read_httpget_data>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    -0x20(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x18(%rbp),%rax
  mov    $0x3f,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  je     L3
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    -0x28(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
L3:
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  leave
  ret
```

assistant: ```c
int read_httpget_data(char *buf, char *data, size_t datalen) {
  char *datastr;
  *data = 0;
  if ((datastr = strchr(buf, '?')) != NULL) {
    strncpy(data, datastr + 1, datalen);
  }
  return strlen(data);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<read_httpget_data>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rsi,%rbx
  mov    %rdx,%rbp
  movb   $0x0,(%rsi)
  mov    $0x3f,%esi
  call   <strchr@plt>
  test   %rax,%rax
  je     L9
  lea    0x1(%rax),%rsi
  mov    %rbp,%rdx
  mov    %rbx,%rdi
  call   <strncpy@plt>
L9:
  mov    %rbx,%rdi
  call   <strlen@plt>
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
int read_httpget_data(char *buf, char *data, size_t datalen) {
  char *datastr;
  *data = 0;
  if ((datastr = strchr(buf, '?')) != NULL) {
    strncpy(data, datastr + 1, datalen);
  }
  return strlen(data);
}
```
user: What is the c source code of the assembly code below:

```asm
<read_httpget_data>:
  endbr64
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %rsi,%rbp
  sub    $0x8,%rsp
  movb   $0x0,(%rsi)
  mov    $0x3f,%esi
  call   <strchr@plt>
  test   %rax,%rax
  je     L0
  lea    0x1(%rax),%rsi
  mov    %r12,%rdx
  mov    %rbp,%rdi
  call   <strncpy@plt>
L0:
  add    $0x8,%rsp
  mov    %rbp,%rdi
  pop    %rbp
  pop    %r12
  jmp    1080 <strlen@plt>
```

assistant: ```c
int read_httpget_data(char *buf, char *data, size_t datalen) {
  char *datastr;
  *data = 0;
  if ((datastr = strchr(buf, '?')) != NULL) {
    strncpy(data, datastr + 1, datalen);
  }
  return strlen(data);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<read_httpget_data>:
  endbr64
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %rsi,%rbp
  sub    $0x8,%rsp
  movb   $0x0,(%rsi)
  mov    $0x3f,%esi
  call   <strchr@plt>
  test   %rax,%rax
  je     L4
  lea    0x1(%rax),%rsi
  mov    %r12,%rdx
  mov    %rbp,%rdi
  call   <strncpy@plt>
L4:
  add    $0x8,%rsp
  mov    %rbp,%rdi
  pop    %rbp
  pop    %r12
  jmp    1080 <strlen@plt>
```

assistant: ```c
int read_httpget_data(char *buf, char *data, size_t datalen) {
  char *datastr;
  *data = 0;
  if ((datastr = strchr(buf, '?')) != NULL) {
    strncpy(data, datastr + 1, datalen);
  }
  return strlen(data);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<read_matrix>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %rcx,-0x50(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x38(%rbp),%rax
  lea    D1(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x48(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  lea    D30(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fscanf@plt>
  mov    -0x50(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  lea    D30(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fscanf@plt>
  mov    -0x48(%rbp),%rax
  mov    (%rax),%eax
  cltq
  mov    %eax,%edx
  mov    -0x50(%rbp),%rax
  mov    (%rax),%eax
  cltq
  imul   %edx,%eax
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  movl   $0x0,-0x1c(%rbp)
  jmp    L8
L36:
  movl   $0x0,-0x20(%rbp)
  jmp    L30
L23:
  lea    -0x24(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  lea    D34(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fscanf@plt>
  movss  -0x24(%rbp),%xmm0
  mov    -0x50(%rbp),%rax
  mov    (%rax),%eax
  imul   -0x1c(%rbp),%eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  cvtss2sd %xmm0,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x20(%rbp)
L30:
  mov    -0x50(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x20(%rbp)
  jl     L23
  addl   $0x1,-0x1c(%rbp)
L8:
  mov    -0x48(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x1c(%rbp)
  jl     L36
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <close@plt>
  mov    -0x40(%rbp),%rax
  mov    -0x10(%rbp),%rdx
  mov    %rdx,(%rax)
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L46
  call   <__stack_chk_fail@plt>
L46:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_tag: D1
type_guessed: string
name: disassemble_data
arguments: data_tag: D30
type_guessed: string
name: disassemble_data
arguments: data_tag: D34
type_guessed: string

tool: D1: r

tool: D30: %d

tool: D34: %f

assistant: ```c
void read_matrix(const char *path, double **A, int *m, int *n) {
  int i, j;
  FILE *f = fopen(path, "r");
  fscanf(f, "%d", m);
  fscanf(f, "%d", n);
  double *t = (double *)malloc(sizeof(double) * (*m) * (*n));
  for (j = 0; j < *m; j++) {
    for (i = 0; i < *n; i++) {
      float fl;
      fscanf(f, "%f", &fl);
      t[i + (*n) * j] = fl;
    }
  }
  close(f);
  *A = t;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<read_matrix>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rsi,0x8(%rsp)
  mov    %rdx,%r15
  mov    %rdx,(%rsp)
  mov    %rcx,%rbp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    D6(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%r13
  mov    %r15,%rdx
  lea    D21(%rip),%rbx
  mov    %rbx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fscanf@plt>
  mov    %rbp,%rdx
  mov    %rbx,%rsi
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <fscanf@plt>
  mov    0x0(%rbp),%edi
  mov    %r15,%rbx
  imul   (%r15),%edi
  shl    $0x3,%edi
  call   <malloc@plt>
  mov    %rax,%r14
  mov    $0x0,%r12d
  lea    D11(%rip),%r15
  cmpl   $0x0,(%rbx)
  jg     L37
L16:
  mov    %r13,%rdi
  call   <close@plt>
  mov    0x8(%rsp),%rax
  mov    %r14,(%rax)
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L57
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L15:
  lea    0x14(%rsp),%rdx
  mov    %r15,%rsi
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <fscanf@plt>
  mov    %r12d,%eax
  imul   0x0(%rbp),%eax
  add    %ebx,%eax
  cltq
  pxor   %xmm0,%xmm0
  cvtss2sd 0x14(%rsp),%xmm0
  movsd  %xmm0,(%r14,%rax,8)
  add    $0x1,%ebx
  cmp    %ebx,0x0(%rbp)
  jg     L15
L30:
  add    $0x1,%r12d
  mov    (%rsp),%rax
  cmp    %r12d,(%rax)
  jle    L16
L37:
  mov    $0x0,%ebx
  cmpl   $0x0,0x0(%rbp)
  jg     L15
  jmp    L30
L57:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: label: D6
type: string
name: parse_data
arguments: label: D21
type: string
name: parse_data
arguments: label: D11
type: string

tool: D6: r

tool: D21: %d

tool: D11: %f

assistant: ```c
void read_matrix(const char *path, double **A, int *m, int *n) {
  int i, j;
  FILE *f = fopen(path, "r");
  fscanf(f, "%d", m);
  fscanf(f, "%d", n);
  double *t = (double *)malloc(sizeof(double) * (*m) * (*n));
  for (j = 0; j < *m; j++) {
    for (i = 0; i < *n; i++) {
      float fl;
      fscanf(f, "%f", &fl);
      t[i + (*n) * j] = fl;
    }
  }
  close(f);
  *A = t;
}
```
user: What is the c source code of the assembly code below?

```asm
<read_matrix>:
  endbr64
  push   %r15
  push   %r14
  lea    D12(%rip),%r14
  push   %r13
  push   %r12
  lea    D21(%rip),%r12
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x38,%rsp
  mov    %rsi,0x18(%rsp)
  lea    D10(%rip),%rsi
  mov    %rdx,0x10(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  call   <fopen@plt>
  mov    %rbx,%rdx
  mov    %r12,%rsi
  mov    %rax,%rdi
  mov    %rax,%r15
  xor    %eax,%eax
  call   <fscanf@plt>
  mov    %rbp,%rdx
  mov    %r12,%rsi
  mov    %r15,%rdi
  xor    %eax,%eax
  call   <fscanf@plt>
  mov    0x0(%rbp),%edi
  imul   (%rbx),%edi
  shl    $0x3,%edi
  call   <malloc@plt>
  mov    (%rbx),%edx
  xor    %ebx,%ebx
  mov    %rax,0x8(%rsp)
  test   %edx,%edx
  jle    L30
  nopw   0x0(%rax,%rax,1)
L44:
  mov    0x0(%rbp),%eax
  xor    %r13d,%r13d
  lea    0x24(%rsp),%r12
  test   %eax,%eax
  jle    L0
  nop
L19:
  mov    %r12,%rdx
  mov    %r14,%rsi
  mov    %r15,%rdi
  xor    %eax,%eax
  call   <fscanf@plt>
  mov    0x0(%rbp),%edx
  mov    0x8(%rsp),%rcx
  pxor   %xmm0,%xmm0
  cvtss2sd 0x24(%rsp),%xmm0
  mov    %edx,%eax
  imul   %ebx,%eax
  add    %r13d,%eax
  add    $0x1,%r13d
  cltq
  movsd  %xmm0,(%rcx,%rax,8)
  cmp    %r13d,%edx
  jg     L19
L0:
  mov    0x10(%rsp),%rax
  add    $0x1,%ebx
  cmp    %ebx,(%rax)
  jg     L44
L30:
  mov    %r15,%rdi
  call   <close@plt>
  mov    0x18(%rsp),%rax
  mov    0x8(%rsp),%rsi
  mov    %rsi,(%rax)
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L17
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L17:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D12
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D21
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D10
type_guessed: string

tool: D12: %f

tool: D21: %d

tool: D10: r

assistant: ```c
void read_matrix(const char *path, double **A, int *m, int *n) {
  int i, j;
  FILE *f = fopen(path, "r");
  fscanf(f, "%d", m);
  fscanf(f, "%d", n);
  double *t = (double *)malloc(sizeof(double) * (*m) * (*n));
  for (j = 0; j < *m; j++) {
    for (i = 0; i < *n; i++) {
      float fl;
      fscanf(f, "%f", &fl);
      t[i + (*n) * j] = fl;
    }
  }
  close(f);
  *A = t;
}
```