// File: gjoni[P]iPot/src/AACE.cpp
// Function: AACE::GetTypes(Chain const&)
std::vector<int> AACE::GetTypes(const Chain &C) {

	int n = 0;

	std::map<std::string, int>::iterator it;
	std::vector<int> types(C.nAtoms);

	for (int i = 0; i < C.nRes; i++) {

		std::string rname(C.residue[i].name);

		for (int j = 0; j < C.residue[i].nAtoms; j++) {

			/* ACE atom type */
			std::string name = rname + "_"
					+ std::string(C.residue[i].atom[j].name);

			it = ATOM_IDX.find(name);
			if (it != ATOM_IDX.end()) {
				types[n] = it->second;
			} else {
				types[n] = -1;
			}
			n++;
		}
	}

	return types;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0xf8(%rbp)
movq %rdi, %rax
movq %rax, -0x108(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x100(%rbp)
movl $0x0, -0x1c(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x23840
movb $0x0, -0x29(%rbp)
movq -0x18(%rbp), %rax
movslq 0x38(%rax), %rax
movq %rax, -0xf0(%rbp)
leaq -0x2a(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x1c3d0
movq -0xf8(%rbp), %rdi
movq -0xf0(%rbp), %rsi
movq -0xe8(%rbp), %rdx
callq 0x23860
jmp 0x22072
leaq -0x2a(%rbp), %rdi
callq 0x1f010
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x48(%rcx), %eax
jge 0x2234e
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x40(%rbp), %rcx
imulq $0x188, %rcx, %rcx      # imm = 0x188
leaq 0x1(%rax,%rcx), %rax
movq %rax, -0x118(%rbp)
leaq -0x61(%rbp), %rdi
movq %rdi, -0x110(%rbp)
callq 0x3470
movq -0x118(%rbp), %rsi
movq -0x110(%rbp), %rdx
leaq -0x60(%rbp), %rdi
callq 0x18790
jmp 0x220da
leaq -0x61(%rbp), %rdi
callq 0x32e0
movl $0x0, -0x68(%rbp)
movl -0x68(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x40(%rcx), %rcx
movslq -0x40(%rbp), %rdx
imulq $0x188, %rdx, %rdx      # imm = 0x188
addq %rdx, %rcx
cmpl 0x18(%rcx), %eax
jge 0x2232c
leaq 0x14de3(%rip), %rdx     # 0x36ef6
leaq -0xa8(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x239a0
jmp 0x22125
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x40(%rbp), %rcx
imulq $0x188, %rcx, %rcx      # imm = 0x188
movq 0x10(%rax,%rcx), %rax
movslq -0x68(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x5, %rcx
leaq 0x4(%rax,%rcx), %rax
movq %rax, -0x128(%rbp)
leaq -0xc9(%rbp), %rdi
movq %rdi, -0x120(%rbp)
callq 0x3470
movq -0x128(%rbp), %rsi
movq -0x120(%rbp), %rdx
leaq -0xc8(%rbp), %rdi
callq 0x18790
jmp 0x22184
leaq -0x88(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
leaq -0xc8(%rbp), %rdx
callq 0x238d0
jmp 0x221a0
leaq -0xc8(%rbp), %rdi
callq 0x3190
leaq -0xc9(%rbp), %rdi
callq 0x32e0
leaq -0xa8(%rbp), %rdi
callq 0x3190
movq -0x100(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x23470
movq %rax, -0x130(%rbp)
jmp 0x221e0
movq -0x100(%rbp), %rdi
movq -0x130(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rax
movq %rax, -0x28(%rbp)
callq 0x234f0
movq %rax, -0xe0(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x23a20
testb $0x1, %al
jne 0x22225
jmp 0x222f3
leaq -0x28(%rbp), %rdi
callq 0x23a50
movq -0xf8(%rbp), %rdi
movl 0x20(%rax), %eax
movl %eax, -0x134(%rbp)
movslq -0x1c(%rbp), %rsi
callq 0x1bb90
movl -0x134(%rbp), %ecx
movl %ecx, (%rax)
jmp 0x22309
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x2a(%rbp), %rdi
callq 0x1f010
jmp 0x22380
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x61(%rbp), %rdi
callq 0x32e0
jmp 0x22374
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x22343
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x222bf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x3190
leaq -0xc9(%rbp), %rdi
callq 0x32e0
leaq -0xa8(%rbp), %rdi
callq 0x3190
jmp 0x22343
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x3190
jmp 0x22343
movq -0xf8(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
callq 0x1bb90
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x3190
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
jmp 0x220ea
leaq -0x60(%rbp), %rdi
callq 0x3190
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x22082
leaq -0x60(%rbp), %rdi
callq 0x3190
jmp 0x22374
movb $0x1, -0x29(%rbp)
testb $0x1, -0x29(%rbp)
jne 0x22364
movq -0xf8(%rbp), %rdi
callq 0x1bc20
movq -0x108(%rbp), %rax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq -0xf8(%rbp), %rdi
callq 0x1bc20
movq -0x38(%rbp), %rdi
callq 0x3460
nopl (%rax)