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

```asm
<any>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  movl   $0x0,-0x8(%rbp)
  jmp    L8
L3:
  movl   $0x0,-0x4(%rbp)
  jmp    L46
L43:
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%ecx
  mov    -0x4(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x4(%rbp)
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    %al,%cl
  jne    L0
  mov    -0x8(%rbp),%eax
  jmp    L16
L0:
  addl   $0x1,-0x4(%rbp)
L46:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L43
  addl   $0x1,-0x8(%rbp)
L8:
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L3
  mov    $0xffffffff,%eax
L16:
  pop    %rbp
  ret
```

assistant: ```c
int any(char *s, char *t) {
  int i, j;
  for (i = 0; s[i] != '\0'; i++) {
    for (j = 0; t[j] != '\0'; j++) {
      if (s[i] == t[j++]) {
        return i;
      }
    }
  }
  return -1;
}
```
user: What is the c source code of the assembly code below:

```asm
<any>:
  endbr64
  movzbl (%rdi),%ecx
  test   %cl,%cl
  je     L26
  movzbl (%rsi),%r9d
  mov    $0x0,%r8d
L50:
  mov    %r8d,%r10d
  lea    0x2(%rsi),%rdx
  mov    %r9d,%eax
  test   %r9b,%r9b
  je     L36
L6:
  cmp    %cl,%al
  je     L22
  add    $0x2,%rdx
  movzbl -0x2(%rdx),%eax
  test   %al,%al
  jne    L6
L36:
  add    $0x1,%r8
  movzbl (%rdi,%r8,1),%ecx
  test   %cl,%cl
  jne    L50
  mov    $0xffffffff,%r10d
  jmp    L22
L26:
  mov    $0xffffffff,%r10d
L22:
  mov    %r10d,%eax
  ret
```

assistant: ```c
int any(char *s, char *t) {
  int i, j;
  for (i = 0; s[i] != '\0'; i++) {
    for (j = 0; t[j] != '\0'; j++) {
      if (s[i] == t[j++]) {
        return i;
      }
    }
  }
  return -1;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<any>:
  endbr64
  movzbl (%rdi),%ecx
  test   %cl,%cl
  je     L45
  movzbl (%rsi),%r9d
  xor    %r8d,%r8d
L50:
  mov    %r8d,%r10d
  lea    0x2(%rsi),%rdx
  mov    %r9d,%eax
  test   %r9b,%r9b
  jne    L41
  jmp    L11
  nopl   0x0(%rax,%rax,1)
L59:
  movzbl (%rdx),%eax
  add    $0x2,%rdx
  test   %al,%al
  je     L11
L41:
  cmp    %cl,%al
  jne    L59
  mov    %r10d,%eax
  ret
  nopl   0x0(%rax,%rax,1)
L11:
  add    $0x1,%r8
  movzbl (%rdi,%r8,1),%ecx
  test   %cl,%cl
  jne    L50
L45:
  mov    $0xffffffff,%r10d
  mov    %r10d,%eax
  ret
```

assistant: ```c
int any(char *s, char *t) {
  int i, j;
  for (i = 0; s[i] != '\0'; i++) {
    for (j = 0; t[j] != '\0'; j++) {
      if (s[i] == t[j++]) {
        return i;
      }
    }
  }
  return -1;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<any>:
  endbr64
  movzbl (%rdi),%ecx
  test   %cl,%cl
  je     L13
  movzbl (%rsi),%r9d
  xor    %r8d,%r8d
L39:
  mov    %r8d,%r10d
  lea    0x2(%rsi),%rdx
  mov    %r9d,%eax
  test   %r9b,%r9b
  jne    L7
  jmp    L19
  nopl   0x0(%rax,%rax,1)
L20:
  movzbl (%rdx),%eax
  add    $0x2,%rdx
  test   %al,%al
  je     L19
L7:
  cmp    %cl,%al
  jne    L20
  mov    %r10d,%eax
  ret
  nopl   0x0(%rax,%rax,1)
L19:
  add    $0x1,%r8
  movzbl (%rdi,%r8,1),%ecx
  test   %cl,%cl
  jne    L39
L13:
  mov    $0xffffffff,%r10d
  mov    %r10d,%eax
  ret
```

