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

```asm
<WXHash_StrEqualsFn>:
  endbr64
  xor    %eax,%eax
  jmp    L15
  nopl   0x0(%rax,%rax,1)
L17:
  add    $0x1,%rax
  cmp    %cl,%dl
  jne    L3
L15:
  movzbl (%rdi,%rax,1),%edx
  movzbl (%rsi,%rax,1),%ecx
  test   %dl,%dl
  jne    L17
  xor    %eax,%eax
  test   %cl,%cl
  sete   %al
  ret
  nopl   0x0(%rax)
L3:
  xor    %eax,%eax
  ret
```

assistant: ```c
int WXHash_StrEqualsFn(void *keya, void *keyb) {
  char *ptra = (char *)keya, *ptrb = (char *)keyb;
  while (*ptra != '\0') {
    if (*(ptra++) != *(ptrb++))
      return 0;
  }
  if (*ptrb != '\0')
    return 0;
  return 1;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<underapprox_min_minus_min_linear_CAF>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0xa,-0x10(%rbp)
  cmpl   $0x4,-0x14(%rbp)
  jg     L4
  mov    -0x14(%rbp),%eax
  add    $0x14,%eax
  mov    %eax,-0x10(%rbp)
L4:
  cmpl   $0x18,-0x10(%rbp)
  jle    L1
  movl   $0x0,-0x10(%rbp)
L1:
  mov    -0x10(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L26
  call   <__stack_chk_fail@plt>
L26:
  leave
  ret
```

assistant: ```c
int underapprox_min_minus_min_linear_CAF(int x) {
  int size1[1];
  int y = 10;
  if (x < 5)
    y = x + 20;
  if (y > 24) {
    size1[-1] = 0;
  }
  return y;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<underapprox_min_minus_min_linear_CAF>:
  endbr64
  lea    0x14(%rdi),%eax
  cmp    $0x5,%edi
  mov    $0xa,%edx
  cmovge %edx,%eax
  ret
```

assistant: ```c
int underapprox_min_minus_min_linear_CAF(int x) {
  int size1[1];
  int y = 10;
  if (x < 5)
    y = x + 20;
  if (y > 24) {
    size1[-1] = 0;
  }
  return y;
}
```
user: What is the c source code of the assembly code below?

```asm
<underapprox_min_minus_min_linear_CAF>:
  endbr64
  lea    0x14(%rdi),%eax
  cmp    $0x5,%edi
  mov    $0xa,%edx
  cmovge %edx,%eax
  ret
```

assistant: ```c
int underapprox_min_minus_min_linear_CAF(int x) {
  int size1[1];
  int y = 10;
  if (x < 5)
    y = x + 20;
  if (y > 24) {
    size1[-1] = 0;
  }
  return y;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<underapprox_min_minus_min_linear_CAF>:
  endbr64
  lea    0x14(%rdi),%eax
  cmp    $0x5,%edi
  mov    $0xa,%edx
  cmovge %edx,%eax
  ret
```

