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

```asm
<lu>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %edi,%ebx
  mov    %rsi,%rbp
  mov    %rdx,%r12
  movslq %edi,%r14
  lea    0x0(,%rdi,8),%edi
  call   <malloc@plt>
  mov    %rax,%r13
  test   %ebx,%ebx
  jle    L62
  mov    %rax,%rsi
  lea    0x0(,%r14,8),%r8
  lea    -0x1(%rbx),%eax
  mov    %eax,0xc(%rsp)
  mov    %eax,%eax
  lea    0x8(%rbp,%rax,8),%rdx
  mov    %ebx,%r9d
  mov    $0x0,%ecx
  mov    %ebx,%edi
  neg    %rdi
  shl    $0x3,%rdi
  movq   D49(%rip),%xmm2
  pxor   %xmm3,%xmm3
  movapd %xmm3,%xmm4
  movsd  D11(%rip),%xmm5
  jmp    L41
L180:
  ucomisd %xmm3,%xmm0
  jp     L191
  ucomisd %xmm4,%xmm0
  je     L108
L191:
  movapd %xmm5,%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,(%rsi)
  add    $0x1,%rcx
  add    $0x8,%rsi
  add    %r8,%rdx
  cmp    %r9,%rcx
  je     L120
L41:
  mov    %ecx,(%r12,%rcx,4)
  lea    (%rdi,%rdx,1),%rax
  pxor   %xmm1,%xmm1
L102:
  movsd  (%rax),%xmm0
  andpd  %xmm2,%xmm0
  maxsd  %xmm1,%xmm0
  movapd %xmm0,%xmm1
  add    $0x8,%rax
  cmp    %rdx,%rax
  jne    L102
  jmp    L180
L120:
  lea    -0x2(%rbx),%eax
  mov    %eax,0x8(%rsp)
  mov    %ebx,%eax
  mov    $0x1,%r10d
  mov    $0x0,%r15d
  movsd  D11(%rip),%xmm9
  mov    $0x0,%r8d
  movsd  D22(%rip),%xmm7
  movq   D49(%rip),%xmm4
  movq   D68(%rip),%xmm8
  pxor   %xmm6,%xmm6
  movapd %xmm6,%xmm5
  lea    0x10(%rbp),%r14
  jmp    L37
L27:
  imul   %ebx,%r9d
  lea    (%r9,%r8,1),%eax
  cltq
  movsd  0x0(%rbp,%rax,8),%xmm3
  mulsd  %xmm3,%xmm9
  ucomisd %xmm6,%xmm3
  jp     L114
  ucomisd %xmm5,%xmm3
  je     L84
L114:
  lea    0x1(%r8),%eax
  mov    %eax,0x4(%rsp)
  cmp    %eax,%ebx
  je     L58
  mov    %r10,%rdi
  mov    0x8(%rsp),%r11d
  add    %r15,%r11
  movslq %r9d,%r9
L21:
  mov    %ebx,%esi
  imul   (%r12,%rdi,4),%esi
  lea    (%rsi,%r8,1),%eax
  cltq
  lea    0x0(%rbp,%rax,8),%rax
  movsd  (%rax),%xmm2
  divsd  %xmm3,%xmm2
  movsd  %xmm2,(%rax)
  movslq %esi,%rsi
  lea    (%rsi,%r10,1),%rax
  lea    0x0(%rbp,%rax,8),%rax
  lea    (%r11,%rsi,1),%rdx
  lea    (%r14,%rdx,8),%rcx
  mov    %r9,%rdx
  sub    %rsi,%rdx
L110:
  movapd %xmm2,%xmm1
  mulsd  (%rax,%rdx,8),%xmm1
  movsd  (%rax),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  add    $0x8,%rax
  cmp    %rcx,%rax
  jne    L110
  add    $0x1,%rdi
  cmp    %edi,%ebx
  jg     L21
  mov    0xc(%rsp),%eax
  sub    %r15d,%eax
  mov    0x4(%rsp),%r8d
  add    %r8d,%eax
  add    $0x1,%r15
  add    $0x1,%r10
  subl   $0x1,0x8(%rsp)
L37:
  mov    %r15,%rdx
  movapd %xmm7,%xmm1
  cmp    %r8d,%ebx
  jle    L92
L147:
  mov    (%r12,%rdx,4),%esi
  mov    %ebx,%ecx
  imul   %esi,%ecx
  add    %r8d,%ecx
  movslq %ecx,%rcx
  movsd  0x0(%rbp,%rcx,8),%xmm0
  andpd  %xmm4,%xmm0
  movslq %esi,%rsi
  mulsd  0x0(%r13,%rsi,8),%xmm0
  comisd %xmm1,%xmm0
  maxsd  %xmm1,%xmm0
  movapd %xmm0,%xmm1
  cmova  %edx,%eax
  add    $0x1,%rdx
  cmp    %edx,%ebx
  jg     L147
L92:
  movslq %eax,%rdx
  lea    (%r12,%rdx,4),%rdx
  mov    (%rdx),%r9d
  cmp    %r8d,%eax
  je     L27
  mov    (%r12,%r15,4),%eax
  mov    %eax,(%rdx)
  mov    %r9d,(%r12,%r15,4)
  xorpd  %xmm8,%xmm9
  jmp    L27
L62:
  movsd  D11(%rip),%xmm6
  movq   %xmm6,%rbx
  jmp    L144
L58:
  movq   %xmm9,%rbx
L144:
  mov    %r13,%rdi
  call   <free@plt>
  jmp    L76
L108:
  pxor   %xmm7,%xmm7
  movq   %xmm7,%rbx
L76:
  movq   %rbx,%xmm0
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L84:
  pxor   %xmm6,%xmm6
  movq   %xmm6,%rbx
  jmp    L76
```

tool_calls: name: disassemble_data
arguments: tag: D49
type_infered: qword
name: disassemble_data
arguments: tag: D11
type_infered: byte[8]
name: disassemble_data
arguments: tag: D22
type_infered: byte[8]
name: disassemble_data
arguments: tag: D68
type_infered: byte[8]

tool: D49: 9223372036854775807

tool: {"D11": [0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f]}

tool: {"D22": [0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0xbf]}

tool: {"D68": [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80]}

assistant: ```c
double lu(int n, double *a, int *ip) {
  int i, j, k, ii, ik;
  double t, u, det;
  double *weight;
  weight = (double *)malloc(sizeof(double) * n);
  det = 0;
  for (k = 0; k < n; k++) {
    ip[k] = k;
    u = 0;
    for (j = 0; j < n; j++) {
      t = fabs(a[n * k + j]);
      if (t > u)
        u = t;
    }
    if (u == 0) {
      return 0;
    }
    weight[k] = 1 / u;
  }
  det = 1;
  for (k = 0; k < n; k++) {
    u = -1;
    for (i = k; i < n; i++) {
      ii = ip[i];
      t = fabs(a[n * ii + k]) * weight[ii];
      if (t > u) {
        u = t;
        j = i;
      }
    }
    ik = ip[j];
    if (j != k) {
      ip[j] = ip[k];
      ip[k] = ik;
      det = -det;
    }
    u = a[n * ik + k];
    det *= u;
    if (u == 0) {
      return 0;
    }
    for (i = k + 1; i < n; i++) {
      ii = ip[i];
      t = (a[n * ii + k] /= u);
      for (j = k + 1; j < n; j++) {
        a[n * ii + j] -= t * a[n * ik + j];
      }
    }
  }
  free(weight);
  return det;
}
```