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

```asm
<levenshtein>:
  endbr64
  push   %r15
  mov    %r8d,%r15d
  push   %r14
  mov    %r9d,%r14d
  push   %r13
  mov    %rsi,%r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x28,%rsp
  mov    %edx,0x14(%rsp)
  mov    %ecx,0x1c(%rsp)
  call   <strlen@plt>
  mov    %r13,%rdi
  mov    %eax,0x18(%rsp)
  call   <strlen@plt>
  lea    0x4(,%rax,4),%ebp
  mov    %eax,(%rsp)
  mov    %ebp,%edi
  call   <malloc@plt>
  mov    %ebp,%edi
  mov    %rax,0x8(%rsp)
  call   <malloc@plt>
  mov    %ebp,%edi
  mov    %rax,%r12
  call   <malloc@plt>
  mov    (%rsp),%ecx
  mov    0x8(%rsp),%r8
  mov    0x18(%rsp),%edx
  mov    0x1c(%rsp),%esi
  mov    %rax,%rbp
  test   %ecx,%ecx
  js     L50
  movslq (%rsp),%rdi
  mov    %r12,%rax
  xor    %ecx,%ecx
  lea    0x4(%r12,%rdi,4),%r9
  nopw   0x0(%rax,%rax,1)
L81:
  mov    %ecx,(%rax)
  add    $0x4,%rax
  add    %r15d,%ecx
  cmp    %r9,%rax
  jne    L81
L13:
  test   %edx,%edx
  jle    L118
  movslq %edx,%rax
  mov    %rbx,%rcx
  mov    %r14d,%r11d
  xor    %r10d,%r10d
  mov    %rax,0x8(%rsp)
  nopw   0x0(%rax,%rax,1)
L64:
  mov    (%rsp),%edx
  test   %r10d,%r10d
  mov    %r11d,0x0(%rbp)
  setg   %r9b
  xor    %eax,%eax
  test   %edx,%edx
  jg     L37
  jmp    L3
  nopl   0x0(%rax)
L16:
  mov    0x4(%r12,%rax,4),%ebx
  add    %r14d,%ebx
  cmp    %edx,%ebx
  cmovle %ebx,%edx
  mov    0x0(%rbp,%rax,4),%ebx
  add    %r15d,%ebx
  cmp    %ebx,%edx
  cmovg  %ebx,%edx
  mov    %edx,0x4(%rbp,%rax,4)
  add    $0x1,%rax
  cmp    %rax,%rdi
  je     L3
L37:
  movzbl 0x0(%r13,%rax,1),%ebx
  xor    %edx,%edx
  cmp    %bl,(%rcx)
  setne  %dl
  imul   %esi,%edx
  add    (%r12,%rax,4),%edx
  mov    %edx,0x4(%rbp,%rax,4)
  test   %eax,%eax
  jle    L16
  test   %r9b,%r9b
  je     L16
  movzbl 0x0(%r13,%rax,1),%ebx
  cmp    %bl,-0x1(%rcx)
  jne    L16
  movzbl -0x1(%r13,%rax,1),%ebx
  cmp    %bl,(%rcx)
  jne    L16
  mov    0x14(%rsp),%ebx
  add    -0x4(%r8,%rax,4),%ebx
  cmp    %ebx,%edx
  jle    L16
  mov    %ebx,0x4(%rbp,%rax,4)
  mov    %ebx,%edx
  jmp    L16
  nopl   0x0(%rax)
L3:
  add    $0x1,%r10
  add    %r14d,%r11d
  add    $0x1,%rcx
  cmp    %r10,0x8(%rsp)
  je     L4
  mov    %r8,%rax
  mov    %r12,%r8
  mov    %rbp,%r12
  mov    %rax,%rbp
  jmp    L64
L118:
  mov    %r12,%rax
  mov    %r8,%r12
  mov    %rbp,%r8
  mov    %rax,%rbp
L4:
  mov    0x0(%rbp,%rdi,4),%r13d
  mov    %r12,%rdi
  mov    %r8,(%rsp)
  call   <free@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  mov    (%rsp),%rdi
  call   <free@plt>
  add    $0x28,%rsp
  mov    %r13d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L50:
  movslq (%rsp),%rdi
  jmp    L13
```

assistant: ```c
int levenshtein(const char *string1, const char *string2, int w, int s, int a, int d) {
  int len1 = strlen(string1), len2 = strlen(string2);
  int *row0 = malloc(sizeof(int) * (len2 + 1));
  int *row1 = malloc(sizeof(int) * (len2 + 1));
  int *row2 = malloc(sizeof(int) * (len2 + 1));
  int i, j;
  for (j = 0; j <= len2; j++) {
    row1[j] = j * a;
  }
  for (i = 0; i < len1; i++) {
    int *dummy;
    row2[0] = (i + 1) * d;
    for (j = 0; j < len2; j++) {
      row2[j + 1] = row1[j] + s * (string1[i] != string2[j]);
      if (i > 0 && j > 0 && string1[i - 1] == string2[j] && string1[i] == string2[j - 1] && row2[j + 1] > row0[j - 1] + w) {
        row2[j + 1] = row0[j - 1] + w;
      }
      if (row2[j + 1] > row1[j + 1] + d) {
        row2[j + 1] = row1[j + 1] + d;
      }
      if (row2[j + 1] > row2[j] + a) {
        row2[j + 1] = row2[j] + a;
      }
    }
    dummy = row0;
    row0 = row1;
    row1 = row2;
    row2 = dummy;
  }
  i = row1[len2];
  free(row0);
  free(row1);
  free(row2);
  return i;
}
```