// File: /workspace/github_cpp_makefile_star2_O1/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 0xe50c
addq $-0x60, %r12
addq $0x60, %r15
cmpq $-0x120, %r12           # imm = 0xFEE0
jne 0x14160
movw $0x0, 0x158(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x160(%rbx)
movups %xmm0, 0x170(%rbx)
movq $0x0, 0x180(%rbx)
cmpl $0x0, 0x18(%rbx)
jle 0x142cd
leaq 0x1(%rbx), %r15
movq (%r14), %rsi
addq $0xa, %rsi
movq %r15, %rdi
callq 0x21f0
movslq 0x18(%rbx), %rbp
movl $0x60, %ecx
movq %rbp, %rax
mulq %rcx
seto %cl
orq $0x8, %rax
movq $-0x1, %rdi
testb %cl, %cl
cmoveq %rax, %rdi
movq %rdi, 0x10(%rsp)
callq 0x2030
movq %rbp, (%rax)
movq %rax, (%rsp)
addq $0x8, %rax
movq %rax, 0x8(%rsp)
testl %ebp, %ebp
je 0x1422b
shlq $0x5, %rbp
leaq (,%rbp,2), %r12
addq %rbp, %r12
negq %r12
xorl %r13d, %r13d
movq 0x8(%rsp), %rbp
movq %rbp, %rdi
callq 0xe50c
addq $-0x60, %r13
addq $0x60, %rbp
cmpq %r13, %r12
jne 0x14216
movq 0x8(%rsp), %rax
movq %rax, 0x10(%rbx)
cmpl $0x0, 0x18(%rbx)
jle 0x14282
xorl %r13d, %r13d
leaq 0x18(%rsp), %r12
xorl %ebp, %ebp
movq (%r14), %rsi
addq %r13, %rsi
movq %r12, %rdi
callq 0xe5e0
movq 0x10(%rbx), %rdi
addq %r13, %rdi
movq %r12, %rsi
callq 0xe69c
movq %r12, %rdi
callq 0xe69a
movq 0x10(%rbx), %rax
movq %rbx, 0x40(%rax,%r13)
incq %rbp
movslq 0x18(%rbx), %rax
addq $0x60, %r13
cmpq %rax, %rbp
jl 0x14244
movq %rbx, %rdi
callq 0x13f74
leaq 0xccbf(%rip), %r14      # 0x20f50
xorl %r12d, %r12d
movq %r15, %rdi
movq %r14, %rsi
callq 0x22f0
testl %eax, %eax
je 0x142b3
incq %r12
addq $0x4, %r14
cmpq $0x18, %r12
jne 0x14294
movb $0x17, %r12b
movb %r12b, (%rbx)
movq %rbx, %rdi
callq 0x143ac
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xcce0(%rip), %rdi      # 0x20fb4
leaq 0xcce4(%rip), %rsi      # 0x20fbf
leaq 0xcd0f(%rip), %rcx      # 0x20ff1
movl $0x39, %edx
callq 0x2160
jmp 0x142ee
movq %rax, %r14
jmp 0x14332
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0xe69a
jmp 0x14332
movq %rax, %r14
testq %r13, %r13
je 0x14324
negq %r13
movq (%rsp), %r15
addq $-0x58, %r15
leaq (%r15,%r13), %rdi
callq 0xe69a
addq $-0x60, %r13
jne 0x14315
movq (%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x23d0
movl $0xf8, %r15d
leaq (%rbx,%r15), %rdi
callq 0xe69a
addq $-0x60, %r15
cmpq $-0x28, %r15
jne 0x14338
jmp 0x1436b
movq %rax, %r14
testq %r12, %r12
je 0x1436b
negq %r12
addq $-0x28, %rbx
leaq (%rbx,%r12), %rdi
callq 0xe69a
addq $-0x60, %r12
jne 0x1435c
movq %r14, %rdi
callq 0x2390
nop