#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ dgesvd_(char *, char *, int *, int *, double *, int *,
                           double *, double *, int *, double *, int *, double *,
                           int *, int *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
int /*<<< orphan*/ stderr;
int dlevmar_pseudoinverse(double *A, double *B, int m) {
  double *buf = NULL;
  int buf_sz = 0;
  static double eps = (-1.0);
  register int i, j;
  double *a, *u, *s, *vt, *work;
  int a_sz, u_sz, s_sz, vt_sz, tot_sz;
  double thresh, one_over_denom;
  int info, rank, worksz, *iwork, iworksz;
  worksz = 5 * m;
  iworksz = 8 * m;
  a_sz = m * m;
  u_sz = m * m;
  s_sz = m;
  vt_sz = m * m;
  tot_sz = (a_sz + u_sz + s_sz + vt_sz + worksz) * sizeof(double) +
           iworksz * sizeof(int);
  buf_sz = tot_sz;
  buf = (double *)malloc(buf_sz);
  if (!buf) {
    fprintf(stderr, "memory allocation in "
                    "dlevmar_pseudoinverse"
                    "() failed!\n");
    return 0;
  }
  a = buf;
  u = a + a_sz;
  s = u + u_sz;
  vt = s + s_sz;
  work = vt + vt_sz;
  iwork = (int *)(work + worksz);
  for (i = 0; i < m; i++)
    for (j = 0; j < m; j++)
      a[i + j * m] = A[i * m + j];
  dgesvd_("A", "A", (int *)&m, (int *)&m, a, (int *)&m, s, u, (int *)&m, vt,
          (int *)&m, work, (int *)&worksz, &info);
  if (info != 0) {
    if (info < 0) {
      fprintf(stderr,
              "LAPACK error: illegal value for argument %d of "
              "dgesvd_"
              "\"/\" dgesdd_"
              " in "
              "dlevmar_pseudoinverse"
              "()\n",
              -info);
    } else {
      fprintf(
          stderr,
          "LAPACK error: dgesdd (dbdsdc)/dgesvd (dbdsqr) failed to converge in "
          "dlevmar_pseudoinverse"
          "() [info=%d]\n",
          info);
    }
    free(buf);
    return 0;
  }
  if (eps < 0.0) {
    double aux;
    for (eps = (1.0); aux = eps + (1.0), aux - (1.0) > 0.0; eps *= (0.5))
      ;
    eps *= (2.0);
  }
  for (i = 0; i < a_sz; i++)
    B[i] = 0.0;
  for (rank = 0, thresh = eps * s[0]; rank < m && s[rank] > thresh; rank++) {
    one_over_denom = (1.0) / s[rank];
    for (j = 0; j < m; j++)
      for (i = 0; i < m; i++)
        B[i * m + j] += vt[rank + i * m] * u[j + rank * m] * one_over_denom;
  }
  free(buf);
  return rank;
}