assistant: ```c
int any(char *s, char *t) {
  int i, j;
  for (i = 0; s[i] != '\0'; i++) {
    for (j = 0; t[j] != '\0'; j++) {
      if (s[i] == t[j++]) {
        return i;
      }
    }
  }
  return -1;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<_times>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x10(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x2b,%edi
  call   <__syscall@plt>
  mov    %eax,-0x14(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  je     L18
  movq   $0x0,-0x10(%rbp)
L18:
  cmpq   $0x0,-0x28(%rbp)
  je     L27
  mov    -0x10(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,0x18(%rax)
  mov    -0x28(%rbp),%rax
  movq   $0x0,0x10(%rax)
  mov    -0x28(%rbp),%rax
  movq   $0x0,0x8(%rax)
  mov    -0x28(%rbp),%rax
  movq   $0x0,(%rax)
L27:
  mov    -0x10(%rbp),%rax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L16
  call   <__stack_chk_fail@plt>
L16:
  leave
  ret
```

assistant: ```c
clock_t _times(struct tms *tp) {
  clock_t utime;
  int err;
  err = __syscall(43, &utime);
  if (err)
    utime = 0;
  if (tp) {
    tp->tms_utime = utime;
    tp->tms_stime = 0;
    tp->tms_cutime = 0;
    tp->tms_cstime = 0;
  }
  return utime;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<_times>:
  endbr64
  push   %rbx
  sub    $0x10,%rsp
  mov    %rdi,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rsi
  mov    $0x2b,%edi
  call   <__syscall@plt>
  test   %eax,%eax
  je     L19
  movq   $0x0,(%rsp)
L19:
  test   %rbx,%rbx
  je     L23
  mov    (%rsp),%rax
  mov    %rax,0x18(%rbx)
  movq   $0x0,0x10(%rbx)
  movq   $0x0,0x8(%rbx)
  movq   $0x0,(%rbx)
L23:
  mov    (%rsp),%rax
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L27
  add    $0x10,%rsp
  pop    %rbx
  ret
L27:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
clock_t _times(struct tms *tp) {
  clock_t utime;
  int err;
  err = __syscall(43, &utime);
  if (err)
    utime = 0;
  if (tp) {
    tp->tms_utime = utime;
    tp->tms_stime = 0;
    tp->tms_cutime = 0;
    tp->tms_cstime = 0;
  }
  return utime;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<_times>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  mov    $0x2b,%edi
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rsi
  call   <__syscall@plt>
  test   %eax,%eax
  mov    $0x0,%eax
  cmove  (%rsp),%rax
  test   %rbx,%rbx
  je     L7
  mov    %rax,0x18(%rbx)
  movq   $0x0,0x10(%rbx)
  movq   $0x0,0x8(%rbx)
  movq   $0x0,(%rbx)
L7:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L16
  add    $0x10,%rsp
  pop    %rbx
  ret
L16:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
clock_t _times(struct tms *tp) {
  clock_t utime;
  int err;
  err = __syscall(43, &utime);
  if (err)
    utime = 0;
  if (tp) {
    tp->tms_utime = utime;
    tp->tms_stime = 0;
    tp->tms_cutime = 0;
    tp->tms_cstime = 0;
  }
  return utime;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<_times>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  mov    $0x2b,%edi
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rsi
  call   <__syscall@plt>
  test   %eax,%eax
  mov    $0x0,%eax
  cmove  (%rsp),%rax
  test   %rbx,%rbx
  je     L3
  mov    %rax,0x18(%rbx)
  pxor   %xmm0,%xmm0
  movq   $0x0,0x10(%rbx)
  movups %xmm0,(%rbx)
L3:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L14
  add    $0x10,%rsp
  pop    %rbx
  ret
L14:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
clock_t _times(struct tms *tp) {
  clock_t utime;
  int err;
  err = __syscall(43, &utime);
  if (err)
    utime = 0;
  if (tp) {
    tp->tms_utime = utime;
    tp->tms_stime = 0;
    tp->tms_cutime = 0;
    tp->tms_cstime = 0;
  }
  return utime;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<free_dmatrix>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %edx,-0x20(%rbp)
  mov    %ecx,-0x24(%rbp)
  mov    %r8d,-0x28(%rbp)
  mov    -0x28(%rbp),%eax
  sub    -0x20(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x3,%rax
  sub    $0x8,%rax
  add    %rdx,%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x1c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,%rdi
  call   <free@plt>
  nop
  leave
  ret
```

