LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/bwtindex.c
// Function: command_pac2bwt
int command_pac2bwt(int argc, char *argv[]) {
	bwt_t *bwt;
	int c;
	while ((c = getopt(argc, argv, "d")) >= 0) {
		switch (c) {
		default: return 1;
		}
	}
	if (optind + 2 > argc) {
		fprintf(stderr, "Usage: paladin pac2bwt <in.pac> <out.bwt>\n");
		return 1;
	}
	bwt = bwt_pac2bwt(argv[optind]);
	bwt_dump_bwt(argv[optind+1], bwt);
	bwt_destroy(bwt);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %r14d
leaq 0x1fc14(%rip), %rdx     # 0x2575c
callq 0x3090
movl $0x1, %ebp
testl %eax, %eax
jns 0x5b8e
movq 0x2a47b(%rip), %r15     # 0x2ffd8
movslq (%r15), %rax
leal 0x2(%rax), %ecx
cmpl %r14d, %ecx
jg 0x5b9b
movq (%rbx,%rax,8), %rdi
callq 0x5984
movq %rax, %r14
movslq (%r15), %rax
movq 0x8(%rbx,%rax,8), %rdi
movq %r14, %rsi
callq 0xfc75
movq %r14, %rdi
callq 0x1004d
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x37c0
jmp 0x5b8e
// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/bwtindex.c
// Function: bwt_bwtupdate_core
void bwt_bwtupdate_core(bwt_t *bwt) {
	int64_t i, k, counts[VALUE_DOMAIN], n_occ;
	uint32_t * bwtBuf;

	// Initialize counts array
	memset(counts, 0, sizeof(counts));

	// Adjust the FM-Index size by the number of interleaved occurrence counts
	n_occ = (bwt->seq_len + OCC_INTERVAL - 1) / OCC_INTERVAL + 1;
	bwt->bwt_size += n_occ * sizeof(bwtint_t) / sizeof(uint32_t) * VALUE_DOMAIN;
	bwtBuf = (uint32_t*)calloc(bwt->bwt_size, sizeof(uint32_t));

	// Iterate through each packed value in the current FM-Index
	for (i = k = 0; i < bwt->seq_len; ++i) {
		// For each occurrence interval, insert the number of running occurrences
		if (i % OCC_INTERVAL == 0) {
			memcpy(bwtBuf + k, counts, sizeof(bwtint_t) * VALUE_DOMAIN);
			k += sizeof(bwtint_t) / sizeof(uint32_t) * VALUE_DOMAIN;
		}

		// Copy packed value
		if (i % 4 == 0) bwtBuf[k++] = bwt->bwt[i/4];

		// Unpack and record current occurrence
		++counts[unpackValue(bwt, i)];
	}

	// Record last element
	memcpy(bwtBuf + k, counts, sizeof(bwtint_t) * VALUE_DOMAIN);
	xassert(k + sizeof(bwtint_t) / sizeof(uint32_t) * VALUE_DOMAIN == bwt->bwt_size, "inconsistent bwt_size");

	// Update FM-Index
	free(bwt->bwt);
	bwt->bwt = bwtBuf;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdi, %rbx
movq %rsp, %rdi
xorl %r12d, %r12d
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x3140
movq 0x110(%rbx), %rax
movq 0x118(%rbx), %rcx
addq $0x7f, %rax
shrq %rax
andq $-0x40, %rax
leaq (%rcx,%rax), %rdi
addq $0x40, %rdi
movq %rdi, 0x118(%rbx)
leaq 0x1f4dd(%rip), %rdx     # 0x250d4
leaq 0x1f518(%rip), %r8      # 0x25116
movl $0x4, %esi
movl $0xc2, %ecx
callq 0x22cb4
movq %rax, %r14
cmpq $0x0, 0x110(%rbx)
je 0x5c88
movq %rsp, %r15
xorl %ebp, %ebp
xorl %r13d, %r13d
testb $0x7f, %bpl
jne 0x5c3d
leaq (%r14,%r13,4), %rdi
movl $0x100, %edx            # imm = 0x100
movq %r15, %rsi
callq 0x3260
addq $0x40, %r13
testb $0x3, %bpl
jne 0x5c54
movq 0x120(%rbx), %rax
movl (%rax,%rbp), %eax
movl %eax, (%r14,%r13,4)
incq %r13
movq 0x120(%rbx), %rax
movq %rbp, %rcx
andq $-0x4, %rcx
movl (%rax,%rcx), %eax
movl %r12d, %ecx
notb %cl
andb $0x18, %cl
shrl %cl, %eax
movzbl %al, %eax
incq (%rsp,%rax,8)
incq %rbp
addl $0x8, %r12d
cmpq 0x110(%rbx), %rbp
jb 0x5c22
jmp 0x5c8b
xorl %r13d, %r13d
leaq (%r14,%r13,4), %rdi
movq %rsp, %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x3260
addq $0x40, %r13
cmpq 0x118(%rbx), %r13
jne 0x5cce
movq 0x120(%rbx), %rdi
callq 0x3390
movq %r14, 0x120(%rbx)
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1f441(%rip), %rdi     # 0x25116
leaq 0x1f44d(%rip), %rsi     # 0x25129
callq 0xe0d8
// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/bwtindex.c
// Function: command_bwtupdate
int command_bwtupdate(int argc, char *argv[]) {
	bwt_t *bwt;
	if (argc < 2) {
		fprintf(stderr, "Usage: paladin bwtupdate <the.bwt>\n");
		return 1;
	}
	bwt = bwt_restore_bwt(argv[1]);
	bwt_bwtupdate_core(bwt);
	bwt_dump_bwt(argv[1], bwt);
	bwt_destroy(bwt);
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x1, %edi
jle 0x5d1f
movq %rsi, %rbx
movq 0x8(%rsi), %rdi
callq 0xff47
movq %rax, %r14
movq %rax, %rdi
callq 0x5ba2
movq 0x8(%rbx), %rdi
movq %r14, %rsi
callq 0xfc75
movq %r14, %rdi
callq 0x1004d
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x37dc
movl $0x1, %eax
jmp 0x5d17
// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/bwtindex.c
// Function: command_bwt2sa
int command_bwt2sa(int argc, char *argv[]) {
	bwt_t *bwt;
	int c, sa_intv = 32;
	while ((c = getopt(argc, argv, "i:")) >= 0) {
		switch (c) {
		case 'i': sa_intv = atoi(optarg); break;
		default: return 1;
		}
	}
	if (optind + 2 > argc) {
		fprintf(stderr, "Usage: paladin bwt2sa [-i %d] <in.bwt> <out.sa>\n", sa_intv);
		return 1;
	}
	bwt = bwt_restore_bwt(argv[optind]);
	bwt_cal_sa(bwt, sa_intv);
	bwt_dump_sa(argv[optind+1], bwt);
	bwt_destroy(bwt);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x230c5(%rip), %rdx     # 0x28e04
callq 0x3090
testl %eax, %eax
js 0x5d7e
movq 0x2a269(%rip), %r12     # 0x2ffb8
leaq 0x230ae(%rip), %r15     # 0x28e04
cmpl $0x69, %eax
jne 0x5de5
movq (%r12), %rdi
callq 0x35b0
movl %eax, %r14d
movl %ebp, %edi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x3090
testl %eax, %eax
jns 0x5d56
jmp 0x5d84
movl $0x20, %r14d
movq 0x2a24d(%rip), %r12     # 0x2ffd8
movslq (%r12), %rax
leal 0x2(%rax), %ecx
cmpl %ebp, %ecx
jg 0x5dca
movq (%rbx,%rax,8), %rdi
callq 0xff47
movq %rax, %r15
movq %rax, %rdi
movl %r14d, %esi
callq 0xeaeb
movslq (%r12), %rax
movq 0x8(%rbx,%rax,8), %rdi
movq %r15, %rsi
callq 0xfcf2
movq %r15, %rdi
callq 0x1004d
xorl %eax, %eax
jmp 0x5dea
movq 0x2a1ff(%rip), %rax     # 0x2ffd0
movq (%rax), %rdi
leaq 0x1f388(%rip), %rsi     # 0x25163
movl %r14d, %edx
xorl %eax, %eax
callq 0x3500
movl $0x1, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/kopen.c
// Function: cmd2argv
static char **cmd2argv(const char *cmd)
{
	int i, beg, end, argc;
	char **argv, *str;
	end = strlen(cmd);
	for (i = end - 1; i >= 0; --i)
		if (!isspace(cmd[i])) break;
	end = i + 1;
	for (beg = 0; beg < end; ++beg)
		if (!isspace(cmd[beg])) break;
	if (beg == end) return 0;
	for (i = beg + 1, argc = 0; i < end; ++i)
		if (isspace(cmd[i]) && !isspace(cmd[i-1]))
			++argc;
	argv = (char**)calloc(argc + 2, sizeof(void*));
	argv[0] = str = (char*)calloc(end - beg + 1, 1);
	strncpy(argv[0], cmd + beg, end - beg);
	for (i = argc = 1; i < end - beg; ++i)
		if (isspace(str[i])) str[i] = 0;
		else if (str[i] && str[i-1] == 0) argv[argc++] = &str[i];
	return argv;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x3100
movq %rax, %r14
movl %r14d, %r15d
movl %r14d, %ebp
sarl $0x1f, %ebp
andl %r14d, %ebp
incl %r14d
testl %r15d, %r15d
jle 0x6fd8
leaq -0x1(%r15), %r12
callq 0x3320
movq (%rax), %rax
movsbq -0x1(%rbx,%r15), %rcx
decl %r14d
testb $0x20, 0x1(%rax,%rcx,2)
movq %r12, %r15
jne 0x6fb2
jmp 0x6fdb
movl %ebp, %r14d
movl %r14d, %r13d
testl %r14d, %r14d
jle 0x7006
callq 0x3320
movq (%rax), %rax
xorl %ebp, %ebp
movsbq (%rbx,%rbp), %rcx
testb $0x20, 0x1(%rax,%rcx,2)
je 0x7008
incq %rbp
cmpq %rbp, %r13
jne 0x6fed
movl %r13d, %ebp
jmp 0x7008
xorl %ebp, %ebp
cmpl %ebp, %r13d
jne 0x7015
xorl %r14d, %r14d
jmp 0x7118
leal 0x1(%rbp), %r14d
movl $0x2, %edi
cmpl %r13d, %r14d
jge 0x706d
callq 0x3320
movq (%rax), %rax
movl %r14d, %ecx
addq %rbx, %rcx
xorl %edx, %edx
movl %ebp, %esi
movsbq (%rcx), %rdi
testb $0x20, 0x1(%rax,%rdi,2)
je 0x7057
movl %esi, %edi
movsbq (%rbx,%rdi), %rdi
movb 0x1(%rax,%rdi,2), %dil
andb $0x20, %dil
cmpb $0x1, %dil
adcl $0x0, %edx
leal 0x1(%rsi), %edi
incq %rcx
addl $0x2, %esi
cmpl %esi, %r13d
movl %edi, %esi
jg 0x7035
addl $0x2, %edx
movslq %edx, %rdi
leaq 0x1e617(%rip), %r15     # 0x2568b
leaq 0x1e708(%rip), %r12     # 0x25783
movl $0x8, %esi
movq %r15, %rdx
movl $0xf6, %ecx
movq %r12, %r8
callq 0x22cb4
movq %rax, %r14
subl %ebp, %r13d
leal 0x1(%r13), %eax
movslq %eax, %rdi
movl $0x1, %esi
movq %r15, %rdx
movl $0xf7, %ecx
movq %r12, %r8
callq 0x22cb4
movq %rax, %r15
movq %rax, (%r14)
movl %ebp, %eax
addq %rax, %rbx
movslq %r13d, %r12
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x3130
cmpl $0x2, %r12d
jl 0x7118
callq 0x3320
movl %r13d, %ecx
incq %r15
decq %rcx
movl $0x1, %edx
movq (%rax), %rdi
movsbq (%r15), %rsi
testb $0x20, 0x1(%rdi,%rsi,2)
jne 0x710c
testb %sil, %sil
je 0x7110
cmpb $0x0, -0x1(%r15)
jne 0x7110
movslq %edx, %rsi
incl %edx
movq %r15, (%r14,%rsi,8)
jmp 0x7110
movb $0x0, (%r15)
incq %r15
decq %rcx
jne 0x70e7
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/kopen.c
// Function: kclose
int kclose(void *a)
{
	koaux_t *aux = (koaux_t*)a;
	if (aux->type == KO_PIPE) {
		int status;
		pid_t pid;
		pid = waitpid(aux->pid, &status, WNOHANG);
		if (pid != aux->pid) kill(aux->pid, 15);
	}
	free(aux);
	return 0;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
cmpl $0x3, (%rdi)
jne 0x715a
movl 0x8(%rbx), %edi
leaq 0xc(%rsp), %rsi
movl $0x1, %edx
callq 0x3240
movl 0x8(%rbx), %edi
cmpl %edi, %eax
je 0x715a
movl $0xf, %esi
callq 0x34f0
movq %rbx, %rdi
callq 0x3390
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/kopen.c
// Function: socket_connect
static int socket_connect(const char *host, const char *port)
{
#define __err_connect(func) do { perror(func); freeaddrinfo(res); return -1; } while (0)

	int on = 1, fd;
	struct linger lng = { 0, 0 };
	struct addrinfo hints, *res = 0;
	memset(&hints, 0, sizeof(struct addrinfo));
	hints.ai_family = AF_UNSPEC;
	hints.ai_socktype = SOCK_STREAM;
	if (getaddrinfo(host, port, &hints, &res) != 0) __err_connect("getaddrinfo");
	if ((fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol)) == -1) __err_connect("socket");
	if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1) __err_connect("setsockopt");
	if (setsockopt(fd, SOL_SOCKET, SO_LINGER, &lng, sizeof(lng)) == -1) __err_connect("setsockopt");
	if (connect(fd, res->ai_addr, res->ai_addrlen) != 0) __err_connect("connect");
	freeaddrinfo(res);
	return fd;
#undef __err_connect
}

// Assembly:
pushq %rbx
subq $0x50, %rsp
movl $0x1, %eax
movl %eax, 0x14(%rsp)
xorl %edx, %edx
movq %rdx, 0x18(%rsp)
leaq 0x8(%rsp), %rcx
movq %rdx, (%rcx)
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rdx
movaps %xmm0, (%rdx)
movaps %xmm0, 0x10(%rdx)
movaps %xmm0, 0x20(%rdx)
movl %eax, 0x8(%rdx)
callq 0x3420
testl %eax, %eax
jne 0x722f
movq 0x8(%rsp), %rax
movl 0x4(%rax), %edi
movl 0x8(%rax), %esi
movl 0xc(%rax), %edx
callq 0x30b0
cmpl $-0x1, %eax
je 0x7238
movl %eax, %ebx
leaq 0x14(%rsp), %rcx
movl %eax, %edi
movl $0x1, %esi
movl $0x2, %edx
movl $0x4, %r8d
callq 0x36d0
cmpl $-0x1, %eax
je 0x7226
leaq 0x18(%rsp), %rcx
movl %ebx, %edi
movl $0x1, %esi
movl $0xd, %edx
movl $0x8, %r8d
callq 0x36d0
cmpl $-0x1, %eax
je 0x7226
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rsi
movl 0x10(%rax), %edx
movl %ebx, %edi
callq 0x3270
testl %eax, %eax
je 0x7249
leaq 0x1e4db(%rip), %rdi     # 0x256ff
jmp 0x723f
leaq 0x1e4c7(%rip), %rdi     # 0x256f4
jmp 0x723f
leaq 0x1e4ab(%rip), %rdi     # 0x256e1
jmp 0x723f
leaq 0x1e4ae(%rip), %rdi     # 0x256ed
callq 0x3280
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq 0x8(%rsp), %rdi
callq 0x3450
movl %ebx, %eax
addq $0x50, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/kopen.c
// Function: write_bytes
static int write_bytes(int fd, const char *buf, size_t len)
{
	ssize_t bytes;
	do {
		bytes = write(fd, buf, len);
		if (bytes >= 0) {
			len -= bytes;
		} else if (errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR) {
			return -1;
		}
	} while (len > 0);

	return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
movl %ebp, %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x30e0
testq %rax, %rax
js 0x727e
subq %rax, %rbx
jmp 0x728f
callq 0x3050
movl (%rax), %eax
cmpl $0xb, %eax
je 0x728f
cmpl $0x4, %eax
jne 0x729b
testq %rbx, %rbx
jne 0x7267
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x7296
// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/kopen.c
// Function: kftp_get_response
static int kftp_get_response(ftpaux_t *aux)
{
	unsigned char c;
	int n = 0;
	char *p;
	if (socket_wait(aux->ctrl_fd, 1) <= 0) return 0;
	while (read(aux->ctrl_fd, &c, 1)) { // FIXME: this is *VERY BAD* for unbuffered I/O
		if (n >= aux->max_response) {
			aux->max_response = aux->max_response? aux->max_response<<1 : 256;
			aux->response = realloc(aux->response, aux->max_response);
		}
		aux->response[n++] = c;
		if (c == '\n') {
			if (n >= 4 && isdigit(aux->response[0]) && isdigit(aux->response[1]) && isdigit(aux->response[2])
				&& aux->response[3] != '-') break;
			n = 0;
			continue;
		}
	}
	if (n < 2) return -1;
	aux->response[n-2] = 0;
	return strtol(aux->response, &p, 0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl 0x4(%rdi), %edi
movl $0x1, %esi
callq 0x743f
testl %eax, %eax
jle 0x73a0
movl 0x4(%rbx), %edi
leaq 0xf(%rsp), %rsi
movl $0x1, %edx
callq 0x3510
testq %rax, %rax
je 0x73a4
xorl %r15d, %r15d
leaq 0xf(%rsp), %r14
leaq 0x1e478(%rip), %r12     # 0x2576a
movl (%rbx), %eax
cmpl %eax, %r15d
jl 0x7327
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x100, %eax            # imm = 0x100
cmovel %eax, %ecx
movl %ecx, (%rbx)
movq 0x8(%rbx), %rdi
movslq %ecx, %rsi
leaq 0x1e375(%rip), %rdx     # 0x2568b
movl $0x9d, %ecx
movq %r12, %r8
callq 0x22d64
movq %rax, 0x8(%rbx)
movb 0xf(%rsp), %al
movq 0x8(%rbx), %rcx
leal 0x1(%r15), %r13d
movslq %r15d, %rdx
movb %al, (%rcx,%rdx)
cmpb $0xa, %al
jne 0x737c
xorl %ebp, %ebp
cmpl $0x3, %r15d
jl 0x737f
callq 0x3320
movq (%rax), %rcx
movq 0x8(%rbx), %rax
movsbq (%rax), %rdx
testb $0x8, 0x1(%rcx,%rdx,2)
je 0x737f
movsbq 0x1(%rax), %rdx
testb $0x8, 0x1(%rcx,%rdx,2)
je 0x737f
movsbq 0x2(%rax), %rdx
testb $0x8, 0x1(%rcx,%rdx,2)
je 0x737f
cmpb $0x2d, 0x3(%rax)
je 0x737f
jmp 0x73a7
movl %r13d, %ebp
movl 0x4(%rbx), %edi
movl $0x1, %edx
movq %r14, %rsi
callq 0x3510
movl %ebp, %r15d
movl %ebp, %r13d
testq %rax, %rax
jne 0x72f2
jmp 0x73a7
xorl %eax, %eax
jmp 0x73ce
xorl %r13d, %r13d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0x2, %r13d
jl 0x73ce
movq 0x8(%rbx), %rax
movl %r13d, %ecx
movb $0x0, -0x2(%rax,%rcx)
movq 0x8(%rbx), %rdi
leaq 0x10(%rsp), %rsi
xorl %edx, %edx
callq 0x34e0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/kopen.c
// Function: socket_wait
static int socket_wait(int fd, int is_read)
{
	fd_set fds, *fdr = 0, *fdw = 0;
	struct timeval tv;
	int ret;
	tv.tv_sec = 5; tv.tv_usec = 0; // 5 seconds time out
	FD_ZERO(&fds);
	FD_SET(fd, &fds);
	if (is_read) fdr = &fds;
	else fdw = &fds;
	ret = select(fd+1, fdr, fdw, 0, &tv);
	if (ret == -1) perror("select");
	return ret;
}

// Assembly:
pushq %rbx
subq $0x90, %rsp
movl %esi, %eax
movq %rsp, %r8
movq $0x5, (%r8)
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rsi
movaps %xmm0, (%rsi)
movaps %xmm0, 0x10(%rsi)
movaps %xmm0, 0x20(%rsi)
movaps %xmm0, 0x30(%rsi)
movaps %xmm0, 0x40(%rsi)
movaps %xmm0, 0x50(%rsi)
leal 0x3f(%rdi), %edx
testl %edi, %edi
cmovnsl %edi, %edx
movl %edx, %r9d
andl $-0x40, %r9d
movl %edi, %ecx
subl %r9d, %ecx
movl $0x1, %r9d
shlq %cl, %r9
movaps %xmm0, 0x60(%rsi)
movaps %xmm0, 0x70(%rsi)
sarl $0x6, %edx
movslq %edx, %rcx
orq %r9, 0x10(%rsp,%rcx,8)
xorl %ecx, %ecx
testl %eax, %eax
movl $0x0, %edx
cmoveq %rsi, %rdx
movq $0x0, 0x8(%r8)
cmoveq %rcx, %rsi
incl %edi
xorl %ecx, %ecx
callq 0x32d0
movl %eax, %ebx
cmpl $-0x1, %eax
je 0x74d6
movl %ebx, %eax
addq $0x90, %rsp
popq %rbx
retq
leaq 0x1e29f(%rip), %rdi     # 0x2577c
callq 0x3280
jmp 0x74cb
// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/translations.c
// Function: convertTransArgs
int * convertTransArgs(const char * passArguments) {
    char * workArguments, * parseArgument;
    int * retTranslations;
    int argIdx;
    int transCount, valid;

    // Check for help mode
    if (passArguments[0] == '?') {
        renderTranslations();
        exit(0);
    }

    // Copy arguments over to temporary area
    workArguments = calloc(strlen(passArguments)+1, 1);
    memcpy(workArguments, passArguments, strlen(passArguments)+1);

    // Count commas to calculate array size, and replace with NULLs for parsing
    for (argIdx = 0, transCount = 0 ; workArguments[argIdx] ; argIdx++) {
        if (workArguments[argIdx] == ',') {
            workArguments[argIdx] = 0;
            transCount++;
        }
    }

    transCount++;
    retTranslations = calloc(transCount+1, sizeof(int));

    // Parse arguments
    parseArgument = workArguments;
    valid = 1;

    for (argIdx = 0 ; argIdx < transCount ; argIdx++) {
        retTranslations[argIdx] = atoi(parseArgument); 
        parseArgument += strlen(parseArgument) + 1;

        // Check for valid translation ID
        if (retTranslations[argIdx] < 1 || retTranslations[argIdx] > TRANSLATION_COUNT) {
            valid = 0; break;
        }

        if (translationNames[retTranslations[argIdx] - 1][0] == 0) {
            valid = 0; break;
        }
    }

    // If invalid, only translate for standard genetic code
    if (!valid) {
        retTranslations[0] = 1;
        retTranslations[1] = 0;
    }

    return retTranslations;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
cmpb $0x3f, (%rdi)
je 0x8f51
movq %rdi, %r14
callq 0x3100
leaq 0x1(%rax), %r15
movl $0x1, %esi
movq %r15, %rdi
callq 0x31b0
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x3260
xorl %r15d, %r15d
movq %rbx, %rax
movzbl (%rax), %ecx
cmpl $0x2c, %ecx
je 0x8ed4
testl %ecx, %ecx
jne 0x8eda
jmp 0x8edf
movb $0x0, (%rax)
incl %r15d
incq %rax
jmp 0x8ec6
leal 0x2(%r15), %eax
movslq %eax, %rdi
movl $0x4, %esi
callq 0x31b0
movq %rax, %r14
testl %r15d, %r15d
js 0x8f44
incl %r15d
xorl %r12d, %r12d
leaq 0x27b2b(%rip), %r13     # 0x30a30
movq %rbx, %rdi
callq 0x35b0
movl %eax, (%r14,%r12,4)
leal -0x1a(%rax), %ecx
cmpl $-0x19, %ecx
jb 0x8f3d
decl %eax
movq (%r13,%rax,8), %rax
cmpb $0x0, (%rax)
je 0x8f3d
incq %r12
movq %rbx, %rdi
callq 0x3100
addq %rax, %rbx
incq %rbx
cmpq %r12, %r15
jne 0x8f05
jmp 0x8f44
movq $0x1, (%r14)
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
callq 0x8f5d
xorl %edi, %edi
callq 0x33c0
// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/translations.c
// Function: renderTranslations
void renderTranslations() {
    char * transName;
    int transIdx;

    printf("\nThe following genetic code translation tables are available to PALADIN.\n"
           "Multiple codes may be specified by a comma-delimited list with no spaces.\n"
           "If no translation codes are specified, code 1 is used.\n"
           "Details may be found at http://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi\n\n"); 

    for (transIdx = 0 ; transIdx < TRANSLATION_COUNT ; transIdx++) {
        if ((transName = (char *) translationNames[transIdx])[0] != 0) {
            printf("%d. %s\n", transIdx + 1, transName); 
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
leaq 0x1e04e(%rip), %rdi     # 0x26fba
callq 0x3590
movl $0x1, %ebx
leaq 0x27ab3(%rip), %r15     # 0x30a30
leaq 0x1e02e(%rip), %r14     # 0x26fb2
xorl %r12d, %r12d
movq (%r12,%r15), %rdx
cmpb $0x0, (%rdx)
je 0x8f9c
movq %r14, %rdi
movl %ebx, %esi
xorl %eax, %eax
callq 0x3060
incl %ebx
addq $0x8, %r12
cmpq $0xc8, %r12
jne 0x8f87
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/protein.c
// Function: encodeCodon
unsigned char encodeCodon(char * passSequence, int passStrand) {
	unsigned char retCodon;
	int relIdx, absIdx;

	retCodon = 0;

	for (relIdx = 0 ; relIdx < 3 ; relIdx++) {
		// Calculate absolute index from relative
		absIdx = relIdx;
		if (passStrand < 0) absIdx = absIdx * -1;

		// If this codon has any ambiguous nucleotides, signal with 0xFF
		if (nst_nt4_table[(int) passSequence[absIdx]] > 3) {
			return 0xFF;
		}

		retCodon = (retCodon << 2) | nst_nt4_table[(int) passSequence[absIdx]];
	}

	// Complement if reverse strand
	if (passStrand < 0) retCodon ^= 0x3F;

	return retCodon;
}

// Assembly:
xorl %ecx, %ecx
leaq 0x27b7f(%rip), %rdx     # 0x30b40
xorl %r8d, %r8d
xorl %eax, %eax
testl %esi, %esi
movl %r8d, %r9d
cmovsl %ecx, %r9d
movslq %r9d, %r9
movsbq (%rdi,%r9), %r9
movb (%rdx,%r9), %r9b
cmpb $0x3, %r9b
ja 0x8fff
shlb $0x2, %al
orb %r9b, %al
incl %r8d
decl %ecx
cmpl $-0x3, %ecx
jne 0x8fc6
movzbl %al, %ecx
xorb $0x3f, %al
testl %esi, %esi
movzbl %al, %eax
cmovnsl %ecx, %eax
retq
movb $-0x1, %al
retq
// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/protein.c
// Function: convertToAA
int convertToAA(char * passSequence, CDS * passCDS, int passTrans, char ** retSequence, unsigned long * retSize) {
	unsigned long nucIdx, aaIdx;
	unsigned long seqLen, seqStart;
	unsigned char currentCodon;

	// Calculate sequence length and loop control from CDS entry
	seqLen = passCDS->endIdx + 1 - passCDS->startIdx - passCDS->phase;
	seqStart = (passCDS->strand == 1) ? passCDS->startIdx : passCDS->endIdx;

	// Reserve memory for amino acid sequence
	*retSize = (seqLen + 2) / 3;
	*retSequence = malloc(*retSize);

	// Iterate through all codons in the nucleotide sequence
	for (nucIdx = 0, aaIdx = 0 ; nucIdx < seqLen ; nucIdx += 3, aaIdx++) {
		// If we've exhausted nucleotides premature to a full frame, assign ambiguous AA and exit
		if (nucIdx + 3 > seqLen) {
			(*retSequence)[aaIdx] = 'X';
			break;
		}

		// Encode codon
		currentCodon = encodeCodon(passSequence + seqStart + (passCDS->strand * nucIdx), passCDS->strand);

		if (currentCodon == 0xFF) {
            // If ambiguous nucleotides are present, assign ambiguous AA
			(*retSequence)[aaIdx] = 'X';
		}
        else {
            // Hash to amino acid IUPAC
            (*retSequence)[aaIdx] = codon_aa_hash[passTrans][currentCodon];
        }
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %rbx
movl %edx, 0xc(%rsp)
movq %rsi, %r14
movq %rdi, %r15
movq (%rsi), %rax
movq 0x8(%rsi), %r13
movswq 0x12(%rsi), %rbp
leaq 0x1(%r13), %r12
movq %rax, 0x10(%rsp)
addq %rax, %rbp
movq %r12, %rax
subq %rbp, %rax
addq $0x2, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rcx
movq %rdx, %rdi
movzwl 0x10(%rsi), %eax
movw %ax, 0xa(%rsp)
shrq %rdi
movq %rdi, (%r8)
leaq 0x1e070(%rip), %rsi     # 0x270d5
leaq 0x1e073(%rip), %rcx     # 0x270df
movl $0x56, %edx
callq 0x22d2b
movq %rax, (%rbx)
subq %rbp, %r12
je 0x9149
cmpw $0x1, 0xa(%rsp)
cmoveq 0x10(%rsp), %r13
addq %r13, %r15
movslq 0xc(%rsp), %rax
xorl %edi, %edi
leaq 0x27aa1(%rip), %rcx     # 0x30b40
shlq $0x6, %rax
addq 0x26f4e(%rip), %rax     # 0x2fff8
xorl %edx, %edx
leaq 0x3(%rdi), %rsi
cmpq %r12, %rsi
ja 0x9142
movswq 0x10(%r14), %r8
imulq %r8, %rdi
addq %r15, %rdi
xorl %r10d, %r10d
xorl %r11d, %r11d
xorl %r9d, %r9d
testw %r8w, %r8w
movl %r11d, %ebp
cmovsl %r10d, %ebp
movslq %ebp, %r13
movsbq (%rdi,%r13), %r13
movb (%rcx,%r13), %bpl
cmpb $0x3, %bpl
ja 0x9114
shlb $0x2, %r9b
orb %bpl, %r9b
incl %r11d
decl %r10d
cmpl $-0x3, %r10d
jne 0x90ce
movzbl %r9b, %r10d
xorb $0x3f, %r9b
testw %r8w, %r8w
movzbl %r9b, %edi
cmovnsl %r10d, %edi
jmp 0x9117
movb $-0x1, %dil
cmpb $-0x1, %dil
je 0x9127
movzbl %dil, %edi
movb (%rdi,%rax), %dil
jmp 0x912a
movb $0x58, %dil
movq (%rbx), %r8
movb %dil, (%r8,%rdx)
incq %rdx
movq %rsi, %rdi
cmpq %r12, %rsi
jb 0x90ac
jmp 0x9149
movq (%rbx), %rax
movb $0x58, (%rax,%rdx)
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/protein.c
// Function: getLastAlignedPos
long getLastAlignedPos(long passLength, int passFrame) {
	long retPos;

	if (passFrame < 3) {
		// Forward frame
		retPos = passLength - (passLength % 3) - 1 + (passFrame % 3);
		if (retPos >= passLength) retPos -= 3;
	}
	else {
		// Reverse frame
		retPos = (passLength % 3) - (passFrame % 3);
		if (retPos < 0) retPos += 3;
	}

	return retPos;
}

// Assembly:
movabsq $0x5555555555555556, %rcx # imm = 0x5555555555555556
movq %rdi, %rax
imulq %rcx
movq %rdx, %rax
shrq $0x3f, %rax
addq %rdx, %rax
leaq (%rax,%rax,2), %rax
movq %rdi, %rcx
subq %rax, %rcx
cmpl $0x2, %esi
jg 0x91b9
notq %rcx
addq %rdi, %rcx
movslq %esi, %rax
imulq $0x55555556, %rax, %rax # imm = 0x55555556
movq %rax, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rax
addl %edx, %eax
leal (%rax,%rax,2), %eax
subl %eax, %esi
movslq %esi, %rax
leaq (%rcx,%rax), %rdx
cmpq %rdi, %rdx
leaq -0x3(%rax,%rcx), %rax
cmovlq %rdx, %rax
retq
movl %esi, %eax
movl $0xaaaaaaab, %edx       # imm = 0xAAAAAAAB
imulq %rax, %rdx
shrq $0x21, %rdx
leal (%rdx,%rdx,2), %eax
subl %eax, %esi
subq %rsi, %rcx
leaq 0x3(%rcx), %rax
testq %rcx, %rcx
cmovnsq %rcx, %rax
retq
// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/protein.c
// Function: getLastAlignedOrfPos
long getLastAlignedOrfPos(long passLength, int passFrame, mem_opt_t * passOptions) {
	long retValue;

	if (passOptions->min_orf_percent) {
		// Minimum ORF length specified as a read length percentage
		retValue = getLastAlignedPos(passOptions->min_orf_percent * passLength, passFrame);
	}
	else {
		// Minimum ORF length specified as constant value, check for adjustment
		if ((passOptions->proteinFlag & ALIGN_FLAG_ADJUST_ORF) && (passLength < passOptions->min_orf_len)) {
			retValue = getLastAlignedPos(passLength, passFrame);
		}
		else {
			retValue = getLastAlignedPos(passOptions->min_orf_len, passFrame);
		}
	}


	return retValue;
}

// Assembly:
movss 0x6c(%rdx), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x91eb
jnp 0x91fe
xorps %xmm1, %xmm1
cvtsi2ss %rdi, %xmm1
mulss %xmm1, %xmm0
cvttss2si %xmm0, %rcx
jmp 0x9274
testb $0x8, 0x4c(%rdx)
je 0x9270
movslq 0x68(%rdx), %rax
cmpq %rdi, %rax
jle 0x9270
movabsq $0x5555555555555556, %rcx # imm = 0x5555555555555556
movq %rdi, %rax
imulq %rcx
movq %rdx, %rax
shrq $0x3f, %rax
addq %rdx, %rax
leaq (%rax,%rax,2), %rax
movq %rdi, %rcx
subq %rax, %rcx
cmpl $0x2, %esi
jg 0x92f6
notq %rcx
addq %rdi, %rcx
movslq %esi, %rax
imulq $0x55555556, %rax, %rax # imm = 0x55555556
movq %rax, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rax
addl %edx, %eax
leal (%rax,%rax,2), %eax
subl %eax, %esi
movslq %esi, %rax
leaq (%rcx,%rax), %rdx
cmpq %rdi, %rdx
leaq -0x3(%rax,%rcx), %rax
cmovlq %rdx, %rax
retq
movslq 0x68(%rdx), %rcx
movabsq $0x5555555555555556, %rdx # imm = 0x5555555555555556
movq %rcx, %rax
imulq %rdx
movq %rdx, %rax
shrq $0x3f, %rax
addq %rdx, %rax
leaq (%rax,%rax,2), %rax
movq %rcx, %rdx
subq %rax, %rdx
cmpl $0x2, %esi
jg 0x92d3
notq %rdx
movslq %esi, %rax
imulq $0x55555556, %rax, %rax # imm = 0x55555556
movq %rax, %rdi
shrq $0x3f, %rdi
shrq $0x20, %rax
addl %edi, %eax
leal (%rax,%rax,2), %eax
subl %eax, %esi
movslq %esi, %rax
addq %rcx, %rax
leaq (%rax,%rdx), %rsi
cmpq %rcx, %rsi
leaq -0x3(%rdx,%rax), %rax
cmovlq %rsi, %rax
retq
movl %esi, %eax
movl $0xaaaaaaab, %ecx       # imm = 0xAAAAAAAB
imulq %rax, %rcx
shrq $0x21, %rcx
leal (%rcx,%rcx,2), %eax
subl %eax, %esi
subq %rsi, %rdx
leaq 0x3(%rdx), %rax
testq %rdx, %rdx
cmovnsq %rdx, %rax
retq
movl %esi, %eax
movl $0xaaaaaaab, %edx       # imm = 0xAAAAAAAB
imulq %rax, %rdx
shrq $0x21, %rdx
leal (%rdx,%rdx,2), %eax
subl %eax, %esi
subq %rsi, %rcx
leaq 0x3(%rcx), %rax
testq %rcx, %rcx
cmovnsq %rcx, %rax
retq
// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/protein.c
// Function: addORFHistory
void addORFHistory(long * passHistory[2][6], long passHistorySize[6], unsigned long passIdx ) {
	int copyIdx;
	long * tempHistory;

	if (passHistorySize[passIdx] == 0) {
		// New array
		passHistory[0][passIdx] = malloc(sizeof(long));
		passHistory[1][passIdx] = malloc(sizeof(long));
	}
	else {
		// If array has existing items, resize, copy, and free old
		for (copyIdx = 0 ; copyIdx < 2 ; copyIdx++) {
			tempHistory = passHistory[copyIdx][passIdx];
			passHistory[copyIdx][passIdx] = malloc((passHistorySize[passIdx] + 1) * sizeof(long));
			memcpy(passHistory[copyIdx][passIdx], tempHistory, passHistorySize[passIdx] * sizeof(long));
			free(tempHistory);
		}
	}

	// Update size
	passHistorySize[passIdx]++;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
cmpq $0x0, (%rsi,%rdx,8)
je 0x9393
leaq (%r15,%rbx,8), %rbp
xorl %r15d, %r15d
leaq 0x1dda9(%rip), %r12     # 0x270eb
movq (%rbp,%r15), %r13
movq (%r14,%rbx,8), %rax
leaq 0x8(,%rax,8), %rdi
leaq 0x1dd7b(%rip), %rsi     # 0x270d5
movl $0xa5, %edx
movq %r12, %rcx
callq 0x22d2b
movq %rax, (%rbp,%r15)
movq (%r14,%rbx,8), %rdx
shlq $0x3, %rdx
movq %rax, %rdi
movq %r13, %rsi
callq 0x3260
movq %r13, %rdi
callq 0x3390
addq $0x30, %r15
cmpq $0x30, %r15
je 0x9342
jmp 0x93d4
leaq 0x1dd3b(%rip), %r12     # 0x270d5
leaq 0x1dd4a(%rip), %r13     # 0x270eb
movl $0x8, %edi
movq %r12, %rsi
movl $0x9e, %edx
movq %r13, %rcx
callq 0x22d2b
movq %rax, (%r15,%rbx,8)
movl $0x8, %edi
movq %r12, %rsi
movl $0x9f, %edx
movq %r13, %rcx
callq 0x22d2b
movq %rax, 0x30(%r15,%rbx,8)
incq (%r14,%rbx,8)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/protein.c
// Function: compileORFHistory
void compileORFHistory(long * passHistory[2][6], long passHistorySize[6], CDS * * retCDS, unsigned long * retCount) {
	unsigned long srcFrameIdx, srcHistoryIdx;
	unsigned long srcStart, srcEnd, totalSize;
	int relStart, validEntry;

	// Allocate potential CDS records per entry in history array
	totalSize = 0;
	for (srcFrameIdx = 0 ; srcFrameIdx < 6 ; srcFrameIdx++) totalSize += passHistorySize[srcFrameIdx];

	*retCDS = calloc(totalSize, sizeof(CDS));
	*retCount = 0;
	relStart = -1;

	// Iterate through each entry in each reading frame
	for (srcFrameIdx = 0 ; srcFrameIdx < 6 ; srcFrameIdx++) {
		for (srcHistoryIdx = 0 ; srcHistoryIdx < passHistorySize[srcFrameIdx] ; srcHistoryIdx++) {
			// Swap start/stop for reverse direction
			if (passHistory[0][srcFrameIdx][srcHistoryIdx] < passHistory[1][srcFrameIdx][srcHistoryIdx]) {
				srcStart = passHistory[0][srcFrameIdx][srcHistoryIdx];
				srcEnd = passHistory[1][srcFrameIdx][srcHistoryIdx];
			}
			else {
				srcStart = passHistory[1][srcFrameIdx][srcHistoryIdx];
				srcEnd = passHistory[0][srcFrameIdx][srcHistoryIdx];
			}

			validEntry = 1;

			// Filter minimum ORF size
			//if (srcLen < passMinORF) continue;

			// Add CDS record if valid (current strategy marks all as valid)
			if (validEntry) {
				if (relStart < 0) relStart = srcFrameIdx;

				(*retCDS)[*retCount].startIdx = srcStart;
				(*retCDS)[*retCount].endIdx = srcEnd;
				(*retCDS)[*retCount].strand = (srcFrameIdx < 3) ? 1 : -1;
				(*retCDS)[*retCount].relFrame = srcFrameIdx - relStart;

				(*retCount)++;
			}
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %r15
xorl %eax, %eax
xorl %edi, %edi
addq (%r14,%rax,8), %rdi
incq %rax
cmpq $0x6, %rax
jne 0x93ff
leaq 0x1dcc2(%rip), %rdx     # 0x270d5
leaq 0x1dcdf(%rip), %r8      # 0x270f9
movl $0x2018, %esi           # imm = 0x2018
movl $0xb9, %ecx
callq 0x22cb4
movq %rax, (%r12)
movq $0x0, (%rbx)
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
xorl %edx, %edx
cmpq $0x0, (%r14,%rdx,8)
je 0x94bb
movq (%r15,%rdx,8), %rsi
movq 0x30(%r15,%rdx,8), %rdi
cmpq $0x3, %rdx
movl $0x0, %r8d
adcl $-0x1, %r8d
orl $0x1, %r8d
xorl %r9d, %r9d
movq (%rsi,%r9,8), %r10
movq (%rdi,%r9,8), %r11
cmpq %r11, %r10
movq %r11, %r12
cmovlq %r10, %r12
cmovgq %r10, %r11
testl %ecx, %ecx
cmovsl %edx, %ecx
imulq $0x2018, (%rbx), %r10   # imm = 0x2018
movq %r12, (%rax,%r10)
imulq $0x2018, (%rbx), %r10   # imm = 0x2018
movq %r11, 0x8(%rax,%r10)
movq (%rbx), %r10
imulq $0x2018, %r10, %r11     # imm = 0x2018
movw %r8w, 0x10(%rax,%r11)
movl %edx, %ebp
subl %ecx, %ebp
movw %bp, 0x14(%rax,%r11)
incq %r10
movq %r10, (%rbx)
incq %r9
cmpq (%r14,%rdx,8), %r9
jb 0x9460
incq %rdx
cmpq $0x6, %rdx
jne 0x943b
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/protein.c
// Function: writeIndexDirectProtein
int writeIndexDirectProtein(const char * passPrefix, const char * passProName, IndexHeader passHeader) {
	FILE * outputPtr;

	outputPtr = err_xopen_core(__func__, passProName, "w");

	// Write index type header
	passHeader.nucleotide = 0;
	writeIndexHeader(outputPtr, passHeader);

	// Close file
	fflush(outputPtr);
	err_fclose(outputPtr);

	return 0;
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
leaq 0x1d345(%rip), %rdi     # 0x2714f
leaq 0x1f61e(%rip), %rdx     # 0x2942f
callq 0xdd8e
movq %rax, %rbx
movl $0x0, 0x30(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x30(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %rbx, %rdi
callq 0x5794
movq %rbx, %rdi
callq 0x3370
movq %rbx, %rdi
callq 0xe490
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/uniprot.c
// Function: prepareUniprotReport
void prepareUniprotReport(int passType, int passPrimary, UniprotList * passLists, CURLBuffer * passBuffer, const char * passProxy) {
	UniprotList * globalLists;

	// Aggregate and sort lists by value
	prepareUniprotLists(passLists, passPrimary);

	// Do not process if no results
	globalLists = getGlobalLists(passPrimary);
	if (globalLists[0].entryCount == 0) return;

	// Report specific preparation
	if (passType == OUTPUT_TYPE_UNIPROT_FULL) {
		// Submit entries to UniProt and retrieve full information
		retrieveUniprotOnline(passLists + UNIPROT_LIST_FULL, passBuffer, passProxy);
		joinOnlineLists(passLists + UNIPROT_LIST_FULL, passBuffer->buffer);
	}

	// Sort aggregated lists by count
	qsort(passLists[UNIPROT_LIST_FULL].entries, passLists[UNIPROT_LIST_FULL].entryCount, sizeof(UniprotEntry), uniprotEntryCompareID);
	qsort(passLists[UNIPROT_LIST_GENES].entries, passLists[UNIPROT_LIST_GENES].entryCount, sizeof(UniprotEntry), uniprotEntryCompareGene);
	qsort(passLists[UNIPROT_LIST_ORGANISM].entries, passLists[UNIPROT_LIST_ORGANISM].entryCount, sizeof(UniprotEntry), uniprotEntryCompareOrganism);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %r8, %r15
movq %rcx, %r14
movq %rdx, %rbx
movl %esi, %r12d
movl %edi, %ebp
movq %rdx, %rdi
callq 0xa41e
testl %r12d, %r12d
leaq 0x26acf(%rip), %rax     # 0x30e60
leaq 0x26ac0(%rip), %rcx     # 0x30e58
cmoveq %rax, %rcx
movq (%rcx), %rax
cmpl $0x0, 0x8(%rax)
je 0xa415
cmpl $0x1, %ebp
jne 0xa3c3
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xa5bc
movq (%r14), %rsi
movq %rbx, %rdi
callq 0xaa0a
movq (%rbx), %rdi
movslq 0x8(%rbx), %rsi
leaq 0x7a8(%rip), %rcx       # 0xab79
movl $0x28, %edx
callq 0x3760
movq 0x10(%rbx), %rdi
movslq 0x18(%rbx), %rsi
leaq 0x7a3(%rip), %rcx       # 0xab8d
movl $0x28, %edx
callq 0x3760
movq 0x20(%rbx), %rdi
movslq 0x28(%rbx), %rsi
leaq 0x7a0(%rip), %rcx       # 0xaba3
movl $0x28, %edx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x3760
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/uniprot.c
// Function: renderUniprotEntries
void renderUniprotEntries(UniprotList * passList, int passType, FILE * passStream) {
	int entryIdx, occurTotal;
	float occurPercent, avgQuality;
    char commonFields[] = "%d\t%.5f\t%.5f\t%d\t%s\n";

	// Count total occurrences for percentages
	for (entryIdx = 0, occurTotal = 0 ; entryIdx < passList->entryCount ; entryIdx++) {
		occurTotal += passList->entries[entryIdx].numOccurrence;
	}

	// Render fields
	for (entryIdx = 0 ; entryIdx < passList->entryCount ; entryIdx++) {
		occurPercent = (float) passList->entries[entryIdx].numOccurrence / (float) occurTotal * 100;
		avgQuality = (float) passList->entries[entryIdx].totalQuality / (float) passList->entries[entryIdx].numOccurrence;

		switch(passType) {
		    case UNIPROT_LIST_FULL:
		    	fprintf(passStream, commonFields, passList->entries[entryIdx].numOccurrence, occurPercent, avgQuality, passList->entries[entryIdx].maxQuality,  passList->entries[entryIdx].id);
		    	break;
		    case UNIPROT_LIST_GENES:
			    fprintf(passStream, commonFields, passList->entries[entryIdx].numOccurrence, occurPercent, avgQuality, passList->entries[entryIdx].maxQuality, passList->entries[entryIdx].gene);
			    break;
		    case UNIPROT_LIST_ORGANISM:
			    fprintf(passStream, commonFields, passList->entries[entryIdx].numOccurrence, occurPercent, avgQuality, passList->entries[entryIdx].maxQuality, passList->entries[entryIdx].organism);
			    break;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
movslq 0x8(%rdi), %rcx
testq %rcx, %rcx
jle 0xad3f
movq (%r14), %rax
shlq $0x3, %rcx
leaq (%rcx,%rcx,4), %rcx
xorl %edx, %edx
xorl %esi, %esi
addl 0x18(%rax,%rdx), %esi
addq $0x28, %rdx
cmpq %rdx, %rcx
jne 0xad2c
cvtsi2ss %esi, %xmm0
jmp 0xad42
xorps %xmm0, %xmm0
movss %xmm0, 0x4(%rsp)
cmpl $0x0, 0x8(%r14)
jle 0xadf4
movl $0x20, %r12d
xorl %r13d, %r13d
leaq 0x1cb7d(%rip), %r15     # 0x278e0
movq (%r14), %rax
movl -0x8(%rax,%r12), %edx
xorps %xmm0, %xmm0
cvtsi2ss %edx, %xmm0
xorps %xmm1, %xmm1
cvtsi2ssl -0x4(%rax,%r12), %xmm1
divss %xmm0, %xmm1
divss 0x4(%rsp), %xmm0
mulss 0x1c4d6(%rip), %xmm0    # 0x27264
cmpl $0x2, %ebp
je 0xadc2
cmpl $0x1, %ebp
je 0xadaf
testl %ebp, %ebp
jne 0xade0
cvtss2sd %xmm0, %xmm0
cvtss2sd %xmm1, %xmm1
movl (%rax,%r12), %ecx
movq -0x20(%rax,%r12), %r8
jmp 0xadd3
cvtss2sd %xmm0, %xmm0
cvtss2sd %xmm1, %xmm1
movl (%rax,%r12), %ecx
movq -0x18(%rax,%r12), %r8
jmp 0xadd3
cvtss2sd %xmm0, %xmm0
cvtss2sd %xmm1, %xmm1
movl (%rax,%r12), %ecx
movq -0x10(%rax,%r12), %r8
movq %rbx, %rdi
movq %r15, %rsi
movb $0x2, %al
callq 0x3500
incq %r13
movslq 0x8(%r14), %rax
addq $0x28, %r12
cmpq %rax, %r13
jl 0xad63
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/uniprot.c
// Function: cleanUniprotLists
void cleanUniprotLists(UniprotList * passLists, int passPrimary) {
	UniprotList * globalLists;
	int listIdx, entryIdx;

	globalLists = getGlobalLists(passPrimary);

	// Global list 0 contains pointers to all allocated strings, so delete from there. Do not repeat with other lists
	for (entryIdx = 0 ; entryIdx < globalLists[0].entryCount ; entryIdx++) {
		free(globalLists[0].entries[entryIdx].id);
		free(globalLists[0].entries[entryIdx].gene);
		free(globalLists[0].entries[entryIdx].organism);
	}

	free(globalLists[0].entries);
	free(globalLists);

	// Free local lists
	for (listIdx = 0 ; listIdx < 3 ; listIdx++) {
		free(passLists[listIdx].entries);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testl %esi, %esi
leaq 0x26044(%rip), %rax     # 0x30e60
leaq 0x26035(%rip), %rcx     # 0x30e58
cmoveq %rax, %rcx
movq %rdi, %rbx
movq (%rcx), %r14
cmpl $0x0, 0x8(%r14)
jle 0xae70
xorl %r15d, %r15d
xorl %r12d, %r12d
movq (%r14), %rax
movq (%rax,%r15), %rdi
callq 0x3390
movq (%r14), %rax
movq 0x8(%rax,%r15), %rdi
callq 0x3390
movq (%r14), %rax
movq 0x10(%rax,%r15), %rdi
callq 0x3390
incq %r12
movslq 0x8(%r14), %rax
addq $0x28, %r15
cmpq %rax, %r12
jl 0xae3a
movq (%r14), %rdi
callq 0x3390
movq %r14, %rdi
callq 0x3390
xorl %r14d, %r14d
movq (%rbx,%r14), %rdi
callq 0x3390
addq $0x10, %r14
cmpq $0x30, %r14
jne 0xae83
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/uniprot.c
// Function: cleanUniprotReference
int cleanUniprotReference(int passReference, const char * passBase) {
	char * tempName;
	int indexed;
	IndexHeader newHeader;
	FILE * proHandle;

	logMessage(__func__, LOG_LEVEL_MESSAGE, "Cleaning UniProt reference...\n");

	// Check if reference has already been indexed
	tempName = malloc(strlen(passBase) + 5);
	sprintf(tempName, "%s.ann", passBase);
	indexed = (access(tempName, F_OK) != -1);

	// Begin reference-specific preparation
	switch (passReference) {
	case UNIPROT_REFERENCE_UNIREF90:
		cleanUniprotReferenceUniref(passBase, 0);
		if (indexed) cleanUniprotReferenceUniref(tempName, 1);
	}

	// If indexed, also fix protein header
	if (indexed) {
		sprintf(tempName, "%s.pro", passBase);
		proHandle = err_xopen_core(__func__, tempName, "w");

		newHeader.multiFrame = 1;
		newHeader.nucleotide = 0;
		newHeader.referenceType = passReference;
		writeIndexHeader(proHandle, newHeader);

		fclose(proHandle);
	}

	free(tempName);

	return indexed;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r15
movl %edi, %ebx
leaq 0x1c5a6(%rip), %rdi     # 0x2745e
leaq 0x1c5b5(%rip), %rdx     # 0x27474
movl $0x3, %esi
xorl %eax, %eax
callq 0xdbeb
movq %r15, %rdi
callq 0x3100
leaq 0x5(%rax), %rdi
callq 0x3470
movq %rax, %r14
leaq 0x1c5ad(%rip), %rsi     # 0x27493
movq %rax, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x3070
movq %r14, %rdi
xorl %esi, %esi
callq 0x3630
movl %eax, %ebp
cmpl $0x2, %ebx
jne 0xaf20
movq %r15, %rdi
xorl %esi, %esi
callq 0xafa5
cmpl $-0x1, %ebp
je 0xaf88
movq %r14, %rdi
movl $0x1, %esi
callq 0xafa5
cmpl $-0x1, %ebp
je 0xaf88
leaq 0x1a4cf(%rip), %rsi     # 0x253fb
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x3070
leaq 0x1c51e(%rip), %rdi     # 0x2745e
leaq 0x1e4e8(%rip), %rdx     # 0x2942f
movq %r14, %rsi
callq 0xdd8e
movq %rax, %r15
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, 0x20(%rsp)
movl %ebx, 0x28(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r15, %rdi
callq 0x5794
movq %r15, %rdi
callq 0x32f0
xorl %ebx, %ebx
cmpl $-0x1, %ebp
setne %bl
movq %r14, %rdi
callq 0x3390
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/uniprot.c
// Function: downloadUniprotReference
const char * downloadUniprotReference(int passReference, const char * passProxy) {
	CURL * curlHandle;
	CURLcode curlResult;
	FILE * fileHandle;
	const char * retFile;

	curlHandle = curl_easy_init();
	fileHandle = err_xopen_core(__func__, downloadNames[passReference], "w");
	retFile = downloadNames[passReference];

	curl_easy_setopt(curlHandle, CURLOPT_URL, downloadURLs[passReference]);
	curl_easy_setopt(curlHandle, CURLOPT_WRITEDATA, fileHandle);
    if (passProxy) curl_easy_setopt(curlHandle, CURLOPT_PROXY, passProxy);

	logMessage(__func__, LOG_LEVEL_MESSAGE, "Downloading %s...\n", downloadURLs[passReference]);
	curlResult = curl_easy_perform(curlHandle);

	if (curlResult != CURLE_OK) {
		logMessage(__func__, LOG_LEVEL_ERROR, "%s\n", curl_easy_strerror(curlResult));
		unlink(downloadNames[passReference]);
		retFile = "";
	}

	curl_easy_cleanup(curlHandle);
	fclose(fileHandle);

	return retFile;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r12
movl %edi, %ebp
callq 0x3440
movq %rax, %rbx
movslq %ebp, %r13
leaq 0x25910(%rip), %r15     # 0x30b00
movq (%r15,%r13,8), %rsi
leaq 0x1c2da(%rip), %rdi     # 0x274d5
leaq 0x1e22d(%rip), %rdx     # 0x2942f
callq 0xdd8e
movq %rax, %r14
movq (%r15,%r13,8), %r15
leaq 0x2590b(%rip), %rbp     # 0x30b20
movq (%rbp,%r13,8), %rdx
movq %rbx, %rdi
movl $0x2712, %esi           # imm = 0x2712
xorl %eax, %eax
callq 0x3350
movq %rbx, %rdi
movl $0x2711, %esi           # imm = 0x2711
movq %r14, %rdx
xorl %eax, %eax
callq 0x3350
testq %r12, %r12
je 0xb252
movq %rbx, %rdi
movl $0x2714, %esi           # imm = 0x2714
movq %r12, %rdx
xorl %eax, %eax
callq 0x3350
movq (%rbp,%r13,8), %rcx
leaq 0x1c277(%rip), %rdi     # 0x274d5
leaq 0x1c289(%rip), %rdx     # 0x274ee
movl $0x3, %esi
xorl %eax, %eax
callq 0xdbeb
movq %rbx, %rdi
callq 0x3460
testl %eax, %eax
je 0xb2b8
movl %eax, %edi
callq 0x3520
leaq 0x1c24a(%rip), %rdi     # 0x274d5
leaq 0x1bd24(%rip), %rdx     # 0x26fb6
movl $0x1, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0xdbeb
leaq 0x25858(%rip), %rax     # 0x30b00
movq (%rax,%r13,8), %rdi
callq 0x3110
leaq 0x1d376(%rip), %r15     # 0x2862e
movq %rbx, %rdi
callq 0x33f0
movq %r14, %rdi
callq 0x32f0
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/uniprot.c
// Function: initCURLBuffer
void initCURLBuffer(CURLBuffer * passBuffer, int passCapacity) {
	passBuffer->buffer = calloc(1, passCapacity);
	passBuffer->capacity = passCapacity;
	passBuffer->size = 0;
	passBuffer->buffer[0] = 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movslq %esi, %r14
movl $0x1, %edi
movq %r14, %rsi
callq 0x31b0
movq %rax, (%rbx)
movl %r14d, 0xc(%rbx)
movl $0x0, 0x8(%rbx)
movb $0x0, (%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/uniprot.c
// Function: receiveUniprotOutput
size_t receiveUniprotOutput(void * passString, size_t passSize, size_t passNum, void * retStream) {
	CURLBuffer * currentBuffer;

	currentBuffer = (CURLBuffer *) retStream;

	// Grow receive buffer if addition is greater than capacity
	if (currentBuffer->size + (int)(passSize * passNum) >= currentBuffer->capacity) {
		currentBuffer->buffer = realloc(currentBuffer->buffer, currentBuffer->capacity + UNIPROT_BUFFER_GROW);
		currentBuffer->capacity += UNIPROT_BUFFER_GROW;
	}

	// Concatenate results
	memcpy(currentBuffer->buffer + currentBuffer->size, passString, (int) (passSize * passNum));
	currentBuffer->size += (int) (passSize * passNum);
	currentBuffer->buffer[currentBuffer->size] = 0;

	return (size_t)(passSize * passNum);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rcx, %r14
movq %rsi, %rbx
movq %rdi, %r15
imulq %rdx, %rbx
movl 0x8(%rcx), %eax
addl %ebx, %eax
movslq 0xc(%rcx), %rsi
cmpl %esi, %eax
jl 0xb343
movq (%r14), %rdi
addq $0x2faf080, %rsi        # imm = 0x2FAF080
callq 0x3610
movq %rax, (%r14)
addl $0x2faf080, 0xc(%r14)   # imm = 0x2FAF080
movslq 0x8(%r14), %rdi
addq (%r14), %rdi
movslq %ebx, %rdx
movq %r15, %rsi
callq 0x3260
movslq 0x8(%r14), %rax
movslq %ebx, %rcx
addq %rax, %rcx
movl %ecx, 0x8(%r14)
movq (%r14), %rax
movb $0x0, (%rax,%rcx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq