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

```asm
<cdfBinomial>:
  endbr64
  cmp    %rdi,%rsi
  jl     L4
  movsd  D15(%rip),%xmm0
  ret
L4:
  sub    $0x8,%rsp
  mov    %rdi,%rax
  sub    %rsi,%rax
  lea    0x1(%rsi),%rdi
  mov    %rax,%rsi
  call   <InBeta@plt>
  movapd %xmm0,%xmm1
  movsd  D15(%rip),%xmm0
  subsd  %xmm1,%xmm0
  add    $0x8,%rsp
  ret
```

tool_calls: name: unpack_data
arguments: label: D15
type_guessed: f64

tool: D15: 1

assistant: ```c
double cdfBinomial(long n, double p, long x) {
  if (x < n)
    return (1.0 - InBeta(x + 1, n - x, p));
  else
    return (1.0);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<cdfBinomial>:
  endbr64
  cmp    %rdi,%rsi
  jl     L7
  movsd  D8(%rip),%xmm0
  ret
  nopw   0x0(%rax,%rax,1)
L7:
  sub    %rsi,%rdi
  sub    $0x8,%rsp
  mov    %rdi,%r8
  lea    0x1(%rsi),%rdi
  mov    %r8,%rsi
  call   <InBeta@plt>
  movapd %xmm0,%xmm1
  movsd  D8(%rip),%xmm0
  add    $0x8,%rsp
  subsd  %xmm1,%xmm0
  ret
```

tool_calls: name: extract_symbolic_data
arguments: tag: D8
data_type: f64

tool: D8: 1

assistant: ```c
double cdfBinomial(long n, double p, long x) {
  if (x < n)
    return (1.0 - InBeta(x + 1, n - x, p));
  else
    return (1.0);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<cdfBinomial>:
  endbr64
  cmp    %rdi,%rsi
  jl     L9
  movsd  D1(%rip),%xmm0
  ret
  nopw   0x0(%rax,%rax,1)
L9:
  sub    %rsi,%rdi
  sub    $0x8,%rsp
  mov    %rdi,%r8
  lea    0x1(%rsi),%rdi
  mov    %r8,%rsi
  call   <InBeta@plt>
  movapd %xmm0,%xmm1
  movsd  D1(%rip),%xmm0
  add    $0x8,%rsp
  subsd  %xmm1,%xmm0
  ret
```

tool_calls: name: unpack_data
arguments: label: D1
data_type: f64

tool: D1: 1

assistant: ```c
double cdfBinomial(long n, double p, long x) {
  if (x < n)
    return (1.0 - InBeta(x + 1, n - x, p));
  else
    return (1.0);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<has_suffix>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x8(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x8(%rbp),%eax
  cmp    -0x4(%rbp),%eax
  jle    L22
  mov    -0x8(%rbp),%eax
  cltq
  mov    -0x4(%rbp),%edx
  movslq %edx,%rdx
  sub    %rdx,%rax
  mov    %rax,%rcx
  mov    -0x18(%rbp),%rax
  add    %rax,%rcx
  mov    -0x4(%rbp),%edx
  mov    -0x20(%rbp),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L22
  mov    $0x1,%eax
  jmp    L13
L22:
  mov    $0x0,%eax
L13:
  leave
  ret
```

assistant: ```c
int has_suffix(const char *name, const char *suffix) {
  int nlen = strlen(name);
  int slen = strlen(suffix);
  return nlen > slen && strncmp(name + nlen - slen, suffix, slen) == 0;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<has_suffix>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbp
  mov    %rsi,%r12
  call   <strlen@plt>
  mov    %eax,%ebx
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  mov    $0x0,%eax
  cmp    %edx,%ebx
  jg     L16
L18:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L16:
  movslq %ebx,%rbx
  movslq %edx,%rax
  sub    %rax,%rbx
  lea    0x0(%rbp,%rbx,1),%rdi
  mov    %r12,%rsi
  call   <strncmp@plt>
  test   %rax,%rax
  sete   %al
  movzbl %al,%eax
  jmp    L18
```

assistant: ```c
int has_suffix(const char *name, const char *suffix) {
  int nlen = strlen(name);
  int slen = strlen(suffix);
  return nlen > slen && strncmp(name + nlen - slen, suffix, slen) == 0;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<has_suffix>:
  endbr64
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  call   <strlen@plt>
  mov    %r12,%rdi
  movslq %eax,%rbx
  call   <strlen@plt>
  mov    %eax,%edx
  xor    %eax,%eax
  cmp    %edx,%ebx
  jg     L5
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L5:
  movslq %edx,%rax
  mov    %r12,%rsi
  sub    %rax,%rbx
  lea    0x0(%rbp,%rbx,1),%rdi
  call   <strncmp@plt>
  pop    %rbx
  pop    %rbp
  test   %rax,%rax
  pop    %r12
  sete   %al
  movzbl %al,%eax
  ret
```

assistant: ```c
int has_suffix(const char *name, const char *suffix) {
  int nlen = strlen(name);
  int slen = strlen(suffix);
  return nlen > slen && strncmp(name + nlen - slen, suffix, slen) == 0;
}
```
user: Translate the below assembly code into C programming language:

```asm
<has_suffix>:
  endbr64
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  call   <strlen@plt>
  mov    %r12,%rdi
  movslq %eax,%rbx
  call   <strlen@plt>
  mov    %eax,%edx
  xor    %eax,%eax
  cmp    %edx,%ebx
  jg     L4
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L4:
  movslq %edx,%rax
  mov    %r12,%rsi
  sub    %rax,%rbx
  lea    0x0(%rbp,%rbx,1),%rdi
  call   <strncmp@plt>
  pop    %rbx
  pop    %rbp
  test   %rax,%rax
  pop    %r12
  sete   %al
  movzbl %al,%eax
  ret
```

assistant: ```c
int has_suffix(const char *name, const char *suffix) {
  int nlen = strlen(name);
  int slen = strlen(suffix);
  return nlen > slen && strncmp(name + nlen - slen, suffix, slen) == 0;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<mips_change_flags>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x14(%rbp)
  movl   $0x0,-0x4(%rbp)
  mov    -0x14(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  je     L54
  mov    D32(%rip),%rax
  mov    (%rax),%eax
  or     %eax,-0x4(%rbp)
L54:
  mov    -0x14(%rbp),%eax
  and    $0x2,%eax
  test   %eax,%eax
  je     L79
  mov    D88(%rip),%rax
  mov    (%rax),%eax
  or     %eax,-0x4(%rbp)
L79:
  mov    -0x14(%rbp),%eax
  and    $0x20,%eax
  test   %eax,%eax
  je     L76
  mov    D87(%rip),%rax
  mov    (%rax),%eax
  or     %eax,-0x4(%rbp)
L76:
  mov    -0x14(%rbp),%eax
  and    $0x10,%eax
  test   %eax,%eax
  je     L2
  mov    D65(%rip),%rax
  mov    (%rax),%eax
  or     %eax,-0x4(%rbp)
L2:
  mov    -0x14(%rbp),%eax
  and    $0x100,%eax
  test   %eax,%eax
  je     L34
  mov    D16(%rip),%rax
  mov    (%rax),%eax
  or     %eax,-0x4(%rbp)
L34:
  mov    -0x14(%rbp),%eax
  and    $0x2000,%eax
  test   %eax,%eax
  je     L28
  mov    D43(%rip),%rax
  mov    (%rax),%eax
  or     %eax,-0x4(%rbp)
L28:
  mov    -0x14(%rbp),%eax
  and    $0x10000,%eax
  test   %eax,%eax
  je     L26
  mov    D63(%rip),%rax
  mov    (%rax),%eax
  or     %eax,-0x4(%rbp)
L26:
  mov    -0x14(%rbp),%eax
  and    $0x4000,%eax
  test   %eax,%eax
  je     L57
  mov    D20(%rip),%rax
  mov    (%rax),%eax
  or     %eax,-0x4(%rbp)
L57:
  mov    -0x14(%rbp),%eax
  and    $0x8000,%eax
  test   %eax,%eax
  je     L27
  mov    D12(%rip),%rax
  mov    (%rax),%eax
  or     %eax,-0x4(%rbp)
L27:
  mov    -0x4(%rbp),%eax
  pop    %rbp
  ret
```

