// File: /workspace/github_cpp_makefile_star2_O1/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 $0x2728, %rsp           # imm = 0x2728
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 0x12f42
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10e52
movl %eax, %ebp
movq %rbx, %rdi
movl %eax, %esi
callq 0x10f4e
movq 0x78(%rbx), %rdi
leaq 0x9b0d(%rip), %rsi      # 0x1ab4d
callq 0x2260
testq %rax, %rax
je 0x1112e
movq %rax, %r14
movq $-0x1, %r15
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movl $0x2710, %esi           # imm = 0x2710
movq %r14, %rdx
callq 0x2360
incq %r15
testq %rax, %rax
jne 0x1105d
movq %r14, %rdi
callq 0x2060
cmpl %r15d, %ebp
jne 0x11149
testl %r15d, %r15d
je 0x11114
xorl %ebp, %ebp
leaq 0xbca6(%rip), %r12      # 0x1cd3e
movq %r14, 0x8(%rsp)
leaq 0x10(%rsp), %r13
movq %r13, %rdi
movl $0x2710, %esi           # imm = 0x2710
movq %r14, %rdx
callq 0x2360
movq %r13, %rdi
movq %r12, %rsi
callq 0x2350
xorl %edi, %edi
movq %r12, %rsi
callq 0x2350
movq %rax, %rdi
callq 0x22b0
movq 0x60(%rbx), %rax
movsd %xmm0, (%rax,%rbp,8)
movq %r15, %r13
xorl %r14d, %r14d
xorl %edi, %edi
movq %r12, %rsi
callq 0x2350
movq %rax, %rdi
callq 0x22b0
movq 0x68(%rbx), %rax
movq (%rax,%rbp,8), %rax
movsd %xmm0, (%rax,%r14)
addq $0x8, %r14
decq %r13
jne 0x110de
incq %rbp
cmpq %rbp, %r15
movq 0x8(%rsp), %r14
jne 0x1109d
movq %r14, %rdi
callq 0x2210
addq $0x2728, %rsp           # imm = 0x2728
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r15), %rsi
leaq 0xbb9e(%rip), %rdi      # 0x1ccd6
xorl %eax, %eax
callq 0x2050
movl $0x1, %edi
callq 0x2280
leaq 0xbba8(%rip), %rdi      # 0x1ccf8
leaq 0xbabf(%rip), %rsi      # 0x1cc16
leaq 0xbba3(%rip), %rcx      # 0x1cd01
movl $0x3b, %edx
callq 0x2160
movq %rax, %r14
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x11184
movq (%r12), %rsi
incq %rsi
callq 0x2230
jmp 0x11184
movq %rax, %r14
leaq 0x30(%rbx), %rdi
callq 0x1287e
movq %rbx, %rdi
callq 0x1287e
movq %r14, %rdi
callq 0x2390
nop