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

```asm
<constrained_least_squares>:
  endbr64
  push   %r15
  mov    %edi,%eax
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0xc8,%rsp
  mov    %edi,0x3c(%rsp)
  mov    %esi,0x38(%rsp)
  mov    %ecx,0x34(%rsp)
  mov    %fs:0x28,%rdx
  mov    %rdx,0xb8(%rsp)
  xor    %edx,%edx
  test   %edi,%edi
  jle    L558
  mov    %esi,%edi
  test   %esi,%esi
  jle    L558
  mov    %ecx,%edx
  cmp    %esi,%eax
  jl     L558
  cmp    %ecx,%esi
  jl     L558
  mov    %eax,%ecx
  imul   %eax,%eax
  sub    %edx,%edi
  mov    %r8,%rbp
  sub    %edx,%ecx
  mov    %edi,0x4c(%rsp)
  lea    0x68(%rsp),%rdi
  mov    %ecx,0x48(%rsp)
  mov    %eax,0x54(%rsp)
  mov    %eax,%esi
  xor    %eax,%eax
  call   <allocate_double_vector@plt>
  test   %eax,%eax
  je     L364
  mov    0x34(%rsp),%esi
  xor    %eax,%eax
  lea    0x70(%rsp),%rdi
  call   <allocate_integer_vector@plt>
  test   %eax,%eax
  je     L364
  mov    0x34(%rsp),%esi
  xor    %eax,%eax
  lea    0x78(%rsp),%rdi
  call   <allocate_double_vector@plt>
  test   %eax,%eax
  je     L364
  mov    0x3c(%rsp),%esi
  xor    %eax,%eax
  lea    0x80(%rsp),%rdi
  mov    %esi,%edx
  call   <allocate_double_matrix@plt>
  test   %eax,%eax
  je     L364
  mov    0x38(%rsp),%esi
  xor    %eax,%eax
  lea    0x88(%rsp),%rdi
  mov    %esi,%edx
  call   <allocate_double_matrix@plt>
  test   %eax,%eax
  je     L364
  mov    0x34(%rsp),%esi
  xor    %eax,%eax
  lea    0x90(%rsp),%rdi
  mov    %esi,%edx
  call   <allocate_double_matrix@plt>
  test   %eax,%eax
  je     L364
  mov    0x48(%rsp),%edx
  mov    0x38(%rsp),%esi
  xor    %eax,%eax
  lea    0x98(%rsp),%rdi
  call   <allocate_double_matrix@plt>
  test   %eax,%eax
  je     L364
  mov    0x48(%rsp),%esi
  xor    %eax,%eax
  lea    0xa0(%rsp),%rdi
  mov    %esi,%edx
  call   <allocate_double_matrix@plt>
  test   %eax,%eax
  je     L364
  mov    0x3c(%rsp),%esi
  xor    %eax,%eax
  lea    0xa8(%rsp),%rdi
  call   <allocate_integer_vector@plt>
  test   %eax,%eax
  je     L364
  mov    0x48(%rsp),%esi
  xor    %eax,%eax
  lea    0xb0(%rsp),%rdi
  call   <allocate_integer_vector@plt>
  test   %eax,%eax
  je     L364
  mov    0x3c(%rsp),%r10d
  test   %r10d,%r10d
  jle    L33
  mov    0xa8(%rsp),%rcx
  xor    %eax,%eax
  nopl   0x0(%rax)
L248:
  movl   $0x0,(%rcx,%rax,4)
  mov    0x3c(%rsp),%edx
  add    $0x1,%rax
  cmp    %eax,%edx
  jg     L248
  mov    0x34(%rsp),%r9d
  test   %r9d,%r9d
  jle    L65
L597:
  xor    %eax,%eax
  nop
L649:
  movslq 0x0(%rbp,%rax,4),%rdx
  add    $0x1,%rax
  movl   $0x1,(%rcx,%rdx,4)
  mov    0x34(%rsp),%r9d
  cmp    %eax,%r9d
  jg     L649
  mov    0x3c(%rsp),%edx
L65:
  test   %edx,%edx
  jle    L537
  mov    0xb0(%rsp),%r8
  xor    %eax,%eax
  xor    %esi,%esi
  xchg   %ax,%ax
L208:
  mov    (%rcx,%rax,4),%r9d
  test   %r9d,%r9d
  jne    L259
L661:
  mov    %eax,(%r8,%rsi,4)
  mov    0x3c(%rsp),%edx
  add    $0x1,%rax
  lea    0x1(%rsi),%edi
  cmp    %eax,%edx
  jle    L280
  mov    (%rcx,%rax,4),%r9d
  movslq %edi,%rsi
  test   %r9d,%r9d
  je     L661
L259:
  add    $0x1,%rax
  cmp    %eax,%edx
  jg     L208
L280:
  mov    0x34(%rsp),%r9d
L537:
  movslq 0x48(%rsp),%r10
  test   %r10d,%r10d
  jle    L556
L157:
  movslq 0x38(%rsp),%rdi
  mov    0xb0(%rsp),%r11
  mov    0x80(%rsp),%r12
  test   %edi,%edi
  jle    L556
  xor    %r8d,%r8d
  nopl   0x0(%rax,%rax,1)
L643:
  movslq (%r11,%r8,4),%rcx
  mov    (%r12,%r8,8),%rsi
  xor    %eax,%eax
  shl    $0x3,%rcx
  xchg   %ax,%ax
L338:
  mov    (%rbx,%rax,8),%rdx
  movsd  (%rdx,%rcx,1),%xmm0
  movsd  %xmm0,(%rsi,%rax,8)
  add    $0x1,%rax
  cmp    %rax,%rdi
  jne    L338
  add    $0x1,%r8
  cmp    %r8,%r10
  jne    L643
L556:
  mov    0x88(%rsp),%rdi
  test   %r9d,%r9d
  jle    L70
  movslq 0x38(%rsp),%r8
  test   %r8d,%r8d
  jle    L70
  movslq %r9d,%r10
  xor    %r9d,%r9d
  nopl   (%rax)
L628:
  movslq 0x0(%rbp,%r9,4),%rcx
  mov    (%rdi,%r9,8),%rsi
  xor    %eax,%eax
  shl    $0x3,%rcx
  nop
L78:
  mov    (%rbx,%rax,8),%rdx
  movsd  (%rdx,%rcx,1),%xmm0
  movsd  %xmm0,(%rsi,%rax,8)
  add    $0x1,%rax
  cmp    %rax,%r8
  jne    L78
  add    $0x1,%r9
  cmp    %r9,%r10
  jne    L628
L70:
  lea    0x50(%rsp),%rax
  lea    0x38(%rsp),%r12
  mov    (%rdi),%rdx
  mov    %rax,0x8(%rsp)
  lea    0x34(%rsp),%r13
  mov    %r12,%rcx
  mov    %r12,%rdi
  push   %rax
  mov    %r13,%rsi
  lea    0x5c(%rsp),%rax
  mov    %rax,0x18(%rsp)
  push   %rax
  mov    0x78(%rsp),%r9
  xor    %eax,%eax
  mov    0x88(%rsp),%r8
  call   <dgeqrf_@plt>
  mov    0x44(%rsp),%ecx
  pop    %rsi
  pop    %rdi
  mov    0x88(%rsp),%r10
  test   %ecx,%ecx
  jle    L614
  movslq %ecx,%rax
  mov    %rbx,(%rsp)
  xor    %r8d,%r8d
  mov    $0x1,%r11d
  mov    0x90(%rsp),%r14
  movdqa D79(%rip),%xmm4
  pxor   %xmm2,%xmm2
  mov    %rax,%rbx
  movdqa D52(%rip),%xmm3
  nopl   (%rax)
L371:
  mov    (%r14,%r8,8),%rdx
  lea    0x0(,%r8,8),%rsi
  test   %r8,%r8
  je     L193
  cmp    %r8d,%ecx
  mov    %r8d,%edi
  mov    %r11d,%r9d
  cmovle %ecx,%edi
  test   %edi,%edi
  cmovg  %edi,%r9d
  cmp    $0x3,%edi
  jle    L612
  mov    %r9d,%r15d
  movdqa D73(%rip),%xmm1
  mov    %rdx,%rax
  shr    $0x2,%r15d
  sub    $0x1,%r15d
  shl    $0x5,%r15
  lea    0x20(%rdx,%r15,1),%r15
  nopw   0x0(%rax,%rax,1)
L84:
  movdqa %xmm1,%xmm0
  movups %xmm2,(%rax)
  add    $0x20,%rax
  paddd  %xmm4,%xmm1
  movups %xmm2,-0x10(%rax)
  paddd  %xmm3,%xmm0
  cmp    %rax,%r15
  jne    L84
  mov    %r9d,%r15d
  pshufd $0xff,%xmm0,%xmm0
  and    $0xfffffffc,%r15d
  and    $0x3,%r9d
  movd   %xmm0,%eax
  je     L405
L511:
  movslq %r15d,%rax
  movq   $0x0,(%rdx,%rax,8)
  lea    0x0(,%rax,8),%r9
  lea    0x1(%r15),%eax
  cmp    %edi,%eax
  jge    L405
  movq   $0x0,0x8(%rdx,%r9,1)
  lea    0x2(%r15),%eax
  cmp    %edi,%eax
  jge    L405
  movq   $0x0,0x10(%rdx,%r9,1)
  lea    0x3(%r15),%eax
L405:
  cmp    %eax,%ecx
  jle    L447
L291:
  cltq
  nopl   0x0(%rax)
L254:
  mov    (%r10,%rax,8),%rdi
  movsd  (%rdi,%rsi,1),%xmm0
  movsd  %xmm0,(%rdx,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%ecx
  jg     L254
L447:
  add    $0x1,%r8
  cmp    %r8,%rbx
  jne    L371
  mov    (%rsp),%rbx
L614:
  sub    $0x8,%rsp
  mov    %r12,%r8
  mov    %r13,%rdx
  mov    %r12,%rsi
  push   0x10(%rsp)
  mov    %r12,%rdi
  xor    %eax,%eax
  push   0x20(%rsp)
  push   0x80(%rsp)
  mov    0x98(%rsp),%r9
  mov    (%r10),%rcx
  call   <dorgqr_@plt>
  movb   $0x54,0x66(%rsp)
  mov    %r12,%r8
  mov    %r12,%rcx
  movsd  D33(%rip),%xmm1
  movb   $0x4e,0x67(%rsp)
  movq   $0x0,0x80(%rsp)
  movsd  %xmm1,0x78(%rsp)
  add    $0x20,%rsp
  lea    0x58(%rsp),%rdi
  lea    0x47(%rsp),%rsi
  mov    %rdi,0x18(%rsp)
  lea    0x48(%rsp),%r14
  lea    0x46(%rsp),%r15
  mov    %rdi,%r9
  mov    %rsi,0x28(%rsp)
  sub    $0x8,%rsp
  mov    %r14,%rdx
  mov    %r15,%rdi
  push   %r14
  mov    0xa8(%rsp),%rax
  push   (%rax)
  lea    0x78(%rsp),%rax
  mov    %rax,0x38(%rsp)
  push   %rax
  push   %r12
  mov    0xb0(%rsp),%rax
  push   (%rax)
  lea    0x6c(%rsp),%rax
  mov    %rax,0x30(%rsp)
  push   %rax
  mov    0xb8(%rsp),%rax
  push   (%rax)
  xor    %eax,%eax
  call   <dgemm_@plt>
  mov    0x48(%rsp),%r9
  mov    %r13,%rcx
  mov    %r13,%rsi
  mov    0xd0(%rsp),%rax
  mov    0xb0(%rsp),%r8
  add    $0x40,%rsp
  mov    %r13,%rdi
  mov    (%rax),%rdx
  xor    %eax,%eax
  call   <dgetrf_@plt>
  sub    $0x8,%rsp
  mov    %r13,%rdx
  mov    %r13,%rdi
  push   0x10(%rsp)
  mov    0xa0(%rsp),%rax
  mov    0x20(%rsp),%r9
  mov    0x78(%rsp),%r8
  mov    0x80(%rsp),%rcx
  mov    (%rax),%rsi
  xor    %eax,%eax
  call   <dgetri_@plt>
  movslq 0x58(%rsp),%rsi
  pop    %rax
  mov    D33(%rip),%rax
  pop    %rdx
  test   %esi,%esi
  movq   %rax,%xmm1
  jle    L386
  movslq 0x4c(%rsp),%rdi
  mov    0x98(%rsp),%rdx
  movslq 0x34(%rsp),%rax
  mov    0x80(%rsp),%r8
  test   %edi,%edi
  jle    L206
  lea    (%rdx,%rax,8),%r9
  lea    0x0(,%rsi,8),%r10
  xor    %edx,%edx
  nopl   (%rax)
L159:
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L313:
  mov    (%r9,%rax,8),%rcx
  movsd  (%rcx,%rdx,1),%xmm0
  mov    (%r8,%rax,8),%rcx
  add    $0x1,%rax
  movsd  %xmm0,(%rcx,%rdx,1)
  cmp    %rax,%rdi
  jne    L313
  add    $0x8,%rdx
  cmp    %rdx,%r10
  jne    L159
L206:
  mov    0xa0(%rsp),%rdi
  xor    %edx,%edx
  cs nopw 0x0(%rax,%rax,1)
L542:
  mov    (%rdi,%rdx,8),%rcx
  xor    %eax,%eax
  cs nopw 0x0(%rax,%rax,1)
L546:
  cmp    %eax,%edx
  je     L580
  movq   $0x0,(%rcx,%rax,8)
  add    $0x1,%rax
  cmp    %rax,%rsi
  jne    L546
  add    $0x1,%rdx
  cmp    %rdx,%rsi
  jne    L542
L578:
  movb   $0x4e,0x46(%rsp)
  lea    0x4c(%rsp),%rdx
  sub    $0x8,%rsp
  xor    %eax,%eax
  push   0x10(%rsp)
  mov    %r14,%rcx
  mov    %r14,%rsi
  push   0x20(%rsp)
  push   0x80(%rsp)
  push   %r14
  push   (%rdi)
  mov    0x30(%rsp),%r9
  mov    %r15,%rdi
  mov    (%r8),%r8
  mov    %rdx,0x38(%rsp)
  call   <dgels_@plt>
  movb   $0x4e,0x77(%rsp)
  mov    %r12,%rdx
  mov    %r15,%rdi
  mov    D33(%rip),%rax
  movb   $0x4e,0x76(%rsp)
  movq   $0x0,0x90(%rsp)
  mov    %rax,0x88(%rsp)
  add    $0x28,%rsp
  push   0x8(%rsp)
  mov    0x90(%rsp),%rax
  push   (%rax)
  push   0x38(%rsp)
  push   %r14
  mov    0xc8(%rsp),%rax
  push   (%rax)
  push   %r12
  movslq 0x6c(%rsp),%rcx
  mov    0xc0(%rsp),%rax
  push   (%rax,%rcx,8)
  mov    0x48(%rsp),%r8
  mov    %r14,%rcx
  xor    %eax,%eax
  mov    0x68(%rsp),%rsi
  mov    0x58(%rsp),%r9
  call   <dgemm_@plt>
  mov    %r14,%r8
  mov    %r13,%rcx
  mov    %r12,%rdx
  mov    D62(%rip),%rax
  mov    %r15,%rdi
  mov    %rax,0x98(%rsp)
  mov    D33(%rip),%rax
  mov    %rax,0xa0(%rsp)
  add    $0x38,%rsp
  push   %r12
  mov    0x98(%rsp),%rax
  push   (%rax)
  push   0x38(%rsp)
  push   %r14
  mov    0xc0(%rsp),%rax
  push   (%rax)
  push   0x30(%rsp)
  mov    0xb8(%rsp),%rax
  push   (%rax)
  mov    0x68(%rsp),%r14
  xor    %eax,%eax
  mov    0x58(%rsp),%r9
  mov    %r14,%rsi
  call   <dgemm_@plt>
  mov    %r13,%r8
  mov    %r13,%rcx
  mov    %r14,%rsi
  mov    D33(%rip),%rax
  mov    %r15,%rdi
  movq   $0x0,0xa0(%rsp)
  mov    %rax,0x98(%rsp)
  add    $0x38,%rsp
  push   0x8(%rsp)
  movslq 0x58(%rsp),%rdx
  mov    0x90(%rsp),%rax
  push   (%rax,%rdx,8)
  mov    %r12,%rdx
  push   0x38(%rsp)
  push   %r13
  mov    0xb8(%rsp),%rax
  push   (%rax)
  push   %r12
  mov    0xc0(%rsp),%rax
  push   (%rax)
  mov    0x58(%rsp),%r9
  xor    %eax,%eax
  call   <dgemm_@plt>
  mov    0x78(%rsp),%r10d
  add    $0x40,%rsp
  test   %r10d,%r10d
  jle    L198
  movslq 0x48(%rsp),%r12
  mov    0x80(%rsp),%r8
  mov    0xb0(%rsp),%rdi
  test   %r12d,%r12d
  jle    L16
  movslq %r10d,%r11
  xor    %ecx,%ecx
  movslq %r12d,%r9
  shl    $0x3,%r11
  cs nopw 0x0(%rax,%rax,1)
L410:
  mov    (%rbx,%rcx,1),%rsi
  xor    %eax,%eax
  cs nopw 0x0(%rax,%rax,1)
L619:
  mov    (%r8,%rax,8),%rdx
  movsd  (%rdx,%rcx,1),%xmm0
  movslq (%rdi,%rax,4),%rdx
  add    $0x1,%rax
  movsd  %xmm0,(%rsi,%rdx,8)
  cmp    %r9,%rax
  jne    L619
  add    $0x8,%rcx
  cmp    %r11,%rcx
  jne    L410
L16:
  movslq 0x34(%rsp),%rdi
  test   %edi,%edi
  jle    L198
  movslq %r10d,%r9
  lea    (%r8,%r12,8),%r8
  xor    %ecx,%ecx
  shl    $0x3,%r9
  nopw   0x0(%rax,%rax,1)
L117:
  mov    (%rbx,%rcx,1),%rsi
  xor    %eax,%eax
  cs nopw 0x0(%rax,%rax,1)
L445:
  mov    (%r8,%rax,8),%rdx
  movsd  (%rdx,%rcx,1),%xmm0
  movslq 0x0(%rbp,%rax,4),%rdx
  add    $0x1,%rax
  movsd  %xmm0,(%rsi,%rdx,8)
  cmp    %rdi,%rax
  jne    L445
  add    $0x8,%rcx
  cmp    %rcx,%r9
  jne    L117
L198:
  mov    0x68(%rsp),%rdi
  xor    %eax,%eax
  call   <free_vector@plt>
  mov    0x70(%rsp),%rdi
  xor    %eax,%eax
  call   <free_vector@plt>
  mov    0x78(%rsp),%rdi
  xor    %eax,%eax
  call   <free_vector@plt>
  mov    0xa8(%rsp),%rdi
  xor    %eax,%eax
  call   <free_vector@plt>
  mov    0xb0(%rsp),%rdi
  xor    %eax,%eax
  call   <free_vector@plt>
  mov    0x80(%rsp),%rdi
  xor    %eax,%eax
  call   <free_matrix@plt>
  mov    0x88(%rsp),%rdi
  xor    %eax,%eax
  call   <free_matrix@plt>
  mov    0x90(%rsp),%rdi
  xor    %eax,%eax
  call   <free_matrix@plt>
  mov    0x98(%rsp),%rdi
  xor    %eax,%eax
  call   <free_matrix@plt>
  mov    0xa0(%rsp),%rdi
  xor    %eax,%eax
  call   <free_matrix@plt>
  mov    $0x1,%eax
L7:
  mov    0xb8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L509
  add    $0xc8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L580:
  movsd  %xmm1,(%rcx,%rax,8)
  add    $0x1,%rax
  cmp    %rsi,%rax
  jne    L546
  add    $0x1,%rdx
  cmp    %rdx,%rsi
  jne    L542
  jmp    L578
  nopl   0x0(%rax)
L193:
  xor    %eax,%eax
  jmp    L291
  nop
L612:
  xor    %r15d,%r15d
  jmp    L511
L364:
  mov    $0xffffffff,%eax
  jmp    L7
L33:
  mov    0x34(%rsp),%r9d
  test   %r9d,%r9d
  jle    L662
  mov    0xa8(%rsp),%rcx
  jmp    L597
L386:
  mov    0x80(%rsp),%r8
  mov    0xa0(%rsp),%rdi
  jmp    L578
L558:
  mov    $0xfffffffe,%eax
  jmp    L7
L662:
  movslq 0x48(%rsp),%r10
  test   %r10d,%r10d
  jg     L157
  mov    0x88(%rsp),%rdi
  jmp    L70
L509:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D79
type_infered: byte[16]
name: extract_symbolic_data
arguments: data_tag: D52
type_infered: byte[16]
name: extract_symbolic_data
arguments: data_tag: D73
type_infered: f32[4]
name: extract_symbolic_data
arguments: data_tag: D33
type_infered: f64
name: extract_symbolic_data
arguments: data_tag: D62
type_infered: f32[2]

tool: {"D79": [0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00]}

tool: {"D52": [0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00]}

tool: {"D73": [0.0,1.401298464324817e-45,2.802596928649634e-45,4.203895392974451e-45]}

tool: D33: 1

tool: {"D62": [0.0,-1.875]}

assistant: ```c
int constrained_least_squares(int m, int n, double **matrix, int c, int *constrained) {
  if (m < 1 || n < 1 || n > m || c > n)
    return -2;
  int i, j;
  int f = m - c, u = n - c;
  char transa, transb;
  double alpha, beta;
  int info;
  int lwork = m * m;
  double *work;
  if (!allocate_double_vector(&work, lwork)) {
    return -1;
  }
  int *ipiv;
  if (!allocate_integer_vector(&ipiv, c)) {
    return -1;
  }
  double *tau;
  if (!allocate_double_vector(&tau, c)) {
    return -1;
  }
  double **t_matrix;
  if (!allocate_double_matrix(&t_matrix, m, m)) {
    return -1;
  }
  double **c_matrix;
  if (!allocate_double_matrix(&c_matrix, n, n)) {
    return -1;
  }
  double **r_matrix;
  if (!allocate_double_matrix(&r_matrix, c, c)) {
    return -1;
  }
  double **a_matrix;
  if (!allocate_double_matrix(&a_matrix, n, f)) {
    return -1;
  }
  double **d_matrix;
  if (!allocate_double_matrix(&d_matrix, f, f)) {
    return -1;
  }
  int *temp, *unconstrained;
  if (!allocate_integer_vector(&temp, m)) {
    return -1;
  }
  if (!allocate_integer_vector(&unconstrained, f)) {
    return -1;
  }
  for (i = 0; i < m; i++)
    temp[i] = 0;
  for (i = 0; i < c; i++)
    temp[constrained[i]] = 1;
  j = 0;
  for (i = 0; i < m; i++)
    if (!temp[i])
      unconstrained[j++] = i;
  for (i = 0; i < f; i++)
    for (j = 0; j < n; j++)
      t_matrix[i][j] = matrix[j][unconstrained[i]];
  for (i = 0; i < c; i++)
    for (j = 0; j < n; j++)
      c_matrix[i][j] = matrix[j][constrained[i]];
  dgeqrf_(&n, &c, c_matrix[0], &n, tau, work, &lwork, &info);
  for (i = 0; i < c; i++)
    for (j = 0; j < c; j++)
      r_matrix[i][j] = ((j >= i) ? c_matrix[j][i] : 0);
  dorgqr_(&n, &n, &c, c_matrix[0], &n, tau, work, &lwork, &info);
  transa = 'T';
  transb = 'N';
  alpha = 1.0;
  beta = 0.0;
  dgemm_(&transa, &transb, &f, &n, &n, &alpha, t_matrix[0], &m, c_matrix[0], &n, &beta, a_matrix[0], &f);
  dgetrf_(&c, &c, r_matrix[0], &c, ipiv, &info);
  dgetri_(&c, r_matrix[0], &c, ipiv, work, &lwork, &info);
  for (i = 0; i < f; i++)
    for (j = 0; j < u; j++)
      t_matrix[j][i] = a_matrix[j + c][i];
  for (i = 0; i < f; i++)
    for (j = 0; j < f; j++)
      d_matrix[i][j] = (i == j);
  transa = 'N';
  dgels_(&transa, &f, &u, &f, t_matrix[0], &m, d_matrix[0], &f, work, &lwork, &info);
  transa = transb = 'N';
  alpha = 1.0;
  beta = 0.0;
  dgemm_(&transa, &transb, &n, &f, &u, &alpha, c_matrix[c], &n, d_matrix[0], &f, &beta, t_matrix[0], &m);
  alpha = -1.0;
  beta = 1.0;
  dgemm_(&transa, &transb, &n, &c, &f, &alpha, t_matrix[0], &m, a_matrix[0], &f, &beta, c_matrix[0], &n);
  alpha = 1.0;
  beta = 0.0;
  dgemm_(&transa, &transb, &n, &c, &c, &alpha, c_matrix[0], &n, r_matrix[0], &c, &beta, t_matrix[f], &m);
  for (i = 0; i < n; i++)
    for (j = 0; j < f; j++)
      matrix[i][unconstrained[j]] = t_matrix[j][i];
  for (i = 0; i < n; i++)
    for (j = 0; j < c; j++)
      matrix[i][constrained[j]] = t_matrix[j + f][i];
  free_vector(work);
  free_vector(ipiv);
  free_vector(tau);
  free_vector(temp);
  free_vector(unconstrained);
  free_matrix((void **)t_matrix);
  free_matrix((void **)c_matrix);
  free_matrix((void **)r_matrix);
  free_matrix((void **)a_matrix);
  free_matrix((void **)d_matrix);
  return 1;
}
```