user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<editdist>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x198,%rsp
  mov    %rsi,0x20(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x188(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L76
  mov    %rdi,%rbx
  test   %rsi,%rsi
  je     L76
  movzbl (%rdi),%eax
  mov    $0x0,%ebp
  mov    0x20(%rsp),%rdx
  test   %al,%al
  je     L124
L23:
  cmp    %al,(%rdx)
  jne    L541
  movsbl %al,%ebp
  add    $0x1,%rbx
  add    $0x1,%rdx
  movzbl (%rbx),%eax
  test   %al,%al
  jne    L23
  mov    %rdx,0x20(%rsp)
L124:
  movl   $0x0,0x1c(%rsp)
  mov    0x20(%rsp),%rax
  cmpb   $0x0,(%rax)
  je     L382
  mov    $0x0,%eax
  jmp    L81
L541:
  mov    %rdx,0x20(%rsp)
  test   %al,%al
  je     L124
L81:
  movzbl (%rbx),%r14d
  mov    $0x1,%edx
  test   %r14b,%r14b
  je     L254
L155:
  mov    %edx,%esi
  mov    %rdx,%rcx
  add    $0x1,%rdx
  cmpb   $0x0,-0x1(%rbx,%rdx,1)
  jne    L155
  mov    %rcx,0x38(%rsp)
  mov    %esi,0x1c(%rsp)
  mov    0x20(%rsp),%rcx
  movzbl (%rcx),%r12d
  test   %r12b,%r12b
  je     L287
L437:
  mov    $0x1,%edx
  mov    0x20(%rsp),%rcx
L158:
  mov    %edx,%esi
  mov    %rdx,%r13
  add    $0x1,%rdx
  cmpb   $0x0,-0x1(%rcx,%rdx,1)
  jne    L158
  mov    %esi,0x28(%rsp)
  cmpl   $0x0,0x1c(%rsp)
  je     L405
  cmpl   $0x0,0x28(%rsp)
  je     L322
  cmp    $0x2a,%al
  je     L144
L175:
  movq   $0x0,0x40(%rsp)
  lea    0x50(%rsp),%r15
  cmp    $0x3b,%r13d
  ja     L456
L34:
  lea    0x4(,%r13,4),%rax
  mov    %rax,0x48(%rsp)
  lea    (%r15,%rax,1),%r13
  movl   $0x0,(%r15)
  mov    %bpl,0xc(%rsp)
  mov    %bpl,0x0(%r13)
  cmpl   $0x0,0x28(%rsp)
  jle    L137
  mov    $0x1,%r12d
  mov    %rbx,0x10(%rsp)
  mov    0x20(%rsp),%r14
L325:
  mov    %ebp,%edi
  movzbl -0x1(%r14,%r12,1),%ebp
  mov    %bpl,0x0(%r13,%r12,1)
  mov    -0x4(%r15,%r12,4),%ebx
  movsbl %bpl,%esi
  movsbl %dil,%edi
  call   <insertOrDeleteCost@plt>
  add    %eax,%ebx
  mov    %ebx,(%r15,%r12,4)
  add    $0x1,%r12
  cmp    %r12d,0x28(%rsp)
  jge    L325
  mov    0x10(%rsp),%rbx
L137:
  mov    0x1c(%rsp),%eax
  test   %eax,%eax
  jle    L528
  movzbl (%rbx),%ecx
  mov    %cl,0x2f(%rsp)
  cmp    $0x1,%eax
  jne    L253
  cmp    $0x2a,%cl
  je     L489
L253:
  lea    0x1(%rbx),%rax
  mov    %rax,0x30(%rsp)
  movl   $0x1,0x18(%rsp)
  movzbl 0xc(%rsp),%edi
  jmp    L282
L144:
  cmpb   $0x0,0x1(%rbx)
  jne    L175
  movl   $0x0,0x1c(%rsp)
  jmp    L382
L456:
  mov    0x28(%rsp),%eax
  lea    0x5(%rax,%rax,4),%edi
  call   <sqlite3_malloc@plt>
  mov    %rax,%r15
  test   %rax,%rax
  je     L219
  mov    %rax,0x40(%rsp)
  jmp    L34
L334:
  lea    0x3(%rax),%eax
  test   %ebp,%ebp
  cmovns %ebp,%eax
  sar    $0x2,%eax
  mov    %eax,%ebp
  jmp    L244
L293:
  add    0x10(%rsp),%eax
  cmp    %ebp,%eax
  cmovg  %ebp,%eax
  mov    %eax,(%r15,%rbx,4)
  mov    %r14b,0x0(%r13,%rbx,1)
  add    $0x1,%rbx
  cmp    %ebx,0x28(%rsp)
  jl     L350
  mov    %edx,0x10(%rsp)
L533:
  mov    0x20(%rsp),%rax
  movsbl -0x1(%rax,%rbx,1),%r14d
  movsbl -0x1(%r13,%rbx,1),%edi
  mov    %r14d,%esi
  call   <insertOrDeleteCost@plt>
  mov    %eax,%ebp
  mov    0x18(%rsp),%ecx
  cmp    %ecx,0x1c(%rsp)
  je     L334
L244:
  movsbl 0x0(%r13,%rbx,1),%edi
  mov    0xc(%rsp),%esi
  call   <insertOrDeleteCost@plt>
  mov    %eax,%r12d
  movsbl -0x1(%r13,%rbx,1),%edi
  mov    %r14d,%edx
  mov    0xc(%rsp),%esi
  call   <substituteCost@plt>
  add    -0x4(%r15,%rbx,4),%ebp
  mov    (%r15,%rbx,4),%edx
  add    %edx,%r12d
  cmp    %ebp,%r12d
  jge    L293
  mov    0xc(%rsp),%r14d
  mov    %r12d,%ebp
  jmp    L293
L350:
  addl   $0x1,0x18(%rsp)
  mov    0x18(%rsp),%eax
  cmp    0x1c(%rsp),%eax
  jg     L528
  mov    0x30(%rsp),%rcx
  movzbl (%rcx),%eax
  add    $0x1,%rcx
  mov    %rcx,0x30(%rsp)
  movzbl 0x2f(%rsp),%edi
  mov    0x1c(%rsp),%esi
  cmp    %esi,0x18(%rsp)
  jne    L22
  cmp    $0x2a,%al
  je     L65
L22:
  mov    %al,0x2f(%rsp)
L282:
  mov    (%r15),%ebx
  mov    %ebx,0x10(%rsp)
  movsbl 0x2f(%rsp),%esi
  mov    %esi,0xc(%rsp)
  movsbl %dil,%edi
  call   <insertOrDeleteCost@plt>
  add    %ebx,%eax
  mov    %eax,(%r15)
  cmpl   $0x0,0x28(%rsp)
  jle    L350
  mov    $0x1,%ebx
  jmp    L533
L489:
  movb   $0x2a,0x2f(%rsp)
  jmp    L528
L65:
  movb   $0x2a,0x2f(%rsp)
L528:
  cmpb   $0x2a,0x2f(%rsp)
  jne    L508
  mov    0x28(%rsp),%ecx
  mov    0x1c(%rsp),%eax
  cmp    %eax,%ecx
  jle    L508
  mov    0x38(%rsp),%rsi
  mov    (%r15,%rsi,4),%edx
  add    $0x1,%eax
  cmp    %ecx,%eax
  jg     L481
  cltq
  mov    %ecx,%esi
L545:
  mov    (%r15,%rax,4),%ecx
  cmp    %ecx,%edx
  cmovg  %ecx,%edx
  add    $0x1,%rax
  cmp    %eax,%esi
  jge    L545
  mov    %edx,0x1c(%rsp)
  jmp    L433
L508:
  mov    0x48(%rsp),%rax
  mov    -0x4(%r15,%rax,1),%eax
  mov    %eax,0x1c(%rsp)
L433:
  mov    0x40(%rsp),%rdi
  call   <sqlite3_free@plt>
L382:
  mov    0x188(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L363
  mov    0x1c(%rsp),%eax
  add    $0x198,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L481:
  mov    %edx,0x1c(%rsp)
  jmp    L433
L76:
  movl   $0xffffffff,0x1c(%rsp)
  jmp    L382
L523:
  movl   $0x0,0x1c(%rsp)
  jmp    L382
L219:
  movl   $0xfffffffd,0x1c(%rsp)
  jmp    L382
L405:
  mov    0x20(%rsp),%r15
  add    $0x1,%r15
  mov    %ebp,%edi
  mov    0x1c(%rsp),%ebx
L199:
  movsbl %r12b,%esi
  movsbl %dil,%edi
  call   <insertOrDeleteCost@plt>
  mov    %eax,%edx
  lea    0x3(%rax),%eax
  test   %edx,%edx
  cmovns %edx,%eax
  sar    $0x2,%eax
  add    %eax,%ebx
  add    $0x1,%r15
  mov    %r12d,%edi
  movzbl -0x1(%r15),%r12d
  test   %r12b,%r12b
  jne    L199
  mov    %ebx,0x1c(%rsp)
  jmp    L382
L287:
  cmpl   $0x0,0x1c(%rsp)
  je     L382
L322:
  test   %r14b,%r14b
  je     L523
  add    $0x1,%rbx
  mov    $0x0,%eax
  mov    %ebp,%edi
  mov    %eax,%ebp
L236:
  movsbl %r14b,%esi
  movsbl %dil,%edi
  call   <insertOrDeleteCost@plt>
  add    %eax,%ebp
  add    $0x1,%rbx
  mov    %r14d,%edi
  movzbl -0x1(%rbx),%r14d
  test   %r14b,%r14b
  jne    L236
  mov    %ebp,0x1c(%rsp)
  jmp    L382
L254:
  mov    0x20(%rsp),%rcx
  movzbl (%rcx),%r12d
  movl   $0x0,0x1c(%rsp)
  movq   $0x0,0x38(%rsp)
  test   %r12b,%r12b
  jne    L437
  jmp    L382
L363:
  call   <__stack_chk_fail@plt>
```

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;
}
```