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

```asm
<editdist>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1b8,%rsp
  mov    %rdi,0x28(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x1a8(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L243
  mov    %rsi,%r12
  test   %rsi,%rsi
  je     L243
  movzbl (%rdi),%ebx
  xor    %r13d,%r13d
  mov    %rdi,%rax
  test   %bl,%bl
  jne    L236
  jmp    L64
  nopl   0x0(%rax)
L119:
  add    $0x1,%rax
  movsbl %bl,%r13d
  add    $0x1,%r12
  movzbl (%rax),%ebx
  test   %bl,%bl
  je     L366
L236:
  movzbl (%r12),%edx
  cmp    %bl,%dl
  je     L119
  mov    %rax,0x28(%rsp)
  mov    %rax,%rcx
  mov    $0x1,%eax
  nopl   (%rax)
L437:
  mov    %eax,%edi
  mov    %rax,%rsi
  add    $0x1,%rax
  cmpb   $0x0,-0x1(%rcx,%rax,1)
  jne    L437
  mov    %rsi,0x58(%rsp)
  mov    %edi,0x20(%rsp)
  test   %dl,%dl
  je     L18
L10:
  mov    $0x1,%ebp
  xchg   %ax,%ax
L55:
  mov    %ebp,%eax
  lea    -0x1(%rbp),%ecx
  add    $0x1,%rbp
  cmpb   $0x0,-0x1(%r12,%rbp,1)
  jne    L55
  mov    0x20(%rsp),%edx
  mov    %eax,0x54(%rsp)
  mov    %ecx,0x50(%rsp)
  test   %edx,%edx
  je     L420
  cmp    $0x2a,%bl
  je     L231
L167:
  lea    0x70(%rsp),%rcx
  cmpl   $0x3b,0x54(%rsp)
  movq   $0x0,0x60(%rsp)
  mov    %rcx,0x30(%rsp)
  jg     L340
L100:
  mov    0x30(%rsp),%r14
  lea    0x0(,%rbp,4),%rax
  mov    %r13b,0x26(%rsp)
  xor    %ebp,%ebp
  mov    %rax,0x68(%rsp)
  mov    %r14,%r15
  movl   $0x0,(%r14)
  add    %rax,%r15
  mov    %r15,0x38(%rsp)
  mov    %r13b,(%r15)
  nopw   0x0(%rax,%rax,1)
L23:
  movsbl (%r12,%rbp,1),%esi
  movsbl %r13b,%edi
  mov    %sil,0x1(%r15,%rbp,1)
  mov    (%r14,%rbp,4),%ebx
  mov    %esi,%r13d
  call   <insertOrDeleteCost@plt>
  add    %eax,%ebx
  mov    %ebx,0x4(%r14,%rbp,4)
  add    $0x1,%rbp
  cmp    %ebp,0x50(%rsp)
  jge    L23
  lea    0x1(%r12),%rax
  mov    %r12,0x48(%rsp)
  movq   $0x1,0x18(%rsp)
  mov    %rax,0x40(%rsp)
  nopl   0x0(%rax,%rax,1)
L408:
  mov    0x28(%rsp),%rax
  mov    0x18(%rsp),%rbx
  mov    0x20(%rsp),%ebp
  movsbl 0x26(%rsp),%edi
  movzbl -0x1(%rax,%rbx,1),%ecx
  cmp    $0x2a,%cl
  mov    %cl,0x26(%rsp)
  sete   0x27(%rsp)
  cmp    %ebx,%ebp
  movzbl 0x27(%rsp),%esi
  sete   %al
  and    %sil,%al
  jne    L73
  mov    0x30(%rsp),%r15
  movsbl %cl,%r12d
  mov    %r12d,%esi
  mov    (%r15),%r14d
  call   <insertOrDeleteCost@plt>
  add    %r14d,%eax
  mov    %eax,(%r15)
  cmp    %ebx,%ebp
  je     L83
  mov    0x38(%rsp),%rax
  mov    0x48(%rsp),%r13
  add    $0x4,%r15
  mov    %r14d,%ebx
  lea    0x1(%rax),%rbp
  mov    0x50(%rsp),%eax
  add    0x40(%rsp),%rax
  mov    %rax,0x10(%rsp)
  nopl   0x0(%rax)
L228:
  movsbl 0x0(%r13),%edx
  movsbl -0x1(%rbp),%edi
  mov    %edx,%esi
  mov    %dl,0x25(%rsp)
  mov    %edx,0xc(%rsp)
  call   <insertOrDeleteCost@plt>
  movsbl 0x0(%rbp),%edi
  mov    %r12d,%esi
  mov    %eax,0x8(%rsp)
  call   <insertOrDeleteCost@plt>
  mov    0xc(%rsp),%edx
  movsbl -0x1(%rbp),%edi
  mov    %r12d,%esi
  mov    %eax,%r14d
  call   <substituteCost@plt>
  mov    %ebx,%edx
  mov    (%r15),%ebx
  mov    0x8(%rsp),%r10d
  add    -0x4(%r15),%r10d
  movzbl 0x25(%rsp),%r8d
  add    %ebx,%r14d
  cmp    %r10d,%r14d
  jge    L105
  movzbl 0x26(%rsp),%r8d
  mov    %r14d,%r10d
L105:
  add    %edx,%eax
  cmp    %r10d,%eax
  cmovg  %r10d,%eax
  add    $0x1,%r13
  add    $0x1,%rbp
  add    $0x4,%r15
  mov    %eax,-0x4(%r15)
  mov    %r8b,-0x1(%rbp)
  cmp    0x10(%rsp),%r13
  jne    L228
L175:
  addq   $0x1,0x18(%rsp)
  mov    0x18(%rsp),%rax
  cmp    %eax,0x20(%rsp)
  jge    L408
L144:
  mov    0x20(%rsp),%esi
  cmp    %esi,0x54(%rsp)
  jle    L449
  cmpb   $0x0,0x27(%rsp)
  je     L449
  mov    0x30(%rsp),%rdi
  mov    0x58(%rsp),%rax
  lea    0x1(%rsi),%ecx
  mov    0x50(%rsp),%ebx
  mov    (%rdi,%rax,4),%eax
  cmp    %ebx,%esi
  jg     L454
  mov    %ebx,%edx
  sub    %esi,%edx
  lea    0x1(%rdx),%esi
  cmp    $0x2,%edx
  jbe    L16
  mov    %esi,%edx
  movd   %eax,%xmm4
  movslq %ecx,%rax
  shr    $0x2,%edx
  lea    (%rdi,%rax,4),%rax
  pshufd $0x0,%xmm4,%xmm0
  shl    $0x4,%rdx
  add    %rax,%rdx
  cs nopw 0x0(%rax,%rax,1)
L436:
  movdqu (%rax),%xmm1
  movdqu (%rax),%xmm3
  add    $0x10,%rax
  pcmpgtd %xmm0,%xmm1
  pand   %xmm1,%xmm0
  pandn  %xmm3,%xmm1
  por    %xmm1,%xmm0
  cmp    %rax,%rdx
  jne    L436
  movdqa %xmm0,%xmm2
  mov    %esi,%eax
  psrldq $0x8,%xmm2
  and    $0xfffffffc,%eax
  movdqa %xmm2,%xmm1
  add    %eax,%ecx
  pcmpgtd %xmm0,%xmm1
  pand   %xmm1,%xmm0
  pandn  %xmm2,%xmm1
  por    %xmm1,%xmm0
  movdqa %xmm0,%xmm2
  psrldq $0x4,%xmm2
  movdqa %xmm2,%xmm1
  pcmpgtd %xmm0,%xmm1
  pand   %xmm1,%xmm0
  pandn  %xmm2,%xmm1
  por    %xmm0,%xmm1
  movd   %xmm1,0x20(%rsp)
  cmp    %esi,%eax
  je     L109
L407:
  mov    0x30(%rsp),%rbx
  movslq %ecx,%rax
  mov    0x20(%rsp),%esi
  lea    0x0(,%rax,4),%rdx
  mov    0x50(%rsp),%edi
  mov    (%rbx,%rax,4),%eax
  cmp    %eax,%esi
  cmovle %esi,%eax
  mov    %eax,0x20(%rsp)
  mov    %eax,%esi
  cmp    %edi,%ecx
  jg     L109
  mov    0x4(%rbx,%rdx,1),%eax
  cmp    %eax,%esi
  cmovle %esi,%eax
  mov    %eax,0x20(%rsp)
  mov    %eax,%esi
  cmp    %edi,%ecx
  jge    L109
  mov    0x8(%rbx,%rdx,1),%eax
  cmp    %eax,%esi
  cmovle %esi,%eax
  mov    %eax,0x20(%rsp)
L109:
  mov    0x60(%rsp),%rdi
  call   <sqlite3_free@plt>
L423:
  mov    0x1a8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L61
  mov    0x20(%rsp),%eax
  add    $0x1b8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L83:
  mov    0x38(%rsp),%rax
  mov    0x48(%rsp),%r9
  lea    0x1(%rax),%rbp
  mov    0x30(%rsp),%rax
  mov    %r9,%r13
  lea    0x4(%rax),%r15
  mov    0x50(%rsp),%eax
  add    0x40(%rsp),%rax
  mov    %rax,0x10(%rsp)
  nopl   0x0(%rax,%rax,1)
L9:
  movsbl 0x0(%r13),%edx
  movsbl -0x1(%rbp),%edi
  mov    %edx,%esi
  mov    %dl,0x25(%rsp)
  mov    %edx,0xc(%rsp)
  call   <insertOrDeleteCost@plt>
  movsbl 0x0(%rbp),%edi
  mov    %r12d,%esi
  mov    %eax,%ebx
  call   <insertOrDeleteCost@plt>
  mov    0xc(%rsp),%edx
  movsbl -0x1(%rbp),%edi
  mov    %r12d,%esi
  mov    %eax,0x8(%rsp)
  call   <substituteCost@plt>
  test   %ebx,%ebx
  mov    %r14d,%esi
  mov    (%r15),%r14d
  mov    %eax,%edx
  lea    0x3(%rbx),%eax
  movzbl 0x25(%rsp),%ecx
  cmovns %ebx,%eax
  mov    0x8(%rsp),%ebx
  sar    $0x2,%eax
  add    %r14d,%ebx
  add    -0x4(%r15),%eax
  cmp    %eax,%ebx
  jge    L418
  movzbl 0x26(%rsp),%ecx
  mov    %ebx,%eax
L418:
  add    %esi,%edx
  cmp    %eax,%edx
  cmovg  %eax,%edx
  add    $0x1,%r13
  add    $0x1,%rbp
  add    $0x4,%r15
  mov    %edx,-0x4(%r15)
  mov    %cl,-0x1(%rbp)
  cmp    0x10(%rsp),%r13
  jne    L9
  jmp    L175
  nopw   0x0(%rax,%rax,1)
L366:
  mov    %rax,0x28(%rsp)
L64:
  cmpb   $0x0,(%r12)
  movl   $0x0,0x20(%rsp)
  je     L423
  movq   $0x0,0x58(%rsp)
  xor    %ebx,%ebx
  jmp    L10
L420:
  movzbl (%r12),%ebx
  test   %bl,%bl
  je     L423
  mov    0x20(%rsp),%ebp
  add    $0x1,%r12
  movsbl %r13b,%edi
  nopl   0x0(%rax)
L331:
  movsbl %bl,%esi
  call   <insertOrDeleteCost@plt>
  movsbl %bl,%edi
  mov    %eax,%edx
  lea    0x3(%rax),%eax
  test   %edx,%edx
  cmovns %edx,%eax
  movzbl (%r12),%ebx
  add    $0x1,%r12
  sar    $0x2,%eax
  add    %eax,%ebp
  test   %bl,%bl
  jne    L331
  mov    %ebp,0x20(%rsp)
  jmp    L423
L449:
  mov    0x30(%rsp),%rax
  mov    0x68(%rsp),%rcx
  mov    -0x4(%rax,%rcx,1),%eax
  mov    %eax,0x20(%rsp)
  jmp    L109
L18:
  mov    0x28(%rsp),%r14
  xor    %ebp,%ebp
  movsbl %r13b,%edi
  add    $0x1,%r14
  cs nopw 0x0(%rax,%rax,1)
L391:
  movsbl %bl,%esi
  add    $0x1,%r14
  call   <insertOrDeleteCost@plt>
  movsbl %bl,%edi
  movzbl -0x1(%r14),%ebx
  add    %eax,%ebp
  test   %bl,%bl
  jne    L391
  mov    %ebp,0x20(%rsp)
  jmp    L423
L73:
  mov    %al,0x27(%rsp)
  jmp    L144
L231:
  mov    0x28(%rsp),%rcx
  cmpb   $0x0,0x1(%rcx)
  jne    L167
  movl   $0x0,0x20(%rsp)
  jmp    L423
L340:
  lea    0x5(%rax,%rax,4),%edi
  call   <sqlite3_malloc@plt>
  mov    %rax,0x30(%rsp)
  test   %rax,%rax
  je     L251
  mov    %rax,0x60(%rsp)
  jmp    L100
L454:
  mov    %eax,0x20(%rsp)
  jmp    L109
L16:
  mov    %eax,0x20(%rsp)
  jmp    L407
L243:
  movl   $0xffffffff,0x20(%rsp)
  jmp    L423
L61:
  call   <__stack_chk_fail@plt>
L251:
  movl   $0xfffffffd,0x20(%rsp)
  jmp    L423
```