assistant: ```c
int underapprox_min_minus_min_linear_CAF(int x) {
  int size1[1];
  int y = 10;
  if (x < 5)
    y = x + 20;
  if (y > 24) {
    size1[-1] = 0;
  }
  return y;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0xa,-0x14(%rbp)
  lea    -0x14(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  push   $0x8
  push   $0x8
  mov    $0x4,%r9d
  mov    $0x8,%r8d
  mov    $0x4,%ecx
  mov    $0x2,%edx
  mov    $0x1,%esi
  lea    D7(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  add    $0x10,%rsp
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L1
  call   <__stack_chk_fail@plt>
L1:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D7
data_type: string

tool: D7: char=%d, short=%d, int=%d, long=%d, float=%d, double=%d, pointer=%d


assistant: ```c
int main() {
  int x = 10;
  int *p = &x;
  printf("char=%d, short=%d, int=%d, long=%d, float=%d, double=%d, pointer=%d\n", sizeof(char), sizeof(short), sizeof(int), sizeof(long), sizeof(float), sizeof(double), sizeof(p));
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  push   $0x8
  push   $0x8
  mov    $0x4,%r9d
  mov    $0x8,%r8d
  mov    $0x4,%ecx
  mov    $0x2,%edx
  mov    $0x1,%esi
  lea    D0(%rip),%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  add    $0x18,%rsp
  ret
```

tool_calls: name: extract_symbolic_data
arguments: tag: D0
datatype: string

tool: D0: char=%d, short=%d, int=%d, long=%d, float=%d, double=%d, pointer=%d


assistant: ```c
int main() {
  int x = 10;
  int *p = &x;
  printf("char=%d, short=%d, int=%d, long=%d, float=%d, double=%d, pointer=%d\n", sizeof(char), sizeof(short), sizeof(int), sizeof(long), sizeof(float), sizeof(double), sizeof(p));
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x4,%r9d
  mov    $0x8,%r8d
  mov    $0x4,%ecx
  push   $0x8
  mov    $0x2,%edx
  mov    $0x1,%esi
  lea    D8(%rip),%rdi
  push   $0x8
  call   <printf@plt>
  xor    %eax,%eax
  add    $0x18,%rsp
  ret
```

tool_calls: name: disassemble_data
arguments: data_tag: D8
type_infered: string

tool: D8: char=%d, short=%d, int=%d, long=%d, float=%d, double=%d, pointer=%d


assistant: ```c
int main() {
  int x = 10;
  int *p = &x;
  printf("char=%d, short=%d, int=%d, long=%d, float=%d, double=%d, pointer=%d\n", sizeof(char), sizeof(short), sizeof(int), sizeof(long), sizeof(float), sizeof(double), sizeof(p));
  return 0;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x4,%r9d
  mov    $0x8,%r8d
  mov    $0x4,%ecx
  push   $0x8
  mov    $0x2,%edx
  mov    $0x1,%esi
  lea    D3(%rip),%rdi
  push   $0x8
  call   <printf@plt>
  xor    %eax,%eax
  add    $0x18,%rsp
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D3
datatype: string

tool: D3: char=%d, short=%d, int=%d, long=%d, float=%d, double=%d, pointer=%d


assistant: ```c
int main() {
  int x = 10;
  int *p = &x;
  printf("char=%d, short=%d, int=%d, long=%d, float=%d, double=%d, pointer=%d\n", sizeof(char), sizeof(short), sizeof(int), sizeof(long), sizeof(float), sizeof(double), sizeof(p));
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<pow_x>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  movl   $0x1,-0x4(%rbp)
  jmp    L15
L18:
  mov    -0x4(%rbp),%eax
  imul   -0x14(%rbp),%eax
  mov    %eax,-0x4(%rbp)
L15:
  mov    -0x18(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x18(%rbp)
  test   %eax,%eax
  jne    L18
  mov    -0x4(%rbp),%eax
  pop    %rbp
  ret
```

assistant: ```c
int pow_x(int x, int y) {
  int r = 1;
  while (y--) {
    r = x * r;
  }
  return r;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<pow_x>:
  endbr64
  lea    -0x1(%rsi),%eax
  test   %esi,%esi
  je     L6
  mov    $0x1,%edx
L15:
  imul   %edi,%edx
  sub    $0x1,%eax
  cmp    $0xffffffff,%eax
  jne    L15
L20:
  mov    %edx,%eax
  ret
L6:
  mov    $0x1,%edx
  jmp    L20
```

assistant: ```c
int pow_x(int x, int y) {
  int r = 1;
  while (y--) {
    r = x * r;
  }
  return r;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<pow_x>:
  endbr64
  lea    -0x1(%rsi),%eax
  mov    $0x1,%r8d
  test   %esi,%esi
  je     L11
  nopl   0x0(%rax)
L14:
  imul   %edi,%r8d
  sub    $0x1,%eax
  jae    L14
L11:
  mov    %r8d,%eax
  ret
```

assistant: ```c
int pow_x(int x, int y) {
  int r = 1;
  while (y--) {
    r = x * r;
  }
  return r;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<pow_x>:
  endbr64
  lea    -0x1(%rsi),%eax
  mov    $0x1,%r8d
  test   %esi,%esi
  je     L18
  nopl   0x0(%rax)
L12:
  imul   %edi,%r8d
  sub    $0x1,%eax
  jae    L12
L18:
  mov    %r8d,%eax
  ret
```

assistant: ```c
int pow_x(int x, int y) {
  int r = 1;
  while (y--) {
    r = x * r;
  }
  return r;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<spi_read_reg>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x14(%rbp)
  mov    $0x80004000,%eax
  mov    %rax,-0x8(%rbp)
  mov    -0x14(%rbp),%eax
  lea    0x0(,%rax,8),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  pop    %rbp
  ret
```

assistant: ```c
unsigned long spi_read_reg(unsigned int regnum) {
  volatile unsigned long *base = (volatile unsigned long *)0x80004000;
  return base[regnum];
}
```
user: What is the c source code of the assembly code below:

```asm
<spi_read_reg>:
  endbr64
  mov    %edi,%edi
  mov    $0x80004000,%eax
  lea    (%rax,%rdi,8),%rax
  mov    (%rax),%rax
  ret
```

assistant: ```c
unsigned long spi_read_reg(unsigned int regnum) {
  volatile unsigned long *base = (volatile unsigned long *)0x80004000;
  return base[regnum];
}
```
user: Translate the below assembly code into C programming language:

```asm
<spi_read_reg>:
  endbr64
  mov    %edi,%edi
  mov    $0x80004000,%eax
  lea    (%rax,%rdi,8),%rax
  mov    (%rax),%rax
  ret
```

assistant: ```c
unsigned long spi_read_reg(unsigned int regnum) {
  volatile unsigned long *base = (volatile unsigned long *)0x80004000;
  return base[regnum];
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<spi_read_reg>:
  endbr64
  mov    %edi,%edi
  mov    $0x80004000,%eax
  lea    (%rax,%rdi,8),%rax
  mov    (%rax),%rax
  ret
```

assistant: ```c
unsigned long spi_read_reg(unsigned int regnum) {
  volatile unsigned long *base = (volatile unsigned long *)0x80004000;
  return base[regnum];
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<p3>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r13
  push   %r12
  mov    %edi,-0x44(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %rdx,-0x58(%rbp)
  mov    %rcx,-0x60(%rbp)
  mov    -0x44(%rbp),%edx
  movslq %edx,%rax
  sub    $0x1,%rax
  mov    %rax,-0x28(%rbp)
  movslq %edx,%rax
  mov    %rax,%r12
  mov    $0x0,%r13d
  mov    -0x44(%rbp),%ecx
  movslq %ecx,%rax
  sub    $0x1,%rax
  mov    %rax,-0x20(%rbp)
  movslq %ecx,%rax
  mov    %rax,%r10
  mov    $0x0,%r11d
  mov    -0x44(%rbp),%eax
  movslq %eax,%rsi
  sub    $0x1,%rsi
  mov    %rsi,-0x18(%rbp)
  movslq %eax,%rsi
  mov    %rsi,%r8
  mov    $0x0,%r9d
  movl   $0x0,-0x34(%rbp)
  jmp    L39
L38:
  movl   $0x0,-0x30(%rbp)
  jmp    L56
L3:
  movl   $0x0,-0x2c(%rbp)
  jmp    L8
L59:
  mov    -0x2c(%rbp),%esi
  movslq %esi,%rdi
  movslq %edx,%rsi
  imul   %rdi,%rsi
  lea    0x0(,%rsi,8),%rdi
  mov    -0x50(%rbp),%rsi
  add    %rsi,%rdi
  mov    -0x34(%rbp),%esi
  movslq %esi,%rsi
  movsd  (%rdi,%rsi,8),%xmm1
  mov    -0x2c(%rbp),%esi
  movslq %esi,%rdi
  movslq %ecx,%rsi
  imul   %rdi,%rsi
  lea    0x0(,%rsi,8),%rdi
  mov    -0x58(%rbp),%rsi
  add    %rsi,%rdi
  mov    -0x30(%rbp),%esi
  movslq %esi,%rsi
  movsd  (%rdi,%rsi,8),%xmm0
  mulsd  %xmm0,%xmm1
  mov    -0x34(%rbp),%esi
  movslq %esi,%rdi
  movslq %eax,%rsi
  imul   %rdi,%rsi
  lea    0x0(,%rsi,8),%rdi
  mov    -0x60(%rbp),%rsi
  add    %rsi,%rdi
  mov    -0x30(%rbp),%esi
  movslq %esi,%rsi
  movsd  (%rdi,%rsi,8),%xmm0
  mov    -0x34(%rbp),%esi
  movslq %esi,%rdi
  movslq %eax,%rsi
  imul   %rdi,%rsi
  lea    0x0(,%rsi,8),%rdi
  mov    -0x60(%rbp),%rsi
  add    %rsi,%rdi
  addsd  %xmm1,%xmm0
  mov    -0x30(%rbp),%esi
  movslq %esi,%rsi
  movsd  %xmm0,(%rdi,%rsi,8)
  addl   $0x1,-0x2c(%rbp)
L8:
  mov    -0x34(%rbp),%esi
  cmp    -0x2c(%rbp),%esi
  jge    L59
  addl   $0x1,-0x30(%rbp)
L56:
  mov    -0x30(%rbp),%esi
  cmp    -0x44(%rbp),%esi
  jl     L3
  addl   $0x1,-0x34(%rbp)
L39:
  mov    -0x34(%rbp),%esi
  cmp    -0x44(%rbp),%esi
  jl     L38
  nop
  nop
  pop    %r12
  pop    %r13
  pop    %rbp
  ret
```

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

```asm
<p3>:
  endbr64
  mov    %edi,%r10d
  test   %edi,%edi
  jle    L49
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rdi
  mov    %rdx,%rbp
  mov    %rcx,%r12
  movslq %r10d,%r9
  shl    $0x3,%r9
  lea    -0x1(%r10),%eax
  lea    0x8(%rdx,%rax,8),%rbx
  mov    $0x1,%r8d
  mov    $0x0,%r11d
  jmp    L58
L29:
  movsd  (%rdi,%rax,1),%xmm0
  mulsd  (%rsi,%rax,1),%xmm0
  addsd  (%rcx),%xmm0
  movsd  %xmm0,(%rcx)
  add    $0x1,%edx
  add    %r9,%rax
  cmp    %r8d,%edx
  jne    L29
L13:
  add    $0x8,%rsi
  add    $0x8,%rcx
  cmp    %rbx,%rsi
  je     L16
L35:
  mov    $0x0,%eax
  mov    $0x0,%edx
  test   %r11d,%r11d
  jns    L29
  jmp    L13
L16:
  add    $0x1,%r11d
  add    $0x1,%r8d
  add    %r9,%r12
  add    $0x8,%rdi
  cmp    %r11d,%r10d
  je     L59
L58:
  mov    %r12,%rcx
  mov    %rbp,%rsi
  jmp    L35
L59:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L49:
  ret
```

assistant: ```c
void p3(int n, double a[][n], double b[][n], double c[][n]) {
  int i, j, k;
  for (i = 0; i < n; i++)
    for (j = 0; j < n; j++)
      for (k = 0; k < i + 1; k++)
        c[i][j] += a[k][i] * b[k][j];
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<p3>:
  endbr64
  movslq %edi,%r9
  test   %r9d,%r9d
  jle    L38
  mov    %r9,%r11
  push   %rbp
  mov    %rsi,%r8
  mov    %rdx,%rbp
  lea    -0x1(%r11),%eax
  push   %rbx
  shl    $0x3,%r9
  mov    %rcx,%rbx
  lea    0x8(%rdx,%rax,8),%r10
  mov    $0x1,%edi
L30:
  mov    %rbp,%rsi
  mov    %rbx,%rcx
  cs nopw 0x0(%rax,%rax,1)
L48:
  movsd  (%rcx),%xmm1
  xor    %eax,%eax
  xor    %edx,%edx
  nopl   0x0(%rax,%rax,1)
L28:
  movsd  (%r8,%rax,1),%xmm0
  mulsd  (%rsi,%rax,1),%xmm0
  add    $0x1,%edx
  add    %r9,%rax
  addsd  %xmm0,%xmm1
  movsd  %xmm1,(%rcx)
  cmp    %edi,%edx
  jne    L28
  add    $0x8,%rsi
  add    $0x8,%rcx
  cmp    %rsi,%r10
  jne    L48
  lea    0x1(%rdi),%eax
  add    $0x8,%r8
  add    %r9,%rbx
  cmp    %r11d,%edi
  je     L15
  mov    %eax,%edi
  jmp    L30
L15:
  pop    %rbx
  pop    %rbp
  ret
L38:
  ret
```

assistant: ```c
void p3(int n, double a[][n], double b[][n], double c[][n]) {
  int i, j, k;
  for (i = 0; i < n; i++)
    for (j = 0; j < n; j++)
      for (k = 0; k < i + 1; k++)
        c[i][j] += a[k][i] * b[k][j];
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<p3>:
  endbr64
  push   %r13
  movslq %edi,%r13
  push   %r12
  push   %rbp
  push   %rbx
  test   %r13d,%r13d
  jle    L7
  lea    -0x1(%r13),%eax
  mov    %r13,%rbx
  mov    %rsi,%r8
  mov    %rdx,%rbp
  mov    %rcx,%r12
  lea    0x8(%rdx,%rax,8),%r10
  xor    %r11d,%r11d
  mov    $0x1,%edi
  lea    0x0(,%r13,8),%r9
  nopl   0x0(%rax,%rax,1)
L32:
  lea    (%r12,%r11,8),%rsi
  mov    %rbp,%rcx
  nopw   0x0(%rax,%rax,1)
L34:
  movsd  (%rsi),%xmm1
  xor    %eax,%eax
  xor    %edx,%edx
  nopl   0x0(%rax,%rax,1)
L2:
  movsd  (%r8,%rax,1),%xmm0
  mulsd  (%rcx,%rax,1),%xmm0
  add    $0x1,%edx
  add    %r9,%rax
  addsd  %xmm0,%xmm1
  movsd  %xmm1,(%rsi)
  cmp    %edi,%edx
  jne    L2
  add    $0x8,%rcx
  add    $0x8,%rsi
  cmp    %rcx,%r10
  jne    L34
  lea    0x1(%rdi),%eax
  add    $0x8,%r8
  add    %r13,%r11
  cmp    %edi,%ebx
  je     L7
  mov    %eax,%edi
  jmp    L32
L7:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
void p3(int n, double a[][n], double b[][n], double c[][n]) {
  int i, j, k;
  for (i = 0; i < n; i++)
    for (j = 0; j < n; j++)
      for (k = 0; k < i + 1; k++)
        c[i][j] += a[k][i] * b[k][j];
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<utf8_encoded_expected_len>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <assert@plt>
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,-0x1(%rbp)
  movzbl -0x1(%rbp),%eax
  test   %al,%al
  js     L45
  mov    $0x1,%eax
  jmp    L106
L45:
  movzbl -0x1(%rbp),%eax
  and    $0xe0,%eax
  cmp    $0xc0,%eax
  jne    L63
  mov    $0x2,%eax
  jmp    L106
L63:
  movzbl -0x1(%rbp),%eax
  and    $0xf0,%eax
  cmp    $0xe0,%eax
  jne    L31
  mov    $0x3,%eax
  jmp    L106
L31:
  movzbl -0x1(%rbp),%eax
  and    $0xf8,%eax
  cmp    $0xf0,%eax
  jne    L48
  mov    $0x4,%eax
  jmp    L106
L48:
  movzbl -0x1(%rbp),%eax
  and    $0xfc,%eax
  cmp    $0xf8,%eax
  jne    L26
  mov    $0x5,%eax
  jmp    L106
L26:
  movzbl -0x1(%rbp),%eax
  and    $0xfe,%eax
  cmp    $0xfc,%eax
  jne    L60
  mov    $0x6,%eax
  jmp    L106
L60:
  mov    $0x0,%eax
L106:
  leave
  ret
```

assistant: ```c
int utf8_encoded_expected_len(const char *str) {
  unsigned char c;
  assert(str);
  c = (unsigned char)str[0];
  if (c < 0x80)
    return 1;
  if ((c & 0xe0) == 0xc0)
    return 2;
  if ((c & 0xf0) == 0xe0)
    return 3;
  if ((c & 0xf8) == 0xf0)
    return 4;
  if ((c & 0xfc) == 0xf8)
    return 5;
  if ((c & 0xfe) == 0xfc)
    return 6;
  return 0;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<utf8_encoded_expected_len>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  call   <assert@plt>
  movzbl (%rbx),%eax
  mov    $0x1,%edx
  test   %al,%al
  jns    L7
  mov    %eax,%edx
  and    $0xffffffe0,%edx
  cmp    $0xc0,%dl
  je     L11
  mov    %eax,%edx
  and    $0xfffffff0,%edx
  cmp    $0xe0,%dl
  je     L18
  mov    %eax,%edx
  and    $0xfffffff8,%edx
  cmp    $0xf0,%dl
  je     L16
  mov    %eax,%edx
  and    $0xfffffffc,%edx
  cmp    $0xf8,%dl
  je     L21
  and    $0xfffffffe,%eax
  cmp    $0xfc,%al
  mov    $0x0,%edx
  mov    $0x6,%eax
  cmove  %eax,%edx
L7:
  mov    %edx,%eax
  pop    %rbx
  ret
L11:
  mov    $0x2,%edx
  jmp    L7
L18:
  mov    $0x3,%edx
  jmp    L7
L16:
  mov    $0x4,%edx
  jmp    L7
L21:
  mov    $0x5,%edx
  jmp    L7
```

assistant: ```c
int utf8_encoded_expected_len(const char *str) {
  unsigned char c;
  assert(str);
  c = (unsigned char)str[0];
  if (c < 0x80)
    return 1;
  if ((c & 0xe0) == 0xc0)
    return 2;
  if ((c & 0xf0) == 0xe0)
    return 3;
  if ((c & 0xf8) == 0xf0)
    return 4;
  if ((c & 0xfc) == 0xf8)
    return 5;
  if ((c & 0xfe) == 0xfc)
    return 6;
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<utf8_encoded_expected_len>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  call   <assert@plt>
  movzbl (%rbx),%eax
  mov    $0x1,%r8d
  test   %al,%al
  jns    L68
  mov    %eax,%edx
  and    $0xffffffe0,%edx
  cmp    $0xc0,%dl
  je     L49
  mov    %eax,%edx
  and    $0xfffffff0,%edx
  cmp    $0xe0,%dl
  je     L58
  mov    %eax,%edx
  and    $0xfffffff8,%edx
  cmp    $0xf0,%dl
  je     L89
  mov    %eax,%edx
  and    $0xfffffffc,%edx
  cmp    $0xf8,%dl
  je     L77
  and    $0xfffffffe,%eax
  xor    %r8d,%r8d
  cmp    $0xfc,%al
  mov    $0x6,%eax
  cmove  %eax,%r8d
L68:
  mov    %r8d,%eax
  pop    %rbx
  ret
  nopl   0x0(%rax,%rax,1)
L58:
  mov    $0x3,%r8d
  jmp    L68
  nopl   0x0(%rax,%rax,1)
L49:
  mov    $0x2,%r8d
  jmp    L68
  nopl   0x0(%rax,%rax,1)
L89:
  mov    $0x4,%r8d
  jmp    L68
  nopl   0x0(%rax,%rax,1)
L77:
  mov    $0x5,%r8d
  jmp    L68
```

assistant: ```c
int utf8_encoded_expected_len(const char *str) {
  unsigned char c;
  assert(str);
  c = (unsigned char)str[0];
  if (c < 0x80)
    return 1;
  if ((c & 0xe0) == 0xc0)
    return 2;
  if ((c & 0xf0) == 0xe0)
    return 3;
  if ((c & 0xf8) == 0xf0)
    return 4;
  if ((c & 0xfc) == 0xf8)
    return 5;
  if ((c & 0xfe) == 0xfc)
    return 6;
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<utf8_encoded_expected_len>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  call   <assert@plt>
  movzbl (%rbx),%eax
  mov    $0x1,%r8d
  test   %al,%al
  jns    L74
  mov    %eax,%edx
  and    $0xffffffe0,%edx
  cmp    $0xc0,%dl
  je     L10
  mov    %eax,%edx
  and    $0xfffffff0,%edx
  cmp    $0xe0,%dl
  je     L47
  mov    %eax,%edx
  and    $0xfffffff8,%edx
  cmp    $0xf0,%dl
  je     L53
  mov    %eax,%edx
  and    $0xfffffffc,%edx
  cmp    $0xf8,%dl
  je     L65
  and    $0xfffffffe,%eax
  xor    %r8d,%r8d
  cmp    $0xfc,%al
  mov    $0x6,%eax
  cmove  %eax,%r8d
L74:
  mov    %r8d,%eax
  pop    %rbx
  ret
  nopl   0x0(%rax,%rax,1)
L47:
  mov    $0x3,%r8d
  jmp    L74
  nopl   0x0(%rax,%rax,1)
L10:
  mov    $0x2,%r8d
  jmp    L74
  nopl   0x0(%rax,%rax,1)
L53:
  mov    $0x4,%r8d
  jmp    L74
  nopl   0x0(%rax,%rax,1)
L65:
  mov    $0x5,%r8d
  jmp    L74
```

assistant: ```c
int utf8_encoded_expected_len(const char *str) {
  unsigned char c;
  assert(str);
  c = (unsigned char)str[0];
  if (c < 0x80)
    return 1;
  if ((c & 0xe0) == 0xc0)
    return 2;
  if ((c & 0xf0) == 0xe0)
    return 3;
  if ((c & 0xf8) == 0xf0)
    return 4;
  if ((c & 0xfc) == 0xf8)
    return 5;
  if ((c & 0xfe) == 0xfc)
    return 6;
  return 0;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<seed_sample_rate>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  movsd  %xmm0,-0x8(%rbp)
  movsd  %xmm1,-0x10(%rbp)
  movsd  -0x8(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jb     L70
  movsd  -0x10(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jb     L70
  movsd  -0x8(%rbp),%xmm0
  mulsd  -0x10(%rbp),%xmm0
  jmp    L69
L70:
  movsd  -0x8(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jb     L73
  pxor   %xmm0,%xmm0
  comisd -0x10(%rbp),%xmm0
  jbe    L73
  movsd  -0x8(%rbp),%xmm0
  movq   D9(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  divsd  -0x10(%rbp),%xmm0
  jmp    L69
L73:
  pxor   %xmm0,%xmm0
  comisd -0x8(%rbp),%xmm0
  jbe    L88
  movsd  -0x10(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jb     L88
  movsd  D7(%rip),%xmm0
  divsd  -0x8(%rbp),%xmm0
  mulsd  -0x10(%rbp),%xmm0
  jmp    L69
L88:
  movsd  D4(%rip),%xmm0
  divsd  -0x8(%rbp),%xmm0
  divsd  -0x10(%rbp),%xmm0
L69:
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  pop    %rbp
  ret
```

tool_calls: name: parse_data
arguments: label: D9
datatype: byte[8]
name: parse_data
arguments: label: D7
datatype: byte[8]
name: parse_data
arguments: label: D4
datatype: f64

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

tool: {"D7": [0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0xbf]}

tool: D4: 1

assistant: ```c
double seed_sample_rate(int16_t factor, int16_t multiplier) {
  if (factor >= 0 && multiplier >= 0) {
    return (double)factor * multiplier;
  } else if (factor >= 0 && multiplier < 0) {
    return -1.0 * factor / multiplier;
  } else if (factor < 0 && multiplier >= 0) {
    return -1.0 / factor * multiplier;
  } else {
    return 1.0 / factor / multiplier;
  }
}
```
user: What is the c source code of the assembly code below?

```asm
<seed_sample_rate>:
  endbr64
  movapd %xmm0,%xmm2
  comisd D52(%rip),%xmm0
  jb     L55
  comisd D52(%rip),%xmm1
  jae    L13
L30:
  pxor   %xmm0,%xmm0
  comisd %xmm1,%xmm0
  ja     L40
L5:
  pxor   %xmm0,%xmm0
  comisd %xmm2,%xmm0
  jbe    L41
  comisd %xmm0,%xmm1
  jb     L41
  movsd  D29(%rip),%xmm0
  divsd  %xmm2,%xmm0
  mulsd  %xmm1,%xmm0
  ret
L13:
  mulsd  %xmm1,%xmm2
  movapd %xmm2,%xmm0
  ret
L55:
  comisd D52(%rip),%xmm0
  jb     L5
  jmp    L30
L40:
  xorpd  D53(%rip),%xmm2
  divsd  %xmm1,%xmm2
  movapd %xmm2,%xmm0
  ret
L41:
  movsd  D44(%rip),%xmm0
  divsd  %xmm2,%xmm0
  divsd  %xmm1,%xmm0
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D52
type: byte[16]
name: disassemble_data
arguments: data_label: D29
type: byte[8]
name: disassemble_data
arguments: data_label: D53
type: byte[16]
name: disassemble_data
arguments: data_label: D44
type: f64

tool: {"D52": [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0xbf]}

tool: {"D29": [0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0xbf]}

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

tool: D44: 1

assistant: ```c
double seed_sample_rate(int16_t factor, int16_t multiplier) {
  if (factor >= 0 && multiplier >= 0) {
    return (double)factor * multiplier;
  } else if (factor >= 0 && multiplier < 0) {
    return -1.0 * factor / multiplier;
  } else if (factor < 0 && multiplier >= 0) {
    return -1.0 / factor * multiplier;
  } else {
    return 1.0 / factor / multiplier;
  }
}
```