user: 请从给定的汇编指令推导出C源代码:

```asm
<getGrams>:
  endbr64
  push   %r15
  mov    %r9d,%r15d
  push   %r14
  mov    %edx,%r14d
  push   %r13
  mov    %rdi,%r13
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %r8d,%ebx
  sub    $0x18,%rsp
  call   <strlen@plt>
  mov    %eax,%ecx
  test   %ebx,%ebx
  je     L38
  mov    %eax,%r8d
  sub    %r12d,%r8d
L341:
  xor    %eax,%eax
  cmp    %r14d,%r8d
  jl     L61
  mov    $0xffffffff,%eax
  cmp    %r12d,%ecx
  jle    L61
  lea    0x4(%r12,%r12,1),%edx
  test   %edx,%edx
  jle    L65
  movslq %edx,%rdx
  xor    %esi,%esi
  mov    %rbp,%rdi
  mov    %r8d,0xc(%rsp)
  call   <memset@plt>
  mov    0xc(%rsp),%r8d
L65:
  test   %ebx,%ebx
  je     L478
  test   %r12d,%r12d
  jle    L277
  movslq %r14d,%rdx
  mov    %rbp,%rcx
  lea    -0x1(%r12),%eax
  mov    %r12d,%esi
  lea    0x1(%r13,%rdx,1),%rdi
  sub    %rdi,%rcx
  cmp    $0xe,%rcx
  jbe    L7
  cmp    $0x6,%eax
  jbe    L7
  cmp    $0xe,%eax
  jbe    L139
  mov    %r12d,%ecx
  add    %r13,%rdx
  xor    %eax,%eax
  shr    $0x4,%ecx
  shl    $0x4,%rcx
  nopl   0x0(%rax)
L282:
  movdqu (%rdx,%rax,1),%xmm0
  movups %xmm0,0x0(%rbp,%rax,1)
  add    $0x10,%rax
  cmp    %rcx,%rax
  jne    L282
  mov    %r12d,%ecx
  and    $0xfffffff0,%ecx
  mov    %ecx,%eax
  cmp    %r12d,%ecx
  je     L277
  mov    %r12d,%esi
  sub    %ecx,%esi
  lea    -0x1(%rsi),%edi
  cmp    $0x6,%edi
  jbe    L312
L125:
  mov    (%rdx,%rcx,1),%rdx
  mov    %rdx,0x0(%rbp,%rcx,1)
  mov    %esi,%edx
  and    $0xfffffff8,%edx
  add    %edx,%eax
  cmp    %edx,%esi
  je     L277
L312:
  lea    (%r14,%rax,1),%edx
  movslq %edx,%rdx
  movzbl 0x0(%r13,%rdx,1),%ecx
  movslq %eax,%rdx
  mov    %cl,0x0(%rbp,%rdx,1)
  lea    0x1(%rax),%edx
  cmp    %edx,%r12d
  jle    L277
  lea    (%r14,%rdx,1),%ecx
  movslq %edx,%rdx
  movslq %ecx,%rcx
  movzbl 0x0(%r13,%rcx,1),%ecx
  mov    %cl,0x0(%rbp,%rdx,1)
  lea    0x2(%rax),%edx
  cmp    %r12d,%edx
  jge    L277
  lea    (%rdx,%r14,1),%ecx
  movslq %edx,%rdx
  movslq %ecx,%rcx
  movzbl 0x0(%r13,%rcx,1),%ecx
  mov    %cl,0x0(%rbp,%rdx,1)
  lea    0x3(%rax),%edx
  cmp    %edx,%r12d
  jle    L277
  lea    (%r14,%rdx,1),%ecx
  movslq %edx,%rdx
  movslq %ecx,%rcx
  movzbl 0x0(%r13,%rcx,1),%ecx
  mov    %cl,0x0(%rbp,%rdx,1)
  lea    0x4(%rax),%edx
  cmp    %edx,%r12d
  jle    L277
  lea    (%r14,%rdx,1),%ecx
  movslq %edx,%rdx
  movslq %ecx,%rcx
  movzbl 0x0(%r13,%rcx,1),%ecx
  mov    %cl,0x0(%rbp,%rdx,1)
  lea    0x5(%rax),%edx
  cmp    %edx,%r12d
  jle    L277
  lea    (%r14,%rdx,1),%ecx
  add    $0x6,%eax
  movslq %edx,%rdx
  movslq %ecx,%rcx
  movzbl 0x0(%r13,%rcx,1),%ecx
  mov    %cl,0x0(%rbp,%rdx,1)
  cmp    %eax,%r12d
  jle    L277
  lea    (%r14,%rax,1),%edx
  cltq
  movslq %edx,%rdx
  movzbl 0x0(%r13,%rdx,1),%edx
  mov    %dl,0x0(%rbp,%rax,1)
L277:
  movslq %r12d,%rax
  movb   $0x0,0x0(%rbp,%rax,1)
  test   %r15d,%r15d
  jg     L116
L302:
  mov    $0x1,%eax
L61:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L38:
  cltd
  idiv   %r12d
  lea    -0x1(%rax),%r8d
  jmp    L341
  nopl   (%rax)
L478:
  mov    %r12d,%edx
  imul   %r14d,%edx
  cmp    %r14d,%r8d
  je     L462
  test   %r12d,%r12d
  jle    L51
  movslq %edx,%rcx
  mov    %rbp,%rdi
  lea    -0x1(%r12),%eax
  mov    %r12d,%esi
  lea    0x1(%r13,%rcx,1),%r8
  sub    %r8,%rdi
  cmp    $0xe,%rdi
  jbe    L95
  cmp    $0x6,%eax
  jbe    L95
  cmp    $0xe,%eax
  jbe    L435
  shr    $0x4,%esi
  add    %r13,%rcx
  xor    %eax,%eax
  shl    $0x4,%rsi
  nopw   0x0(%rax,%rax,1)
L144:
  movdqu (%rcx,%rax,1),%xmm1
  movups %xmm1,0x0(%rbp,%rax,1)
  add    $0x10,%rax
  cmp    %rsi,%rax
  jne    L144
  mov    %r12d,%eax
  and    $0xfffffff0,%eax
  mov    %eax,%ebx
  cmp    %eax,%r12d
  je     L51
  mov    %r12d,%esi
  sub    %eax,%esi
  lea    -0x1(%rsi),%edi
  cmp    $0x6,%edi
  jbe    L399
L117:
  mov    (%rcx,%rax,1),%rcx
  mov    %rcx,0x0(%rbp,%rax,1)
  mov    %esi,%eax
  and    $0xfffffff8,%eax
  add    %eax,%ebx
  cmp    %eax,%esi
  je     L51
L399:
  lea    (%rdx,%rbx,1),%eax
  cltq
  movzbl 0x0(%r13,%rax,1),%ecx
  movslq %ebx,%rax
  mov    %cl,0x0(%rbp,%rax,1)
  lea    0x1(%rbx),%eax
  cmp    %eax,%r12d
  jle    L51
  lea    (%rdx,%rax,1),%ecx
  cltq
  movslq %ecx,%rcx
  movzbl 0x0(%r13,%rcx,1),%ecx
  mov    %cl,0x0(%rbp,%rax,1)
  lea    0x2(%rbx),%eax
  cmp    %eax,%r12d
  jle    L51
  lea    (%rdx,%rax,1),%ecx
  cltq
  movslq %ecx,%rcx
  movzbl 0x0(%r13,%rcx,1),%ecx
  mov    %cl,0x0(%rbp,%rax,1)
  lea    0x3(%rbx),%eax
  cmp    %eax,%r12d
  jle    L51
  lea    (%rdx,%rax,1),%ecx
  cltq
  movslq %ecx,%rcx
  movzbl 0x0(%r13,%rcx,1),%ecx
  mov    %cl,0x0(%rbp,%rax,1)
  lea    0x4(%rbx),%eax
  cmp    %eax,%r12d
  jle    L51
  lea    (%rdx,%rax,1),%ecx
  cltq
  movslq %ecx,%rcx
  movzbl 0x0(%r13,%rcx,1),%ecx
  mov    %cl,0x0(%rbp,%rax,1)
  lea    0x5(%rbx),%eax
  cmp    %eax,%r12d
  jle    L51
  lea    (%rdx,%rax,1),%ecx
  add    $0x6,%ebx
  cltq
  movslq %ecx,%rcx
  movzbl 0x0(%r13,%rcx,1),%ecx
  mov    %cl,0x0(%rbp,%rax,1)
  cmp    %ebx,%r12d
  jle    L51
  lea    (%rdx,%rbx,1),%eax
  movslq %ebx,%rbx
  cltq
  movzbl 0x0(%r13,%rax,1),%eax
  mov    %al,0x0(%rbp,%rbx,1)
L51:
  movslq %r12d,%rax
  movb   $0x0,0x0(%rbp,%rax,1)
  jmp    L26
  nopl   (%rax)
L116:
  sub    $0x8,%rsp
  mov    %ebx,%r9d
  mov    0x58(%rsp),%eax
  push   %rax
L351:
  mov    %r12d,%edx
  mov    %r15d,%r8d
  mov    %r14d,%ecx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <addGramPosition@plt>
  pop    %rax
  mov    $0x1,%eax
  pop    %rdx
  jmp    L61
  nopl   0x0(%rax)
L462:
  movslq %edx,%rdx
  lea    0x0(%r13,%rdx,1),%rsi
  movzbl (%rsi),%edx
  test   %dl,%dl
  je     L219
  mov    $0x1,%eax
L115:
  mov    %dl,-0x1(%rbp,%rax,1)
  movslq %eax,%rcx
  add    $0x1,%rax
  movzbl -0x1(%rsi,%rax,1),%edx
  test   %dl,%dl
  jne    L115
  add    %rbp,%rcx
L481:
  movb   $0x0,(%rcx)
L26:
  test   %r15d,%r15d
  jle    L302
  sub    $0x8,%rsp
  xor    %r9d,%r9d
  mov    0x58(%rsp),%eax
  push   %rax
  jmp    L351
L7:
  mov    %r12d,%esi
  xor    %eax,%eax
  add    %r13,%rdx
  nopl   0x0(%rax)
L189:
  movzbl (%rdx,%rax,1),%ecx
  mov    %cl,0x0(%rbp,%rax,1)
  add    $0x1,%rax
  cmp    %rsi,%rax
  jne    L189
  jmp    L277
L95:
  mov    %r12d,%esi
  xor    %eax,%eax
  add    %r13,%rcx
  xchg   %ax,%ax
L63:
  movzbl (%rcx,%rax,1),%edx
  mov    %dl,0x0(%rbp,%rax,1)
  add    $0x1,%rax
  cmp    %rsi,%rax
  jne    L63
  jmp    L51
L139:
  xor    %ecx,%ecx
  xor    %eax,%eax
  add    %r13,%rdx
  jmp    L125
L435:
  xor    %eax,%eax
  add    %r13,%rcx
  jmp    L117
L219:
  mov    %rbp,%rcx
  jmp    L481
```

assistant: ```c
int getGrams(char *word, char *gram, int index, int size, int overlap, int position, int hashbang) {
  int lenWord = strlen(word);
  int lastIndex;
  if (overlap)
    lastIndex = lenWord - size;
  else
    lastIndex = lenWord / size - 1;
  if (index > lastIndex)
    return 0;
  if (lenWord <= size) {
    return -1;
  }
  int start, i;
  for (i = 0; i < size * 2 + 4; i++)
    gram[i] = 0;
  if (overlap) {
    start = index;
    for (i = 0; i < size; i++) {
      gram[i] = word[start + i];
    }
    gram[size] = '\0';
    if (position > 0)
      addGramPosition(word, gram, size, index, position, overlap, hashbang);
  } else {
    start = index * size;
    i = 0;
    if (index == lastIndex) {
      while (word[start + i] != '\0') {
        gram[i] = word[start + i];
        i++;
      }
      gram[i] = '\0';
    } else {
      for (i = 0; i < size; i++)
        gram[i] = word[start + i];
      gram[size] = '\0';
    }
    if (position > 0)
      addGramPosition(word, gram, size, index, position, overlap, hashbang);
  }
  return 1;
}
```