user: What is the c source code of the assembly code below?

```asm
<align_W2>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %r9d,%ebp
  push   %rbx
  sub    $0x58,%rsp
  movq   $0x0,(%rdi)
  mov    0x90(%rsp),%ebx
  movq   $0x0,(%rsi)
  movzbl 0xb0(%rsp),%eax
  mov    %rdi,0x40(%rsp)
  cmp    %ebx,%r9d
  mov    %ebx,%r14d
  mov    %rdx,0x18(%rsp)
  mov    0x98(%rsp),%r13d
  cmovge %r9d,%r14d
  mov    %rsi,0x48(%rsp)
  mov    %rcx,0x10(%rsp)
  add    %r14d,%r14d
  mov    %r8,0x8(%rsp)
  mov    %r14d,%edi
  mov    %al,0x2f(%rsp)
  call   <malloc@plt>
  mov    %r14d,%edi
  movslq %r14d,%r14
  mov    %rax,%r15
  mov    %rax,0x30(%rsp)
  call   <malloc@plt>
  movb   $0x0,-0x1(%r15,%r14,1)
  lea    -0x1(%rbp),%r9d
  mov    %rax,0x38(%rsp)
  movb   $0x0,-0x1(%rax,%r14,1)
  mov    %r13d,%eax
  shr    $0x1f,%eax
  add    %r13d,%eax
  sar    %eax
  test   %r9d,%r9d
  mov    %eax,%r12d
  lea    -0x1(%rbx),%eax
  setg   %dl
  test   %eax,%eax
  mov    %edx,%edi
  setg   %r10b
  jg     L262
  test   %dl,%dl
  je     L42
L262:
  mov    0x30(%rsp),%rcx
  mov    $0x1,%edx
  mov    0x38(%rsp),%r8
  sub    %ecx,%edx
  mov    %rcx,%r11
  mov    %edx,0x28(%rsp)
  nopl   (%rax)
L135:
  mov    %r13d,%ecx
  mov    %r9d,%esi
  mov    %eax,%edx
  imul   %r9d,%ecx
  sub    %r12d,%esi
  sub    %esi,%edx
  add    %ecx,%edx
  test   %r9d,%r9d
  jle    L148
  lea    -0x1(%r9),%r14d
  mov    %eax,%ebp
  mov    %r14d,%ebx
  sub    %r12d,%ebx
  sub    %ebx,%ebp
  js     L148
  cmp    %ebp,%r13d
  jle    L148
  mov    %ecx,%ebx
  mov    0xa8(%rsp),%r15d
  sub    %r13d,%ebx
  add    %ebp,%ebx
  mov    0x8(%rsp),%rbp
  movslq %ebx,%rbx
  add    0x0(%rbp,%rbx,4),%r15d
  movslq %edx,%rbx
  mov    0x0(%rbp,%rbx,4),%ebp
  xor    %ebx,%ebx
  cmp    %ebp,%r15d
  sete   %bl
  neg    %ebx
  test   %eax,%eax
  jg     L205
  cmp    %ebp,%r15d
  jne    L144
L236:
  movzbl 0x2f(%rsp),%edi
  movslq %r9d,%r9
  mov    %dil,(%r11)
  mov    0x10(%rsp),%rdi
  movzbl -0x1(%rdi,%r9,1),%edx
  mov    %r14d,%r9d
  mov    %dl,(%r8)
L10:
  test   %r9d,%r9d
  mov    0x28(%rsp),%ebx
  setg   %dil
  test   %eax,%eax
  setg   %dl
  lea    (%rbx,%r11,1),%ecx
  add    $0x1,%r8
  add    $0x1,%r11
  mov    %edx,%r10d
  test   %dil,%dil
  jne    L135
  test   %dl,%dl
  jne    L135
  mov    0x30(%rsp),%rbx
  mov    0x38(%rsp),%rsi
  movslq %ecx,%rax
  sar    %ecx
  movb   $0x0,(%rbx,%rax,1)
  movb   $0x0,(%rsi,%rax,1)
  je     L197
  lea    -0x1(%rbx,%rax,1),%rdx
  mov    %rsi,%rdi
  lea    -0x1(%rcx),%eax
  lea    0x1(%rbx,%rax,1),%r10
  sub    %rbx,%rdi
  mov    %rbx,%rax
  nopw   0x0(%rax,%rax,1)
L199:
  movzbl (%rax),%ecx
  movzbl (%rdx),%esi
  mov    %sil,(%rax)
  lea    (%rax,%rdi,1),%rsi
  add    $0x1,%rax
  mov    %cl,(%rdx)
  lea    (%rdx,%rdi,1),%rcx
  movzbl (%rsi),%r8d
  sub    $0x1,%rdx
  movzbl (%rcx),%r9d
  mov    %r9b,(%rsi)
  mov    %r8b,(%rcx)
  cmp    %rax,%r10
  jne    L199
L197:
  mov    0x40(%rsp),%rax
  mov    0x30(%rsp),%rbx
  mov    %rbx,(%rax)
  mov    0x48(%rsp),%rax
  mov    0x38(%rsp),%rbx
  mov    %rbx,(%rax)
  add    $0x58,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L148:
  test   %eax,%eax
  jle    L144
  xor    %ebx,%ebx
L205:
  lea    -0x1(%rax),%ebp
  mov    %ebp,%r14d
  sub    %esi,%r14d
  js     L184
  cmp    %r14d,%r13d
  jle    L184
  mov    0x8(%rsp),%rsi
  add    %ecx,%r14d
  mov    0xa8(%rsp),%r15d
  movslq %r14d,%r14
  add    (%rsi,%r14,4),%r15d
  movslq %edx,%r14
  mov    %rsi,0x20(%rsp)
  cmp    (%rsi,%r14,4),%r15d
  setne  %sil
  movzbl %sil,%esi
  sub    $0x1,%esi
  mov    %esi,0x4(%rsp)
  mov    0x20(%rsp),%rsi
  cmp    (%rsi,%r14,4),%r15d
  mov    $0x0,%esi
  cmove  %esi,%ebx
  test   %dil,%dil
  je     L194
L81:
  test   %r10b,%r10b
  je     L194
  lea    -0x1(%r9),%r14d
  mov    %ebp,%r10d
  mov    %r14d,%edi
  sub    %r12d,%edi
  sub    %edi,%r10d
  js     L112
  cmp    %r10d,%r13d
  jle    L112
  mov    0x18(%rsp),%rsi
  sub    %r13d,%ecx
  movslq %eax,%rdi
  movslq %edx,%rdx
  add    %r10d,%ecx
  xor    %r15d,%r15d
  movzbl -0x1(%rsi,%rdi,1),%r10d
  mov    0x10(%rsp),%rsi
  movslq %r9d,%rdi
  movslq %ecx,%rcx
  lea    -0x1(%rsi,%rdi,1),%rdi
  mov    0x8(%rsp),%rsi
  cmp    (%rdi),%r10b
  cmovne 0xa0(%rsp),%r15d
  add    (%rsi,%rcx,4),%r15d
  cmp    (%rsi,%rdx,4),%r15d
  je     L204
L112:
  mov    0x4(%rsp),%esi
  mov    %ebx,%edx
  and    %esi,%edx
  cmp    $0xffffffff,%edx
  jne    L194
  mov    0x18(%rsp),%rdi
  movslq %eax,%rdx
  mov    0x10(%rsp),%rcx
  add    %esi,%eax
  movzbl -0x1(%rdi,%rdx,1),%r10d
  movslq %r9d,%rdx
  add    %ebx,%r9d
  lea    -0x1(%rcx,%rdx,1),%rdi
L98:
  mov    %r10b,(%r11)
  movzbl (%rdi),%edx
  mov    %dl,(%r8)
  jmp    L10
  nopw   0x0(%rax,%rax,1)
L184:
  movl   $0x0,0x4(%rsp)
  test   %dil,%dil
  jne    L81
  nopl   0x0(%rax)
L194:
  mov    0x4(%rsp),%ecx
  cmp    $0xffffffff,%ecx
  sete   %dl
  cmp    $0xffffffff,%ebx
  jne    L248
  test   %ecx,%ecx
  jne    L248
  lea    -0x1(%r9),%r14d
  jmp    L236
  nopl   0x0(%rax)
L248:
  test   %ebx,%ebx
  jne    L144
  test   %dl,%dl
  je     L144
  mov    0x18(%rsp),%rdi
  cltq
  movzbl -0x1(%rdi,%rax,1),%eax
  mov    %al,(%r11)
  movzbl 0x2f(%rsp),%eax
  mov    %al,(%r8)
  mov    %ebp,%eax
  jmp    L10
  cs nopw 0x0(%rax,%rax,1)
L204:
  mov    %ebp,%eax
  mov    %r14d,%r9d
  jmp    L98
  nopw   0x0(%rax,%rax,1)
L144:
  mov    0x30(%rsp),%rdi
  call   <free@plt>
  mov    0x38(%rsp),%rdi
  call   <free@plt>
  add    $0x58,%rsp
  mov    $0xffffffff,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L42:
  mov    0x30(%rsp),%rax
  movb   $0x0,(%rax)
  mov    0x38(%rsp),%rax
  movb   $0x0,(%rax)
  jmp    L197
```

