ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Demonstrate the C code that generates the assembly output below:

```asm
<establish_connection>:
  endbr64
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x8,%rsp
  mov    D26(%rip),%rax
  mov    (%rax),%edx
  mov    D13(%rip),%rax
  mov    (%rax),%esi
  mov    D29(%rip),%rax
  mov    (%rax),%edi
  call   <socket@plt>
  test   %eax,%eax
  js     L10
  mov    $0x4,%edx
  mov    %rbp,%rsi
  mov    %eax,%edi
  mov    %eax,%r12d
  call   <connect@plt>
  test   %eax,%eax
  mov    $0xfffffffe,%eax
  cmovs  %eax,%r12d
L5:
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  ret
  nopw   0x0(%rax,%rax,1)
L10:
  mov    $0xffffffff,%r12d
  jmp    L5
```

assistant: ```c
int establish_connection(void *server_addr) {
  int sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
  if (sock < 0) {
    return -1;
  }
  int cresult = connect(sock, (struct sockaddr *)server_addr, sizeof(struct sockaddr));
  if (cresult < 0) {
    return -2;
  }
  return sock;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<establish_connection>:
  endbr64
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x8,%rsp
  mov    D24(%rip),%rax
  mov    (%rax),%edx
  mov    D1(%rip),%rax
  mov    (%rax),%esi
  mov    D20(%rip),%rax
  mov    (%rax),%edi
  call   <socket@plt>
  test   %eax,%eax
  js     L8
  mov    $0x4,%edx
  mov    %rbp,%rsi
  mov    %eax,%edi
  mov    %eax,%r12d
  call   <connect@plt>
  test   %eax,%eax
  mov    $0xfffffffe,%eax
  cmovs  %eax,%r12d
L16:
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  ret
  nopw   0x0(%rax,%rax,1)
L8:
  mov    $0xffffffff,%r12d
  jmp    L16
```

assistant: ```c
int establish_connection(void *server_addr) {
  int sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
  if (sock < 0) {
    return -1;
  }
  int cresult = connect(sock, (struct sockaddr *)server_addr, sizeof(struct sockaddr));
  if (cresult < 0) {
    return -2;
  }
  return sock;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  mov    0x8(%rax),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <printFileContent@plt>
  mov    $0x0,%eax
  leave
  ret
```

