ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<cw_dir_block>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x430,%rsp
  mov    %rdi,-0x428(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x428(%rbp),%rdx
  lea    -0x410(%rbp),%rax
  mov    %rdx,%rsi
  mov    $0x80,%edx
  mov    %rax,%rdi
  mov    %rdx,%rcx
  rep movsq %ds:(%rsi),%es:(%rdi)
  movl   $0x0,-0x41c(%rbp)
  jmp    L45
L4:
  mov    -0x41c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x428(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <two_bytes@plt>
  mov    %eax,-0x418(%rbp)
  cmpl   $0x0,-0x418(%rbp)
  jne    L43
  mov    -0x41c(%rbp),%eax
  add    $0xe,%eax
  mov    %eax,-0x414(%rbp)
  mov    -0x414(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x428(%rbp),%rax
  add    %rax,%rdx
  mov    -0x414(%rbp),%eax
  cltq
  lea    -0x410(%rbp),%rcx
  add    %rcx,%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <conv2cpy@plt>
  jmp    L36
L43:
  mov    -0x41c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x428(%rbp),%rax
  add    %rax,%rdx
  mov    -0x41c(%rbp),%eax
  cltq
  lea    -0x410(%rbp),%rcx
  add    %rcx,%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <conv2cpy@plt>
L36:
  addl   $0x10,-0x41c(%rbp)
L45:
  cmpl   $0x3ff,-0x41c(%rbp)
  jle    L4
  lea    -0x410(%rbp),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <write_block@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L49
  call   <__stack_chk_fail@plt>
L49:
  leave
  ret
```

assistant: ```c
void cw_dir_block(buf) char *buf;
{
  char output_buf[1024];
  int ino, i, old_ino_offset;
  memcpy(output_buf, buf, 1024);
  for (i = 0; i < 1024; i += 16) {
    ino = two_bytes(buf + i);
    if (ino == 0) {
      old_ino_offset = i + 16 - 2;
      conv2cpy(output_buf + old_ino_offset, buf + old_ino_offset);
    } else
      conv2cpy(output_buf + i, buf + i);
  }
  write_block(output_buf);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<cw_dir_block>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x410,%rsp
  mov    %rdi,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x408(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rdi
  mov    $0x80,%ecx
  mov    %rbx,%rsi
  rep movsq %ds:(%rsi),%es:(%rdi)
  mov    %rsp,%rbp
  lea    0x400(%rsp),%r12
  jmp    L48
L30:
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <conv2cpy@plt>
L5:
  add    $0x10,%rbx
  add    $0x10,%rbp
  cmp    %r12,%rbp
  je     L41
L48:
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <two_bytes@plt>
  test   %eax,%eax
  jne    L30
  lea    0xe(%rbx),%rsi
  lea    0xe(%rbp),%rdi
  call   <conv2cpy@plt>
  jmp    L5
L41:
  mov    %rsp,%rdi
  mov    $0x0,%eax
  call   <write_block@plt>
  mov    0x408(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L26
  add    $0x410,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L26:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void cw_dir_block(buf) char *buf;
{
  char output_buf[1024];
  int ino, i, old_ino_offset;
  memcpy(output_buf, buf, 1024);
  for (i = 0; i < 1024; i += 16) {
    ino = two_bytes(buf + i);
    if (ino == 0) {
      old_ino_offset = i + 16 - 2;
      conv2cpy(output_buf + old_ino_offset, buf + old_ino_offset);
    } else
      conv2cpy(output_buf + i, buf + i);
  }
  write_block(output_buf);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<cw_dir_block>:
  endbr64
  push   %r13
  mov    $0x80,%ecx
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    %rbx,%rsi
  sub    $0x418,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x408(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r13
  mov    %rsp,%rdi
  lea    0x400(%rsp),%r12
  rep movsq %ds:(%rsi),%es:(%rdi)
  mov    %r13,%rbp
  jmp    L6
  nopl   (%rax)
L49:
  lea    0xe(%rbx),%rsi
  lea    0xe(%rbp),%rdi
  add    $0x10,%rbp
  add    $0x10,%rbx
  call   <conv2cpy@plt>
  cmp    %r12,%rbp
  je     L32
L6:
  xor    %eax,%eax
  mov    %rbx,%rdi
  call   <two_bytes@plt>
  test   %eax,%eax
  je     L49
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  add    $0x10,%rbp
  call   <conv2cpy@plt>
  add    $0x10,%rbx
  cmp    %r12,%rbp
  jne    L6
L32:
  xor    %eax,%eax
  mov    %r13,%rdi
  call   <write_block@plt>
  mov    0x408(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L15
  add    $0x418,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L15:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void cw_dir_block(buf) char *buf;
{
  char output_buf[1024];
  int ino, i, old_ino_offset;
  memcpy(output_buf, buf, 1024);
  for (i = 0; i < 1024; i += 16) {
    ino = two_bytes(buf + i);
    if (ino == 0) {
      old_ino_offset = i + 16 - 2;
      conv2cpy(output_buf + old_ino_offset, buf + old_ino_offset);
    } else
      conv2cpy(output_buf + i, buf + i);
  }
  write_block(output_buf);
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<cw_dir_block>:
  endbr64
  push   %r13
  mov    $0x80,%ecx
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    %rbx,%rsi
  sub    $0x418,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x408(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r13
  mov    %rsp,%rdi
  lea    0x400(%rsp),%r12
  rep movsq %ds:(%rsi),%es:(%rdi)
  mov    %r13,%rbp
  jmp    L10
  nopl   (%rax)
L28:
  lea    0xe(%rbx),%rsi
  lea    0xe(%rbp),%rdi
  add    $0x10,%rbp
  add    $0x10,%rbx
  call   <conv2cpy@plt>
  cmp    %r12,%rbp
  je     L49
L10:
  xor    %eax,%eax
  mov    %rbx,%rdi
  call   <two_bytes@plt>
  test   %eax,%eax
  je     L28
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  add    $0x10,%rbp
  call   <conv2cpy@plt>
  add    $0x10,%rbx
  cmp    %r12,%rbp
  jne    L10
L49:
  xor    %eax,%eax
  mov    %r13,%rdi
  call   <write_block@plt>
  mov    0x408(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L45
  add    $0x418,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L45:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void cw_dir_block(buf) char *buf;
{
  char output_buf[1024];
  int ino, i, old_ino_offset;
  memcpy(output_buf, buf, 1024);
  for (i = 0; i < 1024; i += 16) {
    ino = two_bytes(buf + i);
    if (ino == 0) {
      old_ino_offset = i + 16 - 2;
      conv2cpy(output_buf + old_ino_offset, buf + old_ino_offset);
    } else
      conv2cpy(output_buf + i, buf + i);
  }
  write_block(output_buf);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  push   %rbx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    D73(%rip),%rdi
  call   <puts@plt>
  lea    0x14(%rsp),%rdx
  lea    0x10(%rsp),%rsi
  lea    D28(%rip),%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  lea    D76(%rip),%rdi
  call   <puts@plt>
  lea    D79(%rip),%rdi
  call   <puts@plt>
  lea    0xc(%rsp),%rsi
  lea    D60(%rip),%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  mov    0xc(%rsp),%edx
  cmp    $0x3,%edx
  je     L17
  jg     L36
  cmp    $0x1,%edx
  je     L21
  cmp    $0x2,%edx
  jne    L94
  mov    0x10(%rsp),%ebx
  sub    0x14(%rsp),%ebx
  jmp    L13
L36:
  cmp    $0x4,%edx
  jne    L94
  cmpl   $0x0,0x14(%rsp)
  je     L95
L51:
  mov    0x10(%rsp),%eax
  cltd
  idivl  0x14(%rsp)
  mov    %eax,%ebx
  jmp    L13
L21:
  mov    0x14(%rsp),%ebx
  add    0x10(%rsp),%ebx
L13:
  mov    %ebx,%esi
  lea    D70(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L25
  mov    $0x0,%eax
  add    $0x20,%rsp
  pop    %rbx
  ret
L17:
  mov    0x10(%rsp),%ebx
  imul   0x14(%rsp),%ebx
  jmp    L13
L95:
  lea    D47(%rip),%rdi
  call   <puts@plt>
  mov    $0x0,%edi
  call   <exit@plt>
  jmp    L51
L94:
  lea    D27(%rip),%rdi
  call   <puts@plt>
  mov    $0x0,%edi
  call   <exit@plt>
  jmp    L13
L25:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: label: D73
type_infered: string
name: parse_data
arguments: label: D28
type_infered: string
name: parse_data
arguments: label: D76
type_infered: string
name: parse_data
arguments: label: D79
type_infered: string
name: parse_data
arguments: label: D60
type_infered: string
name: parse_data
arguments: label: D70
type_infered: string
name: parse_data
arguments: label: D47
type_infered: string
name: parse_data
arguments: label: D27
type_infered: string

tool: D73: 
Enter two values

tool: D28: %d%d

tool: D76: 
1.Addition
2.Subtraction
3.Multiplication
4.Division

tool: D79: 
Enter your Choice

tool: D60: %d

tool: D70: 
Result of the operation is : %d


tool: D47: 
Cannot divide by zero

tool: D27: 
Invalid Input

assistant: ```c
int main(void) {
  int iChoice, iVal1, iVal2, iResult;
  printf("\nEnter two values\n");
  scanf("%d%d", &iVal1, &iVal2);
  printf("\n1.Addition\n2.Subtraction\n3.Multiplication\n4.Division\n");
  printf("\nEnter your Choice\n");
  scanf("%d", &iChoice);
  switch (iChoice) {
  case 1:
    iResult = iVal1 + iVal2;
    break;
  case 2:
    iResult = iVal1 - iVal2;
    break;
  case 3:
    iResult = iVal1 * iVal2;
    break;
  case 4:
    if (iVal2 == 0) {
      printf("\nCannot divide by zero\n");
      exit(0);
    }
    iResult = iVal1 / iVal2;
    break;
  default:
    printf("\nInvalid Input\n");
    exit(0);
  }
  printf("\nResult of the operation is : %d\n", iResult);
  return 0;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<main>:
  endbr64
  push   %rbp
  lea    D33(%rip),%rdi
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  call   <puts@plt>
  lea    0x14(%rsp),%rdx
  lea    0x10(%rsp),%rsi
  xor    %eax,%eax
  lea    D63(%rip),%rdi
  call   <scanf@plt>
  lea    D42(%rip),%rdi
  call   <puts@plt>
  lea    D0(%rip),%rdi
  call   <puts@plt>
  lea    0xc(%rsp),%rsi
  lea    D51(%rip),%rdi
  xor    %eax,%eax
  call   <scanf@plt>
  mov    0xc(%rsp),%edx
  cmp    $0x3,%edx
  je     L105
  jg     L54
  cmp    $0x1,%edx
  je     L26
  cmp    $0x2,%edx
  jne    L114
  mov    0x10(%rsp),%ebp
  sub    0x14(%rsp),%ebp
L49:
  xor    %eax,%eax
  mov    %ebp,%esi
  lea    D74(%rip),%rdi
  call   <printf@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L22
  add    $0x20,%rsp
  xor    %eax,%eax
  pop    %rbp
  ret
  nopl   (%rax)
L54:
  cmp    $0x4,%edx
  jne    L114
  cmpl   $0x0,0x14(%rsp)
  je     L46
L94:
  mov    0x10(%rsp),%eax
  cltd
  idivl  0x14(%rsp)
  mov    %eax,%ebp
  jmp    L49
L114:
  lea    D75(%rip),%rdi
  call   <puts@plt>
  xor    %edi,%edi
  call   <exit@plt>
  jmp    L49
L26:
  mov    0x14(%rsp),%ebp
  add    0x10(%rsp),%ebp
  jmp    L49
L105:
  mov    0x10(%rsp),%ebp
  imul   0x14(%rsp),%ebp
  jmp    L49
L46:
  lea    D18(%rip),%rdi
  call   <puts@plt>
  xor    %edi,%edi
  call   <exit@plt>
  jmp    L94
L22:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D33
data_type: string
name: retrieve_data
arguments: label: D63
data_type: string
name: retrieve_data
arguments: label: D42
data_type: string
name: retrieve_data
arguments: label: D0
data_type: string
name: retrieve_data
arguments: label: D51
data_type: string
name: retrieve_data
arguments: label: D74
data_type: string
name: retrieve_data
arguments: label: D75
data_type: string
name: retrieve_data
arguments: label: D18
data_type: string

tool: D33: 
Enter two values

tool: D63: %d%d

tool: D42: 
1.Addition
2.Subtraction
3.Multiplication
4.Division

tool: D0: 
Enter your Choice

tool: D51: %d

tool: D74: 
Result of the operation is : %d


tool: D75: 
Invalid Input

tool: D18: 
Cannot divide by zero

assistant: ```c
int main(void) {
  int iChoice, iVal1, iVal2, iResult;
  printf("\nEnter two values\n");
  scanf("%d%d", &iVal1, &iVal2);
  printf("\n1.Addition\n2.Subtraction\n3.Multiplication\n4.Division\n");
  printf("\nEnter your Choice\n");
  scanf("%d", &iChoice);
  switch (iChoice) {
  case 1:
    iResult = iVal1 + iVal2;
    break;
  case 2:
    iResult = iVal1 - iVal2;
    break;
  case 3:
    iResult = iVal1 * iVal2;
    break;
  case 4:
    if (iVal2 == 0) {
      printf("\nCannot divide by zero\n");
      exit(0);
    }
    iResult = iVal1 / iVal2;
    break;
  default:
    printf("\nInvalid Input\n");
    exit(0);
  }
  printf("\nResult of the operation is : %d\n", iResult);
  return 0;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<main>:
  endbr64
  push   %rbp
  lea    D25(%rip),%rdi
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  call   <puts@plt>
  lea    0x14(%rsp),%rdx
  lea    0x10(%rsp),%rsi
  xor    %eax,%eax
  lea    D74(%rip),%rdi
  call   <scanf@plt>
  lea    D54(%rip),%rdi
  call   <puts@plt>
  lea    D56(%rip),%rdi
  call   <puts@plt>
  lea    0xc(%rsp),%rsi
  lea    D52(%rip),%rdi
  xor    %eax,%eax
  call   <scanf@plt>
  mov    0xc(%rsp),%edx
  cmp    $0x3,%edx
  je     L2
  jg     L36
  cmp    $0x1,%edx
  je     L91
  cmp    $0x2,%edx
  jne    L115
  mov    0x10(%rsp),%ebp
  sub    0x14(%rsp),%ebp
L3:
  xor    %eax,%eax
  mov    %ebp,%esi
  lea    D47(%rip),%rdi
  call   <printf@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L28
  add    $0x20,%rsp
  xor    %eax,%eax
  pop    %rbp
  ret
  nopl   (%rax)
L36:
  cmp    $0x4,%edx
  jne    L115
  cmpl   $0x0,0x14(%rsp)
  je     L4
L0:
  mov    0x10(%rsp),%eax
  cltd
  idivl  0x14(%rsp)
  mov    %eax,%ebp
  jmp    L3
L115:
  lea    D11(%rip),%rdi
  call   <puts@plt>
  xor    %edi,%edi
  call   <exit@plt>
  jmp    L3
L91:
  mov    0x14(%rsp),%ebp
  add    0x10(%rsp),%ebp
  jmp    L3
L2:
  mov    0x10(%rsp),%ebp
  imul   0x14(%rsp),%ebp
  jmp    L3
L4:
  lea    D60(%rip),%rdi
  call   <puts@plt>
  xor    %edi,%edi
  call   <exit@plt>
  jmp    L0
L28:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D25
datatype: string
name: retrieve_data
arguments: label: D74
datatype: string
name: retrieve_data
arguments: label: D54
datatype: string
name: retrieve_data
arguments: label: D56
datatype: string
name: retrieve_data
arguments: label: D52
datatype: string
name: retrieve_data
arguments: label: D47
datatype: string
name: retrieve_data
arguments: label: D11
datatype: string
name: retrieve_data
arguments: label: D60
datatype: string

tool: D25: 
Enter two values

tool: D74: %d%d

tool: D54: 
1.Addition
2.Subtraction
3.Multiplication
4.Division

tool: D56: 
Enter your Choice

tool: D52: %d

tool: D47: 
Result of the operation is : %d


tool: D11: 
Invalid Input

tool: D60: 
Cannot divide by zero

assistant: ```c
int main(void) {
  int iChoice, iVal1, iVal2, iResult;
  printf("\nEnter two values\n");
  scanf("%d%d", &iVal1, &iVal2);
  printf("\n1.Addition\n2.Subtraction\n3.Multiplication\n4.Division\n");
  printf("\nEnter your Choice\n");
  scanf("%d", &iChoice);
  switch (iChoice) {
  case 1:
    iResult = iVal1 + iVal2;
    break;
  case 2:
    iResult = iVal1 - iVal2;
    break;
  case 3:
    iResult = iVal1 * iVal2;
    break;
  case 4:
    if (iVal2 == 0) {
      printf("\nCannot divide by zero\n");
      exit(0);
    }
    iResult = iVal1 / iVal2;
    break;
  default:
    printf("\nInvalid Input\n");
    exit(0);
  }
  printf("\nResult of the operation is : %d\n", iResult);
  return 0;
}
```
user: What is the c source code of the assembly code below:

```asm
<add_vector_double>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
  movl   $0x0,-0x4(%rbp)
  movl   $0x1,-0x4(%rbp)
  jmp    L2
L10:
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x4(%rbp)
L2:
  mov    -0x4(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jle    L10
  nop
  nop
  pop    %rbp
  ret
```

assistant: ```c
void add_vector_double(double *a, double *b, int n) {
  int i = 0;
  for (i = 1; i <= n; i++) {
    a[i] += b[i];
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<add_vector_double>:
  endbr64
  test   %edx,%edx
  jle    L11
  lea    0x1(%rdx),%edx
  mov    $0x1,%eax
L0:
  movsd  (%rdi,%rax,8),%xmm0
  addsd  (%rsi,%rax,8),%xmm0
  movsd  %xmm0,(%rdi,%rax,8)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L0
L11:
  ret
```

assistant: ```c
void add_vector_double(double *a, double *b, int n) {
  int i = 0;
  for (i = 1; i <= n; i++) {
    a[i] += b[i];
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<add_vector_double>:
  endbr64
  test   %edx,%edx
  jle    L3
  add    $0x1,%edx
  mov    $0x1,%eax
L18:
  movsd  (%rdi,%rax,8),%xmm0
  addsd  (%rsi,%rax,8),%xmm0
  movsd  %xmm0,(%rdi,%rax,8)
  add    $0x1,%rax
  cmp    %rax,%rdx
  jne    L18
L3:
  ret
```

assistant: ```c
void add_vector_double(double *a, double *b, int n) {
  int i = 0;
  for (i = 1; i <= n; i++) {
    a[i] += b[i];
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<add_vector_double>:
  endbr64
  mov    %rdi,%rcx
  test   %edx,%edx
  jle    L6
  lea    0x10(%rsi),%rdi
  lea    0x8(%rcx),%rax
  cmp    %rax,%rdi
  je     L56
  lea    -0x1(%rdx),%eax
  cmp    $0x1,%eax
  jbe    L56
  mov    %edx,%eax
  shr    %eax
  lea    -0x1(%rax),%edi
  mov    $0x8,%eax
  shl    $0x4,%rdi
  add    $0x18,%rdi
  nopl   0x0(%rax,%rax,1)
L28:
  movupd (%rcx,%rax,1),%xmm0
  movupd (%rsi,%rax,1),%xmm1
  addpd  %xmm1,%xmm0
  movups %xmm0,(%rcx,%rax,1)
  add    $0x10,%rax
  cmp    %rdi,%rax
  jne    L28
  mov    %edx,%eax
  or     $0x1,%eax
  and    $0x1,%edx
  je     L6
  cltq
  lea    (%rcx,%rax,8),%rdx
  movsd  (%rdx),%xmm0
  addsd  (%rsi,%rax,8),%xmm0
  movsd  %xmm0,(%rdx)
  ret
  nopl   0x0(%rax)
L56:
  add    $0x1,%edx
  mov    $0x1,%eax
  nopl   0x0(%rax,%rax,1)
L5:
  movsd  (%rcx,%rax,8),%xmm0
  addsd  (%rsi,%rax,8),%xmm0
  movsd  %xmm0,(%rcx,%rax,8)
  add    $0x1,%rax
  cmp    %rax,%rdx
  jne    L5
L6:
  ret
```

assistant: ```c
void add_vector_double(double *a, double *b, int n) {
  int i = 0;
  for (i = 1; i <= n; i++) {
    a[i] += b[i];
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<parse_size>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x18(%rbp),%rcx
  mov    -0x28(%rbp),%rax
  mov    $0xa,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strtoll@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x47,%eax
  cmp    $0x26,%eax
  seta   %dl
  test   %dl,%dl
  jne    L24
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%rdx
  mov    %rdx,%rax
  movabs $0x100000001,%rdx
  and    %rax,%rdx
  test   %rdx,%rdx
  setne  %dl
  test   %dl,%dl
  jne    L60
  movabs $0x4000000040,%rdx
  and    %rax,%rdx
  test   %rdx,%rdx
  setne  %dl
  test   %dl,%dl
  jne    L66
  movabs $0x1000000010,%rdx
  and    %rdx,%rax
  test   %rax,%rax
  setne  %al
  test   %al,%al
  je     L24
  shlq   $0xa,-0x10(%rbp)
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x18(%rbp)
  jmp    L68
L66:
  shlq   $0x14,-0x10(%rbp)
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x18(%rbp)
  jmp    L68
L60:
  shlq   $0x1e,-0x10(%rbp)
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x18(%rbp)
  jmp    L68
L24:
  nop
L68:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L50
  movq   $0x0,-0x10(%rbp)
L50:
  mov    -0x10(%rbp),%rax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L10
  call   <__stack_chk_fail@plt>
L10:
  leave
  ret
```

assistant: ```c
unsigned long long parse_size(const char *p) {
  unsigned long long size;
  char *q;
  size = strtoll(p, &q, 10);
  switch (*q) {
  case 'K':
  case 'k':
    size *= 1024;
    q++;
    break;
  case 'M':
  case 'm':
    size *= 1024 * 1024;
    q++;
    break;
  case 'G':
  case 'g':
    size *= 1024 * 1024 * 1024;
    q++;
    break;
  default:
    break;
  }
  if (*q != '\0')
    size = 0;
  return size;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<parse_size>:
  endbr64
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rsi
  mov    $0xa,%edx
  call   <strtoll@plt>
  mov    %rax,%rdi
  mov    (%rsp),%rsi
  movzbl (%rsi),%eax
  lea    -0x47(%rax),%ecx
  cmp    $0x26,%cl
  ja     L32
  mov    $0x1,%edx
  shl    %cl,%rdx
  movabs $0x100000001,%rax
  test   %rax,%rdx
  jne    L8
  movabs $0x4000000040,%rax
  test   %rax,%rdx
  jne    L37
  movabs $0x1000000010,%rax
  and    %rdx,%rax
  jne    L52
L73:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L36
  add    $0x18,%rsp
  ret
L52:
  mov    %rdi,%rax
  shl    $0xa,%rax
  add    $0x1,%rsi
  mov    %rsi,(%rsp)
L18:
  mov    (%rsp),%rdx
  cmpb   $0x0,(%rdx)
  mov    $0x0,%edx
  cmovne %rdx,%rax
  jmp    L73
L37:
  mov    %rdi,%rax
  shl    $0x14,%rax
  add    $0x1,%rsi
  mov    %rsi,(%rsp)
  jmp    L18
L8:
  mov    %rdi,%rax
  shl    $0x1e,%rax
  add    $0x1,%rsi
  mov    %rsi,(%rsp)
  jmp    L18
L32:
  mov    %rdi,%rax
  jmp    L18
L36:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
unsigned long long parse_size(const char *p) {
  unsigned long long size;
  char *q;
  size = strtoll(p, &q, 10);
  switch (*q) {
  case 'K':
  case 'k':
    size *= 1024;
    q++;
    break;
  case 'M':
  case 'm':
    size *= 1024 * 1024;
    q++;
    break;
  case 'G':
  case 'g':
    size *= 1024 * 1024 * 1024;
    q++;
    break;
  default:
    break;
  }
  if (*q != '\0')
    size = 0;
  return size;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<parse_size>:
  endbr64
  sub    $0x18,%rsp
  mov    $0xa,%edx
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rsi
  call   <strtoll@plt>
  mov    (%rsp),%rdi
  mov    %rax,%rsi
  movzbl (%rdi),%edx
  lea    -0x47(%rdx),%ecx
  cmp    $0x26,%cl
  ja     L72
  movabs $0x100000001,%rax
  mov    $0x1,%edx
  shl    %cl,%rdx
  test   %rax,%rdx
  jne    L26
  movabs $0x4000000040,%rax
  test   %rax,%rdx
  jne    L20
  movabs $0x1000000010,%rax
  and    %rdx,%rax
  jne    L56
L79:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L36
  add    $0x18,%rsp
  ret
  nopl   0x0(%rax)
L20:
  lea    0x1(%rdi),%rdx
  mov    %rsi,%rax
  mov    %rdx,(%rsp)
  movzbl 0x1(%rdi),%edx
  shl    $0x14,%rax
L72:
  test   %dl,%dl
  mov    $0x0,%edx
  cmovne %rdx,%rax
  jmp    L79
  nopl   0x0(%rax,%rax,1)
L26:
  lea    0x1(%rdi),%rdx
  mov    %rsi,%rax
  mov    %rdx,(%rsp)
  movzbl 0x1(%rdi),%edx
  shl    $0x1e,%rax
  test   %dl,%dl
  mov    $0x0,%edx
  cmovne %rdx,%rax
  jmp    L79
L56:
  lea    0x1(%rdi),%rdx
  mov    %rsi,%rax
  mov    %rdx,(%rsp)
  movzbl 0x1(%rdi),%edx
  shl    $0xa,%rax
  test   %dl,%dl
  mov    $0x0,%edx
  cmovne %rdx,%rax
  jmp    L79
L36:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
unsigned long long parse_size(const char *p) {
  unsigned long long size;
  char *q;
  size = strtoll(p, &q, 10);
  switch (*q) {
  case 'K':
  case 'k':
    size *= 1024;
    q++;
    break;
  case 'M':
  case 'm':
    size *= 1024 * 1024;
    q++;
    break;
  case 'G':
  case 'g':
    size *= 1024 * 1024 * 1024;
    q++;
    break;
  default:
    break;
  }
  if (*q != '\0')
    size = 0;
  return size;
}
```