ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请从给定的汇编指令推导出C源代码:

```asm
<cmp>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    (%rdi),%rbx
  mov    (%rsi),%rbp
  movzbl (%rbx),%eax
  movzbl 0x0(%rbp),%edx
  cmp    %dl,%al
  je     L82
  cmp    $0x2d,%al
  je     L72
  cmp    $0x2d,%dl
  je     L56
L82:
  mov    %rbx,%rdi
  call   <strlen@plt>
  mov    %rbp,%rdi
  mov    %eax,%r12d
  call   <strlen@plt>
  cmp    %eax,%r12d
  je     L2
  setl   %dl
  xor    %eax,%eax
  cmpb   $0x2d,(%rbx)
  jne    L38
  cmpb   $0x2d,0x0(%rbp)
  sete   %al
L38:
  cmp    %al,%dl
  je     L32
L72:
  pop    %rbx
  mov    $0xffffffff,%eax
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L2:
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <strcmp@plt>
  xor    %edx,%edx
  shr    $0x3f,%rax
  cmpb   $0x2d,(%rbx)
  je     L76
L58:
  cmp    %dl,%al
  jne    L72
L32:
  mov    $0x1,%eax
L6:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L56:
  cmp    $0x2d,%al
  je     L72
  mov    $0x1,%eax
  jmp    L6
  nopl   0x0(%rax,%rax,1)
L76:
  cmpb   $0x2d,0x0(%rbp)
  sete   %dl
  jmp    L58
```

assistant: ```c
int cmp(const void *a, const void *b) {
  char *x = *(char **)a, *y = *(char **)b;
  if (x[0] != y[0] && (x[0] == '-' || y[0] == '-'))
    return x[0] == '-' ? -1 : 1;
  int n0 = strlen(x), n1 = strlen(y);
  if (n0 != n1)
    return ((n0 < n1) ^ (x[0] == '-' && y[0] == '-')) ? -1 : 1;
  return ((strcmp(x, y) < 0) ^ (x[0] == '-' && y[0] == '-')) ? -1 : 1;
}
```
user: Translate the below assembly code into C programming language:

```asm
<cmp>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    (%rdi),%rbx
  mov    (%rsi),%rbp
  movzbl (%rbx),%eax
  movzbl 0x0(%rbp),%edx
  cmp    %dl,%al
  je     L93
  cmp    $0x2d,%al
  je     L101
  cmp    $0x2d,%dl
  je     L50
L93:
  mov    %rbx,%rdi
  call   <strlen@plt>
  mov    %rbp,%rdi
  mov    %eax,%r12d
  call   <strlen@plt>
  cmp    %eax,%r12d
  je     L53
  setl   %dl
  xor    %eax,%eax
  cmpb   $0x2d,(%rbx)
  jne    L107
  cmpb   $0x2d,0x0(%rbp)
  sete   %al
L107:
  cmp    %al,%dl
  je     L68
L101:
  pop    %rbx
  mov    $0xffffffff,%eax
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L53:
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <strcmp@plt>
  xor    %edx,%edx
  shr    $0x3f,%rax
  cmpb   $0x2d,(%rbx)
  je     L52
L102:
  cmp    %dl,%al
  jne    L101
L68:
  mov    $0x1,%eax
L75:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L50:
  cmp    $0x2d,%al
  je     L101
  mov    $0x1,%eax
  jmp    L75
  nopl   0x0(%rax,%rax,1)
L52:
  cmpb   $0x2d,0x0(%rbp)
  sete   %dl
  jmp    L102
```

assistant: ```c
int cmp(const void *a, const void *b) {
  char *x = *(char **)a, *y = *(char **)b;
  if (x[0] != y[0] && (x[0] == '-' || y[0] == '-'))
    return x[0] == '-' ? -1 : 1;
  int n0 = strlen(x), n1 = strlen(y);
  if (n0 != n1)
    return ((n0 < n1) ^ (x[0] == '-' && y[0] == '-')) ? -1 : 1;
  return ((strcmp(x, y) < 0) ^ (x[0] == '-' && y[0] == '-')) ? -1 : 1;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<jan1>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r12
  push   %rbx
  mov    %edi,-0x14(%rbp)
  mov    -0x14(%rbp),%r12d
  lea    0x4(%r12),%ecx
  lea    0x3(%r12),%eax
  lea    0x3(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x2,%eax
  lea    (%rcx,%rax,1),%ebx
  cmp    $0x708,%r12d
  jle    L14
  lea    -0x6a5(%r12),%eax
  movslq %eax,%rdx
  imul   $0x51eb851f,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x5,%edx
  sar    $0x1f,%eax
  sub    %edx,%eax
  add    %eax,%ebx
  lea    -0x641(%r12),%eax
  movslq %eax,%rdx
  imul   $0x51eb851f,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x7,%edx
  sar    $0x1f,%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  add    %eax,%ebx
L14:
  cmp    $0x6d8,%r12d
  jle    L7
  add    $0x3,%ebx
L7:
  movslq %ebx,%rax
  imul   $0xffffffff92492493,%rax,%rax
  shr    $0x20,%rax
  add    %ebx,%eax
  sar    $0x2,%eax
  mov    %ebx,%edx
  sar    $0x1f,%edx
  sub    %edx,%eax
  mov    %eax,%edx
  shl    $0x3,%edx
  sub    %eax,%edx
  mov    %ebx,%eax
  sub    %edx,%eax
  pop    %rbx
  pop    %r12
  pop    %rbp
  ret
```

assistant: ```c
jan1(yr) {
  register y, d;
  y = yr;
  d = 4 + y + (y + 3) / 4;
  if (y > 1800) {
    d -= (y - 1701) / 100;
    d += (y - 1601) / 400;
  }
  if (y > 1752)
    d += 3;
  return (d % 7);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<jan1>:
  endbr64
  lea    0x6(%rdi),%eax
  mov    %edi,%edx
  add    $0x3,%edx
  cmovns %edx,%eax
  sar    $0x2,%eax
  lea    0x4(%rdi,%rax,1),%edx
  cmp    $0x708,%edi
  jle    L27
  lea    -0x6a5(%rdi),%eax
  movslq %eax,%rcx
  imul   $0x51eb851f,%rcx,%rcx
  sar    $0x25,%rcx
  sar    $0x1f,%eax
  sub    %ecx,%eax
  add    %edx,%eax
  sub    $0x641,%edi
  movslq %edi,%rdx
  imul   $0x51eb851f,%rdx,%rdx
  sar    $0x27,%rdx
  sar    $0x1f,%edi
  sub    %edi,%edx
  add    %eax,%edx
L24:
  add    $0x3,%edx
L3:
  movslq %edx,%rax
  imul   $0xffffffff92492493,%rax,%rax
  shr    $0x20,%rax
  add    %edx,%eax
  sar    $0x2,%eax
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  lea    0x0(,%rax,8),%ecx
  sub    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  ret
L27:
  cmp    $0x6d8,%edi
  jle    L3
  jmp    L24
```

assistant: ```c
jan1(yr) {
  register y, d;
  y = yr;
  d = 4 + y + (y + 3) / 4;
  if (y > 1800) {
    d -= (y - 1701) / 100;
    d += (y - 1601) / 400;
  }
  if (y > 1752)
    d += 3;
  return (d % 7);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<jan1>:
  endbr64
  mov    %edi,%edx
  lea    0x6(%rdi),%eax
  add    $0x3,%edx
  cmovns %edx,%eax
  sar    $0x2,%eax
  lea    0x4(%rdi,%rax,1),%edx
  cmp    $0x708,%edi
  jle    L16
  lea    -0x6a5(%rdi),%eax
  movslq %eax,%rcx
  sar    $0x1f,%eax
  imul   $0x51eb851f,%rcx,%rcx
  sar    $0x25,%rcx
  sub    %ecx,%eax
  add    %edx,%eax
  lea    -0x641(%rdi),%edx
  imul   $0x51eb851f,%rdx,%rdx
  shr    $0x27,%rdx
  add    %eax,%edx
L2:
  add    $0x3,%edx
L18:
  movslq %edx,%rax
  mov    %edx,%ecx
  imul   $0xffffffff92492493,%rax,%rax
  sar    $0x1f,%ecx
  shr    $0x20,%rax
  add    %edx,%eax
  sar    $0x2,%eax
  sub    %ecx,%eax
  lea    0x0(,%rax,8),%ecx
  sub    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  ret
  nopw   0x0(%rax,%rax,1)
L16:
  cmp    $0x6d8,%edi
  jle    L18
  jmp    L2
```