assistant: ```c
void free_dmatrix(double **Matrix, int LoRows, int HiRows, int LoCols, int HiCols) {
  int silly;
  silly = HiCols - HiRows;
  free((char *)(Matrix[LoRows] + LoCols - 1));
  free((char *)(Matrix + LoRows - 1));
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<free_dmatrix>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  movslq %esi,%rsi
  lea    0x0(,%rsi,8),%rbp
  movslq %ecx,%rcx
  mov    (%rdi,%rsi,8),%rax
  lea    -0x8(%rax,%rcx,8),%rdi
  call   <free@plt>
  lea    -0x8(%rbx,%rbp,1),%rdi
  call   <free@plt>
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
void free_dmatrix(double **Matrix, int LoRows, int HiRows, int LoCols, int HiCols) {
  int silly;
  silly = HiCols - HiRows;
  free((char *)(Matrix[LoRows] + LoCols - 1));
  free((char *)(Matrix + LoRows - 1));
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<free_dmatrix>:
  endbr64
  push   %rbp
  movslq %esi,%rsi
  movslq %ecx,%rcx
  push   %rbx
  mov    %rdi,%rbx
  lea    0x0(,%rsi,8),%rbp
  sub    $0x8,%rsp
  mov    (%rdi,%rsi,8),%rax
  lea    -0x8(%rax,%rcx,8),%rdi
  call   <free@plt>
  add    $0x8,%rsp
  lea    -0x8(%rbx,%rbp,1),%rdi
  pop    %rbx
  pop    %rbp
  jmp    1050 <free@plt>
```

assistant: ```c
void free_dmatrix(double **Matrix, int LoRows, int HiRows, int LoCols, int HiCols) {
  int silly;
  silly = HiCols - HiRows;
  free((char *)(Matrix[LoRows] + LoCols - 1));
  free((char *)(Matrix + LoRows - 1));
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<free_dmatrix>:
  endbr64
  push   %rbp
  movslq %esi,%rsi
  movslq %ecx,%rcx
  push   %rbx
  mov    %rdi,%rbx
  lea    0x0(,%rsi,8),%rbp
  sub    $0x8,%rsp
  mov    (%rdi,%rsi,8),%rax
  lea    -0x8(%rax,%rcx,8),%rdi
  call   <free@plt>
  add    $0x8,%rsp
  lea    -0x8(%rbx,%rbp,1),%rdi
  pop    %rbx
  pop    %rbp
  jmp    1050 <free@plt>
```

assistant: ```c
void free_dmatrix(double **Matrix, int LoRows, int HiRows, int LoCols, int HiCols) {
  int silly;
  silly = HiCols - HiRows;
  free((char *)(Matrix[LoRows] + LoCols - 1));
  free((char *)(Matrix + LoRows - 1));
}
```
user: Translate the below assembly code into C programming language:

```asm
<add>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L0
L9:
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  add    %edx,%edx
  mov    %edx,(%rax)
  addl   $0x1,-0x4(%rbp)
L0:
  mov    -0x4(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L9
  nop
  nop
  pop    %rbp
  ret
```

assistant: ```c
void add(int a[], int len) {
  int i;
  for (i = 0; i < len; i++)
    a[i] <<= 1;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<add>:
  endbr64
  test   %esi,%esi
  jle    L17
  mov    %rdi,%rax
  lea    -0x1(%rsi),%edx
  lea    0x4(%rdi,%rdx,4),%rdx
L3:
  shll   (%rax)
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L3
L17:
  ret
```

