// File: /workspace/github_cpp_makefile_star2_O3/gjoni[P]iPot/src/AACE.cpp
// Function: AACE::AACE(std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>> const&, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
AACE::AACE(const GROUPS_TYPE &GROUPS, double dmax_, 
		const std::string &name_) : 
		h(NULL), J(NULL), dmax(dmax_), name(name_) {

	int dim = ReadGroups(GROUPS);
	Allocate(dim);

	FILE *F = fopen(name.c_str(), "r");
	if (F == NULL) {
		printf("Error: cannot open table file %s\n", name.c_str());
		exit(1);
	}

	const int STRMAX = 10000;
	char buf[STRMAX];

	int N = 0;
	
	while (fgets(buf, STRMAX, F)) {
		N++;
	}
	rewind(F);
	
	assert(N == dim);

	for (int i = 0; i < N; i++) {
		fgets(buf, STRMAX, F);
		char * pch;
		pch = strtok(buf, " "); /* label */
		pch = strtok(NULL, " "); /* local field */
		h[i] = atof(pch);
		for (int j = 0; j < N; j++) {
			pch = strtok(NULL, " ");
			J[i][j] = atof(pch);
		}
	}
	fclose(F);

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2718, %rsp           # imm = 0x2718
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x8(%rdi), %rax
xorl %ecx, %ecx
movl %ecx, 0x8(%rdi)
movq %rcx, 0x10(%rdi)
movq %rax, 0x18(%rdi)
movq %rax, 0x20(%rdi)
movq %rcx, 0x28(%rdi)
leaq 0x38(%rdi), %rax
movl %ecx, 0x38(%rdi)
movq %rcx, 0x40(%rdi)
movq %rax, 0x48(%rdi)
movq %rax, 0x50(%rdi)
xorps %xmm1, %xmm1
movups %xmm1, 0x58(%rdi)
movq %rcx, 0x68(%rdi)
movsd %xmm0, 0x70(%rdi)
leaq 0x78(%rdi), %r15
leaq 0x88(%rdi), %r12
movq %r12, 0x78(%rdi)
movq (%rdx), %rsi
movq 0x8(%rdx), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x12d4c
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10c6a
movl %eax, %ebp
movq %rbx, %rdi
movl %eax, %esi
callq 0x10d66
movq 0x78(%rbx), %rdi
leaq 0x9cf5(%rip), %rsi      # 0x1ab4d
callq 0x2250
testq %rax, %rax
je 0x10f31
movq %rax, %r14
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movq %rsp, %r15
movq %r15, %rdi
movl $0x2710, %esi           # imm = 0x2710
movq %r14, %rdx
callq 0x2350
incl %r12d
testq %rax, %rax
jne 0x10e72
movq %r14, %rdi
callq 0x2060
cmpl %r12d, %ebp
jne 0x10f4c
testl %ebp, %ebp
je 0x10f17
movl %ebp, %r13d
xorl %ebp, %ebp
leaq 0xbe93(%rip), %r12      # 0x1cd3e
movq %rsp, %r15
movq %r15, %rdi
movl $0x2710, %esi           # imm = 0x2710
movq %r14, %rdx
callq 0x2350
movq %r15, %rdi
movq %r12, %rsi
callq 0x2340
xorl %edi, %edi
movq %r12, %rsi
callq 0x2340
movq %rax, %rdi
callq 0x22a0
movq 0x60(%rbx), %rax
movsd %xmm0, (%rax,%rbp,8)
xorl %r15d, %r15d
xorl %edi, %edi
movq %r12, %rsi
callq 0x2340
movq %rax, %rdi
callq 0x22a0
movq 0x68(%rbx), %rax
movq (%rax,%rbp,8), %rax
movsd %xmm0, (%rax,%r15,8)
incq %r15
cmpq %r15, %r13
jne 0x10ee7
incq %rbp
cmpq %r13, %rbp
jne 0x10eab
movq %r14, %rdi
callq 0x2200
addq $0x2718, %rsp           # imm = 0x2718
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r15), %rsi
leaq 0xbd9b(%rip), %rdi      # 0x1ccd6
xorl %eax, %eax
callq 0x2050
movl $0x1, %edi
callq 0x2270
leaq 0xbda5(%rip), %rdi      # 0x1ccf8
leaq 0xbcbc(%rip), %rsi      # 0x1cc16
leaq 0xbda0(%rip), %rcx      # 0x1cd01
movl $0x3b, %edx
callq 0x2160
movq %rax, %r14
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x10f87
movq (%r12), %rsi
incq %rsi
callq 0x2220
jmp 0x10f87
movq %rax, %r14
leaq 0x30(%rbx), %rdi
callq 0x1268a
movq %rbx, %rdi
callq 0x1268a
movq %r14, %rdi
callq 0x2380