LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/IncludeScanner.cpp
// Function: t2::ScanIncludesCpp(char*, t2::MemAllocLinear*)
IncludeData*
ScanIncludesCpp(char* buffer, MemAllocLinear* allocator)
{
  IncludeDataList list;

  char *linep = buffer;

  while (linep)
  {
    char *line = linep;
    linep = GetNextLine(linep);

    if (IncludeData* d = ScanCppLine(line, allocator))
    {
      list.Add(d);
    }
  }

  return list.m_Head;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, 0x8(%rsp)
movq %rdi, %r13
xorl %ecx, %ecx
xorl %esi, %esi
movq %rcx, %rax
testq %r13, %r13
je 0x12169
movq %rax, (%rsp)
movq %rsi, 0x10(%rsp)
movq %r13, %rdi
callq 0x12178
movq %rax, %r12
leaq -0x1(%r13), %r14
leaq 0x8(%r13), %rcx
addq $0xa, %r13
movq %rcx, %rbp
movq %r13, %rbx
movb 0x1(%r14), %r15b
incq %r14
movsbl %r15b, %edi
callq 0x3070
leaq 0x1(%rbp), %rcx
incq %r13
testl %eax, %eax
jne 0x12012
movq (%rsp), %rcx
movq 0x10(%rsp), %r14
movq %r14, %rsi
movq %r12, %r13
cmpb $0x23, %r15b
jne 0x11fe6
movsbl -0x7(%rbp), %edi
callq 0x3070
incq %rbp
incq %rbx
testl %eax, %eax
jne 0x12048
leaq -0x8(%rbp), %rsi
leaq 0x333d(%rip), %rdi      # 0x153a3
pushq $0x7
popq %rdx
callq 0x3170
movq (%rsp), %rcx
movq %r14, %rsi
movq %r12, %r13
testl %eax, %eax
jne 0x11fe6
movsbl -0x1(%rbp), %edi
callq 0x3070
movq (%rsp), %rcx
movq %r14, %rsi
movq %r12, %r13
testl %eax, %eax
je 0x11fe6
movsbl (%rbp), %edi
callq 0x3070
incq %rbp
testl %eax, %eax
jne 0x1209b
movq 0x8(%rsp), %rdi
callq 0x1245a
movq %rax, %rbx
movzbl -0x1(%rbp), %eax
cmpl $0x3c, %eax
je 0x120df
movq (%rsp), %r9
movq %r9, %rcx
movq %r14, %rsi
movq %r12, %r13
cmpl $0x22, %eax
jne 0x11fe6
xorl %r15d, %r15d
pushq $0x22
popq %rax
jmp 0x120e9
movb $0x1, %r15b
pushq $0x3e
popq %rax
movq (%rsp), %r9
pushq $-0x1
popq %rdx
movq %rbp, %rcx
pushq $0x9
popq %r8
movsbl (%rcx), %esi
incq %rcx
xorl %edi, %edi
testl %esi, %esi
sete %dil
cmpl %esi, %eax
cmovel %r8d, %edi
incq %rdx
testl %edi, %edi
je 0x120f3
movq %r9, %rcx
movq %r14, %rsi
movq %r12, %r13
cmpl $0x9, %edi
jne 0x11fe6
movq %rdx, 0x8(%rbx)
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0xc84b
movq (%rsp), %rdx
movq %rax, (%rbx)
movb %r15b, 0x10(%rbx)
movb $0x1, 0x11(%rbx)
andq $0x0, 0x18(%rbx)
movq %rbx, %rcx
movq %rbx, %rsi
movq %r12, %r13
testq %rdx, %rdx
je 0x11fe6
movq %rbx, 0x18(%r14)
movq %rdx, %rcx
movq %rbx, %rsi
movq %r12, %r13
jmp 0x11fe6
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/TerminalIo.cpp
// Function: t2::TerminalIoInit()
void TerminalIoInit(void)
{
	int i;
	for (i = 0; i < kLineBufCount; ++i)
	{
		s_FreeLinebufs[i] = &s_Linebufs[i];
		s_Linebufs[i].m_Data = &s_BufferData[i][0];
		s_Linebufs[i].m_Data = &s_BufferData[i][0];
	}
	s_FreeLinebufCount = kLineBufCount;
	s_QueuedLinebufCount = 0;


  MutexInit(&s_LineLock);
  CondInit(&s_CanPrint);
}

// Assembly:
pushq %rax
leaq 0xba70(%rip), %rax      # 0x1dee0
leaq 0xb269(%rip), %rcx      # 0x1d6e0
xorl %edx, %edx
leaq 0xb860(%rip), %rsi      # 0x1dce0
cmpq $0x200, %rdx            # imm = 0x200
je 0x124a1
movq %rcx, (%rdx,%rsi)
movq %rax, 0x10(%rcx)
addq $0x8, %rdx
addq $0x2000, %rax           # imm = 0x2000
addq $0x18, %rcx
jmp 0x12480
movl $0x40, 0x8ba35(%rip)    # 0x9dee0
andl $0x0, 0x8ba32(%rip)     # 0x9dee4
leaq 0x8ba2f(%rip), %rdi     # 0x9dee8
callq 0x5404
leaq 0x8ba4b(%rip), %rdi     # 0x9df10
popq %rax
jmp 0x5420
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/TerminalIo.cpp
// Function: t2::TerminalIoJobExit(int)
void TerminalIoJobExit(int job_id)
{
	/* Find any queued buffers for this job and flush them. */
	MutexLock(&s_LineLock);

	TTY_PRINTF(("exit job %d\n", job_id));

	if (job_id != s_PrintingJobIndex) {
		/* Wait until we can grab the TTY */
		while (-1 != s_PrintingJobIndex) {
			CondWait(&s_CanPrint, &s_LineLock);
		}
	}

	s_PrintingJobIndex = job_id;

	FlushOutputQueue(job_id);

	s_PrintingJobIndex = -1;

	MutexUnlock(&s_LineLock);

	CondBroadcast(&s_CanPrint);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edi, %ebx
leaq 0x8b707(%rip), %rdi     # 0x9dee8
callq 0x549a
movl 0xab8c(%rip), %eax      # 0x1d378
cmpl %ebx, %eax
sete %cl
cmpl $-0x1, %eax
sete %al
orb %cl, %al
jne 0x1281d
leaq 0x8b70e(%rip), %r14     # 0x9df10
leaq 0x8b6df(%rip), %r15     # 0x9dee8
movq %r14, %rdi
movq %r15, %rsi
callq 0x5549
cmpl $-0x1, 0xab5d(%rip)     # 0x1d378
jne 0x12809
movl %ebx, 0xab55(%rip)      # 0x1d378
movl %ebx, %edi
callq 0x126b3
orl $-0x1, 0xab47(%rip)     # 0x1d378
leaq 0x8b6b0(%rip), %rdi     # 0x9dee8
callq 0x54b4
leaq 0x8b6cc(%rip), %rdi     # 0x9df10
popq %rbx
popq %r14
popq %r15
jmp 0x54ce
// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/TerminalIo.cpp
// Function: t2::TerminalIoPrintf(int, int, char const*, ...)
void TerminalIoPrintf(int job_id, int sort_key, const char *format, ...)
{
	char buffer[16384];
	va_list a;
	va_start(a, format);
	vsnprintf(buffer, sizeof(buffer), format, a);
	buffer[sizeof(buffer)-1] = '\0';
	TerminalIoEmit(job_id, 0, sort_key, buffer, (int) strlen(buffer));
	va_end(a);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x40d0, %rsp           # imm = 0x40D0
movl %esi, %ebx
movl %edi, %ebp
leaq 0x20(%rsp), %rsi
movq %rcx, 0x18(%rsi)
movq %r8, 0x20(%rsi)
movq %r9, 0x28(%rsi)
testb %al, %al
je 0x128a9
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rsp, %rcx
movq %rsi, 0x10(%rcx)
leaq 0x40f0(%rsp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000018, %rax     # imm = 0x3000000018
movq %rax, (%rcx)
leaq 0xd0(%rsp), %r14
movl $0x4000, %esi           # imm = 0x4000
movq %r14, %rdi
callq 0x3200
movb $0x0, 0x3fff(%r14)
movq %r14, %rdi
callq 0x3150
movl %ebp, %edi
xorl %esi, %esi
movl %ebx, %edx
movq %r14, %rcx
movl %eax, %r8d
callq 0x124e5
addq $0x40d0, %rsp           # imm = 0x40D0
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/ToniWestbrook[P]paladin/is.c
// Function: is_sa
int64_t is_sa(const ubyte_t *T, int64_t *SA, int64_t n)
{
	if ((T == NULL) || (SA == NULL) || (n < 0)) return -1;
	SA[0] = n;
	if (n <= 1) {
		if (n == 1) SA[1] = 0;
		return 0;
	}
	return sais_main(T, SA+1, 0, n, 256, 1);
}

// Assembly:
movq %rdx, %rcx
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %dl
orb %al, %dl
testq %rcx, %rcx
sets %al
orb %dl, %al
je 0x38cb
pushq $-0x1
popq %rax
retq
movq %rcx, (%rsi)
cmpq $0x1, %rcx
ja 0x38de
jne 0x38db
andq $0x0, 0x8(%rsi)
xorl %eax, %eax
retq
addq $0x8, %rsi
pushq $0x1
popq %r9
movl $0x100, %r8d            # imm = 0x100
xorl %edx, %edx
jmp 0x38f0
// File: /workspace/github_c_makefile_star2_O2/ToniWestbrook[P]paladin/is.c
// Function: is_bwt
int64_t is_bwt(ubyte_t *T, int64_t n)
{
	int64_t *SA, i, primary = 0;
	SA = (int64_t *)calloc(n+1, sizeof(int64_t));

	if (is_sa(T, SA, n)) return -1;

	for (i = 0; i <= n; ++i) {
		if (SA[i] == 0) primary = i;
		else SA[i] = T[SA[i] - 1];
	}
	for (i = 0; i < primary; ++i) T[i] = SA[i];
	for (; i < n; ++i) T[i] = SA[i + 1];
	free(SA);
	return primary;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x1(%rsi), %rdi
leaq 0x1c15b(%rip), %rdx     # 0x20004
leaq 0x1c159(%rip), %r8      # 0x20009
pushq $0x8
popq %rsi
movl $0xd4, %ecx
callq 0x1dfd0
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x38ac
testq %rax, %rax
je 0x3ed9
pushq $-0x1
popq %r12
jmp 0x3f3d
xorl %eax, %eax
xorl %r12d, %r12d
cmpq %rbx, %rax
jg 0x3f04
movq (%r15,%rax,8), %rdx
movq %rax, %rcx
testq %rdx, %rdx
je 0x3efc
movzbl -0x1(%r14,%rdx), %ecx
movq %rcx, (%r15,%rax,8)
movq %r12, %rcx
incq %rax
movq %rcx, %r12
jmp 0x3ede
xorl %ecx, %ecx
testq %r12, %r12
movl $0x0, %eax
cmovgq %r12, %rax
cmpq %rcx, %rax
je 0x3f30
movb (%r15,%rcx,8), %dl
movb %dl, (%r14,%rcx)
incq %rcx
jmp 0x3f12
movb 0x8(%r15,%rax,8), %cl
movb %cl, (%r14,%rax)
incq %rax
cmpq %rbx, %rax
jl 0x3f24
movq %r15, %rdi
callq 0x3390
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/ToniWestbrook[P]paladin/is.c
// Function: getBuckets
static void getBuckets(const int64_t *C, int64_t *B, int64_t k, int64_t end)
{
	int64_t i, sum = 0;
	if (end) {
		for (i = 0; i < k; ++i) {
			sum += C[i];
			B[i] = sum;
		}
	} else {
		for (i = 0; i < k; ++i) {
			sum += C[i];
			B[i] = sum - C[i];
		}
	}
}

// Assembly:
xorl %eax, %eax
testq %rdx, %rdx
cmovgq %rdx, %rax
testq %rcx, %rcx
je 0x3fb0
xorl %ecx, %ecx
xorl %edx, %edx
cmpq %rcx, %rax
je 0x3fcc
addq (%rdi,%rcx,8), %rdx
movq %rdx, (%rsi,%rcx,8)
incq %rcx
jmp 0x3f9e
xorl %ecx, %ecx
xorl %edx, %edx
cmpq %rcx, %rax
je 0x3fcc
movq (%rdi,%rcx,8), %r8
addq %rdx, %r8
movq %rdx, (%rsi,%rcx,8)
incq %rcx
movq %r8, %rdx
jmp 0x3fb4
retq
// File: /workspace/github_c_makefile_star2_O2/ToniWestbrook[P]paladin/bwtindex.c
// Function: writeIndexHeader
void writeIndexHeader(FILE * passFilePtr, IndexHeader passHeader) {
	fprintf(passFilePtr, ">VER=%s:NT=%d:MF=%d:RT=%d\n", PACKAGE_VERSION,
														passHeader.nucleotide,
														passHeader.multiFrame,
														passHeader.referenceType);
}

// Assembly:
movl 0x8(%rsp), %ecx
movl 0xc(%rsp), %r8d
movl 0x10(%rsp), %r9d
leaq 0x1be3b(%rip), %rsi     # 0x20030
leaq 0x1be4f(%rip), %rdx     # 0x2004b
xorl %eax, %eax
jmp 0x3500
// File: /workspace/github_c_makefile_star2_O2/ToniWestbrook[P]paladin/bwtindex.c
// Function: getIndexHeader
IndexHeader getIndexHeader(char * passFile) {
	FILE * filePtr;
	IndexHeader retHeader;

	// Open file and read header information
	filePtr = fopen(passFile, "r");

    if (filePtr == NULL) {
    	logMessage(__func__, LOG_LEVEL_ERROR, "Failed to open file '%s' : %s\n", passFile, errno ? strerror(errno) : "Out of memory");
    	exit(EXIT_FAILURE);
    }

	if (fscanf(filePtr, ">VER=%d.%d.%d:NT=%d:MF=%d:RT=%d", &(retHeader.version[0]),
														   &(retHeader.version[1]),
														   &(retHeader.version[2]),
														   &(retHeader.nucleotide),
														   &(retHeader.multiFrame),
														   &(retHeader.referenceType)) != 6) {
		logMessage(__func__, LOG_LEVEL_ERROR, "Failed to parse file '%s'\n", passFile);
    	exit(EXIT_FAILURE);
	}
	fclose(filePtr);

	return retHeader;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x1dc07(%rip), %rsi     # 0x21e1e
movq %rbx, %rdi
callq 0x3380
testq %rax, %rax
je 0x4270
movq %rax, %r15
leaq 0xc(%r14), %rdx
leaq 0x10(%r14), %rcx
leaq 0x14(%r14), %r8
leaq 0x4(%r14), %r10
leaq 0x8(%r14), %r11
leaq 0x1be4b(%rip), %rsi     # 0x2008d
movq %rax, %rdi
movq %r14, %r9
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x3720
popq %rcx
popq %rdx
cmpl $0x6, %eax
jne 0x4284
movq %r15, %rdi
callq 0x32f0
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x3050
movl (%rax), %edi
testl %edi, %edi
jne 0x42a3
leaq 0x1bdfd(%rip), %r8      # 0x2007f
jmp 0x42ab
leaq 0x1bdc6(%rip), %rdi     # 0x20051
leaq 0x1be1b(%rip), %rdx     # 0x200ad
pushq $0x1
popq %rbp
movl %ebp, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0xc78e
jmp 0x42c8
callq 0x30c0
movq %rax, %r8
leaq 0x1bd9f(%rip), %rdi     # 0x20051
leaq 0x1bda7(%rip), %rdx     # 0x20060
pushq $0x1
popq %rbp
movl %ebp, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0xc78e
movl %ebp, %edi
callq 0x33c0
// File: /workspace/github_c_makefile_star2_O2/ToniWestbrook[P]paladin/bwtindex.c
// Function: getIndexCompatible
int getIndexCompatible(IndexHeader passHeader) {
	// Check if index newer than current version
	while (1) {
		if (passHeader.version[0] < PACKAGE_VERSION_MAJOR) break;
		if (passHeader.version[0] > PACKAGE_VERSION_MAJOR) return INDEX_COMPATBILITY_FUTURE;
		if (passHeader.version[1] < PACKAGE_VERSION_MINOR) break;
		if (passHeader.version[1] > PACKAGE_VERSION_MINOR) return INDEX_COMPATBILITY_FUTURE;
		if (passHeader.version[2] < PACKAGE_VERSION_REV) break;
		if (passHeader.version[2] > PACKAGE_VERSION_REV) return INDEX_COMPATBILITY_FUTURE;
		break;
	}

	// Check if reference new enough to be supported (1.1.0 for current version)
	while (1) {
		if (passHeader.version[0] < 1) return INDEX_COMPATIBILITY_NONE;
		if (passHeader.version[0] > 1) break;
		if (passHeader.version[1] < 1) return INDEX_COMPATIBILITY_NONE;
		if (passHeader.version[1] > 1) break;
		if (passHeader.version[2] < 0) return INDEX_COMPATIBILITY_NONE;
		if (passHeader.version[2] > 0) break;
		break;
	}

	return INDEX_COMPATIBLITY_FULL;
}

// Assembly:
movl 0x14(%rsp), %ecx
xorl %eax, %eax
testl %ecx, %ecx
jle 0x42f7
pushq $0x2
popq %rax
cmpl $0x1, %ecx
jne 0x42f7
leaq 0x8(%rsp), %rcx
movl 0x10(%rcx), %edx
cmpl $0x6, %edx
jge 0x42f8
movl $0x0, %eax
testl %edx, %edx
jg 0x4300
retq
jne 0x42f7
cmpl $0x0, 0x14(%rcx)
jg 0x42f7
cmpl $0x1, %edx
setne %al
cmpl $0x0, 0x14(%rcx)
setns %cl
orb %al, %cl
movzbl %cl, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/ToniWestbrook[P]paladin/bwtindex.c
// Function: bwa_seq_len
int64_t bwa_seq_len(const char *fn_pac) {
	FILE *fp;
	int64_t pac_len;
	ubyte_t c;

	fp = xopen(fn_pac, "rb");
	err_fseek(fp, -1, SEEK_END);
	pac_len = err_ftell(fp);
	err_fread_noeof(&c, 1, 1, fp);
	err_fclose(fp);
	return pac_len - 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rsi
leaq 0x1bd72(%rip), %rdi     # 0x200c8
leaq 0x1f6cb(%rip), %rdx     # 0x23a28
callq 0xc931
movq %rax, %rbx
pushq $-0x1
popq %rsi
pushq $0x2
popq %rdx
movq %rax, %rdi
callq 0xcd4e
movq %rbx, %rdi
callq 0xcd77
movq %rax, %r14
leaq 0x7(%rsp), %rdi
pushq $0x1
popq %rdx
movq %rdx, %rsi
movq %rbx, %rcx
callq 0xccb2
movq %rbx, %rdi
callq 0xd01b
decq %r14
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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, %r14
movl %edi, %ebp
leaq 0x1c1fe(%rip), %rdx     # 0x2075c
callq 0x3090
pushq $0x1
popq %rbx
testl %eax, %eax
jns 0x45a1
movq 0x27a67(%rip), %r15     # 0x2bfd8
movslq (%r15), %rax
leal 0x2(%rax), %ecx
cmpl %ebp, %ecx
jg 0x45ae
movq (%r14,%rax,8), %rdi
callq 0x43a7
movq %rax, %rbx
movslq (%r15), %rax
movq 0x8(%r14,%rax,8), %rdi
movq %rbx, %rsi
callq 0xe53f
movq %rbx, %rdi
callq 0xe901
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x27a1b(%rip), %rax     # 0x2bfd0
movq (%rax), %rcx
leaq 0x1bb2c(%rip), %rdi     # 0x200eb
pushq $0x2a
popq %rsi
pushq $0x1
popq %rdx
callq 0x3790
jmp 0x45a1
// File: /workspace/github_c_makefile_star2_O2/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, %r14
xorl %r12d, %r12d
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
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 0x1bab0(%rip), %rdx     # 0x200d4
leaq 0x1baeb(%rip), %r8      # 0x20116
pushq $0x4
popq %rsi
movl $0xc2, %ecx
callq 0x1dfd0
movq %rax, %r15
xorl %r13d, %r13d
xorl %ebp, %ebp
cmpq 0x110(%rbx), %rbp
jae 0x469f
testb $0x7f, %bpl
jne 0x4664
leaq (%r15,%r13,4), %rdi
movl $0x100, %edx            # imm = 0x100
movq %r14, %rsi
callq 0x3260
addq $0x40, %r13
movq 0x120(%rbx), %rax
testb $0x3, %bpl
jne 0x467b
movl (%rax,%rbp), %ecx
movl %ecx, (%r15,%r13,4)
incq %r13
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
jmp 0x4640
leaq (%r15,%r13,4), %rdi
movq %rsp, %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x3260
addq $0x40, %r13
cmpq 0x118(%rbx), %r13
jne 0x46e2
movq 0x120(%rbx), %rdi
callq 0x3390
movq %r15, 0x120(%rbx)
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1ba2d(%rip), %rdi     # 0x20116
leaq 0x1ba39(%rip), %rsi     # 0x20129
callq 0xcc60
// File: /workspace/github_c_makefile_star2_O2/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 0x4733
movq %rsi, %rbx
movq 0x8(%rsi), %rdi
callq 0xe802
movq %rax, %r14
movq %rax, %rdi
callq 0x45cc
movq 0x8(%rbx), %rdi
movq %r14, %rsi
callq 0xe53f
movq %r14, %rdi
callq 0xe901
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x27896(%rip), %rax     # 0x2bfd0
movq (%rax), %rcx
leaq 0x1b9fb(%rip), %rdi     # 0x2013f
pushq $0x23
popq %rsi
pushq $0x1
popq %rdx
callq 0x3790
pushq $0x1
popq %rax
jmp 0x472b
// File: /workspace/github_c_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movl %edi, %r15d
pushq $0x20
popq %rbp
leaq 0x1f715(%rip), %r12     # 0x23e84
pushq $0x1
popq %rbx
movq 0x2783f(%rip), %r13     # 0x2bfb8
movl %r15d, %edi
movq %r14, %rsi
movq %r12, %rdx
callq 0x3090
testl %eax, %eax
js 0x479d
cmpl $0x69, %eax
jne 0x47e1
movq (%r13), %rdi
callq 0x35b0
movl %eax, %ebp
jmp 0x4779
movq 0x27834(%rip), %r12     # 0x2bfd8
movslq (%r12), %rax
leal 0x2(%rax), %ecx
cmpl %r15d, %ecx
jg 0x47f2
movq (%r14,%rax,8), %rdi
callq 0xe802
movq %rax, %rbx
movq %rax, %rdi
movl %ebp, %esi
callq 0xd65b
movslq (%r12), %rax
movq 0x8(%r14,%rax,8), %rdi
movq %rbx, %rsi
callq 0xe5b5
movq %rbx, %rdi
callq 0xe901
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x277d7(%rip), %rax     # 0x2bfd0
movq (%rax), %rdi
leaq 0x1b960(%rip), %rsi     # 0x20163
movl %ebp, %edx
xorl %eax, %eax
callq 0x3500
jmp 0x47e1
// File: /workspace/github_c_makefile_star2_O2/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 0x5c5a
movl 0x8(%rbx), %edi
leaq 0xc(%rsp), %rsi
pushq $0x1
popq %rdx
callq 0x3240
movl 0x8(%rbx), %edi
cmpl %edi, %eax
je 0x5c5a
pushq $0xf
popq %rsi
callq 0x34f0
movq %rbx, %rdi
callq 0x3390
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
subq $0x58, %rsp
andq $0x0, 0x18(%rsp)
leaq 0x8(%rsp), %rcx
andq $0x0, (%rcx)
pushq $0x1
popq %rax
movl %eax, 0x14(%rsp)
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 0x5d1d
movq 0x8(%rsp), %rax
movl 0x4(%rax), %edi
movl 0x8(%rax), %esi
movl 0xc(%rax), %edx
callq 0x30b0
cmpl $-0x1, %eax
je 0x5d26
movl %eax, %ebx
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
leaq 0x14(%rsp), %rcx
pushq $0x4
popq %r8
movl %eax, %edi
callq 0x36d0
leaq 0x1aa17(%rip), %r14     # 0x206f4
cmpl $-0x1, %eax
je 0x5d2d
pushq $0x1
popq %rsi
pushq $0xd
popq %rdx
leaq 0x18(%rsp), %rcx
pushq $0x8
popq %r8
movl %ebx, %edi
callq 0x36d0
cmpl $-0x1, %eax
je 0x5d2d
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rsi
movl 0x10(%rax), %edx
movl %ebx, %edi
callq 0x3270
testl %eax, %eax
je 0x5d38
leaq 0x1a9e4(%rip), %r14     # 0x206ff
jmp 0x5d2d
leaq 0x1a9bd(%rip), %r14     # 0x206e1
jmp 0x5d2d
leaq 0x1a9c0(%rip), %r14     # 0x206ed
movq %r14, %rdi
callq 0x3280
pushq $-0x1
popq %rbx
movq 0x8(%rsp), %rdi
callq 0x3450
movl %ebx, %eax
addq $0x58, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movl %edi, %ebp
pushq $-0x1
popq %rbx
movl %ebp, %edi
movq %r15, %rsi
movq %r14, %rdx
callq 0x30e0
testq %rax, %rax
js 0x5d75
subq %rax, %r14
jmp 0x5d86
callq 0x3050
movl (%rax), %eax
cmpl $0xb, %eax
je 0x5d86
cmpl $0x4, %eax
jne 0x5d8d
testq %r14, %r14
jne 0x5d5e
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x1
popq %rsi
callq 0x5f34
testl %eax, %eax
jle 0x5ea0
xorl %ecx, %ecx
leaq 0xf(%rsp), %r14
pushq $0x1
popq %r15
leaq 0x1a99a(%rip), %r13     # 0x2076a
movl %ecx, %ebp
movl 0x4(%rbx), %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x3510
testq %rax, %rax
je 0x5e96
movl (%rbx), %ecx
movq 0x8(%rbx), %rax
cmpl %ecx, %ebp
jl 0x5e20
leal (%rcx,%rcx), %edx
testl %ecx, %ecx
movl $0x100, %ecx            # imm = 0x100
cmovel %ecx, %edx
movl %edx, (%rbx)
movslq %edx, %rsi
movq %rax, %rdi
leaq 0x1a87c(%rip), %rdx     # 0x2068b
movl $0x9d, %ecx
movq %r13, %r8
callq 0x1e0b4
movq %rax, 0x8(%rbx)
movb 0xf(%rsp), %dl
leal 0x1(%rbp), %r12d
movslq %ebp, %rcx
movb %dl, (%rax,%rcx)
movl %r12d, %ecx
cmpb $0xa, %dl
jne 0x5dd0
movl $0x0, %ecx
cmpl $0x3, %ebp
jl 0x5dd0
callq 0x3320
movq (%rax), %rdx
movq 0x8(%rbx), %rax
movsbq (%rax), %rcx
testb $0x8, 0x1(%rdx,%rcx,2)
movl $0x0, %ecx
je 0x5dd0
movsbq 0x1(%rax), %rcx
testb $0x8, 0x1(%rdx,%rcx,2)
movl $0x0, %ecx
je 0x5dd0
movsbq 0x2(%rax), %rcx
testb $0x8, 0x1(%rdx,%rcx,2)
movl $0x0, %ecx
je 0x5dd0
cmpb $0x2d, 0x3(%rax)
je 0x5dd0
jmp 0x5eab
cmpl $0x2, %ebp
jge 0x5ea4
pushq $-0x1
popq %rax
jmp 0x5ec3
xorl %eax, %eax
jmp 0x5ec3
movq 0x8(%rbx), %rax
movl %ebp, %r12d
movl %r12d, %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_O2/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
movq $0x5, (%rsp)
andq $0x0, 0x8(%rsp)
xorl %eax, %eax
cmpq $0x10, %rax
je 0x5f5d
andq $0x0, 0x10(%rsp,%rax,8)
incq %rax
jmp 0x5f4c
pushq $0x40
popq %rcx
movl %edi, %eax
cltd
idivl %ecx
movslq %eax, %rdx
shll $0x6, %eax
movl %edi, %ecx
subl %eax, %ecx
pushq $0x1
popq %rax
shlq %cl, %rax
orq %rax, 0x10(%rsp,%rdx,8)
xorl %eax, %eax
testl %esi, %esi
leaq 0x10(%rsp), %rsi
movl $0x0, %edx
cmoveq %rsi, %rdx
cmoveq %rax, %rsi
incl %edi
movq %rsp, %r8
xorl %ecx, %ecx
callq 0x32d0
movl %eax, %ebx
cmpl $-0x1, %eax
je 0x5fae
movl %ebx, %eax
addq $0x90, %rsp
popq %rbx
retq
leaq 0x1a7c7(%rip), %rdi     # 0x2077c
callq 0x3280
jmp 0x5fa3
// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpb $0x3f, (%rdi)
je 0x7e4e
movq %rdi, %r14
callq 0x3100
leaq 0x1(%rax), %r15
pushq $0x1
popq %rsi
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 0x7dd0
testl %ecx, %ecx
jne 0x7dd6
jmp 0x7ddb
movb $0x0, (%rax)
incl %r15d
incq %rax
jmp 0x7dc2
leal 0x2(%r15), %eax
movslq %eax, %rdi
pushq $0x4
popq %rsi
callq 0x31b0
movq %rax, %r14
movslq %r15d, %r12
xorl %r13d, %r13d
leaq 0x24c36(%rip), %rbp     # 0x2ca30
cmpq %r12, %r13
jg 0x7e3c
movq %rbx, %rdi
callq 0x35b0
movl %eax, %r15d
movl %eax, (%r14,%r13,4)
leal -0x1a(%r15), %eax
cmpl $-0x19, %eax
jb 0x7e35
movq %rbx, %rdi
callq 0x3100
addq %rax, %rbx
incq %rbx
decl %r15d
movq (%rbp,%r15,8), %rax
incq %r13
cmpb $0x0, (%rax)
jne 0x7dfa
movq $0x1, (%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x7e5a
xorl %edi, %edi
callq 0x33c0
// File: /workspace/github_c_makefile_star2_O2/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 0x1a151(%rip), %rdi     # 0x21fba
callq 0x3590
pushq $0x1
popq %rbx
leaq 0x24bb8(%rip), %r15     # 0x2ca30
leaq 0x1a133(%rip), %r14     # 0x21fb2
xorl %r12d, %r12d
cmpq $0xc8, %r12
je 0x7ea8
movq (%r12,%r15), %rdx
cmpb $0x0, (%rdx)
je 0x7ea0
movq %r14, %rdi
movl %ebx, %esi
xorl %eax, %eax
callq 0x3060
incl %ebx
addq $0x8, %r12
jmp 0x7e82
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x24c83(%rip), %rdx     # 0x2cb40
xorl %eax, %eax
xorl %r8d, %r8d
cmpl $-0x3, %ecx
je 0x7eef
testl %esi, %esi
movl %r8d, %r9d
cmovsl %ecx, %r9d
movslq %r9d, %r9
movsbq (%rdi,%r9), %r9
movb (%rdx,%r9), %r9b
cmpb $0x3, %r9b
ja 0x7efd
shlb $0x2, %al
orb %r9b, %al
incl %r8d
decl %ecx
jmp 0x7ec2
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_O2/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, %r14d
movq %rdi, 0x8(%rsp)
movq (%rsi), %rcx
movq 0x8(%rsi), %r12
movswq 0x12(%rsi), %rdx
addq %rcx, %rdx
movq %r12, %rax
subq %rdx, %rax
negq %rdx
leaq (%r12,%rdx), %r13
incq %r13
movq %rsi, 0x10(%rsp)
cmpw $0x1, 0x10(%rsi)
cmoveq %rcx, %r12
addq $0x3, %rax
xorl %ebp, %ebp
pushq $0x3
popq %r15
xorl %edx, %edx
divq %r15
movq %rax, (%r8)
leaq 0x1a191(%rip), %rsi     # 0x220f0
leaq 0x1a194(%rip), %rcx     # 0x220fa
pushq $0x56
popq %rdx
movq %rax, %rdi
callq 0x1e045
movq %rax, (%rbx)
addq 0x8(%rsp), %r12
movslq %r14d, %r14
shlq $0x6, %r14
addq 0x24071(%rip), %r14     # 0x2bff8
leaq -0x3(%r15), %rdi
cmpq %r13, %rdi
jae 0x7fd2
cmpq %r13, %r15
ja 0x7fcb
movq 0x10(%rsp), %rax
movswl 0x10(%rax), %eax
movslq %eax, %rsi
imulq %rsi, %rdi
addq %r12, %rdi
callq 0x7eb4
cmpb $-0x1, %al
je 0x7fba
movzbl %al, %eax
movb (%rax,%r14), %al
jmp 0x7fbc
movb $0x58, %al
movq (%rbx), %rcx
movb %al, (%rcx,%rbp)
incq %rbp
addq $0x3, %r15
jmp 0x7f87
movq (%rbx), %rax
movb $0x58, (%rax,%rbp)
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_O2/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:
pushq $0x3
popq %rcx
movq %rdi, %rax
cqto
idivq %rcx
movq %rdx, %rcx
cmpl $0x2, %esi
jg 0x801a
notq %rcx
addq %rdi, %rcx
pushq $0x3
popq %r8
movl %esi, %eax
cltd
idivl %r8d
movslq %edx, %rax
leaq (%rcx,%rax), %rdx
cmpq %rdi, %rdx
leaq -0x3(%rax,%rcx), %rax
cmovlq %rdx, %rax
retq
pushq $0x3
popq %rdi
movl %esi, %eax
xorl %edx, %edx
divl %edi
subq %rdx, %rcx
leaq 0x3(%rcx), %rax
testq %rcx, %rcx
cmovnsq %rcx, %rax
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x80ea
leaq (%r15,%rbx,8), %rbp
xorl %r15d, %r15d
leaq 0x1a071(%rip), %r12     # 0x22106
cmpq $0x60, %r15
je 0x812a
movq (%rbp,%r15), %r13
movq (%r14,%rbx,8), %rax
leaq 0x8(,%rax,8), %rdi
leaq 0x1a039(%rip), %rsi     # 0x220f0
movl $0xa5, %edx
movq %r12, %rcx
callq 0x1e045
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
jmp 0x8095
leaq 0x19fff(%rip), %r12     # 0x220f0
leaq 0x1a00e(%rip), %r13     # 0x22106
pushq $0x8
popq %rbp
movq %rbp, %rdi
movq %r12, %rsi
movl $0x9e, %edx
movq %r13, %rcx
callq 0x1e045
movq %rax, (%r15,%rbx,8)
movq %rbp, %rdi
movq %r12, %rsi
movl $0x9f, %edx
movq %r13, %rcx
callq 0x1e045
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_O2/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %r15
xorl %edi, %edi
xorl %eax, %eax
cmpq $0x6, %rax
je 0x8164
addq (%r14,%rax,8), %rdi
incq %rax
jmp 0x8155
leaq 0x19f85(%rip), %rdx     # 0x220f0
leaq 0x19fa2(%rip), %r8      # 0x22114
movl $0x2018, %esi           # imm = 0x2018
movl $0xb9, %ecx
callq 0x1dfd0
movq %rax, (%r12)
andq $0x0, (%rbx)
pushq $-0x1
popq %rcx
xorl %esi, %esi
xorl %edx, %edx
cmpq $0x6, %rdx
je 0x821c
cmpq $0x3, %rdx
movl $0x0, %edi
adcl $-0x1, %edi
orl $0x1, %edi
xorl %r8d, %r8d
cmpq (%r14,%rdx,8), %r8
jae 0x8214
movq (%r15,%rdx,8), %r9
movq 0x30(%r15,%rdx,8), %r10
movq (%r9,%r8,8), %r9
movq (%r10,%r8,8), %r10
cmpq %r10, %r9
movq %r10, %r11
cmovlq %r9, %r11
cmovgq %r9, %r10
testl %ecx, %ecx
cmovsl %edx, %ecx
imulq $0x2018, %rsi, %rsi     # imm = 0x2018
movq %r11, (%rax,%rsi)
imulq $0x2018, (%rbx), %rsi   # imm = 0x2018
movq %r10, 0x8(%rax,%rsi)
movq (%rbx), %rsi
imulq $0x2018, %rsi, %r9      # imm = 0x2018
movw %di, 0x10(%rax,%r9)
movl %edx, %r10d
subl %ecx, %r10d
movw %r10w, 0x14(%rax,%r9)
incq %rsi
movq %rsi, (%rbx)
incq %r8
jmp 0x81ac
incq %rdx
jmp 0x8190
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/ToniWestbrook[P]paladin/protein.c
// Function: getNextCDS
int getNextCDS(FILE * passFile, CDS * retCDS, unsigned long * retLine) {
	int fieldIdx, scanIdx;
	int readCount;
	char readBuffer[GFF_MAX_FIELD], field[9][GFF_MAX_FIELD];

	// Iterate through each annotation line until CDS or EOF
	while (fgets(readBuffer, GFF_MAX_FIELD, passFile)) {
		// Skip comments and blank lines
		(*retLine)++;
		if (readBuffer[0] == '#') continue;
		if ((readBuffer[0] == '\n') || (readBuffer[0] == '\r')) continue;

		// Parse all fields from GFF entry
		for (fieldIdx = 0, scanIdx = 0 ; fieldIdx < 9 ; fieldIdx++) {
			sscanf(readBuffer + scanIdx, "%[^\t]%n", field[fieldIdx], &readCount);
			scanIdx += readCount + 1;
		}

		// Check for CDS entry, assign to record and return
		if (strcmp(field[2], "CDS") == 0) {
			retCDS->startIdx = atol(field[3]) - 1;
			retCDS->endIdx = atol(field[4]) - 1;
			retCDS->strand = (field[6][0] == '+') ? 1 : -1;
			retCDS->phase = atoi(field[7]);

			// Fixup description
			sprintf(retCDS->description, "%s", field[8]);
			for (scanIdx = 0 ; scanIdx < strlen(retCDS->description) ; scanIdx++) {
				if (retCDS->description[scanIdx] == ' ') retCDS->description[scanIdx] = '_';
				if (retCDS->description[scanIdx] == 0x0A || retCDS->description[scanIdx] == 0x0D) retCDS->description[scanIdx] = 0;
			}

			return 1;
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x14018, %rsp          # imm = 0x14018
movq %rdx, %r14
movq %rsi, 0x8(%rsp)
movq %rdi, %r15
leaq 0x10(%rsp), %rbx
leaq 0x19c09(%rip), %r13     # 0x22126
leaq 0x4(%rsp), %rbp
movq %rbx, %rdi
movl $0x2000, %esi           # imm = 0x2000
movq %r15, %rdx
callq 0x35d0
testq %rax, %rax
je 0x8654
incq (%r14)
movzbl 0x10(%rsp), %eax
cmpq $0x23, %rax
ja 0x8559
movabsq $0x800002400, %rcx      # imm = 0x800002400
btq %rax, %rcx
jb 0x8522
xorl %ebx, %ebx
xorl %eax, %eax
cmpq $0x12000, %rbx          # imm = 0x12000
je 0x859b
movslq %eax, %r12
leaq (%rsp,%r12), %rdi
addq $0x10, %rdi
leaq (%rsp,%rbx), %rdx
addq $0x2010, %rdx           # imm = 0x2010
movq %r13, %rsi
movq %rbp, %rcx
xorl %eax, %eax
callq 0x32e0
movl 0x4(%rsp), %eax
addl %r12d, %eax
incl %eax
addq $0x2000, %rbx           # imm = 0x2000
jmp 0x855d
cmpl $0x534443, 0x6010(%rsp) # imm = 0x534443
leaq 0x10(%rsp), %rbx
jne 0x8522
leaq 0x8010(%rsp), %rdi
callq 0x33a0
decq %rax
movq 0x8(%rsp), %r15
movq %rax, (%r15)
leaq 0xa010(%rsp), %r14
movq %r14, %rdi
callq 0x33a0
decq %rax
movq %rax, 0x8(%r15)
xorl %eax, %eax
cmpb $0x2b, 0x4000(%r14)
sete %al
leal -0x1(,%rax,2), %eax
movw %ax, 0x10(%r15)
leaq 0x10010(%rsp), %rdi
callq 0x35b0
movw %ax, 0x12(%r15)
addq $0x16, %r15
leaq 0x12010(%rsp), %rsi
movq %r15, %rdi
callq 0x32c0
xorl %ebx, %ebx
pushq $0x1
popq %rbp
movq %r15, %rdi
callq 0x3100
cmpq %rbx, %rax
jbe 0x8656
movzbl (%r15,%rbx), %eax
cmpl $0xa, %eax
je 0x8645
cmpl $0x20, %eax
je 0x8649
cmpl $0xd, %eax
jne 0x864f
xorl %eax, %eax
jmp 0x864b
movb $0x5f, %al
movb %al, (%r15,%rbx)
incq %rbx
jmp 0x8624
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x14018, %rsp          # imm = 0x14018
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x197cc(%rip), %rdi     # 0x2216a
leaq 0x1bb3a(%rip), %rdx     # 0x244df
callq 0xc931
movq %rax, %rbx
andl $0x0, 0x30(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x30(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %rbx, %rdi
callq 0x41e0
movq %rbx, %rdi
callq 0x3370
movq %rbx, %rdi
callq 0xd01b
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x8f38
testl %r12d, %r12d
leaq 0x23fb3(%rip), %rax     # 0x2ce60
leaq 0x23fa4(%rip), %rcx     # 0x2ce58
cmoveq %rax, %rcx
movq (%rcx), %rax
cmpl $0x0, 0x8(%rax)
je 0x8f2f
cmpl $0x1, %ebp
jne 0x8edf
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x90aa
movq (%r14), %rsi
movq %rbx, %rdi
callq 0x949b
movq (%rbx), %rdi
movslq 0x8(%rbx), %rsi
leaq 0x713(%rip), %rcx       # 0x9600
pushq $0x28
popq %r14
movq %r14, %rdx
callq 0x3760
movq 0x10(%rbx), %rdi
movslq 0x18(%rbx), %rsi
leaq 0x70c(%rip), %rcx       # 0x9614
movq %r14, %rdx
callq 0x3760
movq 0x20(%rbx), %rdi
movslq 0x28(%rbx), %rsi
leaq 0x70b(%rip), %rcx       # 0x962a
movq %r14, %rdx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x3760
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq