// File: gjoni[P]iPot/src/Residue.cpp
// Function: Residue::Residue(Residue const&)
Residue::Residue(const Residue &source) :
		type(source.type), seqNum(source.seqNum), insCode(source.insCode), atom(
		NULL), nAtoms(source.nAtoms), chainId(source.chainId), ntFlag(
				source.ntFlag), ctFlag(source.ctFlag), N(NULL), CA(NULL), O(
		NULL), CB(NULL) {

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

	strcpy(name, source.name);

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

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

	memcpy(centroid, source.centroid, 3 * sizeof(double));

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rcx
movb (%rcx), %cl
movb %cl, (%rax)
movq -0x10(%rbp), %rcx
movl 0x8(%rcx), %ecx
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rcx
movb 0xc(%rcx), %cl
movb %cl, 0xc(%rax)
movq $0x0, 0x10(%rax)
movq -0x10(%rbp), %rcx
movl 0x18(%rcx), %ecx
movl %ecx, 0x18(%rax)
movq -0x10(%rbp), %rcx
movb 0x1c(%rcx), %cl
movb %cl, 0x1c(%rax)
addq $0x38, %rax
movq %rax, -0x38(%rbp)
movq %rax, %rcx
addq $0x120, %rcx            # imm = 0x120
movq %rcx, -0x30(%rbp)
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movq %rdi, -0x48(%rbp)
callq 0x18b10
jmp 0x27b5c
movq -0x30(%rbp), %rcx
movq -0x48(%rbp), %rax
addq $0x60, %rax
cmpq %rcx, %rax
movq %rax, -0x28(%rbp)
jne 0x27b4d
movq -0x40(%rbp), %rax
movq -0x10(%rbp), %rcx
movb 0x158(%rcx), %cl
andb $0x1, %cl
movb %cl, 0x158(%rax)
movq -0x10(%rbp), %rcx
movb 0x159(%rcx), %cl
andb $0x1, %cl
movb %cl, 0x159(%rax)
movq $0x0, 0x160(%rax)
movq $0x0, 0x168(%rax)
movq $0x0, 0x178(%rax)
movq $0x0, 0x180(%rax)
cmpl $0x0, 0x18(%rax)
jle 0x27bcf
jmp 0x27c30
leaq 0x133a2(%rip), %rdi     # 0x3af78
leaq 0x133a6(%rip), %rsi     # 0x3af83
movl $0x23, %edx
leaq 0x133aa(%rip), %rcx     # 0x3af93
callq 0x31b0
movq -0x38(%rbp), %rcx
movq %rax, %rsi
movq -0x48(%rbp), %rax
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
cmpq %rax, %rcx
movq %rax, -0x50(%rbp)
je 0x27c2b
movq -0x50(%rbp), %rdi
addq $-0x60, %rdi
movq %rdi, -0x58(%rbp)
callq 0x18e20
movq -0x38(%rbp), %rcx
movq -0x58(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x50(%rbp)
jne 0x27c09
jmp 0x27e36
movq -0x40(%rbp), %rdi
incq %rdi
movq -0x10(%rbp), %rsi
incq %rsi
callq 0x3270
movq -0x40(%rbp), %rax
movslq 0x18(%rax), %rax
movq %rax, -0x70(%rbp)
movl $0x60, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
addq $0x8, %rdi
movq $-0x1, %rax
cmovbq %rax, %rdi
testb %cl, %cl
cmovneq %rax, %rdi
movq %rdi, -0x68(%rbp)
callq 0x3030
movq %rax, -0x60(%rbp)
jmp 0x27c81
movq -0x70(%rbp), %rax
movq -0x60(%rbp), %rcx
movq %rax, (%rcx)
addq $0x8, %rcx
movq %rcx, -0x78(%rbp)
cmpq $0x0, %rax
je 0x27ce4
movq -0x78(%rbp), %rax
movq -0x70(%rbp), %rcx
imulq $0x60, %rcx, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, -0x88(%rbp)
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rdi
movq %rdi, -0x90(%rbp)
callq 0x18b10
jmp 0x27cc9
movq -0x88(%rbp), %rcx
movq -0x90(%rbp), %rax
addq $0x60, %rax
cmpq %rcx, %rax
movq %rax, -0x80(%rbp)
jne 0x27cb7
movq -0x40(%rbp), %rax
movq -0x78(%rbp), %rcx
movq %rcx, 0x10(%rax)
movl $0x0, -0x20(%rbp)
movq -0x40(%rbp), %rcx
movl -0x20(%rbp), %eax
cmpl 0x18(%rcx), %eax
jge 0x27dc1
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movslq -0x20(%rbp), %rax
shlq $0x5, %rax
leaq (%rax,%rax,2), %rax
addq %rax, %rsi
movq 0x10(%rcx), %rdi
addq %rax, %rdi
callq 0x18e30
jmp 0x27d30
movq -0x40(%rbp), %rcx
movq 0x10(%rcx), %rax
movslq -0x20(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x40(%rax)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x27cf7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x27df5
movq -0x78(%rbp), %rcx
movq %rax, %rsi
movq -0x90(%rbp), %rax
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
cmpq %rax, %rcx
movq %rax, -0x98(%rbp)
je 0x27db2
movq -0x98(%rbp), %rdi
addq $-0x60, %rdi
movq %rdi, -0xa0(%rbp)
callq 0x18e20
movq -0x78(%rbp), %rcx
movq -0xa0(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x98(%rbp)
jne 0x27d84
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdi
callq 0x34a0
jmp 0x27df5
movq -0x40(%rbp), %rdi
callq 0x27e40
jmp 0x27dcc
movq -0x40(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x20(%rcx), %rdx
movq %rdx, 0x20(%rax)
movq 0x28(%rcx), %rdx
movq %rdx, 0x28(%rax)
movq 0x30(%rcx), %rcx
movq %rcx, 0x30(%rax)
addq $0xb0, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rax
addq $0x120, %rax            # imm = 0x120
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rdi
addq $-0x60, %rdi
movq %rdi, -0xb0(%rbp)
callq 0x18e20
movq -0x38(%rbp), %rcx
movq -0xb0(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0xa8(%rbp)
jne 0x27e06
jmp 0x27e36
movq -0x18(%rbp), %rdi
callq 0x3460
nop