assistant: ```c
void add(int a[], int len) {
  int i;
  for (i = 0; i < len; i++)
    a[i] <<= 1;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<add>:
  endbr64
  test   %esi,%esi
  jle    L1
  lea    -0x1(%rsi),%eax
  lea    0x4(%rdi,%rax,4),%rax
L17:
  shll   (%rdi)
  add    $0x4,%rdi
  cmp    %rax,%rdi
  jne    L17
L1:
  ret
```

assistant: ```c
void add(int a[], int len) {
  int i;
  for (i = 0; i < len; i++)
    a[i] <<= 1;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<add>:
  endbr64
  test   %esi,%esi
  jle    L43
  lea    -0x1(%rsi),%eax
  cmp    $0x2,%eax
  jbe    L22
  mov    %esi,%edx
  mov    %rdi,%rax
  shr    $0x2,%edx
  sub    $0x1,%edx
  shl    $0x4,%rdx
  lea    0x10(%rdi,%rdx,1),%rdx
  nopl   0x0(%rax)
L20:
  movdqu (%rax),%xmm0
  add    $0x10,%rax
  pslld  $0x1,%xmm0
  movups %xmm0,-0x10(%rax)
  cmp    %rdx,%rax
  jne    L20
  mov    %esi,%edx
  and    $0xfffffffc,%edx
  test   $0x3,%sil
  je     L3
L58:
  movslq %edx,%rax
  lea    0x1(%rdx),%ecx
  shl    $0x2,%rax
  shll   (%rdi,%rax,1)
  cmp    %ecx,%esi
  jle    L43
  add    $0x2,%edx
  shll   0x4(%rdi,%rax,1)
  cmp    %edx,%esi
  jle    L43
  shll   0x8(%rdi,%rax,1)
L43:
  ret
  nopw   0x0(%rax,%rax,1)
L3:
  ret
L22:
  xor    %edx,%edx
  jmp    L58
```

assistant: ```c
void add(int a[], int len) {
  int i;
  for (i = 0; i < len; i++)
    a[i] <<= 1;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<BLInternalFlashStartAddrCheck>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    $0x400fe008,%eax
  mov    (%rax),%rax
  movzwl %ax,%eax
  add    $0x1,%rax
  shl    $0xb,%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  sub    $0x800,%rax
  cmp    %rax,-0x18(%rbp)
  je     L45
  subq   $0x800,-0x8(%rbp)
L45:
  mov    -0x8(%rbp),%rax
  sub    $0x800,%rax
  cmp    %rax,-0x18(%rbp)
  je     L28
  cmpq   $0x800,-0x18(%rbp)
  jne    L59
L28:
  mov    -0x18(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  cmp    %rax,-0x8(%rbp)
  jb     L59
  mov    -0x18(%rbp),%rax
  and    $0x3,%eax
  test   %rax,%rax
  je     L33
L59:
  mov    $0x0,%eax
  jmp    L4
L33:
  mov    $0x1,%eax
L4:
  pop    %rbp
  ret
```

assistant: ```c
unsigned long BLInternalFlashStartAddrCheck(unsigned long ulAddr, unsigned long ulImgSize) {
  unsigned long ulFlashSize;
  ulFlashSize = (((*((volatile unsigned long *)(0x400FE008))) & 0x0000FFFF) + 1) << 11;
  if ((ulFlashSize - 0x800) != ulAddr) {
    ulFlashSize -= 0x800;
  }
  if (((ulAddr != (ulFlashSize - 0x800)) && (ulAddr != 0x800)) || ((ulAddr + ulImgSize) > ulFlashSize) || ((ulAddr & 3) != 0)) {
    return (0);
  } else {
    return (1);
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<BLInternalFlashStartAddrCheck>:
  endbr64
  mov    0x400fe008,%rax
  movzwl %ax,%eax
  add    $0x1,%rax
  shl    $0xb,%rax
  lea    -0x800(%rax),%rcx
  cmp    %rdi,%rcx
  je     L16
  sub    $0x1000,%rax
  cmp    %rdi,%rax
  je     L25
  mov    $0x0,%edx
  cmp    $0x800,%rdi
  jne    L15
L25:
  mov    %rcx,%rax
L16:
  add    %rdi,%rsi
  mov    $0x0,%edx
  cmp    %rax,%rsi
  ja     L15
  test   $0x3,%dil
  sete   %dl
  movzbl %dl,%edx
L15:
  mov    %rdx,%rax
  ret
```

