#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 GTOBasis_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ GTO_JK_Matrix_CUDA1(int, unsigned int *, unsigned int *,
                                       unsigned int *, unsigned int *, int,
                                       float *, struct GTOBasis_t *, float *);
unsigned int *calloc(int, int);
int /*<<< orphan*/ exit(int);
float fabs(float);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ realloc(unsigned int *, int);
float sqrt(float);
void GTO_JK_Matrix1(int nBasis, float *P, struct GTOBasis_t *gto,
                    float *Schwarz, float cutoff, float *G) {
  int p, q, i, j, maxj;
  float EE;
  float upBound;
  int nEE = 0;
  unsigned int *iter_p, *iter_q, *iter_i, *iter_j;
  iter_p = calloc(2147483647, sizeof(unsigned int));
  if (iter_p == NULL) {
    printf("GTO_JK_Matrix_Quartet - error cannot allocate memory\n");
    exit(-1);
  };
  iter_q = calloc(2147483647, sizeof(unsigned int));
  if (iter_q == NULL) {
    printf("GTO_JK_Matrix_Quartet - error cannot allocate memory\n");
    exit(-1);
  };
  iter_i = calloc(2147483647, sizeof(unsigned int));
  if (iter_i == NULL) {
    printf("GTO_JK_Matrix_Quartet - error cannot allocate memory\n");
    exit(-1);
  };
  iter_j = calloc(2147483647, sizeof(unsigned int));
  if (iter_j == NULL) {
    printf("GTO_JK_Matrix_Quartet - error cannot allocate memory\n");
    exit(-1);
  };
  nEE = 0;
  for (p = 0; p < nBasis; p++) {
    for (q = 0; q < p + 1; q++) {
      for (i = 0; i < p + 1; i++) {
        if (i == p) {
          maxj = q + 1;
        } else {
          maxj = i + 1;
        }
        for (j = 0; j < maxj; j++) {
          upBound = Schwarz[i * nBasis + j] * Schwarz[p * nBasis + q];
          if (upBound < 1.0E-12)
            continue;
          upBound = sqrt(upBound);
          if (fabs(upBound * P[nBasis * p + q]) < cutoff &&
              fabs(upBound * P[nBasis * p + i]) < cutoff &&
              fabs(upBound * P[nBasis * p + j]) < cutoff &&
              fabs(upBound * P[nBasis * q + i]) < cutoff &&
              fabs(upBound * P[nBasis * q + j]) < cutoff &&
              fabs(upBound * P[nBasis * i + j]) < cutoff)
            continue;
          iter_p[nEE] = p;
          iter_q[nEE] = q;
          iter_i[nEE] = i;
          iter_j[nEE] = j;
          nEE++;
        }
      }
    }
  }
  realloc(iter_p, sizeof(unsigned int) * nEE);
  realloc(iter_q, sizeof(unsigned int) * nEE);
  realloc(iter_i, sizeof(unsigned int) * nEE);
  realloc(iter_j, sizeof(unsigned int) * nEE);
  GTO_JK_Matrix_CUDA1(nEE, iter_p, iter_q, iter_i, iter_j, nBasis, P, gto, G);
}