assistant: ```c
int align_W2(char **X, char **Y, char *a, char *b, int *W, int m_r, int n_c, int w_len, int mismatch, int gap, char gap_char) {
  int i;
  int dr, dc;
  int r, c, w;
  int pos00, pos01, pos10, pos11;
  int w_offset;
  int mm;
  int xy_pos = 0;
  char ch;
  char *tx, *ty;
  i = ((n_c > m_r) ? n_c : m_r);
  *X = NULL;
  *Y = NULL;
  tx = (char *)malloc(sizeof(char) * 2 * i);
  ty = (char *)malloc(sizeof(char) * 2 * i);
  tx[2 * i - 1] = '\0';
  ty[2 * i - 1] = '\0';
  w_offset = w_len / 2;
  r = m_r - 1;
  c = n_c - 1;
  while ((r > 0) || (c > 0)) {
    dr = 0;
    dc = 0;
    w = c - (r - w_offset);
    pos11 = r * w_len + w;
    if (r > 0) {
      w = c - ((r - 1) - w_offset);
      if ((w >= 0) && (w < w_len)) {
        pos01 = (r - 1) * w_len + w;
        if ((W[pos01] + gap) == W[pos11]) {
          dr = -1;
          dc = 0;
        }
      }
    }
    if (c > 0) {
      w = (c - 1) - (r - w_offset);
      if ((w >= 0) && (w < w_len)) {
        pos10 = r * w_len + w;
        if ((W[pos10] + gap) == W[pos11]) {
          dr = 0;
          dc = -1;
        }
      }
    }
    if ((r > 0) && (c > 0)) {
      w = (c - 1) - ((r - 1) - w_offset);
      if ((w >= 0) && (w < w_len)) {
        pos00 = (r - 1) * w_len + w;
        mm = ((a[c - 1] == b[r - 1]) ? 0 : mismatch);
        if ((W[pos00] + mm) == W[pos11]) {
          dr = -1;
          dc = -1;
        }
      }
    }
    if ((dr == -1) && (dc == -1)) {
      tx[xy_pos] = a[c - 1];
      ty[xy_pos] = b[r - 1];
    } else if ((dr == -1) && (dc == 0)) {
      tx[xy_pos] = gap_char;
      ty[xy_pos] = b[r - 1];
    } else if ((dr == 0) && (dc == -1)) {
      tx[xy_pos] = a[c - 1];
      ty[xy_pos] = gap_char;
    } else {
      free(tx);
      free(ty);
      return -1;
    }
    xy_pos++;
    r += dr;
    c += dc;
  }
  tx[xy_pos] = '\0';
  ty[xy_pos] = '\0';
  for (i = 0; i < (xy_pos / 2); i++) {
    ch = tx[i];
    tx[i] = tx[xy_pos - i - 1];
    tx[xy_pos - i - 1] = ch;
    ch = ty[i];
    ty[i] = ty[xy_pos - i - 1];
    ty[xy_pos - i - 1] = ch;
  }
  *X = tx;
  *Y = ty;
  return 0;
}
```