assistant: ```c
jan1(yr) {
  register y, d;
  y = yr;
  d = 4 + y + (y + 3) / 4;
  if (y > 1800) {
    d -= (y - 1701) / 100;
    d += (y - 1601) / 400;
  }
  if (y > 1752)
    d += 3;
  return (d % 7);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<jan1>:
  endbr64
  mov    %edi,%edx
  lea    0x6(%rdi),%eax
  add    $0x3,%edx
  cmovns %edx,%eax
  sar    $0x2,%eax
  lea    0x4(%rdi,%rax,1),%edx
  cmp    $0x708,%edi
  jle    L11
  lea    -0x6a5(%rdi),%eax
  movslq %eax,%rcx
  sar    $0x1f,%eax
  imul   $0x51eb851f,%rcx,%rcx
  sar    $0x25,%rcx
  sub    %ecx,%eax
  add    %edx,%eax
  lea    -0x641(%rdi),%edx
  imul   $0x51eb851f,%rdx,%rdx
  shr    $0x27,%rdx
  add    %eax,%edx
L23:
  add    $0x3,%edx
L2:
  movslq %edx,%rax
  mov    %edx,%ecx
  imul   $0xffffffff92492493,%rax,%rax
  sar    $0x1f,%ecx
  shr    $0x20,%rax
  add    %edx,%eax
  sar    $0x2,%eax
  sub    %ecx,%eax
  lea    0x0(,%rax,8),%ecx
  sub    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  ret
  nopw   0x0(%rax,%rax,1)
L11:
  cmp    $0x6d8,%edi
  jle    L2
  jmp    L23
```

assistant: ```c
jan1(yr) {
  register y, d;
  y = yr;
  d = 4 + y + (y + 3) / 4;
  if (y > 1800) {
    d -= (y - 1701) / 100;
    d += (y - 1601) / 400;
  }
  if (y > 1752)
    d += 3;
  return (d % 7);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<FatalError>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xd0,%rsp
  mov    %rdi,-0xc8(%rbp)
  mov    %rsi,-0xa8(%rbp)
  mov    %rdx,-0xa0(%rbp)
  mov    %rcx,-0x98(%rbp)
  mov    %r8,-0x90(%rbp)
  mov    %r9,-0x88(%rbp)
  test   %al,%al
  je     L0
  movaps %xmm0,-0x80(%rbp)
  movaps %xmm1,-0x70(%rbp)
  movaps %xmm2,-0x60(%rbp)
  movaps %xmm3,-0x50(%rbp)
  movaps %xmm4,-0x40(%rbp)
  movaps %xmm5,-0x30(%rbp)
  movaps %xmm6,-0x20(%rbp)
  movaps %xmm7,-0x10(%rbp)
L0:
  mov    -0xc8(%rbp),%rdx
  mov    -0xb4(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <va_start@plt>
  mov    -0xb4(%rbp),%edx
  mov    -0xc8(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <vWarning@plt>
  mov    -0xb4(%rbp),%eax
  mov    %eax,%edi
  call   <va_end@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  nop
  leave
  ret
```

