ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<version>:
  endbr64
  lea    D4(%rip),%rsi
  jmp    1050 <fprintf@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D4
data_type: string

tool: D4: romcc 0.80 released 18 November 2015


assistant: ```c
void version(FILE *fp) {
  fprintf(fp, "romcc "
              "0"
              "."
              "80"
              " released "
              "18 November 2015"
              "\n");
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<version>:
  endbr64
  lea    D0(%rip),%rsi
  jmp    1050 <fprintf@plt>
```

tool_calls: name: retrieve_data
arguments: tag: D0
type: string

tool: D0: romcc 0.80 released 18 November 2015


assistant: ```c
void version(FILE *fp) {
  fprintf(fp, "romcc "
              "0"
              "."
              "80"
              " released "
              "18 November 2015"
              "\n");
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<SeqGCGCheckSum>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  movl   $0x0,-0x1c(%rbp)
  movq   $0x0,-0x18(%rbp)
  jmp    L15
L0:
  mov    -0x1c(%rbp),%eax
  movslq %eax,%rdx
  imul   $0xffffffff8fb823ef,%rdx,%rdx
  shr    $0x20,%rdx
  add    %eax,%edx
  sar    $0x5,%edx
  mov    %eax,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%edx
  imul   $0x39,%edx,%ecx
  sub    %ecx,%eax
  mov    %eax,%edx
  lea    0x1(%rdx),%ebx
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <toupper@plt>
  imul   %ebx,%eax
  cltq
  add    %rax,-0x18(%rbp)
  addl   $0x1,-0x1c(%rbp)
  addq   $0x1,-0x28(%rbp)
L15:
  mov    -0x1c(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jl     L0
  mov    -0x18(%rbp),%rcx
  movabs $0x346dc5d63886594b,%rdx
  mov    %rcx,%rax
  imul   %rdx
  mov    %rdx,%rax
  sar    $0xb,%rax
  mov    %rcx,%rdx
  sar    $0x3f,%rdx
  sub    %rdx,%rax
  imul   $0x2710,%rax,%rdx
  mov    %rcx,%rax
  sub    %rdx,%rax
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
int SeqGCGCheckSum(char *seq, int len) {
  int i;
  long check;
  for (i = 0, check = 0; i < len; i++, seq++)
    check += ((i % 57) + 1) * toupper(*seq);
  return (check % 10000);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<SeqGCGCheckSum>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %esi,%esi
  jle    L7
  mov    %rdi,%r13
  mov    %esi,%r12d
  mov    $0x0,%ebx
  mov    $0x0,%ebp
L3:
  movsbl 0x0(%r13,%rbx,1),%edi
  call   <toupper@plt>
  mov    %eax,%ecx
  movslq %ebx,%rax
  imul   $0xffffffff8fb823ef,%rax,%rax
  shr    $0x20,%rax
  add    %ebx,%eax
  sar    $0x5,%eax
  mov    %ebx,%edx
  sar    $0x1f,%edx
  sub    %edx,%eax
  imul   $0x39,%eax,%eax
  mov    %ebx,%edx
  sub    %eax,%edx
  lea    0x1(%rdx),%eax
  imul   %ecx,%eax
  cltq
  add    %rax,%rbp
  add    $0x1,%rbx
  cmp    %r12,%rbx
  jne    L3
L2:
  movabs $0x346dc5d63886594b,%rdx
  mov    %rbp,%rax
  imul   %rdx
  sar    $0xb,%rdx
  mov    %rbp,%rax
  sar    $0x3f,%rax
  sub    %rax,%rdx
  imul   $0x2710,%rdx,%rdx
  mov    %ebp,%eax
  sub    %edx,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L7:
  mov    $0x0,%ebp
  jmp    L2
```

assistant: ```c
int SeqGCGCheckSum(char *seq, int len) {
  int i;
  long check;
  for (i = 0, check = 0; i < len; i++, seq++)
    check += ((i % 57) + 1) * toupper(*seq);
  return (check % 10000);
}
```
user: Translate the below assembly code into C programming language:

```asm
<SeqGCGCheckSum>:
  endbr64
  test   %esi,%esi
  jle    L8
  push   %r13
  xor    %r13d,%r13d
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  movslq %esi,%rbx
  sub    $0x8,%rsp
  nopw   0x0(%rax,%rax,1)
L2:
  movsbl 0x0(%rbp,%r13,1),%edi
  call   <toupper@plt>
  mov    %r13d,%edx
  imul   $0x1f7047dd,%rdx,%rdx
  mov    %eax,%r8d
  mov    %r13d,%eax
  shr    $0x20,%rdx
  sub    %edx,%eax
  shr    %eax
  add    %edx,%eax
  mov    %r13d,%edx
  add    $0x1,%r13
  shr    $0x5,%eax
  imul   $0x39,%eax,%eax
  sub    %eax,%edx
  lea    0x1(%rdx),%eax
  imul   %r8d,%eax
  cltq
  add    %rax,%r12
  cmp    %r13,%rbx
  jne    L2
  mov    %r12,%rax
  add    $0x8,%rsp
  movabs $0x346dc5d63886594b,%rdx
  imul   %rdx
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  sar    $0x3f,%rax
  sar    $0xb,%rdx
  sub    %rax,%rdx
  mov    %r12d,%eax
  pop    %r12
  pop    %r13
  imul   $0x2710,%rdx,%rdx
  sub    %edx,%eax
  ret
  nopw   0x0(%rax,%rax,1)
L8:
  xor    %eax,%eax
  ret
```

assistant: ```c
int SeqGCGCheckSum(char *seq, int len) {
  int i;
  long check;
  for (i = 0, check = 0; i < len; i++, seq++)
    check += ((i % 57) + 1) * toupper(*seq);
  return (check % 10000);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<SeqGCGCheckSum>:
  endbr64
  test   %esi,%esi
  jle    L1
  push   %r13
  xor    %r13d,%r13d
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  movslq %esi,%rbx
  sub    $0x8,%rsp
  nopw   0x0(%rax,%rax,1)
L2:
  movsbl 0x0(%rbp,%r13,1),%edi
  call   <toupper@plt>
  mov    %r13d,%edx
  imul   $0x1f7047dd,%rdx,%rdx
  mov    %eax,%r8d
  mov    %r13d,%eax
  shr    $0x20,%rdx
  sub    %edx,%eax
  shr    %eax
  add    %edx,%eax
  mov    %r13d,%edx
  add    $0x1,%r13
  shr    $0x5,%eax
  imul   $0x39,%eax,%eax
  sub    %eax,%edx
  lea    0x1(%rdx),%eax
  imul   %r8d,%eax
  cltq
  add    %rax,%r12
  cmp    %r13,%rbx
  jne    L2
  mov    %r12,%rax
  add    $0x8,%rsp
  movabs $0x346dc5d63886594b,%rdx
  imul   %rdx
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  sar    $0x3f,%rax
  sar    $0xb,%rdx
  sub    %rax,%rdx
  mov    %r12d,%eax
  pop    %r12
  pop    %r13
  imul   $0x2710,%rdx,%rdx
  sub    %edx,%eax
  ret
  nopw   0x0(%rax,%rax,1)
L1:
  xor    %eax,%eax
  ret
```

