user: Translate the below assembly code into C programming language:

```asm
<editdist>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x1a8,%rsp
  mov    %rdi,-0x1a8(%rbp)
  mov    %rsi,-0x1b0(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x188(%rbp)
  movq   $0x0,-0x160(%rbp)
  cmpq   $0x0,-0x1a8(%rbp)
  je     L47
  cmpq   $0x0,-0x1b0(%rbp)
  jne    L430
L47:
  mov    $0xffffffff,%eax
  jmp    L62
L43:
  mov    -0x1a8(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,-0x188(%rbp)
  addq   $0x1,-0x1a8(%rbp)
  addq   $0x1,-0x1b0(%rbp)
L430:
  mov    -0x1a8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L263
  mov    -0x1a8(%rbp),%rax
  movzbl (%rax),%edx
  mov    -0x1b0(%rbp),%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  je     L43
L263:
  mov    -0x1a8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L277
  mov    -0x1b0(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L277
  mov    $0x0,%eax
  jmp    L62
L277:
  movl   $0x0,-0x19c(%rbp)
  jmp    L197
L237:
  addl   $0x1,-0x19c(%rbp)
L197:
  mov    -0x19c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x1a8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L237
  movl   $0x0,-0x198(%rbp)
  jmp    L6
L272:
  addl   $0x1,-0x198(%rbp)
L6:
  mov    -0x198(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x1b0(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L272
  cmpl   $0x0,-0x19c(%rbp)
  jne    L303
  mov    -0x188(%rbp),%eax
  mov    %al,-0x19e(%rbp)
  movl   $0x0,-0x184(%rbp)
  mov    -0x184(%rbp),%eax
  mov    %eax,-0x190(%rbp)
  jmp    L383
L55:
  movsbl -0x19d(%rbp),%edx
  movsbl -0x19e(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <insertOrDeleteCost@plt>
  lea    0x3(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x2,%eax
  add    %eax,-0x184(%rbp)
  movzbl -0x19d(%rbp),%eax
  mov    %al,-0x19e(%rbp)
  addl   $0x1,-0x190(%rbp)
L383:
  mov    -0x190(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x1b0(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x19d(%rbp)
  cmpb   $0x0,-0x19d(%rbp)
  jne    L55
  mov    -0x184(%rbp),%eax
  jmp    L62
L303:
  cmpl   $0x0,-0x198(%rbp)
  jne    L448
  mov    -0x188(%rbp),%eax
  mov    %al,-0x19f(%rbp)
  movl   $0x0,-0x184(%rbp)
  mov    -0x184(%rbp),%eax
  mov    %eax,-0x194(%rbp)
  jmp    L369
L267:
  movsbl -0x1a0(%rbp),%edx
  movsbl -0x19f(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <insertOrDeleteCost@plt>
  add    %eax,-0x184(%rbp)
  movzbl -0x1a0(%rbp),%eax
  mov    %al,-0x19f(%rbp)
  addl   $0x1,-0x194(%rbp)
L369:
  mov    -0x194(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x1a8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x1a0(%rbp)
  cmpb   $0x0,-0x1a0(%rbp)
  jne    L267
  mov    -0x184(%rbp),%eax
  jmp    L62
L448:
  mov    -0x1a8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2a,%al
  jne    L119
  mov    -0x1a8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L119
  mov    $0x0,%eax
  jmp    L62
L119:
  mov    -0x198(%rbp),%eax
  cmp    $0x3b,%eax
  ja     L319
  lea    -0x150(%rbp),%rax
  mov    %rax,-0x168(%rbp)
  jmp    L29
L319:
  mov    -0x198(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  mov    %eax,%edi
  call   <sqlite3_malloc@plt>
  mov    %rax,-0x160(%rbp)
  mov    -0x160(%rbp),%rax
  mov    %rax,-0x168(%rbp)
  cmpq   $0x0,-0x168(%rbp)
  jne    L29
  mov    $0xfffffffd,%eax
  jmp    L62
L29:
  mov    -0x198(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x168(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x158(%rbp)
  mov    -0x168(%rbp),%rax
  movl   $0x0,(%rax)
  mov    -0x188(%rbp),%eax
  mov    %eax,%edx
  mov    -0x158(%rbp),%rax
  mov    %dl,(%rax)
  mov    -0x188(%rbp),%eax
  mov    %al,-0x19e(%rbp)
  movl   $0x1,-0x190(%rbp)
  jmp    L140
L81:
  mov    -0x190(%rbp),%eax
  cltq
  lea    -0x1(%rax),%rdx
  mov    -0x1b0(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x19d(%rbp)
  mov    -0x190(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x158(%rbp),%rax
  add    %rax,%rdx
  movzbl -0x19d(%rbp),%eax
  mov    %al,(%rdx)
  mov    -0x190(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x168(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%ebx
  movsbl -0x19d(%rbp),%edx
  movsbl -0x19e(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <insertOrDeleteCost@plt>
  mov    %eax,%edx
  mov    -0x190(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x168(%rbp),%rax
  add    %rcx,%rax
  add    %ebx,%edx
  mov    %edx,(%rax)
  movzbl -0x19d(%rbp),%eax
  mov    %al,-0x19e(%rbp)
  addl   $0x1,-0x190(%rbp)
L140:
  mov    -0x190(%rbp),%eax
  cmp    -0x198(%rbp),%eax
  jle    L81
  mov    -0x188(%rbp),%eax
  mov    %al,-0x19f(%rbp)
  movl   $0x1,-0x194(%rbp)
  jmp    L80
L156:
  mov    -0x194(%rbp),%eax
  cmp    -0x19c(%rbp),%eax
  sete   %al
  movzbl %al,%eax
  mov    %eax,-0x174(%rbp)
  mov    -0x194(%rbp),%eax
  cltq
  lea    -0x1(%rax),%rdx
  mov    -0x1a8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x1a0(%rbp)
  cmpb   $0x2a,-0x1a0(%rbp)
  jne    L311
  cmpl   $0x0,-0x174(%rbp)
  jne    L209
L311:
  mov    -0x168(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x18c(%rbp)
  mov    -0x158(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,-0x188(%rbp)
  movsbl -0x1a0(%rbp),%edx
  movsbl -0x19f(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <insertOrDeleteCost@plt>
  mov    -0x18c(%rbp),%edx
  add    %eax,%edx
  mov    -0x168(%rbp),%rax
  mov    %edx,(%rax)
  movb   $0x0,-0x19e(%rbp)
  movl   $0x1,-0x190(%rbp)
  jmp    L48
L200:
  mov    -0x190(%rbp),%eax
  cltq
  lea    -0x1(%rax),%rdx
  mov    -0x1b0(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x19d(%rbp)
  movsbl -0x19d(%rbp),%edx
  mov    -0x190(%rbp),%eax
  cltq
  lea    -0x1(%rax),%rcx
  mov    -0x158(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <insertOrDeleteCost@plt>
  mov    %eax,-0x17c(%rbp)
  cmpl   $0x0,-0x174(%rbp)
  je     L416
  mov    -0x17c(%rbp),%eax
  lea    0x3(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x2,%eax
  mov    %eax,-0x17c(%rbp)
L416:
  movsbl -0x1a0(%rbp),%edx
  mov    -0x190(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x158(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <insertOrDeleteCost@plt>
  mov    %eax,-0x170(%rbp)
  movsbl -0x19d(%rbp),%edx
  movsbl -0x1a0(%rbp),%ecx
  mov    -0x190(%rbp),%eax
  cltq
  lea    -0x1(%rax),%rsi
  mov    -0x158(%rbp),%rax
  add    %rsi,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <substituteCost@plt>
  mov    %eax,-0x16c(%rbp)
  mov    -0x190(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x168(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x17c(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x180(%rbp)
  movsbl -0x19d(%rbp),%eax
  mov    %eax,-0x178(%rbp)
  mov    -0x190(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x168(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x170(%rbp),%eax
  add    %edx,%eax
  cmp    %eax,-0x180(%rbp)
  jle    L181
  mov    -0x190(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x168(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x170(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x180(%rbp)
  movsbl -0x1a0(%rbp),%eax
  mov    %eax,-0x178(%rbp)
L181:
  mov    -0x16c(%rbp),%edx
  mov    -0x18c(%rbp),%eax
  add    %edx,%eax
  cmp    %eax,-0x180(%rbp)
  jle    L128
  mov    -0x16c(%rbp),%edx
  mov    -0x18c(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x180(%rbp)
L128:
  mov    -0x190(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x168(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x18c(%rbp)
  mov    -0x190(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x158(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,-0x188(%rbp)
  mov    -0x190(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x168(%rbp),%rax
  add    %rax,%rdx
  mov    -0x180(%rbp),%eax
  mov    %eax,(%rdx)
  mov    -0x190(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x158(%rbp),%rax
  add    %rdx,%rax
  mov    -0x178(%rbp),%edx
  mov    %dl,(%rax)
  movzbl -0x19d(%rbp),%eax
  mov    %al,-0x19e(%rbp)
  addl   $0x1,-0x190(%rbp)
L48:
  mov    -0x190(%rbp),%eax
  cmp    -0x198(%rbp),%eax
  jle    L200
  movzbl -0x1a0(%rbp),%eax
  mov    %al,-0x19f(%rbp)
  addl   $0x1,-0x194(%rbp)
L80:
  mov    -0x194(%rbp),%eax
  cmp    -0x19c(%rbp),%eax
  jle    L156
  jmp    L281
L209:
  nop
L281:
  cmpb   $0x2a,-0x1a0(%rbp)
  jne    L404
  mov    -0x198(%rbp),%eax
  cmp    -0x19c(%rbp),%eax
  jle    L404
  mov    -0x19c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x168(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x184(%rbp)
  mov    -0x19c(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x190(%rbp)
  jmp    L389
L159:
  mov    -0x190(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x168(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x184(%rbp)
  jle    L243
  mov    -0x190(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x168(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x184(%rbp)
L243:
  addl   $0x1,-0x190(%rbp)
L389:
  mov    -0x190(%rbp),%eax
  cmp    -0x198(%rbp),%eax
  jle    L159
  jmp    L30
L404:
  mov    -0x198(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x168(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x184(%rbp)
L30:
  mov    -0x160(%rbp),%rax
  mov    %rax,%rdi
  call   <sqlite3_free@plt>
  mov    -0x184(%rbp),%eax
L62:
  mov    -0x18(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L351
  call   <__stack_chk_fail@plt>
L351:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

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