user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<main>:
  endbr64
  push   %r13
  lea    D18(%rip),%rdi
  xor    %r13d,%r13d
  push   %r12
  push   %rbp
  push   %rbx
  lea    D48(%rip),%rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rdx
  mov    %rsp,%rsi
  call   <scanf@plt>
  mov    0x4(%rsp),%eax
  mov    $0x8,%esi
  lea    0x1(%rax),%edi
  call   <calloc@plt>
  mov    $0x8,%esi
  mov    %rax,%r12
  mov    0x4(%rsp),%eax
  lea    0x1(%rax),%edi
  call   <calloc@plt>
  mov    $0x7f,%esi
  mov    %r12,%rdi
  mov    %rax,%rbp
  mov    0x4(%rsp),%eax
  lea    0x8(,%rax,8),%edx
  call   <memset@plt>
  mov    (%rsp),%eax
  test   %eax,%eax
  jle    L109
  nopw   0x0(%rax,%rax,1)
L94:
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  xor    %eax,%eax
  call   <scanf@plt>
  movslq 0x4(%rsp),%rdi
  mov    0x0(%rbp),%rsi
  mov    %r12,%rax
  shl    $0x3,%rdi
  mov    %rsi,(%r12)
  lea    (%r12,%rdi,1),%r8
  cmp    %r8,%r12
  jb     L83
  jmp    L103
  nopl   0x0(%rax)
L100:
  lea    0x8(%rax),%rcx
  mov    %rsi,0x8(%rax)
  mov    %rdx,(%rax)
  cmp    %r8,%rcx
  jae    L103
  mov    %rcx,%rax
L83:
  mov    0x8(%rax),%rdx
  cmp    %rdx,%rsi
  jl     L100
L103:
  add    %rbp,%rdi
  cmp    %rdi,%rbp
  jae    L8
  mov    0x0(%rbp),%rsi
  mov    %rbp,%rax
  jmp    L0
  nopl   (%rax)
L12:
  lea    0x8(%rax),%rcx
  mov    %rsi,0x8(%rax)
  mov    %rdx,(%rax)
  cmp    %rdi,%rcx
  jae    L8
  mov    %rcx,%rax
L0:
  mov    0x8(%rax),%rdx
  cmp    %rsi,%rdx
  jl     L12
L8:
  add    $0x1,%r13d
  cmp    %r13d,(%rsp)
  jg     L94
L109:
  mov    0x8(%rbp),%r13
  sub    0x8(%r12),%r13
  mov    %r13,%rdi
  call   <isprime@plt>
  lea    D22(%rip),%rsi
  mov    %r13,%rdx
  lea    D37(%rip),%rdi
  test   %rax,%rax
  lea    D45(%rip),%rax
  cmove  %rax,%rsi
  call   <printf@plt>
  mov    %r12,%rdi
  call   <free@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L23
  add    $0x18,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L23:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D18
data_type: string
name: unpack_data
arguments: data_tag: D48
data_type: string
name: unpack_data
arguments: data_tag: D22
data_type: string
name: unpack_data
arguments: data_tag: D37
data_type: string
name: unpack_data
arguments: data_tag: D45
data_type: string

tool: D18: %d %d

tool: D48: %ld

tool: D22: YES

tool: D37: %s
%d


tool: D45: NO

assistant: ```c
int main(void) {
  int n, k;
  scanf("%d %d", &n, &k);
  long *p1, *p2, temp;
  long *min = (long *)calloc(k + 1, sizeof(long));
  long *max = (long *)calloc(k + 1, sizeof(long));
  memset(min, 0x7F, (k + 1) * sizeof(long));
  for (int i = 0; i < n; i++) {
    scanf("%ld", max);
    *(p1 = min) = *(p2 = max);
    while (p1 < min + k && p1[0] < p1[1]) {
      {
        temp = (p1)[1];
        (p1)[1] = *(p1);
        *(p1)++ = temp;
      };
    }
    while (p2 < max + k && p2[0] > p2[1]) {
      {
        temp = (p2)[1];
        (p2)[1] = *(p2);
        *(p2)++ = temp;
      };
    }
  }
  temp = max[1] - min[1];
  printf("%s\n%d\n", isprime(temp) ? "YES" : "NO", temp);
  free(min);
  free(max);
  return 0;
}
```