x86 assembly (clang, -O0):
<GTO_JK_Matrix1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movss  %xmm0,-0x24(%rbp)
mov    %r8,-0x30(%rbp)
movl   $0x0,-0x50(%rbp)
mov    $0x7fffffff,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
jne    11ce <GTO_JK_Matrix1+0x5e>
lea    0xe49(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
mov    $0x7fffffff,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
jne    1202 <GTO_JK_Matrix1+0x92>
lea    0xe15(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
mov    $0x7fffffff,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x68(%rbp)
jne    1236 <GTO_JK_Matrix1+0xc6>
lea    0xde1(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
mov    $0x7fffffff,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,-0x70(%rbp)
cmpq   $0x0,-0x70(%rbp)
jne    126a <GTO_JK_Matrix1+0xfa>
lea    0xdad(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
movl   $0x0,-0x50(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    14fd <GTO_JK_Matrix1+0x38d>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    14ea <GTO_JK_Matrix1+0x37a>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    14d7 <GTO_JK_Matrix1+0x367>
mov    -0x3c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jne    12ce <GTO_JK_Matrix1+0x15e>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    12d7 <GTO_JK_Matrix1+0x167>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    14c4 <GTO_JK_Matrix1+0x354>
mov    -0x20(%rbp),%rax
mov    -0x3c(%rbp),%ecx
imul   -0x4(%rbp),%ecx
add    -0x40(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x4(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
mulss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  -0x4c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xcd4(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    133b <GTO_JK_Matrix1+0x1cb>
jmp    14b6 <GTO_JK_Matrix1+0x346>
movss  -0x4c(%rbp),%xmm0
call   1080 <sqrt@plt>
movss  %xmm0,-0x4c(%rbp)
movss  -0x4c(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
mulss  (%rax,%rcx,4),%xmm0
call   1050 <fabs@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1475 <GTO_JK_Matrix1+0x305>
movss  -0x4c(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x3c(%rbp),%ecx
movslq %ecx,%rcx
mulss  (%rax,%rcx,4),%xmm0
call   1050 <fabs@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1475 <GTO_JK_Matrix1+0x305>
movss  -0x4c(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x40(%rbp),%ecx
movslq %ecx,%rcx
mulss  (%rax,%rcx,4),%xmm0
call   1050 <fabs@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1475 <GTO_JK_Matrix1+0x305>
movss  -0x4c(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
imul   -0x38(%rbp),%ecx
add    -0x3c(%rbp),%ecx
movslq %ecx,%rcx
mulss  (%rax,%rcx,4),%xmm0
call   1050 <fabs@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1475 <GTO_JK_Matrix1+0x305>
movss  -0x4c(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
imul   -0x38(%rbp),%ecx
add    -0x40(%rbp),%ecx
movslq %ecx,%rcx
mulss  (%rax,%rcx,4),%xmm0
call   1050 <fabs@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1475 <GTO_JK_Matrix1+0x305>
movss  -0x4c(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
imul   -0x3c(%rbp),%ecx
add    -0x40(%rbp),%ecx
movslq %ecx,%rcx
mulss  (%rax,%rcx,4),%xmm0
call   1050 <fabs@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1475 <GTO_JK_Matrix1+0x305>
jmp    14b6 <GTO_JK_Matrix1+0x346>
mov    -0x34(%rbp),%edx
mov    -0x58(%rbp),%rax
movslq -0x50(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x38(%rbp),%edx
mov    -0x60(%rbp),%rax
movslq -0x50(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x3c(%rbp),%edx
mov    -0x68(%rbp),%rax
movslq -0x50(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x40(%rbp),%edx
mov    -0x70(%rbp),%rax
movslq -0x50(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    12de <GTO_JK_Matrix1+0x16e>
jmp    14c9 <GTO_JK_Matrix1+0x359>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    12a3 <GTO_JK_Matrix1+0x133>
jmp    14dc <GTO_JK_Matrix1+0x36c>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    128b <GTO_JK_Matrix1+0x11b>
jmp    14ef <GTO_JK_Matrix1+0x37f>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1278 <GTO_JK_Matrix1+0x108>
mov    -0x58(%rbp),%rdi
movslq -0x50(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%esi
call   1070 <realloc@plt>
mov    -0x60(%rbp),%rdi
movslq -0x50(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%esi
call   1070 <realloc@plt>
mov    -0x68(%rbp),%rdi
movslq -0x50(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%esi
call   1070 <realloc@plt>
mov    -0x70(%rbp),%rdi
movslq -0x50(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%esi
call   1070 <realloc@plt>
mov    -0x50(%rbp),%edi
mov    -0x58(%rbp),%rsi
mov    -0x60(%rbp),%rdx
mov    -0x68(%rbp),%rcx
mov    -0x70(%rbp),%r8
mov    -0x4(%rbp),%r9d
mov    -0x10(%rbp),%r11
mov    -0x18(%rbp),%r10
mov    -0x30(%rbp),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1060 <GTO_JK_Matrix_CUDA1@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GTO_JK_Matrix1>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
mov    %r8,%r14
movss  %xmm0,0xc(%rsp)
mov    %rcx,0x50(%rsp)
mov    %rdx,%r15
mov    %rsi,0x30(%rsp)
mov    %edi,%ebp
mov    $0x7fffffff,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,0x70(%rsp)
test   %rax,%rax
je     1532 <GTO_JK_Matrix1+0x3d2>
mov    $0x7fffffff,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,0x68(%rsp)
test   %rax,%rax
je     1532 <GTO_JK_Matrix1+0x3d2>
mov    $0x7fffffff,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,0x60(%rsp)
test   %rax,%rax
je     1532 <GTO_JK_Matrix1+0x3d2>
mov    $0x7fffffff,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,0x58(%rsp)
test   %rax,%rax
je     1532 <GTO_JK_Matrix1+0x3d2>
test   %ebp,%ebp
mov    0x30(%rsp),%r8
movss  0xc(%rsp),%xmm2
mov    0x50(%rsp),%r9
mov    %r14,0x80(%rsp)
mov    %r15,0x78(%rsp)
mov    %ebp,0x3c(%rsp)
jle    14a6 <GTO_JK_Matrix1+0x346>
mov    %ebp,%ecx
lea    0x0(,%rcx,4),%rsi
mov    %rsi,0x18(%rsp)
xor    %ebx,%ebx
mov    $0x1,%edi
mov    %rdi,0x10(%rsp)
movsd  0xdb7(%rip),%xmm3
xorps  %xmm4,%xmm4
movaps 0xdbd(%rip),%xmm5
mov    %r8,0x28(%rsp)
xor    %r13d,%r13d
mov    %rcx,0x88(%rsp)
jmp    1292 <GTO_JK_Matrix1+0x132>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rbx
addq   $0x1,0x10(%rsp)
mov    0x28(%rsp),%rdi
add    0x18(%rsp),%rdi
mov    %rdi,0x28(%rsp)
cmp    %rcx,%rbx
je     14a9 <GTO_JK_Matrix1+0x349>
mov    %rbx,%rdi
imul   %rcx,%rdi
mov    %rdi,0x40(%rsp)
mov    %r8,0x20(%rsp)
xor    %r14d,%r14d
jmp    12d2 <GTO_JK_Matrix1+0x172>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r14
mov    0x20(%rsp),%rcx
add    0x18(%rsp),%rcx
mov    %rcx,0x20(%rsp)
cmp    0x10(%rsp),%r14
mov    0x88(%rsp),%rcx
je     1270 <GTO_JK_Matrix1+0x110>
mov    0x40(%rsp),%rdi
lea    (%r14,%rdi,1),%rdx
mov    %r14,%rdi
imul   %rcx,%rdi
mov    %rdi,0x90(%rsp)
mov    %r8,0x48(%rsp)
mov    %r9,%rdi
xor    %r12d,%r12d
jmp    1318 <GTO_JK_Matrix1+0x1b8>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r12
mov    0x18(%rsp),%rcx
add    %rcx,%rdi
add    %rcx,0x48(%rsp)
cmp    0x10(%rsp),%r12
je     12b0 <GTO_JK_Matrix1+0x150>
mov    0x40(%rsp),%rcx
add    %r12,%rcx
mov    %rcx,0xa8(%rsp)
mov    0x90(%rsp),%rcx
add    %r12,%rcx
mov    %rcx,0x98(%rsp)
cmp    %rbx,%r12
mov    %r14d,%r15d
cmovne %r12d,%r15d
add    $0x1,%r15d
xor    %ebp,%ebp
mov    %rdi,0xa0(%rsp)
jmp    1398 <GTO_JK_Matrix1+0x238>
cs nopw 0x0(%rax,%rax,1)
nop
movslq %r13d,%r13
mov    0x70(%rsp),%rcx
mov    %ebx,(%rcx,%r13,4)
mov    0x68(%rsp),%rcx
mov    %r14d,(%rcx,%r13,4)
mov    0x60(%rsp),%rcx
mov    %r12d,(%rcx,%r13,4)
mov    0x58(%rsp),%rcx
mov    %ebp,(%rcx,%r13,4)
add    $0x1,%r13d
add    $0x1,%rbp
cmp    %rbp,%r15
je     1300 <GTO_JK_Matrix1+0x1a0>
movss  (%rdi,%rbp,4),%xmm0
mulss  (%r9,%rdx,4),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
ucomisd %xmm1,%xmm3
ja     138b <GTO_JK_Matrix1+0x22b>
ucomiss %xmm4,%xmm0
jb     13c0 <GTO_JK_Matrix1+0x260>
sqrtss %xmm0,%xmm0
jmp    1405 <GTO_JK_Matrix1+0x2a5>
nopl   0x0(%rax,%rax,1)
mov    %r13,0xb0(%rsp)
mov    %rdx,%r13
call   1070 <sqrt@plt>
mov    %r13,%rdx
mov    0xb0(%rsp),%r13
mov    0xa0(%rsp),%rdi
movaps 0xc26(%rip),%xmm5
xorps  %xmm4,%xmm4
movsd  0xc0b(%rip),%xmm3
mov    0x50(%rsp),%r9
movss  0xc(%rsp),%xmm2
mov    0x30(%rsp),%r8
movss  (%r8,%rdx,4),%xmm1
mulss  %xmm0,%xmm1
andps  %xmm5,%xmm1
ucomiss %xmm1,%xmm2
jbe    1360 <GTO_JK_Matrix1+0x200>
mov    0xa8(%rsp),%rcx
movss  (%r8,%rcx,4),%xmm1
mulss  %xmm0,%xmm1
andps  %xmm5,%xmm1
ucomiss %xmm1,%xmm2
jbe    1360 <GTO_JK_Matrix1+0x200>
mov    0x28(%rsp),%rcx
movss  (%rcx,%rbp,4),%xmm1
mulss  %xmm0,%xmm1
andps  %xmm5,%xmm1
ucomiss %xmm1,%xmm2
jbe    1360 <GTO_JK_Matrix1+0x200>
mov    0x98(%rsp),%rcx
movss  (%r8,%rcx,4),%xmm1
mulss  %xmm0,%xmm1
andps  %xmm5,%xmm1
ucomiss %xmm1,%xmm2
jbe    1360 <GTO_JK_Matrix1+0x200>
mov    0x20(%rsp),%rcx
movss  (%rcx,%rbp,4),%xmm1
mulss  %xmm0,%xmm1
andps  %xmm5,%xmm1
ucomiss %xmm1,%xmm2
jbe    1360 <GTO_JK_Matrix1+0x200>
mov    0x48(%rsp),%rcx
mulss  (%rcx,%rbp,4),%xmm0
andps  %xmm5,%xmm0
ucomiss %xmm0,%xmm2
jbe    1360 <GTO_JK_Matrix1+0x200>
jmp    138b <GTO_JK_Matrix1+0x22b>
xor    %r13d,%r13d
lea    0x0(,%r13,4),%r14d
mov    0x70(%rsp),%r12
mov    %r12,%rdi
mov    %r14d,%esi
call   1060 <realloc@plt>
mov    0x68(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14d,%esi
call   1060 <realloc@plt>
mov    0x60(%rsp),%rbp
mov    %rbp,%rdi
mov    %r14d,%esi
call   1060 <realloc@plt>
mov    0x58(%rsp),%r15
mov    %r15,%rdi
mov    %r14d,%esi
call   1060 <realloc@plt>
sub    $0x8,%rsp
mov    %r13d,%edi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %rbp,%rcx
mov    %r15,%r8
mov    0x44(%rsp),%r9d
push   0x88(%rsp)
push   0x88(%rsp)
push   0x48(%rsp)
call   1050 <GTO_JK_Matrix_CUDA1@plt>
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xae7(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>

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

LLVM IR (-O2):
%struct.GTOBasis_t = type { i32 }
@str.3 = [53 x i8] c"GTO_JK_Matrix_Quartet - error cannot allocate memory\00"
define void @GTO_JK_Matrix1(i32 %0, float* %1, %struct.GTOBasis_t* %2, float* nocapture %3, float %4, float* %5) {
%7 = tail call i32* @calloc(i32 2147483647, i32 4)
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.3, i64 0, i64 0))
%11 = tail call i32 @exit(i32 -1)
unreachable
12: ; preds = %6
%13 = tail call i32* @calloc(i32 2147483647, i32 4)
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.3, i64 0, i64 0))
%17 = tail call i32 @exit(i32 -1)
unreachable
18: ; preds = %12
%19 = tail call i32* @calloc(i32 2147483647, i32 4)
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.3, i64 0, i64 0))
%23 = tail call i32 @exit(i32 -1)
unreachable
24: ; preds = %18
%25 = tail call i32* @calloc(i32 2147483647, i32 4)
%26 = icmp eq i32* %25, null
br i1 %26, label %32, label %27
27: ; preds = %24
%28 = icmp sgt i32 %0, 0
br i1 %28, label %29, label %130
29: ; preds = %27
%30 = zext i32 %0 to i64
%31 = zext i32 %0 to i64
br label %35
32: ; preds = %24
%33 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.3, i64 0, i64 0))
%34 = tail call i32 @exit(i32 -1)
unreachable
35: ; preds = %29, %126
%36 = phi i64 [ 0, %29 ], [ %127, %126 ]
%37 = phi i64 [ 1, %29 ], [ %128, %126 ]
%38 = phi i32 [ 0, %29 ], [ %117, %126 ]
%39 = mul nsw i64 %36, %30
%40 = trunc i64 %36 to i32
br label %41
41: ; preds = %35, %123
%42 = phi i64 [ 0, %35 ], [ %124, %123 ]
%43 = phi i32 [ %38, %35 ], [ %117, %123 ]
%44 = add nuw nsw i64 %42, %39
%45 = getelementptr inbounds float, float* %3, i64 %44
%46 = getelementptr inbounds float, float* %1, i64 %44
%47 = mul nsw i64 %42, %30
%48 = trunc i64 %42 to i32
br label %49
49: ; preds = %41, %120
%50 = phi i64 [ 0, %41 ], [ %121, %120 ]
%51 = phi i32 [ %43, %41 ], [ %117, %120 ]
%52 = icmp eq i64 %50, %36
%53 = trunc i64 %50 to i32
%54 = select i1 %52, i64 %42, i64 %50
%55 = mul nsw i64 %50, %30
%56 = add nuw nsw i64 %50, %39
%57 = getelementptr inbounds float, float* %1, i64 %56
%58 = add nuw nsw i64 %50, %47
%59 = getelementptr inbounds float, float* %1, i64 %58
%60 = add nuw i64 %54, 1
%61 = and i64 %60, 4294967295
br label %62
62: ; preds = %49, %116
%63 = phi i64 [ 0, %49 ], [ %118, %116 ]
%64 = phi i32 [ %51, %49 ], [ %117, %116 ]
%65 = add nuw nsw i64 %63, %55
%66 = getelementptr inbounds float, float* %3, i64 %65
%67 = load float, float* %66
%68 = load float, float* %45
%69 = fmul float %67, %68
%70 = fpext float %69 to double
%71 = fcmp olt double %70, 0x3D719799812DEA11
br i1 %71, label %116, label %72
72: ; preds = %62
%73 = tail call float @sqrt(float %69)
%74 = load float, float* %46
%75 = fmul float %73, %74
%76 = tail call float @llvm.fabs.f32(float %75)
%77 = fcmp olt float %76, %4
br i1 %77, label %78, label %108
78: ; preds = %72
%79 = load float, float* %57
%80 = fmul float %73, %79
%81 = tail call float @llvm.fabs.f32(float %80)
%82 = fcmp olt float %81, %4
br i1 %82, label %83, label %108
83: ; preds = %78
%84 = add nuw nsw i64 %63, %39
%85 = getelementptr inbounds float, float* %1, i64 %84
%86 = load float, float* %85
%87 = fmul float %73, %86
%88 = tail call float @llvm.fabs.f32(float %87)
%89 = fcmp olt float %88, %4
br i1 %89, label %90, label %108
90: ; preds = %83
%91 = load float, float* %59
%92 = fmul float %73, %91
%93 = tail call float @llvm.fabs.f32(float %92)
%94 = fcmp olt float %93, %4
br i1 %94, label %95, label %108
95: ; preds = %90
%96 = add nuw nsw i64 %63, %47
%97 = getelementptr inbounds float, float* %1, i64 %96
%98 = load float, float* %97
%99 = fmul float %73, %98
%100 = tail call float @llvm.fabs.f32(float %99)
%101 = fcmp olt float %100, %4
br i1 %101, label %102, label %108
102: ; preds = %95
%103 = getelementptr inbounds float, float* %1, i64 %65
%104 = load float, float* %103
%105 = fmul float %73, %104
%106 = tail call float @llvm.fabs.f32(float %105)
%107 = fcmp olt float %106, %4
br i1 %107, label %116, label %108
108: ; preds = %102, %95, %90, %83, %78, %72
%109 = sext i32 %64 to i64
%110 = getelementptr inbounds i32, i32* %7, i64 %109
store i32 %40, i32* %110
%111 = getelementptr inbounds i32, i32* %13, i64 %109
store i32 %48, i32* %111
%112 = getelementptr inbounds i32, i32* %19, i64 %109
store i32 %53, i32* %112
%113 = getelementptr inbounds i32, i32* %25, i64 %109
%114 = trunc i64 %63 to i32
store i32 %114, i32* %113
%115 = add nsw i32 %64, 1
br label %116
116: ; preds = %102, %62, %108
%117 = phi i32 [ %64, %62 ], [ %64, %102 ], [ %115, %108 ]
%118 = add nuw nsw i64 %63, 1
%119 = icmp eq i64 %118, %61
br i1 %119, label %120, label %62
120: ; preds = %116
%121 = add nuw nsw i64 %50, 1
%122 = icmp eq i64 %121, %37
br i1 %122, label %123, label %49
123: ; preds = %120
%124 = add nuw nsw i64 %42, 1
%125 = icmp eq i64 %124, %37
br i1 %125, label %126, label %41
126: ; preds = %123
%127 = add nuw nsw i64 %36, 1
%128 = add nuw nsw i64 %37, 1
%129 = icmp eq i64 %127, %31
br i1 %129, label %130, label %35
130: ; preds = %126, %27
%131 = phi i32 [ 0, %27 ], [ %117, %126 ]
%132 = shl i32 %131, 2
%133 = tail call i32 @realloc(i32* %7, i32 %132)
%134 = tail call i32 @realloc(i32* %13, i32 %132)
%135 = tail call i32 @realloc(i32* %19, i32 %132)
%136 = tail call i32 @realloc(i32* %25, i32 %132)
%137 = tail call i32 @GTO_JK_Matrix_CUDA1(i32 %131, i32* %7, i32* %13, i32* %19, i32* %25, i32 %0, float* %1, %struct.GTOBasis_t* %2, float* %5)
ret void
}