#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 */
float **convert_matrix(float *, int, int, int, int);
int /*<<< orphan*/ free_convert_matrix(float **, int, int, int, int);
int /*<<< orphan*/ free_matrix(float **, int, int, int, int);
int /*<<< orphan*/ free_vector(float *, int, int);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ jacobi(float **, int, float *, float **, int *);
float **matrix(int, int, int, int);
int /*<<< orphan*/ printf(char *, ...);
float *vector(int, int);
int main(void) {
  int i, j, k, kk, l, ll, nrot;
  static float a[3][3] = {1.0, 2.0, 3.0, 2.0, 2.0, 3.0, 3.0, 3.0, 3.0};
  static float b[5][5] = {-2.0, -1.0, 0.0, 1.0, 2.0, -1.0, -1.0, 0.0, 1.0,
                          2.0,  0.0,  0.0, 0.0, 1.0, 2.0,  1.0,  1.0, 1.0,
                          1.0,  2.0,  2.0, 2.0, 2.0, 2.0,  2.0};
  static float c[10][10] = {
      5.0,  4.3, 3.0, 2.0,  1.0,  0.0,  -1.0, -2.0, -3.0, -4.0, 4.3,  5.1,
      4.0,  3.0, 2.0, 1.0,  0.0,  -1.0, -2.0, -3.0, 3.0,  4.0,  5.0,  4.0,
      3.0,  2.0, 1.0, 0.0,  -1.0, -2.0, 2.0,  3.0,  4.0,  5.0,  4.0,  3.0,
      2.0,  1.0, 0.0, -1.0, 1.0,  2.0,  3.0,  4.0,  5.0,  4.0,  3.0,  2.0,
      1.0,  0.0, 0.0, 1.0,  2.0,  3.0,  4.0,  5.0,  4.0,  3.0,  2.0,  1.0,
      -1.0, 0.0, 1.0, 2.0,  3.0,  4.0,  5.0,  4.0,  3.0,  2.0,  -2.0, -1.0,
      0.0,  1.0, 2.0, 3.0,  4.0,  5.0,  4.0,  3.0,  -3.0, -2.0, -1.0, 0.0,
      1.0,  2.0, 3.0, 4.0,  5.0,  4.0,  -4.0, -3.0, -2.0, -1.0, 0.0,  1.0,
      2.0,  3.0, 4.0, 5.0};
  float *d, *r, **v, **e;
  static int num[4] = {0, 3, 5, 10};
  d = vector(1, 10);
  r = vector(1, 10);
  v = matrix(1, 10, 1, 10);
  for (i = 1; i <= 3; i++) {
    if (i == 1)
      e = convert_matrix(&a[0][0], 1, num[i], 1, num[i]);
    else if (i == 2)
      e = convert_matrix(&b[0][0], 1, num[i], 1, num[i]);
    else if (i == 3)
      e = convert_matrix(&c[0][0], 1, num[i], 1, num[i]);
    jacobi(e, num[i], d, v, &nrot);
    printf("matrix number %2d\n", i);
    printf("number of JACOBI rotations: %3d\n", nrot);
    printf("eigenvalues: \n");
    for (j = 1; j <= num[i]; j++) {
      printf("%12.6f", d[j]);
      if ((j % 5) == 0)
        printf("\n");
    }
    printf("\neigenvectors:\n");
    for (j = 1; j <= num[i]; j++) {
      printf("%9s %3d \n", "number", j);
      for (k = 1; k <= num[i]; k++) {
        printf("%12.6f", v[k][j]);
        if ((k % 5) == 0)
          printf("\n");
      }
      printf("\n");
    }
    printf("eigenvector test\n");
    for (j = 1; j <= num[i]; j++) {
      for (l = 1; l <= num[i]; l++) {
        r[l] = 0.0;
        for (k = 1; k <= num[i]; k++) {
          if (k > l) {
            kk = l;
            ll = k;
          } else {
            kk = k;
            ll = l;
          }
          r[l] += (e[ll][kk] * v[k][j]);
        }
      }
      printf("vector number %3d\n", j);
      printf("%11s %14s %10s\n", "vector", "mtrx*vec.", "ratio");
      for (l = 1; l <= num[i]; l++)
        printf("%12.6f %12.6f %12.6f\n", v[l][j], r[l], r[l] / v[l][j]);
    }
    printf("press RETURN to continue...\n");
    (void)getchar();
    free_convert_matrix(e, 1, num[i], 1, num[i]);
  }
  free_matrix(v, 1, 10, 1, 10);
  free_vector(r, 1, 10);
  free_vector(d, 1, 10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
mov    $0xa,%esi
call   10a0 <vector@plt>
mov    %rax,-0x28(%rbp)
mov    $0x1,%edi
mov    $0xa,%esi
call   10a0 <vector@plt>
mov    %rax,-0x30(%rbp)
mov    $0x1,%edx
mov    $0xa,%ecx
mov    %edx,%edi
mov    %ecx,%esi
call   1090 <matrix@plt>
mov    %rax,-0x38(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jg     1681 <main+0x4f1>
cmpl   $0x1,-0x8(%rbp)
jne    1230 <main+0xa0>
movslq -0x8(%rbp),%rcx
lea    0x309e(%rip),%rax
mov    (%rax,%rcx,4),%edx
movslq -0x8(%rbp),%rcx
lea    0x3090(%rip),%rax
mov    (%rax,%rcx,4),%r8d
lea    0x2e55(%rip),%rdi
mov    $0x1,%ecx
mov    %ecx,%esi
call   10b0 <convert_matrix@plt>
mov    %rax,-0x40(%rbp)
jmp    12bb <main+0x12b>
cmpl   $0x2,-0x8(%rbp)
jne    1273 <main+0xe3>
movslq -0x8(%rbp),%rcx
lea    0x305b(%rip),%rax
mov    (%rax,%rcx,4),%edx
movslq -0x8(%rbp),%rcx
lea    0x304d(%rip),%rax
mov    (%rax,%rcx,4),%r8d
lea    0x2e42(%rip),%rdi
mov    $0x1,%ecx
mov    %ecx,%esi
call   10b0 <convert_matrix@plt>
mov    %rax,-0x40(%rbp)
jmp    12b6 <main+0x126>
cmpl   $0x3,-0x8(%rbp)
jne    12b1 <main+0x121>
movslq -0x8(%rbp),%rcx
lea    0x3018(%rip),%rax
mov    (%rax,%rcx,4),%edx
movslq -0x8(%rbp),%rcx
lea    0x300a(%rip),%rax
mov    (%rax,%rcx,4),%r8d
lea    0x2e6f(%rip),%rdi
mov    $0x1,%ecx
mov    %ecx,%esi
call   10b0 <convert_matrix@plt>
mov    %rax,-0x40(%rbp)
jmp    12b6 <main+0x126>
jmp    12bb <main+0x12b>
mov    -0x40(%rbp),%rdi
movslq -0x8(%rbp),%rcx
lea    0x2fd6(%rip),%rax
mov    (%rax,%rcx,4),%esi
mov    -0x28(%rbp),%rdx
mov    -0x38(%rbp),%rcx
lea    -0x20(%rbp),%r8
call   1030 <jacobi@plt>
mov    -0x8(%rbp),%esi
lea    0xd18(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xd1a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd2d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
movslq -0x8(%rbp),%rdx
lea    0x2f7d(%rip),%rcx
cmp    (%rcx,%rdx,4),%eax
jg     1380 <main+0x1f0>
mov    -0x28(%rbp),%rax
movslq -0xc(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xcff(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    -0xc(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    136d <main+0x1dd>
lea    0xcdb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1372 <main+0x1e2>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1315 <main+0x185>
lea    0xcc3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
movslq -0x8(%rbp),%rdx
lea    0x2efd(%rip),%rcx
cmp    (%rcx,%rdx,4),%eax
jg     145a <main+0x2ca>
mov    -0xc(%rbp),%edx
lea    0xca4(%rip),%rdi
lea    0xca7(%rip),%rsi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
movslq -0x8(%rbp),%rdx
lea    0x2ec7(%rip),%rcx
cmp    (%rcx,%rdx,4),%eax
jg     143e <main+0x2ae>
mov    -0x38(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xc(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc41(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    142b <main+0x29b>
lea    0xc1d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1430 <main+0x2a0>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    13cb <main+0x23b>
lea    0xbfc(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1395 <main+0x205>
lea    0xc0a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
movslq -0x8(%rbp),%rdx
lea    0x2e23(%rip),%rcx
cmp    (%rcx,%rdx,4),%eax
jg     1631 <main+0x4a1>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
movslq -0x8(%rbp),%rdx
lea    0x2e05(%rip),%rcx
cmp    (%rcx,%rdx,4),%eax
jg     1560 <main+0x3d0>
mov    -0x30(%rbp),%rax
movslq -0x18(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
movslq -0x8(%rbp),%rdx
lea    0x2dd7(%rip),%rcx
cmp    (%rcx,%rdx,4),%eax
jg     154d <main+0x3bd>
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    14ef <main+0x35f>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    14fb <main+0x36b>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x40(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x14(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xc(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm2
mov    -0x30(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    14bb <main+0x32b>
jmp    1552 <main+0x3c2>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    148d <main+0x2fd>
mov    -0xc(%rbp),%esi
lea    0xb13(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xb18(%rip),%rdi
lea    0xb21(%rip),%rsi
lea    0xb21(%rip),%rdx
lea    0xb24(%rip),%rcx
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
movslq -0x8(%rbp),%rdx
lea    0x2cf7(%rip),%rcx
cmp    (%rcx,%rdx,4),%eax
jg     161e <main+0x48e>
mov    -0x38(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xc(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x30(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
cvtss2sd %xmm1,%xmm1
mov    -0x30(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm2
mov    -0x38(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xc(%rbp),%rcx
divss  (%rax,%rcx,4),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xaae(%rip),%rdi
mov    $0x3,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    159b <main+0x40b>
jmp    1623 <main+0x493>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    146f <main+0x2df>
lea    0xa95(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1080 <getchar@plt>
mov    -0x40(%rbp),%rdi
movslq -0x8(%rbp),%rcx
lea    0x2c4b(%rip),%rax
mov    (%rax,%rcx,4),%edx
movslq -0x8(%rbp),%rcx
lea    0x2c3d(%rip),%rax
mov    (%rax,%rcx,4),%r8d
mov    $0x1,%ecx
mov    %ecx,%esi
call   1040 <free_convert_matrix@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11e3 <main+0x53>
mov    -0x38(%rbp),%rdi
mov    $0x1,%ecx
mov    $0xa,%r8d
mov    %ecx,%esi
mov    %r8d,%edx
call   1050 <free_matrix@plt>
mov    -0x30(%rbp),%rdi
mov    $0x1,%esi
mov    $0xa,%edx
call   1070 <free_vector@plt>
mov    -0x28(%rbp),%rdi
mov    $0x1,%esi
mov    $0xa,%edx
call   1070 <free_vector@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    $0x1,%edi
mov    $0xa,%esi
call   10c0 <vector@plt>
mov    %rax,0x18(%rsp)
mov    $0x1,%edi
mov    $0xa,%esi
call   10c0 <vector@plt>
mov    %rax,0x38(%rsp)
mov    $0x1,%edi
mov    $0xa,%esi
mov    $0x1,%edx
mov    $0xa,%ecx
call   10b0 <matrix@plt>
mov    %rax,%r15
mov    $0x1,%ebp
nopw   0x0(%rax,%rax,1)
cmp    $0x3,%ebp
je     1260 <main+0xb0>
cmp    $0x2,%ebp
je     1240 <main+0x90>
cmp    $0x1,%ebp
jne    1284 <main+0xd4>
lea    0x2e5a(%rip),%rdi
mov    $0x1,%esi
mov    $0x3,%edx
mov    $0x1,%ecx
mov    $0x3,%r8d
jmp    127c <main+0xcc>
nopl   (%rax)
lea    0x2e69(%rip),%rdi
mov    $0x1,%esi
mov    $0x5,%edx
mov    $0x1,%ecx
mov    $0x5,%r8d
jmp    127c <main+0xcc>
xchg   %ax,%ax
lea    0x2eb9(%rip),%rdi
mov    $0x1,%esi
mov    $0xa,%edx
mov    $0x1,%ecx
mov    $0xa,%r8d
call   10d0 <convert_matrix@plt>
mov    %rax,%r13
lea    0xd75(%rip),%rax
mov    (%rax,%rbp,4),%ebx
mov    %r13,%rdi
mov    %ebx,%esi
mov    0x18(%rsp),%rdx
mov    %r15,%rcx
lea    0x24(%rsp),%r8
call   1040 <jacobi@plt>
lea    0xd64(%rip),%rdi
mov    %rbp,0x40(%rsp)
mov    %ebp,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x24(%rsp),%esi
lea    0xd5e(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xdd9(%rip),%rdi
call   1060 <puts@plt>
cmp    $0x2,%ebx
mov    $0x1,%r12d
mov    $0x1,%r14d
mov    %ebx,0xc(%rsp)
cmovge %ebx,%r14d
lea    0x1(%r14),%rax
mov    %rax,0x28(%rsp)
xor    %ebp,%ebp
jmp    130d <main+0x15d>
nopl   0x0(%rax)
add    $0x1,%rbp
add    $0x1,%r12d
cmp    %rbp,%r14
je     1350 <main+0x1a0>
mov    %r12d,%eax
mov    $0xcccccccd,%ecx
imul   %rcx,%rax
shr    $0x22,%rax
lea    (%rax,%rax,4),%ebx
add    $0xffffffff,%ebx
mov    0x18(%rsp),%rax
movss  0x4(%rax,%rbp,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd0b(%rip),%rdi
mov    $0x1,%al
call   1080 <printf@plt>
cmp    %ebp,%ebx
jne    1300 <main+0x150>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1300 <main+0x150>
lea    0xd63(%rip),%rdi
call   1060 <puts@plt>
mov    0xc(%rsp),%eax
cmp    $0x2,%eax
mov    $0x1,%ecx
cmovge %eax,%ecx
add    $0x1,%ecx
mov    %rcx,0x10(%rsp)
mov    0x28(%rsp),%rax
lea    -0x1(%rax),%rbx
mov    $0x1,%ebp
mov    %rbx,0x30(%rsp)
jmp    13a9 <main+0x1f9>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    0x10(%rsp),%rbp
je     1430 <main+0x280>
lea    0xc9b(%rip),%rdi
lea    0xc9e(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0x1,%r14d
xor    %r12d,%r12d
jmp    13e2 <main+0x232>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r12
add    $0x1,%r14d
mov    0x30(%rsp),%rbx
cmp    %r12,%rbx
je     1390 <main+0x1e0>
mov    %r14d,%eax
mov    $0xcccccccd,%ecx
imul   %rcx,%rax
shr    $0x22,%rax
lea    (%rax,%rax,4),%ebx
add    $0xffffffff,%ebx
mov    0x8(%r15,%r12,8),%rax
movss  (%rax,%rbp,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc37(%rip),%rdi
mov    $0x1,%al
call   1080 <printf@plt>
cmp    %r12d,%ebx
jne    13d0 <main+0x220>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    13d0 <main+0x220>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xc92(%rip),%rdi
call   1060 <puts@plt>
mov    0xc(%rsp),%eax
cmp    $0x2,%eax
mov    $0x1,%edi
cmovge %eax,%edi
add    $0x1,%edi
mov    $0x1,%r14d
mov    $0x1,%ebp
sub    0x28(%rsp),%rbp
mov    0x38(%rsp),%rbx
mov    %rdi,0x10(%rsp)
nopl   0x0(%rax,%rax,1)
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
nop
movl   $0x0,(%rbx,%rax,4)
mov    $0x1,%ecx
xorps  %xmm0,%xmm0
nop
cmp    %rax,%rcx
mov    %rax,%rdx
cmovb  %rcx,%rdx
mov    %rax,%rsi
cmova  %rcx,%rsi
mov    %esi,%esi
mov    0x0(%r13,%rsi,8),%rsi
mov    %edx,%edx
movss  (%rsi,%rdx,4),%xmm1
mov    (%r15,%rcx,8),%rdx
mulss  (%rdx,%r14,4),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,(%rbx,%rax,4)
lea    (%rcx,%rbp,1),%rdx
add    $0x1,%rdx
add    $0x1,%rcx
cmp    $0x1,%rdx
jne    1490 <main+0x2e0>
add    $0x1,%rax
cmp    %rdi,%rax
jne    1480 <main+0x2d0>
lea    0xb78(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xb7a(%rip),%rdi
lea    0xb83(%rip),%rsi
lea    0xb83(%rip),%rdx
lea    0xb86(%rip),%rcx
xor    %eax,%eax
call   1080 <printf@plt>
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x8(%r15,%r12,8),%rax
movss  (%rax,%r14,4),%xmm2
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
movss  0x4(%rbx,%r12,4),%xmm3
xorps  %xmm1,%xmm1
cvtss2sd %xmm3,%xmm1
divss  %xmm2,%xmm3
xorps  %xmm2,%xmm2
cvtss2sd %xmm3,%xmm2
lea    0xb44(%rip),%rdi
mov    $0x3,%al
call   1080 <printf@plt>
add    $0x1,%r12
cmp    %r12,0x30(%rsp)
jne    1520 <main+0x370>
add    $0x1,%r14
mov    0x10(%rsp),%rdi
cmp    %rdi,%r14
jne    1470 <main+0x2c0>
lea    0xb5d(%rip),%rdi
call   1060 <puts@plt>
xor    %eax,%eax
call   10a0 <getchar@plt>
mov    %r13,%rdi
mov    $0x1,%esi
mov    0xc(%rsp),%edx
mov    $0x1,%ecx
mov    %edx,%r8d
call   1050 <free_convert_matrix@plt>
mov    0x40(%rsp),%rbp
add    $0x1,%rbp
cmp    $0x4,%rbp
jne    1210 <main+0x60>
mov    %r15,%rdi
mov    $0x1,%esi
mov    $0xa,%edx
mov    $0x1,%ecx
mov    $0xa,%r8d
call   1070 <free_matrix@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0xa,%edx
call   1090 <free_vector@plt>
mov    0x18(%rsp),%rdi
mov    $0x1,%esi
mov    $0xa,%edx
call   1090 <free_vector@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@main.a = internal global [3 x [3 x float]] [[3 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00], [3 x float] [float 2.000000e+00, float 2.000000e+00, float 3.000000e+00], [3 x float] [float 3.000000e+00, float 3.000000e+00, float 3.000000e+00]]
@main.b = internal global [5 x [5 x float]] [[5 x float] [float -2.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 2.000000e+00], [5 x float] [float -1.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 2.000000e+00], [5 x float] [float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 1.000000e+00, float 2.000000e+00], [5 x float] [float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 2.000000e+00], [5 x float] [float 2.000000e+00, float 2.000000e+00, float 2.000000e+00, float 2.000000e+00, float 2.000000e+00]]
@main.c = internal global [10 x [10 x float]] [[10 x float] [float 5.000000e+00, float 0x4011333340000000, float 3.000000e+00, float 2.000000e+00, float 1.000000e+00, float 0.000000e+00, float -1.000000e+00, float -2.000000e+00, float -3.000000e+00, float -4.000000e+00], [10 x float] [float 0x4011333340000000, float 0x4014666660000000, float 4.000000e+00, float 3.000000e+00, float 2.000000e+00, float 1.000000e+00, float 0.000000e+00, float -1.000000e+00, float -2.000000e+00, float -3.000000e+00], [10 x float] [float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 4.000000e+00, float 3.000000e+00, float 2.000000e+00, float 1.000000e+00, float 0.000000e+00, float -1.000000e+00, float -2.000000e+00], [10 x float] [float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 4.000000e+00, float 3.000000e+00, float 2.000000e+00, float 1.000000e+00, float 0.000000e+00, float -1.000000e+00], [10 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 4.000000e+00, float 3.000000e+00, float 2.000000e+00, float 1.000000e+00, float 0.000000e+00], [10 x float] [float 0.000000e+00, float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 4.000000e+00, float 3.000000e+00, float 2.000000e+00, float 1.000000e+00], [10 x float] [float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 4.000000e+00, float 3.000000e+00, float 2.000000e+00], [10 x float] [float -2.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 4.000000e+00, float 3.000000e+00], [10 x float] [float -3.000000e+00, float -2.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 4.000000e+00], [10 x float] [float -4.000000e+00, float -3.000000e+00, float -2.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00]]
@main.num = internal global [4 x i32] [i32 0, i32 3, i32 5, i32 10]
@.str = [19 x i8] c"matrix number %2d\0A\00"
@.str.1 = [33 x i8] c"number of JACOBI rotations: %3d\0A\00"
@.str.2 = [15 x i8] c"eigenvalues: \0A\00"
@.str.3 = [7 x i8] c"%12.6f\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [16 x i8] c"\0Aeigenvectors:\0A\00"
@.str.6 = [10 x i8] c"%9s %3d \0A\00"
@.str.7 = [7 x i8] c"number\00"
@.str.8 = [18 x i8] c"eigenvector test\0A\00"
@.str.9 = [19 x i8] c"vector number %3d\0A\00"
@.str.10 = [16 x i8] c"%11s %14s %10s\0A\00"
@.str.11 = [7 x i8] c"vector\00"
@.str.12 = [10 x i8] c"mtrx*vec.\00"
@.str.13 = [6 x i8] c"ratio\00"
@.str.14 = [22 x i8] c"%12.6f %12.6f %12.6f\0A\00"
@.str.15 = [29 x i8] c"press RETURN to continue...\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca float*
%10 = alloca float*
%11 = alloca float**
%12 = alloca float**
store i32 0, i32* %1
%13 = call float* @vector(i32 1, i32 10)
store float* %13, float** %9
%14 = call float* @vector(i32 1, i32 10)
store float* %14, float** %10
%15 = call float** @matrix(i32 1, i32 10, i32 1, i32 10)
store float** %15, float*** %11
store i32 1, i32* %2
br label %16
16: ; preds = %279, %0
%17 = load i32, i32* %2
%18 = icmp sle i32 %17, 3
br i1 %18, label %19, label %282
19: ; preds = %16
%20 = load i32, i32* %2
%21 = icmp eq i32 %20, 1
br i1 %21, label %22, label %32
22: ; preds = %19
%23 = load i32, i32* %2
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [4 x i32], [4 x i32]* @main.num, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = load i32, i32* %2
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [4 x i32], [4 x i32]* @main.num, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = call float** @convert_matrix(float* getelementptr inbounds ([3 x [3 x float]], [3 x [3 x float]]* @main.a, i64 0, i64 0, i64 0), i32 1, i32 %26, i32 1, i32 %30)
store float** %31, float*** %12
br label %60
32: ; preds = %19
%33 = load i32, i32* %2
%34 = icmp eq i32 %33, 2
br i1 %34, label %35, label %45
35: ; preds = %32
%36 = load i32, i32* %2
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [4 x i32], [4 x i32]* @main.num, i64 0, i64 %37
%39 = load i32, i32* %38
%40 = load i32, i32* %2
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [4 x i32], [4 x i32]* @main.num, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = call float** @convert_matrix(float* getelementptr inbounds ([5 x [5 x float]], [5 x [5 x float]]* @main.b, i64 0, i64 0, i64 0), i32 1, i32 %39, i32 1, i32 %43)
store float** %44, float*** %12
br label %59
45: ; preds = %32
%46 = load i32, i32* %2
%47 = icmp eq i32 %46, 3
br i1 %47, label %48, label %58
48: ; preds = %45
%49 = load i32, i32* %2
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [4 x i32], [4 x i32]* @main.num, i64 0, i64 %50
%52 = load i32, i32* %51
%53 = load i32, i32* %2
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [4 x i32], [4 x i32]* @main.num, i64 0, i64 %54
%56 = load i32, i32* %55
%57 = call float** @convert_matrix(float* getelementptr inbounds ([10 x [10 x float]], [10 x [10 x float]]* @main.c, i64 0, i64 0, i64 0), i32 1, i32 %52, i32 1, i32 %56)
store float** %57, float*** %12
br label %58
58: ; preds = %48, %45
br label %59
59: ; preds = %58, %35
br label %60
60: ; preds = %59, %22
%61 = load float**, float*** %12
%62 = load i32, i32* %2
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [4 x i32], [4 x i32]* @main.num, i64 0, i64 %63
%65 = load i32, i32* %64
%66 = load float*, float** %9
%67 = load float**, float*** %11
%68 = call i32 @jacobi(float** %61, i32 %65, float* %66, float** %67, i32* %8)
%69 = load i32, i32* %2
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %69)
%71 = load i32, i32* %8
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i32 %71)
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %74
74: ; preds = %95, %60
%75 = load i32, i32* %3
%76 = load i32, i32* %2
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [4 x i32], [4 x i32]* @main.num, i64 0, i64 %77
%79 = load i32, i32* %78
%80 = icmp sle i32 %75, %79
br i1 %80, label %81, label %98
81: ; preds = %74
%82 = load float*, float** %9
%83 = load i32, i32* %3
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds float, float* %82, i64 %84
%86 = load float, float* %85
%87 = fpext float %86 to double
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double %87)
%89 = load i32, i32* %3
%90 = srem i32 %89, 5
%91 = icmp eq i32 %90, 0
br i1 %91, label %92, label %94
92: ; preds = %81
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %94
94: ; preds = %92, %81
br label %95
95: ; preds = %94
%96 = load i32, i32* %3
%97 = add nsw i32 %96, 1
store i32 %97, i32* %3
br label %74
98: ; preds = %74
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %3
br label %100
100: ; preds = %140, %98
%101 = load i32, i32* %3
%102 = load i32, i32* %2
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds [4 x i32], [4 x i32]* @main.num, i64 0, i64 %103
%105 = load i32, i32* %104
%106 = icmp sle i32 %101, %105
br i1 %106, label %107, label %143
107: ; preds = %100
%108 = load i32, i32* %3
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32 %108)
store i32 1, i32* %4
br label %110
110: ; preds = %135, %107
%111 = load i32, i32* %4
%112 = load i32, i32* %2
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds [4 x i32], [4 x i32]* @main.num, i64 0, i64 %113
%115 = load i32, i32* %114
%116 = icmp sle i32 %111, %115
br i1 %116, label %117, label %138
117: ; preds = %110
%118 = load float**, float*** %11
%119 = load i32, i32* %4
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds float*, float** %118, i64 %120
%122 = load float*, float** %121
%123 = load i32, i32* %3
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds float, float* %122, i64 %124
%126 = load float, float* %125
%127 = fpext float %126 to double
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double %127)
%129 = load i32, i32* %4
%130 = srem i32 %129, 5
%131 = icmp eq i32 %130, 0
br i1 %131, label %132, label %134
132: ; preds = %117
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %134
134: ; preds = %132, %117
br label %135
135: ; preds = %134
%136 = load i32, i32* %4
%137 = add nsw i32 %136, 1
store i32 %137, i32* %4
br label %110
138: ; preds = %110
%139 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %140
140: ; preds = %138
%141 = load i32, i32* %3
%142 = add nsw i32 %141, 1
store i32 %142, i32* %3
br label %100
143: ; preds = %100
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %3
br label %145
145: ; preds = %263, %143
%146 = load i32, i32* %3
%147 = load i32, i32* %2
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds [4 x i32], [4 x i32]* @main.num, i64 0, i64 %148
%150 = load i32, i32* %149
%151 = icmp sle i32 %146, %150
br i1 %151, label %152, label %266
152: ; preds = %145
store i32 1, i32* %6
br label %153
153: ; preds = %211, %152
%154 = load i32, i32* %6
%155 = load i32, i32* %2
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds [4 x i32], [4 x i32]* @main.num, i64 0, i64 %156
%158 = load i32, i32* %157
%159 = icmp sle i32 %154, %158
br i1 %159, label %160, label %214
160: ; preds = %153
%161 = load float*, float** %10
%162 = load i32, i32* %6
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds float, float* %161, i64 %163
store float 0.000000e+00, float* %164
store i32 1, i32* %4
br label %165
165: ; preds = %207, %160
%166 = load i32, i32* %4
%167 = load i32, i32* %2
%168 = sext i32 %167 to i64
%169 = getelementptr inbounds [4 x i32], [4 x i32]* @main.num, i64 0, i64 %168
%170 = load i32, i32* %169
%171 = icmp sle i32 %166, %170
br i1 %171, label %172, label %210
172: ; preds = %165
%173 = load i32, i32* %4
%174 = load i32, i32* %6
%175 = icmp sgt i32 %173, %174
br i1 %175, label %176, label %179
176: ; preds = %172
%177 = load i32, i32* %6
store i32 %177, i32* %5
%178 = load i32, i32* %4
store i32 %178, i32* %7
br label %182
179: ; preds = %172
%180 = load i32, i32* %4
store i32 %180, i32* %5
%181 = load i32, i32* %6
store i32 %181, i32* %7
br label %182
182: ; preds = %179, %176
%183 = load float**, float*** %12
%184 = load i32, i32* %7
%185 = sext i32 %184 to i64
%186 = getelementptr inbounds float*, float** %183, i64 %185
%187 = load float*, float** %186
%188 = load i32, i32* %5
%189 = sext i32 %188 to i64
%190 = getelementptr inbounds float, float* %187, i64 %189
%191 = load float, float* %190
%192 = load float**, float*** %11
%193 = load i32, i32* %4
%194 = sext i32 %193 to i64
%195 = getelementptr inbounds float*, float** %192, i64 %194
%196 = load float*, float** %195
%197 = load i32, i32* %3
%198 = sext i32 %197 to i64
%199 = getelementptr inbounds float, float* %196, i64 %198
%200 = load float, float* %199
%201 = load float*, float** %10
%202 = load i32, i32* %6
%203 = sext i32 %202 to i64
%204 = getelementptr inbounds float, float* %201, i64 %203
%205 = load float, float* %204
%206 = call float @llvm.fmuladd.f32(float %191, float %200, float %205)
store float %206, float* %204
br label %207
207: ; preds = %182
%208 = load i32, i32* %4
%209 = add nsw i32 %208, 1
store i32 %209, i32* %4
br label %165
210: ; preds = %165
br label %211
211: ; preds = %210
%212 = load i32, i32* %6
%213 = add nsw i32 %212, 1
store i32 %213, i32* %6
br label %153
214: ; preds = %153
%215 = load i32, i32* %3
%216 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), i32 %215)
%217 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0))
store i32 1, i32* %6
br label %218
218: ; preds = %259, %214
%219 = load i32, i32* %6
%220 = load i32, i32* %2
%221 = sext i32 %220 to i64
%222 = getelementptr inbounds [4 x i32], [4 x i32]* @main.num, i64 0, i64 %221
%223 = load i32, i32* %222
%224 = icmp sle i32 %219, %223
br i1 %224, label %225, label %262
225: ; preds = %218
%226 = load float**, float*** %11
%227 = load i32, i32* %6
%228 = sext i32 %227 to i64
%229 = getelementptr inbounds float*, float** %226, i64 %228
%230 = load float*, float** %229
%231 = load i32, i32* %3
%232 = sext i32 %231 to i64
%233 = getelementptr inbounds float, float* %230, i64 %232
%234 = load float, float* %233
%235 = fpext float %234 to double
%236 = load float*, float** %10
%237 = load i32, i32* %6
%238 = sext i32 %237 to i64
%239 = getelementptr inbounds float, float* %236, i64 %238
%240 = load float, float* %239
%241 = fpext float %240 to double
%242 = load float*, float** %10
%243 = load i32, i32* %6
%244 = sext i32 %243 to i64
%245 = getelementptr inbounds float, float* %242, i64 %244
%246 = load float, float* %245
%247 = load float**, float*** %11
%248 = load i32, i32* %6
%249 = sext i32 %248 to i64
%250 = getelementptr inbounds float*, float** %247, i64 %249
%251 = load float*, float** %250
%252 = load i32, i32* %3
%253 = sext i32 %252 to i64
%254 = getelementptr inbounds float, float* %251, i64 %253
%255 = load float, float* %254
%256 = fdiv float %246, %255
%257 = fpext float %256 to double
%258 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.14, i64 0, i64 0), double %235, double %241, double %257)
br label %259
259: ; preds = %225
%260 = load i32, i32* %6
%261 = add nsw i32 %260, 1
store i32 %261, i32* %6
br label %218
262: ; preds = %218
br label %263
263: ; preds = %262
%264 = load i32, i32* %3
%265 = add nsw i32 %264, 1
store i32 %265, i32* %3
br label %145
266: ; preds = %145
%267 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.15, i64 0, i64 0))
%268 = call i32 (...) @getchar()
%269 = load float**, float*** %12
%270 = load i32, i32* %2
%271 = sext i32 %270 to i64
%272 = getelementptr inbounds [4 x i32], [4 x i32]* @main.num, i64 0, i64 %271
%273 = load i32, i32* %272
%274 = load i32, i32* %2
%275 = sext i32 %274 to i64
%276 = getelementptr inbounds [4 x i32], [4 x i32]* @main.num, i64 0, i64 %275
%277 = load i32, i32* %276
%278 = call i32 @free_convert_matrix(float** %269, i32 1, i32 %273, i32 1, i32 %277)
br label %279
279: ; preds = %266
%280 = load i32, i32* %2
%281 = add nsw i32 %280, 1
store i32 %281, i32* %2
br label %16
282: ; preds = %16
%283 = load float**, float*** %11
%284 = call i32 @free_matrix(float** %283, i32 1, i32 10, i32 1, i32 10)
%285 = load float*, float** %10
%286 = call i32 @free_vector(float* %285, i32 1, i32 10)
%287 = load float*, float** %9
%288 = call i32 @free_vector(float* %287, i32 1, i32 10)
ret i32 0
}

LLVM IR (-O2):
@main.a = internal global [3 x [3 x float]] [[3 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00], [3 x float] [float 2.000000e+00, float 2.000000e+00, float 3.000000e+00], [3 x float] [float 3.000000e+00, float 3.000000e+00, float 3.000000e+00]]
@main.b = internal global [5 x [5 x float]] [[5 x float] [float -2.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 2.000000e+00], [5 x float] [float -1.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 2.000000e+00], [5 x float] [float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 1.000000e+00, float 2.000000e+00], [5 x float] [float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 2.000000e+00], [5 x float] [float 2.000000e+00, float 2.000000e+00, float 2.000000e+00, float 2.000000e+00, float 2.000000e+00]]
@main.c = internal global [10 x [10 x float]] [[10 x float] [float 5.000000e+00, float 0x4011333340000000, float 3.000000e+00, float 2.000000e+00, float 1.000000e+00, float 0.000000e+00, float -1.000000e+00, float -2.000000e+00, float -3.000000e+00, float -4.000000e+00], [10 x float] [float 0x4011333340000000, float 0x4014666660000000, float 4.000000e+00, float 3.000000e+00, float 2.000000e+00, float 1.000000e+00, float 0.000000e+00, float -1.000000e+00, float -2.000000e+00, float -3.000000e+00], [10 x float] [float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 4.000000e+00, float 3.000000e+00, float 2.000000e+00, float 1.000000e+00, float 0.000000e+00, float -1.000000e+00, float -2.000000e+00], [10 x float] [float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 4.000000e+00, float 3.000000e+00, float 2.000000e+00, float 1.000000e+00, float 0.000000e+00, float -1.000000e+00], [10 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 4.000000e+00, float 3.000000e+00, float 2.000000e+00, float 1.000000e+00, float 0.000000e+00], [10 x float] [float 0.000000e+00, float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 4.000000e+00, float 3.000000e+00, float 2.000000e+00, float 1.000000e+00], [10 x float] [float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 4.000000e+00, float 3.000000e+00, float 2.000000e+00], [10 x float] [float -2.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 4.000000e+00, float 3.000000e+00], [10 x float] [float -3.000000e+00, float -2.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 4.000000e+00], [10 x float] [float -4.000000e+00, float -3.000000e+00, float -2.000000e+00, float -1.000000e+00, float 0.000000e+00, float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00]]
@main.num = internal unnamed_addr constant [4 x i32] [i32 0, i32 3, i32 5, i32 10]
@.str = [19 x i8] c"matrix number %2d\0A\00"
@.str.1 = [33 x i8] c"number of JACOBI rotations: %3d\0A\00"
@.str.3 = [7 x i8] c"%12.6f\00"
@.str.6 = [10 x i8] c"%9s %3d \0A\00"
@.str.7 = [7 x i8] c"number\00"
@.str.9 = [19 x i8] c"vector number %3d\0A\00"
@.str.10 = [16 x i8] c"%11s %14s %10s\0A\00"
@.str.11 = [7 x i8] c"vector\00"
@.str.12 = [10 x i8] c"mtrx*vec.\00"
@.str.13 = [6 x i8] c"ratio\00"
@.str.14 = [22 x i8] c"%12.6f %12.6f %12.6f\0A\00"
@str = [14 x i8] c"eigenvalues: \00"
@str.16 = [15 x i8] c"\0Aeigenvectors:\00"
@str.17 = [17 x i8] c"eigenvector test\00"
@str.18 = [28 x i8] c"press RETURN to continue...\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call float* @vector(i32 1, i32 10)
%4 = tail call float* @vector(i32 1, i32 10)
%5 = tail call float** @matrix(i32 1, i32 10, i32 1, i32 10)
br label %6
6: ; preds = %0, %126
%7 = phi i64 [ 1, %0 ], [ %130, %126 ]
%8 = phi float** [ undef, %0 ], [ %17, %126 ]
%9 = trunc i64 %7 to i32
switch i32 %9, label %16 [
i32 1, label %10
i32 2, label %12
i32 3, label %14
]
10: ; preds = %6
%11 = call float** @convert_matrix(float* getelementptr inbounds ([3 x [3 x float]], [3 x [3 x float]]* @main.a, i64 0, i64 0, i64 0), i32 1, i32 3, i32 1, i32 3)
br label %16
12: ; preds = %6
%13 = call float** @convert_matrix(float* getelementptr inbounds ([5 x [5 x float]], [5 x [5 x float]]* @main.b, i64 0, i64 0, i64 0), i32 1, i32 5, i32 1, i32 5)
br label %16
14: ; preds = %6
%15 = call float** @convert_matrix(float* getelementptr inbounds ([10 x [10 x float]], [10 x [10 x float]]* @main.c, i64 0, i64 0, i64 0), i32 1, i32 10, i32 1, i32 10)
br label %16
16: ; preds = %10, %14, %12, %6
%17 = phi float** [ %11, %10 ], [ %13, %12 ], [ %15, %14 ], [ %8, %6 ]
%18 = getelementptr inbounds [4 x i32], [4 x i32]* @main.num, i64 0, i64 %7
%19 = load i32, i32* %18
%20 = call i32 @jacobi(float** %17, i32 %19, float* %3, float** %5, i32* %1)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %9)
%22 = load i32, i32* %1
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%25 = call i32 @llvm.smax.i32(i32 %19, i32 1)
%26 = add nuw i32 %25, 1
%27 = zext i32 %26 to i64
br label %28
28: ; preds = %16, %39
%29 = phi i64 [ 1, %16 ], [ %40, %39 ]
%30 = getelementptr inbounds float, float* %3, i64 %29
%31 = load float, float* %30
%32 = fpext float %31 to double
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double %32)
%34 = trunc i64 %29 to i32
%35 = urem i32 %34, 5
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %28
%38 = call i32 @putchar(i32 10)
br label %39
39: ; preds = %28, %37
%40 = add nuw nsw i64 %29, 1
%41 = icmp eq i64 %40, %27
br i1 %41, label %42, label %28
42: ; preds = %39
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.16, i64 0, i64 0))
%44 = call i32 @llvm.smax.i32(i32 %19, i32 1)
%45 = add nuw i32 %44, 1
%46 = zext i32 %45 to i64
br label %47
47: ; preds = %67, %42
%48 = phi i64 [ 1, %42 ], [ %69, %67 ]
%49 = trunc i64 %48 to i32
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32 %49)
br label %51
51: ; preds = %47, %64
%52 = phi i64 [ 1, %47 ], [ %65, %64 ]
%53 = getelementptr inbounds float*, float** %5, i64 %52
%54 = load float*, float** %53
%55 = getelementptr inbounds float, float* %54, i64 %48
%56 = load float, float* %55
%57 = fpext float %56 to double
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double %57)
%59 = trunc i64 %52 to i32
%60 = urem i32 %59, 5
%61 = icmp eq i32 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %51
%63 = call i32 @putchar(i32 10)
br label %64
64: ; preds = %51, %62
%65 = add nuw nsw i64 %52, 1
%66 = icmp eq i64 %65, %46
br i1 %66, label %67, label %51
67: ; preds = %64
%68 = call i32 @putchar(i32 10)
%69 = add nuw nsw i64 %48, 1
%70 = icmp eq i64 %69, %46
br i1 %70, label %71, label %47
71: ; preds = %67
%72 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.17, i64 0, i64 0))
%73 = call i32 @llvm.smax.i32(i32 %19, i32 1)
%74 = add nuw i32 %73, 1
%75 = zext i32 %74 to i64
br label %76
76: ; preds = %123, %71
%77 = phi i64 [ 1, %71 ], [ %124, %123 ]
br label %78
78: ; preds = %101, %76
%79 = phi i64 [ 1, %76 ], [ %102, %101 ]
%80 = getelementptr inbounds float, float* %4, i64 %79
store float 0.000000e+00, float* %80
br label %81
81: ; preds = %78, %81
%82 = phi float [ 0.000000e+00, %78 ], [ %98, %81 ]
%83 = phi i64 [ 1, %78 ], [ %99, %81 ]
%84 = icmp ugt i64 %83, %79
%85 = icmp ult i64 %83, %79
%86 = select i1 %85, i64 %83, i64 %79
%87 = select i1 %84, i64 %83, i64 %79
%88 = and i64 %87, 4294967295
%89 = getelementptr inbounds float*, float** %17, i64 %88
%90 = load float*, float** %89
%91 = and i64 %86, 4294967295
%92 = getelementptr inbounds float, float* %90, i64 %91
%93 = load float, float* %92
%94 = getelementptr inbounds float*, float** %5, i64 %83
%95 = load float*, float** %94
%96 = getelementptr inbounds float, float* %95, i64 %77
%97 = load float, float* %96
%98 = call float @llvm.fmuladd.f32(float %93, float %97, float %82)
store float %98, float* %80
%99 = add nuw nsw i64 %83, 1
%100 = icmp eq i64 %99, %75
br i1 %100, label %101, label %81
101: ; preds = %81
%102 = add nuw nsw i64 %79, 1
%103 = icmp eq i64 %102, %75
br i1 %103, label %104, label %78
104: ; preds = %101
%105 = trunc i64 %77 to i32
%106 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), i32 %105)
%107 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0))
br label %108
108: ; preds = %104, %108
%109 = phi i64 [ 1, %104 ], [ %121, %108 ]
%110 = getelementptr inbounds float*, float** %5, i64 %109
%111 = load float*, float** %110
%112 = getelementptr inbounds float, float* %111, i64 %77
%113 = load float, float* %112
%114 = fpext float %113 to double
%115 = getelementptr inbounds float, float* %4, i64 %109
%116 = load float, float* %115
%117 = fpext float %116 to double
%118 = fdiv float %116, %113
%119 = fpext float %118 to double
%120 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.14, i64 0, i64 0), double %114, double %117, double %119)
%121 = add nuw nsw i64 %109, 1
%122 = icmp eq i64 %121, %75
br i1 %122, label %123, label %108
123: ; preds = %108
%124 = add nuw nsw i64 %77, 1
%125 = icmp eq i64 %124, %75
br i1 %125, label %126, label %76
126: ; preds = %123
%127 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.18, i64 0, i64 0))
%128 = call i32 (...) @getchar()
%129 = call i32 @free_convert_matrix(float** %17, i32 1, i32 %19, i32 1, i32 %19)
%130 = add nuw nsw i64 %7, 1
%131 = icmp eq i64 %130, 4
br i1 %131, label %132, label %6
132: ; preds = %126
%133 = call i32 @free_matrix(float** %5, i32 1, i32 10, i32 1, i32 10)
%134 = call i32 @free_vector(float* %4, i32 1, i32 10)
%135 = call i32 @free_vector(float* %3, i32 1, i32 10)
ret i32 0
}