ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    D2(%rip),%rdi
  call   <printf@plt>
  lea    0x4(%rsp),%rsi
  lea    D24(%rip),%rdi
  call   <scanf@plt>
  cvttss2si 0x4(%rsp),%esi
  movslq %esi,%rax
  imul   $0x51eb851f,%rax,%rax
  sar    $0x25,%rax
  mov    %esi,%edx
  sar    $0x1f,%edx
  sub    %edx,%eax
  imul   $0x64,%eax,%eax
  sub    %eax,%esi
  lea    D12(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L1
  mov    $0x0,%eax
  add    $0x18,%rsp
  ret
L1:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D2
data_type: string
name: retrieve_data
arguments: data_label: D24
data_type: string
name: retrieve_data
arguments: data_label: D12
data_type: string

tool: D2: Enter a Number: 

tool: D24: %f

tool: D12: 2 Rightmost Intergral Part is: %d 


assistant: ```c
int main() {
  float f;
  printf("Enter a Number: ");
  scanf("%f", &f);
  printf("2 Rightmost Intergral Part is: %d \n", (int)f % 100);
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<main>:
  endbr64
  sub    $0x18,%rsp
  lea    D17(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <printf@plt>
  lea    0x4(%rsp),%rsi
  lea    D12(%rip),%rdi
  call   <scanf@plt>
  cvttss2si 0x4(%rsp),%esi
  lea    D3(%rip),%rdi
  movslq %esi,%rax
  mov    %esi,%edx
  imul   $0x51eb851f,%rax,%rax
  sar    $0x1f,%edx
  sar    $0x25,%rax
  sub    %edx,%eax
  imul   $0x64,%eax,%eax
  sub    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L9
  xor    %eax,%eax
  add    $0x18,%rsp
  ret
L9:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D17
type_infered: string
name: extract_symbolic_data
arguments: data_label: D12
type_infered: string
name: extract_symbolic_data
arguments: data_label: D3
type_infered: string

tool: D17: Enter a Number: 

tool: D12: %f

tool: D3: 2 Rightmost Intergral Part is: %d 


assistant: ```c
int main() {
  float f;
  printf("Enter a Number: ");
  scanf("%f", &f);
  printf("2 Rightmost Intergral Part is: %d \n", (int)f % 100);
  return 0;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<main>:
  endbr64
  sub    $0x18,%rsp
  lea    D0(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <printf@plt>
  lea    0x4(%rsp),%rsi
  lea    D3(%rip),%rdi
  call   <scanf@plt>
  cvttss2si 0x4(%rsp),%esi
  lea    D22(%rip),%rdi
  movslq %esi,%rax
  mov    %esi,%edx
  imul   $0x51eb851f,%rax,%rax
  sar    $0x1f,%edx
  sar    $0x25,%rax
  sub    %edx,%eax
  imul   $0x64,%eax,%eax
  sub    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L3
  xor    %eax,%eax
  add    $0x18,%rsp
  ret
L3:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D0
type_guessed: string
name: disassemble_data
arguments: data_label: D3
type_guessed: string
name: disassemble_data
arguments: data_label: D22
type_guessed: string

tool: D0: Enter a Number: 

tool: D3: %f

tool: D22: 2 Rightmost Intergral Part is: %d 


assistant: ```c
int main() {
  float f;
  printf("Enter a Number: ");
  scanf("%f", &f);
  printf("2 Rightmost Intergral Part is: %d \n", (int)f % 100);
  return 0;
}
```
user: Translate the below assembly code into C programming language:

```asm
<Q_stricmpn>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
L80:
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x24(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x24(%rbp)
  test   %eax,%eax
  jne    L34
  mov    $0x0,%eax
  jmp    L42
L34:
  mov    -0x8(%rbp),%eax
  cmp    -0x4(%rbp),%eax
  je     L60
  cmpl   $0x60,-0x8(%rbp)
  jle    L79
  cmpl   $0x7a,-0x8(%rbp)
  jg     L79
  subl   $0x20,-0x8(%rbp)
L79:
  cmpl   $0x60,-0x4(%rbp)
  jle    L116
  cmpl   $0x7a,-0x4(%rbp)
  jg     L116
  subl   $0x20,-0x4(%rbp)
L116:
  mov    -0x8(%rbp),%eax
  cmp    -0x4(%rbp),%eax
  je     L60
  mov    -0x8(%rbp),%eax
  cmp    -0x4(%rbp),%eax
  jge    L24
  mov    $0xffffffff,%eax
  jmp    L42
L24:
  mov    $0x1,%eax
  jmp    L42
L60:
  cmpl   $0x0,-0x8(%rbp)
  jne    L80
  mov    $0x0,%eax
L42:
  pop    %rbp
  ret
```

assistant: ```c
int Q_stricmpn(const char *s1, const char *s2, int n) {
  int c1, c2;
  do {
    c1 = *s1++;
    c2 = *s2++;
    if (!n--) {
      return 0;
    }
    if (c1 != c2) {
      if (c1 >= 'a' && c1 <= 'z') {
        c1 -= ('a' - 'A');
      }
      if (c2 >= 'a' && c2 <= 'z') {
        c2 -= ('a' - 'A');
      }
      if (c1 != c2) {
        return c1 < c2 ? -1 : 1;
      }
    }
  } while (c1);
  return 0;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<Q_stricmpn>:
  endbr64
  mov    %rdi,%r9
  mov    %rsi,%r10
  mov    %edx,%edx
  mov    $0x0,%esi
  jmp    L25
L99:
  mov    %edi,%r8d
  mov    %eax,%edi
L50:
  cmp    %edi,%r8d
  setge  %dil
  movzbl %dil,%edi
  lea    -0x1(%rdi,%rdi,1),%edi
  jmp    L31
L38:
  mov    $0x0,%edi
L31:
  mov    %edi,%eax
  ret
L78:
  movsbl %cl,%ecx
  sub    $0x61,%ecx
  cmp    $0x19,%ecx
  ja     L50
L11:
  lea    -0x20(%rdi),%eax
  mov    %r8d,%edi
L87:
  cmp    %edi,%eax
  jne    L99
L89:
  add    $0x1,%rsi
  test   %edi,%edi
  je     L31
L25:
  movzbl (%r9,%rsi,1),%eax
  movsbl %al,%r8d
  movzbl (%r10,%rsi,1),%ecx
  movsbl %cl,%edi
  cmp    %rdx,%rsi
  je     L38
  cmp    %edi,%r8d
  je     L89
  mov    %r8d,%eax
  sub    $0x61,%eax
  cmp    $0x19,%eax
  ja     L78
  sub    $0x20,%r8d
  mov    %edi,%ecx
  sub    $0x61,%ecx
  cmp    $0x19,%ecx
  jbe    L11
  mov    %edi,%eax
  mov    %r8d,%edi
  jmp    L87
```

assistant: ```c
int Q_stricmpn(const char *s1, const char *s2, int n) {
  int c1, c2;
  do {
    c1 = *s1++;
    c2 = *s2++;
    if (!n--) {
      return 0;
    }
    if (c1 != c2) {
      if (c1 >= 'a' && c1 <= 'z') {
        c1 -= ('a' - 'A');
      }
      if (c2 >= 'a' && c2 <= 'z') {
        c2 -= ('a' - 'A');
      }
      if (c1 != c2) {
        return c1 < c2 ? -1 : 1;
      }
    }
  } while (c1);
  return 0;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<Q_stricmpn>:
  endbr64
  mov    %edx,%edx
  xor    %ecx,%ecx
  jmp    L59
  nopw   0x0(%rax,%rax,1)
L39:
  sub    $0x20,%r8d
  cmp    $0x19,%r10d
  jbe    L17
  mov    %eax,%r9d
  mov    %r8d,%eax
L46:
  cmp    %r8d,%r9d
  jne    L32
L89:
  add    $0x1,%rcx
  test   %eax,%eax
  je     L57
L59:
  movsbl (%rdi,%rcx,1),%r8d
  movsbl (%rsi,%rcx,1),%eax
  cmp    %rcx,%rdx
  je     L70
  cmp    %eax,%r8d
  je     L89
  lea    -0x61(%r8),%r9d
  lea    -0x61(%rax),%r10d
  cmp    $0x19,%r9d
  jbe    L39
  cmp    $0x19,%r10d
  ja     L65
L17:
  lea    -0x20(%rax),%r9d
  mov    %r8d,%eax
  jmp    L46
  nopl   (%rax)
L70:
  xor    %eax,%eax
  ret
  nopl   0x0(%rax,%rax,1)
L57:
  ret
L32:
  mov    %r9d,%eax
L65:
  cmp    %eax,%r8d
  setge  %al
  movzbl %al,%eax
  lea    -0x1(%rax,%rax,1),%eax
  ret
```

assistant: ```c
int Q_stricmpn(const char *s1, const char *s2, int n) {
  int c1, c2;
  do {
    c1 = *s1++;
    c2 = *s2++;
    if (!n--) {
      return 0;
    }
    if (c1 != c2) {
      if (c1 >= 'a' && c1 <= 'z') {
        c1 -= ('a' - 'A');
      }
      if (c2 >= 'a' && c2 <= 'z') {
        c2 -= ('a' - 'A');
      }
      if (c1 != c2) {
        return c1 < c2 ? -1 : 1;
      }
    }
  } while (c1);
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<Q_stricmpn>:
  endbr64
  mov    %edx,%edx
  xor    %ecx,%ecx
  jmp    L60
  nopw   0x0(%rax,%rax,1)
L58:
  sub    $0x20,%r8d
  cmp    $0x19,%r10d
  jbe    L38
  mov    %eax,%r9d
  mov    %r8d,%eax
L86:
  cmp    %r8d,%r9d
  jne    L12
L22:
  add    $0x1,%rcx
  test   %eax,%eax
  je     L81
L60:
  movsbl (%rdi,%rcx,1),%r8d
  movsbl (%rsi,%rcx,1),%eax
  cmp    %rcx,%rdx
  je     L0
  cmp    %eax,%r8d
  je     L22
  lea    -0x61(%r8),%r9d
  lea    -0x61(%rax),%r10d
  cmp    $0x19,%r9d
  jbe    L58
  cmp    $0x19,%r10d
  ja     L10
L38:
  lea    -0x20(%rax),%r9d
  mov    %r8d,%eax
  jmp    L86
  nopl   (%rax)
L0:
  xor    %eax,%eax
  ret
  nopl   0x0(%rax,%rax,1)
L81:
  ret
L12:
  mov    %r9d,%eax
L10:
  cmp    %eax,%r8d
  setge  %al
  movzbl %al,%eax
  lea    -0x1(%rax,%rax,1),%eax
  ret
```

assistant: ```c
int Q_stricmpn(const char *s1, const char *s2, int n) {
  int c1, c2;
  do {
    c1 = *s1++;
    c2 = *s2++;
    if (!n--) {
      return 0;
    }
    if (c1 != c2) {
      if (c1 >= 'a' && c1 <= 'z') {
        c1 -= ('a' - 'A');
      }
      if (c2 >= 'a' && c2 <= 'z') {
        c2 -= ('a' - 'A');
      }
      if (c1 != c2) {
        return c1 < c2 ? -1 : 1;
      }
    }
  } while (c1);
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<pullphone>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L14
L3:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    -0x4(%rbp),%edx
  movslq %edx,%rcx
  mov    -0x20(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0x4(%rbp)
L14:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2c,%al
  jne    L3
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  nop
  pop    %rbp
  ret
```

assistant: ```c
void pullphone(char *dn, char *str) {
  int i = 0;
  while (dn[i] != ',')
    str[i] = dn[i], i++;
  str[i] = 0x0;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<pullphone>:
  endbr64
  movzbl (%rdi),%edx
  cmp    $0x2c,%dl
  je     L23
  mov    $0x0,%eax
L6:
  mov    %dl,(%rsi,%rax,1)
  add    $0x1,%rax
  movzbl (%rdi,%rax,1),%edx
  cmp    $0x2c,%dl
  jne    L6
L7:
  movb   $0x0,(%rsi,%rax,1)
  ret
L23:
  mov    $0x0,%eax
  jmp    L7
```

assistant: ```c
void pullphone(char *dn, char *str) {
  int i = 0;
  while (dn[i] != ',')
    str[i] = dn[i], i++;
  str[i] = 0x0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<pullphone>:
  endbr64
  movzbl (%rdi),%edx
  cmp    $0x2c,%dl
  je     L0
  xor    %eax,%eax
  xchg   %ax,%ax
L19:
  mov    %dl,(%rsi,%rax,1)
  add    $0x1,%rax
  movzbl (%rdi,%rax,1),%edx
  cmp    $0x2c,%dl
  jne    L19
  add    %rax,%rsi
L0:
  movb   $0x0,(%rsi)
  ret
```

assistant: ```c
void pullphone(char *dn, char *str) {
  int i = 0;
  while (dn[i] != ',')
    str[i] = dn[i], i++;
  str[i] = 0x0;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<pullphone>:
  endbr64
  movzbl (%rdi),%edx
  cmp    $0x2c,%dl
  je     L7
  xor    %eax,%eax
  xchg   %ax,%ax
L3:
  mov    %dl,(%rsi,%rax,1)
  add    $0x1,%rax
  movzbl (%rdi,%rax,1),%edx
  cmp    $0x2c,%dl
  jne    L3
  add    %rax,%rsi
L7:
  movb   $0x0,(%rsi)
  ret
```

assistant: ```c
void pullphone(char *dn, char *str) {
  int i = 0;
  while (dn[i] != ',')
    str[i] = dn[i], i++;
  str[i] = 0x0;
}
```
user: What is the c source code of the assembly code below:

```asm
<kmp>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%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    -0x28(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <makeNext@plt>
  movl   $0x0,-0x10(%rbp)
  movl   $0x0,-0xc(%rbp)
  jmp    L3
L11:
  mov    -0xc(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0xc(%rbp)
L37:
  cmpl   $0x0,-0xc(%rbp)
  jle    L8
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0x10(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  jne    L11
L8:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0x10(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  jne    L29
  addl   $0x1,-0xc(%rbp)
L29:
  mov    -0xc(%rbp),%eax
  cmp    -0x4(%rbp),%eax
  jne    L56
  mov    -0x10(%rbp),%eax
  sub    -0x4(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,%esi
  lea    D0(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
L56:
  addl   $0x1,-0x10(%rbp)
L3:
  mov    -0x10(%rbp),%eax
  cmp    -0x8(%rbp),%eax
  jl     L37
  nop
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_tag: D0
datatype: string

tool: D0: Pattern occurs with shift:%d


assistant: ```c
int kmp(const char T[], const char P[], int next[]) {
  int n, m;
  int i, q;
  n = strlen(T);
  m = strlen(P);
  makeNext(P, next);
  for (i = 0, q = 0; i < n; ++i) {
    while (q > 0 && P[q] != T[i])
      q = next[q - 1];
    if (P[q] == T[i]) {
      q++;
    }
    if (q == m) {
      printf("Pattern occurs with shift:%d\n", (i - m + 1));
    }
  }
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<kmp>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r15
  mov    %rsi,%rbp
  mov    %rdx,%r12
  call   <strlen@plt>
  mov    %eax,%ebx
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %eax,%r14d
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <makeNext@plt>
  test   %ebx,%ebx
  jle    L103
  lea    -0x1(%rbx),%eax
  mov    %r15,%rsi
  lea    0x1(%r15,%rax,1),%r15
  mov    %rsi,%r13
  mov    $0x0,%ebx
  mov    $0x1,%eax
  sub    %esi,%eax
  sub    %r14d,%eax
  mov    %eax,0xc(%rsp)
  jmp    L4
L83:
  movslq %ebx,%rax
  movzbl 0x0(%r13),%ecx
  cmp    %cl,0x0(%rbp,%rax,1)
  je     L17
L52:
  cmp    %r14d,%ebx
  je     L77
L39:
  add    $0x1,%r13
  cmp    %r15,%r13
  je     L103
L4:
  test   %ebx,%ebx
  jle    L83
  movzbl 0x0(%r13),%edx
L72:
  movslq %ebx,%rax
  cmp    %dl,0x0(%rbp,%rax,1)
  je     L17
  mov    -0x4(%r12,%rax,4),%ebx
  test   %ebx,%ebx
  jg     L72
  jmp    L83
L17:
  add    $0x1,%ebx
  jmp    L52
L77:
  mov    0xc(%rsp),%eax
  lea    (%rax,%r13,1),%esi
  lea    D0(%rip),%rdi
  call   <printf@plt>
  jmp    L39
L103:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D0
type_infered: string

tool: D0: Pattern occurs with shift:%d


assistant: ```c
int kmp(const char T[], const char P[], int next[]) {
  int n, m;
  int i, q;
  n = strlen(T);
  m = strlen(P);
  makeNext(P, next);
  for (i = 0, q = 0; i < n; ++i) {
    while (q > 0 && P[q] != T[i])
      q = next[q - 1];
    if (P[q] == T[i]) {
      q++;
    }
    if (q == m) {
      printf("Pattern occurs with shift:%d\n", (i - m + 1));
    }
  }
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<kmp>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  sub    $0x18,%rsp
  call   <strlen@plt>
  mov    %rbp,%rdi
  mov    %eax,%ebx
  call   <strlen@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  mov    %eax,%r15d
  call   <makeNext@plt>
  test   %ebx,%ebx
  jle    L9
  mov    $0x1,%r13d
  lea    -0x1(%rbx),%eax
  xor    %ebx,%ebx
  sub    %r14d,%r13d
  lea    0x1(%r14,%rax,1),%rcx
  mov    %r13d,0xc(%rsp)
  lea    D9(%rip),%r13
  nopl   0x0(%rax,%rax,1)
L95:
  movzbl (%r14),%edx
  test   %ebx,%ebx
  jg     L54
  jmp    L44
  nopw   0x0(%rax,%rax,1)
L11:
  mov    -0x4(%r12,%rax,4),%ebx
  test   %ebx,%ebx
  jle    L44
L54:
  movslq %ebx,%rax
  cmp    %dl,0x0(%rbp,%rax,1)
  jne    L11
L15:
  add    $0x1,%ebx
  cmp    %r15d,%ebx
  je     L75
L69:
  add    $0x1,%r14
  cmp    %r14,%rcx
  jne    L95
L9:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L44:
  movslq %ebx,%rax
  cmp    %dl,0x0(%rbp,%rax,1)
  je     L15
  cmp    %r15d,%ebx
  jne    L69
L75:
  mov    0xc(%rsp),%esi
  mov    %r13,%rdi
  mov    %rcx,(%rsp)
  sub    %ebx,%esi
  add    %r14d,%esi
  call   <printf@plt>
  mov    (%rsp),%rcx
  jmp    L69
```

tool_calls: name: retrieve_data
arguments: label: D9
type: string

tool: D9: Pattern occurs with shift:%d


assistant: ```c
int kmp(const char T[], const char P[], int next[]) {
  int n, m;
  int i, q;
  n = strlen(T);
  m = strlen(P);
  makeNext(P, next);
  for (i = 0, q = 0; i < n; ++i) {
    while (q > 0 && P[q] != T[i])
      q = next[q - 1];
    if (P[q] == T[i]) {
      q++;
    }
    if (q == m) {
      printf("Pattern occurs with shift:%d\n", (i - m + 1));
    }
  }
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<kmp>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  sub    $0x18,%rsp
  call   <strlen@plt>
  mov    %rbp,%rdi
  mov    %eax,%ebx
  call   <strlen@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  mov    %eax,%r15d
  call   <makeNext@plt>
  test   %ebx,%ebx
  jle    L71
  mov    $0x1,%r13d
  lea    -0x1(%rbx),%eax
  xor    %ebx,%ebx
  sub    %r14d,%r13d
  lea    0x1(%r14,%rax,1),%rcx
  mov    %r13d,0xc(%rsp)
  lea    D8(%rip),%r13
  nopl   0x0(%rax,%rax,1)
L23:
  movzbl (%r14),%edx
  test   %ebx,%ebx
  jg     L82
  jmp    L62
  nopw   0x0(%rax,%rax,1)
L38:
  mov    -0x4(%r12,%rax,4),%ebx
  test   %ebx,%ebx
  jle    L62
L82:
  movslq %ebx,%rax
  cmp    %dl,0x0(%rbp,%rax,1)
  jne    L38
L28:
  add    $0x1,%ebx
  cmp    %r15d,%ebx
  je     L76
L11:
  add    $0x1,%r14
  cmp    %r14,%rcx
  jne    L23
L71:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L62:
  movslq %ebx,%rax
  cmp    %dl,0x0(%rbp,%rax,1)
  je     L28
  cmp    %r15d,%ebx
  jne    L11
L76:
  mov    0xc(%rsp),%esi
  mov    %r13,%rdi
  mov    %rcx,(%rsp)
  sub    %ebx,%esi
  add    %r14d,%esi
  call   <printf@plt>
  mov    (%rsp),%rcx
  jmp    L11
```

tool_calls: name: parse_data
arguments: data_label: D8
type_guessed: string

tool: D8: Pattern occurs with shift:%d


assistant: ```c
int kmp(const char T[], const char P[], int next[]) {
  int n, m;
  int i, q;
  n = strlen(T);
  m = strlen(P);
  makeNext(P, next);
  for (i = 0, q = 0; i < n; ++i) {
    while (q > 0 && P[q] != T[i])
      q = next[q - 1];
    if (P[q] == T[i]) {
      q++;
    }
    if (q == m) {
      printf("Pattern occurs with shift:%d\n", (i - m + 1));
    }
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<fb_hSetDate>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %edi,-0x54(%rbp)
  mov    %esi,-0x58(%rbp)
  mov    %edx,-0x5c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x28de80,-0x40(%rbp)
  movl   $0x24ea00,-0x3c(%rbp)
  movl   $0x28de80,-0x38(%rbp)
  movl   $0x278d00,-0x34(%rbp)
  movl   $0x28de80,-0x30(%rbp)
  movl   $0x278d00,-0x2c(%rbp)
  movl   $0x28de80,-0x28(%rbp)
  movl   $0x28de80,-0x24(%rbp)
  movl   $0x278d00,-0x20(%rbp)
  movl   $0x28de80,-0x1c(%rbp)
  movl   $0x278d00,-0x18(%rbp)
  movl   $0x28de80,-0x14(%rbp)
  cmpl   $0x7b1,-0x54(%rbp)
  jg     L50
  mov    $0xffffffff,%eax
  jmp    L28
L50:
  lea    -0x4c(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <gettimeofday@plt>
  mov    -0x4c(%rbp),%eax
  movslq %eax,%rdx
  imul   $0xffffffffc22e4507,%rdx,%rdx
  shr    $0x20,%rdx
  add    %eax,%edx
  sar    $0x10,%edx
  mov    %eax,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%edx
  mov    %edx,-0x44(%rbp)
  mov    -0x44(%rbp),%edx
  imul   $0x15180,%edx,%edx
  sub    %edx,%eax
  mov    %eax,-0x44(%rbp)
  movl   $0x0,-0x4c(%rbp)
  movl   $0x7b2,-0x48(%rbp)
  jmp    L80
L15:
  mov    -0x4c(%rbp),%eax
  add    $0x1e13380,%eax
  mov    %eax,-0x4c(%rbp)
  mov    -0x48(%rbp),%eax
  and    $0x3,%eax
  test   %eax,%eax
  je     L19
  mov    -0x48(%rbp),%eax
  add    $0x18f,%eax
  cmp    $0x31e,%eax
  ja     L67
L19:
  addl   $0x1,-0x5c(%rbp)
L67:
  addl   $0x1,-0x48(%rbp)
L80:
  mov    -0x48(%rbp),%eax
  cmp    -0x54(%rbp),%eax
  jl     L15
  mov    -0x4c(%rbp),%edx
  mov    -0x58(%rbp),%eax
  sub    $0x1,%eax
  cltq
  mov    -0x40(%rbp,%rax,4),%eax
  imul   -0x58(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x4c(%rbp)
  mov    -0x54(%rbp),%eax
  and    $0x3,%eax
  test   %eax,%eax
  je     L75
  mov    -0x54(%rbp),%eax
  add    $0x18f,%eax
  cmp    $0x31e,%eax
  ja     L10
L75:
  addl   $0x1,-0x5c(%rbp)
L10:
  mov    -0x4c(%rbp),%edx
  mov    -0x5c(%rbp),%eax
  imul   $0x15180,%eax,%ecx
  mov    -0x44(%rbp),%eax
  add    %ecx,%eax
  add    %edx,%eax
  mov    %eax,-0x4c(%rbp)
  lea    -0x4c(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <settimeofday@plt>
  test   %rax,%rax
  je     L47
  mov    $0xffffffff,%eax
  jmp    L28
L47:
  mov    $0x0,%eax
L28:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L23
  call   <__stack_chk_fail@plt>
L23:
  leave
  ret
```

assistant: ```c
int fb_hSetDate(int y, int m, int d) {
  const int month_len[12] = {2678400, 2419200, 2678400, 2592000, 2678400, 2592000, 2678400, 2678400, 2592000, 2678400, 2592000, 2678400};
  struct timeval tv;
  time_t secs;
  int i;
  if (y < 1970)
    return -1;
  gettimeofday(&tv, 0);
  secs = tv.tv_sec % 86400;
  tv.tv_sec = 0;
  for (i = 1970; i < y; i++) {
    tv.tv_sec += 31536000;
    if (((i % 4) == 0) || ((i / 400) == 0))
      d++;
  }
  tv.tv_sec += (m * month_len[m - 1]);
  if (((y % 4) == 0) || ((y / 400) == 0))
    d++;
  tv.tv_sec += (d * 86400) + secs;
  if (settimeofday(&tv, 0))
    return -1;
  return 0;
}
```