// File: /workspace/github_cpp_makefile_star2_O2/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
andl $0x0, 0x8(%rdi)
andq $0x0, 0x10(%rdi)
movq %rax, 0x18(%rdi)
movq %rax, 0x20(%rdi)
andq $0x0, 0x28(%rdi)
leaq 0x38(%rdi), %rax
andl $0x0, 0x38(%rdi)
andq $0x0, 0x40(%rdi)
movq %rax, 0x48(%rdi)
movq %rax, 0x50(%rdi)
andq $0x0, 0x68(%rdi)
xorps %xmm1, %xmm1
movups %xmm1, 0x58(%rdi)
movsd %xmm0, 0x70(%rdi)
leaq 0x78(%rdi), %r12
movq %r12, %rdi
movq %rdx, %rsi
callq 0x22e0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10516
movl %eax, %r15d
movq %rbx, %rdi
movl %eax, %esi
callq 0x105d6
movq 0x78(%rbx), %rdi
leaq 0x8490(%rip), %rsi      # 0x18b4d
callq 0x2250
testq %rax, %rax
je 0x10792
movq %rax, %r14
leal 0x1(%r15), %ebp
movq %rsp, %r12
movq %r12, %rdi
movl $0x2710, %esi           # imm = 0x2710
movq %r14, %rdx
callq 0x2360
decl %ebp
testq %rax, %rax
jne 0x106d5
movq %r14, %rdi
callq 0x2060
testl %ebp, %ebp
jne 0x107ac
movl %r15d, %r13d
xorl %ebp, %ebp
leaq 0xa636(%rip), %r12      # 0x1ad3e
cmpq %r13, %rbp
je 0x10778
movq %rsp, %r15
movq %r15, %rdi
movl $0x2710, %esi           # imm = 0x2710
movq %r14, %rdx
callq 0x2360
movq %r15, %rdi
movq %r12, %rsi
callq 0x2350
xorl %edi, %edi
movq %r12, %rsi
callq 0x2350
movq %rax, %rdi
callq 0x22a0
movq 0x60(%rbx), %rax
movsd %xmm0, (%rax,%rbp,8)
xorl %r15d, %r15d
cmpq %r15, %r13
je 0x10773
xorl %edi, %edi
movq %r12, %rsi
callq 0x2350
movq %rax, %rdi
callq 0x22a0
movq 0x68(%rbx), %rax
movq (%rax,%rbp,8), %rax
movsd %xmm0, (%rax,%r15,8)
incq %r15
jmp 0x10749
incq %rbp
jmp 0x10708
movq %r14, %rdi
callq 0x2200
addq $0x2718, %rsp           # imm = 0x2718
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r12), %rsi
leaq 0xa539(%rip), %rdi      # 0x1acd6
xorl %eax, %eax
callq 0x2050
pushq $0x1
popq %rdi
callq 0x2270
leaq 0xa545(%rip), %rdi      # 0x1acf8
leaq 0xa45c(%rip), %rsi      # 0x1ac16
leaq 0xa540(%rip), %rcx      # 0x1ad01
pushq $0x3b
popq %rdx
callq 0x2160
movq %rax, %r14
movq %r12, %rdi
callq 0x2100
jmp 0x107d9
movq %rax, %r14
leaq 0x30(%rbx), %rdi
callq 0x11922
movq %rbx, %rdi
callq 0x11922
movq %r14, %rdi
callq 0x23a0