assistant: ```c
int mips_change_flags(int flags) {
  int mipsflags = 0;
  if (flags & 0x01)
    mipsflags |= MAP_SHARED;
  if (flags & 0x02)
    mipsflags |= MAP_PRIVATE;
  if (flags & 0x20)
    mipsflags |= MAP_ANONYMOUS;
  if (flags & 0x10)
    mipsflags |= MAP_FIXED;
  if (flags & 0x0100)
    mipsflags |= MAP_GROWSDOWN;
  if (flags & 0x2000)
    mipsflags |= MAP_LOCKED;
  if (flags & 0x10000)
    mipsflags |= MAP_NONBLOCK;
  if (flags & 0x4000)
    mipsflags |= MAP_NORESERVE;
  if (flags & 0x8000)
    mipsflags |= MAP_POPULATE;
  return mipsflags;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<mips_change_flags>:
  endbr64
  mov    %edi,%eax
  and    $0x1,%eax
  je     L70
  mov    D73(%rip),%rax
  mov    (%rax),%eax
L70:
  test   $0x2,%dil
  je     L42
  mov    D30(%rip),%rdx
  or     (%rdx),%eax
L42:
  test   $0x20,%dil
  je     L83
  mov    D36(%rip),%rdx
  or     (%rdx),%eax
L83:
  test   $0x10,%dil
  je     L1
  mov    D58(%rip),%rdx
  or     (%rdx),%eax
L1:
  test   $0x100,%edi
  je     L18
  mov    D75(%rip),%rdx
  or     (%rdx),%eax
L18:
  test   $0x2000,%edi
  je     L73
  mov    D17(%rip),%rdx
  or     (%rdx),%eax
L73:
  test   $0x10000,%edi
  je     L89
  mov    D11(%rip),%rdx
  or     (%rdx),%eax
L89:
  test   $0x4000,%edi
  je     L49
  mov    D2(%rip),%rdx
  or     (%rdx),%eax
L49:
  test   $0x8000,%edi
  je     L2
  mov    D61(%rip),%rdx
  or     (%rdx),%eax
L2:
  ret
```

assistant: ```c
int mips_change_flags(int flags) {
  int mipsflags = 0;
  if (flags & 0x01)
    mipsflags |= MAP_SHARED;
  if (flags & 0x02)
    mipsflags |= MAP_PRIVATE;
  if (flags & 0x20)
    mipsflags |= MAP_ANONYMOUS;
  if (flags & 0x10)
    mipsflags |= MAP_FIXED;
  if (flags & 0x0100)
    mipsflags |= MAP_GROWSDOWN;
  if (flags & 0x2000)
    mipsflags |= MAP_LOCKED;
  if (flags & 0x10000)
    mipsflags |= MAP_NONBLOCK;
  if (flags & 0x4000)
    mipsflags |= MAP_NORESERVE;
  if (flags & 0x8000)
    mipsflags |= MAP_POPULATE;
  return mipsflags;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<mips_change_flags>:
  endbr64
  mov    %edi,%eax
  and    $0x1,%eax
  je     L21
  mov    D3(%rip),%rax
  mov    (%rax),%eax
L21:
  test   $0x2,%dil
  je     L52
  mov    D28(%rip),%rdx
  or     (%rdx),%eax
L52:
  test   $0x20,%dil
  je     L71
  mov    D83(%rip),%rdx
  or     (%rdx),%eax
L71:
  test   $0x10,%dil
  je     L67
  mov    D17(%rip),%rdx
  or     (%rdx),%eax
L67:
  test   $0x100,%edi
  je     L23
  mov    D14(%rip),%rdx
  or     (%rdx),%eax
L23:
  test   $0x2000,%edi
  je     L10
  mov    D61(%rip),%rdx
  or     (%rdx),%eax
L10:
  test   $0x10000,%edi
  je     L48
  mov    D21(%rip),%rdx
  or     (%rdx),%eax
L48:
  test   $0x4000,%edi
  je     L33
  mov    D89(%rip),%rdx
  or     (%rdx),%eax
L33:
  and    $0x8000,%edi
  je     L6
  mov    D25(%rip),%rdx
  or     (%rdx),%eax
L6:
  ret
```

