#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*/ Adjoint(double **, double **);
int /*<<< orphan*/ FKinSpace(double **, int, double *, double *, double **);
int /*<<< orphan*/ JacobianSpace(int, double *, double *, double *);
int /*<<< orphan*/ Matrix4Mult(double **, double **, double **);
int /*<<< orphan*/ MatrixCopy(double *, int, int, double *);
int /*<<< orphan*/ MatrixLog6(double **, double **);
int /*<<< orphan*/ MatrixMult(double *, int, int, double *, int, double *);
int /*<<< orphan*/ MatrixPinv(double *, int, int, double, double *);
int /*<<< orphan*/ TransInv(double **, double **);
double VecNorm2(int, double *);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ se3ToVec(double **, double *);
int IKinSpaceNR(int JointNum, double *Slist, double M[4][4], double T[4][4],
                double *thetalist0, double eomg, double ev, int maxiter,
                double *thetalist) {
  int i, j;
  double Tsb[4][4];
  double iTsb[4][4];
  double Tbd[4][4];
  double AdT[6][6];
  double se3Mat[4][4];
  double Vb[6];
  double Vs[6];
  int ErrFlag;
  double *Js = (double *)malloc(JointNum * 6 * sizeof(double));
  if (Js == NULL) {
    return 2;
  }
  double *pJs = (double *)malloc(JointNum * 6 * sizeof(double));
  if (pJs == NULL) {
    free(Js);
    return 2;
  }
  double *dtheta = (double *)malloc(JointNum * sizeof(double));
  if (dtheta == NULL) {
    free(Js);
    free(pJs);
    return 2;
  }
  MatrixCopy(thetalist0, JointNum, 1, thetalist);
  FKinSpace(M, JointNum, Slist, thetalist, Tsb);
  TransInv(Tsb, iTsb);
  Matrix4Mult(iTsb, T, Tbd);
  MatrixLog6(Tbd, se3Mat);
  se3ToVec(se3Mat, Vb);
  Adjoint(Tsb, AdT);
  MatrixMult((double *)AdT, 6, 6, Vb, 1, Vs);
  ErrFlag = VecNorm2(3, &Vs[0]) > eomg || VecNorm2(3, &Vs[3]) > ev;
  i = 0;
  printf("iteration:%4d  thetalist:  ", i);
  int k;
  for (k = 0; k < JointNum; k++) {
    printf("%4.4lf, ", thetalist[k]);
  }
  printf("\n");
  while (ErrFlag && i < maxiter) {
    JacobianSpace(JointNum, Slist, thetalist, Js);
    MatrixPinv(Js, 6, JointNum, 2.2E-15, pJs);
    MatrixMult(pJs, JointNum, 6, Vs, 1, dtheta);
    for (j = 0; j < JointNum; j++) {
      thetalist[j] = thetalist[j] + dtheta[j];
    }
    i++;
    FKinSpace(M, JointNum, Slist, thetalist, Tsb);
    TransInv(Tsb, iTsb);
    Matrix4Mult(iTsb, T, Tbd);
    MatrixLog6(Tbd, se3Mat);
    se3ToVec(se3Mat, Vb);
    Adjoint(Tsb, AdT);
    MatrixMult((double *)AdT, 6, 6, Vb, 1, Vs);
    ErrFlag = VecNorm2(3, &Vs[0]) > eomg || VecNorm2(3, &Vs[3]) > ev;
    printf("iteration:%4d  thetalist:  ", i);
    for (k = 0; k < JointNum; k++) {
      printf("%4.4lf, ", thetalist[k]);
    }
    printf("\n");
  }
  free(Js);
  free(pJs);
  free(dtheta);
  return ErrFlag;
}