assistant: ```c
unsigned long BLInternalFlashStartAddrCheck(unsigned long ulAddr, unsigned long ulImgSize) {
  unsigned long ulFlashSize;
  ulFlashSize = (((*((volatile unsigned long *)(0x400FE008))) & 0x0000FFFF) + 1) << 11;
  if ((ulFlashSize - 0x800) != ulAddr) {
    ulFlashSize -= 0x800;
  }
  if (((ulAddr != (ulFlashSize - 0x800)) && (ulAddr != 0x800)) || ((ulAddr + ulImgSize) > ulFlashSize) || ((ulAddr & 3) != 0)) {
    return (0);
  } else {
    return (1);
  }
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<BLInternalFlashStartAddrCheck>:
  endbr64
  mov    0x400fe008,%rax
  movzwl %ax,%eax
  add    $0x1,%rax
  shl    $0xb,%rax
  lea    -0x800(%rax),%rdx
  cmp    %rdi,%rdx
  je     L36
  sub    $0x1000,%rax
  cmp    %rdi,%rax
  je     L12
  xor    %r8d,%r8d
  cmp    $0x800,%rdi
  je     L12
L23:
  mov    %r8,%rax
  ret
  xchg   %ax,%ax
L12:
  mov    %rdx,%rax
L36:
  add    %rdi,%rsi
  xor    %r8d,%r8d
  cmp    %rax,%rsi
  ja     L23
  xor    %r8d,%r8d
  and    $0x3,%edi
  sete   %r8b
  mov    %r8,%rax
  ret
```

assistant: ```c
unsigned long BLInternalFlashStartAddrCheck(unsigned long ulAddr, unsigned long ulImgSize) {
  unsigned long ulFlashSize;
  ulFlashSize = (((*((volatile unsigned long *)(0x400FE008))) & 0x0000FFFF) + 1) << 11;
  if ((ulFlashSize - 0x800) != ulAddr) {
    ulFlashSize -= 0x800;
  }
  if (((ulAddr != (ulFlashSize - 0x800)) && (ulAddr != 0x800)) || ((ulAddr + ulImgSize) > ulFlashSize) || ((ulAddr & 3) != 0)) {
    return (0);
  } else {
    return (1);
  }
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<BLInternalFlashStartAddrCheck>:
  endbr64
  mov    0x400fe008,%rax
  movzwl %ax,%eax
  add    $0x1,%rax
  shl    $0xb,%rax
  lea    -0x800(%rax),%rdx
  cmp    %rdi,%rdx
  je     L16
  sub    $0x1000,%rax
  cmp    %rdi,%rax
  je     L15
  xor    %r8d,%r8d
  cmp    $0x800,%rdi
  je     L15
L34:
  mov    %r8,%rax
  ret
  xchg   %ax,%ax
L15:
  mov    %rdx,%rax
L16:
  add    %rdi,%rsi
  xor    %r8d,%r8d
  cmp    %rax,%rsi
  ja     L34
  xor    %r8d,%r8d
  and    $0x3,%edi
  sete   %r8b
  mov    %r8,%rax
  ret
```