assistant: ```c
int mips_change_flags(int flags) {
  int mipsflags = 0;
  if (flags & 0x01)
    mipsflags |= MAP_SHARED;
  if (flags & 0x02)
    mipsflags |= MAP_PRIVATE;
  if (flags & 0x20)
    mipsflags |= MAP_ANONYMOUS;
  if (flags & 0x10)
    mipsflags |= MAP_FIXED;
  if (flags & 0x0100)
    mipsflags |= MAP_GROWSDOWN;
  if (flags & 0x2000)
    mipsflags |= MAP_LOCKED;
  if (flags & 0x10000)
    mipsflags |= MAP_NONBLOCK;
  if (flags & 0x4000)
    mipsflags |= MAP_NORESERVE;
  if (flags & 0x8000)
    mipsflags |= MAP_POPULATE;
  return mipsflags;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<mips_change_flags>:
  endbr64
  mov    %edi,%eax
  and    $0x1,%eax
  je     L39
  mov    D51(%rip),%rax
  mov    (%rax),%eax
L39:
  test   $0x2,%dil
  je     L50
  mov    D22(%rip),%rdx
  or     (%rdx),%eax
L50:
  test   $0x20,%dil
  je     L6
  mov    D10(%rip),%rdx
  or     (%rdx),%eax
L6:
  test   $0x10,%dil
  je     L10
  mov    D84(%rip),%rdx
  or     (%rdx),%eax
L10:
  test   $0x100,%edi
  je     L4
  mov    D75(%rip),%rdx
  or     (%rdx),%eax
L4:
  test   $0x2000,%edi
  je     L51
  mov    D18(%rip),%rdx
  or     (%rdx),%eax
L51:
  test   $0x10000,%edi
  je     L48
  mov    D46(%rip),%rdx
  or     (%rdx),%eax
L48:
  test   $0x4000,%edi
  je     L60
  mov    D49(%rip),%rdx
  or     (%rdx),%eax
L60:
  and    $0x8000,%edi
  je     L77
  mov    D17(%rip),%rdx
  or     (%rdx),%eax
L77:
  ret
```

assistant: ```c
int mips_change_flags(int flags) {
  int mipsflags = 0;
  if (flags & 0x01)
    mipsflags |= MAP_SHARED;
  if (flags & 0x02)
    mipsflags |= MAP_PRIVATE;
  if (flags & 0x20)
    mipsflags |= MAP_ANONYMOUS;
  if (flags & 0x10)
    mipsflags |= MAP_FIXED;
  if (flags & 0x0100)
    mipsflags |= MAP_GROWSDOWN;
  if (flags & 0x2000)
    mipsflags |= MAP_LOCKED;
  if (flags & 0x10000)
    mipsflags |= MAP_NONBLOCK;
  if (flags & 0x4000)
    mipsflags |= MAP_NORESERVE;
  if (flags & 0x8000)
    mipsflags |= MAP_POPULATE;
  return mipsflags;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<p5glove_normal>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movl   $0x0,-0xc(%rbp)
  jmp    L29
L14:
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  -0x8(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  addl   $0x1,-0xc(%rbp)
L29:
  cmpl   $0x2,-0xc(%rbp)
  jle    L14
  mov    -0x8(%rbp),%rax
  movq   %rax,%xmm0
  call   <sqrt@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0xc(%rbp)
  jmp    L31
L22:
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  divsd  -0x8(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0xc(%rbp)
L31:
  cmpl   $0x2,-0xc(%rbp)
  jle    L22
  nop
  nop
  leave
  ret
```