assistant: ```c
void FatalError(const char *fmt, ...) {
  va_list args;
  va_start(args, fmt);
  vWarning(fmt, args);
  va_end(args);
  exit(1);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<FatalError>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  mov    %rdi,%rsi
  mov    $0x0,%ebp
  mov    %ebp,%edi
  call   <va_start@plt>
  mov    %ebp,%esi
  mov    %rbx,%rdi
  call   <vWarning@plt>
  mov    %ebp,%edi
  call   <va_end@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
void FatalError(const char *fmt, ...) {
  va_list args;
  va_start(args, fmt);
  vWarning(fmt, args);
  va_end(args);
  exit(1);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<FatalError>:
  endbr64
  push   %r12
  xor    %r12d,%r12d
  mov    %rdi,%rsi
  push   %rbp
  mov    %rdi,%rbp
  mov    %r12d,%edi
  sub    $0x8,%rsp
  call   <va_start@plt>
  mov    %r12d,%esi
  mov    %rbp,%rdi
  call   <vWarning@plt>
  mov    %r12d,%edi
  call   <va_end@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  add    $0x8,%rsp
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void FatalError(const char *fmt, ...) {
  va_list args;
  va_start(args, fmt);
  vWarning(fmt, args);
  va_end(args);
  exit(1);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<FatalError>:
  endbr64
  push   %r12
  xor    %r12d,%r12d
  mov    %rdi,%rsi
  push   %rbp
  mov    %rdi,%rbp
  mov    %r12d,%edi
  sub    $0x8,%rsp
  call   <va_start@plt>
  mov    %r12d,%esi
  mov    %rbp,%rdi
  call   <vWarning@plt>
  mov    %r12d,%edi
  call   <va_end@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  add    $0x8,%rsp
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void FatalError(const char *fmt, ...) {
  va_list args;
  va_start(args, fmt);
  vWarning(fmt, args);
  va_end(args);
  exit(1);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<roll>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  movq   $0x0,-0x8(%rbp)
  jmp    L14
L3:
  mov    $0x0,%eax
  call   <random@plt>
  cltd
  idivl  -0x18(%rbp)
  mov    %edx,%eax
  add    $0x1,%eax
  cltq
  add    %rax,-0x8(%rbp)
L14:
  mov    -0x14(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x14(%rbp)
  test   %eax,%eax
  jne    L3
  mov    -0x8(%rbp),%rax
  leave
  ret
```

assistant: ```c
int roll(int ndie, int nsides) {
  long tot;
  tot = 0;
  while (ndie--)
    tot += (random() % nsides) + 1;
  return (int)tot;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<roll>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  test   %edi,%edi
  je     L29
  mov    %edi,%ebx
  mov    %esi,%r12d
  mov    $0x0,%ebp
L24:
  mov    $0x0,%eax
  call   <random@plt>
  cltd
  idiv   %r12d
  add    $0x1,%edx
  movslq %edx,%rdx
  add    %rdx,%rbp
  sub    $0x1,%ebx
  jne    L24
L3:
  mov    %ebp,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L29:
  mov    $0x0,%ebp
  jmp    L3
```

assistant: ```c
int roll(int ndie, int nsides) {
  long tot;
  tot = 0;
  while (ndie--)
    tot += (random() % nsides) + 1;
  return (int)tot;
}
```
user: Translate the below assembly code into C programming language:

```asm
<roll>:
  endbr64
  test   %edi,%edi
  je     L3
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  mov    %edi,%ebx
  nopl   0x0(%rax,%rax,1)
L7:
  xor    %eax,%eax
  call   <random@plt>
  cltd
  idiv   %r12d
  add    $0x1,%edx
  movslq %edx,%rdx
  add    %rdx,%rbp
  sub    $0x1,%ebx
  jne    L7
  mov    %ebp,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L3:
  xor    %eax,%eax
  ret
```

assistant: ```c
int roll(int ndie, int nsides) {
  long tot;
  tot = 0;
  while (ndie--)
    tot += (random() % nsides) + 1;
  return (int)tot;
}
```
user: Translate the below assembly code into C programming language:

```asm
<roll>:
  endbr64
  test   %edi,%edi
  je     L0
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  mov    %edi,%ebx
  nopl   0x0(%rax,%rax,1)
L4:
  xor    %eax,%eax
  call   <random@plt>
  cltd
  idiv   %r12d
  add    $0x1,%edx
  movslq %edx,%rdx
  add    %rdx,%rbp
  sub    $0x1,%ebx
  jne    L4
  mov    %ebp,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L0:
  xor    %eax,%eax
  ret
```

