user: Converte this assembly snippet into its equivalent C code:

```asm
<update2>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r12
  mov    %rsi,%rbp
  mov    %rdx,%rbx
  mov    %rcx,%r13
  movss  %xmm0,0xc(%rsp)
  mov    (%rcx),%eax
  lea    0x4(,%rax,4),%edi
  call   <malloc@plt>
  mov    %rax,%rdi
  movl   $0x0,(%rax)
  cmpl   $0x0,0x0(%r13)
  jle    L119
  mov    $0x1,%eax
L449:
  movswl 0x2(%r13,%rax,4),%edx
  mov    %edx,(%rdi,%rax,4)
  andl   $0xffff,0x0(%r13,%rax,4)
  add    $0x1,%rax
  cmp    %eax,0x0(%r13)
  jge    L449
L119:
  mov    0x4(%r13),%eax
  cmp    $0x3,%eax
  je     L191
  mov    $0x1,%r8d
  mov    $0x4,%r9d
  pxor   %xmm5,%xmm5
  mov    $0x1,%esi
  movaps %xmm5,%xmm4
  movaps %xmm5,%xmm3
  movaps %xmm5,%xmm2
  mov    $0x0,%ecx
  jmp    L45
L73:
  movslq %r8d,%rax
  lea    0x0(%r13,%rax,4),%rdx
  cmpl   $0x0,(%rdx)
  jne    L479
L162:
  mov    $0xfc,%eax
L315:
  movss  (%r12,%rax,1),%xmm0
  addss  0x0(%rbp,%rax,1),%xmm0
  movss  %xmm0,(%rbx,%rax,1)
  sub    $0x4,%rax
  cmp    $0xfffffffffffffffc,%rax
  jne    L315
  add    $0x100,%r12
  add    $0x100,%rbp
  add    $0x100,%rbx
  add    $0x1,%r8d
  add    $0x4,%rdx
  cmpl   $0x0,(%rdx)
  je     L162
L479:
  movslq %r8d,%rax
  lea    0x0(,%rax,4),%r9
  mov    0x0(%r13,%rax,4),%eax
  cmp    $0x3,%eax
  je     L191
L45:
  test   %eax,%eax
  je     L73
  mov    %eax,%edx
  and    $0x1,%edx
  jne    L291
  test   $0x2,%al
  je     L479
  test   $0x80,%al
  jne    L254
  test   $0x40,%al
  je     L356
  movaps %xmm4,%xmm0
  addss  0x16c(%r12),%xmm0
  cvttss2si %xmm0,%eax
  mov    (%rdi,%r9,1),%r10d
  cmp    $0x1,%r10d
  jle    L255
  lea    0x174(%r12),%rdx
  lea    -0x2(%r10),%r10d
  shl    $0x8,%r10
  lea    0x274(%r12,%r10,1),%r10
L113:
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  addss  (%rdx),%xmm0
  cvttss2si %xmm0,%eax
  add    $0x100,%rdx
  cmp    %r10,%rdx
  jne    L113
  jmp    L255
L291:
  test   $0x80,%al
  jne    L489
  test   $0x40,%al
  je     L317
  movaps %xmm2,%xmm0
  addss  0x16c(%rbp),%xmm0
  cvttss2si %xmm0,%eax
  mov    (%rdi,%r9,1),%r10d
  cmp    $0x1,%r10d
  jle    L412
  lea    0x174(%rbp),%rdx
  lea    -0x2(%r10),%r10d
  shl    $0x8,%r10
  lea    0x274(%rbp,%r10,1),%r10
L101:
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  addss  (%rdx),%xmm0
  cvttss2si %xmm0,%eax
  add    $0x100,%rdx
  cmp    %r10,%rdx
  jne    L101
  jmp    L412
L489:
  mov    (%rdi,%r9,1),%eax
  cmp    $0x1,%eax
  jle    L341
  lea    0x74(%rbp),%r10
  lea    -0x2(%rax),%edx
  shl    $0x8,%rdx
  lea    0x174(%rbp,%rdx,1),%r11
  mov    %ecx,%edx
L384:
  pxor   %xmm0,%xmm0
  cvtsi2ss %edx,%xmm0
  addss  (%r10),%xmm0
  cvttss2si %xmm0,%edx
  add    $0x100,%r10
  cmp    %r10,%r11
  jne    L384
  sub    $0x1,%eax
L303:
  shl    $0x6,%eax
  add    $0x1b,%eax
  cltq
  pxor   %xmm0,%xmm0
  cvtsi2ss %edx,%xmm0
  addss  0x0(%rbp,%rax,4),%xmm0
  cvttss2si %xmm0,%eax
  jmp    L412
L341:
  mov    %ecx,%edx
  mov    %ecx,%eax
  jmp    L303
L317:
  movaps %xmm3,%xmm0
  addss  0x16c(%rbp),%xmm0
  cvttss2si %xmm0,%r10d
  mov    (%rdi,%r9,1),%r11d
  cmp    $0x2,%r11d
  jle    L165
  lea    0x170(%rbp),%rax
  lea    -0x3(%r11),%edx
  shl    $0x8,%rdx
  lea    0x270(%rbp,%rdx,1),%rdx
L197:
  pxor   %xmm0,%xmm0
  cvtsi2ss %r10d,%xmm0
  addss  (%rax),%xmm0
  cvttss2si %xmm0,%r10d
  add    $0x100,%rax
  cmp    %rax,%rdx
  jne    L197
  lea    -0x1(%r11),%edx
L165:
  mov    %edx,%eax
  shl    $0x6,%eax
  add    $0x1b,%eax
  cltq
  pxor   %xmm0,%xmm0
  cvtsi2ss %r10d,%xmm0
  addss  0x0(%rbp,%rax,4),%xmm0
  cvttss2si %xmm0,%eax
L412:
  cltd
  idivl  (%rdi,%r9,1)
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  mulss  0xc(%rsp),%xmm0
  cvttss2si %xmm0,%r10d
  movslq %r8d,%rax
  mov    0x0(%r13,%rax,4),%eax
  test   $0x1,%al
  je     L479
  cmp    $0x3,%eax
  je     L479
  lea    0x1(%r8),%r9d
  movslq %r9d,%r9
  lea    0xdc(%rbx),%rdx
L61:
  mov    $0xfc,%eax
L488:
  movss  0x0(%rbp,%rax,1),%xmm0
  movss  %xmm0,(%rbx,%rax,1)
  sub    $0x4,%rax
  cmp    $0xfffffffffffffffc,%rax
  jne    L488
  pxor   %xmm1,%xmm1
  cvtsi2ss %r10d,%xmm1
  movaps %xmm1,%xmm0
  addss  0x5c(%rbx),%xmm0
  movss  %xmm0,0x5c(%rbx)
  lea    0x80(%rbx),%rax
L382:
  movaps %xmm1,%xmm0
  addss  (%rax),%xmm0
  movss  %xmm0,(%rax)
  add    $0x4,%rax
  cmp    %rax,%rdx
  jne    L382
  add    $0x100,%rbp
  add    $0x100,%rbx
  mov    %r9d,%r8d
  mov    0x0(%r13,%r9,4),%eax
  add    $0x1,%r9
  add    $0x100,%rdx
  test   $0x1,%al
  je     L479
  cmp    $0x3,%eax
  jne    L61
  jmp    L479
L254:
  mov    (%rdi,%r9,1),%eax
  cmp    $0x1,%eax
  jle    L450
  lea    0x74(%r12),%r10
  lea    -0x2(%rax),%r11d
  shl    $0x8,%r11
  lea    0x174(%r12,%r11,1),%r11
L248:
  pxor   %xmm0,%xmm0
  cvtsi2ss %edx,%xmm0
  addss  (%r10),%xmm0
  cvttss2si %xmm0,%edx
  add    $0x100,%r10
  cmp    %r11,%r10
  jne    L248
  sub    $0x1,%eax
L172:
  shl    $0x6,%eax
  add    $0x1b,%eax
  cltq
  pxor   %xmm0,%xmm0
  cvtsi2ss %edx,%xmm0
  addss  (%r12,%rax,4),%xmm0
  cvttss2si %xmm0,%eax
  jmp    L255
L450:
  mov    %edx,%eax
  jmp    L172
L356:
  movaps %xmm5,%xmm0
  addss  0x16c(%r12),%xmm0
  cvttss2si %xmm0,%edx
  mov    (%rdi,%r9,1),%eax
  cmp    $0x2,%eax
  jle    L451
  lea    0x170(%r12),%r10
  lea    -0x3(%rax),%r11d
  shl    $0x8,%r11
  lea    0x270(%r12,%r11,1),%r11
L295:
  pxor   %xmm0,%xmm0
  cvtsi2ss %edx,%xmm0
  addss  (%r10),%xmm0
  cvttss2si %xmm0,%edx
  add    $0x100,%r10
  cmp    %r11,%r10
  jne    L295
  sub    $0x1,%eax
L462:
  shl    $0x6,%eax
  add    $0x1b,%eax
  cltq
  pxor   %xmm0,%xmm0
  cvtsi2ss %edx,%xmm0
  addss  (%r12,%rax,4),%xmm0
  cvttss2si %xmm0,%eax
L255:
  cltd
  idivl  (%rdi,%r9,1)
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  mulss  0xc(%rsp),%xmm0
  cvttss2si %xmm0,%r10d
  movslq %r8d,%rax
  mov    0x0(%r13,%rax,4),%eax
  test   $0x2,%al
  je     L479
  cmp    $0x3,%eax
  je     L479
  lea    0x1(%r8),%r9d
  movslq %r9d,%r9
  lea    0xdc(%rbx),%rdx
L2:
  mov    $0xfc,%eax
L474:
  movss  (%r12,%rax,1),%xmm0
  movss  %xmm0,(%rbx,%rax,1)
  sub    $0x4,%rax
  cmp    $0xfffffffffffffffc,%rax
  jne    L474
  pxor   %xmm1,%xmm1
  cvtsi2ss %r10d,%xmm1
  movaps %xmm1,%xmm0
  addss  0x5c(%rbx),%xmm0
  movss  %xmm0,0x5c(%rbx)
  lea    0x80(%rbx),%rax
L211:
  movaps %xmm1,%xmm0
  addss  (%rax),%xmm0
  movss  %xmm0,(%rax)
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L211
  add    $0x100,%r12
  add    $0x100,%rbx
  mov    %r9d,%r8d
  mov    0x0(%r13,%r9,4),%eax
  add    $0x1,%r9
  add    $0x100,%rdx
  test   $0x2,%al
  je     L479
  cmp    $0x3,%eax
  jne    L2
  jmp    L479
L451:
  mov    %esi,%eax
  jmp    L462
L191:
  mov    $0xfc,%eax
L232:
  movss  (%r12,%rax,1),%xmm0
  addss  0x0(%rbp,%rax,1),%xmm0
  movss  %xmm0,(%rbx,%rax,1)
  sub    $0x4,%rax
  cmp    $0xfffffffffffffffc,%rax
  jne    L232
  mov    0x0(%r13),%eax
  shl    $0x6,%eax
  cltq
  shl    $0x2,%rax
  sub    %rax,%rbx
  call   <free@plt>
  mov    %rbx,%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
float *update2(const float *profa, const float *profb, float *newp, int *path, int sipa, int sipb, float internal_gap_weight) {
  int i, c;
  int *gap_len = 0;
  int gap_cost = 0;
  gap_len = malloc(sizeof(int) * (path[0] + 1));
  gap_len[0] = 0;
  for (i = 1; i <= path[0]; i++) {
    gap_len[i] = (path[i] >> 16);
    path[i] = path[i] & 0x0000ffff;
  }
  c = 1;
  while (path[c] != 3) {
    gap_cost = 0;
    if (!path[c]) {
      while (!path[c] && path[c] != 3) {
        for (i = 64; i--;) {
          newp[i] = profa[i] + profb[i];
        }
        profa += 64;
        profb += 64;
        newp += 64;
        c++;
      }
    } else if (path[c] & 1) {
      if (path[c] & 128) {
        for (i = 0; i < gap_len[c] - 1; i++) {
          gap_cost += profb[29 + 64 * i];
        }
        gap_cost += profb[27 + 64 * i];
      } else if (path[c] & 64) {
        gap_cost += profb[27 + 64];
        for (i = 1; i < gap_len[c]; i++) {
          gap_cost += profb[29 + 64 * i];
        }
      } else {
        gap_cost += profb[27 + 64];
        for (i = 1; i < gap_len[c] - 1; i++) {
          gap_cost += profb[28 + 64 * i];
        }
        gap_cost += profb[27 + 64 * i];
      }
      gap_cost /= gap_len[c];
      gap_cost *= internal_gap_weight;
      while (path[c] & 1 && path[c] != 3) {
        for (i = 64; i--;) {
          newp[i] = profb[i];
        }
        newp[23] += gap_cost;
        for (i = 32; i < 55; i++) {
          newp[i] += gap_cost;
        }
        profb += 64;
        newp += 64;
        c++;
      }
    } else if (path[c] & 2) {
      if (path[c] & 128) {
        for (i = 0; i < gap_len[c] - 1; i++) {
          gap_cost += profa[29 + 64 * i];
        }
        gap_cost += profa[27 + 64 * i];
      } else if (path[c] & 64) {
        gap_cost += profa[27 + 64];
        for (i = 1; i < gap_len[c]; i++) {
          gap_cost += profa[29 + 64 * i];
        }
      } else {
        gap_cost += profa[27 + 64];
        for (i = 1; i < gap_len[c] - 1; i++) {
          gap_cost += profa[28 + 64 * i];
        }
        gap_cost += profa[27 + 64 * i];
      }
      gap_cost /= gap_len[c];
      gap_cost *= internal_gap_weight;
      while (path[c] & 2 && path[c] != 3) {
        for (i = 64; i--;) {
          newp[i] = profa[i];
        }
        newp[23] += gap_cost;
        for (i = 32; i < 55; i++) {
          newp[i] += gap_cost;
        }
        profa += 64;
        newp += 64;
        c++;
      }
    }
  }
  for (i = 64; i--;) {
    newp[i] = profa[i] + profb[i];
  }
  newp -= path[0] * 64;
  free(gap_len);
  return newp;
}
```