assistant: ```c
unsigned long BLInternalFlashStartAddrCheck(unsigned long ulAddr, unsigned long ulImgSize) {
  unsigned long ulFlashSize;
  ulFlashSize = (((*((volatile unsigned long *)(0x400FE008))) & 0x0000FFFF) + 1) << 11;
  if ((ulFlashSize - 0x800) != ulAddr) {
    ulFlashSize -= 0x800;
  }
  if (((ulAddr != (ulFlashSize - 0x800)) && (ulAddr != 0x800)) || ((ulAddr + ulImgSize) > ulFlashSize) || ((ulAddr & 3) != 0)) {
    return (0);
  } else {
    return (1);
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<ctxt_switch_loading>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  movsd  %xmm0,-0x8(%rbp)
  movsd  -0x8(%rbp),%xmm0
  cvttsd2si %xmm0,%eax
  mov    %eax,%edi
  call   <fabs@plt>
  movsd  D57(%rip),%xmm1
  comisd %xmm0,%xmm1
  jbe    L9
  lea    D73(%rip),%rax
  jmp    L24
L9:
  movsd  -0x8(%rbp),%xmm0
  comisd D3(%rip),%xmm0
  jbe    L53
  lea    D100(%rip),%rax
  jmp    L24
L53:
  movsd  -0x8(%rbp),%xmm0
  comisd D63(%rip),%xmm0
  jbe    L30
  lea    D22(%rip),%rax
  jmp    L24
L30:
  movsd  -0x8(%rbp),%xmm0
  comisd D45(%rip),%xmm0
  jbe    L35
  lea    D35(%rip),%rax
  jmp    L24
L35:
  movsd  -0x8(%rbp),%xmm0
  comisd D39(%rip),%xmm0
  jbe    L17
  lea    D112(%rip),%rax
  jmp    L24
L17:
  movsd  -0x8(%rbp),%xmm0
  movsd  D58(%rip),%xmm1
  comisd %xmm1,%xmm0
  jbe    L86
  lea    D17(%rip),%rax
  jmp    L24
L86:
  lea    D110(%rip),%rax
L24:
  leave
  ret
```

tool_calls: name: read_data
arguments: tag: D57
type: f64
name: read_data
arguments: tag: D73
type: string
name: read_data
arguments: tag: D3
type: f64[2]
name: read_data
arguments: tag: D100
type: string
name: read_data
arguments: tag: D63
type: f64[2]
name: read_data
arguments: tag: D22
type: string
name: read_data
arguments: tag: D45
type: f64[2]
name: read_data
arguments: tag: D35
type: string
name: read_data
arguments: tag: D39
type: f64[2]
name: read_data
arguments: tag: D112
type: string
name: read_data
arguments: tag: D58
type: f64
name: read_data
arguments: tag: D17
type: string
name: read_data
arguments: tag: D110
type: string

tool: D57: 1e-07

tool: D73: idle

tool: {"D3": [10000.0,1000.0]}

tool: D100: very high

tool: {"D63": [1000.0,100.0]}

tool: D22: high

tool: {"D45": [100.0,10.0]}

tool: D35: quite high

tool: {"D39": [10.0,1.0]}

tool: D112: moderate

tool: D58: 1

tool: D17: low

tool: D110: very low