assistant: ```c
int SeqGCGCheckSum(char *seq, int len) {
  int i;
  long check;
  for (i = 0, check = 0; i < len; i++, seq++)
    check += ((i % 57) + 1) * toupper(*seq);
  return (check % 10000);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<fprint_bgp_file_header>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  lea    D2(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fprintf@plt>
  nop
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D2
data_type: string

tool: D2: V;Proto;BEST;          prefix;              GW;       MED;LOCAL_PREF;    WEIGHT;ORIGIN;AS_PATH;


assistant: ```c
void fprint_bgp_file_header(FILE *out) {
  fprintf(out, "V;Proto;BEST;          prefix;              GW;       MED;"
               "LOCAL_PREF;    WEIGHT;ORIGIN;AS_PATH;\n");
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<fprint_bgp_file_header>:
  endbr64
  sub    $0x8,%rsp
  lea    D9(%rip),%rsi
  call   <fprintf@plt>
  add    $0x8,%rsp
  ret
```

tool_calls: name: parse_data
arguments: label: D9
type_infered: string

tool: D9: V;Proto;BEST;          prefix;              GW;       MED;LOCAL_PREF;    WEIGHT;ORIGIN;AS_PATH;


assistant: ```c
void fprint_bgp_file_header(FILE *out) {
  fprintf(out, "V;Proto;BEST;          prefix;              GW;       MED;"
               "LOCAL_PREF;    WEIGHT;ORIGIN;AS_PATH;\n");
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<fprint_bgp_file_header>:
  endbr64
  lea    D9(%rip),%rsi
  jmp    1050 <fprintf@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D9
type_guessed: string

tool: D9: V;Proto;BEST;          prefix;              GW;       MED;LOCAL_PREF;    WEIGHT;ORIGIN;AS_PATH;


assistant: ```c
void fprint_bgp_file_header(FILE *out) {
  fprintf(out, "V;Proto;BEST;          prefix;              GW;       MED;"
               "LOCAL_PREF;    WEIGHT;ORIGIN;AS_PATH;\n");
}
```
user: Translate the below assembly code into C programming language:

```asm
<fprint_bgp_file_header>:
  endbr64
  lea    D1(%rip),%rsi
  jmp    1050 <fprintf@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D1
datatype: string

tool: D1: V;Proto;BEST;          prefix;              GW;       MED;LOCAL_PREF;    WEIGHT;ORIGIN;AS_PATH;


assistant: ```c
void fprint_bgp_file_header(FILE *out) {
  fprintf(out, "V;Proto;BEST;          prefix;              GW;       MED;"
               "LOCAL_PREF;    WEIGHT;ORIGIN;AS_PATH;\n");
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<quat_of_eulers>:
  endbr64
  push   %r14
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,%rbx
  movsd  D12(%rip),%xmm3
  mulsd  %xmm3,%xmm0
  pxor   %xmm5,%xmm5
  cvtsd2ss %xmm0,%xmm5
  movd   %xmm5,%r14d
  mulsd  %xmm3,%xmm1
  pxor   %xmm6,%xmm6
  cvtsd2ss %xmm1,%xmm6
  movss  %xmm6,0x8(%rsp)
  mulsd  %xmm3,%xmm2
  pxor   %xmm3,%xmm3
  cvtsd2ss %xmm2,%xmm3
  movss  %xmm3,0xc(%rsp)
  movaps %xmm5,%xmm0
  call   <sin@plt>
  movss  %xmm0,0x10(%rsp)
  movd   %r14d,%xmm0
  call   <cos@plt>
  movss  %xmm0,0x14(%rsp)
  movss  0x8(%rsp),%xmm0
  call   <sin@plt>
  movss  %xmm0,0x18(%rsp)
  movss  0x8(%rsp),%xmm0
  call   <cos@plt>
  movss  %xmm0,0x8(%rsp)
  movss  0xc(%rsp),%xmm0
  call   <sin@plt>
  movss  %xmm0,0x1c(%rsp)
  movss  0xc(%rsp),%xmm0
  call   <cos@plt>
  movaps %xmm0,%xmm3
  movss  0x14(%rsp),%xmm6
  movaps %xmm6,%xmm2
  movss  0x8(%rsp),%xmm8
  mulss  %xmm8,%xmm2
  movss  0x10(%rsp),%xmm4
  movaps %xmm4,%xmm5
  movss  0x18(%rsp),%xmm9
  mulss  %xmm9,%xmm5
  movaps %xmm2,%xmm1
  mulss  %xmm0,%xmm1
  movaps %xmm1,%xmm0
  movss  0x1c(%rsp),%xmm7
  movaps %xmm7,%xmm1
  mulss  %xmm5,%xmm1
  addss  %xmm1,%xmm0
  cvtss2sd %xmm0,%xmm0
  movsd  %xmm0,(%rbx)
  xorps  D14(%rip),%xmm6
  movaps %xmm6,%xmm1
  mulss  %xmm9,%xmm1
  mulss  %xmm8,%xmm4
  movaps %xmm4,%xmm0
  movaps %xmm7,%xmm4
  mulss  %xmm1,%xmm4
  movaps %xmm0,%xmm6
  mulss  %xmm3,%xmm6
  addss  %xmm6,%xmm4
  cvtss2sd %xmm4,%xmm4
  movsd  %xmm4,0x8(%rbx)
  mulss  %xmm3,%xmm1
  mulss  %xmm7,%xmm0
  subss  %xmm1,%xmm0
  cvtss2sd %xmm0,%xmm0
  movsd  %xmm0,0x10(%rbx)
  mulss  %xmm7,%xmm2
  mulss  %xmm3,%xmm5
  subss  %xmm5,%xmm2
  cvtss2sd %xmm2,%xmm2
  movsd  %xmm2,0x18(%rbx)
  add    $0x28,%rsp
  pop    %rbx
  pop    %r14
  ret
```

tool_calls: name: parse_data
arguments: data_label: D12
type: byte[8]
name: parse_data
arguments: data_label: D14
type: byte[16]

tool: {"D12": [0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x3f]}

tool: {"D14": [0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]}

assistant: ```c
void quat_of_eulers(double *quat, double phi, double theta, double psi) {
  const float phi2 = phi / 2.0;
  const float theta2 = theta / 2.0;
  const float psi2 = psi / 2.0;
  const float sinphi2 = sin(phi2);
  const float cosphi2 = cos(phi2);
  const float sintheta2 = sin(theta2);
  const float costheta2 = cos(theta2);
  const float sinpsi2 = sin(psi2);
  const float cospsi2 = cos(psi2);
  quat[0] = cosphi2 * costheta2 * cospsi2 + sinphi2 * sintheta2 * sinpsi2;
  quat[1] = -cosphi2 * sintheta2 * sinpsi2 + sinphi2 * costheta2 * cospsi2;
  quat[2] = cosphi2 * sintheta2 * cospsi2 + sinphi2 * costheta2 * sinpsi2;
  quat[3] = cosphi2 * costheta2 * sinpsi2 - sinphi2 * sintheta2 * cospsi2;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<quat_of_eulers>:
  endbr64
  push   %rbx
  pxor   %xmm4,%xmm4
  mov    %rdi,%rbx
  sub    $0x20,%rsp
  movsd  D12(%rip),%xmm3
  mulsd  %xmm3,%xmm0
  mulsd  %xmm3,%xmm1
  mulsd  %xmm3,%xmm2
  cvtsd2ss %xmm0,%xmm4
  movaps %xmm4,%xmm0
  movss  %xmm4,0x8(%rsp)
  cvtsd2ss %xmm1,%xmm1
  movss  %xmm1,0x10(%rsp)
  cvtsd2ss %xmm2,%xmm2
  movss  %xmm2,0xc(%rsp)
  call   <sin@plt>
  movss  0x8(%rsp),%xmm4
  movss  %xmm0,0x1c(%rsp)
  movaps %xmm4,%xmm0
  call   <cos@plt>
  movss  0x10(%rsp),%xmm1
  movss  %xmm0,0x18(%rsp)
  movaps %xmm1,%xmm0
  movss  %xmm1,0x8(%rsp)
  call   <sin@plt>
  movss  0x8(%rsp),%xmm1
  movss  %xmm0,0x14(%rsp)
  movaps %xmm1,%xmm0
  call   <cos@plt>
  movss  0xc(%rsp),%xmm2
  movss  %xmm0,0x10(%rsp)
  movaps %xmm2,%xmm0
  call   <sin@plt>
  movss  0xc(%rsp),%xmm2
  movss  %xmm0,0x8(%rsp)
  movaps %xmm2,%xmm0
  call   <cos@plt>
  movss  0x18(%rsp),%xmm4
  movss  0x1c(%rsp),%xmm3
  movss  0x10(%rsp),%xmm7
  movss  0x14(%rsp),%xmm8
  movaps %xmm0,%xmm1
  movaps %xmm3,%xmm6
  movaps %xmm4,%xmm0
  movss  0x8(%rsp),%xmm5
  xorps  D14(%rip),%xmm4
  mulss  %xmm7,%xmm0
  mulss  %xmm8,%xmm6
  mulss  %xmm8,%xmm4
  mulss  %xmm7,%xmm3
  movaps %xmm0,%xmm2
  mulss  %xmm1,%xmm2
  movaps %xmm6,%xmm9
  mulss  %xmm5,%xmm9
  mulss  %xmm5,%xmm0
  movaps %xmm3,%xmm7
  mulss  %xmm1,%xmm7
  mulss  %xmm5,%xmm3
  mulss  %xmm1,%xmm6
  addss  %xmm9,%xmm2
  cvtss2sd %xmm2,%xmm2
  movsd  %xmm2,(%rbx)
  movaps %xmm4,%xmm2
  mulss  %xmm5,%xmm2
  subss  %xmm6,%xmm0
  mulss  %xmm1,%xmm4
  cvtss2sd %xmm0,%xmm0
  movsd  %xmm0,0x18(%rbx)
  addss  %xmm7,%xmm2
  subss  %xmm4,%xmm3
  cvtss2sd %xmm2,%xmm2
  movsd  %xmm2,0x8(%rbx)
  cvtss2sd %xmm3,%xmm3
  movsd  %xmm3,0x10(%rbx)
  add    $0x20,%rsp
  pop    %rbx
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D12
type_guessed: byte[8]
name: unpack_data
arguments: data_tag: D14
type_guessed: byte[16]

tool: {"D12": [0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x3f]}

tool: {"D14": [0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]}

assistant: ```c
void quat_of_eulers(double *quat, double phi, double theta, double psi) {
  const float phi2 = phi / 2.0;
  const float theta2 = theta / 2.0;
  const float psi2 = psi / 2.0;
  const float sinphi2 = sin(phi2);
  const float cosphi2 = cos(phi2);
  const float sintheta2 = sin(theta2);
  const float costheta2 = cos(theta2);
  const float sinpsi2 = sin(psi2);
  const float cospsi2 = cos(psi2);
  quat[0] = cosphi2 * costheta2 * cospsi2 + sinphi2 * sintheta2 * sinpsi2;
  quat[1] = -cosphi2 * sintheta2 * sinpsi2 + sinphi2 * costheta2 * cospsi2;
  quat[2] = cosphi2 * sintheta2 * cospsi2 + sinphi2 * costheta2 * sinpsi2;
  quat[3] = cosphi2 * costheta2 * sinpsi2 - sinphi2 * sintheta2 * cospsi2;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<quat_of_eulers>:
  endbr64
  push   %rbx
  pxor   %xmm4,%xmm4
  mov    %rdi,%rbx
  sub    $0x20,%rsp
  movsd  D18(%rip),%xmm3
  mulsd  %xmm3,%xmm0
  mulsd  %xmm3,%xmm1
  mulsd  %xmm3,%xmm2
  cvtsd2ss %xmm0,%xmm4
  movaps %xmm4,%xmm0
  movss  %xmm4,0x8(%rsp)
  cvtsd2ss %xmm1,%xmm1
  movss  %xmm1,0x10(%rsp)
  cvtsd2ss %xmm2,%xmm2
  movss  %xmm2,0xc(%rsp)
  call   <sin@plt>
  movss  0x8(%rsp),%xmm4
  movss  %xmm0,0x1c(%rsp)
  movaps %xmm4,%xmm0
  call   <cos@plt>
  movss  0x10(%rsp),%xmm1
  movss  %xmm0,0x18(%rsp)
  movaps %xmm1,%xmm0
  movss  %xmm1,0x8(%rsp)
  call   <sin@plt>
  movss  0x8(%rsp),%xmm1
  movss  %xmm0,0x14(%rsp)
  movaps %xmm1,%xmm0
  call   <cos@plt>
  movss  0xc(%rsp),%xmm2
  movss  %xmm0,0x10(%rsp)
  movaps %xmm2,%xmm0
  call   <sin@plt>
  movss  0xc(%rsp),%xmm2
  movss  %xmm0,0x8(%rsp)
  movaps %xmm2,%xmm0
  call   <cos@plt>
  movss  0x18(%rsp),%xmm4
  movss  0x1c(%rsp),%xmm3
  movss  0x10(%rsp),%xmm7
  movss  0x14(%rsp),%xmm8
  movaps %xmm0,%xmm2
  movaps %xmm4,%xmm1
  movaps %xmm3,%xmm6
  movss  0x8(%rsp),%xmm5
  xorps  D4(%rip),%xmm4
  mulss  %xmm7,%xmm1
  mulss  %xmm8,%xmm6
  mulss  %xmm7,%xmm3
  mulss  %xmm8,%xmm4
  movaps %xmm1,%xmm0
  mulss  %xmm2,%xmm0
  movaps %xmm6,%xmm7
  mulss  %xmm5,%xmm7
  movaps %xmm3,%xmm8
  mulss  %xmm2,%xmm8
  mulss  %xmm5,%xmm3
  mulss  %xmm5,%xmm1
  mulss  %xmm2,%xmm6
  addss  %xmm7,%xmm0
  movaps %xmm4,%xmm7
  mulss  %xmm5,%xmm7
  mulss  %xmm2,%xmm4
  subss  %xmm6,%xmm1
  addss  %xmm8,%xmm7
  subss  %xmm4,%xmm3
  unpcklps %xmm7,%xmm0
  unpcklps %xmm1,%xmm3
  movaps %xmm0,%xmm1
  cvtps2pd %xmm0,%xmm0
  movups %xmm0,(%rbx)
  movlhps %xmm3,%xmm1
  pxor   %xmm0,%xmm0
  movhlps %xmm1,%xmm0
  cvtps2pd %xmm0,%xmm0
  movups %xmm0,0x10(%rbx)
  add    $0x20,%rsp
  pop    %rbx
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D18
data_type: byte[8]
name: disassemble_data
arguments: tag: D4
data_type: byte[16]

tool: {"D18": [0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x3f]}

tool: {"D4": [0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]}

assistant: ```c
void quat_of_eulers(double *quat, double phi, double theta, double psi) {
  const float phi2 = phi / 2.0;
  const float theta2 = theta / 2.0;
  const float psi2 = psi / 2.0;
  const float sinphi2 = sin(phi2);
  const float cosphi2 = cos(phi2);
  const float sintheta2 = sin(theta2);
  const float costheta2 = cos(theta2);
  const float sinpsi2 = sin(psi2);
  const float cospsi2 = cos(psi2);
  quat[0] = cosphi2 * costheta2 * cospsi2 + sinphi2 * sintheta2 * sinpsi2;
  quat[1] = -cosphi2 * sintheta2 * sinpsi2 + sinphi2 * costheta2 * cospsi2;
  quat[2] = cosphi2 * sintheta2 * cospsi2 + sinphi2 * costheta2 * sinpsi2;
  quat[3] = cosphi2 * costheta2 * sinpsi2 - sinphi2 * sintheta2 * cospsi2;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<uDMAChannelAttributeDisable>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    -0x8(%rbp),%rax
  and    $0xffe0,%eax
  test   %rax,%rax
  sete   %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <DEBUG_ASSERT@plt>
  mov    -0x10(%rbp),%rax
  and    $0xfffffffffffffff0,%rax
  test   %rax,%rax
  sete   %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <DEBUG_ASSERT@plt>
  andq   $0x1f,-0x8(%rbp)
  mov    -0x10(%rbp),%rax
  and    $0x1,%eax
  test   %rax,%rax
  je     L39
  mov    -0x8(%rbp),%rax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    $0x400ff01c,%edx
  cltq
  mov    %rax,(%rdx)
L39:
  mov    -0x10(%rbp),%rax
  and    $0x2,%eax
  test   %rax,%rax
  je     L26
  mov    -0x8(%rbp),%rax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    $0x400ff034,%edx
  cltq
  mov    %rax,(%rdx)
L26:
  mov    -0x10(%rbp),%rax
  and    $0x4,%eax
  test   %rax,%rax
  je     L28
  mov    -0x8(%rbp),%rax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    $0x400ff03c,%edx
  cltq
  mov    %rax,(%rdx)
L28:
  mov    -0x10(%rbp),%rax
  and    $0x8,%eax
  test   %rax,%rax
  je     L25
  mov    -0x8(%rbp),%rax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    $0x400ff024,%edx
  cltq
  mov    %rax,(%rdx)
L25:
  nop
  leave
  ret
```

assistant: ```c
void uDMAChannelAttributeDisable(unsigned long ulChannelNum, unsigned long ulAttr) {
  DEBUG_ASSERT((ulChannelNum & 0xffff) < 32);
  DEBUG_ASSERT((ulAttr & ~(0x00000001 | 0x00000002 | 0x00000004 | 0x00000008)) == 0);
  ulChannelNum &= 0x1f;
  if (ulAttr & 0x00000001) {
    (*((volatile unsigned long *)(0x400FF01C))) = 1 << ulChannelNum;
  }
  if (ulAttr & 0x00000002) {
    (*((volatile unsigned long *)(0x400FF034))) = 1 << ulChannelNum;
  }
  if (ulAttr & 0x00000004) {
    (*((volatile unsigned long *)(0x400FF03C))) = 1 << ulChannelNum;
  }
  if (ulAttr & 0x00000008) {
    (*((volatile unsigned long *)(0x400FF024))) = 1 << ulChannelNum;
  }
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<uDMAChannelAttributeDisable>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  mov    %rsi,%rbp
  test   $0xffe0,%edi
  sete   %dil
  movzbl %dil,%edi
  call   <DEBUG_ASSERT@plt>
  test   $0xfffffffffffffff0,%rbp
  sete   %dil
  movzbl %dil,%edi
  call   <DEBUG_ASSERT@plt>
  mov    %rbx,%rcx
  and    $0x1f,%ecx
  test   $0x1,%bpl
  je     L31
  mov    $0x1,%eax
  shl    %cl,%eax
  cltq
  mov    %rax,0x400ff01c
L31:
  test   $0x2,%bpl
  je     L7
  mov    $0x1,%eax
  shl    %cl,%eax
  cltq
  mov    %rax,0x400ff034
L7:
  test   $0x4,%bpl
  je     L1
  mov    $0x1,%eax
  shl    %cl,%eax
  cltq
  mov    %rax,0x400ff03c
L1:
  test   $0x8,%bpl
  je     L23
  mov    $0x1,%eax
  shl    %cl,%eax
  cltq
  mov    %rax,0x400ff024
L23:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
void uDMAChannelAttributeDisable(unsigned long ulChannelNum, unsigned long ulAttr) {
  DEBUG_ASSERT((ulChannelNum & 0xffff) < 32);
  DEBUG_ASSERT((ulAttr & ~(0x00000001 | 0x00000002 | 0x00000004 | 0x00000008)) == 0);
  ulChannelNum &= 0x1f;
  if (ulAttr & 0x00000001) {
    (*((volatile unsigned long *)(0x400FF01C))) = 1 << ulChannelNum;
  }
  if (ulAttr & 0x00000002) {
    (*((volatile unsigned long *)(0x400FF034))) = 1 << ulChannelNum;
  }
  if (ulAttr & 0x00000004) {
    (*((volatile unsigned long *)(0x400FF03C))) = 1 << ulChannelNum;
  }
  if (ulAttr & 0x00000008) {
    (*((volatile unsigned long *)(0x400FF024))) = 1 << ulChannelNum;
  }
}
```
user: What is the c source code of the assembly code below?

```asm
<uDMAChannelAttributeDisable>:
  endbr64
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  test   $0xffe0,%edi
  sete   %dil
  movzbl %dil,%edi
  call   <DEBUG_ASSERT@plt>
  xor    %edi,%edi
  test   $0xfffffffffffffff0,%rbp
  sete   %dil
  call   <DEBUG_ASSERT@plt>
  mov    %rbx,%rcx
  and    $0x1f,%ecx
  test   $0x1,%bpl
  je     L13
  mov    $0x1,%eax
  shl    %cl,%eax
  cltq
  mov    %rax,0x400ff01c
L13:
  test   $0x2,%bpl
  je     L2
  mov    $0x1,%eax
  shl    %cl,%eax
  cltq
  mov    %rax,0x400ff034
L2:
  test   $0x4,%bpl
  je     L19
  mov    $0x1,%eax
  shl    %cl,%eax
  cltq
  mov    %rax,0x400ff03c
L19:
  and    $0x8,%ebp
  je     L26
  mov    $0x1,%eax
  shl    %cl,%eax
  cltq
  mov    %rax,0x400ff024
L26:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
void uDMAChannelAttributeDisable(unsigned long ulChannelNum, unsigned long ulAttr) {
  DEBUG_ASSERT((ulChannelNum & 0xffff) < 32);
  DEBUG_ASSERT((ulAttr & ~(0x00000001 | 0x00000002 | 0x00000004 | 0x00000008)) == 0);
  ulChannelNum &= 0x1f;
  if (ulAttr & 0x00000001) {
    (*((volatile unsigned long *)(0x400FF01C))) = 1 << ulChannelNum;
  }
  if (ulAttr & 0x00000002) {
    (*((volatile unsigned long *)(0x400FF034))) = 1 << ulChannelNum;
  }
  if (ulAttr & 0x00000004) {
    (*((volatile unsigned long *)(0x400FF03C))) = 1 << ulChannelNum;
  }
  if (ulAttr & 0x00000008) {
    (*((volatile unsigned long *)(0x400FF024))) = 1 << ulChannelNum;
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<uDMAChannelAttributeDisable>:
  endbr64
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  test   $0xffe0,%edi
  sete   %dil
  movzbl %dil,%edi
  call   <DEBUG_ASSERT@plt>
  xor    %edi,%edi
  test   $0xfffffffffffffff0,%rbp
  sete   %dil
  call   <DEBUG_ASSERT@plt>
  mov    %rbx,%rcx
  and    $0x1f,%ecx
  test   $0x1,%bpl
  je     L6
  mov    $0x1,%eax
  shl    %cl,%eax
  cltq
  mov    %rax,0x400ff01c
L6:
  test   $0x2,%bpl
  je     L3
  mov    $0x1,%eax
  shl    %cl,%eax
  cltq
  mov    %rax,0x400ff034
L3:
  test   $0x4,%bpl
  je     L11
  mov    $0x1,%eax
  shl    %cl,%eax
  cltq
  mov    %rax,0x400ff03c
L11:
  and    $0x8,%ebp
  je     L9
  mov    $0x1,%eax
  shl    %cl,%eax
  cltq
  mov    %rax,0x400ff024
L9:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
void uDMAChannelAttributeDisable(unsigned long ulChannelNum, unsigned long ulAttr) {
  DEBUG_ASSERT((ulChannelNum & 0xffff) < 32);
  DEBUG_ASSERT((ulAttr & ~(0x00000001 | 0x00000002 | 0x00000004 | 0x00000008)) == 0);
  ulChannelNum &= 0x1f;
  if (ulAttr & 0x00000001) {
    (*((volatile unsigned long *)(0x400FF01C))) = 1 << ulChannelNum;
  }
  if (ulAttr & 0x00000002) {
    (*((volatile unsigned long *)(0x400FF034))) = 1 << ulChannelNum;
  }
  if (ulAttr & 0x00000004) {
    (*((volatile unsigned long *)(0x400FF03C))) = 1 << ulChannelNum;
  }
  if (ulAttr & 0x00000008) {
    (*((volatile unsigned long *)(0x400FF024))) = 1 << ulChannelNum;
  }
}
```