assistant: ```c
int roll(int ndie, int nsides) {
  long tot;
  tot = 0;
  while (ndie--)
    tot += (random() % nsides) + 1;
  return (int)tot;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<sse_swap_rowf>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
  mov    -0x24(%rbp),%eax
  lea    0x3(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x2,%eax
  shl    $0x2,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  jmp    L14
L7:
  mov    -0x20(%rbp),%rax
  movss  (%rax),%xmm0
  mov    -0x18(%rbp),%rax
  movss  %xmm0,(%rax)
  addq   $0x4,-0x18(%rbp)
L14:
  mov    -0x18(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jb     L7
  nop
  nop
  pop    %rbp
  ret
```

assistant: ```c
void sse_swap_rowf(float *r1, float *r2, int n) {
  int n4 = (n / 4) * 4;
  float *r14end = r1 + n4;
  while (r1 < r14end) {
    *r1 = *r2;
    r1++;
  }
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<sse_swap_rowf>:
  endbr64
  lea    0x3(%rdx),%eax
  test   %edx,%edx
  cmovns %edx,%eax
  and    $0xfffffffc,%eax
  cltq
  lea    (%rdi,%rax,4),%rax
  cmp    %rax,%rdi
  jae    L11
L1:
  movss  (%rsi),%xmm0
  movss  %xmm0,(%rdi)
  add    $0x4,%rdi
  cmp    %rdi,%rax
  ja     L1
L11:
  ret
```

assistant: ```c
void sse_swap_rowf(float *r1, float *r2, int n) {
  int n4 = (n / 4) * 4;
  float *r14end = r1 + n4;
  while (r1 < r14end) {
    *r1 = *r2;
    r1++;
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<sse_swap_rowf>:
  endbr64
  test   %edx,%edx
  lea    0x3(%rdx),%eax
  cmovns %edx,%eax
  and    $0xfffffffc,%eax
  cltq
  lea    (%rdi,%rax,4),%rax
  cmp    %rax,%rdi
  jae    L15
  nopw   0x0(%rax,%rax,1)
L2:
  movss  (%rsi),%xmm0
  add    $0x4,%rdi
  movss  %xmm0,-0x4(%rdi)
  cmp    %rdi,%rax
  ja     L2
L15:
  ret
```

assistant: ```c
void sse_swap_rowf(float *r1, float *r2, int n) {
  int n4 = (n / 4) * 4;
  float *r14end = r1 + n4;
  while (r1 < r14end) {
    *r1 = *r2;
    r1++;
  }
}
```
user: What is the c source code of the assembly code below?

```asm
<sse_swap_rowf>:
  endbr64
  mov    %edx,%eax
  lea    0x3(%rdx),%edx
  mov    %rdi,%rcx
  test   %eax,%eax
  cmovns %eax,%edx
  and    $0xfffffffc,%edx
  movslq %edx,%rdx
  shl    $0x2,%rdx
  lea    (%rdi,%rdx,1),%r8
  cmp    %r8,%rdi
  jae    L66
  sub    $0x1,%rdx
  mov    %rdi,%rax
  lea    0x4(%rsi),%r10
  mov    %rdx,%rdi
  shr    $0x2,%rdi
  add    $0x1,%rdi
  lea    (%rcx,%rdi,4),%r9
  cmp    %r9,%rsi
  setae  %r9b
  cmp    %r10,%rcx
  setae  %r10b
  or     %r10b,%r9b
  je     L26
  cmp    $0xb,%rdx
  jbe    L26
  mov    %rdi,%rdx
  movss  (%rsi),%xmm0
  shr    $0x2,%rdx
  shl    $0x4,%rdx
  shufps $0x0,%xmm0,%xmm0
  add    %rcx,%rdx
  nopl   0x0(%rax)
L19:
  movups %xmm0,(%rax)
  add    $0x10,%rax
  cmp    %rdx,%rax
  jne    L19
  mov    %rdi,%rdx
  and    $0xfffffffffffffffc,%rdx
  lea    (%rcx,%rdx,4),%rax
  cmp    %rdx,%rdi
  je     L66
  movss  (%rsi),%xmm0
  lea    0x4(%rax),%rdx
  movss  %xmm0,(%rax)
  cmp    %rdx,%r8
  jbe    L66
  lea    0x8(%rax),%rdx
  movss  %xmm0,0x4(%rax)
  cmp    %rdx,%r8
  jbe    L66
  movss  (%rsi),%xmm0
  movss  %xmm0,0x8(%rax)
  ret
  nopl   (%rax)
L26:
  movss  (%rsi),%xmm0
  add    $0x4,%rcx
  movss  %xmm0,-0x4(%rcx)
  cmp    %rcx,%r8
  ja     L26
L66:
  ret
```

assistant: ```c
void sse_swap_rowf(float *r1, float *r2, int n) {
  int n4 = (n / 4) * 4;
  float *r14end = r1 + n4;
  while (r1 < r14end) {
    *r1 = *r2;
    r1++;
  }
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<foreach_dir>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x20(%rbp)
  movl   $0x0,-0x30(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <opendir@plt>
  mov    %rax,-0x20(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  je     L49
  movq   $0x0,-0x18(%rbp)
  jmp    L66
L36:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  je     L66
  movq   $0x0,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rcx
  mov    -0x38(%rbp),%rdx
  lea    -0x28(%rbp),%rax
  lea    D4(%rip),%rsi
  mov    %rax,%rdi
  call   <asprintf@plt>
  mov    -0x28(%rbp),%rax
  lea    D0(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <has_library_ext@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  je     L42
  mov    -0x10(%rbp),%rax
  movb   $0x0,(%rax)
L42:
  mov    -0x28(%rbp),%rax
  mov    -0x48(%rbp),%rdx
  mov    -0x40(%rbp),%rcx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   *%rcx
  mov    %eax,-0x2c(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  cmpl   $0x0,-0x2c(%rbp)
  je     L66
  addl   $0x1,-0x30(%rbp)
L66:
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <readdir@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L36
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <closedir@plt>
  jmp    L43
L49:
  addl   $0x1,-0x30(%rbp)
L43:
  mov    -0x30(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L8
  call   <__stack_chk_fail@plt>
L8:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D4
type_guessed: string
name: retrieve_data
arguments: tag: D0
type_guessed: string

tool: D4: %s/%s

tool: D0: .so

assistant: ```c
int foreach_dir(const char *path, int (*func)(const char *filename, void *data), void *data) {
  DIR *dirp = 0;
  int errors = 0;
  dirp = opendir(path);
  if (dirp) {
    struct dirent *dp = 0;
    while ((dp = readdir(dirp)))
      if (dp->d_name[0] != '.') {
        char *fullname = NULL;
        asprintf(&fullname, "%s/%s", path, dp->d_name);
        char *ext = has_library_ext(fullname, ".so");
        if (ext)
          *ext = '\0';
        int rc = func(fullname, data);
        free(fullname);
        if (rc)
          ++errors;
      }
    closedir(dirp);
  } else
    ++errors;
  return errors;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<foreach_dir>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,%rbp
  mov    %rsi,0x8(%rsp)
  mov    %rdx,0x10(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  call   <opendir@plt>
  mov    %rax,%rbx
  mov    $0x0,%r12d
  lea    0x20(%rsp),%r15
  lea    D7(%rip),%r14
  lea    D16(%rip),%r13
  test   %rax,%rax
  je     L54
L2:
  mov    %rbx,%rdi
  call   <readdir@plt>
  test   %rax,%rax
  je     L23
  mov    (%rax),%rdx
  cmpb   $0x2e,(%rdx)
  je     L2
  movq   $0x0,0x20(%rsp)
  mov    (%rax),%rcx
  mov    %rbp,%rdx
  mov    %r14,%rsi
  mov    %r15,%rdi
  call   <asprintf@plt>
  mov    %r13,%rsi
  mov    0x20(%rsp),%rdi
  call   <has_library_ext@plt>
  test   %rax,%rax
  je     L16
  movb   $0x0,(%rax)
L16:
  mov    0x10(%rsp),%rsi
  mov    0x20(%rsp),%rdi
  mov    0x8(%rsp),%rax
  call   *%rax
  mov    %eax,0x1c(%rsp)
  mov    0x20(%rsp),%rdi
  call   <free@plt>
  cmpl   $0x1,0x1c(%rsp)
  sbb    $0xffffffff,%r12d
  jmp    L2
L54:
  mov    $0x1,%r12d
  jmp    L6
L23:
  mov    %rbx,%rdi
  call   <closedir@plt>
L6:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L59
  mov    %r12d,%eax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L59:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D7
type_infered: string
name: read_data
arguments: label: D16
type_infered: string

tool: D7: %s/%s

tool: D16: .so

assistant: ```c
int foreach_dir(const char *path, int (*func)(const char *filename, void *data), void *data) {
  DIR *dirp = 0;
  int errors = 0;
  dirp = opendir(path);
  if (dirp) {
    struct dirent *dp = 0;
    while ((dp = readdir(dirp)))
      if (dp->d_name[0] != '.') {
        char *fullname = NULL;
        asprintf(&fullname, "%s/%s", path, dp->d_name);
        char *ext = has_library_ext(fullname, ".so");
        if (ext)
          *ext = '\0';
        int rc = func(fullname, data);
        free(fullname);
        if (rc)
          ++errors;
      }
    closedir(dirp);
  } else
    ++errors;
  return errors;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<foreach_dir>:
  endbr64
  push   %r15
  push   %r14
  lea    D4(%rip),%r14
  push   %r13
  lea    D13(%rip),%r13
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x38,%rsp
  mov    %rsi,0x8(%rsp)
  lea    0x20(%rsp),%r15
  mov    %rdx,0x10(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  call   <opendir@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  jne    L30
  jmp    L5
  nopw   0x0(%rax,%rax,1)
L15:
  mov    (%rax),%rdx
  cmpb   $0x2e,(%rdx)
  jne    L38
L30:
  mov    %rbp,%rdi
  call   <readdir@plt>
  test   %rax,%rax
  jne    L15
  mov    %rbp,%rdi
  call   <closedir@plt>
L36:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L6
  add    $0x38,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L38:
  movq   $0x0,0x20(%rsp)
  mov    (%rax),%rcx
  mov    %r14,%rsi
  mov    %r15,%rdi
  mov    %rbx,%rdx
  call   <asprintf@plt>
  mov    0x20(%rsp),%rdi
  mov    %r13,%rsi
  call   <has_library_ext@plt>
  test   %rax,%rax
  je     L41
  movb   $0x0,(%rax)
L41:
  mov    0x10(%rsp),%rsi
  mov    0x20(%rsp),%rdi
  mov    0x8(%rsp),%rax
  call   *%rax
  mov    0x20(%rsp),%rdi
  mov    %eax,0x1c(%rsp)
  call   <free@plt>
  cmpl   $0x1,0x1c(%rsp)
  sbb    $0xffffffff,%r12d
  jmp    L30
  nopl   0x0(%rax)
L5:
  mov    $0x1,%r12d
  jmp    L36
L6:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_label: D4
type_guessed: string
name: read_data
arguments: data_label: D13
type_guessed: string

tool: D4: %s/%s

tool: D13: .so

assistant: ```c
int foreach_dir(const char *path, int (*func)(const char *filename, void *data), void *data) {
  DIR *dirp = 0;
  int errors = 0;
  dirp = opendir(path);
  if (dirp) {
    struct dirent *dp = 0;
    while ((dp = readdir(dirp)))
      if (dp->d_name[0] != '.') {
        char *fullname = NULL;
        asprintf(&fullname, "%s/%s", path, dp->d_name);
        char *ext = has_library_ext(fullname, ".so");
        if (ext)
          *ext = '\0';
        int rc = func(fullname, data);
        free(fullname);
        if (rc)
          ++errors;
      }
    closedir(dirp);
  } else
    ++errors;
  return errors;
}
```