// File: /workspace/github_c_makefile_star2_O2/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, %r15
movq %rsi, -0x78(%rbp)
movq %rdi, -0x60(%rbp)
movq %rdx, %rdi
callq 0x10b0
addl $0x14, %eax
movslq %eax, %r12
pushq $0x1
popq %rdi
movq %r12, %rsi
callq 0x1140
movq %rax, %r14
movq %rax, %rdi
movq %r15, %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 0x11b0
cmpl $-0x1, %eax
je 0x18a7
leaq 0xbcbb(%rip), %rsi      # 0xd23b
movq %r14, %rdi
callq 0x11c0
movq %rax, -0x58(%rbp)
testq %rax, %rax
je 0x18b0
movq %r14, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x1100
movq %r14, %rdi
movq %r15, %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 0x11b0
cmpl $-0x1, %eax
je 0x18a7
leaq 0xbc58(%rip), %rsi      # 0xd23b
movq %r14, %rdi
callq 0x11c0
movq %rax, -0x50(%rbp)
testq %rax, %rax
je 0x18b0
movq %r14, %rdi
callq 0x1030
pushq $0x1
popq %rdi
pushq $0x14
popq %rsi
callq 0x1140
movq %rax, %r13
movq $0x0, -0x38(%rbp)
movq -0x78(%rbp), %rax
movq -0x60(%rbp), %rcx
movq %rcx, -0x30(%rbp)
xorl %edx, %edx
cmpq $0x5, %rdx
je 0x1868
imulq $0x7d, %rdx, %rcx
movq %rcx, -0x88(%rbp)
movq %rax, -0x80(%rbp)
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
xorl %esi, %esi
movq %rdx, -0x98(%rbp)
cmpq $0x5, %rsi
je 0x1848
imulq $0x19, %rsi, %rax
addq -0x88(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq %rcx, -0x90(%rbp)
movq %rcx, -0x70(%rbp)
movq -0x48(%rbp), %r14
movq -0x40(%rbp), %rax
movq %rax, -0x68(%rbp)
xorl %edi, %edi
movq %rsi, -0xa0(%rbp)
cmpq $0x5, %rdi
je 0x1828
cmpq $0x4, %rsi
sete %al
cmpq $0x4, %rdx
sete %cl
cmpq $0x4, %rdi
sete %r12b
orb %cl, %r12b
orb %al, %r12b
movq %rdi, -0xb0(%rbp)
leaq (%rdi,%rdi,4), %rbx
addq -0xa8(%rbp), %rbx
notb %r12b
movq %r14, -0xb8(%rbp)
xorl %r15d, %r15d
cmpq $0x5, %r15
je 0x17f6
cmpq $0x4, %r15
setne %al
testb %al, %r12b
jne 0x1720
leaq (%rbx,%r15), %rax
movq -0x60(%rbp), %rcx
leaq (%rcx,%rax,8), %rcx
movabsq $-0x4010000000000000, %rdx # imm = 0xBFF0000000000000
movq %rdx, (%rcx)
movq -0x78(%rbp), %rcx
movabsq $0x7ff0000000000000, %rdx # imm = 0x7FF0000000000000
movq %rdx, (%rcx,%rax,8)
jmp 0x17e2
movq %r13, %rdi
pushq $0x14
popq %rsi
movq -0x58(%rbp), %rdx
callq 0x1130
testq %rax, %rax
je 0x1893
movq %r13, %rdi
leaq 0xb9e6(%rip), %rsi      # 0xd128
pushq $0x3
popq %rdx
callq 0x1040
movsd 0xb8d6(%rip), %xmm0     # 0xd028
testl %eax, %eax
je 0x175e
movq %r13, %rdi
callq 0x1090
movsd %xmm0, (%r14)
movq %r13, %rdi
pushq $0x14
popq %rsi
movq -0x50(%rbp), %rdx
callq 0x1130
testq %rax, %rax
je 0x1893
movq %r13, %rdi
leaq 0xb9a3(%rip), %rsi      # 0xd128
pushq $0x3
popq %rdx
callq 0x1040
movsd 0xb893(%rip), %xmm0     # 0xd028
testl %eax, %eax
je 0x17a1
movq %r13, %rdi
callq 0x1090
movq -0x68(%rbp), %rax
addq %r15, %rax
movq -0x70(%rbp), %rcx
movsd %xmm0, (%rcx,%r15,8)
movsd (%r14), %xmm1
movapd 0xb921(%rip), %xmm2     # 0xd0e0
andpd %xmm2, %xmm1
movsd 0xb865(%rip), %xmm3     # 0xd030
ucomisd %xmm3, %xmm1
ja 0x17ee
andpd %xmm2, %xmm0
ucomisd %xmm3, %xmm0
movq %r14, %rcx
ja 0x16fc
incq %r15
addq $0x8, %r14
jmp 0x16da
movq %r14, %rcx
jmp 0x16fc
movq -0xb0(%rbp), %rdi
incq %rdi
addq $0x5, -0x68(%rbp)
movq -0xb8(%rbp), %r14
addq $0x28, %r14
addq $0x28, -0x70(%rbp)
movq -0x98(%rbp), %rdx
movq -0xa0(%rbp), %rsi
jmp 0x1695
incq %rsi
addq $0x19, -0x40(%rbp)
movl $0xc8, %eax
addq %rax, -0x48(%rbp)
movq -0x90(%rbp), %rcx
addq %rax, %rcx
jmp 0x1659
incq %rdx
addq $0x7d, -0x38(%rbp)
movl $0x3e8, %eax            # imm = 0x3E8
addq %rax, -0x30(%rbp)
movq -0x80(%rbp), %rcx
addq %rax, %rcx
movq %rcx, %rax
jmp 0x1624
movq -0x58(%rbp), %rdi
callq 0x10a0
movq -0x50(%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 0xbd3e(%rip), %rdi      # 0xd5d8
callq 0x1070
pushq $0x1
popq %rdi
callq 0x11f0
leaq 0xb88b(%rip), %rdi      # 0xd139
jmp 0x18b7
leaq 0xb89e(%rip), %rdi      # 0xd155
movq %r14, %rsi
xorl %eax, %eax
callq 0x10c0
jmp 0x189f