assistant: ```c
int editdist(const char *zA, const char *zB) {
  int nA, nB;
  int xA, xB;
  char cA, cB;
  char cAprev, cBprev;
  int d;
  int dc = 0;
  int res;
  int *m;
  char *cx;
  int *toFree = 0;
  int mStack[60 + 15];
  if (zA == 0 || zB == 0)
    return -1;
  while (zA[0] && zA[0] == zB[0]) {
    dc = zA[0];
    zA++;
    zB++;
  }
  if (zA[0] == 0 && zB[0] == 0)
    return 0;
  for (nA = 0; zA[nA]; nA++) {
    if (zA[nA] > 127)
      return -2;
  }
  for (nB = 0; zB[nB]; nB++) {
    if (zB[nB] > 127)
      return -2;
  }
  if (nA == 0) {
    cBprev = dc;
    for (xB = res = 0; (cB = zB[xB]) != 0; xB++) {
      res += insertOrDeleteCost(cBprev, cB) / 4;
      cBprev = cB;
    }
    return res;
  }
  if (nB == 0) {
    cAprev = dc;
    for (xA = res = 0; (cA = zA[xA]) != 0; xA++) {
      res += insertOrDeleteCost(cAprev, cA);
      cAprev = cA;
    }
    return res;
  }
  if (zA[0] == '*' && zA[1] == 0)
    return 0;
  if (nB < (sizeof(mStack) * 4) / (sizeof(mStack[0]) * 5)) {
    m = mStack;
  } else {
    m = toFree = sqlite3_malloc((nB + 1) * 5 * sizeof(m[0]) / 4);
    if (m == 0)
      return -3;
  }
  cx = (char *)&m[nB + 1];
  m[0] = 0;
  cx[0] = dc;
  cBprev = dc;
  for (xB = 1; xB <= nB; xB++) {
    cB = zB[xB - 1];
    cx[xB] = cB;
    m[xB] = m[xB - 1] + insertOrDeleteCost(cBprev, cB);
    cBprev = cB;
  }
  cAprev = dc;
  for (xA = 1; xA <= nA; xA++) {
    int lastA = (xA == nA);
    cA = zA[xA - 1];
    if (cA == '*' && lastA)
      break;
    d = m[0];
    dc = cx[0];
    m[0] = d + insertOrDeleteCost(cAprev, cA);
    cBprev = 0;
    for (xB = 1; xB <= nB; xB++) {
      int totalCost, insCost, delCost, subCost, ncx;
      cB = zB[xB - 1];
      insCost = insertOrDeleteCost(cx[xB - 1], cB);
      if (lastA)
        insCost /= 4;
      delCost = insertOrDeleteCost(cx[xB], cA);
      subCost = substituteCost(cx[xB - 1], cA, cB);
      totalCost = insCost + m[xB - 1];
      ncx = cB;
      if ((delCost + m[xB]) < totalCost) {
        totalCost = delCost + m[xB];
        ncx = cA;
      }
      if ((subCost + d) < totalCost) {
        totalCost = subCost + d;
      }
      d = m[xB];
      dc = cx[xB];
      m[xB] = totalCost;
      cx[xB] = ncx;
      cBprev = cB;
    }
    cAprev = cA;
  }
  if (cA == '*' && nB > nA) {
    res = m[nA];
    for (xB = nA + 1; xB <= nB; xB++) {
      if (m[xB] < res)
        res = m[xB];
    }
  } else {
    res = m[nB];
  }
  sqlite3_free(toFree);
  return res;
}
```