#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 */
struct timeval {
  double tv_sec;
  double tv_usec;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
double *calloc(int, int);
int /*<<< orphan*/ dfeast_sygv(char *, int *, double *, int *, double *, int *,
                               int *, double *, int *, double *, double *,
                               int *, double *, double *, int *, double *,
                               int *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feastinit(int *);
int /*<<< orphan*/ *fopen(char *, char *);
int fscanf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int feastparam[64];
  double epsout;
  int loop;
  char UPLO = 'F';
  FILE *fp;
  char name[] = "../../system1";
  int N, nnz;
  double *A, *B;
  struct timeval t1, t2;
  int i, j, k, n2, err;
  int M0, M, info;
  double Emin, Emax, trace;
  double *X;
  double *E, *res;
  fp = fopen(name, "r");
  err = fscanf(fp, "%d%d\n", &N, &nnz);
  n2 = N * N;
  A = calloc(n2, sizeof(double));
  B = calloc(n2, sizeof(double));
  for (i = 0; i <= n2 - 1; i++) {
    *(A + i) = (double)0.0;
    *(B + i) = (double)0.0;
  };
  for (k = 0; k <= nnz - 1; k++) {
    err = fscanf(fp, "%d%d", &i, &j);
    err = fscanf(fp, "%lf%lf\n", A + (j - 1) * N + i - 1,
                 B + (j - 1) * N + i - 1);
  };
  fclose(fp);
  printf("dense matrix -system1- size %.d\n", N);
  gettimeofday(&t1, NULL);
  Emin = (double)0.18;
  Emax = (double)1.0;
  M0 = 25;
  E = calloc(M0, sizeof(double));
  res = calloc(M0, sizeof(double));
  X = calloc(N * M0, sizeof(double));
  feastinit(feastparam);
  feastparam[0] = 1;
  dfeast_sygv(&UPLO, &N, A, &N, B, &N, feastparam, &epsout, &loop, &Emin, &Emax,
              &M0, E, X, &M, res, &info);
  gettimeofday(&t2, NULL);
  printf("FEAST OUTPUT INFO %d\n", info);
  if (info == 0) {
    printf("*************************************************\n");
    printf("************** REPORT ***************************\n");
    printf("*************************************************\n");
    printf("SIMULATION TIME %f\n", (t2.tv_sec - t1.tv_sec) * 1.0 +
                                       (t2.tv_usec - t1.tv_usec) * 0.000001);
    printf("# Search interval [Emin,Emax] %.15e %.15e\n", Emin, Emax);
    printf("# mode found/subspace %d %d \n", M, M0);
    printf("# iterations %d \n", loop);
    trace = (double)0.0;
    for (i = 0; i <= M - 1; i = i + 1) {
      trace = trace + *(E + i);
    }
    printf("TRACE %.15e\n", trace);
    printf("Relative error on the Trace %.15e\n", epsout);
    printf("Eigenvalues/Residuals\n");
    for (i = 0; i <= M - 1; i = i + 1) {
      printf("   %d %.15e %.15e\n", i, *(E + i), *(res + i));
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x228,%rsp
movl   $0x0,-0x2c(%rbp)
movb   $0x46,-0x13d(%rbp)
mov    0xe6f(%rip),%rax
mov    %rax,-0x156(%rbp)
mov    0xe6a(%rip),%eax
mov    %eax,-0x14e(%rbp)
mov    0xe61(%rip),%ax
mov    %ax,-0x14a(%rbp)
lea    -0x156(%rbp),%rdi
lea    0xe4e(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x148(%rbp)
mov    -0x148(%rbp),%rdi
lea    0xe36(%rip),%rsi
lea    -0x15c(%rbp),%rdx
lea    -0x160(%rbp),%rcx
mov    $0x0,%al
call   1080 <fscanf@plt>
mov    %eax,-0x1a4(%rbp)
mov    -0x15c(%rbp),%eax
imul   -0x15c(%rbp),%eax
mov    %eax,-0x1a0(%rbp)
mov    -0x1a0(%rbp),%edi
mov    $0x8,%esi
call   1090 <calloc@plt>
mov    %rax,-0x168(%rbp)
mov    -0x1a0(%rbp),%edi
mov    $0x8,%esi
call   1090 <calloc@plt>
mov    %rax,-0x170(%rbp)
movl   $0x0,-0x194(%rbp)
mov    -0x194(%rbp),%eax
mov    -0x1a0(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     12af <main+0x12f>
mov    -0x168(%rbp),%rax
movslq -0x194(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x170(%rbp),%rax
movslq -0x194(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x194(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x194(%rbp)
jmp    1258 <main+0xd8>
movl   $0x0,-0x19c(%rbp)
mov    -0x19c(%rbp),%eax
mov    -0x160(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     138c <main+0x20c>
mov    -0x148(%rbp),%rdi
lea    0xd50(%rip),%rsi
lea    -0x194(%rbp),%rdx
lea    -0x198(%rbp),%rcx
mov    $0x0,%al
call   1080 <fscanf@plt>
mov    %eax,-0x1a4(%rbp)
mov    -0x148(%rbp),%rdi
mov    -0x168(%rbp),%rdx
mov    -0x198(%rbp),%eax
sub    $0x1,%eax
imul   -0x15c(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
movslq -0x194(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
add    $0xfffffffffffffff8,%rdx
mov    -0x170(%rbp),%rcx
mov    -0x198(%rbp),%eax
sub    $0x1,%eax
imul   -0x15c(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rcx
movslq -0x194(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rcx
add    $0xfffffffffffffff8,%rcx
lea    0xcc8(%rip),%rsi
mov    $0x0,%al
call   1080 <fscanf@plt>
mov    %eax,-0x1a4(%rbp)
mov    -0x19c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x19c(%rbp)
jmp    12b9 <main+0x139>
mov    -0x148(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x15c(%rbp),%esi
lea    0xc96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x180(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <gettimeofday@plt>
movsd  0xc44(%rip),%xmm0
movsd  %xmm0,-0x1b8(%rbp)
ff
movsd  0xc2c(%rip),%xmm0
movsd  %xmm0,-0x1c0(%rbp)
ff
movl   $0x19,-0x1a8(%rbp)
mov    -0x1a8(%rbp),%edi
mov    $0x8,%esi
call   1090 <calloc@plt>
mov    %rax,-0x1d8(%rbp)
mov    -0x1a8(%rbp),%edi
mov    $0x8,%esi
call   1090 <calloc@plt>
mov    %rax,-0x1e0(%rbp)
mov    -0x15c(%rbp),%edi
imul   -0x1a8(%rbp),%edi
mov    $0x8,%esi
call   1090 <calloc@plt>
mov    %rax,-0x1d0(%rbp)
lea    -0x130(%rbp),%rdi
call   1050 <feastinit@plt>
movl   $0x1,-0x130(%rbp)
mov    -0x168(%rbp),%rdx
mov    -0x170(%rbp),%r8
lea    -0x130(%rbp),%rax
mov    -0x1d8(%rbp),%r14
mov    -0x1d0(%rbp),%rbx
mov    -0x1e0(%rbp),%r10
lea    -0x13d(%rbp),%rdi
lea    -0x15c(%rbp),%r9
lea    -0x138(%rbp),%rcx
mov    %rcx,-0x1f8(%rbp)
lea    -0x13c(%rbp),%rcx
mov    %rcx,-0x1f0(%rbp)
lea    -0x1b8(%rbp),%r13
lea    -0x1c0(%rbp),%r12
lea    -0x1a8(%rbp),%r15
lea    -0x1ac(%rbp),%r11
lea    -0x1b0(%rbp),%rcx
mov    %rcx,-0x1e8(%rbp)
mov    %r9,%rsi
mov    %r9,%rcx
mov    %rax,(%rsp)
mov    -0x1f8(%rbp),%rax
mov    %rax,0x8(%rsp)
mov    -0x1f0(%rbp),%rax
mov    %rax,0x10(%rsp)
mov    -0x1e8(%rbp),%rax
mov    %r13,0x18(%rsp)
mov    %r12,0x20(%rsp)
mov    %r15,0x28(%rsp)
mov    %r14,0x30(%rsp)
mov    %rbx,0x38(%rsp)
mov    %r11,0x40(%rsp)
mov    %r10,0x48(%rsp)
mov    %rax,0x50(%rsp)
call   1070 <dfeast_sygv@plt>
lea    -0x190(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <gettimeofday@plt>
mov    -0x1b0(%rbp),%esi
lea    0xb23(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x1b0(%rbp)
jne    1712 <main+0x592>
lea    0xb1e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xb43(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xb02(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x190(%rbp),%xmm0
ff
subsd  -0x180(%rbp),%xmm0
ff
movsd  -0x188(%rbp),%xmm1
ff
subsd  -0x178(%rbp),%xmm1
ff
movsd  0xa71(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
lea    0xb2a(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x1b8(%rbp),%xmm0
ff
movsd  -0x1c0(%rbp),%xmm1
ff
lea    0xb20(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
mov    -0x1ac(%rbp),%esi
mov    -0x1a8(%rbp),%edx
lea    0xb31(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x13c(%rbp),%esi
lea    0xb3b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x1c8(%rbp)
ff
movl   $0x0,-0x194(%rbp)
mov    -0x194(%rbp),%eax
mov    -0x1ac(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1664 <main+0x4e4>
movsd  -0x1c8(%rbp),%xmm0
ff
mov    -0x1d8(%rbp),%rax
movslq -0x194(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x1c8(%rbp)
ff
mov    -0x194(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x194(%rbp)
jmp    1616 <main+0x496>
movsd  -0x1c8(%rbp),%xmm0
ff
lea    0xad4(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x138(%rbp),%xmm0
ff
lea    0xacb(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xae0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x194(%rbp)
mov    -0x194(%rbp),%eax
mov    -0x1ac(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     170d <main+0x58d>
mov    -0x194(%rbp),%esi
mov    -0x1d8(%rbp),%rax
movslq -0x194(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x1e0(%rbp),%rax
movslq -0x194(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
lea    0xa9c(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
mov    -0x194(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x194(%rbp)
jmp    16a8 <main+0x528>
jmp    1712 <main+0x592>
xor    %eax,%eax
add    $0x228,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x188,%rsp
movb   $0x46,0x7(%rsp)
movabs $0x316d6574737973,%rax
mov    %rax,0x56(%rsp)
movabs $0x79732f2e2e2f2e2e,%rax
2f 73 79
mov    %rax,0x50(%rsp)
lea    0xe3b(%rip),%rsi
lea    0x50(%rsp),%rdi
call   10c0 <fopen@plt>
mov    %rax,%rbx
lea    0xe29(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x1c(%rsp),%rcx
mov    %rax,%rdi
xor    %eax,%eax
call   10a0 <fscanf@plt>
mov    0xc(%rsp),%ebp
imul   %ebp,%ebp
mov    %ebp,%edi
mov    $0x8,%esi
call   10b0 <calloc@plt>
mov    %rax,%r15
mov    %ebp,%edi
mov    $0x8,%esi
call   10b0 <calloc@plt>
mov    %rax,%r12
test   %ebp,%ebp
je     124d <main+0xad>
mov    %ebp,%r14d
shl    $0x3,%r14
mov    %r15,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1090 <memset@plt>
mov    %r12,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1090 <memset@plt>
mov    %r12,0x28(%rsp)
mov    %r15,0x30(%rsp)
mov    %ebp,0x8(%rsp)
cmpl   $0x0,0x1c(%rsp)
jle    12e8 <main+0x148>
mov    0x30(%rsp),%r12
add    $0xfffffffffffffff8,%r12
mov    0x28(%rsp),%r14
add    $0xfffffffffffffff8,%r14
lea    0x20(%rsp),%rbp
lea    0xd9f(%rip),%r15
xor    %r13d,%r13d
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
lea    0xd84(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   10a0 <fscanf@plt>
movslq 0x20(%rsp),%rax
add    $0xffffffffffffffff,%rax
movslq 0xc(%rsp),%rcx
imul   %rax,%rcx
movslq 0x8(%rsp),%rax
lea    (%r12,%rcx,8),%rdx
lea    (%rdx,%rax,8),%rdx
lea    (%r14,%rcx,8),%rcx
lea    (%rcx,%rax,8),%rcx
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   10a0 <fscanf@plt>
add    $0x1,%r13d
cmp    0x1c(%rsp),%r13d
jl     1290 <main+0xf0>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    0xc(%rsp),%esi
lea    0xd30(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x70(%rsp),%rdi
xor    %esi,%esi
call   1070 <gettimeofday@plt>
movabs $0x3fc70a3d70a3d70a,%rax
0a c7 3f
mov    %rax,0x40(%rsp)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x38(%rsp)
movl   $0x19,0x18(%rsp)
mov    $0x19,%edi
mov    $0x8,%esi
call   10b0 <calloc@plt>
mov    %rax,%rbx
mov    $0x19,%edi
mov    $0x8,%esi
call   10b0 <calloc@plt>
mov    %rax,%r14
mov    0xc(%rsp),%eax
lea    (%rax,%rax,4),%eax
lea    (%rax,%rax,4),%edi
mov    $0x8,%esi
call   10b0 <calloc@plt>
mov    %rax,%rbp
lea    0x80(%rsp),%r15
mov    %r15,%rdi
call   1060 <feastinit@plt>
movl   $0x1,0x80(%rsp)
sub    $0x8,%rsp
lea    0x1c(%rsp),%rax
lea    0x18(%rsp),%r10
lea    0x20(%rsp),%r11
lea    0x40(%rsp),%r12
lea    0x48(%rsp),%r13
lea    0xf(%rsp),%rdi
lea    0x14(%rsp),%rcx
mov    %rcx,%rsi
mov    0x38(%rsp),%rdx
mov    0x30(%rsp),%r8
mov    %rcx,%r9
push   %rax
push   %r14
push   %r10
push   %rbp
push   %rbx
push   %r11
push   %r12
push   %r13
lea    0x6c(%rsp),%rax
push   %rax
lea    0x98(%rsp),%rax
push   %rax
push   %r15
call   1080 <dfeast_sygv@plt>
add    $0x60,%rsp
lea    0x60(%rsp),%rdi
xor    %esi,%esi
call   1070 <gettimeofday@plt>
mov    0x14(%rsp),%esi
lea    0xc4d(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmpl   $0x0,0x14(%rsp)
jne    15b9 <main+0x419>
lea    0xd2e(%rip),%rbp
mov    %rbp,%rdi
call   1030 <puts@plt>
lea    0xced(%rip),%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
call   1030 <puts@plt>
movapd 0x60(%rsp),%xmm1
subpd  0x70(%rsp),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
mulsd  0xbb0(%rip),%xmm0
addsd  %xmm1,%xmm0
lea    0xc07(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x40(%rsp),%xmm0
movsd  0x38(%rsp),%xmm1
lea    0xc01(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
mov    0x10(%rsp),%esi
mov    0x18(%rsp),%edx
lea    0xc16(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x24(%rsp),%esi
lea    0xc22(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%eax
test   %eax,%eax
jle    14c3 <main+0x323>
lea    -0x1(%rax),%rdx
mov    %eax,%ecx
and    $0x7,%ecx
cmp    $0x7,%rdx
jae    14cb <main+0x32b>
xorpd  %xmm0,%xmm0
xor    %edx,%edx
jmp    1518 <main+0x378>
xorpd  %xmm0,%xmm0
xor    %eax,%eax
jmp    153e <main+0x39e>
mov    %eax,%esi
and    $0xfffffff8,%esi
xorpd  %xmm0,%xmm0
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
addsd  (%rbx,%rdx,8),%xmm0
addsd  0x8(%rbx,%rdx,8),%xmm0
addsd  0x10(%rbx,%rdx,8),%xmm0
addsd  0x18(%rbx,%rdx,8),%xmm0
addsd  0x20(%rbx,%rdx,8),%xmm0
addsd  0x28(%rbx,%rdx,8),%xmm0
addsd  0x30(%rbx,%rdx,8),%xmm0
addsd  0x38(%rbx,%rdx,8),%xmm0
add    $0x8,%rdx
cmp    %rdx,%rsi
jne    14e0 <main+0x340>
test   %rcx,%rcx
je     153e <main+0x39e>
lea    (%rbx,%rdx,8),%rdx
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
addsd  (%rdx,%rsi,8),%xmm0
add    $0x1,%rsi
cmp    %rsi,%rcx
jne    1530 <main+0x390>
mov    %eax,0x8(%rsp)
lea    0xb88(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x48(%rsp),%xmm0
lea    0xb81(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xc0d(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,0x8(%rsp)
cmpl   $0x0,0x10(%rsp)
jle    15b9 <main+0x419>
xor    %eax,%eax
lea    0xb79(%rip),%rbp
nopl   0x0(%rax,%rax,1)
movslq %eax,%rsi
movsd  (%rbx,%rsi,8),%xmm0
movsd  (%r14,%rsi,8),%xmm1
mov    %rbp,%rdi
mov    $0x2,%al
call   1050 <printf@plt>
mov    0x8(%rsp),%eax
add    $0x1,%eax
mov    %eax,0x8(%rsp)
cmp    0x10(%rsp),%eax
jl     1590 <main+0x3f0>
xor    %eax,%eax
add    $0x188,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.timeval = type { double, double }
@__const.main.name = [14 x i8] c"../../system1\00"
@.str = [2 x i8] c"r\00"
@.str.1 = [6 x i8] c"%d%d\0A\00"
@.str.2 = [5 x i8] c"%d%d\00"
@.str.3 = [8 x i8] c"%lf%lf\0A\00"
@.str.4 = [33 x i8] c"dense matrix -system1- size %.d\0A\00"
@.str.5 = [22 x i8] c"FEAST OUTPUT INFO %d\0A\00"
@.str.6 = [51 x i8] c"*************************************************\0A\00"
@.str.7 = [51 x i8] c"************** REPORT ***************************\0A\00"
@.str.8 = [20 x i8] c"SIMULATION TIME %f\0A\00"
@.str.9 = [43 x i8] c"# Search interval [Emin,Emax] %.15e %.15e\0A\00"
@.str.10 = [30 x i8] c"# mode found/subspace %d %d \0A\00"
@.str.11 = [18 x i8] c"# iterations %d \0A\00"
@.str.12 = [13 x i8] c"TRACE %.15e\0A\00"
@.str.13 = [35 x i8] c"Relative error on the Trace %.15e\0A\00"
@.str.14 = [23 x i8] c"Eigenvalues/Residuals\0A\00"
@.str.15 = [19 x i8] c" %d %.15e %.15e\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [64 x i32]
%3 = alloca double
%4 = alloca i32
%5 = alloca i8
%6 = alloca i32*
%7 = alloca [14 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca double*
%11 = alloca double*
%12 = alloca %struct.timeval
%13 = alloca %struct.timeval
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double*
%26 = alloca double*
%27 = alloca double*
store i32 0, i32* %1
store i8 70, i8* %5
%28 = bitcast [14 x i8]* %7 to i8*
%29 = getelementptr inbounds [14 x i8], [14 x i8]* %7, i64 0, i64 0
%30 = call i32* @fopen(i8* %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %30, i32** %6
%31 = load i32*, i32** %6
%32 = call i32 (i32*, i8*, ...) @fscanf(i32* %31, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %8, i32* %9)
store i32 %32, i32* %18
%33 = load i32, i32* %8
%34 = load i32, i32* %8
%35 = mul nsw i32 %33, %34
store i32 %35, i32* %17
%36 = load i32, i32* %17
%37 = call double* @calloc(i32 %36, i32 8)
store double* %37, double** %10
%38 = load i32, i32* %17
%39 = call double* @calloc(i32 %38, i32 8)
store double* %39, double** %11
store i32 0, i32* %14
br label %40
40: ; preds = %54, %0
%41 = load i32, i32* %14
%42 = load i32, i32* %17
%43 = sub nsw i32 %42, 1
%44 = icmp sle i32 %41, %43
br i1 %44, label %45, label %57
45: ; preds = %40
%46 = load double*, double** %10
%47 = load i32, i32* %14
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds double, double* %46, i64 %48
store double 0.000000e+00, double* %49
%50 = load double*, double** %11
%51 = load i32, i32* %14
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds double, double* %50, i64 %52
store double 0.000000e+00, double* %53
br label %54
54: ; preds = %45
%55 = load i32, i32* %14
%56 = add nsw i32 %55, 1
store i32 %56, i32* %14
br label %40
57: ; preds = %40
store i32 0, i32* %16
br label %58
58: ; preds = %90, %57
%59 = load i32, i32* %16
%60 = load i32, i32* %9
%61 = sub nsw i32 %60, 1
%62 = icmp sle i32 %59, %61
br i1 %62, label %63, label %93
63: ; preds = %58
%64 = load i32*, i32** %6
%65 = call i32 (i32*, i8*, ...) @fscanf(i32* %64, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32* %14, i32* %15)
store i32 %65, i32* %18
%66 = load i32*, i32** %6
%67 = load double*, double** %10
%68 = load i32, i32* %15
%69 = sub nsw i32 %68, 1
%70 = load i32, i32* %8
%71 = mul nsw i32 %69, %70
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds double, double* %67, i64 %72
%74 = load i32, i32* %14
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds double, double* %73, i64 %75
%77 = getelementptr inbounds double, double* %76, i64 -1
%78 = load double*, double** %11
%79 = load i32, i32* %15
%80 = sub nsw i32 %79, 1
%81 = load i32, i32* %8
%82 = mul nsw i32 %80, %81
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds double, double* %78, i64 %83
%85 = load i32, i32* %14
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds double, double* %84, i64 %86
%88 = getelementptr inbounds double, double* %87, i64 -1
%89 = call i32 (i32*, i8*, ...) @fscanf(i32* %66, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), double* %77, double* %88)
store i32 %89, i32* %18
br label %90
90: ; preds = %63
%91 = load i32, i32* %16
%92 = add nsw i32 %91, 1
store i32 %92, i32* %16
br label %58
93: ; preds = %58
%94 = load i32*, i32** %6
%95 = call i32 @fclose(i32* %94)
%96 = load i32, i32* %8
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 %96)
%98 = call i32 @gettimeofday(%struct.timeval* %12, i32* null)
store double 1.800000e-01, double* %22
store double 1.000000e+00, double* %23
store i32 25, i32* %19
%99 = load i32, i32* %19
%100 = call double* @calloc(i32 %99, i32 8)
store double* %100, double** %26
%101 = load i32, i32* %19
%102 = call double* @calloc(i32 %101, i32 8)
store double* %102, double** %27
%103 = load i32, i32* %8
%104 = load i32, i32* %19
%105 = mul nsw i32 %103, %104
%106 = call double* @calloc(i32 %105, i32 8)
store double* %106, double** %25
%107 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 0
%108 = call i32 @feastinit(i32* %107)
%109 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 0
store i32 1, i32* %109
%110 = load double*, double** %10
%111 = load double*, double** %11
%112 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 0
%113 = load double*, double** %26
%114 = load double*, double** %25
%115 = load double*, double** %27
%116 = call i32 @dfeast_sygv(i8* %5, i32* %8, double* %110, i32* %8, double* %111, i32* %8, i32* %112, double* %3, i32* %4, double* %22, double* %23, i32* %19, double* %113, double* %114, i32* %20, double* %115, i32* %21)
%117 = call i32 @gettimeofday(%struct.timeval* %13, i32* null)
%118 = load i32, i32* %21
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 %118)
%120 = load i32, i32* %21
%121 = icmp eq i32 %120, 0
br i1 %121, label %122, label %191
122: ; preds = %93
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.6, i64 0, i64 0))
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.7, i64 0, i64 0))
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.6, i64 0, i64 0))
%126 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 0
%127 = load double, double* %126
%128 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 0
%129 = load double, double* %128
%130 = fsub double %127, %129
%131 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 1
%132 = load double, double* %131
%133 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 1
%134 = load double, double* %133
%135 = fsub double %132, %134
%136 = fmul double %135, 0x3EB0C6F7A0B5ED8D
%137 = call double @llvm.fmuladd.f64(double %130, double 1.000000e+00, double %136)
%138 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), double %137)
%139 = load double, double* %22
%140 = load double, double* %23
%141 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.9, i64 0, i64 0), double %139, double %140)
%142 = load i32, i32* %20
%143 = load i32, i32* %19
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i32 %142, i32 %143)
%145 = load i32, i32* %4
%146 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0), i32 %145)
store double 0.000000e+00, double* %24
store i32 0, i32* %14
br label %147
147: ; preds = %160, %122
%148 = load i32, i32* %14
%149 = load i32, i32* %20
%150 = sub nsw i32 %149, 1
%151 = icmp sle i32 %148, %150
br i1 %151, label %152, label %163
152: ; preds = %147
%153 = load double, double* %24
%154 = load double*, double** %26
%155 = load i32, i32* %14
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds double, double* %154, i64 %156
%158 = load double, double* %157
%159 = fadd double %153, %158
store double %159, double* %24
br label %160
160: ; preds = %152
%161 = load i32, i32* %14
%162 = add nsw i32 %161, 1
store i32 %162, i32* %14
br label %147
163: ; preds = %147
%164 = load double, double* %24
%165 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), double %164)
%166 = load double, double* %3
%167 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.13, i64 0, i64 0), double %166)
%168 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0))
store i32 0, i32* %14
br label %169
169: ; preds = %187, %163
%170 = load i32, i32* %14
%171 = load i32, i32* %20
%172 = sub nsw i32 %171, 1
%173 = icmp sle i32 %170, %172
br i1 %173, label %174, label %190
174: ; preds = %169
%175 = load i32, i32* %14
%176 = load double*, double** %26
%177 = load i32, i32* %14
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds double, double* %176, i64 %178
%180 = load double, double* %179
%181 = load double*, double** %27
%182 = load i32, i32* %14
%183 = sext i32 %182 to i64
%184 = getelementptr inbounds double, double* %181, i64 %183
%185 = load double, double* %184
%186 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.15, i64 0, i64 0), i32 %175, double %180, double %185)
br label %187
187: ; preds = %174
%188 = load i32, i32* %14
%189 = add nsw i32 %188, 1
store i32 %189, i32* %14
br label %169
190: ; preds = %169
br label %191
191: ; preds = %190, %93
ret i32 0
}

LLVM IR (-O2):
%struct.timeval = type { double, double }
@__const.main.name = [14 x i8] c"../../system1\00"
@.str = [2 x i8] c"r\00"
@.str.1 = [6 x i8] c"%d%d\0A\00"
@.str.2 = [5 x i8] c"%d%d\00"
@.str.3 = [8 x i8] c"%lf%lf\0A\00"
@.str.4 = [33 x i8] c"dense matrix -system1- size %.d\0A\00"
@.str.5 = [22 x i8] c"FEAST OUTPUT INFO %d\0A\00"
@.str.8 = [20 x i8] c"SIMULATION TIME %f\0A\00"
@.str.9 = [43 x i8] c"# Search interval [Emin,Emax] %.15e %.15e\0A\00"
@.str.10 = [30 x i8] c"# mode found/subspace %d %d \0A\00"
@.str.11 = [18 x i8] c"# iterations %d \0A\00"
@.str.12 = [13 x i8] c"TRACE %.15e\0A\00"
@.str.13 = [35 x i8] c"Relative error on the Trace %.15e\0A\00"
@.str.15 = [19 x i8] c" %d %.15e %.15e\0A\00"
@str.16 = [50 x i8] c"************** REPORT ***************************\00"
@str.17 = [50 x i8] c"*************************************************\00"
@str.18 = [22 x i8] c"Eigenvalues/Residuals\00"
define i32 @main() {
%1 = alloca [64 x i32]
%2 = alloca double
%3 = alloca i32
%4 = alloca i8
%5 = alloca [14 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca <2 x double>
%9 = bitcast <2 x double>* %8 to %struct.timeval*
%10 = alloca <2 x double>
%11 = bitcast <2 x double>* %10 to %struct.timeval*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca double
%18 = alloca double
%19 = bitcast [64 x i32]* %1 to i8*
%20 = bitcast double* %2 to i8*
%21 = bitcast i32* %3 to i8*
store i8 70, i8* %4
%22 = getelementptr inbounds [14 x i8], [14 x i8]* %5, i64 0, i64 0
%23 = bitcast i32* %6 to i8*
%24 = bitcast i32* %7 to i8*
%25 = bitcast <2 x double>* %8 to i8*
%26 = bitcast <2 x double>* %10 to i8*
%27 = bitcast i32* %12 to i8*
%28 = bitcast i32* %13 to i8*
%29 = bitcast i32* %14 to i8*
%30 = bitcast i32* %15 to i8*
%31 = bitcast i32* %16 to i8*
%32 = bitcast double* %17 to i8*
%33 = bitcast double* %18 to i8*
%34 = call i32* @fopen(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%35 = call i32 (i32*, i8*, ...) @fscanf(i32* %34, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %6, i32* %7)
%36 = load i32, i32* %6
%37 = mul nsw i32 %36, %36
%38 = call double* @calloc(i32 %37, i32 8)
%39 = call double* @calloc(i32 %37, i32 8)
%40 = icmp eq i32 %37, 0
br i1 %40, label %46, label %41
41: ; preds = %0
%42 = bitcast double* %39 to i8*
%43 = bitcast double* %38 to i8*
%44 = zext i32 %37 to i64
%45 = shl nuw nsw i64 %44, 3
br label %46
46: ; preds = %41, %0
store i32 %37, i32* %12
%47 = load i32, i32* %7
%48 = icmp sgt i32 %47, 0
br i1 %48, label %49, label %70
49: ; preds = %46
%50 = getelementptr inbounds double, double* %38, i64 -1
%51 = getelementptr inbounds double, double* %39, i64 -1
br label %52
52: ; preds = %49, %52
%53 = phi i32 [ %67, %52 ], [ 0, %49 ]
%54 = call i32 (i32*, i8*, ...) @fscanf(i32* %34, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32* %12, i32* %13)
%55 = load i32, i32* %13
%56 = add nsw i32 %55, -1
%57 = load i32, i32* %6
%58 = mul nsw i32 %56, %57
%59 = sext i32 %58 to i64
%60 = load i32, i32* %12
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds double, double* %50, i64 %59
%63 = getelementptr inbounds double, double* %62, i64 %61
%64 = getelementptr inbounds double, double* %51, i64 %59
%65 = getelementptr inbounds double, double* %64, i64 %61
%66 = call i32 (i32*, i8*, ...) @fscanf(i32* %34, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), double* %63, double* %65)
%67 = add nuw nsw i32 %53, 1
%68 = load i32, i32* %7
%69 = icmp slt i32 %67, %68
br i1 %69, label %52, label %70
70: ; preds = %52, %46
%71 = call i32 @fclose(i32* %34)
%72 = load i32, i32* %6
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 %72)
%74 = call i32 @gettimeofday(%struct.timeval* %9, i32* null)
store double 1.800000e-01, double* %17
store double 1.000000e+00, double* %18
store i32 25, i32* %14
%75 = call double* @calloc(i32 25, i32 8)
%76 = call double* @calloc(i32 25, i32 8)
%77 = load i32, i32* %6
%78 = mul nsw i32 %77, 25
%79 = call double* @calloc(i32 %78, i32 8)
%80 = getelementptr inbounds [64 x i32], [64 x i32]* %1, i64 0, i64 0
%81 = call i32 @feastinit(i32* %80)
store i32 1, i32* %80
%82 = call i32 @dfeast_sygv(i8* %4, i32* %6, double* %38, i32* %6, double* %39, i32* %6, i32* %80, double* %2, i32* %3, double* %17, double* %18, i32* %14, double* %75, double* %79, i32* %15, double* %76, i32* %16)
%83 = call i32 @gettimeofday(%struct.timeval* %11, i32* null)
%84 = load i32, i32* %16
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 %84)
%86 = load i32, i32* %16
%87 = icmp eq i32 %86, 0
br i1 %87, label %88, label %191
88: ; preds = %70
%89 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.17, i64 0, i64 0))
%90 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.16, i64 0, i64 0))
%91 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.17, i64 0, i64 0))
%92 = load <2 x double>, <2 x double>* %10
%93 = load <2 x double>, <2 x double>* %8
%94 = fsub <2 x double> %92, %93
%95 = extractelement <2 x double> %94, i64 1
%96 = fmul double %95, 0x3EB0C6F7A0B5ED8D
%97 = extractelement <2 x double> %94, i64 0
%98 = fadd double %97, %96
%99 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), double %98)
%100 = load double, double* %17
%101 = load double, double* %18
%102 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.9, i64 0, i64 0), double %100, double %101)
%103 = load i32, i32* %15
%104 = load i32, i32* %14
%105 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i32 %103, i32 %104)
%106 = load i32, i32* %3
%107 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0), i32 %106)
%108 = load i32, i32* %15
%109 = icmp sgt i32 %108, 0
br i1 %109, label %110, label %170
110: ; preds = %88
%111 = zext i32 %108 to i64
%112 = add nsw i64 %111, -1
%113 = and i64 %111, 7
%114 = icmp ult i64 %112, 7
br i1 %114, label %155, label %115
115: ; preds = %110
%116 = and i64 %111, 4294967288
br label %117
117: ; preds = %117, %115
%118 = phi i64 [ 0, %115 ], [ %152, %117 ]
%119 = phi double [ 0.000000e+00, %115 ], [ %151, %117 ]
%120 = phi i64 [ 0, %115 ], [ %153, %117 ]
%121 = getelementptr inbounds double, double* %75, i64 %118
%122 = load double, double* %121
%123 = fadd double %119, %122
%124 = or i64 %118, 1
%125 = getelementptr inbounds double, double* %75, i64 %124
%126 = load double, double* %125
%127 = fadd double %123, %126
%128 = or i64 %118, 2
%129 = getelementptr inbounds double, double* %75, i64 %128
%130 = load double, double* %129
%131 = fadd double %127, %130
%132 = or i64 %118, 3
%133 = getelementptr inbounds double, double* %75, i64 %132
%134 = load double, double* %133
%135 = fadd double %131, %134
%136 = or i64 %118, 4
%137 = getelementptr inbounds double, double* %75, i64 %136
%138 = load double, double* %137
%139 = fadd double %135, %138
%140 = or i64 %118, 5
%141 = getelementptr inbounds double, double* %75, i64 %140
%142 = load double, double* %141
%143 = fadd double %139, %142
%144 = or i64 %118, 6
%145 = getelementptr inbounds double, double* %75, i64 %144
%146 = load double, double* %145
%147 = fadd double %143, %146
%148 = or i64 %118, 7
%149 = getelementptr inbounds double, double* %75, i64 %148
%150 = load double, double* %149
%151 = fadd double %147, %150
%152 = add nuw nsw i64 %118, 8
%153 = add i64 %120, 8
%154 = icmp eq i64 %153, %116
br i1 %154, label %155, label %117
155: ; preds = %117, %110
%156 = phi double [ undef, %110 ], [ %151, %117 ]
%157 = phi i64 [ 0, %110 ], [ %152, %117 ]
%158 = phi double [ 0.000000e+00, %110 ], [ %151, %117 ]
%159 = icmp eq i64 %113, 0
br i1 %159, label %170, label %160
160: ; preds = %155, %160
%161 = phi i64 [ %167, %160 ], [ %157, %155 ]
%162 = phi double [ %166, %160 ], [ %158, %155 ]
%163 = phi i64 [ %168, %160 ], [ 0, %155 ]
%164 = getelementptr inbounds double, double* %75, i64 %161
%165 = load double, double* %164
%166 = fadd double %162, %165
%167 = add nuw nsw i64 %161, 1
%168 = add i64 %163, 1
%169 = icmp eq i64 %168, %113
br i1 %169, label %170, label %160
170: ; preds = %155, %160, %88
%171 = phi i32 [ 0, %88 ], [ %108, %160 ], [ %108, %155 ]
%172 = phi double [ 0.000000e+00, %88 ], [ %156, %155 ], [ %166, %160 ]
store i32 %171, i32* %12
%173 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), double %172)
%174 = load double, double* %2
%175 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.13, i64 0, i64 0), double %174)
%176 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.18, i64 0, i64 0))
store i32 0, i32* %12
%177 = load i32, i32* %15
%178 = icmp sgt i32 %177, 0
br i1 %178, label %179, label %191
179: ; preds = %170, %179
%180 = phi i32 [ %188, %179 ], [ 0, %170 ]
%181 = sext i32 %180 to i64
%182 = getelementptr inbounds double, double* %75, i64 %181
%183 = load double, double* %182
%184 = getelementptr inbounds double, double* %76, i64 %181
%185 = load double, double* %184
%186 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.15, i64 0, i64 0), i32 %180, double %183, double %185)
%187 = load i32, i32* %12
%188 = add nsw i32 %187, 1
store i32 %188, i32* %12
%189 = load i32, i32* %15
%190 = icmp slt i32 %188, %189
br i1 %190, label %179, label %191
191: ; preds = %179, %170, %70
ret i32 0
}