x86 assembly (clang, -O0):
<IKinSpaceNR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movsd  %xmm0,-0x30(%rbp)
movsd  %xmm1,-0x38(%rbp)
mov    %r9d,-0x3c(%rbp)
imul   $0x6,-0x8(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x3e0(%rbp)
cmpq   $0x0,-0x3e0(%rbp)
jne    1242 <IKinSpaceNR+0x62>
movl   $0x2,-0x4(%rbp)
jmp    16d1 <IKinSpaceNR+0x4f1>
imul   $0x6,-0x8(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x3e8(%rbp)
cmpq   $0x0,-0x3e8(%rbp)
jne    1280 <IKinSpaceNR+0xa0>
mov    -0x3e0(%rbp),%rdi
call   1030 <free@plt>
movl   $0x2,-0x4(%rbp)
jmp    16d1 <IKinSpaceNR+0x4f1>
movslq -0x8(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x3f0(%rbp)
cmpq   $0x0,-0x3f0(%rbp)
jne    12c8 <IKinSpaceNR+0xe8>
mov    -0x3e0(%rbp),%rdi
call   1030 <free@plt>
mov    -0x3e8(%rbp),%rdi
call   1030 <free@plt>
movl   $0x2,-0x4(%rbp)
jmp    16d1 <IKinSpaceNR+0x4f1>
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    0x10(%rbp),%rcx
mov    $0x1,%edx
call   1060 <MatrixCopy@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    0x10(%rbp),%rcx
lea    -0xd0(%rbp),%r8
call   10d0 <FKinSpace@plt>
lea    -0xd0(%rbp),%rdi
lea    -0x150(%rbp),%rsi
call   10c0 <TransInv@plt>
lea    -0x150(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0x1d0(%rbp),%rdx
call   1040 <Matrix4Mult@plt>
lea    -0x1d0(%rbp),%rdi
lea    -0x370(%rbp),%rsi
call   10f0 <MatrixLog6@plt>
lea    -0x370(%rbp),%rdi
lea    -0x3a0(%rbp),%rsi
call   1080 <se3ToVec@plt>
lea    -0xd0(%rbp),%rdi
lea    -0x2f0(%rbp),%rsi
call   1090 <Adjoint@plt>
lea    -0x2f0(%rbp),%rdi
lea    -0x3a0(%rbp),%rcx
lea    -0x3d0(%rbp),%r9
mov    $0x6,%edx
mov    $0x1,%r8d
mov    %edx,%esi
call   10a0 <MatrixMult@plt>
lea    -0x3d0(%rbp),%rsi
mov    $0x3,%edi
call   10e0 <VecNorm2@plt>
mov    $0x1,%al
ucomisd -0x30(%rbp),%xmm0
mov    %al,-0x3f5(%rbp)
ja     13c9 <IKinSpaceNR+0x1e9>
lea    -0x3d0(%rbp),%rsi
add    $0x18,%rsi
mov    $0x3,%edi
call   10e0 <VecNorm2@plt>
ucomisd -0x38(%rbp),%xmm0
seta   %al
mov    %al,-0x3f5(%rbp)
mov    -0x3f5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x3d4(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%esi
lea    0xc1d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x3f4(%rbp)
mov    -0x3f4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    143d <IKinSpaceNR+0x25d>
mov    0x10(%rbp),%rax
movslq -0x3f4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xc02(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x3f4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3f4(%rbp)
jmp    13fc <IKinSpaceNR+0x21c>
lea    0xbe9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
cmpl   $0x0,-0x3d4(%rbp)
mov    %al,-0x3f6(%rbp)
je     146f <IKinSpaceNR+0x28f>
mov    -0x40(%rbp),%eax
cmp    -0x3c(%rbp),%eax
setl   %al
mov    %al,-0x3f6(%rbp)
mov    -0x3f6(%rbp),%al
test   $0x1,%al
jne    1482 <IKinSpaceNR+0x2a2>
jmp    16a4 <IKinSpaceNR+0x4c4>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    0x10(%rbp),%rdx
mov    -0x3e0(%rbp),%rcx
call   1070 <JacobianSpace@plt>
mov    -0x3e0(%rbp),%rdi
mov    -0x8(%rbp),%edx
mov    -0x3e8(%rbp),%rcx
mov    $0x6,%esi
movsd  0xb49(%rip),%xmm0
call   1100 <MatrixPinv@plt>
mov    -0x3e8(%rbp),%rdi
mov    -0x8(%rbp),%esi
lea    -0x3d0(%rbp),%rcx
mov    -0x3f0(%rbp),%r9
mov    $0x6,%edx
mov    $0x1,%r8d
call   10a0 <MatrixMult@plt>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    152f <IKinSpaceNR+0x34f>
mov    0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x3f0(%rbp),%rax
movslq -0x44(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    14eb <IKinSpaceNR+0x30b>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    0x10(%rbp),%rcx
lea    -0xd0(%rbp),%r8
call   10d0 <FKinSpace@plt>
lea    -0xd0(%rbp),%rdi
lea    -0x150(%rbp),%rsi
call   10c0 <TransInv@plt>
lea    -0x150(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0x1d0(%rbp),%rdx
call   1040 <Matrix4Mult@plt>
lea    -0x1d0(%rbp),%rdi
lea    -0x370(%rbp),%rsi
call   10f0 <MatrixLog6@plt>
lea    -0x370(%rbp),%rdi
lea    -0x3a0(%rbp),%rsi
call   1080 <se3ToVec@plt>
lea    -0xd0(%rbp),%rdi
lea    -0x2f0(%rbp),%rsi
call   1090 <Adjoint@plt>
lea    -0x2f0(%rbp),%rdi
lea    -0x3a0(%rbp),%rcx
lea    -0x3d0(%rbp),%r9
mov    $0x6,%edx
mov    $0x1,%r8d
mov    %edx,%esi
call   10a0 <MatrixMult@plt>
lea    -0x3d0(%rbp),%rsi
mov    $0x3,%edi
call   10e0 <VecNorm2@plt>
mov    $0x1,%al
ucomisd -0x30(%rbp),%xmm0
mov    %al,-0x3f7(%rbp)
ja     1624 <IKinSpaceNR+0x444>
lea    -0x3d0(%rbp),%rsi
add    $0x18,%rsi
mov    $0x3,%edi
call   10e0 <VecNorm2@plt>
ucomisd -0x38(%rbp),%xmm0
seta   %al
mov    %al,-0x3f7(%rbp)
mov    -0x3f7(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x3d4(%rbp)
mov    -0x40(%rbp),%esi
lea    0x9c9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x3f4(%rbp)
mov    -0x3f4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1691 <IKinSpaceNR+0x4b1>
mov    0x10(%rbp),%rax
movslq -0x3f4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0x9ae(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x3f4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3f4(%rbp)
jmp    1650 <IKinSpaceNR+0x470>
lea    0x995(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    144b <IKinSpaceNR+0x26b>
mov    -0x3e0(%rbp),%rdi
call   1030 <free@plt>
mov    -0x3e8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x3f0(%rbp),%rdi
call   1030 <free@plt>
mov    -0x3d4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IKinSpaceNR>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    %r9d,0x14(%rsp)
movsd  %xmm1,0x30(%rsp)
movsd  %xmm0,0x48(%rsp)
mov    %r8,%r13
mov    %rcx,0x40(%rsp)
mov    %rdx,0x38(%rsp)
mov    %rsi,0x28(%rsp)
mov    %rdi,0x50(%rsp)
mov    %edi,%eax
shl    $0x4,%eax
lea    (%rax,%rax,2),%ebp
mov    %ebp,%edi
call   10c0 <malloc@plt>
mov    $0x2,%r14d
mov    %rax,0x18(%rsp)
test   %rax,%rax
je     17ea <IKinSpaceNR+0x5fa>
mov    %ebp,%edi
call   10c0 <malloc@plt>
mov    %rax,0x20(%rsp)
test   %rax,%rax
je     17b0 <IKinSpaceNR+0x5c0>
mov    0x50(%rsp),%rbx
lea    0x0(,%rbx,8),%edi
call   10c0 <malloc@plt>
test   %rax,%rax
je     17b7 <IKinSpaceNR+0x5c7>
mov    %rax,%r15
mov    0x440(%rsp),%r12
movl   $0x1,0x10(%rsp)
mov    %r13,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1070 <MatrixCopy@plt>
lea    0xe0(%rsp),%rbp
mov    0x38(%rsp),%rdi
mov    %ebx,%esi
mov    0x28(%rsp),%rdx
mov    %r12,%rcx
mov    %rbp,%r8
call   10e0 <FKinSpace@plt>
mov    %rbx,%r14
lea    0x260(%rsp),%rbx
mov    %rbp,%rdi
mov    %rbx,%rsi
call   10d0 <TransInv@plt>
lea    0x1e0(%rsp),%r13
mov    %rbx,%rdi
mov    0x40(%rsp),%rsi
mov    %r13,%rdx
call   1050 <Matrix4Mult@plt>
lea    0x160(%rsp),%rbp
mov    %r13,%rdi
mov    %rbp,%rsi
call   1100 <MatrixLog6@plt>
lea    0xb0(%rsp),%rbx
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1090 <se3ToVec@plt>
lea    0x2e0(%rsp),%rbp
lea    0xe0(%rsp),%rdi
mov    %rbp,%rsi
call   10a0 <Adjoint@plt>
lea    0x80(%rsp),%r13
mov    %rbp,%rdi
mov    $0x6,%esi
mov    $0x6,%edx
mov    %rbx,%rcx
mov    $0x1,%r8d
mov    %r13,%r9
call   10b0 <MatrixMult@plt>
mov    $0x3,%edi
mov    %r13,%rsi
call   10f0 <VecNorm2@plt>
ucomisd 0x48(%rsp),%xmm0
ja     1387 <IKinSpaceNR+0x197>
lea    0x98(%rsp),%rsi
mov    $0x3,%edi
call   10f0 <VecNorm2@plt>
xor    %eax,%eax
ucomisd 0x30(%rsp),%xmm0
seta   %al
mov    %eax,0x10(%rsp)
lea    0xc7a(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14d,%ebx
test   %r14d,%r14d
jle    13c9 <IKinSpaceNR+0x1d9>
xor    %ebp,%ebp
lea    0xc7c(%rip),%r13
nopl   0x0(%rax,%rax,1)
movsd  (%r12,%rbp,8),%xmm0
mov    %r13,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    13b0 <IKinSpaceNR+0x1c0>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    0x10(%rsp),%r14d
test   %r14d,%r14d
je     17ce <IKinSpaceNR+0x5de>
cmpl   $0x0,0x14(%rsp)
jle    17ce <IKinSpaceNR+0x5de>
lea    (%r12,%rbx,8),%rax
lea    (%r15,%rbx,8),%rcx
mov    %ebx,%edx
and    $0xfffffffc,%edx
mov    %rdx,0x70(%rsp)
add    $0xfffffffffffffffc,%rdx
mov    %rdx,0x68(%rsp)
shr    $0x2,%rdx
add    $0x1,%rdx
cmp    %r12,%rcx
seta   %cl
cmp    %rax,%r15
setb   %al
and    %cl,%al
mov    %al,0xe(%rsp)
mov    %rdx,%rax
mov    %rdx,0x60(%rsp)
and    $0xfffffffffffffffe,%rdx
mov    %rdx,0x58(%rsp)
mov    %ebx,%eax
and    $0x3,%eax
mov    %rax,0x78(%rsp)
movl   $0x0,0x10(%rsp)
mov    0x28(%rsp),%r13
jmp    1473 <IKinSpaceNR+0x283>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1040 <putchar@plt>
cmp    0x14(%rsp),%r13d
setl   %al
mov    0xf(%rsp),%cl
test   %al,%cl
mov    0x28(%rsp),%r13
je     17c8 <IKinSpaceNR+0x5d8>
mov    0x50(%rsp),%r14
mov    %r14d,%edi
mov    %r13,%rsi
mov    %r12,%rdx
mov    0x18(%rsp),%rbp
mov    %rbp,%rcx
call   1080 <JacobianSpace@plt>
mov    %rbp,%rdi
mov    $0x6,%esi
mov    %r14d,%edx
movsd  0xb5f(%rip),%xmm0
mov    0x20(%rsp),%rbp
mov    %rbp,%rcx
call   1110 <MatrixPinv@plt>
mov    %rbp,%rdi
mov    %r14d,%esi
mov    $0x6,%edx
lea    0x80(%rsp),%rcx
mov    $0x1,%r8d
mov    %r15,%r9
call   10b0 <MatrixMult@plt>
test   %r14d,%r14d
mov    0x10(%rsp),%edi
jle    166a <IKinSpaceNR+0x47a>
cmp    $0x4,%r14d
setb   %al
or     0xe(%rsp),%al
je     14f0 <IKinSpaceNR+0x300>
xor    %eax,%eax
jmp    15c2 <IKinSpaceNR+0x3d2>
cmpq   $0x0,0x68(%rsp)
je     179e <IKinSpaceNR+0x5ae>
mov    0x58(%rsp),%rcx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movupd (%r15,%rax,8),%xmm0
movupd 0x10(%r15,%rax,8),%xmm1
movupd (%r12,%rax,8),%xmm2
addpd  %xmm0,%xmm2
movupd 0x10(%r12,%rax,8),%xmm0
addpd  %xmm1,%xmm0
movupd 0x20(%r12,%rax,8),%xmm1
movupd 0x30(%r12,%rax,8),%xmm3
movupd %xmm2,(%r12,%rax,8)
movupd %xmm0,0x10(%r12,%rax,8)
movupd 0x20(%r15,%rax,8),%xmm0
addpd  %xmm1,%xmm0
movupd 0x30(%r15,%rax,8),%xmm1
addpd  %xmm3,%xmm1
movupd %xmm0,0x20(%r12,%rax,8)
movupd %xmm1,0x30(%r12,%rax,8)
add    $0x8,%rax
add    $0xfffffffffffffffe,%rcx
jne    1510 <IKinSpaceNR+0x320>
testb  $0x1,0x60(%rsp)
je     15b1 <IKinSpaceNR+0x3c1>
movupd (%r12,%rax,8),%xmm0
movupd 0x10(%r12,%rax,8),%xmm1
movupd (%r15,%rax,8),%xmm2
addpd  %xmm0,%xmm2
movupd 0x10(%r15,%rax,8),%xmm0
addpd  %xmm1,%xmm0
movupd %xmm2,(%r12,%rax,8)
movupd %xmm0,0x10(%r12,%rax,8)
mov    0x70(%rsp),%rcx
mov    %rcx,%rax
cmp    %rbx,%rcx
je     166a <IKinSpaceNR+0x47a>
mov    %rax,%rcx
not    %rcx
add    %rbx,%rcx
mov    0x78(%rsp),%rsi
test   %rsi,%rsi
je     15fc <IKinSpaceNR+0x40c>
cs nopw 0x0(%rax,%rax,1)
nop
movsd  (%r12,%rax,8),%xmm0
addsd  (%r15,%rax,8),%xmm0
movsd  %xmm0,(%r12,%rax,8)
add    $0x1,%rax
add    $0xffffffffffffffff,%rsi
jne    15e0 <IKinSpaceNR+0x3f0>
cmp    $0x3,%rcx
jb     166a <IKinSpaceNR+0x47a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%r12,%rax,8),%xmm0
addsd  (%r15,%rax,8),%xmm0
movsd  0x8(%r12,%rax,8),%xmm1
movsd  %xmm0,(%r12,%rax,8)
addsd  0x8(%r15,%rax,8),%xmm1
movsd  %xmm1,0x8(%r12,%rax,8)
movsd  0x10(%r12,%rax,8),%xmm0
addsd  0x10(%r15,%rax,8),%xmm0
movsd  %xmm0,0x10(%r12,%rax,8)
movsd  0x18(%r12,%rax,8),%xmm0
addsd  0x18(%r15,%rax,8),%xmm0
movsd  %xmm0,0x18(%r12,%rax,8)
add    $0x4,%rax
cmp    %rax,%rbx
jne    1610 <IKinSpaceNR+0x420>
add    $0x1,%edi
mov    %edi,0x10(%rsp)
mov    0x38(%rsp),%rdi
mov    %r14d,%esi
mov    %r13,%rdx
mov    %r12,%rcx
lea    0xe0(%rsp),%rbp
mov    %rbp,%r8
call   10e0 <FKinSpace@plt>
mov    %rbp,%rdi
lea    0x260(%rsp),%rbp
mov    %rbp,%rsi
call   10d0 <TransInv@plt>
mov    %rbp,%rdi
mov    0x40(%rsp),%rsi
lea    0x1e0(%rsp),%rbp
mov    %rbp,%rdx
call   1050 <Matrix4Mult@plt>
mov    %rbp,%rdi
lea    0x160(%rsp),%rbp
mov    %rbp,%rsi
call   1100 <MatrixLog6@plt>
mov    %rbp,%rdi
lea    0xb0(%rsp),%r13
mov    %r13,%rsi
call   1090 <se3ToVec@plt>
lea    0xe0(%rsp),%rdi
lea    0x2e0(%rsp),%rbp
mov    %rbp,%rsi
call   10a0 <Adjoint@plt>
mov    %rbp,%rdi
mov    $0x6,%esi
mov    $0x6,%edx
mov    %r13,%rcx
mov    $0x1,%r8d
lea    0x80(%rsp),%rbp
mov    %rbp,%r9
call   10b0 <MatrixMult@plt>
mov    $0x3,%edi
mov    %rbp,%rsi
call   10f0 <VecNorm2@plt>
mov    $0x1,%al
ucomisd 0x48(%rsp),%xmm0
ja     1750 <IKinSpaceNR+0x560>
mov    $0x3,%edi
lea    0x98(%rsp),%rsi
call   10f0 <VecNorm2@plt>
ucomisd 0x30(%rsp),%xmm0
seta   %al
mov    %al,0xf(%rsp)
lea    0x8ad(%rip),%rdi
mov    0x10(%rsp),%r13d
mov    %r13d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
test   %r14d,%r14d
lea    0x8b0(%rip),%rbp
jle    1450 <IKinSpaceNR+0x260>
xor    %r14d,%r14d
nopl   (%rax)
movsd  (%r12,%r14,8),%xmm0
mov    %rbp,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
add    $0x1,%r14
cmp    %r14,%rbx
jne    1780 <IKinSpaceNR+0x590>
jmp    1450 <IKinSpaceNR+0x260>
xor    %eax,%eax
testb  $0x1,0x60(%rsp)
jne    1582 <IKinSpaceNR+0x392>
jmp    15b1 <IKinSpaceNR+0x3c1>
mov    0x18(%rsp),%rdi
jmp    17e5 <IKinSpaceNR+0x5f5>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    0x20(%rsp),%rdi
jmp    17e5 <IKinSpaceNR+0x5f5>
mov    %ecx,%eax
movzbl %cl,%r14d
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    0x20(%rsp),%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14d,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [28 x i8] c"iteration:%4d thetalist: \00"
@.str.1 = [9 x i8] c"%4.4lf, \00"
define i32 @IKinSpaceNR(i32 %0, double* %1, [4 x double]* %2, [4 x double]* %3, double* %4, double %5, double %6, i32 %7, double* %8) {
%10 = alloca [4 x [4 x double]]
%11 = alloca [4 x [4 x double]]
%12 = alloca [4 x [4 x double]]
%13 = alloca [6 x [6 x double]]
%14 = alloca [4 x [4 x double]]
%15 = alloca [6 x double]
%16 = alloca [6 x double]
%17 = bitcast [4 x [4 x double]]* %10 to i8*
%18 = bitcast [4 x [4 x double]]* %11 to i8*
%19 = bitcast [4 x [4 x double]]* %12 to i8*
%20 = bitcast [6 x [6 x double]]* %13 to i8*
%21 = bitcast [4 x [4 x double]]* %14 to i8*
%22 = bitcast [6 x double]* %15 to i8*
%23 = bitcast [6 x double]* %16 to i8*
%24 = mul i32 %0, 48
%25 = tail call i64 @malloc(i32 %24)
%26 = inttoptr i64 %25 to double*
%27 = icmp eq i64 %25, 0
br i1 %27, label %257, label %28
28: ; preds = %9
%29 = tail call i64 @malloc(i32 %24)
%30 = inttoptr i64 %29 to double*
%31 = icmp eq i64 %29, 0
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = tail call i32 @free(double* %26)
br label %257
34: ; preds = %28
%35 = shl i32 %0, 3
%36 = tail call i64 @malloc(i32 %35)
%37 = inttoptr i64 %36 to double*
%38 = inttoptr i64 %36 to i8*
%39 = icmp eq i64 %36, 0
br i1 %39, label %40, label %43
40: ; preds = %34
%41 = tail call i32 @free(double* %26)
%42 = tail call i32 @free(double* %30)
br label %257
43: ; preds = %34
%44 = tail call i32 @MatrixCopy(double* %4, i32 %0, i32 1, double* %8)
%45 = bitcast [4 x double]* %2 to double**
%46 = bitcast [4 x [4 x double]]* %10 to double**
%47 = call i32 @FKinSpace(double** %45, i32 %0, double* %1, double* %8, double** %46)
%48 = bitcast [4 x [4 x double]]* %11 to double**
%49 = call i32 @TransInv(double** %46, double** %48)
%50 = bitcast [4 x double]* %3 to double**
%51 = bitcast [4 x [4 x double]]* %12 to double**
%52 = call i32 @Matrix4Mult(double** %48, double** %50, double** %51)
%53 = bitcast [4 x [4 x double]]* %14 to double**
%54 = call i32 @MatrixLog6(double** %51, double** %53)
%55 = getelementptr inbounds [6 x double], [6 x double]* %15, i64 0, i64 0
%56 = call i32 @se3ToVec(double** %53, double* %55)
%57 = bitcast [6 x [6 x double]]* %13 to double**
%58 = call i32 @Adjoint(double** %46, double** %57)
%59 = getelementptr inbounds [6 x [6 x double]], [6 x [6 x double]]* %13, i64 0, i64 0, i64 0
%60 = getelementptr inbounds [6 x double], [6 x double]* %16, i64 0, i64 0
%61 = call i32 @MatrixMult(double* %59, i32 6, i32 6, double* %55, i32 1, double* %60)
%62 = call double @VecNorm2(i32 3, double* %60)
%63 = fcmp ogt double %62, %5
br i1 %63, label %69, label %64
64: ; preds = %43
%65 = getelementptr inbounds [6 x double], [6 x double]* %16, i64 0, i64 3
%66 = call double @VecNorm2(i32 3, double* %65)
%67 = fcmp ogt double %66, %6
%68 = zext i1 %67 to i32
br label %69
69: ; preds = %64, %43
%70 = phi i32 [ 1, %43 ], [ %68, %64 ]
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 0)
%72 = icmp sgt i32 %0, 0
br i1 %72, label %73, label %82
73: ; preds = %69
%74 = zext i32 %0 to i64
br label %75
75: ; preds = %73, %75
%76 = phi i64 [ 0, %73 ], [ %80, %75 ]
%77 = getelementptr inbounds double, double* %8, i64 %76
%78 = load double, double* %77
%79 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %78)
%80 = add nuw nsw i64 %76, 1
%81 = icmp eq i64 %80, %74
br i1 %81, label %82, label %75
82: ; preds = %75, %69
%83 = call i32 @putchar(i32 10)
%84 = icmp ne i32 %70, 0
%85 = icmp sgt i32 %7, 0
%86 = and i1 %84, %85
br i1 %86, label %87, label %252
87: ; preds = %82
%88 = getelementptr inbounds [6 x double], [6 x double]* %16, i64 0, i64 3
%89 = zext i32 %0 to i64
%90 = zext i32 %0 to i64
%91 = getelementptr double, double* %8, i64 %89
%92 = bitcast double* %91 to i8*
%93 = getelementptr double, double* %37, i64 %89
%94 = and i64 %89, 4294967292
%95 = add nsw i64 %94, -4
%96 = lshr exact i64 %95, 2
%97 = add nuw nsw i64 %96, 1
%98 = icmp ult i32 %0, 4
%99 = icmp ugt double* %93, %8
%100 = icmp ult i8* %38, %92
%101 = and i1 %99, %100
%102 = and i64 %89, 4294967292
%103 = and i64 %97, 1
%104 = icmp eq i64 %95, 0
%105 = and i64 %97, 9223372036854775806
%106 = icmp eq i64 %103, 0
%107 = icmp eq i64 %102, %89
%108 = and i64 %89, 3
%109 = icmp eq i64 %108, 0
br label %110
110: ; preds = %87, %246
%111 = phi i32 [ 0, %87 ], [ %223, %246 ]
%112 = call i32 @JacobianSpace(i32 %0, double* %1, double* %8, double* %26)
%113 = call i32 @MatrixPinv(double* %26, i32 6, i32 %0, double 2.200000e-15, double* %30)
%114 = call i32 @MatrixMult(double* %30, i32 %0, i32 6, double* %60, i32 1, double* %37)
br i1 %72, label %115, label %222
115: ; preds = %110
%116 = select i1 %98, i1 true, i1 %101
br i1 %116, label %177, label %117
117: ; preds = %115
br i1 %104, label %157, label %118
118: ; preds = %117, %118
%119 = phi i64 [ %154, %118 ], [ 0, %117 ]
%120 = phi i64 [ %155, %118 ], [ 0, %117 ]
%121 = getelementptr inbounds double, double* %8, i64 %119
%122 = bitcast double* %121 to <2 x double>*
%123 = load <2 x double>, <2 x double>* %122
%124 = getelementptr inbounds double, double* %121, i64 2
%125 = bitcast double* %124 to <2 x double>*
%126 = load <2 x double>, <2 x double>* %125
%127 = getelementptr inbounds double, double* %37, i64 %119
%128 = bitcast double* %127 to <2 x double>*
%129 = load <2 x double>, <2 x double>* %128
%130 = getelementptr inbounds double, double* %127, i64 2
%131 = bitcast double* %130 to <2 x double>*
%132 = load <2 x double>, <2 x double>* %131
%133 = fadd <2 x double> %123, %129
%134 = fadd <2 x double> %126, %132
%135 = bitcast double* %121 to <2 x double>*
store <2 x double> %133, <2 x double>* %135
%136 = bitcast double* %124 to <2 x double>*
store <2 x double> %134, <2 x double>* %136
%137 = or i64 %119, 4
%138 = getelementptr inbounds double, double* %8, i64 %137
%139 = bitcast double* %138 to <2 x double>*
%140 = load <2 x double>, <2 x double>* %139
%141 = getelementptr inbounds double, double* %138, i64 2
%142 = bitcast double* %141 to <2 x double>*
%143 = load <2 x double>, <2 x double>* %142
%144 = getelementptr inbounds double, double* %37, i64 %137
%145 = bitcast double* %144 to <2 x double>*
%146 = load <2 x double>, <2 x double>* %145
%147 = getelementptr inbounds double, double* %144, i64 2
%148 = bitcast double* %147 to <2 x double>*
%149 = load <2 x double>, <2 x double>* %148
%150 = fadd <2 x double> %140, %146
%151 = fadd <2 x double> %143, %149
%152 = bitcast double* %138 to <2 x double>*
store <2 x double> %150, <2 x double>* %152
%153 = bitcast double* %141 to <2 x double>*
store <2 x double> %151, <2 x double>* %153
%154 = add nuw i64 %119, 8
%155 = add i64 %120, 2
%156 = icmp eq i64 %155, %105
br i1 %156, label %157, label %118
157: ; preds = %118, %117
%158 = phi i64 [ 0, %117 ], [ %154, %118 ]
br i1 %106, label %176, label %159
159: ; preds = %157
%160 = getelementptr inbounds double, double* %8, i64 %158
%161 = bitcast double* %160 to <2 x double>*
%162 = load <2 x double>, <2 x double>* %161
%163 = getelementptr inbounds double, double* %160, i64 2
%164 = bitcast double* %163 to <2 x double>*
%165 = load <2 x double>, <2 x double>* %164
%166 = getelementptr inbounds double, double* %37, i64 %158
%167 = bitcast double* %166 to <2 x double>*
%168 = load <2 x double>, <2 x double>* %167
%169 = getelementptr inbounds double, double* %166, i64 2
%170 = bitcast double* %169 to <2 x double>*
%171 = load <2 x double>, <2 x double>* %170
%172 = fadd <2 x double> %162, %168
%173 = fadd <2 x double> %165, %171
%174 = bitcast double* %160 to <2 x double>*
store <2 x double> %172, <2 x double>* %174
%175 = bitcast double* %163 to <2 x double>*
store <2 x double> %173, <2 x double>* %175
br label %176
176: ; preds = %157, %159
br i1 %107, label %222, label %177
177: ; preds = %115, %176
%178 = phi i64 [ 0, %115 ], [ %102, %176 ]
%179 = xor i64 %178, -1
%180 = add nsw i64 %179, %89
br i1 %109, label %192, label %181
181: ; preds = %177, %181
%182 = phi i64 [ %189, %181 ], [ %178, %177 ]
%183 = phi i64 [ %190, %181 ], [ 0, %177 ]
%184 = getelementptr inbounds double, double* %8, i64 %182
%185 = load double, double* %184
%186 = getelementptr inbounds double, double* %37, i64 %182
%187 = load double, double* %186
%188 = fadd double %185, %187
store double %188, double* %184
%189 = add nuw nsw i64 %182, 1
%190 = add i64 %183, 1
%191 = icmp eq i64 %190, %108
br i1 %191, label %192, label %181
192: ; preds = %181, %177
%193 = phi i64 [ %178, %177 ], [ %189, %181 ]
%194 = icmp ult i64 %180, 3
br i1 %194, label %222, label %195
195: ; preds = %192, %195
%196 = phi i64 [ %220, %195 ], [ %193, %192 ]
%197 = getelementptr inbounds double, double* %8, i64 %196
%198 = load double, double* %197
%199 = getelementptr inbounds double, double* %37, i64 %196
%200 = load double, double* %199
%201 = fadd double %198, %200
store double %201, double* %197
%202 = add nuw nsw i64 %196, 1
%203 = getelementptr inbounds double, double* %8, i64 %202
%204 = load double, double* %203
%205 = getelementptr inbounds double, double* %37, i64 %202
%206 = load double, double* %205
%207 = fadd double %204, %206
store double %207, double* %203
%208 = add nuw nsw i64 %196, 2
%209 = getelementptr inbounds double, double* %8, i64 %208
%210 = load double, double* %209
%211 = getelementptr inbounds double, double* %37, i64 %208
%212 = load double, double* %211
%213 = fadd double %210, %212
store double %213, double* %209
%214 = add nuw nsw i64 %196, 3
%215 = getelementptr inbounds double, double* %8, i64 %214
%216 = load double, double* %215
%217 = getelementptr inbounds double, double* %37, i64 %214
%218 = load double, double* %217
%219 = fadd double %216, %218
store double %219, double* %215
%220 = add nuw nsw i64 %196, 4
%221 = icmp eq i64 %220, %89
br i1 %221, label %222, label %195
222: ; preds = %192, %195, %176, %110
%223 = add nuw nsw i32 %111, 1
%224 = call i32 @FKinSpace(double** %45, i32 %0, double* %1, double* %8, double** %46)
%225 = call i32 @TransInv(double** %46, double** %48)
%226 = call i32 @Matrix4Mult(double** %48, double** %50, double** %51)
%227 = call i32 @MatrixLog6(double** %51, double** %53)
%228 = call i32 @se3ToVec(double** %53, double* %55)
%229 = call i32 @Adjoint(double** %46, double** %57)
%230 = call i32 @MatrixMult(double* %59, i32 6, i32 6, double* %55, i32 1, double* %60)
%231 = call double @VecNorm2(i32 3, double* %60)
%232 = fcmp ogt double %231, %5
br i1 %232, label %236, label %233
233: ; preds = %222
%234 = call double @VecNorm2(i32 3, double* %88)
%235 = fcmp ogt double %234, %6
br label %236
236: ; preds = %233, %222
%237 = phi i1 [ true, %222 ], [ %235, %233 ]
%238 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %223)
br i1 %72, label %239, label %246
239: ; preds = %236, %239
%240 = phi i64 [ %244, %239 ], [ 0, %236 ]
%241 = getelementptr inbounds double, double* %8, i64 %240
%242 = load double, double* %241
%243 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %242)
%244 = add nuw nsw i64 %240, 1
%245 = icmp eq i64 %244, %90
br i1 %245, label %246, label %239
246: ; preds = %239, %236
%247 = call i32 @putchar(i32 10)
%248 = icmp slt i32 %223, %7
%249 = select i1 %237, i1 %248, i1 false
br i1 %249, label %110, label %250
250: ; preds = %246
%251 = zext i1 %237 to i32
br label %252
252: ; preds = %250, %82
%253 = phi i32 [ %70, %82 ], [ %251, %250 ]
%254 = call i32 @free(double* %26)
%255 = call i32 @free(double* %30)
%256 = call i32 @free(double* %37)
br label %257
257: ; preds = %32, %252, %40, %9
%258 = phi i32 [ 2, %9 ], [ 2, %32 ], [ 2, %40 ], [ %253, %252 ]
ret i32 %258
}