// File: /workspace/github_c_makefile_star2_O3/jiqingxiaoxi[P]RPA/RPA.c
// Function: getStack
void getStack(double stackEntropies[],double stackEnthalpies[], char *path)
{
        int i, j, ii, jj;
        FILE *sFile, *hFile;
        char *line;

        i=strlen(path)+20;
        line=(char *)malloc(i);
        memset(line,'\0',i);
        strcpy(line,path);
        strcat(line,"stack.ds");
        if(access(line,0)==-1)
        {
                printf("Error! Don't have %s file!\n",line);
                exit(1);
        }
        sFile=fopen(line,"r");
        if(sFile==NULL)
        {
                printf("Error! Can't open the %s file!\n",line);
                exit(1);
        }

        memset(line,'\0',i);
        strcpy(line,path);
        strcat(line,"stack.dh");
        if(access(line,0)==-1)
        {
                printf("Error! Don't have %s file!\n",line);
                exit(1);
        }
        hFile=fopen(line,"r");
        if(hFile==NULL)
        {
                printf("Error! Can't open the %s file!\n",line);
                exit(1);
        }
        free(line);

        line=(char *)malloc(20);
        memset(line,'\0',20);
        for (i = 0; i < 5; ++i)
        {
                for (ii = 0; ii < 5; ++ii)
                {
                        for (j = 0; j < 5; ++j)
                        {
                                for (jj = 0; jj < 5; ++jj)
                                {
                                        if (i == 4 || j == 4 || ii == 4 || jj == 4) //N 
                                        {
                                                stackEntropies[i*125+ii*25+j*5+jj] = -1.0;
                                                stackEnthalpies[i*125+ii*25+j*5+jj]=1.0*INFINITY;
                                        }
                                        else 
                                        {
                                                if(fgets(line,20,sFile)==NULL)
                                                {
                                                        printf("Error! When read parameters in getStack function!\n");
                                                        exit(1);
                                                }
                                                if(strncmp(line, "inf", 3)==0)
                                                        stackEntropies[i*125+ii*25+j*5+jj]=1.0*INFINITY;
                                                else
                                                        stackEntropies[i*125+ii*25+j*5+jj] = atof(line);

                                                if(fgets(line,20,hFile)==NULL)
                                                {
                                                        printf("Error! When read parameters in getStack function!\n");
                                                        exit(1);
                                                }
                                                if(strncmp(line, "inf", 3)==0)
                                                        stackEnthalpies[i*125+ii*25+j*5+jj]=1.0*INFINITY;
                                                else
                                                        stackEnthalpies[i*125+ii*25+j*5+jj] = atof(line);

                                                if (fabs(stackEntropies[i*125+ii*25+j*5+jj])>999999999 ||fabs(stackEnthalpies[i*125+ii*25+j*5+jj])>999999999) 
                                                {
                                                        stackEntropies[i*125+ii*25+j*5+jj] = -1.0;
                                                        stackEnthalpies[i*125+ii*25+j*5+jj] =1.0*INFINITY;
                                                }
                                        }
                                }
                        }
                }
        }
        fclose(sFile);
        fclose(hFile);
        free(line);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdx, %r12
movq %rsi, -0x58(%rbp)
movq %rdi, -0x40(%rbp)
movq %rdx, %rdi
callq 0x10b0
addl $0x14, %eax
movslq %eax, %r13
movl $0x1, %edi
movq %r13, %rsi
callq 0x1140
movq %rax, %r14
movq %rax, %rdi
movq %r12, %rsi
callq 0x1050
movq %r14, %rdi
callq 0x10b0
movabsq $0x73642e6b63617473, %rcx # imm = 0x73642E6B63617473
movq %rcx, (%r14,%rax)
movb $0x0, 0x8(%r14,%rax)
movq %r14, %rdi
xorl %esi, %esi
callq 0x11c0
cmpl $-0x1, %eax
je 0x18ce
leaq 0xcc6f(%rip), %rsi      # 0xe21b
movq %r14, %rdi
callq 0x11d0
movq %rax, -0x38(%rbp)
testq %rax, %rax
je 0x18d7
movq %r14, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x1100
movq %r14, %rdi
movq %r12, %rsi
callq 0x1050
movq %r14, %rdi
callq 0x10b0
movabsq $0x68642e6b63617473, %rcx # imm = 0x68642E6B63617473
movq %rcx, (%r14,%rax)
movb $0x0, 0x8(%r14,%rax)
movq %r14, %rdi
xorl %esi, %esi
callq 0x11c0
cmpl $-0x1, %eax
je 0x18ce
leaq 0xcc0c(%rip), %rsi      # 0xe21b
movq %r14, %rdi
callq 0x11d0
movq %rax, -0x30(%rbp)
testq %rax, %rax
je 0x18d7
movq %r14, %rdi
callq 0x1030
movl $0x1, %edi
movl $0x14, %esi
callq 0x1140
movq %rax, %r13
xorl %eax, %eax
movq -0x58(%rbp), %rcx
movq -0x40(%rbp), %r15
xorl %edi, %edi
imulq $0x7d, %rdi, %rdx
movq %rdx, -0x78(%rbp)
movq %rcx, -0x68(%rbp)
movq %r15, -0x60(%rbp)
movq %rax, -0x70(%rbp)
movq %rax, %rdx
xorl %r8d, %r8d
movq %rdi, -0x98(%rbp)
leaq (%r8,%r8,4), %rax
leaq (%rax,%rax,4), %rax
addq -0x78(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq %rcx, -0x90(%rbp)
movq %rcx, -0x50(%rbp)
movq %r15, -0x88(%rbp)
movq %rdx, -0x80(%rbp)
movq %rdx, -0x48(%rbp)
xorl %edx, %edx
movq %r8, -0xa0(%rbp)
cmpq $0x4, %r8
sete %al
cmpq $0x4, %rdi
sete %cl
cmpq $0x4, %rdx
sete %r14b
orb %cl, %r14b
orb %al, %r14b
movq %rdx, -0xb0(%rbp)
leaq (%rdx,%rdx,4), %rbx
addq -0xa8(%rbp), %rbx
notb %r14b
movq %r15, -0xb8(%rbp)
xorl %r12d, %r12d
cmpq $0x4, %r12
setne %al
testb %al, %r14b
jne 0x1718
leaq (%rbx,%r12), %rax
movq -0x40(%rbp), %rcx
leaq (%rcx,%rax,8), %rcx
movabsq $-0x4010000000000000, %rdx # imm = 0xBFF0000000000000
movq %rdx, (%rcx)
movq -0x58(%rbp), %rcx
movabsq $0x7ff0000000000000, %rdx # imm = 0x7FF0000000000000
movq %rdx, (%rcx,%rax,8)
jmp 0x17e2
movq %r13, %rdi
movl $0x14, %esi
movq -0x38(%rbp), %rdx
callq 0x1130
testq %rax, %rax
je 0x18b8
movl $0x3, %edx
movq %r13, %rdi
leaq 0xc9c7(%rip), %rsi      # 0xe108
callq 0x1040
movsd 0xc8ca(%rip), %xmm0     # 0xe018
testl %eax, %eax
je 0x175a
movq %r13, %rdi
callq 0x1090
movsd %xmm0, (%r15)
movq %r13, %rdi
movl $0x14, %esi
movq -0x30(%rbp), %rdx
callq 0x1130
testq %rax, %rax
je 0x18b8
movl $0x3, %edx
movq %r13, %rdi
leaq 0xc980(%rip), %rsi      # 0xe108
callq 0x1040
movsd 0xc883(%rip), %xmm0     # 0xe018
testl %eax, %eax
je 0x17a1
movq %r13, %rdi
callq 0x1090
movq -0x48(%rbp), %rax
addq %r12, %rax
movq -0x50(%rbp), %rcx
movsd %xmm0, (%rcx,%r12,8)
movsd (%r15), %xmm1
movapd 0xc901(%rip), %xmm2     # 0xe0c0
andpd %xmm2, %xmm1
movsd 0xc855(%rip), %xmm3     # 0xe020
ucomisd %xmm3, %xmm1
ja 0x17f5
andpd %xmm2, %xmm0
ucomisd %xmm3, %xmm0
movq %r15, %rcx
ja 0x16f4
incq %r12
addq $0x8, %r15
cmpq $0x5, %r12
jne 0x16dc
jmp 0x17fd
movq %r15, %rcx
jmp 0x16f4
movq -0xb0(%rbp), %rdx
incq %rdx
addq $0x5, -0x48(%rbp)
movq -0xb8(%rbp), %r15
addq $0x28, %r15
addq $0x28, -0x50(%rbp)
cmpq $0x5, %rdx
movq -0x98(%rbp), %rdi
movq -0xa0(%rbp), %r8
jne 0x16a1
incq %r8
movq -0x80(%rbp), %rdx
addq $0x19, %rdx
movl $0xc8, %eax
movq -0x88(%rbp), %r15
addq %rax, %r15
movq -0x90(%rbp), %rcx
addq %rax, %rcx
cmpq $0x5, %r8
jne 0x166b
incq %rdi
movq -0x70(%rbp), %rax
addq $0x7d, %rax
movl $0x3e8, %ecx            # imm = 0x3E8
movq -0x60(%rbp), %r15
addq %rcx, %r15
movq -0x68(%rbp), %rdx
addq %rcx, %rdx
movq %rdx, %rcx
cmpq $0x5, %rdi
jne 0x164a
movq -0x38(%rbp), %rdi
callq 0x10a0
movq -0x30(%rbp), %rdi
callq 0x10a0
movq %r13, %rdi
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1030
leaq 0xccf9(%rip), %rdi      # 0xe5b8
callq 0x1070
movl $0x1, %edi
callq 0x1200
leaq 0xc844(%rip), %rdi      # 0xe119
jmp 0x18de
leaq 0xc857(%rip), %rdi      # 0xe135
movq %r14, %rsi
xorl %eax, %eax
callq 0x10c0
jmp 0x18c4