assistant: ```c
void p5glove_normal(const double v[3], double res[3]) {
  double tmp = 0.0;
  int i;
  for (i = 0; i < 3; i++) {
    tmp += v[i] * v[i];
  }
  tmp = sqrt(tmp);
  for (i = 0; i < 3; i++)
    res[i] = v[i] / tmp;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<p5glove_normal>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    %rsi,%rbp
  mov    (%rdi),%r12
  movq   %r12,%xmm1
  mulsd  %xmm1,%xmm1
  pxor   %xmm2,%xmm2
  addsd  %xmm2,%xmm1
  movsd  0x8(%rdi),%xmm0
  mulsd  %xmm0,%xmm0
  addsd  %xmm0,%xmm1
  movsd  0x10(%rdi),%xmm0
  mulsd  %xmm0,%xmm0
  addsd  %xmm1,%xmm0
  ucomisd %xmm0,%xmm2
  ja     L17
  sqrtsd %xmm0,%xmm0
L9:
  movq   %r12,%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x0(%rbp)
  movsd  0x8(%rbx),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x8(%rbp)
  movsd  0x10(%rbx),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%rbp)
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L17:
  call   <sqrt@plt>
  jmp    L9
```

assistant: ```c
void p5glove_normal(const double v[3], double res[3]) {
  double tmp = 0.0;
  int i;
  for (i = 0; i < 3; i++) {
    tmp += v[i] * v[i];
  }
  tmp = sqrt(tmp);
  for (i = 0; i < 3; i++)
    res[i] = v[i] / tmp;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<p5glove_normal>:
  endbr64
  sub    $0x28,%rsp
  movsd  (%rdi),%xmm2
  movsd  0x8(%rdi),%xmm0
  pxor   %xmm3,%xmm3
  mulsd  %xmm0,%xmm0
  movapd %xmm2,%xmm1
  mulsd  %xmm2,%xmm1
  addsd  %xmm3,%xmm1
  addsd  %xmm0,%xmm1
  movsd  0x10(%rdi),%xmm0
  mulsd  %xmm0,%xmm0
  addsd  %xmm1,%xmm0
  ucomisd %xmm0,%xmm3
  ja     L12
  sqrtsd %xmm0,%xmm0
L11:
  divsd  %xmm0,%xmm2
  movsd  %xmm2,(%rsi)
  movsd  0x8(%rdi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x8(%rsi)
  movsd  0x10(%rdi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%rsi)
  add    $0x28,%rsp
  ret
L12:
  mov    %rsi,0x18(%rsp)
  mov    %rdi,0x10(%rsp)
  movsd  %xmm2,0x8(%rsp)
  call   <sqrt@plt>
  mov    0x18(%rsp),%rsi
  mov    0x10(%rsp),%rdi
  movsd  0x8(%rsp),%xmm2
  jmp    L11
```

