LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: gjoni[P]iPot/src/Chain.cpp
// Function: Chain::GetResidue(int, char) const
Residue* Chain::GetResidue(int n, char ins) const {

	std::map<std::pair<int, char>, Residue*>::const_iterator it;
	it = resmap.find( { n, ins });
	if (it == resmap.end()) {
		return NULL;
	} else {
		return it->second;
	}

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movb %dl, %al
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movb %al, -0x15(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x1be00
leaq -0x30(%rbp), %rdi
leaq -0x14(%rbp), %rsi
leaq -0x15(%rbp), %rdx
callq 0x1bdb0
movq -0x40(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x1be20
movq -0x40(%rbp), %rdi
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x20(%rbp)
callq 0x1be80
movq %rax, -0x38(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x1be50
testb $0x1, %al
jne 0x1b60f
jmp 0x1b619
movq $0x0, -0x8(%rbp)
jmp 0x1b62a
leaq -0x20(%rbp), %rdi
callq 0x1beb0
movq 0x8(%rax), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: gjoni[P]iPot/src/AACE.cpp
// Function: AACE::ReadGroups(std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>> const&)
int AACE::ReadGroups(const GROUPS_TYPE &GROUPS) {

	int n = 0;

	for (auto g: GROUPS) {
		std::map<std::string, int>::const_iterator it;
		it = TYPE_IDX.find(g.second);
		int t;
		if (it == TYPE_IDX.end()) {
			TYPE_IDX[g.second] = n;
			//printf("%s %d\n", g.second.c_str(), n);
			t = n++;
		} else {
			t = it->second;
		}
		ATOM_IDX[g.first] = t;
	}

	return TYPE_IDX.size();

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xb0(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x23620
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
callq 0x23650
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x23680
testb $0x1, %al
jne 0x20d6d
jmp 0x20ed0
leaq -0x28(%rbp), %rdi
callq 0x236c0
movq %rax, %rsi
leaq -0x70(%rbp), %rdi
callq 0x236e0
leaq -0x78(%rbp), %rdi
callq 0x23450
movq -0xb0(%rbp), %rdi
addq $0x30, %rdi
leaq -0x50(%rbp), %rsi
callq 0x23470
movq %rax, -0xb8(%rbp)
jmp 0x20da8
movq -0xb8(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x234a0
movq -0xb0(%rbp), %rdi
movq -0x80(%rbp), %rax
movq %rax, -0x78(%rbp)
addq $0x30, %rdi
callq 0x234f0
movq %rax, -0xa8(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x234a0
leaq -0x78(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x234c0
testb $0x1, %al
jne 0x20e0e
jmp 0x20e73
movq -0xb0(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, -0xc4(%rbp)
addq $0x30, %rdi
leaq -0x50(%rbp), %rsi
callq 0x23740
movq %rax, -0xc0(%rbp)
jmp 0x20e34
movq -0xc0(%rbp), %rax
movl -0xc4(%rbp), %ecx
movl %ecx, (%rax)
movl -0x14(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movl %eax, -0x98(%rbp)
jmp 0x20e85
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x22bb0
jmp 0x20ee9
leaq -0x78(%rbp), %rdi
callq 0x23600
movl 0x20(%rax), %eax
movl %eax, -0x98(%rbp)
movq -0xb0(%rbp), %rdi
movl -0x98(%rbp), %eax
movl %eax, -0xd4(%rbp)
leaq -0x70(%rbp), %rsi
callq 0x23740
movq %rax, -0xd0(%rbp)
jmp 0x20eaa
movq -0xd0(%rbp), %rax
movl -0xd4(%rbp), %ecx
movl %ecx, (%rax)
leaq -0x70(%rbp), %rdi
callq 0x22bb0
leaq -0x28(%rbp), %rdi
callq 0x23820
jmp 0x20d57
movq -0xb0(%rbp), %rdi
addq $0x30, %rdi
callq 0x233d0
addq $0xe0, %rsp
popq %rbp
retq
movq -0x90(%rbp), %rdi
callq 0x3460
nopw %cs:(%rax,%rax)
// File: gjoni[P]iPot/src/AACE.cpp
// Function: AACE::Allocate(int)
void AACE::Allocate(int N) {

	h = (double*) malloc(N * sizeof(double));
	J = (double**) malloc(N * sizeof(double*));
	for (int i = 0; i < N; i++) {
		J[i] = (double*) malloc(N * sizeof(double));
	}

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movslq -0xc(%rbp), %rdi
shlq $0x3, %rdi
callq 0x3390
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x60(%rax)
movslq -0xc(%rbp), %rdi
shlq $0x3, %rdi
callq 0x3390
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x68(%rax)
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x20f81
movslq -0xc(%rbp), %rdi
shlq $0x3, %rdi
callq 0x3390
movq %rax, %rdx
movq -0x18(%rbp), %rax
movq 0x68(%rax), %rax
movslq -0x10(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x20f4e
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: gjoni[P]iPot/src/AACE.cpp
// Function: AACE::ReadCouplings(char const*)
int AACE::ReadCouplings(const char *name) {

	FILE *F = fopen(name, "r");
	if (F == NULL) {
		printf("Error: cannot open %s file\n", name);
		exit(1);
	}

	const int STRMAX = 10000;
	char buf[STRMAX];

	int N = TYPE_IDX.size();

	for (int i = 0; i < N; i++) {
		fgets(buf, STRMAX, F);
		char * pch;
		pch = strtok(buf, " "); /* label */
		pch = strtok(NULL, " "); /* local field */
		h[i] = atof(pch);
		for (int j = 0; j < N; j++) {
			pch = strtok(NULL, " ");
			J[i][j] = atof(pch);
		}
	}
	fclose(F);

	return 0;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2750, %rsp           # imm = 0x2750
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x2750(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x130d4(%rip), %rsi     # 0x34b4d
callq 0x3310
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x21aa5
movq -0x10(%rbp), %rsi
leaq 0x15440(%rip), %rdi     # 0x36ed4
movb $0x0, %al
callq 0x3070
movl $0x1, %edi
callq 0x3330
movq -0x2750(%rbp), %rdi
movl $0x2710, -0x1c(%rbp)    # imm = 0x2710
addq $0x30, %rdi
callq 0x233d0
movl %eax, -0x2734(%rbp)
movl $0x0, -0x2738(%rbp)
movl -0x2738(%rbp), %eax
cmpl -0x2734(%rbp), %eax
jge 0x21bcb
leaq -0x2730(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x2710, %esi           # imm = 0x2710
callq 0x3410
leaq -0x2730(%rbp), %rdi
leaq 0x15219(%rip), %rsi     # 0x36d1a
callq 0x3400
movq %rax, -0x2740(%rbp)
xorl %eax, %eax
movl %eax, %edi
leaq 0x15202(%rip), %rsi     # 0x36d1a
callq 0x3400
movq %rax, -0x2740(%rbp)
movq -0x2740(%rbp), %rdi
callq 0x3370
movq -0x2750(%rbp), %rax
movq 0x60(%rax), %rax
movslq -0x2738(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl $0x0, -0x2744(%rbp)
movl -0x2744(%rbp), %eax
cmpl -0x2734(%rbp), %eax
jge 0x21bb5
xorl %eax, %eax
movl %eax, %edi
leaq 0x151b0(%rip), %rsi     # 0x36d1a
callq 0x3400
movq %rax, -0x2740(%rbp)
movq -0x2740(%rbp), %rdi
callq 0x3370
movq -0x2750(%rbp), %rax
movq 0x68(%rax), %rax
movslq -0x2738(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2744(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x2744(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2744(%rbp)
jmp 0x21b51
jmp 0x21bb7
movl -0x2738(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2738(%rbp)
jmp 0x21acc
movq -0x18(%rbp), %rdi
callq 0x3290
xorl %eax, %eax
addq $0x2750, %rsp           # imm = 0x2750
popq %rbp
retq
nop
// File: gjoni[P]iPot/src/AACE.cpp
// Function: AACE::AACE(AACE const&)
AACE::AACE(const AACE &source) :
		ATOM_IDX(source.ATOM_IDX), TYPE_IDX(source.TYPE_IDX), h(NULL), J(NULL), dmax(
				source.dmax), name(source.name) {

	int N = TYPE_IDX.size();

	Allocate(N);

	memcpy(h, source.h, N * sizeof(double));
	for (int i = 0; i < N; i++) {
		memcpy(J[i], source.J[i], N * sizeof(double));
	}

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x38(%rbp)
movq %rdi, %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rsi
callq 0x233f0
movq -0x38(%rbp), %rdi
addq $0x30, %rdi
movq %rdi, -0x30(%rbp)
movq -0x10(%rbp), %rsi
addq $0x30, %rsi
callq 0x233f0
jmp 0x21c23
movq -0x40(%rbp), %rdi
movq $0x0, 0x60(%rdi)
movq $0x0, 0x68(%rdi)
movq -0x10(%rbp), %rax
movsd 0x70(%rax), %xmm0
movsd %xmm0, 0x70(%rdi)
addq $0x78, %rdi
movq %rdi, -0x48(%rbp)
movq -0x10(%rbp), %rsi
addq $0x78, %rsi
callq 0x3120
jmp 0x21c5c
movq -0x40(%rbp), %rdi
addq $0x30, %rdi
callq 0x233d0
movq -0x40(%rbp), %rdi
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %esi
callq 0x20f00
jmp 0x21c7a
movq -0x40(%rbp), %rax
movq 0x60(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rsi
movslq -0x20(%rbp), %rdx
shlq $0x3, %rdx
callq 0x3240
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x21d11
movq -0x40(%rbp), %rax
movq 0x68(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movslq -0x20(%rbp), %rdx
shlq $0x3, %rdx
callq 0x3240
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x21c9e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x21d20
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x21d17
movq -0x48(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
callq 0x3190
jmp 0x21d17
addq $0x50, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x233b0
movq -0x38(%rbp), %rdi
callq 0x233b0
movq -0x18(%rbp), %rdi
callq 0x3460
nopw %cs:(%rax,%rax)
// File: gjoni[P]iPot/src/AACE.cpp
// Function: AACE::Free(int)
void AACE::Free(int N) {

	if (J != NULL) {
		for (int i = 0; i < N; i++) {
			free(J[i]);
		}
		free(J);
	}
	free(h);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, 0x68(%rax)
je 0x21eaa
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x21e9d
movq -0x18(%rbp), %rax
movq 0x68(%rax), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3320
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x21e75
movq -0x18(%rbp), %rax
movq 0x68(%rax), %rdi
callq 0x3320
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x3320
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: gjoni[P]iPot/src/AACE.cpp
// Function: AACE::operator=(AACE const&)
AACE & AACE::operator =(const AACE & source) {

	assert(this != &source); /* an attempt to assign Residue to itself */

	Free(TYPE_IDX.size());

	ATOM_IDX = source.ATOM_IDX;
	TYPE_IDX = source.TYPE_IDX;
	dmax = source.dmax;
	name = source.name;

	int N = TYPE_IDX.size();
	Allocate(N);

	memcpy(h, source.h, N * sizeof(double));
	for (int i = 0; i < N; i++) {
		memcpy(J[i], source.J[i], N * sizeof(double));
	}

	return *this;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq -0x10(%rbp), %rax
je 0x21ee0
jmp 0x21eff
leaq 0x14fb9(%rip), %rdi     # 0x36ea0
leaq 0x14d04(%rip), %rsi     # 0x36bf2
movl $0xa5, %edx
leaq 0x14fb6(%rip), %rcx     # 0x36eb0
callq 0x31b0
movq -0x20(%rbp), %rdi
addq $0x30, %rdi
callq 0x233d0
movq -0x20(%rbp), %rdi
movl %eax, %esi
callq 0x21e50
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x23420
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x30, %rsi
addq $0x30, %rdi
callq 0x23420
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rax
movsd 0x70(%rax), %xmm0
movsd %xmm0, 0x70(%rdi)
movq -0x10(%rbp), %rsi
addq $0x78, %rsi
addq $0x78, %rdi
callq 0x3060
movq -0x20(%rbp), %rdi
addq $0x30, %rdi
callq 0x233d0
movq -0x20(%rbp), %rdi
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %esi
callq 0x20f00
movq -0x20(%rbp), %rax
movq 0x60(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rsi
movslq -0x14(%rbp), %rdx
shlq $0x3, %rdx
callq 0x3240
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x21fdc
movq -0x20(%rbp), %rax
movq 0x68(%rax), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movslq -0x14(%rbp), %rdx
shlq $0x3, %rdx
callq 0x3240
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x21f9c
movq -0x20(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: gjoni[P]iPot/src/AACE.cpp
// Function: AACE::GetEnergy(Chain const&, std::vector<int, std::allocator<int>> const&)
double AACE::GetEnergy(const Chain &C, const std::vector<int> &t) {

	double E = 0.0;

	for (int i = 0; i < C.nAtoms; i++) {

		if (t[i] < 0) {
			continue;
		}

		Atom *A = C.atom[i];

		kdres *res = kd_nearest_range3f(C.kd, A->x, A->y, A->z, dmax);
		double pos[3];

		while (!kd_res_end(res)) {

			int j = ((Atom**) kd_res_item(res, pos)) - C.atom;
			if (t[j] >= 0 && i > j
			/* && C.atom[i]->residue != C.atom[j]->residue */) {
				E += J[t[i]][t[j]];
			}
			kd_res_next(res);
		}
		kd_res_free(res);
	}

	return E;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x38(%rcx), %eax
jge 0x22504
movq -0x18(%rbp), %rdi
movslq -0x24(%rbp), %rsi
callq 0x1bde0
cmpl $0x0, (%rax)
jge 0x223e2
jmp 0x224f6
movq -0x60(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x30(%rcx), %rcx
movslq -0x24(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq %rcx, -0x30(%rbp)
movq -0x10(%rbp), %rcx
movq 0x50(%rcx), %rdi
movq -0x30(%rbp), %rcx
movsd 0x10(%rcx), %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x30(%rbp), %rcx
movsd 0x18(%rcx), %xmm1
cvtsd2ss %xmm1, %xmm1
movq -0x30(%rbp), %rcx
movsd 0x20(%rcx), %xmm2
cvtsd2ss %xmm2, %xmm2
movsd 0x70(%rax), %xmm3
cvtsd2ss %xmm3, %xmm3
callq 0x32730
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x32820
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x22455
jmp 0x224ed
movq -0x38(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x32870
movq -0x10(%rbp), %rcx
movq 0x30(%rcx), %rcx
subq %rcx, %rax
sarq $0x3, %rax
movl %eax, -0x54(%rbp)
movq -0x18(%rbp), %rdi
movslq -0x54(%rbp), %rsi
callq 0x1bde0
cmpl $0x0, (%rax)
jl 0x224df
movl -0x24(%rbp), %eax
cmpl -0x54(%rbp), %eax
jle 0x224df
movq -0x60(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x18(%rbp), %rdi
movslq -0x24(%rbp), %rsi
callq 0x1bde0
movq %rax, %rcx
movq -0x70(%rbp), %rax
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x68(%rbp)
movq -0x18(%rbp), %rdi
movslq -0x54(%rbp), %rsi
callq 0x1bde0
movq %rax, %rcx
movq -0x68(%rbp), %rax
movslq (%rcx), %rcx
movsd (%rax,%rcx,8), %xmm0
addsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x20(%rbp)
movq -0x38(%rbp), %rdi
callq 0x32840
jmp 0x2243b
movq -0x38(%rbp), %rdi
callq 0x31d50
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x223bb
movsd -0x20(%rbp), %xmm0
addq $0x70, %rsp
popq %rbp
retq
nop
// File: gjoni[P]iPot/src/RRCE.cpp
// Function: RRCE::RRCE(RRCE const&)
RRCE::RRCE(const RRCE &source) :
		h(NULL), J(NULL), dmax(source.dmax), name(source.name) {

	const int N = 20;

	Allocate(N);

	memcpy(h, source.h, N * sizeof(double));
	for (int i = 0; i < N; i++) {
		memcpy(J[i], source.J[i], N * sizeof(double));
	}

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x30(%rbp)
movq $0x0, (%rdi)
movq $0x0, 0x8(%rdi)
movq -0x10(%rbp), %rax
movsd 0x10(%rax), %xmm0
movsd %xmm0, 0x10(%rdi)
addq $0x18, %rdi
movq %rdi, -0x38(%rbp)
movq -0x10(%rbp), %rsi
addq $0x18, %rsi
callq 0x3120
movq -0x30(%rbp), %rdi
movl $0x14, -0x14(%rbp)
movl $0x14, %esi
callq 0x26d60
jmp 0x26fd1
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movl $0xa0, %edx
callq 0x3240
movl $0x0, -0x28(%rbp)
cmpl $0x14, -0x28(%rbp)
jge 0x27042
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movl $0xa0, %edx
callq 0x3240
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x26ff0
movq -0x38(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
callq 0x3190
jmp 0x27048
addq $0x40, %rsp
popq %rbp
retq
movq -0x20(%rbp), %rdi
callq 0x3460
nopw %cs:(%rax,%rax)
// File: gjoni[P]iPot/src/RRCE.cpp
// Function: RRCE::operator=(RRCE const&)
RRCE & RRCE::operator =(const RRCE & source) {

	assert(this != &source);

	const int N = 20;

	Free(N);

	dmax = source.dmax;
	name = source.name;

	Allocate(N);

	memcpy(h, source.h, N * sizeof(double));
	for (int i = 0; i < N; i++) {
		memcpy(J[i], source.J[i], N * sizeof(double));
	}

	return *this;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq -0x10(%rbp), %rax
je 0x273b0
jmp 0x273cf
leaq 0xfae9(%rip), %rdi      # 0x36ea0
leaq 0x1221d(%rip), %rsi     # 0x395db
movl $0x87, %edx
leaq 0x1221e(%rip), %rcx     # 0x395e8
callq 0x31b0
movq -0x20(%rbp), %rdi
movl $0x14, -0x14(%rbp)
movl $0x14, %esi
callq 0x27320
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rax
movsd 0x10(%rax), %xmm0
movsd %xmm0, 0x10(%rdi)
movq -0x10(%rbp), %rsi
addq $0x18, %rsi
addq $0x18, %rdi
callq 0x3060
movq -0x20(%rbp), %rdi
movl $0x14, %esi
callq 0x26d60
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movl $0xa0, %edx
callq 0x3240
movl $0x0, -0x18(%rbp)
cmpl $0x14, -0x18(%rbp)
jge 0x2746f
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movl $0xa0, %edx
callq 0x3240
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x27434
movq -0x20(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: gjoni[P]iPot/src/RRCE.cpp
// Function: RRCE::GetEnergy(Chain const&)
double RRCE::GetEnergy(const Chain &C) {

	double E = 0.0;

	for (int i = 0; i < C.nRes; i++) {

		char ti = C.residue[i].type;
		if (ti < 0 || ti > 19) {
			continue;
		}

		Residue *R = &(C.residue[i]);

		kdres *res = kd_nearest_range3f(C.kdCent, R->centroid[0],
				R->centroid[1], R->centroid[2], dmax);
		double pos[3];

		while (!kd_res_end(res)) {

			Atom *Aj = (Atom*) kd_res_item(res, pos);
			int j = Aj->residue - C.residue;
			char tj = Aj->residue->type;
			if (tj >= 0 && tj < 20 && i < j) {
				E += J[(int) ti][(int) tj];
			}
			kd_res_next(res);
		}
		kd_res_free(res);
	}

	return E;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x48(%rcx), %eax
jge 0x27708
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x188, %rcx, %rcx      # imm = 0x188
addq %rcx, %rax
movb (%rax), %al
movb %al, -0x1d(%rbp)
movsbl -0x1d(%rbp), %eax
cmpl $0x0, %eax
jl 0x275e4
movsbl -0x1d(%rbp), %eax
cmpl $0x13, %eax
jle 0x275e9
jmp 0x276fa
movq -0x68(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x40(%rcx), %rcx
movslq -0x1c(%rbp), %rdx
imulq $0x188, %rdx, %rdx      # imm = 0x188
addq %rdx, %rcx
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rcx
movq 0x60(%rcx), %rdi
movq -0x28(%rbp), %rcx
movsd 0x20(%rcx), %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x28(%rbp), %rcx
movsd 0x28(%rcx), %xmm1
cvtsd2ss %xmm1, %xmm1
movq -0x28(%rbp), %rcx
movsd 0x30(%rcx), %xmm2
cvtsd2ss %xmm2, %xmm2
movsd 0x10(%rax), %xmm3
cvtsd2ss %xmm3, %xmm3
callq 0x32730
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x32820
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x27662
jmp 0x276f1
movq -0x30(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x32870
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x40(%rcx), %rcx
subq %rcx, %rax
movl $0x188, %ecx            # imm = 0x188
cqto
idivq %rcx
movl %eax, -0x5c(%rbp)
movq -0x58(%rbp), %rax
movq 0x40(%rax), %rax
movb (%rax), %al
movb %al, -0x5d(%rbp)
movsbl -0x5d(%rbp), %eax
cmpl $0x0, %eax
jl 0x276e3
movsbl -0x5d(%rbp), %eax
cmpl $0x14, %eax
jge 0x276e3
movl -0x1c(%rbp), %eax
cmpl -0x5c(%rbp), %eax
jge 0x276e3
movq -0x68(%rbp), %rax
movq 0x8(%rax), %rax
movsbl -0x1d(%rbp), %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movsbl -0x5d(%rbp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
addsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
movq -0x30(%rbp), %rdi
callq 0x32840
jmp 0x27648
movq -0x30(%rbp), %rdi
callq 0x31d50
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x275a7
movsd -0x18(%rbp), %xmm0
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: gjoni[P]iPot/src/Residue.cpp
// Function: Residue::SetType(char const*)
char Residue::SetType(const char* name) {

	for (int i = 0; i < 24; i++) {
		if (strcmp(name, AAA3[i]) == 0) {
			return i;
		}
	}
	return 23;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
cmpl $0x18, -0x1c(%rbp)
jge 0x28642
movq -0x18(%rbp), %rdi
movslq -0x1c(%rbp), %rax
leaq 0x128f4(%rip), %rsi     # 0x3af10
shlq $0x2, %rax
addq %rax, %rsi
callq 0x33c0
cmpl $0x0, %eax
jne 0x28635
movl -0x1c(%rbp), %eax
movb %al, -0x1(%rbp)
jmp 0x28646
jmp 0x28637
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x28607
movb $0x17, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x20, %rsp
popq %rbp
retq
nop
// File: gjoni[P]iPot/src/Residue.cpp
// Function: Residue::SetCentroid()
void Residue::SetCentroid() {

	centroid[0] = centroid[1] = centroid[2] = 0.0;

	if (type == 7 /* GLY */) {
		centroid[0] = CA->x;
		centroid[1] = CA->y;
		centroid[2] = CA->z;
	} else /* other residues */{
		for (int j = 0; j < nAtoms; j++) {
			centroid[0] += atom[j].x;
			centroid[1] += atom[j].y;
			centroid[2] += atom[j].z;
		}
		centroid[0] /= nAtoms;
		centroid[1] /= nAtoms;
		centroid[2] /= nAtoms;
	}

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x30(%rax)
xorps %xmm0, %xmm0
movsd %xmm0, 0x28(%rax)
xorps %xmm0, %xmm0
movsd %xmm0, 0x20(%rax)
movsbl (%rax), %eax
cmpl $0x7, %eax
jne 0x286bc
movq -0x18(%rbp), %rax
movq 0x168(%rax), %rcx
movsd 0x10(%rcx), %xmm0
movsd %xmm0, 0x20(%rax)
movq 0x168(%rax), %rcx
movsd 0x18(%rcx), %xmm0
movsd %xmm0, 0x28(%rax)
movq 0x168(%rax), %rcx
movsd 0x20(%rcx), %xmm0
movsd %xmm0, 0x30(%rax)
jmp 0x28775
movl $0x0, -0xc(%rbp)
movq -0x18(%rbp), %rcx
movl -0xc(%rbp), %eax
cmpl 0x18(%rcx), %eax
jge 0x28738
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
movslq -0xc(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rcx
movsd 0x10(%rcx), %xmm0
addsd 0x20(%rax), %xmm0
movsd %xmm0, 0x20(%rax)
movq 0x10(%rax), %rcx
movslq -0xc(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rcx
movsd 0x18(%rcx), %xmm0
addsd 0x28(%rax), %xmm0
movsd %xmm0, 0x28(%rax)
movq 0x10(%rax), %rcx
movslq -0xc(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rcx
movsd 0x20(%rcx), %xmm0
addsd 0x30(%rax), %xmm0
movsd %xmm0, 0x30(%rax)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x286c3
movq -0x18(%rbp), %rax
cvtsi2sdl 0x18(%rax), %xmm1
movsd 0x20(%rax), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rax)
cvtsi2sdl 0x18(%rax), %xmm1
movsd 0x28(%rax), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rax)
cvtsi2sdl 0x18(%rax), %xmm1
movsd 0x30(%rax), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rax)
popq %rbp
retq
nopw (%rax,%rax)
// File: gjoni[P]iPot/src/Complex.cpp
// Function: Complex::Complex(Complex const&)
Complex::Complex(const Complex & C) :
		contacts(C.contacts), intRec(NULL), intLig(NULL), intRecN(C.intRecN), intLigN(
				C.intLigN), Receptor(C.Receptor), Ligand(C.Ligand) {

	AllocateComplex();

	/* copy interface residues */
	memcpy(intRec, C.intRec, Receptor.nRes * sizeof(bool));
	memcpy(intLig, C.intLig, Ligand.nRes * sizeof(bool));

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x30(%rbp)
movq %rdi, %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rsi
callq 0x2c8a0
movq -0x30(%rbp), %rdi
movq $0x0, 0x18(%rdi)
movq $0x0, 0x20(%rdi)
movq -0x10(%rbp), %rax
movl 0x28(%rax), %eax
movl %eax, 0x28(%rdi)
movq -0x10(%rbp), %rax
movl 0x2c(%rax), %eax
movl %eax, 0x2c(%rdi)
addq $0x30, %rdi
movq %rdi, -0x28(%rbp)
movq -0x10(%rbp), %rsi
addq $0x30, %rsi
callq 0x1a340
jmp 0x2b147
movq -0x38(%rbp), %rdi
addq $0xa0, %rdi
movq %rdi, -0x40(%rbp)
movq -0x10(%rbp), %rsi
addq $0xa0, %rsi
callq 0x1a340
jmp 0x2b168
movq -0x38(%rbp), %rdi
callq 0x2b210
jmp 0x2b173
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rsi
movslq 0x78(%rax), %rdx
shlq $0x0, %rdx
callq 0x3240
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x10(%rbp), %rcx
movq 0x20(%rcx), %rsi
movslq 0xe8(%rax), %rdx
shlq $0x0, %rdx
callq 0x3240
addq $0x40, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x2b1f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x2b1e7
movq -0x40(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
callq 0x1a610
movq -0x28(%rbp), %rdi
callq 0x1a610
movq -0x30(%rbp), %rdi
callq 0x2c840
movq -0x18(%rbp), %rdi
callq 0x3460
nopw %cs:(%rax,%rax)
// File: gjoni[P]iPot/src/Complex.cpp
// Function: Complex::operator=(Complex const&)
Complex & Complex::operator =(const Complex & C) {

	assert(this != &C); /* error: an attempt to assign Complex to itself */

	FreeComplex();

	/* copy proteins */
	Receptor = C.Receptor;
	Ligand = C.Ligand;

	AllocateComplex();

	/* copy interface residues and contacts */
	contacts = C.contacts;
	memcpy(intRec, C.intRec, Receptor.nRes * sizeof(bool));
	memcpy(intLig, C.intLig, Ligand.nRes * sizeof(bool));
	intRecN = C.intRecN;
	intLigN = C.intLigN;

	return *this;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq -0x10(%rbp), %rax
je 0x2b4c0
jmp 0x2b4df
leaq 0x12da9(%rip), %rdi     # 0x3e270
leaq 0x12dad(%rip), %rsi     # 0x3e27b
movl $0x3b, %edx
leaq 0x12db1(%rip), %rcx     # 0x3e28b
callq 0x31b0
movq -0x18(%rbp), %rdi
callq 0x2b470
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x30, %rsi
addq $0x30, %rdi
callq 0x1a780
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0xa0, %rsi
addq $0xa0, %rdi
callq 0x1a780
movq -0x18(%rbp), %rdi
callq 0x2b210
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2c990
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rsi
movslq 0x78(%rax), %rdx
shlq $0x0, %rdx
callq 0x3240
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x10(%rbp), %rcx
movq 0x20(%rcx), %rsi
movslq 0xe8(%rax), %rdx
shlq $0x0, %rdx
callq 0x3240
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
movl 0x28(%rcx), %ecx
movl %ecx, 0x28(%rax)
movq -0x10(%rbp), %rcx
movl 0x2c(%rcx), %ecx
movl %ecx, 0x2c(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: gjoni[P]iPot/src/Complex.cpp
// Function: Complex::ArrangeContatcs()
void Complex::ArrangeContatcs() {

	std::sort(contacts.begin(), contacts.end());
	std::vector<std::pair<int, int> >::iterator it;
	it = std::unique(contacts.begin(), contacts.end());
	contacts.resize(it - contacts.begin());

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x48(%rbp)
callq 0x2cc80
movq -0x48(%rbp), %rdi
movq %rax, -0x10(%rbp)
callq 0x2ccb0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x2cc40
leaq -0x20(%rbp), %rdi
callq 0x2cce0
movq -0x48(%rbp), %rdi
callq 0x2cc80
movq -0x48(%rbp), %rdi
movq %rax, -0x30(%rbp)
callq 0x2ccb0
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x2cd00
movq -0x48(%rbp), %rdi
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x20(%rbp)
callq 0x2cc80
movq %rax, -0x40(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x2cdd0
movq -0x48(%rbp), %rdi
movq %rax, %rsi
callq 0x2cd40
addq $0x50, %rsp
popq %rbp
retq
nop
// File: gjoni[P]iPot/src/Complex.cpp
// Function: Complex::CountIntRes()
void Complex::CountIntRes() {

	intRecN = 0;
	for (int i = 0; i < Receptor.nRes; i++) {
		if (intRec[i]) {
			intRecN++;
		}
	}

	intLigN = 0;
	for (int i = 0; i < Ligand.nRes; i++) {
		if (intLig[i]) {
			intLigN++;
		}
	}

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movl $0x0, 0x28(%rax)
movl $0x0, -0xc(%rbp)
movq -0x18(%rbp), %rcx
movl -0xc(%rbp), %eax
cmpl 0x78(%rcx), %eax
jge 0x2c696
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0xc(%rbp), %rcx
testb $0x1, (%rax,%rcx)
je 0x2c689
movq -0x18(%rbp), %rax
movl 0x28(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x28(%rax)
jmp 0x2c68b
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x2c65e
movq -0x18(%rbp), %rax
movl $0x0, 0x2c(%rax)
movl $0x0, -0x10(%rbp)
movq -0x18(%rbp), %rcx
movl -0x10(%rbp), %eax
cmpl 0xe8(%rcx), %eax
jge 0x2c6e3
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x10(%rbp), %rcx
testb $0x1, (%rax,%rcx)
je 0x2c6d6
movq -0x18(%rbp), %rax
movl 0x2c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x2c(%rax)
jmp 0x2c6d8
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x2c6a8
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: gjoni[P]iPot/src/Complex.cpp
// Function: Complex::SetInterface(double, int)
void Complex::SetInterface(double dist, int mode) {

	contacts.clear();
	memset(intRec, 0, Receptor.nRes * sizeof(bool));
	memset(intLig, 0, Ligand.nRes * sizeof(bool));

	if (mode == 1) {
		SetInterface1(dist);
	} else if (mode == 2) {
		SetInterface2(dist);
	} else if (mode == 3) {
		SetInterface3(dist);
	} else if (mode == 4) {
		SetInterface4(dist);
	} else if (mode == 5) {
		SetInterface5(dist);
	} else {
		assert(0); /* error: wrong mode for interface extraction */
	}

	CountIntRes();

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movsd %xmm0, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x20(%rbp)
callq 0x2ce10
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rdi
movslq 0x78(%rax), %rdx
shlq $0x0, %rdx
xorl %esi, %esi
callq 0x3170
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rdi
movslq 0xe8(%rax), %rdx
shlq $0x0, %rdx
xorl %esi, %esi
callq 0x3170
cmpl $0x1, -0x14(%rbp)
jne 0x2c758
movq -0x20(%rbp), %rdi
movsd -0x10(%rbp), %xmm0
callq 0x2b590
jmp 0x2c7d7
cmpl $0x2, -0x14(%rbp)
jne 0x2c76e
movq -0x20(%rbp), %rdi
movsd -0x10(%rbp), %xmm0
callq 0x2b8e0
jmp 0x2c7d5
cmpl $0x3, -0x14(%rbp)
jne 0x2c784
movq -0x20(%rbp), %rdi
movsd -0x10(%rbp), %xmm0
callq 0x2bb40
jmp 0x2c7d3
cmpl $0x4, -0x14(%rbp)
jne 0x2c79a
movq -0x20(%rbp), %rdi
movsd -0x10(%rbp), %xmm0
callq 0x2bfc0
jmp 0x2c7d1
cmpl $0x5, -0x14(%rbp)
jne 0x2c7b0
movq -0x20(%rbp), %rdi
movsd -0x10(%rbp), %xmm0
callq 0x2c1d0
jmp 0x2c7cf
leaq 0xe7ca(%rip), %rdi      # 0x3af81
leaq 0x11abd(%rip), %rsi     # 0x3e27b
movl $0x1a0, %edx            # imm = 0x1A0
leaq 0x11aee(%rip), %rcx     # 0x3e2b8
callq 0x31b0
jmp 0x2c7d1
jmp 0x2c7d3
jmp 0x2c7d5
jmp 0x2c7d7
movq -0x20(%rbp), %rdi
callq 0x2c640
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: gjoni[P]iPot/src/kdtree.cpp
// Function: kd_create
struct kdtree *kd_create(int k)
{
	struct kdtree *tree;

	if(!(tree = (kdtree*)malloc(sizeof *tree))) {	// (kdtree*) added
		return 0;
	}

	tree->dim = k;
	tree->root = 0;
	tree->destr = 0;
	tree->rect = 0;

	return tree;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0xc(%rbp)
movl $0x20, %edi
callq 0x3390
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x31409
movq $0x0, -0x8(%rbp)
jmp 0x3143e
movl -0xc(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: gjoni[P]iPot/src/kdtree.cpp
// Function: kd_clear
void kd_clear(struct kdtree *tree)
{
	clear_rec(tree->root, tree->destr);
	tree->root = 0;

	if (tree->rect) {
		hyperrect_free(tree->rect);
		tree->rect = 0;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x314e0
movq -0x8(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x314d1
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x31550
movq -0x8(%rbp), %rax
movq $0x0, 0x10(%rax)
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: gjoni[P]iPot/src/kdtree.cpp
// Function: clear_rec(kdnode*, void (*)(void*))
static void clear_rec(struct kdnode *node, void (*destr)(void*))
{
	if(!node) return;

	clear_rec(node->left, destr);
	clear_rec(node->right, destr);
	
	if(destr) {
		destr(node->data);
	}
	free(node->pos);
	free(node);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x314f9
jmp 0x31545
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x314e0
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x314e0
cmpq $0x0, -0x10(%rbp)
je 0x31530
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x10(%rcx), %rdi
callq *%rax
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x3320
movq -0x8(%rbp), %rdi
callq 0x3320
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: gjoni[P]iPot/src/kdtree.cpp
// Function: kd_insert
int kd_insert(struct kdtree *tree, const double *pos, void *data)
{
	if (insert_rec(&tree->root, pos, data, 0, tree->dim)) {
		return -1;
	}

	if (tree->rect == 0) {
		tree->rect = hyperrect_create(tree->dim, pos, pos);
	} else {
		hyperrect_extend(tree->rect, pos);
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rax
movl (%rax), %r8d
xorl %ecx, %ecx
callq 0x31640
cmpl $0x0, %eax
je 0x315f0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x31633
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x3161b
movq -0x10(%rbp), %rax
movl (%rax), %edi
movq -0x18(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x317b0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x3162c
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x318a0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: gjoni[P]iPot/src/kdtree.cpp
// Function: insert_rec(kdnode**, double const*, void*, int, int)
static int insert_rec(struct kdnode **nptr, const double *pos, void *data, int dir, int dim)
{
	int new_dir;
	struct kdnode *node;

	if(!*nptr) {
		if(!(node = (kdnode*)malloc(sizeof *node))) {	// (kdnode*) added
			return -1;
		}
		if(!(node->pos = (double*)malloc(dim * sizeof *node->pos))) {	// (double*) added
			free(node);
			return -1;
		}
		memcpy(node->pos, pos, dim * sizeof *node->pos);
		node->data = data;
		node->dir = dir;
		node->left = node->right = 0;
		*nptr = node;
		return 0;
	}

	node = *nptr;
	new_dir = (node->dir + 1) % dim;
	if(pos[node->dir] < node->pos[node->dir]) {
		return insert_rec(&(*nptr)->left, pos, data, new_dir, dim);
	}
	return insert_rec(&(*nptr)->right, pos, data, new_dir, dim);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl %r8d, -0x28(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x31715
movl $0x28, %edi
callq 0x3390
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
jne 0x31689
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x317a2
movslq -0x28(%rbp), %rdi
shlq $0x3, %rdi
callq 0x3390
movq -0x38(%rbp), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0x316b8
movq -0x38(%rbp), %rdi
callq 0x3320
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x317a2
movq -0x38(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
movslq -0x28(%rbp), %rdx
shlq $0x3, %rdx
callq 0x3240
movq -0x20(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movl -0x24(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x38(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x38(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x38(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x317a2
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
cltd
idivl -0x28(%rbp)
movl %edx, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movq -0x38(%rbp), %rcx
movslq 0x8(%rcx), %rcx
movsd (%rax,%rcx,8), %xmm1
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq -0x38(%rbp), %rcx
movslq 0x8(%rcx), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x31780
movq -0x10(%rbp), %rax
movq (%rax), %rdi
addq $0x18, %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl -0x2c(%rbp), %ecx
movl -0x28(%rbp), %r8d
callq 0x31640
movl %eax, -0x4(%rbp)
jmp 0x317a2
movq -0x10(%rbp), %rax
movq (%rax), %rdi
addq $0x20, %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl -0x2c(%rbp), %ecx
movl -0x28(%rbp), %r8d
callq 0x31640
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: gjoni[P]iPot/src/kdtree.cpp
// Function: hyperrect_create(int, double const*, double const*)
static struct kdhyperrect* hyperrect_create(int dim, const double *min, const double *max)
{
	size_t size = dim * sizeof(double);
	struct kdhyperrect* rect = 0;

	if (!(rect = (kdhyperrect*)malloc(sizeof(struct kdhyperrect)))) {	// (kdhyperrect*) added
		return 0;
	}

	rect->dim = dim;
	if (!(rect->min = (double*)malloc(size))) {	// (double*) added
		free(rect);
		return 0;
	}
	if (!(rect->max = (double*)malloc(size))) {	// (double*) added
		free(rect->min);
		free(rect);
		return 0;
	}
	memcpy(rect->min, min, size);
	memcpy(rect->max, max, size);

	return rect;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movslq -0xc(%rbp), %rax
shlq $0x3, %rax
movq %rax, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movl $0x18, %edi
callq 0x3390
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x317f8
movq $0x0, -0x8(%rbp)
jmp 0x31894
movl -0xc(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movq -0x28(%rbp), %rdi
callq 0x3390
movq -0x30(%rbp), %rcx
movq %rax, 0x8(%rcx)
cmpq $0x0, %rax
jne 0x3182b
movq -0x30(%rbp), %rdi
callq 0x3320
movq $0x0, -0x8(%rbp)
jmp 0x31894
movq -0x28(%rbp), %rdi
callq 0x3390
movq -0x30(%rbp), %rcx
movq %rax, 0x10(%rcx)
cmpq $0x0, %rax
jne 0x31862
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x3320
movq -0x30(%rbp), %rdi
callq 0x3320
movq $0x0, -0x8(%rbp)
jmp 0x31894
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x3240
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x3240
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nop
// File: gjoni[P]iPot/src/kdtree.cpp
// Function: hyperrect_extend(kdhyperrect*, double const*)
static void hyperrect_extend(struct kdhyperrect *rect, const double *pos)
{
	int i;

	for (i=0; i < rect->dim; i++) {
		if (pos[i] < rect->min[i]) {
			rect->min[i] = pos[i];
		}
		if (pos[i] > rect->max[i]) {
			rect->max[i] = pos[i];
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x31952
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x14(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x31904
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x14(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x14(%rbp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x31942
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x14(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x31944
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x318b3
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: gjoni[P]iPot/src/kdtree.cpp
// Function: kd_insertf
int kd_insertf(struct kdtree *tree, const float *pos, void *data)
{
	static double sbuf[16];
	double *bptr, *buf = 0;
	int res, dim = tree->dim;

	if(dim > 16) {
#ifndef NO_ALLOCA
		if(dim <= 256)
			bptr = buf = (double*)alloca(dim * sizeof *bptr);	// (double*) added
		else
#endif
			if(!(bptr = buf = (double*)malloc(dim * sizeof *bptr))) {	// (double*) added
				return -1;
			}
	} else {
		bptr = buf = sbuf;
	}

	while(dim-- > 0) {
		*bptr++ = *pos++;
	}

	res = kd_insert(tree, buf, data);
#ifndef NO_ALLOCA
	if(tree->dim > 256)
#else
	if(tree->dim > 16)
#endif
		free(buf);
	return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x38(%rbp)
cmpl $0x10, -0x38(%rbp)
jle 0x319e2
cmpl $0x100, -0x38(%rbp)     # imm = 0x100
jg 0x319b7
movslq -0x38(%rbp), %rax
leaq 0xf(,%rax,8), %rcx
andq $-0x10, %rcx
movq %rsp, %rax
subq %rcx, %rax
movq %rax, %rsp
movq %rax, -0x30(%rbp)
movq %rax, -0x28(%rbp)
jmp 0x319e0
movslq -0x38(%rbp), %rdi
shlq $0x3, %rdi
callq 0x3390
movq %rax, -0x30(%rbp)
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x319de
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x31a65
jmp 0x319e0
jmp 0x319f8
leaq 0x1ca57(%rip), %rax     # 0x4e440
movq %rax, -0x30(%rbp)
leaq 0x1ca4c(%rip), %rax     # 0x4e440
movq %rax, -0x28(%rbp)
jmp 0x319fa
movl -0x38(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x38(%rbp)
cmpl $0x0, %eax
jle 0x31a36
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x18(%rbp)
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x28(%rbp)
movsd %xmm0, (%rax)
jmp 0x319fa
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x315b0
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x100, (%rax)          # imm = 0x100
jle 0x31a5f
movq -0x30(%rbp), %rdi
callq 0x3320
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
movq %rbp, %rsp
popq %rbp
retq
nopl (%rax)
// File: gjoni[P]iPot/src/kdtree.cpp
// Function: kd_insert3
int kd_insert3(struct kdtree *tree, double x, double y, double z, void *data)
{
	double buf[3];
	buf[0] = x;
	buf[1] = y;
	buf[2] = z;
	return kd_insert(tree, buf, data);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movsd %xmm0, -0x10(%rbp)
movsd %xmm1, -0x18(%rbp)
movsd %xmm2, -0x20(%rbp)
movq %rsi, -0x28(%rbp)
movsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x315b0
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: gjoni[P]iPot/src/kdtree.cpp
// Function: kd_insert3f
int kd_insert3f(struct kdtree *tree, float x, float y, float z, void *data)
{
	double buf[3];
	buf[0] = x;
	buf[1] = y;
	buf[2] = z;
	return kd_insert(tree, buf, data);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movss %xmm0, -0xc(%rbp)
movss %xmm1, -0x10(%rbp)
movss %xmm2, -0x14(%rbp)
movq %rsi, -0x20(%rbp)
movss -0xc(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x40(%rbp)
movss -0x10(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x38(%rbp)
movss -0x14(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x315b0
addq $0x40, %rsp
popq %rbp
retq
// File: gjoni[P]iPot/src/kdtree.cpp
// Function: rlist_insert(res_node*, kdnode*, double)
static int rlist_insert(struct res_node *list, struct kdnode *item, double dist_sq)
{
	struct res_node *rnode;

	if(!(rnode = (res_node*)alloc_resnode())) {	// (res_node*) added
		return -1;
	}
	rnode->item = item;
	rnode->dist_sq = dist_sq;

	if(dist_sq >= 0.0) {
		while(list->next && list->next->dist_sq < dist_sq) {
			list = list->next;
		}
	}
	rnode->next = list->next;
	list->next = rnode;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movsd %xmm0, -0x20(%rbp)
movl $0x18, %edi
callq 0x3390
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x32015
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x320a6
movq -0x18(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movsd -0x20(%rbp), %xmm0
movq -0x28(%rbp), %rax
movsd %xmm0, 0x8(%rax)
movsd -0x20(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x32083
jmp 0x3203e
movq -0x10(%rbp), %rcx
xorl %eax, %eax
cmpq $0x0, 0x10(%rcx)
movb %al, -0x29(%rbp)
je 0x3206a
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movsd 0x8(%rax), %xmm1
movsd -0x20(%rbp), %xmm0
ucomisd %xmm1, %xmm0
seta %al
movb %al, -0x29(%rbp)
movb -0x29(%rbp), %al
testb $0x1, %al
jne 0x32073
jmp 0x32081
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x3203e
jmp 0x32083
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop
// File: gjoni[P]iPot/src/kdtree.cpp
// Function: kd_nearestf
struct kdres *kd_nearestf(struct kdtree *tree, const float *pos)
{
	static double sbuf[16];
	double *bptr, *buf = 0;
	int dim = tree->dim;
	struct kdres *res;

	if(dim > 16) {
#ifndef NO_ALLOCA
		if(dim <= 256)
			bptr = buf = (double*)alloca(dim * sizeof *bptr);	// (double*) added
		else
#endif
			if(!(bptr = buf = (double*)malloc(dim * sizeof *bptr))) {	// (double*) added
				return 0;
			}
	} else {
		bptr = buf = sbuf;
	}

	while(dim-- > 0) {
		*bptr++ = *pos++;
	}

	res = kd_nearest(tree, buf);
#ifndef NO_ALLOCA
	if(tree->dim > 256)
#else
	if(tree->dim > 16)
#endif
		free(buf);
	return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
cmpl $0x10, -0x2c(%rbp)
jle 0x3214f
cmpl $0x100, -0x2c(%rbp)     # imm = 0x100
jg 0x32123
movslq -0x2c(%rbp), %rax
leaq 0xf(,%rax,8), %rcx
andq $-0x10, %rcx
movq %rsp, %rax
subq %rcx, %rax
movq %rax, %rsp
movq %rax, -0x28(%rbp)
movq %rax, -0x20(%rbp)
jmp 0x3214d
movslq -0x2c(%rbp), %rdi
shlq $0x3, %rdi
callq 0x3390
movq %rax, -0x28(%rbp)
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0x3214b
movq $0x0, -0x8(%rbp)
jmp 0x321d1
jmp 0x3214d
jmp 0x32165
leaq 0x1c36a(%rip), %rax     # 0x4e4c0
movq %rax, -0x28(%rbp)
leaq 0x1c35f(%rip), %rax     # 0x4e4c0
movq %rax, -0x20(%rbp)
jmp 0x32167
movl -0x2c(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x2c(%rbp)
cmpl $0x0, %eax
jle 0x321a3
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x18(%rbp)
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x20(%rbp)
movsd %xmm0, (%rax)
jmp 0x32167
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x31b30
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x100, (%rax)          # imm = 0x100
jle 0x321c9
movq -0x28(%rbp), %rdi
callq 0x3320
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rbp, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: gjoni[P]iPot/src/kdtree.cpp
// Function: kd_nearest3
struct kdres *kd_nearest3(struct kdtree *tree, double x, double y, double z)
{
	double pos[3];
	pos[0] = x;
	pos[1] = y;
	pos[2] = z;
	return kd_nearest(tree, pos);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movsd %xmm0, -0x10(%rbp)
movsd %xmm1, -0x18(%rbp)
movsd %xmm2, -0x20(%rbp)
movsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x31b30
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)