// File: gjoni[P]iPot/src/Residue.cpp
// Function: Residue::SetBBAtoms()
int Residue::SetBBAtoms() {

	bool flN = false, flCA = false, flC = false, flO = false, flCB = false;

	for (int i = 0; i < nAtoms; i++) {
		if (strcmp(atom[i].name, "N") == 0) {
			N = &(atom[i]);
			flN = true;
		} else if (strcmp(atom[i].name, "CA") == 0) {
			CA = &(atom[i]);
			flCA = true;
		} else if (strcmp(atom[i].name, "CB") == 0) {
			CB = &(atom[i]);
			flCB = true;
		} else if (strcmp(atom[i].name, "C") == 0) {
			C = &(atom[i]);
			flC = true;
		} else if (strcmp(atom[i].name, "O") == 0
				|| strcmp(atom[i].name, "OXT") == 0) {
			O = &(atom[i]);
			flO = true;
		} else if (strcmp(atom[i].name, "H1") == 0) {
			ntFlag = true;
		} else if (strcmp(atom[i].name, "H2") == 0) {
			ntFlag = true;
		} else if (strcmp(atom[i].name, "H3") == 0) {
			ntFlag = true;
		} else if (strcmp(atom[i].name, "OXT") == 0) {
			ctFlag = true;
		}
	}

	int n = flN + flCA + flC + flO + flCB;

	return n;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movb $0x0, -0x9(%rbp)
movb $0x0, -0xa(%rbp)
movb $0x0, -0xb(%rbp)
movb $0x0, -0xc(%rbp)
movb $0x0, -0xd(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x20(%rbp), %rcx
movl -0x14(%rbp), %eax
cmpl 0x18(%rcx), %eax
jge 0x28113
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movslq -0x14(%rbp), %rax
imulq $0x60, %rax, %rax
addq %rax, %rdi
addq $0x4, %rdi
leaq 0xec87(%rip), %rsi      # 0x36b24
callq 0x33c0
cmpl $0x0, %eax
jne 0x27eca
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
movslq -0x14(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rcx
movq %rcx, 0x160(%rax)
movb $0x1, -0x9(%rbp)
jmp 0x28103
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movslq -0x14(%rbp), %rax
imulq $0x60, %rax, %rax
addq %rax, %rdi
addq $0x4, %rdi
leaq 0xe762(%rip), %rsi      # 0x3664a
callq 0x33c0
cmpl $0x0, %eax
jne 0x27f15
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
movslq -0x14(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rcx
movq %rcx, 0x168(%rax)
movb $0x1, -0xa(%rbp)
jmp 0x28101
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movslq -0x14(%rbp), %rax
imulq $0x60, %rax, %rax
addq %rax, %rdi
addq $0x4, %rdi
leaq 0xe71e(%rip), %rsi      # 0x36651
callq 0x33c0
cmpl $0x0, %eax
jne 0x27f60
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
movslq -0x14(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rcx
movq %rcx, 0x180(%rax)
movb $0x1, -0xd(%rbp)
jmp 0x280ff
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movslq -0x14(%rbp), %rax
imulq $0x60, %rax, %rax
addq %rax, %rdi
addq $0x4, %rdi
leaq 0x162fb(%rip), %rsi     # 0x3e279
callq 0x33c0
cmpl $0x0, %eax
jne 0x27fab
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
movslq -0x14(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rcx
movq %rcx, 0x170(%rax)
movb $0x1, -0xb(%rbp)
jmp 0x280fd
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movslq -0x14(%rbp), %rax
imulq $0x60, %rax, %rax
addq %rax, %rdi
addq $0x4, %rdi
leaq 0xeb52(%rip), %rsi      # 0x36b1b
callq 0x33c0
cmpl $0x0, %eax
je 0x27ffb
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movslq -0x14(%rbp), %rax
imulq $0x60, %rax, %rax
addq %rax, %rdi
addq $0x4, %rdi
leaq 0xeb4f(%rip), %rsi      # 0x36b40
callq 0x33c0
cmpl $0x0, %eax
jne 0x2801e
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
movslq -0x14(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rcx
movq %rcx, 0x178(%rax)
movb $0x1, -0xc(%rbp)
jmp 0x280fb
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movslq -0x14(%rbp), %rax
imulq $0x60, %rax, %rax
addq %rax, %rdi
addq $0x4, %rdi
leaq 0xe659(%rip), %rsi      # 0x36695
callq 0x33c0
cmpl $0x0, %eax
jne 0x28056
movq -0x20(%rbp), %rax
movb $0x1, 0x158(%rax)
jmp 0x280f9
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movslq -0x14(%rbp), %rax
imulq $0x60, %rax, %rax
addq %rax, %rdi
addq $0x4, %rdi
leaq 0xe9b4(%rip), %rsi      # 0x36a28
callq 0x33c0
cmpl $0x0, %eax
jne 0x2808b
movq -0x20(%rbp), %rax
movb $0x1, 0x158(%rax)
jmp 0x280f7
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movslq -0x14(%rbp), %rax
imulq $0x60, %rax, %rax
addq %rax, %rdi
addq $0x4, %rdi
leaq 0x12fc2(%rip), %rsi     # 0x3b06b
callq 0x33c0
cmpl $0x0, %eax
jne 0x280c0
movq -0x20(%rbp), %rax
movb $0x1, 0x158(%rax)
jmp 0x280f5
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movslq -0x14(%rbp), %rax
imulq $0x60, %rax, %rax
addq %rax, %rdi
addq $0x4, %rdi
leaq 0xea62(%rip), %rsi      # 0x36b40
callq 0x33c0
cmpl $0x0, %eax
jne 0x280f3
movq -0x20(%rbp), %rax
movb $0x1, 0x159(%rax)
jmp 0x280f5
jmp 0x280f7
jmp 0x280f9
jmp 0x280fb
jmp 0x280fd
jmp 0x280ff
jmp 0x28101
jmp 0x28103
jmp 0x28105
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x27e6f
movb -0x9(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movb -0xa(%rbp), %cl
andb $0x1, %cl
movzbl %cl, %ecx
addl %ecx, %eax
movb -0xb(%rbp), %cl
andb $0x1, %cl
movzbl %cl, %ecx
addl %ecx, %eax
movb -0xc(%rbp), %cl
andb $0x1, %cl
movzbl %cl, %ecx
addl %ecx, %eax
movb -0xd(%rbp), %cl
andb $0x1, %cl
movzbl %cl, %ecx
addl %ecx, %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)