x86 assembly (clang, -O0):
<dlevmar_pseudoinverse>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x100,%rsp
mov    %rdi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %edx,-0x3c(%rbp)
movq   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
imul   $0x5,-0x3c(%rbp),%eax
mov    %eax,-0xb4(%rbp)
mov    -0x3c(%rbp),%eax
shl    $0x3,%eax
mov    %eax,-0xc4(%rbp)
mov    -0x3c(%rbp),%eax
imul   -0x3c(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x3c(%rbp),%eax
imul   -0x3c(%rbp),%eax
mov    %eax,-0x88(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x3c(%rbp),%eax
imul   -0x3c(%rbp),%eax
mov    %eax,-0x90(%rbp)
mov    -0x84(%rbp),%eax
add    -0x88(%rbp),%eax
add    -0x8c(%rbp),%eax
add    -0x90(%rbp),%eax
add    -0xb4(%rbp),%eax
cltq
shl    $0x3,%rax
movslq -0xc4(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %eax,-0x94(%rbp)
mov    -0x94(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%edi
call   1050 <malloc@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    122d <dlevmar_pseudoinverse+0xed>
mov    0x2dcf(%rip),%rax
mov    (%rax),%edi
lea    0xdfe(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x24(%rbp)
jmp    1618 <dlevmar_pseudoinverse+0x4d8>
mov    -0x48(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rax
movslq -0x84(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
movslq -0x88(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rax
movslq -0x8c(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rax
movslq -0x90(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x80(%rbp)
mov    -0x80(%rbp),%rax
movslq -0xb4(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xc0(%rbp)
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    131b <dlevmar_pseudoinverse+0x1db>
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    1308 <dlevmar_pseudoinverse+0x1c8>
mov    -0x30(%rbp),%rax
mov    -0x50(%rbp),%ecx
imul   -0x3c(%rbp),%ecx
add    -0x54(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x60(%rbp),%rax
mov    -0x50(%rbp),%ecx
mov    -0x54(%rbp),%edx
imul   -0x3c(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    12c0 <dlevmar_pseudoinverse+0x180>
jmp    130d <dlevmar_pseudoinverse+0x1cd>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    12ad <dlevmar_pseudoinverse+0x16d>
mov    -0x60(%rbp),%r8
mov    -0x70(%rbp),%r12
mov    -0x68(%rbp),%r15
mov    -0x78(%rbp),%r14
mov    -0x80(%rbp),%r11
lea    0xd18(%rip),%rsi
lea    -0x3c(%rbp),%rbx
lea    -0xb4(%rbp),%r10
lea    -0xac(%rbp),%rax
mov    %rsi,%rdi
mov    %rbx,%rdx
mov    %rbx,%rcx
mov    %rbx,%r9
mov    %r12,(%rsp)
mov    %r15,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r14,0x18(%rsp)
mov    %rbx,0x20(%rsp)
mov    %r11,0x28(%rsp)
mov    %r10,0x30(%rsp)
mov    %rax,0x38(%rsp)
call   1060 <dgesvd_@plt>
cmpl   $0x0,-0xac(%rbp)
je     13f0 <dlevmar_pseudoinverse+0x2b0>
cmpl   $0x0,-0xac(%rbp)
jge    13be <dlevmar_pseudoinverse+0x27e>
mov    0x2c3f(%rip),%rax
mov    (%rax),%edi
xor    %edx,%edx
sub    -0xac(%rbp),%edx
lea    0xc9e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    13db <dlevmar_pseudoinverse+0x29b>
mov    0x2c1b(%rip),%rax
mov    (%rax),%edi
mov    -0xac(%rbp),%edx
lea    0xcda(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x24(%rbp)
jmp    1618 <dlevmar_pseudoinverse+0x4d8>
xorps  %xmm0,%xmm0
ucomisd 0x2c45(%rip),%xmm0
jbe    1484 <dlevmar_pseudoinverse+0x344>
movsd  0xbf7(%rip),%xmm0
movsd  %xmm0,0x2c2f(%rip)
movsd  0xbe7(%rip),%xmm0
addsd  0x2c1f(%rip),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0xd0(%rbp),%xmm0
ff
movsd  0xbc7(%rip),%xmm1
subsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    146c <dlevmar_pseudoinverse+0x32c>
jmp    144f <dlevmar_pseudoinverse+0x30f>
movsd  0xbb9(%rip),%xmm0
mulsd  0x2be1(%rip),%xmm0
movsd  %xmm0,0x2bd9(%rip)
jmp    1411 <dlevmar_pseudoinverse+0x2d1>
movsd  0xb94(%rip),%xmm0
mulsd  0x2bc4(%rip),%xmm0
movsd  %xmm0,0x2bbc(%rip)
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x84(%rbp),%eax
jge    14b8 <dlevmar_pseudoinverse+0x378>
mov    -0x38(%rbp),%rax
movslq -0x50(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    148b <dlevmar_pseudoinverse+0x34b>
movl   $0x0,-0xb0(%rbp)
movsd  0x2b76(%rip),%xmm0
mov    -0x70(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
mov    -0xb0(%rbp),%ecx
xor    %eax,%eax
cmp    -0x3c(%rbp),%ecx
mov    %al,-0xd1(%rbp)
jge    1512 <dlevmar_pseudoinverse+0x3d2>
mov    -0x70(%rbp),%rax
movslq -0xb0(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd -0xa0(%rbp),%xmm0
ff
seta   %al
mov    %al,-0xd1(%rbp)
mov    -0xd1(%rbp),%al
test   $0x1,%al
jne    1525 <dlevmar_pseudoinverse+0x3e5>
jmp    1606 <dlevmar_pseudoinverse+0x4c6>
mov    -0x70(%rbp),%rax
movslq -0xb0(%rbp),%rcx
movsd  0xac8(%rip),%xmm0
divsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    15ed <dlevmar_pseudoinverse+0x4ad>
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    15da <dlevmar_pseudoinverse+0x49a>
mov    -0x78(%rbp),%rax
mov    -0xb0(%rbp),%ecx
mov    -0x50(%rbp),%edx
imul   -0x3c(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x68(%rbp),%rax
mov    -0x54(%rbp),%ecx
mov    -0xb0(%rbp),%edx
imul   -0x3c(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  -0xa8(%rbp),%xmm2
ff
mov    -0x38(%rbp),%rax
mov    -0x50(%rbp),%ecx
imul   -0x3c(%rbp),%ecx
add    -0x54(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    155f <dlevmar_pseudoinverse+0x41f>
jmp    15df <dlevmar_pseudoinverse+0x49f>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    154c <dlevmar_pseudoinverse+0x40c>
jmp    15f2 <dlevmar_pseudoinverse+0x4b2>
mov    -0xb0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb0(%rbp)
jmp    14da <dlevmar_pseudoinverse+0x39a>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0xb0(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x100,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<dlevmar_pseudoinverse>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %edx,%r13d
mov    %rsi,0x18(%rsp)
mov    %rdi,%r12
mov    %edx,0x14(%rsp)
lea    0x0(%r13,%r13,4),%eax
mov    %eax,0x28(%rsp)
mov    %edx,%ecx
shl    $0x5,%ecx
mov    %edx,%ebx
imul   %ebx,%ebx
lea    (%rbx,%r13,1),%edx
add    %eax,%edx
lea    (%rdx,%rbx,2),%eax
lea    (%rcx,%rax,8),%edi
call   1060 <malloc@plt>
test   %rax,%rax
je     12d8 <dlevmar_pseudoinverse+0x188>
mov    %rax,%r15
mov    %rbx,0x48(%rsp)
mov    %ebx,%ecx
lea    (%rax,%rcx,8),%r14
lea    (%r14,%rcx,8),%r11
movslq %r13d,%rax
mov    %rax,0x20(%rsp)
lea    (%r11,%rax,8),%rax
mov    %rax,0x40(%rsp)
mov    %rcx,0x38(%rsp)
lea    (%rax,%rcx,8),%rax
mov    %rax,0x8(%rsp)
test   %r13d,%r13d
jle    1275 <dlevmar_pseudoinverse+0x125>
mov    %r13d,%r8d
mov    %r8d,%edx
and    $0xfffffffe,%edx
lea    0x8(%r12),%rsi
mov    0x20(%rsp),%rbp
lea    0x0(,%rbp,8),%rdi
shl    $0x4,%rbp
xor    %eax,%eax
mov    %r15,%r9
mov    0x20(%rsp),%r10
jmp    1210 <dlevmar_pseudoinverse+0xc0>
nop
add    $0x1,%rax
add    %rdi,%rsi
add    $0x8,%r9
cmp    %r8,%rax
je     1275 <dlevmar_pseudoinverse+0x125>
cmp    $0x1,%r13d
jne    1220 <dlevmar_pseudoinverse+0xd0>
xor    %ebx,%ebx
jmp    1250 <dlevmar_pseudoinverse+0x100>
nopw   0x0(%rax,%rax,1)
mov    %r9,%rcx
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
movsd  -0x8(%rsi,%rbx,8),%xmm0
movsd  %xmm0,(%rcx)
movsd  (%rsi,%rbx,8),%xmm0
movsd  %xmm0,(%rcx,%rdi,1)
add    $0x2,%rbx
add    %rbp,%rcx
cmp    %rbx,%rdx
jne    1230 <dlevmar_pseudoinverse+0xe0>
test   $0x1,%r8b
je     1200 <dlevmar_pseudoinverse+0xb0>
mov    %rax,%rcx
imul   %r10,%rcx
add    %rbx,%rcx
movsd  (%r12,%rcx,8),%xmm0
imul   %r10,%rbx
add    %rax,%rbx
movsd  %xmm0,(%r15,%rbx,8)
jmp    1200 <dlevmar_pseudoinverse+0xb0>
lea    0x2c(%rsp),%rax
lea    0x28(%rsp),%rbp
lea    0x14(%rsp),%rcx
lea    0xdc3(%rip),%rdi
mov    %rdi,%rsi
mov    %rcx,%rdx
mov    %r15,%r8
mov    %rcx,%r9
push   %rax
push   %rbp
push   0x18(%rsp)
push   %rcx
mov    0x60(%rsp),%rbp
push   %rbp
push   %rcx
push   %r14
push   %r11
mov    %r11,%rbx
call   1070 <dgesvd_@plt>
add    $0x40,%rsp
mov    0x2c(%rsp),%edx
test   %edx,%edx
je     12f6 <dlevmar_pseudoinverse+0x1a6>
mov    0x2d1c(%rip),%rax
mov    (%rax),%edi
js     1364 <dlevmar_pseudoinverse+0x214>
lea    0xddb(%rip),%rsi
jmp    136d <dlevmar_pseudoinverse+0x21d>
mov    0x2d01(%rip),%rax
mov    (%rax),%edi
lea    0xd30(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
xor    %eax,%eax
jmp    155a <dlevmar_pseudoinverse+0x40a>
movsd  0x2d4a(%rip),%xmm5
xorpd  %xmm0,%xmm0
ucomisd %xmm5,%xmm0
jbe    138f <dlevmar_pseudoinverse+0x23f>
movsd  0xcec(%rip),%xmm1
movsd  0xcec(%rip),%xmm2
movsd  0xcec(%rip),%xmm3
movapd %xmm1,%xmm5
nopl   0x0(%rax,%rax,1)
mulsd  %xmm2,%xmm5
mulsd  %xmm2,%xmm5
mulsd  %xmm2,%xmm5
mulsd  %xmm2,%xmm5
mulsd  %xmm2,%xmm5
movapd %xmm5,%xmm4
addsd  %xmm1,%xmm4
addsd  %xmm3,%xmm4
ucomisd %xmm0,%xmm4
jbe    1383 <dlevmar_pseudoinverse+0x233>
mulsd  %xmm2,%xmm5
mulsd  %xmm2,%xmm5
mulsd  %xmm2,%xmm5
jmp    1330 <dlevmar_pseudoinverse+0x1e0>
neg    %edx
lea    0xce3(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
jmp    155a <dlevmar_pseudoinverse+0x40a>
addsd  %xmm5,%xmm5
movsd  %xmm5,0x2cb9(%rip)
mov    %r15,0x30(%rsp)
cmpl   $0x0,0x48(%rsp)
je     13c0 <dlevmar_pseudoinverse+0x270>
mov    0x38(%rsp),%rax
lea    0x0(,%rax,8),%rdx
mov    0x18(%rsp),%rdi
xor    %esi,%esi
movsd  %xmm5,0x8(%rsp)
call   1040 <memset@plt>
movsd  0x8(%rsp),%xmm5
mov    0x14(%rsp),%r12d
xor    %esi,%esi
test   %r12d,%r12d
jle    154a <dlevmar_pseudoinverse+0x3fa>
movsd  (%rbx),%xmm2
mulsd  %xmm2,%xmm5
ucomisd %xmm5,%xmm2
jbe    154a <dlevmar_pseudoinverse+0x3fa>
mov    %r12d,%r13d
and    $0xfffffffe,%r13d
mov    0x18(%rsp),%rax
lea    (%rax,%r12,8),%rax
mov    %rax,0x8(%rsp)
mov    %r12,%r10
shl    $0x4,%r10
mov    0x38(%rsp),%rax
mov    0x20(%rsp),%rcx
lea    (%rcx,%rax,2),%rax
add    %r12,%rax
mov    0x30(%rsp),%rcx
lea    (%rcx,%rax,8),%r15
xor    %esi,%esi
movsd  0xbde(%rip),%xmm0
mov    %rbx,0x50(%rsp)
mov    0x40(%rsp),%rdi
nopl   0x0(%rax)
movapd %xmm0,%xmm1
divsd  %xmm2,%xmm1
mov    %rsi,%r9
imul   %r12,%r9
mov    0x18(%rsp),%rdx
mov    0x8(%rsp),%rax
xor    %r11d,%r11d
jmp    1465 <dlevmar_pseudoinverse+0x315>
xchg   %ax,%ax
add    $0x1,%r11
add    $0x8,%rax
add    $0x8,%rdx
cmp    %r12,%r11
je     1520 <dlevmar_pseudoinverse+0x3d0>
lea    (%r11,%r9,1),%rbx
cmp    $0x1,%r12d
jne    1480 <dlevmar_pseudoinverse+0x330>
xor    %ecx,%ecx
jmp    14d5 <dlevmar_pseudoinverse+0x385>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %r8d,%r8d
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movsd  0x0(%rbp,%r8,1),%xmm2
mulsd  (%r14,%rbx,8),%xmm2
mulsd  %xmm1,%xmm2
addsd  (%rdx,%r8,1),%xmm2
movsd  %xmm2,(%rdx,%r8,1)
movsd  (%r15,%r8,1),%xmm2
mulsd  (%r14,%rbx,8),%xmm2
mulsd  %xmm1,%xmm2
addsd  (%rax,%r8,1),%xmm2
movsd  %xmm2,(%rax,%r8,1)
add    $0x2,%rcx
add    %r10,%r8
cmp    %rcx,%r13
jne    1490 <dlevmar_pseudoinverse+0x340>
test   $0x1,%r12b
je     1450 <dlevmar_pseudoinverse+0x300>
imul   %r12,%rcx
mov    %rsi,%r8
add    %rcx,%rsi
movsd  (%rdi,%rsi,8),%xmm2
mulsd  (%r14,%rbx,8),%xmm2
add    %r11,%rcx
mulsd  %xmm1,%xmm2
mov    0x18(%rsp),%rsi
addsd  (%rsi,%rcx,8),%xmm2
movsd  %xmm2,(%rsi,%rcx,8)
mov    %r8,%rsi
jmp    1450 <dlevmar_pseudoinverse+0x300>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rsi
cmp    %r12,%rsi
je     1547 <dlevmar_pseudoinverse+0x3f7>
mov    0x50(%rsp),%rbx
movsd  (%rbx,%rsi,8),%xmm2
add    $0x8,%r15
add    $0x8,%rbp
ucomisd %xmm5,%xmm2
ja     1430 <dlevmar_pseudoinverse+0x2e0>
jmp    154a <dlevmar_pseudoinverse+0x3fa>
mov    %r12d,%esi
mov    0x30(%rsp),%rdi
mov    %rsi,%rbx
call   1030 <free@plt>
mov    %rbx,%rax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@dlevmar_pseudoinverse.eps = internal global double -1.000000e+00
@stderr = global i32 0
@.str = [54 x i8] c"memory allocation in dlevmar_pseudoinverse() failed!\0A\00"
@.str.1 = [2 x i8] c"A\00"
@.str.2 = [94 x i8] c"LAPACK error: illegal value for argument %d of dgesvd_\22/\22 dgesdd_ in dlevmar_pseudoinverse()\0A\00"
@.str.3 = [103 x i8] c"LAPACK error: dgesdd (dbdsdc)/dgesvd (dbdsqr) failed to converge in dlevmar_pseudoinverse() [info=%d]\0A\00"
define i32 @dlevmar_pseudoinverse(double* %0, double* %1, i32 %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca double*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca double*
%13 = alloca double*
%14 = alloca double*
%15 = alloca double*
%16 = alloca double*
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca double
%23 = alloca double
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32*
%28 = alloca i32
%29 = alloca double
store double* %0, double** %5
store double* %1, double** %6
store i32 %2, i32* %7
store double* null, double** %8
store i32 0, i32* %9
%30 = load i32, i32* %7
%31 = mul nsw i32 5, %30
store i32 %31, i32* %26
%32 = load i32, i32* %7
%33 = mul nsw i32 8, %32
store i32 %33, i32* %28
%34 = load i32, i32* %7
%35 = load i32, i32* %7
%36 = mul nsw i32 %34, %35
store i32 %36, i32* %17
%37 = load i32, i32* %7
%38 = load i32, i32* %7
%39 = mul nsw i32 %37, %38
store i32 %39, i32* %18
%40 = load i32, i32* %7
store i32 %40, i32* %19
%41 = load i32, i32* %7
%42 = load i32, i32* %7
%43 = mul nsw i32 %41, %42
store i32 %43, i32* %20
%44 = load i32, i32* %17
%45 = load i32, i32* %18
%46 = add nsw i32 %44, %45
%47 = load i32, i32* %19
%48 = add nsw i32 %46, %47
%49 = load i32, i32* %20
%50 = add nsw i32 %48, %49
%51 = load i32, i32* %26
%52 = add nsw i32 %50, %51
%53 = sext i32 %52 to i64
%54 = mul i64 %53, 8
%55 = load i32, i32* %28
%56 = sext i32 %55 to i64
%57 = mul i64 %56, 4
%58 = add i64 %54, %57
%59 = trunc i64 %58 to i32
store i32 %59, i32* %21
%60 = load i32, i32* %21
store i32 %60, i32* %9
%61 = load i32, i32* %9
%62 = call i64 @malloc(i32 %61)
%63 = inttoptr i64 %62 to double*
store double* %63, double** %8
%64 = load double*, double** %8
%65 = icmp ne double* %64, null
br i1 %65, label %69, label %66
66: ; preds = %3
%67 = load i32, i32* @stderr
%68 = call i32 (i32, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %262
69: ; preds = %3
%70 = load double*, double** %8
store double* %70, double** %12
%71 = load double*, double** %12
%72 = load i32, i32* %17
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds double, double* %71, i64 %73
store double* %74, double** %13
%75 = load double*, double** %13
%76 = load i32, i32* %18
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds double, double* %75, i64 %77
store double* %78, double** %14
%79 = load double*, double** %14
%80 = load i32, i32* %19
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds double, double* %79, i64 %81
store double* %82, double** %15
%83 = load double*, double** %15
%84 = load i32, i32* %20
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds double, double* %83, i64 %85
store double* %86, double** %16
%87 = load double*, double** %16
%88 = load i32, i32* %26
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds double, double* %87, i64 %89
%91 = bitcast double* %90 to i32*
store i32* %91, i32** %27
store i32 0, i32* %10
br label %92
92: ; preds = %123, %69
%93 = load i32, i32* %10
%94 = load i32, i32* %7
%95 = icmp slt i32 %93, %94
br i1 %95, label %96, label %126
96: ; preds = %92
store i32 0, i32* %11
br label %97
97: ; preds = %119, %96
%98 = load i32, i32* %11
%99 = load i32, i32* %7
%100 = icmp slt i32 %98, %99
br i1 %100, label %101, label %122
101: ; preds = %97
%102 = load double*, double** %5
%103 = load i32, i32* %10
%104 = load i32, i32* %7
%105 = mul nsw i32 %103, %104
%106 = load i32, i32* %11
%107 = add nsw i32 %105, %106
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds double, double* %102, i64 %108
%110 = load double, double* %109
%111 = load double*, double** %12
%112 = load i32, i32* %10
%113 = load i32, i32* %11
%114 = load i32, i32* %7
%115 = mul nsw i32 %113, %114
%116 = add nsw i32 %112, %115
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds double, double* %111, i64 %117
store double %110, double* %118
br label %119
119: ; preds = %101
%120 = load i32, i32* %11
%121 = add nsw i32 %120, 1
store i32 %121, i32* %11
br label %97
122: ; preds = %97
br label %123
123: ; preds = %122
%124 = load i32, i32* %10
%125 = add nsw i32 %124, 1
store i32 %125, i32* %10
br label %92
126: ; preds = %92
%127 = load double*, double** %12
%128 = load double*, double** %14
%129 = load double*, double** %13
%130 = load double*, double** %15
%131 = load double*, double** %16
%132 = call i32 @dgesvd_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32* %7, i32* %7, double* %127, i32* %7, double* %128, double* %129, i32* %7, double* %130, i32* %7, double* %131, i32* %26, i32* %24)
%133 = load i32, i32* %24
%134 = icmp ne i32 %133, 0
br i1 %134, label %135, label %150
135: ; preds = %126
%136 = load i32, i32* %24
%137 = icmp slt i32 %136, 0
br i1 %137, label %138, label %143
138: ; preds = %135
%139 = load i32, i32* @stderr
%140 = load i32, i32* %24
%141 = sub nsw i32 0, %140
%142 = call i32 (i32, i8*, ...) @fprintf(i32 %139, i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str.2, i64 0, i64 0), i32 %141)
br label %147
143: ; preds = %135
%144 = load i32, i32* @stderr
%145 = load i32, i32* %24
%146 = call i32 (i32, i8*, ...) @fprintf(i32 %144, i8* getelementptr inbounds ([103 x i8], [103 x i8]* @.str.3, i64 0, i64 0), i32 %145)
br label %147
147: ; preds = %143, %138
%148 = load double*, double** %8
%149 = call i32 @free(double* %148)
store i32 0, i32* %4
br label %262
150: ; preds = %126
%151 = load double, double* @dlevmar_pseudoinverse.eps
%152 = fcmp olt double %151, 0.000000e+00
br i1 %152, label %153, label %167
153: ; preds = %150
store double 1.000000e+00, double* @dlevmar_pseudoinverse.eps
br label %154
154: ; preds = %161, %153
%155 = load double, double* @dlevmar_pseudoinverse.eps
%156 = fadd double %155, 1.000000e+00
store double %156, double* %29
%157 = load double, double* %29
%158 = fsub double %157, 1.000000e+00
%159 = fcmp ogt double %158, 0.000000e+00
br i1 %159, label %160, label %164
160: ; preds = %154
br label %161
161: ; preds = %160
%162 = load double, double* @dlevmar_pseudoinverse.eps
%163 = fmul double %162, 5.000000e-01
store double %163, double* @dlevmar_pseudoinverse.eps
br label %154
164: ; preds = %154
%165 = load double, double* @dlevmar_pseudoinverse.eps
%166 = fmul double %165, 2.000000e+00
store double %166, double* @dlevmar_pseudoinverse.eps
br label %167
167: ; preds = %164, %150
store i32 0, i32* %10
br label %168
168: ; preds = %177, %167
%169 = load i32, i32* %10
%170 = load i32, i32* %17
%171 = icmp slt i32 %169, %170
br i1 %171, label %172, label %180
172: ; preds = %168
%173 = load double*, double** %6
%174 = load i32, i32* %10
%175 = sext i32 %174 to i64
%176 = getelementptr inbounds double, double* %173, i64 %175
store double 0.000000e+00, double* %176
br label %177
177: ; preds = %172
%178 = load i32, i32* %10
%179 = add nsw i32 %178, 1
store i32 %179, i32* %10
br label %168
180: ; preds = %168
store i32 0, i32* %25
%181 = load double, double* @dlevmar_pseudoinverse.eps
%182 = load double*, double** %14
%183 = getelementptr inbounds double, double* %182, i64 0
%184 = load double, double* %183
%185 = fmul double %181, %184
store double %185, double* %22
br label %186
186: ; preds = %255, %180
%187 = load i32, i32* %25
%188 = load i32, i32* %7
%189 = icmp slt i32 %187, %188
br i1 %189, label %190, label %198
190: ; preds = %186
%191 = load double*, double** %14
%192 = load i32, i32* %25
%193 = sext i32 %192 to i64
%194 = getelementptr inbounds double, double* %191, i64 %193
%195 = load double, double* %194
%196 = load double, double* %22
%197 = fcmp ogt double %195, %196
br label %198
198: ; preds = %190, %186
%199 = phi i1 [ false, %186 ], [ %197, %190 ]
br i1 %199, label %200, label %258
200: ; preds = %198
%201 = load double*, double** %14
%202 = load i32, i32* %25
%203 = sext i32 %202 to i64
%204 = getelementptr inbounds double, double* %201, i64 %203
%205 = load double, double* %204
%206 = fdiv double 1.000000e+00, %205
store double %206, double* %23
store i32 0, i32* %11
br label %207
207: ; preds = %251, %200
%208 = load i32, i32* %11
%209 = load i32, i32* %7
%210 = icmp slt i32 %208, %209
br i1 %210, label %211, label %254
211: ; preds = %207
store i32 0, i32* %10
br label %212
212: ; preds = %247, %211
%213 = load i32, i32* %10
%214 = load i32, i32* %7
%215 = icmp slt i32 %213, %214
br i1 %215, label %216, label %250
216: ; preds = %212
%217 = load double*, double** %15
%218 = load i32, i32* %25
%219 = load i32, i32* %10
%220 = load i32, i32* %7
%221 = mul nsw i32 %219, %220
%222 = add nsw i32 %218, %221
%223 = sext i32 %222 to i64
%224 = getelementptr inbounds double, double* %217, i64 %223
%225 = load double, double* %224
%226 = load double*, double** %13
%227 = load i32, i32* %11
%228 = load i32, i32* %25
%229 = load i32, i32* %7
%230 = mul nsw i32 %228, %229
%231 = add nsw i32 %227, %230
%232 = sext i32 %231 to i64
%233 = getelementptr inbounds double, double* %226, i64 %232
%234 = load double, double* %233
%235 = fmul double %225, %234
%236 = load double, double* %23
%237 = load double*, double** %6
%238 = load i32, i32* %10
%239 = load i32, i32* %7
%240 = mul nsw i32 %238, %239
%241 = load i32, i32* %11
%242 = add nsw i32 %240, %241
%243 = sext i32 %242 to i64
%244 = getelementptr inbounds double, double* %237, i64 %243
%245 = load double, double* %244
%246 = call double @llvm.fmuladd.f64(double %235, double %236, double %245)
store double %246, double* %244
br label %247
247: ; preds = %216
%248 = load i32, i32* %10
%249 = add nsw i32 %248, 1
store i32 %249, i32* %10
br label %212
250: ; preds = %212
br label %251
251: ; preds = %250
%252 = load i32, i32* %11
%253 = add nsw i32 %252, 1
store i32 %253, i32* %11
br label %207
254: ; preds = %207
br label %255
255: ; preds = %254
%256 = load i32, i32* %25
%257 = add nsw i32 %256, 1
store i32 %257, i32* %25
br label %186
258: ; preds = %198
%259 = load double*, double** %8
%260 = call i32 @free(double* %259)
%261 = load i32, i32* %25
store i32 %261, i32* %4
br label %262
262: ; preds = %258, %147, %66
%263 = load i32, i32* %4
ret i32 %263
}

LLVM IR (-O2):
@dlevmar_pseudoinverse.eps = internal unnamed_addr global double -1.000000e+00
@stderr = global i32 0
@.str = [54 x i8] c"memory allocation in dlevmar_pseudoinverse() failed!\0A\00"
@.str.1 = [2 x i8] c"A\00"
@.str.2 = [94 x i8] c"LAPACK error: illegal value for argument %d of dgesvd_\22/\22 dgesdd_ in dlevmar_pseudoinverse()\0A\00"
@.str.3 = [103 x i8] c"LAPACK error: dgesdd (dbdsdc)/dgesvd (dbdsqr) failed to converge in dlevmar_pseudoinverse() [info=%d]\0A\00"
define i32 @dlevmar_pseudoinverse(double* nocapture %0, double* nocapture %1, i32 %2) {
%4 = bitcast double* %1 to i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %2, i32* %5
%8 = bitcast i32* %6 to i8*
%9 = bitcast i32* %7 to i8*
%10 = mul nsw i32 %2, 5
store i32 %10, i32* %7
%11 = shl i32 %2, 5
%12 = mul nsw i32 %2, %2
%13 = shl nuw nsw i32 %12, 1
%14 = add i32 %12, %2
%15 = add i32 %14, %10
%16 = add i32 %15, %13
%17 = shl i32 %16, 3
%18 = add i32 %17, %11
%19 = tail call i64 @malloc(i32 %18)
%20 = inttoptr i64 %19 to double*
%21 = icmp eq i64 %19, 0
br i1 %21, label %22, label %25
22: ; preds = %3
%23 = load i32, i32* @stderr
%24 = tail call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
br label %189
25: ; preds = %3
%26 = zext i32 %12 to i64
%27 = getelementptr inbounds double, double* %20, i64 %26
%28 = getelementptr inbounds double, double* %27, i64 %26
%29 = sext i32 %2 to i64
%30 = getelementptr inbounds double, double* %28, i64 %29
%31 = getelementptr inbounds double, double* %30, i64 %26
%32 = icmp sgt i32 %2, 0
br i1 %32, label %33, label %73
33: ; preds = %25
%34 = zext i32 %2 to i64
%35 = and i64 %34, 1
%36 = icmp eq i32 %2, 1
%37 = and i64 %34, 4294967294
%38 = icmp eq i64 %35, 0
br label %39
39: ; preds = %70, %33
%40 = phi i64 [ 0, %33 ], [ %71, %70 ]
%41 = mul nsw i64 %40, %29
br i1 %36, label %61, label %42
42: ; preds = %39, %42
%43 = phi i64 [ %58, %42 ], [ 0, %39 ]
%44 = phi i64 [ %59, %42 ], [ 0, %39 ]
%45 = add nsw i64 %43, %41
%46 = getelementptr inbounds double, double* %0, i64 %45
%47 = load double, double* %46
%48 = mul nsw i64 %43, %29
%49 = add nsw i64 %48, %40
%50 = getelementptr inbounds double, double* %20, i64 %49
store double %47, double* %50
%51 = or i64 %43, 1
%52 = add nsw i64 %51, %41
%53 = getelementptr inbounds double, double* %0, i64 %52
%54 = load double, double* %53
%55 = mul nsw i64 %51, %29
%56 = add nsw i64 %55, %40
%57 = getelementptr inbounds double, double* %20, i64 %56
store double %54, double* %57
%58 = add nuw nsw i64 %43, 2
%59 = add i64 %44, 2
%60 = icmp eq i64 %59, %37
br i1 %60, label %61, label %42
61: ; preds = %42, %39
%62 = phi i64 [ 0, %39 ], [ %58, %42 ]
br i1 %38, label %70, label %63
63: ; preds = %61
%64 = add nsw i64 %62, %41
%65 = getelementptr inbounds double, double* %0, i64 %64
%66 = load double, double* %65
%67 = mul nsw i64 %62, %29
%68 = add nsw i64 %67, %40
%69 = getelementptr inbounds double, double* %20, i64 %68
store double %66, double* %69
br label %70
70: ; preds = %61, %63
%71 = add nuw nsw i64 %40, 1
%72 = icmp eq i64 %71, %34
br i1 %72, label %73, label %39
73: ; preds = %70, %25
%74 = call i32 @dgesvd_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32* %5, i32* %5, double* %20, i32* %5, double* %28, double* %27, i32* %5, double* %30, i32* %5, double* %31, i32* %7, i32* %6)
%75 = load i32, i32* %6
%76 = icmp eq i32 %75, 0
br i1 %76, label %87, label %77
77: ; preds = %73
%78 = icmp slt i32 %75, 0
%79 = load i32, i32* @stderr
br i1 %78, label %80, label %83
80: ; preds = %77
%81 = sub nsw i32 0, %75
%82 = call i32 (i32, i8*, ...) @fprintf(i32 %79, i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str.2, i64 0, i64 0), i32 %81)
br label %85
83: ; preds = %77
%84 = call i32 (i32, i8*, ...) @fprintf(i32 %79, i8* getelementptr inbounds ([103 x i8], [103 x i8]* @.str.3, i64 0, i64 0), i32 %75)
br label %85
85: ; preds = %83, %80
%86 = call i32 @free(double* %20)
br label %189
87: ; preds = %73
%88 = load double, double* @dlevmar_pseudoinverse.eps
%89 = fcmp olt double %88, 0.000000e+00
br i1 %89, label %90, label %106
90: ; preds = %87, %100
%91 = phi double [ %103, %100 ], [ 1.000000e+00, %87 ]
%92 = fmul double %91, 5.000000e-01
%93 = fmul double %92, 5.000000e-01
%94 = fmul double %93, 5.000000e-01
%95 = fmul double %94, 5.000000e-01
%96 = fmul double %95, 5.000000e-01
%97 = fadd double %96, 1.000000e+00
%98 = fadd double %97, -1.000000e+00
%99 = fcmp ogt double %98, 0.000000e+00
br i1 %99, label %100, label %104
100: ; preds = %90
%101 = fmul double %96, 5.000000e-01
%102 = fmul double %101, 5.000000e-01
%103 = fmul double %102, 5.000000e-01
br label %90
104: ; preds = %90
%105 = fmul double %96, 2.000000e+00
store double %105, double* @dlevmar_pseudoinverse.eps
br label %106
106: ; preds = %104, %87
%107 = phi double [ %105, %104 ], [ %88, %87 ]
%108 = icmp eq i32 %12, 0
br i1 %108, label %111, label %109
109: ; preds = %106
%110 = shl nuw nsw i64 %26, 3
br label %111
111: ; preds = %109, %106
%112 = load double, double* %28
%113 = fmul double %107, %112
%114 = load i32, i32* %5
%115 = icmp sgt i32 %114, 0
br i1 %115, label %116, label %186
116: ; preds = %111
%117 = zext i32 %114 to i64
%118 = zext i32 %114 to i64
%119 = fcmp ogt double %112, %113
br i1 %119, label %120, label %186
120: ; preds = %116
%121 = and i64 %118, 1
%122 = icmp eq i32 %114, 1
%123 = and i64 %118, 4294967294
%124 = icmp eq i64 %121, 0
br label %125
125: ; preds = %120, %180
%126 = phi i64 [ %178, %180 ], [ 0, %120 ]
%127 = phi double [ %182, %180 ], [ %112, %120 ]
%128 = fdiv double 1.000000e+00, %127
%129 = mul nsw i64 %126, %117
br label %130
130: ; preds = %174, %125
%131 = phi i64 [ 0, %125 ], [ %175, %174 ]
%132 = add nuw nsw i64 %131, %129
%133 = getelementptr inbounds double, double* %27, i64 %132
br i1 %122, label %161, label %134
134: ; preds = %130, %134
%135 = phi i64 [ %158, %134 ], [ 0, %130 ]
%136 = phi i64 [ %159, %134 ], [ 0, %130 ]
%137 = mul nsw i64 %135, %117
%138 = add nuw nsw i64 %137, %126
%139 = getelementptr inbounds double, double* %30, i64 %138
%140 = load double, double* %139
%141 = load double, double* %133
%142 = fmul double %140, %141
%143 = add nuw nsw i64 %137, %131
%144 = getelementptr inbounds double, double* %1, i64 %143
%145 = load double, double* %144
%146 = call double @llvm.fmuladd.f64(double %142, double %128, double %145)
store double %146, double* %144
%147 = or i64 %135, 1
%148 = mul nsw i64 %147, %117
%149 = add nuw nsw i64 %148, %126
%150 = getelementptr inbounds double, double* %30, i64 %149
%151 = load double, double* %150
%152 = load double, double* %133
%153 = fmul double %151, %152
%154 = add nuw nsw i64 %148, %131
%155 = getelementptr inbounds double, double* %1, i64 %154
%156 = load double, double* %155
%157 = call double @llvm.fmuladd.f64(double %153, double %128, double %156)
store double %157, double* %155
%158 = add nuw nsw i64 %135, 2
%159 = add i64 %136, 2
%160 = icmp eq i64 %159, %123
br i1 %160, label %161, label %134
161: ; preds = %134, %130
%162 = phi i64 [ 0, %130 ], [ %158, %134 ]
br i1 %124, label %174, label %163
163: ; preds = %161
%164 = mul nsw i64 %162, %117
%165 = add nuw nsw i64 %164, %126
%166 = getelementptr inbounds double, double* %30, i64 %165
%167 = load double, double* %166
%168 = load double, double* %133
%169 = fmul double %167, %168
%170 = add nuw nsw i64 %164, %131
%171 = getelementptr inbounds double, double* %1, i64 %170
%172 = load double, double* %171
%173 = call double @llvm.fmuladd.f64(double %169, double %128, double %172)
store double %173, double* %171
br label %174
174: ; preds = %161, %163
%175 = add nuw nsw i64 %131, 1
%176 = icmp eq i64 %175, %118
br i1 %176, label %177, label %130
177: ; preds = %174
%178 = add nuw nsw i64 %126, 1
%179 = icmp eq i64 %178, %118
br i1 %179, label %186, label %180
180: ; preds = %177
%181 = getelementptr inbounds double, double* %28, i64 %178
%182 = load double, double* %181
%183 = fcmp ogt double %182, %113
br i1 %183, label %125, label %184
184: ; preds = %180
%185 = trunc i64 %178 to i32
br label %186
186: ; preds = %177, %116, %184, %111
%187 = phi i32 [ 0, %111 ], [ %185, %184 ], [ 0, %116 ], [ %114, %177 ]
%188 = call i32 @free(double* %20)
br label %189
189: ; preds = %186, %85, %22
%190 = phi i32 [ 0, %85 ], [ %187, %186 ], [ 0, %22 ]
ret i32 %190
}