assistant: ```c
void p5glove_normal(const double v[3], double res[3]) {
  double tmp = 0.0;
  int i;
  for (i = 0; i < 3; i++) {
    tmp += v[i] * v[i];
  }
  tmp = sqrt(tmp);
  for (i = 0; i < 3; i++)
    res[i] = v[i] / tmp;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<p5glove_normal>:
  endbr64
  sub    $0x28,%rsp
  movsd  (%rdi),%xmm2
  movsd  0x8(%rdi),%xmm0
  pxor   %xmm3,%xmm3
  mulsd  %xmm0,%xmm0
  movapd %xmm2,%xmm1
  mulsd  %xmm2,%xmm1
  addsd  %xmm3,%xmm1
  addsd  %xmm0,%xmm1
  movsd  0x10(%rdi),%xmm0
  mulsd  %xmm0,%xmm0
  addsd  %xmm1,%xmm0
  ucomisd %xmm0,%xmm3
  ja     L14
  sqrtsd %xmm0,%xmm0
L8:
  lea    0x8(%rdi),%rax
  cmp    %rax,%rsi
  je     L27
  movupd (%rdi),%xmm1
  movapd %xmm0,%xmm2
  unpcklpd %xmm2,%xmm2
  divpd  %xmm2,%xmm1
  movups %xmm1,(%rsi)
  movsd  0x10(%rdi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%rsi)
  add    $0x28,%rsp
  ret
  nop
L27:
  divsd  %xmm0,%xmm2
  movsd  %xmm2,(%rsi)
  divsd  %xmm0,%xmm2
  movsd  %xmm2,0x8(%rsi)
  movsd  0x10(%rdi),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%rsi)
  add    $0x28,%rsp
  ret
L14:
  mov    %rsi,0x18(%rsp)
  mov    %rdi,0x10(%rsp)
  movsd  %xmm2,0x8(%rsp)
  call   <sqrt@plt>
  mov    0x18(%rsp),%rsi
  mov    0x10(%rsp),%rdi
  movsd  0x8(%rsp),%xmm2
  jmp    L8
```

assistant: ```c
void p5glove_normal(const double v[3], double res[3]) {
  double tmp = 0.0;
  int i;
  for (i = 0; i < 3; i++) {
    tmp += v[i] * v[i];
  }
  tmp = sqrt(tmp);
  for (i = 0; i < 3; i++)
    res[i] = v[i] / tmp;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<StbOnnN_OFILM>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,%edx
  mov    %esi,%eax
  mov    %dl,-0x14(%rbp)
  mov    %al,-0x18(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movb   $0x0,-0xa(%rbp)
  movb   $0x0,-0x9(%rbp)
  mov    $0x1,%esi
  mov    $0x17c,%edi
  call   <RegWriteA_Ofilm@plt>
  cmpb   $0x1,-0x18(%rbp)
  jne    L51
  orb    $0x7,-0xa(%rbp)
L51:
  cmpb   $0x1,-0x14(%rbp)
  jne    L31
  orb    $0x70,-0xa(%rbp)
L31:
  movzbl -0x18(%rbp),%eax
  mov    %eax,%esi
  mov    $0x0,%edi
  call   <SrvCon_OFILM@plt>
  movzbl -0x14(%rbp),%eax
  mov    %eax,%esi
  mov    $0x1,%edi
  call   <SrvCon_OFILM@plt>
  movb   $0x11,-0xb(%rbp)
  jmp    L97
L82:
  lea    -0xb(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x1f8,%edi
  call   <RegReadA_Ofilm@plt>
  mov    $0x0,%eax
  call   <CmdRdChk_OFILM@plt>
  test   %rax,%rax
  jne    L87
  movzbl -0xb(%rbp),%eax
  movzbl %al,%eax
  and    $0x77,%eax
  test   %eax,%eax
  jne    L92
  movzbl -0x9(%rbp),%eax
  add    $0x1,%eax
  mov    %al,-0x9(%rbp)
L92:
  cmpb   $0xa,-0x9(%rbp)
  ja     L22
L97:
  movzbl -0xb(%rbp),%eax
  xor    $0x66,%eax
  and    -0xa(%rbp),%al
  test   %al,%al
  jne    L82
  jmp    L19
L87:
  nop
  jmp    L19
L22:
  nop
L19:
  mov    $0x0,%esi
  mov    $0x17c,%edi
  call   <RegWriteA_Ofilm@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L77
  call   <__stack_chk_fail@plt>
L77:
  leave
  ret
```