assistant: ```c
const char *ctxt_switch_loading(const double rate) {
  if ((fabs((rate) - (0.0)) < (0.0000001)))
    return "idle";
  if (rate > 10000.0)
    return "very high";
  if (rate > 1000.0)
    return "high";
  if (rate > 100.0)
    return "quite high";
  if (rate > 10.0)
    return "moderate";
  if (rate > 1.0)
    return "low";
  return "very low";
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<ctxt_switch_loading>:
  endbr64
  sub    $0x18,%rsp
  movsd  %xmm0,0x8(%rsp)
  cvttsd2si %xmm0,%edi
  call   <fabs@plt>
  lea    D53(%rip),%rax
  movsd  D64(%rip),%xmm1
  comisd %xmm0,%xmm1
  ja     L48
  lea    D110(%rip),%rax
  movsd  0x8(%rsp),%xmm2
  comisd D79(%rip),%xmm2
  ja     L48
  lea    D71(%rip),%rax
  comisd D32(%rip),%xmm2
  ja     L48
  lea    D82(%rip),%rax
  comisd D85(%rip),%xmm2
  ja     L48
  lea    D77(%rip),%rax
  comisd D22(%rip),%xmm2
  ja     L48
  comisd D41(%rip),%xmm2
  lea    D61(%rip),%rax
  lea    D121(%rip),%rdx
  cmovbe %rdx,%rax
L48:
  add    $0x18,%rsp
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D53
data_type: string
name: retrieve_data
arguments: data_tag: D64
data_type: f64
name: retrieve_data
arguments: data_tag: D110
data_type: string
name: retrieve_data
arguments: data_tag: D79
data_type: f64[2]
name: retrieve_data
arguments: data_tag: D71
data_type: string
name: retrieve_data
arguments: data_tag: D32
data_type: f64[2]
name: retrieve_data
arguments: data_tag: D82
data_type: string
name: retrieve_data
arguments: data_tag: D85
data_type: f64[2]
name: retrieve_data
arguments: data_tag: D77
data_type: string
name: retrieve_data
arguments: data_tag: D22
data_type: f64[2]
name: retrieve_data
arguments: data_tag: D41
data_type: f64
name: retrieve_data
arguments: data_tag: D61
data_type: string
name: retrieve_data
arguments: data_tag: D121
data_type: string

tool: D53: idle

tool: D64: 1e-07

tool: D110: very high

tool: {"D79": [10000.0,1000.0]}

tool: D71: high

tool: {"D32": [1000.0,100.0]}

tool: D82: quite high

tool: {"D85": [100.0,10.0]}

tool: D77: moderate

tool: {"D22": [10.0,1.0]}

tool: D41: 1

tool: D61: low

tool: D121: very low

assistant: ```c
const char *ctxt_switch_loading(const double rate) {
  if ((fabs((rate) - (0.0)) < (0.0000001)))
    return "idle";
  if (rate > 10000.0)
    return "very high";
  if (rate > 1000.0)
    return "high";
  if (rate > 100.0)
    return "quite high";
  if (rate > 10.0)
    return "moderate";
  if (rate > 1.0)
    return "low";
  return "very low";
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<ctxt_switch_loading>:
  endbr64
  cvttsd2si %xmm0,%edi
  sub    $0x18,%rsp
  movsd  %xmm0,0x8(%rsp)
  call   <fabs@plt>
  movsd  D121(%rip),%xmm2
  lea    D17(%rip),%rax
  comisd %xmm0,%xmm2
  ja     L36
  movsd  0x8(%rsp),%xmm1
  comisd D43(%rip),%xmm1
  lea    D2(%rip),%rax
  ja     L36
  comisd D4(%rip),%xmm1
  lea    D10(%rip),%rax
  ja     L36
  comisd D9(%rip),%xmm1
  lea    D49(%rip),%rax
  ja     L36
  comisd D22(%rip),%xmm1
  lea    D56(%rip),%rax
  ja     L36
  comisd D5(%rip),%xmm1
  lea    D76(%rip),%rax
  lea    D55(%rip),%rdx
  cmovbe %rdx,%rax
L36:
  add    $0x18,%rsp
  ret
```

tool_calls: name: read_data
arguments: data_tag: D121
type_infered: f64
name: read_data
arguments: data_tag: D17
type_infered: string
name: read_data
arguments: data_tag: D43
type_infered: f64[2]
name: read_data
arguments: data_tag: D2
type_infered: string
name: read_data
arguments: data_tag: D4
type_infered: f64[2]
name: read_data
arguments: data_tag: D10
type_infered: string
name: read_data
arguments: data_tag: D9
type_infered: f64[2]
name: read_data
arguments: data_tag: D49
type_infered: string
name: read_data
arguments: data_tag: D22
type_infered: f64[2]
name: read_data
arguments: data_tag: D56
type_infered: string
name: read_data
arguments: data_tag: D5
type_infered: f64
name: read_data
arguments: data_tag: D76
type_infered: string
name: read_data
arguments: data_tag: D55
type_infered: string

tool: D121: 1e-07

tool: D17: idle

tool: {"D43": [10000.0,1000.0]}

tool: D2: very high

tool: {"D4": [1000.0,100.0]}

tool: D10: high

tool: {"D9": [100.0,10.0]}

tool: D49: quite high

tool: {"D22": [10.0,1.0]}

tool: D56: moderate

tool: D5: 1

tool: D76: low

tool: D55: very low

assistant: ```c
const char *ctxt_switch_loading(const double rate) {
  if ((fabs((rate) - (0.0)) < (0.0000001)))
    return "idle";
  if (rate > 10000.0)
    return "very high";
  if (rate > 1000.0)
    return "high";
  if (rate > 100.0)
    return "quite high";
  if (rate > 10.0)
    return "moderate";
  if (rate > 1.0)
    return "low";
  return "very low";
}
```