// File: /workspace/github_cpp_makefile_star2_O2/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), %rcx
movl 0x10(%rcx), %eax
movl %eax, 0x8(%rdi)
movb 0x14(%rcx), %al
movb %al, 0xc(%rdi)
andq $0x0, 0x10(%rdi)
movq 0x8(%rsi), %rax
subq %rcx, %rax
pushq $0x60
popq %r12
cqto
idivq %r12
movl %eax, 0x18(%rdi)
movb 0xe(%rcx), %al
movb %al, 0x1c(%rdi)
leaq 0x38(%rdi), %r15
xorl %r13d, %r13d
movq %r15, %rdi
callq 0xdcb4
addq $-0x60, %r13
addq $0x60, %r15
cmpq $-0x120, %r13           # imm = 0xFEE0
jne 0x1314c
andw $0x0, 0x158(%rbx)
xorps %xmm0, %xmm0
andq $0x0, 0x180(%rbx)
movups %xmm0, 0x160(%rbx)
movups %xmm0, 0x170(%rbx)
cmpl $0x0, 0x18(%rbx)
jle 0x13271
leaq 0x1(%rbx), %rdi
movq (%r14), %rsi
addq $0xa, %rsi
movq %rdi, 0x10(%rsp)
callq 0x21e0
movslq 0x18(%rbx), %rbp
movq %rbp, %rax
mulq %r12
seto %cl
orq $0x8, %rax
pushq $-0x1
popq %rdi
testb %cl, %cl
cmoveq %rax, %rdi
movq %rdi, 0x8(%rsp)
callq 0x2030
movq %rbp, (%rax)
movq %rax, (%rsp)
leaq 0x8(%rax), %r13
testl %ebp, %ebp
je 0x131f7
imulq $-0x60, %rbp, %r12
xorl %r15d, %r15d
movq %r13, %rbp
movq %rbp, %rdi
callq 0xdcb4
addq $-0x60, %r15
addq $0x60, %rbp
cmpq %r15, %r12
jne 0x131e2
movq %r13, 0x10(%rbx)
xorl %r13d, %r13d
leaq 0x18(%rsp), %r12
xorl %r15d, %r15d
movslq 0x18(%rbx), %rax
cmpq %rax, %r15
jge 0x13246
movq (%r14), %rsi
addq %r13, %rsi
movq %r12, %rdi
callq 0xdd60
movq 0x10(%rbx), %rdi
addq %r13, %rdi
movq %r12, %rsi
callq 0xddf4
movq %r12, %rdi
callq 0xddf2
movq 0x10(%rbx), %rax
movq %rbx, 0x40(%rax,%r13)
incq %r15
addq $0x60, %r13
jmp 0x13206
movq %rbx, %rdi
callq 0x12f88
movq 0x10(%rsp), %rsi
callq 0x13316
movb %al, (%rbx)
movq %rbx, %rdi
callq 0x13350
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xbd3c(%rip), %rdi      # 0x1efb4
leaq 0xbd40(%rip), %rsi      # 0x1efbf
leaq 0xbd6b(%rip), %rcx      # 0x1eff1
pushq $0x39
popq %rdx
callq 0x2160
jmp 0x132d1
movq %rax, %r14
testq %r15, %r15
je 0x132b2
negq %r15
movq (%rsp), %r12
addq $-0x58, %r12
leaq (%r12,%r15), %rdi
callq 0xddf2
addq $-0x60, %r15
jne 0x132a3
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x23f0
jmp 0x132d4
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0xddf2
jmp 0x132d4
movq %rax, %r14
movl $0xf8, %r15d
leaq (%rbx,%r15), %rdi
callq 0xddf2
addq $-0x60, %r15
cmpq $-0x28, %r15
jne 0x132da
movq %r14, %rdi
callq 0x23a0
movq %rax, %r14
testq %r13, %r13
je 0x132ed
negq %r13
addq $-0x28, %rbx
leaq (%rbx,%r13), %rdi
callq 0xddf2
addq $-0x60, %r13
jne 0x13304
jmp 0x132ed
nop