assistant: ```c
void StbOnnN_OFILM(unsigned char UcStbY_OFILM, unsigned char UcStbX_OFILM) {
  unsigned char UcRegIni_OFILM;
  unsigned char UcSttMsk_OFILM = 0;
  unsigned char UcRegIniCnt_OFILM = 0;
  ;
  RegWriteA_Ofilm(0x017C, 0x01);
  if (UcStbX_OFILM == 0x01)
    UcSttMsk_OFILM |= 0x07;
  if (UcStbY_OFILM == 0x01)
    UcSttMsk_OFILM |= 0x70;
  SrvCon_OFILM(0x00, UcStbX_OFILM);
  SrvCon_OFILM(0x01, UcStbY_OFILM);
  UcRegIni_OFILM = 0x11;
  while ((UcRegIni_OFILM & UcSttMsk_OFILM) != (0x66 & UcSttMsk_OFILM)) {
    RegReadA_Ofilm(0x01F8, &UcRegIni_OFILM);
    if (CmdRdChk_OFILM() != 0)
      break;
    if ((UcRegIni_OFILM & 0x77) == 0)
      UcRegIniCnt_OFILM++;
    if (UcRegIniCnt_OFILM > 10) {
      ;
      break;
    }
  }
  RegWriteA_Ofilm(0x017C, 0x00);
}
```
user: What is the c source code of the assembly code below:

```asm
<StbOnnN_OFILM>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %edi,%ebx
  mov    %esi,%r12d
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    $0x1,%esi
  mov    $0x17c,%edi
  call   <RegWriteA_Ofilm@plt>
  cmp    $0x1,%r12b
  mov    $0x0,%ebp
  mov    $0x7,%eax
  cmove  %eax,%ebp
  mov    %ebp,%eax
  or     $0x70,%eax
  cmp    $0x1,%bl
  cmove  %eax,%ebp
  movzbl %r12b,%esi
  mov    $0x0,%edi
  call   <SrvCon_OFILM@plt>
  movzbl %bl,%esi
  mov    $0x1,%edi
  call   <SrvCon_OFILM@plt>
  movb   $0x11,0x7(%rsp)
  mov    $0x0,%ebx
  lea    0x7(%rsp),%r12
L19:
  movzbl 0x7(%rsp),%eax
  xor    $0x66,%eax
  test   %bpl,%al
  je     L38
  mov    %r12,%rsi
  mov    $0x1f8,%edi
  call   <RegReadA_Ofilm@plt>
  mov    $0x0,%eax
  call   <CmdRdChk_OFILM@plt>
  test   %rax,%rax
  jne    L38
  movzbl 0x7(%rsp),%eax
  and    $0x77,%eax
  cmp    $0x1,%al
  adc    $0x0,%bl
  cmp    $0xa,%bl
  jbe    L19
L38:
  mov    $0x0,%esi
  mov    $0x17c,%edi
  call   <RegWriteA_Ofilm@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L11
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L11:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void StbOnnN_OFILM(unsigned char UcStbY_OFILM, unsigned char UcStbX_OFILM) {
  unsigned char UcRegIni_OFILM;
  unsigned char UcSttMsk_OFILM = 0;
  unsigned char UcRegIniCnt_OFILM = 0;
  ;
  RegWriteA_Ofilm(0x017C, 0x01);
  if (UcStbX_OFILM == 0x01)
    UcSttMsk_OFILM |= 0x07;
  if (UcStbY_OFILM == 0x01)
    UcSttMsk_OFILM |= 0x70;
  SrvCon_OFILM(0x00, UcStbX_OFILM);
  SrvCon_OFILM(0x01, UcStbY_OFILM);
  UcRegIni_OFILM = 0x11;
  while ((UcRegIni_OFILM & UcSttMsk_OFILM) != (0x66 & UcSttMsk_OFILM)) {
    RegReadA_Ofilm(0x01F8, &UcRegIni_OFILM);
    if (CmdRdChk_OFILM() != 0)
      break;
    if ((UcRegIni_OFILM & 0x77) == 0)
      UcRegIniCnt_OFILM++;
    if (UcRegIniCnt_OFILM > 10) {
      ;
      break;
    }
  }
  RegWriteA_Ofilm(0x017C, 0x00);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<StbOnnN_OFILM>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  mov    %esi,%ebp
  mov    $0x1,%esi
  push   %rbx
  mov    %edi,%ebx
  mov    $0x17c,%edi
  movzbl %bl,%r13d
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <RegWriteA_Ofilm@plt>
  movzbl %bpl,%esi
  cmp    $0x1,%bpl
  je     L97
  mov    $0x70,%r12d
  cmp    $0x1,%bl
  jne    L15
L55:
  xor    %edi,%edi
  call   <SrvCon_OFILM@plt>
  mov    $0x1,%esi
  mov    $0x1,%edi
  call   <SrvCon_OFILM@plt>
L40:
  movb   $0x11,0x7(%rsp)
  xor    %ebx,%ebx
  lea    0x7(%rsp),%rbp
  jmp    L57
  cs nopw 0x0(%rax,%rax,1)
L29:
  movzbl 0x7(%rsp),%eax
  test   $0x77,%al
  jne    L25
  add    $0x1,%ebx
  cmp    $0xb,%bl
  je     L56
L25:
  xor    $0x66,%eax
  test   %r12b,%al
  je     L56
L57:
  mov    %rbp,%rsi
  mov    $0x1f8,%edi
  call   <RegReadA_Ofilm@plt>
  xor    %eax,%eax
  call   <CmdRdChk_OFILM@plt>
  test   %rax,%rax
  je     L29
L56:
  xor    %esi,%esi
  mov    $0x17c,%edi
  call   <RegWriteA_Ofilm@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L90
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L97:
  cmp    $0x1,%bl
  je     L53
  mov    $0x1,%esi
  xor    %edi,%edi
  mov    $0x7,%r12d
  call   <SrvCon_OFILM@plt>
  mov    %r13d,%esi
  mov    $0x1,%edi
  call   <SrvCon_OFILM@plt>
  jmp    L40
L15:
  xor    %edi,%edi
  call   <SrvCon_OFILM@plt>
  mov    %r13d,%esi
  mov    $0x1,%edi
  call   <SrvCon_OFILM@plt>
  movb   $0x11,0x7(%rsp)
  jmp    L56
L90:
  call   <__stack_chk_fail@plt>
L53:
  mov    $0x77,%r12d
  jmp    L55
```

assistant: ```c
void StbOnnN_OFILM(unsigned char UcStbY_OFILM, unsigned char UcStbX_OFILM) {
  unsigned char UcRegIni_OFILM;
  unsigned char UcSttMsk_OFILM = 0;
  unsigned char UcRegIniCnt_OFILM = 0;
  ;
  RegWriteA_Ofilm(0x017C, 0x01);
  if (UcStbX_OFILM == 0x01)
    UcSttMsk_OFILM |= 0x07;
  if (UcStbY_OFILM == 0x01)
    UcSttMsk_OFILM |= 0x70;
  SrvCon_OFILM(0x00, UcStbX_OFILM);
  SrvCon_OFILM(0x01, UcStbY_OFILM);
  UcRegIni_OFILM = 0x11;
  while ((UcRegIni_OFILM & UcSttMsk_OFILM) != (0x66 & UcSttMsk_OFILM)) {
    RegReadA_Ofilm(0x01F8, &UcRegIni_OFILM);
    if (CmdRdChk_OFILM() != 0)
      break;
    if ((UcRegIni_OFILM & 0x77) == 0)
      UcRegIniCnt_OFILM++;
    if (UcRegIniCnt_OFILM > 10) {
      ;
      break;
    }
  }
  RegWriteA_Ofilm(0x017C, 0x00);
}
```