assistant: ```c
int main(int argc, char *argv[]) {
  char *filename = argv[1];
  printFileContent(filename);
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    0x8(%rsi),%rdi
  call   <printFileContent@plt>
  mov    $0x0,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int main(int argc, char *argv[]) {
  char *filename = argv[1];
  printFileContent(filename);
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    0x8(%rsi),%rdi
  call   <printFileContent@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int main(int argc, char *argv[]) {
  char *filename = argv[1];
  printFileContent(filename);
  return 0;
}
```
user: What is the c source code of the assembly code below:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    0x8(%rsi),%rdi
  call   <printFileContent@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int main(int argc, char *argv[]) {
  char *filename = argv[1];
  printFileContent(filename);
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<minimumr>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %edx,-0x20(%rbp)
  mov    %rcx,-0x28(%rbp)
  mov    D3(%rip),%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movl   $0x0,-0xc(%rbp)
  jmp    L1
L2:
  mov    -0x20(%rbp),%eax
  imul   -0x1c(%rbp),%eax
  mov    %eax,%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  -0x8(%rbp),%xmm0
  comisd %xmm1,%xmm0
  jbe    L23
  mov    -0x20(%rbp),%eax
  imul   -0x1c(%rbp),%eax
  mov    %eax,%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x8(%rbp)
  mov    -0x28(%rbp),%rax
  mov    -0xc(%rbp),%edx
  mov    %edx,(%rax)
L23:
  addl   $0x1,-0xc(%rbp)
L1:
  mov    -0xc(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L2
  movsd  -0x8(%rbp),%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  pop    %rbp
  ret
```

assistant: ```c
double minimumr(double *matrix, int ncols, int row, int *col) {
  int i;
  double res = DBL_MAX;
  for (i = 0; i < ncols; i++) {
    if (matrix[((row) * (ncols) + (i))] < res) {
      res = matrix[((row) * (ncols) + (i))];
      *col = i;
    }
  }
  return res;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<minimumr>:
  endbr64
  mov    D5(%rip),%rax
  movsd  (%rax),%xmm1
  test   %esi,%esi
  jle    L9
  mov    %esi,%r8d
  imul   %edx,%esi
  movslq %esi,%rsi
  lea    (%rdi,%rsi,8),%rdx
  mov    $0x0,%eax
  jmp    L19
L28:
  add    $0x1,%rax
  cmp    %r8,%rax
  je     L9
L19:
  movsd  (%rdx,%rax,8),%xmm0
  comisd %xmm0,%xmm1
  jbe    L28
  mov    %eax,(%rcx)
  movapd %xmm0,%xmm1
  jmp    L28
L9:
  movapd %xmm1,%xmm0
  ret
```

assistant: ```c
double minimumr(double *matrix, int ncols, int row, int *col) {
  int i;
  double res = DBL_MAX;
  for (i = 0; i < ncols; i++) {
    if (matrix[((row) * (ncols) + (i))] < res) {
      res = matrix[((row) * (ncols) + (i))];
      *col = i;
    }
  }
  return res;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<minimumr>:
  endbr64
  mov    D6(%rip),%rax
  movsd  (%rax),%xmm1
  test   %esi,%esi
  jle    L7
  movslq %esi,%r8
  imul   %edx,%esi
  xor    %eax,%eax
  movslq %esi,%rsi
  lea    (%rdi,%rsi,8),%rdx
  nopw   0x0(%rax,%rax,1)
L15:
  movsd  (%rdx,%rax,8),%xmm0
  comisd %xmm0,%xmm1
  jbe    L13
  mov    %eax,(%rcx)
  movapd %xmm0,%xmm1
L13:
  add    $0x1,%rax
  cmp    %r8,%rax
  jne    L15
L7:
  movapd %xmm1,%xmm0
  ret
```

assistant: ```c
double minimumr(double *matrix, int ncols, int row, int *col) {
  int i;
  double res = DBL_MAX;
  for (i = 0; i < ncols; i++) {
    if (matrix[((row) * (ncols) + (i))] < res) {
      res = matrix[((row) * (ncols) + (i))];
      *col = i;
    }
  }
  return res;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<minimumr>:
  endbr64
  mov    D4(%rip),%rax
  movsd  (%rax),%xmm1
  test   %esi,%esi
  jle    L27
  movslq %esi,%r8
  imul   %edx,%esi
  xor    %eax,%eax
  movslq %esi,%rsi
  lea    (%rdi,%rsi,8),%rdx
  nopw   0x0(%rax,%rax,1)
L1:
  movsd  (%rdx,%rax,8),%xmm0
  comisd %xmm0,%xmm1
  jbe    L22
  mov    %eax,(%rcx)
  movapd %xmm0,%xmm1
L22:
  add    $0x1,%rax
  cmp    %r8,%rax
  jne    L1
L27:
  movapd %xmm1,%xmm0
  ret
```

assistant: ```c
double minimumr(double *matrix, int ncols, int row, int *col) {
  int i;
  double res = DBL_MAX;
  for (i = 0; i < ncols; i++) {
    if (matrix[((row) * (ncols) + (i))] < res) {
      res = matrix[((row) * (ncols) + (i))];
      *col = i;
    }
  }
  return res;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<am_malloc_realnums>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  cltq
  shl    $0x3,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    D5(%rip),%rcx
  mov    -0x14(%rbp),%edx
  mov    -0x8(%rbp),%rax
  movq   %rcx,%xmm0
  mov    %edx,%esi
  mov    %rax,%rdi
  mov    $0x1,%eax
  call   <set_realnums_constant@plt>
  mov    -0x8(%rbp),%rax
  leave
  ret
```

tool_calls: name: parse_data
arguments: tag: D5
type: byte[8]

tool: {"D5": [0xa8,0xd6,0xd8,0x09,0x90,0x21,0xb9,0xc5]}

assistant: ```c
double *am_malloc_realnums(int size) {
  double *result = ((double *)malloc((size) * sizeof(double)));
  set_realnums_constant(result, size, -7.7777e27);
  return (result);
}
```
user: What is the c source code of the assembly code below?

```asm
<am_malloc_realnums>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%ebp
  movslq %edi,%rdi
  shl    $0x3,%rdi
  call   <malloc@plt>
  mov    %rax,%rbx
  movsd  D3(%rip),%xmm0
  mov    %ebp,%esi
  mov    %rax,%rdi
  mov    $0x1,%eax
  call   <set_realnums_constant@plt>
  mov    %rbx,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

tool_calls: name: parse_data
arguments: data_label: D3
data_type: byte[8]

tool: {"D3": [0xa8,0xd6,0xd8,0x09,0x90,0x21,0xb9,0xc5]}

assistant: ```c
double *am_malloc_realnums(int size) {
  double *result = ((double *)malloc((size) * sizeof(double)));
  set_realnums_constant(result, size, -7.7777e27);
  return (result);
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<am_malloc_realnums>:
  endbr64
  push   %r12
  movslq %edi,%rdi
  push   %rbp
  mov    %rdi,%rbp
  shl    $0x3,%rdi
  sub    $0x8,%rsp
  call   <malloc@plt>
  movsd  D9(%rip),%xmm0
  mov    %ebp,%esi
  mov    %rax,%r12
  mov    %rax,%rdi
  mov    $0x1,%eax
  call   <set_realnums_constant@plt>
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D9
datatype: byte[8]

tool: {"D9": [0xa8,0xd6,0xd8,0x09,0x90,0x21,0xb9,0xc5]}

assistant: ```c
double *am_malloc_realnums(int size) {
  double *result = ((double *)malloc((size) * sizeof(double)));
  set_realnums_constant(result, size, -7.7777e27);
  return (result);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<am_malloc_realnums>:
  endbr64
  push   %r12
  movslq %edi,%rdi
  push   %rbp
  mov    %rdi,%rbp
  shl    $0x3,%rdi
  sub    $0x8,%rsp
  call   <malloc@plt>
  movsd  D6(%rip),%xmm0
  mov    %ebp,%esi
  mov    %rax,%r12
  mov    %rax,%rdi
  mov    $0x1,%eax
  call   <set_realnums_constant@plt>
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D6
data_type: byte[8]

tool: {"D6": [0xa8,0xd6,0xd8,0x09,0x90,0x21,0xb9,0xc5]}

assistant: ```c
double *am_malloc_realnums(int size) {
  double *result = ((double *)malloc((size) * sizeof(double)));
  set_realnums_constant(result, size, -7.7777e27);
  return (result);
}
```
user: What is the c source code of the assembly code below:

```asm
<Rmq>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,%r12
  mov    %rsi,%rbx
  mov    %rdx,%rbp
  lea    0x28(%rsp),%r13
  lea    0x20(%rsp),%r14
  mov    %r14,%rsi
  mov    %r13,%rdi
  movsd  (%r12),%xmm0
  call   <sincos@plt>
  movsd  0x20(%rsp),%xmm7
  movsd  %xmm7,0x8(%rsp)
  mov    0x28(%rsp),%r15
  movsd  0x8(%r12),%xmm0
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <sincos@plt>
  movsd  0x20(%rsp),%xmm8
  movsd  %xmm8,0x10(%rsp)
  movsd  0x28(%rsp),%xmm6
  movsd  %xmm6,0x18(%rsp)
  movsd  0x10(%r12),%xmm0
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <sincos@plt>
  movsd  0x20(%rsp),%xmm4
  movsd  0x28(%rsp),%xmm5
  movsd  0x10(%rsp),%xmm8
  movapd %xmm8,%xmm0
  mulsd  %xmm4,%xmm0
  mulsd  (%rbx),%xmm0
  movapd %xmm8,%xmm1
  mulsd  %xmm5,%xmm1
  mulsd  0x8(%rbx),%xmm1
  addsd  %xmm1,%xmm0
  movsd  0x18(%rsp),%xmm6
  movapd %xmm6,%xmm1
  mulsd  0x10(%rbx),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,0x0(%rbp)
  movsd  0x8(%rsp),%xmm7
  movapd %xmm7,%xmm0
  mulsd  %xmm5,%xmm0
  movapd %xmm7,%xmm2
  mulsd  %xmm4,%xmm2
  movq   %r15,%xmm3
  mulsd  %xmm3,%xmm5
  movq   %r15,%xmm1
  mulsd  %xmm4,%xmm1
  mulsd  %xmm6,%xmm1
  subsd  %xmm0,%xmm1
  mulsd  (%rbx),%xmm1
  movapd %xmm6,%xmm3
  mulsd  %xmm5,%xmm3
  addsd  %xmm2,%xmm3
  mulsd  0x8(%rbx),%xmm3
  addsd  %xmm3,%xmm1
  movq   %r15,%xmm3
  mulsd  %xmm8,%xmm3
  mulsd  0x10(%rbx),%xmm3
  addsd  %xmm3,%xmm1
  movsd  %xmm1,0x8(%rbp)
  mulsd  %xmm6,%xmm0
  mulsd  %xmm6,%xmm4
  subsd  %xmm4,%xmm0
  mulsd  0x8(%rbx),%xmm0
  mulsd  %xmm6,%xmm2
  addsd  %xmm5,%xmm2
  mulsd  (%rbx),%xmm2
  addsd  %xmm2,%xmm0
  mulsd  %xmm8,%xmm7
  movapd %xmm7,%xmm1
  mulsd  0x10(%rbx),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,0x10(%rbp)
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void Rmq(double theta[3], double Vin[3], double Vout[3]) {
  double cpsi, cphi, ctet;
  double spsi, sphi, stet;
  cphi = cos(theta[0]);
  ctet = cos(theta[1]);
  cpsi = cos(theta[2]);
  sphi = sin(theta[0]);
  stet = sin(theta[1]);
  spsi = sin(theta[2]);
  Vout[0] = cpsi * ctet * Vin[0] + ctet * spsi * Vin[1] - stet * Vin[2];
  Vout[1] = (cpsi * sphi * stet - cphi * spsi) * Vin[0] + (cphi * cpsi + sphi * spsi * stet) * Vin[1] + ctet * sphi * Vin[2];
  Vout[2] = (sphi * spsi + cphi * cpsi * stet) * Vin[0] + (cphi * spsi * stet - cpsi * stet) * Vin[1] + cphi * ctet * Vin[2];
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<Rmq>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %rdx,%rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x30,%rsp
  movsd  (%r12),%xmm0
  lea    0x28(%rsp),%r13
  lea    0x20(%rsp),%r14
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <sincos@plt>
  movsd  0x20(%rsp),%xmm3
  mov    %r14,%rsi
  mov    %r13,%rdi
  movsd  0x28(%rsp),%xmm7
  movsd  0x8(%r12),%xmm0
  movsd  %xmm3,0x18(%rsp)
  movsd  %xmm7,0x10(%rsp)
  call   <sincos@plt>
  movsd  0x20(%rsp),%xmm4
  mov    %r14,%rsi
  mov    %r13,%rdi
  movsd  0x28(%rsp),%xmm6
  movsd  0x10(%r12),%xmm0
  movsd  %xmm4,0x8(%rsp)
  movsd  %xmm6,(%rsp)
  call   <sincos@plt>
  movsd  0x8(%rsp),%xmm4
  movsd  0x28(%rsp),%xmm5
  movsd  0x20(%rsp),%xmm8
  movsd  (%rsp),%xmm6
  movapd %xmm4,%xmm0
  movapd %xmm4,%xmm1
  movsd  0x18(%rsp),%xmm3
  movsd  0x10(%rsp),%xmm7
  mulsd  %xmm8,%xmm0
  mulsd  %xmm5,%xmm1
  movapd %xmm3,%xmm2
  mulsd  0x8(%rbx),%xmm1
  mulsd  (%rbx),%xmm0
  mulsd  %xmm8,%xmm2
  addsd  %xmm1,%xmm0
  movsd  0x10(%rbx),%xmm1
  mulsd  %xmm6,%xmm1
  subsd  %xmm1,%xmm0
  movapd %xmm8,%xmm1
  mulsd  %xmm7,%xmm1
  mulsd  %xmm6,%xmm8
  movsd  %xmm0,0x0(%rbp)
  movapd %xmm3,%xmm0
  mulsd  %xmm5,%xmm0
  mulsd  %xmm7,%xmm5
  mulsd  %xmm6,%xmm1
  mulsd  %xmm4,%xmm7
  mulsd  0x10(%rbx),%xmm7
  mulsd  %xmm4,%xmm3
  movapd %xmm5,%xmm9
  mulsd  %xmm6,%xmm9
  subsd  %xmm0,%xmm1
  mulsd  (%rbx),%xmm1
  mulsd  %xmm6,%xmm0
  addsd  %xmm2,%xmm9
  mulsd  0x8(%rbx),%xmm9
  mulsd  %xmm6,%xmm2
  subsd  %xmm8,%xmm0
  addsd  %xmm9,%xmm1
  addsd  %xmm5,%xmm2
  addsd  %xmm7,%xmm1
  movsd  %xmm1,0x8(%rbp)
  mulsd  0x8(%rbx),%xmm0
  mulsd  (%rbx),%xmm2
  mulsd  0x10(%rbx),%xmm3
  addsd  %xmm2,%xmm0
  addsd  %xmm3,%xmm0
  movsd  %xmm0,0x10(%rbp)
  add    $0x30,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
void Rmq(double theta[3], double Vin[3], double Vout[3]) {
  double cpsi, cphi, ctet;
  double spsi, sphi, stet;
  cphi = cos(theta[0]);
  ctet = cos(theta[1]);
  cpsi = cos(theta[2]);
  sphi = sin(theta[0]);
  stet = sin(theta[1]);
  spsi = sin(theta[2]);
  Vout[0] = cpsi * ctet * Vin[0] + ctet * spsi * Vin[1] - stet * Vin[2];
  Vout[1] = (cpsi * sphi * stet - cphi * spsi) * Vin[0] + (cphi * cpsi + sphi * spsi * stet) * Vin[1] + ctet * sphi * Vin[2];
  Vout[2] = (sphi * spsi + cphi * cpsi * stet) * Vin[0] + (cphi * spsi * stet - cpsi * stet) * Vin[1] + cphi * ctet * Vin[2];
}
```
user: Translate the below assembly code into C programming language:

```asm
<Rmq>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %rdx,%rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x30,%rsp
  movsd  (%r12),%xmm0
  lea    0x28(%rsp),%r13
  lea    0x20(%rsp),%r14
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <sincos@plt>
  movsd  0x20(%rsp),%xmm3
  mov    %r14,%rsi
  mov    %r13,%rdi
  movsd  0x28(%rsp),%xmm7
  movsd  0x8(%r12),%xmm0
  movsd  %xmm3,0x18(%rsp)
  movsd  %xmm7,0x10(%rsp)
  call   <sincos@plt>
  movsd  0x20(%rsp),%xmm4
  mov    %r14,%rsi
  mov    %r13,%rdi
  movsd  0x28(%rsp),%xmm6
  movsd  0x10(%r12),%xmm0
  movsd  %xmm4,0x8(%rsp)
  movsd  %xmm6,(%rsp)
  call   <sincos@plt>
  movsd  0x8(%rsp),%xmm4
  movsd  0x28(%rsp),%xmm5
  movsd  0x20(%rsp),%xmm8
  movsd  (%rsp),%xmm6
  movapd %xmm4,%xmm0
  movapd %xmm4,%xmm1
  movsd  0x18(%rsp),%xmm3
  movsd  0x10(%rsp),%xmm7
  mulsd  %xmm8,%xmm0
  mulsd  %xmm5,%xmm1
  movapd %xmm3,%xmm2
  mulsd  0x8(%rbx),%xmm1
  mulsd  (%rbx),%xmm0
  mulsd  %xmm8,%xmm2
  addsd  %xmm1,%xmm0
  movsd  0x10(%rbx),%xmm1
  mulsd  %xmm6,%xmm1
  subsd  %xmm1,%xmm0
  movapd %xmm8,%xmm1
  mulsd  %xmm7,%xmm1
  mulsd  %xmm6,%xmm8
  movsd  %xmm0,0x0(%rbp)
  movapd %xmm3,%xmm0
  mulsd  %xmm5,%xmm0
  mulsd  %xmm7,%xmm5
  mulsd  %xmm6,%xmm1
  mulsd  %xmm4,%xmm7
  mulsd  0x10(%rbx),%xmm7
  mulsd  %xmm4,%xmm3
  movapd %xmm5,%xmm9
  mulsd  %xmm6,%xmm9
  subsd  %xmm0,%xmm1
  mulsd  (%rbx),%xmm1
  mulsd  %xmm6,%xmm0
  addsd  %xmm2,%xmm9
  mulsd  0x8(%rbx),%xmm9
  mulsd  %xmm6,%xmm2
  subsd  %xmm8,%xmm0
  addsd  %xmm9,%xmm1
  addsd  %xmm5,%xmm2
  addsd  %xmm7,%xmm1
  movsd  %xmm1,0x8(%rbp)
  mulsd  0x8(%rbx),%xmm0
  mulsd  (%rbx),%xmm2
  mulsd  0x10(%rbx),%xmm3
  addsd  %xmm2,%xmm0
  addsd  %xmm3,%xmm0
  movsd  %xmm0,0x10(%rbp)
  add    $0x30,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
void Rmq(double theta[3], double Vin[3], double Vout[3]) {
  double cpsi, cphi, ctet;
  double spsi, sphi, stet;
  cphi = cos(theta[0]);
  ctet = cos(theta[1]);
  cpsi = cos(theta[2]);
  sphi = sin(theta[0]);
  stet = sin(theta[1]);
  spsi = sin(theta[2]);
  Vout[0] = cpsi * ctet * Vin[0] + ctet * spsi * Vin[1] - stet * Vin[2];
  Vout[1] = (cpsi * sphi * stet - cphi * spsi) * Vin[0] + (cphi * cpsi + sphi * spsi * stet) * Vin[1] + ctet * sphi * Vin[2];
  Vout[2] = (sphi * spsi + cphi * cpsi * stet) * Vin[0] + (cphi * spsi * stet - cpsi * stet) * Vin[1] + cphi * ctet * Vin[2];
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<gethd>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r14
  mov    %rsi,%r12
  mov    %rdx,%rbx
  call   <strlen@plt>
  mov    %eax,%r13d
  lea    0x3(%rax),%edi
  call   <malloc@plt>
  mov    %rax,%rbp
  movb   $0xa,(%rax)
  lea    0x1(%rax),%rdi
  mov    %r13d,%edx
  mov    %r14,%rsi
  call   <strncpy@plt>
  movslq %r13d,%rax
  movb   $0x3d,0x1(%rbp,%rax,1)
  movb   $0x0,0x2(%rbp,%rax,1)
  cmpb   $0x7d,(%rbx)
  je     L38
  lea    0x2(%r13),%r8d
  mov    %rbx,%rcx
  sub    %rbp,%rcx
  mov    $0x0,%edi
  mov    %r8d,%esi
  jmp    L136
L95:
  mov    $0x0,%edx
L143:
  cmp    %edx,%r8d
  cmove  %r9,%rdi
  add    $0x1,%rcx
  cmpb   $0x7d,(%rcx,%rbp,1)
  je     L7
L136:
  lea    (%rcx,%rbp,1),%r9
  test   %r8d,%r8d
  jle    L95
  mov    %rbp,%rax
  mov    $0x0,%edx
L66:
  movzbl (%rax),%ebx
  cmp    %bl,(%rax,%rcx,1)
  jne    L143
  add    $0x1,%rax
  add    $0x1,%edx
  cmp    %edx,%esi
  jne    L66
  mov    %esi,%edx
  jmp    L143
L7:
  test   %rdi,%rdi
  je     L38
  cmpb   $0x3d,(%rdi)
  je     L22
L116:
  add    $0x1,%rdi
  cmpb   $0x3d,(%rdi)
  jne    L116
L22:
  lea    0x1(%rdi),%rdx
  movzbl 0x1(%rdi),%eax
  cmp    $0x3b,%al
  je     L39
  test   %al,%al
  je     L39
L24:
  mov    %al,(%r12)
  add    $0x1,%rdx
  add    $0x1,%r12
  movzbl (%rdx),%eax
  cmp    $0x3b,%al
  je     L39
  test   %al,%al
  jne    L24
L39:
  movb   $0x0,(%r12)
L9:
  mov    %rbp,%rdi
  call   <free@plt>
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L38:
  movb   $0x0,(%r12)
  jmp    L9
```

assistant: ```c
void gethd(char *field, char *value, char *header) {
  char *hp, *lhp, *fp, *vp;
  int l, j;
  char *newfield;
  l = strlen(field);
  newfield = (char *)malloc(l + 3);
  *newfield = 10;
  strncpy(newfield + 1, field, l);
  *(newfield + l + 1) = '=';
  *(newfield + l + 2) = (char)0;
  l += 2;
  lhp = 0;
  for (hp = header; *hp != '}'; hp++) {
    for (fp = newfield, j = 0; j < l && *(hp + j) == *fp; fp++, j++)
      ;
    if (j == l)
      lhp = hp;
  }
  if (lhp == 0)
    value[0] = 0;
  else {
    for (hp = lhp; *hp != '='; hp++)
      ;
    for (lhp = hp + 1, vp = value; *lhp != ';' && *lhp != 0; lhp++, vp++)
      *vp = *lhp;
    *(vp++) = 0;
  }
  free(newfield);
}
```
user: What is the c source code of the assembly code below:

```asm
<gethd>:
  endbr64
  push   %r14
  mov    %rdi,%r14
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  push   %rbx
  mov    %rdx,%rbx
  call   <strlen@plt>
  lea    0x3(%rax),%edi
  mov    %eax,%r13d
  call   <malloc@plt>
  mov    %r14,%rsi
  mov    %r13d,%edx
  movb   $0xa,(%rax)
  lea    0x1(%rax),%rdi
  mov    %rax,%rbp
  call   <strncpy@plt>
  movslq %r13d,%rax
  lea    0x1(%r13),%ecx
  xor    %esi,%esi
  movb   $0x3d,0x1(%rbp,%rax,1)
  add    $0x2,%rcx
  lea    0x2(%r13),%edi
  movb   $0x0,0x2(%rbp,%rax,1)
  cmpb   $0x7d,(%rbx)
  je     L58
  nopw   0x0(%rax,%rax,1)
L144:
  test   %edi,%edi
  jle    L20
  mov    $0x1,%eax
  jmp    L112
  nop
L100:
  mov    %eax,%edx
  add    $0x1,%rax
  cmp    %rax,%rcx
  je     L27
L112:
  movzbl -0x1(%rbp,%rax,1),%edx
  cmp    %dl,-0x1(%rbx,%rax,1)
  je     L100
  add    $0x1,%rbx
  cmpb   $0x7d,(%rbx)
  jne    L144
L17:
  test   %rsi,%rsi
  jne    L136
  jmp    L58
  cs nopw 0x0(%rax,%rax,1)
L41:
  add    $0x1,%rsi
L136:
  cmpb   $0x3d,(%rsi)
  jne    L41
  movzbl 0x1(%rsi),%eax
  lea    0x1(%rsi),%rdx
  test   %al,%al
  je     L58
  cmp    $0x3b,%al
  jne    L16
  jmp    L58
  nopl   0x0(%rax,%rax,1)
L68:
  test   %al,%al
  je     L58
L16:
  add    $0x1,%rdx
  mov    %al,(%r12)
  add    $0x1,%r12
  movzbl (%rdx),%eax
  cmp    $0x3b,%al
  jne    L68
L58:
  movb   $0x0,(%r12)
  pop    %rbx
  mov    %rbp,%rdi
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  jmp    1080 <free@plt>
L20:
  xor    %edx,%edx
  xchg   %ax,%ax
L27:
  cmp    %edx,%edi
  cmove  %rbx,%rsi
  add    $0x1,%rbx
  cmpb   $0x7d,(%rbx)
  jne    L144
  jmp    L17
```

assistant: ```c
void gethd(char *field, char *value, char *header) {
  char *hp, *lhp, *fp, *vp;
  int l, j;
  char *newfield;
  l = strlen(field);
  newfield = (char *)malloc(l + 3);
  *newfield = 10;
  strncpy(newfield + 1, field, l);
  *(newfield + l + 1) = '=';
  *(newfield + l + 2) = (char)0;
  l += 2;
  lhp = 0;
  for (hp = header; *hp != '}'; hp++) {
    for (fp = newfield, j = 0; j < l && *(hp + j) == *fp; fp++, j++)
      ;
    if (j == l)
      lhp = hp;
  }
  if (lhp == 0)
    value[0] = 0;
  else {
    for (hp = lhp; *hp != '='; hp++)
      ;
    for (lhp = hp + 1, vp = value; *lhp != ';' && *lhp != 0; lhp++, vp++)
      *vp = *lhp;
    *(vp++) = 0;
  }
  free(newfield);
}
```