// File: /workspace/github_cpp_makefile_star2_O3/gjoni[P]iPot/src/Residue.cpp
// Function: Residue::Residue(std::vector<AtomRecord, std::allocator<AtomRecord>> const&)
Residue::Residue(const std::vector<AtomRecord>& source) :
		seqNum(source[0].resNum), insCode(source[0].insCode), atom(NULL), nAtoms(
				source.size()), chainId(source[0].chainId), ntFlag(false), ctFlag(
				false), N(NULL), CA(NULL), C(
		NULL), O(NULL), CB(NULL) {

	assert(nAtoms > 0); /* pedantic check */

	strcpy(name, source[0].resName); /* first atom is used to name the residue*/

	atom = new Atom[nAtoms];
	int idx = 0;
	for (int i = 0; i < nAtoms; i++) {
		atom[i] = Atom(source[i]);
		atom[i].residue = this;
		idx++;
	}

	SetBBAtoms(); /* N, CA, C, O, CB are pointers - they need to be reinitialized */

	type = SetType(name);

	SetCentroid();

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rax
movl 0x10(%rax), %ecx
movl %ecx, 0x8(%rdi)
movb 0x14(%rax), %cl
movb %cl, 0xc(%rdi)
movq $0x0, 0x10(%rdi)
movq 0x8(%rsi), %rcx
subq %rax, %rcx
shrq $0x5, %rcx
imull $0xaaaaaaab, %ecx, %ecx # imm = 0xAAAAAAAB
movl %ecx, 0x18(%rdi)
movb 0xe(%rax), %al
movb %al, 0x1c(%rdi)
leaq 0x38(%rdi), %r15
xorl %r12d, %r12d
movq %r15, %rdi
callq 0xe404
addq $-0x60, %r12
addq $0x60, %r15
cmpq $-0x120, %r12           # imm = 0xFEE0
jne 0x13f7a
movw $0x0, 0x158(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x160(%rbx)
movups %xmm0, 0x170(%rbx)
movq $0x0, 0x180(%rbx)
cmpl $0x0, 0x18(%rbx)
jle 0x140f2
leaq 0x1(%rbx), %r15
movq (%r14), %rsi
addq $0xa, %rsi
movq %r15, %rdi
callq 0x21e0
movslq 0x18(%rbx), %rbp
movl $0x60, %ecx
movq %rbp, %rax
mulq %rcx
seto %cl
orq $0x8, %rax
movq $-0x1, %r12
testb %cl, %cl
cmoveq %rax, %r12
movq %r12, %rdi
callq 0x2030
movq %rbp, (%rax)
leaq 0x8(%rax), %rcx
testl %ebp, %ebp
je 0x140a3
movq %rax, (%rsp)
movq %r12, 0x8(%rsp)
shlq $0x5, %rbp
leaq (,%rbp,2), %r12
addq %rbp, %r12
negq %r12
movq %rcx, %rbp
xorl %r13d, %r13d
movq %rcx, 0x10(%rsp)
movq %rbp, %rdi
callq 0xe404
addq $-0x60, %r13
addq $0x60, %rbp
cmpq %r13, %r12
jne 0x14035
cmpl $0x0, 0x18(%rbx)
movq 0x10(%rsp), %rax
movq %rax, 0x10(%rbx)
jle 0x140a7
xorl %r13d, %r13d
leaq 0x18(%rsp), %r12
xorl %ebp, %ebp
movq (%r14), %rsi
addq %r13, %rsi
movq %r12, %rdi
callq 0xe4b0
movq 0x10(%rbx), %rdi
addq %r13, %rdi
movq %r12, %rsi
callq 0xe548
movq %r12, %rdi
callq 0xe546
movq 0x10(%rbx), %rax
movq %rbx, 0x40(%rax,%r13)
incq %rbp
movslq 0x18(%rbx), %rax
addq $0x60, %r13
cmpq %rax, %rbp
jl 0x14063
jmp 0x140a7
movq %rcx, 0x10(%rbx)
movq %rbx, %rdi
callq 0x13d94
leaq 0xce9a(%rip), %r14      # 0x20f50
xorl %r12d, %r12d
movq %r15, %rdi
movq %r14, %rsi
callq 0x22e0
testl %eax, %eax
je 0x140d8
incq %r12
addq $0x4, %r14
cmpq $0x18, %r12
jne 0x140b9
movb $0x17, %r12b
movb %r12b, (%rbx)
movq %rbx, %rdi
callq 0x141d0
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xcebb(%rip), %rdi      # 0x20fb4
leaq 0xcebf(%rip), %rsi      # 0x20fbf
leaq 0xceea(%rip), %rcx      # 0x20ff1
movl $0x39, %edx
callq 0x2160
jmp 0x14113
movq %rax, %r14
jmp 0x14157
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0xe546
jmp 0x14157
movq %rax, %r14
testq %r13, %r13
je 0x14149
negq %r13
movq (%rsp), %r15
addq $-0x58, %r15
leaq (%r15,%r13), %rdi
callq 0xe546
addq $-0x60, %r13
jne 0x1413a
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x23c0
movl $0xf8, %r15d
leaq (%rbx,%r15), %rdi
callq 0xe546
addq $-0x60, %r15
cmpq $-0x28, %r15
jne 0x1415d
jmp 0x14190
movq %rax, %r14
testq %r12, %r12
je 0x14190
negq %r12
addq $-0x28, %rbx
leaq (%rbx,%r12), %rdi
callq 0xe546
addq $-0x60, %r12
jne 0x14181
movq %r14, %rdi
callq 0x2380