LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/aap[P]pdp11/rk11.c
// Function: detach_rk05
void
detach_rk05(RK11 *rk, int n)
{
	if(rk->drives[n].fp){
		fclose(rk->drives[n].fp);
		rk->drives[n].fp = nil;
	}
	reset_rk05(&rk->drives[n]);
}

// Assembly:
pushq %rbx
movslq %esi, %rax
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
leaq (%rdi,%rax), %rbx
addq $0x28, %rbx
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x64fe
callq 0x2090
movq $0x0, (%rbx)
movw $0x800, 0xc(%rbx)       # imm = 0x800
movq $0x0, 0x10(%rbx)
movl $0x0, 0x20(%rbx)
movw $0x0, 0x2c(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]pdp11/rk11.c
// Function: busaddr
static int
busaddr(RK11 *rk)
{
	int addr = rk->rkba | (rk->rkcs&060)<<12;
	if((rk->rkcs & IBA)==0){
		rk->rkba += 2;
		if(rk->rkba == 0)
			SETMASK(rk->rkcs, rk->rkcs+020, 060);
	}
	return addr;
}

// Assembly:
movzwl 0x10(%rdi), %ecx
movzwl 0xc(%rdi), %eax
btl $0xb, %eax
jb 0x6546
movl %ecx, %edx
addw $0x2, %dx
movw %dx, 0x10(%rdi)
jne 0x6546
movl %eax, %edx
andl $-0x31, %edx
leal 0x10(%rax), %esi
andl $0x30, %esi
orl %edx, %esi
movw %si, 0xc(%rdi)
andl $0x30, %eax
shll $0xc, %eax
orl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]pdp11/rk11.c
// Function: count
static void
count(RK05 *drive, RK11 *rk)
{
	word rkda;

	if(rk->rkwc == 0)
		return;

	rkda = rk->rkda+1;
	if((rkda & 017) == 12)
		rkda = (rkda&~017)+020;
	if((rkda&0160000) != (rk->rkda&0160000))
		rkerr(drive, rk, OVR);
	SETMASK(rk->rkda, rkda, 017777);

	// seek
	drive->newcyl = (rkda>>5) & 0377;
}

// Assembly:
cmpw $0x0, 0xe(%rsi)
je 0x65c5
movzwl 0x12(%rsi), %eax
leal 0x1(%rax), %ecx
movl %ecx, %edx
andl $0xf, %edx
movl %ecx, %r8d
andl $-0x10, %r8d
addl $0x10, %r8d
cmpw $0xc, %dx
cmovnel %ecx, %r8d
movzwl %r8w, %ecx
movl $0xe000, %edx           # imm = 0xE000
andl %edx, %r8d
andl %edx, %eax
cmpl %eax, %r8d
je 0x65ae
movzwl 0xa(%rsi), %edx
movl %edx, %r8d
orl $0x4000, %r8d           # imm = 0x4000
movw %r8w, 0xa(%rsi)
testl $0xb64c, %edx           # imm = 0xB64C
je 0x65ae
orb $-0x80, 0xc(%rsi)
movl $0x0, 0x10(%rdi)
movl %ecx, %edx
andl $0x1fff, %edx           # imm = 0x1FFF
orl %edx, %eax
movw %ax, 0x12(%rsi)
shrl $0x5, %ecx
movzbl %cl, %eax
movl %eax, 0x20(%rdi)
retq
nop
// File: /workspace/github_c_makefile_star2_O1/aap[P]pdp11/mem.c
// Function: datob_mem
int
datob_mem(Bus *bus, void *dev)
{
	Memory *mem = dev;
	uint32 waddr = bus->addr>>1;
	if(waddr >= mem->start && waddr < mem->end){
		mem->mem[waddr-mem->start] &= (bus->addr&1) ? 0377 : ~0377;
		mem->mem[waddr-mem->start] |= bus->data & ((bus->addr&1) ? ~0377 : 0377);
		return 0;
	}
	return 1;
}

// Assembly:
movl 0x8(%rdi), %edx
movl %edx, %r8d
shrl %r8d
movl $0x1, %eax
movl %r8d, %ecx
subl 0x8(%rsi), %ecx
jb 0x6660
cmpl 0xc(%rsi), %r8d
jae 0x6660
testb $0x1, %dl
movl $0xff00, %eax           # imm = 0xFF00
movl $0xff, %edx
movl $0xff, %r8d
cmovel %eax, %r8d
movq (%rsi), %rsi
cmovel %edx, %eax
andw (%rsi,%rcx,2), %r8w
movw %r8w, (%rsi,%rcx,2)
andw 0xc(%rdi), %ax
orl %r8d, %eax
movw %ax, (%rsi,%rcx,2)
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]pdp11/unix.c
// Function: handleclock
int
handleclock(Clock *clk)
{
	struct timespec diff;
	clock_gettime(CLOCK_REALTIME, &clk->newtime);
	diff.tv_sec = clk->newtime.tv_sec - clk->oldtime.tv_sec;
	diff.tv_nsec = clk->newtime.tv_nsec - clk->oldtime.tv_nsec;
	if(diff.tv_nsec < 0){
		diff.tv_nsec += 1000000000;
		diff.tv_sec -= 1;
	}
	if(diff.tv_nsec >= clk->period){
		clk->oldtime.tv_nsec += clk->period;
		if(clk->oldtime.tv_nsec >= 1000000000){
			clk->oldtime.tv_nsec -= 1000000000;
			clk->oldtime.tv_sec += 1;
		}
		return 1;
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x10(%rdi), %rsi
xorl %ebp, %ebp
xorl %edi, %edi
callq 0x2070
movq 0x8(%rbx), %rax
movq 0x18(%rbx), %rcx
subq %rax, %rcx
leaq 0x3b9aca00(%rcx), %rdx
testq %rcx, %rcx
cmovnsq %rcx, %rdx
movq 0x20(%rbx), %rcx
cmpq %rcx, %rdx
jl 0x6736
addq %rax, %rcx
movq %rcx, 0x8(%rbx)
movl $0x1, %ebp
cmpq $0x3b9aca00, %rcx       # imm = 0x3B9ACA00
jl 0x6736
addq $-0x3b9aca00, %rcx      # imm = 0xC4653600
movq %rcx, 0x8(%rbx)
incq (%rbx)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]pdp11/unix.c
// Function: timestamp
int
timestamp(char *buffer, size_t n)
{
	struct tm *tm;
	time_t t;

	t = time(NULL);
	if (t == (time_t)-1)
		return -1;
	tm = localtime(&t);
	if (tm == NULL)
		return -1;
	if(strftime(buffer, n, "%Y%m%d%H%M%S", tm) == 0)
		return -1;
	return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
xorl %edi, %edi
callq 0x2140
movq %rax, 0x8(%rsp)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpq $-0x1, %rax
je 0x67f8
leaq 0x8(%rsp), %rdi
callq 0x2030
testq %rax, %rax
je 0x67f8
leaq 0xf9c(%rip), %rdx       # 0x777e
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rcx
callq 0x2190
xorl %ebp, %ebp
cmpq $0x1, %rax
sbbl %ebp, %ebp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/aap[P]pdp11/util.c
// Function: hasinput
int
hasinput(int fd)
{
	fd_set fds;
	struct timeval timeout;

	if(fd < 0) return 0;

	timeout.tv_sec = 0;
	timeout.tv_usec = 0;
	FD_ZERO(&fds);
	FD_SET(fd, &fds);
	return select(fd+1, &fds, NULL, NULL, &timeout) > 0;
}

// Assembly:
testl %edi, %edi
js 0x686d
subq $0x98, %rsp
xorps %xmm0, %xmm0
movq %rsp, %r8
movaps %xmm0, (%r8)
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)
movl $0x1, %eax
movl %edi, %ecx
shlq %cl, %rax
movaps %xmm0, 0x60(%rsi)
movaps %xmm0, 0x70(%rsi)
movl %edi, %ecx
shrl $0x6, %ecx
orq %rax, 0x10(%rsp,%rcx,8)
incl %edi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x2150
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
setg %al
addq $0x98, %rsp
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]pdp11/util.c
// Function: readn
int
readn(int fd, void *data, int n)
{
	int m;

	while(n > 0){
		m = read(fd, data, n);
		if(m <= 0)
			return -1;
		data += m;
		n -= m;
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
xorl %ebx, %ebx
testl %edx, %edx
jle 0x68ac
movl %edx, %ebp
movq %rsi, %r14
movl %edi, %r15d
movl %ebp, %edx
movl %r15d, %edi
movq %r14, %rsi
callq 0x2100
testl %eax, %eax
jle 0x68a7
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
addq %rcx, %r14
subl %eax, %ebp
jg 0x6885
jmp 0x68ac
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]pdp11/util.c
// Function: writen
int
writen(int fd, void *data, int n)
{
	int m;

	while(n > 0){
		m = write(fd, data, n);
		if(m <= 0)
			return -1;
		data += m;
		n -= m;
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
xorl %ebx, %ebx
testl %edx, %edx
jle 0x68f5
movl %edx, %ebp
movq %rsi, %r14
movl %edi, %r15d
movl %ebp, %edx
movl %r15d, %edi
movq %r14, %rsi
callq 0x2080
testl %eax, %eax
jle 0x68f0
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
addq %rcx, %r14
subl %eax, %ebp
jg 0x68ce
jmp 0x68f5
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]pdp11/util.c
// Function: dial
int
dial(char *host, int port)
{
	char portstr[32];
	int sockfd;
	struct addrinfo *result, *rp, hints;

	memset(&hints, 0, sizeof(hints));
	hints.ai_family = AF_UNSPEC;
	hints.ai_socktype = SOCK_STREAM;

	snprintf(portstr, 32, "%d", port);
	if(getaddrinfo(host, portstr, &hints, &result)){
		perror("error: getaddrinfo");
		return -1;
	}

	for(rp = result; rp; rp = rp->ai_next){
		sockfd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
		if(sockfd < 0)
			continue;
		if(connect(sockfd, rp->ai_addr, rp->ai_addrlen) >= 0)
			goto win;
		close(sockfd);
	}
	freeaddrinfo(result);
	perror("error");
	return -1;

win:
	freeaddrinfo(result);
	return sockfd;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x60, %rsp
movl %esi, %ecx
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %r14
movaps %xmm0, (%r14)
movaps %xmm0, 0x20(%r14)
movaps %xmm0, 0x10(%r14)
movl $0x1, 0x8(%r14)
leaq 0xe56(%rip), %rdx       # 0x778b
leaq 0x10(%rsp), %r15
movl $0x20, %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x20b0
leaq 0x8(%rsp), %rcx
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x2210
testl %eax, %eax
jne 0x69c3
movq 0x8(%rsp), %r14
testq %r14, %r14
je 0x69b7
movl 0x4(%r14), %edi
movl 0x8(%r14), %esi
movl 0xc(%r14), %edx
callq 0x2240
testl %eax, %eax
js 0x699b
movl %eax, %ebx
movq 0x18(%r14), %rsi
movl 0x10(%r14), %edx
movl %eax, %edi
callq 0x21f0
testl %eax, %eax
jns 0x69a1
movl %ebx, %edi
callq 0x20f0
movq 0x28(%r14), %r14
jmp 0x6965
movq 0x8(%rsp), %rdi
callq 0x2230
movl %ebx, %eax
addq $0x60, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x8(%rsp), %rdi
callq 0x2374
jmp 0x69cf
leaq 0xdc4(%rip), %rdi       # 0x778e
callq 0x21c0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x69ab
// File: /workspace/github_c_makefile_star2_O1/aap[P]pdp11/util.c
// Function: sleep_ms
void
sleep_ms (uint32 ms)
{
	struct timespec ts;

	if (ms == 0)
		return;

	ts.tv_sec = ms / 1000;
	ts.tv_nsec = (ms % 1000) * 1000000;
	(void)nanosleep (&ts, NULL);
}

// Assembly:
testl %edi, %edi
je 0x6a36
subq $0x18, %rsp
movl %edi, %eax
imulq $0x10624dd3, %rax, %rcx # imm = 0x10624DD3
shrq $0x26, %rcx
leaq 0x8(%rsp), %rax
movq %rcx, (%rax)
imull $0x3e8, %ecx, %ecx      # imm = 0x3E8
subl %ecx, %edi
imull $0xf4240, %edi, %ecx    # imm = 0xF4240
movq %rcx, 0x8(%rax)
movq %rax, %rdi
xorl %esi, %esi
callq 0x20c0
addq $0x18, %rsp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/w4kfu[P]HommI/Bmp/main.c
// Function: main
int main(int argc, char *argv[])
{
	struct bmp *bmp = NULL;

	if (argc != 4)
	{
		fprintf(stderr, "%s <*.BMP|*.bmp|*.bkg> <*.pal> outfile\n", argv[0]);
		return EXIT_FAILURE;
	}

	if ((bmp = convertbmp(argv[1], argv[2])))
	{
		writeImage(argv[3], bmp->width, bmp->height, bmp->data, argv[3]);
		closebmp(bmp);
	}
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
cmpl $0x4, %edi
jne 0x160f
movq 0x8(%r14), %rdi
movq 0x10(%r14), %rsi
callq 0x175d
xorl %ebx, %ebx
testq %rax, %rax
je 0x1607
movq %rax, %r15
movq 0x18(%r14), %rdi
movzwl 0x2(%rax), %esi
movzwl 0x4(%rax), %edx
movq 0x10(%rax), %rcx
movq %rdi, %r8
callq 0x13a6
movq %r15, %rdi
callq 0x172e
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
movq %r14, %rdi
callq 0x121e
movl $0x1, %ebx
jmp 0x1607
nop
// File: /workspace/github_c_makefile_star2_O1/w4kfu[P]HommI/Bmp/bmp.c
// Function: openbmp
struct bmp *openbmp(char *filename)
{
	struct bmp *newbmp = NULL;
	FILE *fin = NULL;
	unsigned int filesize = 0;

	if (!(fin = fopen(filename, "rb")))
	{
		perror("fopen()");
		return NULL;
	}
	if (!(newbmp = malloc(sizeof (struct bmp))))
	{
		perror("malloc()");
		return NULL;
	}

        fseek(fin, 0, SEEK_END);
        filesize = ftell(fin);
        fseek(fin, 0, SEEK_SET);
	if (!(newbmp->buf = malloc(sizeof (char) * filesize)))
	{
		perror("malloc()");
		free(newbmp);
		fclose(fin);
		return NULL;
	}
	if (fread(newbmp->buf, 1, filesize, fin) != filesize)
	{
		perror("fread()");
		free(newbmp);
		fclose(fin);
		return NULL;
	}
	memcpy(newbmp, newbmp->buf, 3 * sizeof (unsigned short));
	if (newbmp->sig != 0x0021)
	{
		fprintf(stderr, "[-] Wrong signature\n");
		free(newbmp->buf);
		free(newbmp);
		fclose(fin);
		return NULL;
	}
	newbmp->data = NULL;
	fclose(fin);
	return newbmp;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
leaq 0xa71(%rip), %rsi       # 0x20a0
callq 0x1140
testq %rax, %rax
je 0x16d1
movq %rax, %r14
movl $0x18, %edi
callq 0x1110
testq %rax, %rax
je 0x16da
movq %rax, %rbx
movq %r14, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x1120
movq %r14, %rdi
callq 0x10d0
movq %rax, %r15
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1120
movl %r15d, %r12d
movq %r12, %rdi
callq 0x1110
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x16e8
movq %rax, %r15
movl $0x1, %esi
movq %rax, %rdi
movq %r12, %rdx
movq %r14, %rcx
callq 0x1050
cmpq %r12, %rax
jne 0x16f1
movzwl 0x4(%r15), %eax
movw %ax, 0x4(%rbx)
movl (%r15), %eax
movl %eax, (%rbx)
cmpw $0x21, %ax
jne 0x170f
movq $0x0, 0x10(%rbx)
movq %r14, %rdi
callq 0x1070
jmp 0x171f
leaq 0x92f(%rip), %rdi       # 0x2007
jmp 0x16e1
leaq 0x9c2(%rip), %rdi       # 0x20a3
callq 0x1150
jmp 0x171d
leaq 0x9b4(%rip), %rdi       # 0x20a3
jmp 0x16f8
leaq 0x9b4(%rip), %rdi       # 0x20ac
callq 0x1150
movq %rbx, %rdi
callq 0x1040
movq %r14, %rdi
callq 0x1070
jmp 0x171d
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x123c
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/w4kfu[P]HommI/Bmp/bmp.c
// Function: closebmp
void closebmp(struct bmp *nbmp)
{
	if (nbmp)
	{
		if (nbmp->buf)
			free(nbmp->buf);
		if (nbmp->data)
			free(nbmp->data);
		free(nbmp);
	}
}

// Assembly:
testq %rdi, %rdi
je 0x175c
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x1745
callq 0x1040
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x1753
callq 0x1040
movq %rbx, %rdi
popq %rbx
jmp 0x1040
retq
// File: /workspace/github_c_makefile_star2_O1/w4kfu[P]HommI/Bmp/bmp.c
// Function: convertbmp
struct bmp* convertbmp(char *filename, char *palettefile)
{
	struct bmp *newbmp = NULL;
	unsigned char *pal = NULL;
	unsigned char *newdata = NULL;
	struct color *rgb = NULL;
	unsigned int y, x;

	if (!(pal = open_palette(palettefile)))
		return NULL;
	if (!(newbmp = openbmp(filename)))
	{
		free(pal);
		return NULL;
	}
	if (!(newdata = malloc(sizeof (char) * newbmp->width * newbmp->height * 3)))
	{
		perror("malloc()");
		free(pal);
		free(newbmp);
		return NULL;
	}
	newbmp->data = newdata;
	rgb = (struct color *)pal;
	for (y = 0; y < newbmp->height; y++)
	{
		for (x = 0; x < newbmp->width; x++)
		{
			memcpy(newdata, &rgb[*(newbmp->buf + (3 * 2) + (x + (y * newbmp->width)))], 3);
			newdata += 3;
		}
	}
	free(pal);
	return newbmp;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x1830
testq %rax, %rax
je 0x17fd
movq %rax, %r14
movq %rbx, %rdi
callq 0x1620
testq %rax, %rax
je 0x1818
movq %rax, %rbx
movzwl 0x2(%rax), %eax
movzwl 0x4(%rbx), %ecx
imulq %rax, %rcx
leaq (%rcx,%rcx,2), %rdi
callq 0x1110
testq %rax, %rax
je 0x1801
movq %rax, 0x10(%rbx)
cmpw $0x0, 0x4(%rbx)
je 0x181a
xorl %ecx, %ecx
movzwl 0x2(%rbx), %esi
testl %esi, %esi
je 0x17f0
xorl %edx, %edx
movl %esi, %esi
imulq %rcx, %rsi
addq 0x8(%rbx), %rsi
movzbl 0x6(%rdx,%rsi), %esi
leaq (%rsi,%rsi,2), %rsi
movb 0x2(%r14,%rsi), %dil
movb %dil, 0x2(%rax)
movzwl (%r14,%rsi), %esi
movw %si, (%rax)
addq $0x3, %rax
movzwl 0x2(%rbx), %esi
incq %rdx
cmpl %esi, %edx
jb 0x17bd
incq %rcx
movzwl 0x4(%rbx), %edx
cmpl %edx, %ecx
jb 0x17b3
jmp 0x181a
xorl %ebx, %ebx
jmp 0x1822
leaq 0x89b(%rip), %rdi       # 0x20a3
callq 0x1150
movq %r14, %rdi
callq 0x1040
movq %rbx, %r14
xorl %ebx, %ebx
movq %r14, %rdi
callq 0x1040
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/JulStrat[P]bams/./sh_bisect.h
// Function: bisect_left
void *
bisect_left(const void *key, const void *arr,
            size_t el_num, size_t el_size,
            int (*compare) (const void *, const void *))
{
    size_t low = 0;
    size_t high = el_num;
    size_t mid;
    char *off;

    ASSERT_BISECT_ARGS();

    while (low < high) {
        mid = low + ((high - low) >> 1);
        off = (char *) arr + mid * el_size;
        if ((*compare) (key, off) > 0) {
            low = mid + 1;
        } else {
            high = mid;
        }
    }

    return (char *) arr + low * el_size;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, 0x10(%rsp)
movq %rcx, 0x8(%rsp)
testq %rdi, %rdi
je 0x1a02
movq %rsi, %rbx
testq %rsi, %rsi
je 0x1a0b
cmpq $0x0, 0x8(%rsp)
je 0x1a14
cmpq $0x0, 0x10(%rsp)
je 0x1a1d
movq %rdx, %r15
testq %rdx, %rdx
je 0x19e5
movq %rdi, %r13
xorl %ebp, %ebp
movq %r15, %r12
subq %rbp, %r12
shrq %r12
leaq (%r12,%rbp), %r14
movq %r14, %rsi
imulq 0x8(%rsp), %rsi
addq %rbx, %rsi
movq %r13, %rdi
callq *0x10(%rsp)
testl %eax, %eax
jg 0x19d8
movq %r14, %r15
jmp 0x19de
addq %r12, %rbp
incq %rbp
cmpq %r15, %rbp
jb 0x19af
jmp 0x19e7
xorl %ebp, %ebp
imulq 0x8(%rsp), %rbp
addq %rbp, %rbx
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1926(%rip), %rdi      # 0x332f
jmp 0x1a24
leaq 0x199a(%rip), %rdi      # 0x33ac
jmp 0x1a24
leaq 0x1821(%rip), %rdi      # 0x323c
jmp 0x1a24
leaq 0x1897(%rip), %rdi      # 0x32bb
leaq 0x1910(%rip), %rsi      # 0x333b
leaq 0x1917(%rip), %rcx      # 0x3349
movl $0x5c, %edx
callq 0x1050
// File: /workspace/github_c_makefile_star2_O1/JulStrat[P]bams/bams.c
// Function: bams_create
BAMS *
bams_create(size_t key_size, int (*compare) (const void *, const void *))
{
    BAMS *set;

    assert(NULL != compare);

    set = (BAMS *) malloc(sizeof (BAMS));
    if (!set) {
        return NULL;
    }

    if (key_size) {
        set->key_size = key_size;
        set->type = COPY_DATA;
    } else {
        set->key_size = sizeof (void *);
        set->type = COPY_POINTER;
    }
    set->compare = compare;
    set->head = NULL;
    set->size = 0;

    return set;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0x1b57
movq %rsi, %rbx
movq %rdi, %r14
movl $0x28, %edi
callq 0x1090
testq %rax, %rax
je 0x1b4d
xorl %ecx, %ecx
testq %r14, %r14
setne %cl
movl $0x8, %edx
cmovneq %r14, %rdx
movq %rdx, (%rax)
movl %ecx, 0x20(%rax)
movq %rbx, 0x8(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
jmp 0x1b4f
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x18be(%rip), %rdi      # 0x341c
leaq 0x18c7(%rip), %rsi      # 0x342c
leaq 0x18c7(%rip), %rcx      # 0x3433
movl $0x52, %edx
callq 0x1050
// File: /workspace/github_c_makefile_star2_O1/JulStrat[P]bams/bams.c
// Function: bams_insert
int
bams_insert(BAMS * set, const void *key)
{
    SET_NODE *curr;
    /** void *keys; */
    void *t;
    /** size_t length = 1; */
    SET_NODE *node;
    SET_NODE *next;

    assert(NULL != set);
    assert(NULL != key);

    curr = set->head;
    node = make_node(set, key);
    if (!node) {
        return 0;
    }

    node->next = curr;
    set->head = node;
    set->size += 1;

    /*
     * Normalize 
     */
    while (curr != NULL) {
        if ((node->length) >= (curr->length)) {
            next = curr->next;

            t = merge_into(curr->keys, curr->length, node->keys,
                           node->length, set->key_size, set->compare);
            if (NULL == t) {
                return 1;       /*
                                 * return norm error ! 
                                 */
            }
            curr->keys = t;
            curr->length += node->length;
            set->head = curr;

            /*
             * free node 
             */
            free(node->keys);
            free(node);

            node = curr;
            curr = next;
        } else
            break;
    }
    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x1c85
movq %rsi, %r12
testq %rsi, %rsi
je 0x1ca4
movq %rdi, %rbx
movq 0x10(%rdi), %r15
movl $0x18, %edi
callq 0x1090
xorl %r13d, %r13d
testq %rax, %rax
je 0x1bf0
movq %rax, %r14
movq (%rbx), %r13
movq %r13, %rdi
callq 0x1090
testq %rax, %rax
je 0x1bf5
movq %rax, %rbp
cmpl $0x0, 0x20(%rbx)
jne 0x1bd4
movq %rsp, %rax
movq %r12, (%rax)
movq %rax, %r12
movq %rbp, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x1070
movq %rbp, 0x10(%r14)
movq $0x1, 0x8(%r14)
jmp 0x1c00
xorl %r14d, %r14d
jmp 0x1c03
movq %r14, %rdi
callq 0x1030
xorl %r14d, %r14d
xorl %r13d, %r13d
testq %r14, %r14
je 0x1c73
movq %r15, (%r14)
movq %r14, 0x10(%rbx)
incq 0x18(%rbx)
movl $0x1, %r13d
testq %r15, %r15
je 0x1c73
movq 0x8(%r14), %rcx
movq 0x8(%r15), %rsi
cmpq %rsi, %rcx
jb 0x1c73
movq (%r15), %r12
movq 0x10(%r15), %rdi
movq 0x10(%r14), %rdx
movq (%rbx), %r8
movq 0x8(%rbx), %r9
callq 0x1805
testq %rax, %rax
je 0x1c73
movq %rax, 0x10(%r15)
movq 0x8(%r14), %rax
addq %rax, 0x8(%r15)
movq %r15, 0x10(%rbx)
movq 0x10(%r14), %rdi
callq 0x1030
movq %r14, %rdi
callq 0x1030
movq %r15, %r14
movq %r12, %r15
testq %r12, %r12
jne 0x1c1e
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x17e6(%rip), %rdi      # 0x3472
leaq 0x1799(%rip), %rsi      # 0x342c
leaq 0x17e4(%rip), %rcx      # 0x347e
movl $0x71, %edx
callq 0x1050
leaq 0x17f9(%rip), %rdi      # 0x34a4
leaq 0x177a(%rip), %rsi      # 0x342c
leaq 0x17c5(%rip), %rcx      # 0x347e
movl $0x72, %edx
callq 0x1050
// File: /workspace/github_c_makefile_star2_O1/JulStrat[P]bams/bams.c
// Function: bams_min
const void *
bams_min(const BAMS * set)
{
    SET_NODE *curr;
    void *min_key = NULL;

    assert(NULL != set);

    curr = set->head;
    if (set->size > 0) {
        assert(curr != NULL);
        assert(curr->keys != NULL);

        min_key = curr->keys;
        while (NULL != curr->next) {
            curr = curr->next;
            if ((*(set->compare)) (min_key, curr->keys) > 0) {
                min_key = curr->keys;
            }
        }
    }

    if (set->type == COPY_POINTER) {
        return *(void **) min_key;
    } else {
        return min_key;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x1d1d
movq %rdi, %rbx
cmpq $0x0, 0x18(%rdi)
je 0x1d08
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0x1d3c
movq 0x10(%rax), %r14
testq %r14, %r14
je 0x1d5b
movq (%rax), %r15
testq %r15, %r15
je 0x1d0b
movq 0x10(%r15), %rsi
movq %r14, %rdi
callq *0x8(%rbx)
testl %eax, %eax
jle 0x1d03
movq 0x10(%r15), %r14
movq (%r15), %r15
jmp 0x1cec
xorl %r14d, %r14d
cmpl $0x0, 0x20(%rbx)
jne 0x1d14
movq (%r14), %r14
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x174e(%rip), %rdi      # 0x3472
leaq 0x1701(%rip), %rsi      # 0x342c
leaq 0x177e(%rip), %rcx      # 0x34b0
movl $0xa4, %edx
callq 0x1050
leaq 0x1790(%rip), %rdi      # 0x34d3
leaq 0x16e2(%rip), %rsi      # 0x342c
leaq 0x175f(%rip), %rcx      # 0x34b0
movl $0xa8, %edx
callq 0x1050
leaq 0x177e(%rip), %rdi      # 0x34e0
leaq 0x16c3(%rip), %rsi      # 0x342c
leaq 0x1740(%rip), %rcx      # 0x34b0
movl $0xa9, %edx
callq 0x1050
// File: /workspace/github_c_makefile_star2_O1/JulStrat[P]bams/bams.c
// Function: bams_max
const void *
bams_max(const BAMS * set)
{
    SET_NODE *curr;
    size_t key_size;
    char *last = NULL;
    char *max_key = NULL;

    assert(NULL != set);

    curr = set->head;
    key_size = set->key_size;

    if (set->size > 0) {
        assert(curr != NULL);
        assert(curr->keys != NULL);

        max_key = (char *) curr->keys + (curr->length - 1) * key_size;
        while (NULL != curr->next) {
            curr = curr->next;
            last = (char *) curr->keys + (curr->length - 1) * key_size;
            if ((*(set->compare)) (last, max_key) > 0) {
                max_key = last;
            }
        }
    }

    if (set->type == COPY_POINTER) {
        return *(void **) max_key;
    } else {
        return max_key;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
testq %rdi, %rdi
je 0x1e14
movq %rdi, %rbx
cmpq $0x0, 0x18(%rdi)
je 0x1df6
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0x1e33
movq 0x10(%rax), %r14
testq %r14, %r14
je 0x1e52
movq (%rbx), %r12
movq (%rax), %r13
movq 0x8(%rax), %rax
decq %rax
imulq %r12, %rax
addq %rax, %r14
testq %r13, %r13
je 0x1dfb
movq 0x8(%r13), %r15
decq %r15
imulq %r12, %r15
addq 0x10(%r13), %r15
movq %r15, %rdi
movq %r14, %rsi
callq *0x8(%rbx)
testl %eax, %eax
jg 0x1de8
movq %r14, %r15
movq (%r13), %r13
movq %r15, %r14
testq %r13, %r13
jne 0x1dc9
jmp 0x1dfe
xorl %r15d, %r15d
jmp 0x1dfe
movq %r14, %r15
cmpl $0x0, 0x20(%rbx)
jne 0x1e07
movq (%r15), %r15
movq %r15, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x1657(%rip), %rdi      # 0x3472
leaq 0x160a(%rip), %rsi      # 0x342c
leaq 0x16ca(%rip), %rcx      # 0x34f3
movl $0xc3, %edx
callq 0x1050
leaq 0x1699(%rip), %rdi      # 0x34d3
leaq 0x15eb(%rip), %rsi      # 0x342c
leaq 0x16ab(%rip), %rcx      # 0x34f3
movl $0xc9, %edx
callq 0x1050
leaq 0x1687(%rip), %rdi      # 0x34e0
leaq 0x15cc(%rip), %rsi      # 0x342c
leaq 0x168c(%rip), %rcx      # 0x34f3
movl $0xca, %edx
callq 0x1050
// File: /workspace/github_c_makefile_star2_O1/JulStrat[P]bams/bams.c
// Function: bams_count_less
size_t
bams_count_less(const BAMS * set, const void *key)
{
    SET_NODE *curr;
    size_t key_size;
    char *off;
    size_t less = 0;
    const void *tkey;

    assert(NULL != set);
    assert(NULL != key);

    curr = set->head;
    key_size = set->key_size;

    if (set->type == COPY_POINTER) {
        POINTER_ADDR(key, tkey);
    }

    while (NULL != curr) {
        off = (char *) bisect_left(key, curr->keys, curr->length,
                                   key_size, set->compare);
        assert(off >= (char *) curr->keys);
        less += off - (char *) curr->keys;
        curr = curr->next;
    }

    return (size_t) (less / key_size);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
testq %rdi, %rdi
je 0x1f17
movq %rsi, %rbx
testq %rsi, %rsi
je 0x1f36
movq %rdi, %r14
movq 0x10(%rdi), %r13
cmpl $0x0, 0x20(%rdi)
jne 0x1eab
leaq 0x8(%rsp), %rax
movq %rbx, (%rax)
movq %rax, %rbx
movq (%r14), %r15
xorl %r12d, %r12d
testq %r13, %r13
je 0x1ee2
movq 0x8(%r13), %rdx
movq 0x10(%r13), %rsi
movq 0x8(%r14), %r8
movq %rbx, %rdi
movq %r15, %rcx
callq 0x196d
movq 0x10(%r13), %rcx
cmpq %rcx, %rax
jb 0x1ef8
addq %rax, %r12
subq %rcx, %r12
movq (%r13), %r13
jmp 0x1eb1
movq %r12, %rax
xorl %edx, %edx
divq %r15
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x164a(%rip), %rdi      # 0x3549
leaq 0x1526(%rip), %rsi      # 0x342c
leaq 0x1609(%rip), %rcx      # 0x3516
movl $0xf3, %edx
callq 0x1050
leaq 0x1554(%rip), %rdi      # 0x3472
leaq 0x1507(%rip), %rsi      # 0x342c
leaq 0x15ea(%rip), %rcx      # 0x3516
movl $0xe6, %edx
callq 0x1050
leaq 0x1567(%rip), %rdi      # 0x34a4
leaq 0x14e8(%rip), %rsi      # 0x342c
leaq 0x15cb(%rip), %rcx      # 0x3516
movl $0xe7, %edx
callq 0x1050
// File: /workspace/github_c_makefile_star2_O1/JulStrat[P]bams/bams.c
// Function: bams_count_equal
size_t
bams_count_equal(const BAMS * set, const void *key)
{
    SET_NODE *curr;
    size_t key_size;
    char *low, *high;
    size_t equal = 0;
    const void *tkey;

    assert(NULL != set);
    assert(NULL != key);

    curr = set->head;
    key_size = set->key_size;

    if (set->type == COPY_POINTER) {
        POINTER_ADDR(key, tkey);
    }

    while (NULL != curr) {
        low = (char *) bisect_left(key, curr->keys, curr->length,
                                   key_size, set->compare);
        high = (char *) bisect_right(key, curr->keys, curr->length,
                                     key_size, set->compare);
        assert(high >= low);
        equal += high - low;
        curr = curr->next;
    }

    return (size_t) (equal / key_size);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x200e
movq %rsi, %rbx
testq %rsi, %rsi
je 0x202d
movq %rdi, %r14
movq 0x10(%rdi), %rbp
cmpl $0x0, 0x20(%rdi)
jne 0x1f8b
movq %rsp, %rax
movq %rbx, (%rax)
movq %rax, %rbx
movq (%r14), %r15
xorl %r12d, %r12d
testq %rbp, %rbp
je 0x1fd8
movq 0x8(%rbp), %rdx
movq 0x10(%rbp), %rsi
movq 0x8(%r14), %r8
movq %rbx, %rdi
movq %r15, %rcx
callq 0x196d
movq %rax, %r13
movq 0x8(%rbp), %rdx
movq 0x10(%rbp), %rsi
movq 0x8(%r14), %r8
movq %rbx, %rdi
movq %r15, %rcx
callq 0x1a3c
cmpq %r13, %rax
jb 0x1fef
subq %r13, %r12
addq %rax, %r12
movq (%rbp), %rbp
jmp 0x1f91
movq %r12, %rax
xorl %edx, %edx
divq %r15
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x15a2(%rip), %rdi      # 0x3598
leaq 0x142f(%rip), %rsi      # 0x342c
leaq 0x1560(%rip), %rcx      # 0x3564
movl $0x113, %edx            # imm = 0x113
callq 0x1050
leaq 0x145d(%rip), %rdi      # 0x3472
leaq 0x1410(%rip), %rsi      # 0x342c
leaq 0x1541(%rip), %rcx      # 0x3564
movl $0x104, %edx            # imm = 0x104
callq 0x1050
leaq 0x1470(%rip), %rdi      # 0x34a4
leaq 0x13f1(%rip), %rsi      # 0x342c
leaq 0x1522(%rip), %rcx      # 0x3564
movl $0x105, %edx            # imm = 0x105
callq 0x1050
// File: /workspace/github_c_makefile_star2_O1/JulStrat[P]bams/bams.c
// Function: bams_count_great
size_t
bams_count_great(const BAMS * set, const void *key)
{
    SET_NODE *curr;
    size_t key_size;
    char *low, *high;
    size_t great = 0;
    const void *tkey;

    assert(NULL != set);
    assert(NULL != key);

    curr = set->head;
    key_size = set->key_size;

    if (set->type == COPY_POINTER) {
        POINTER_ADDR(key, tkey);
    }

    while (NULL != curr) {
        low = (char *) bisect_right(key, curr->keys, curr->length,
                                    key_size, set->compare);
        high = (char *) curr->keys + curr->length * key_size;
        assert(high >= low);
        great += high - low;
        curr = curr->next;
    }

    return (size_t) (great / key_size);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
testq %rdi, %rdi
je 0x20fa
movq %rsi, %rbx
testq %rsi, %rsi
je 0x2119
movq %rdi, %r14
movq 0x10(%rdi), %r13
cmpl $0x0, 0x20(%rdi)
jne 0x2086
leaq 0x8(%rsp), %rax
movq %rbx, (%rax)
movq %rax, %rbx
movq (%r14), %r15
xorl %r12d, %r12d
testq %r13, %r13
je 0x20c5
movq 0x8(%r13), %rdx
movq 0x10(%r13), %rsi
movq 0x8(%r14), %r8
movq %rbx, %rdi
movq %r15, %rcx
callq 0x1a3c
movq 0x8(%r13), %rcx
imulq %r15, %rcx
addq 0x10(%r13), %rcx
cmpq %rax, %rcx
jb 0x20db
subq %rax, %r12
addq %rcx, %r12
movq (%r13), %r13
jmp 0x208c
movq %r12, %rax
xorl %edx, %edx
divq %r15
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x14b6(%rip), %rdi      # 0x3598
leaq 0x1343(%rip), %rsi      # 0x342c
leaq 0x14b4(%rip), %rcx      # 0x35a4
movl $0x132, %edx            # imm = 0x132
callq 0x1050
leaq 0x1371(%rip), %rdi      # 0x3472
leaq 0x1324(%rip), %rsi      # 0x342c
leaq 0x1495(%rip), %rcx      # 0x35a4
movl $0x124, %edx            # imm = 0x124
callq 0x1050
leaq 0x1384(%rip), %rdi      # 0x34a4
leaq 0x1305(%rip), %rsi      # 0x342c
leaq 0x1476(%rip), %rcx      # 0x35a4
movl $0x125, %edx            # imm = 0x125
callq 0x1050
// File: /workspace/github_c_makefile_star2_O1/JulStrat[P]bams/bams.c
// Function: bams_less
void *
bams_less(const BAMS * set, const void *key, size_t *key_num)
{
    SET_NODE *curr;
    size_t key_size;
    char *off;
    char *r = NULL;
    char *t;
    size_t less = 0;
    const void *tkey;

    assert(NULL != set);
    assert(NULL != key);
    assert(NULL != key_num);

    curr = set->head;
    key_size = set->key_size;

    if (set->type == COPY_POINTER) {
        POINTER_ADDR(key, tkey);
    }

    *key_num = 0;
    while (NULL != curr) {
        off = (char *) bisect_left(key, curr->keys, curr->length,
                                   key_size, set->compare);
        assert(off >= (char *) curr->keys);
        less = (size_t) ((off - (char *) curr->keys) / key_size);
        if (less > 0) {
            t = merge_into(r, *key_num, curr->keys, less,
                           key_size, set->compare);
            /*
             * free(r); 
             */
            r = t;
            *key_num += less;
        }
        curr = curr->next;
    }

    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, 0x8(%rsp)
testq %rdi, %rdi
je 0x2236
movq %rsi, %r13
testq %rsi, %rsi
je 0x2255
cmpq $0x0, 0x8(%rsp)
je 0x2274
movq %rdi, %r15
movq 0x10(%rdi), %rbx
cmpl $0x0, 0x20(%rdi)
jne 0x2184
leaq 0x10(%rsp), %rax
movq %r13, (%rax)
movq %rax, %r13
movq (%r15), %r12
movq 0x8(%rsp), %rax
movq $0x0, (%rax)
testq %rbx, %rbx
je 0x21fc
movq $0x0, (%rsp)
movq 0x8(%rsp), %r14
movq 0x8(%rbx), %rdx
movq 0x10(%rbx), %rsi
movq 0x8(%r15), %r8
movq %r13, %rdi
movq %r12, %rcx
callq 0x196d
movq 0x10(%rbx), %rcx
subq %rcx, %rax
jb 0x2217
cmpq %rax, %r12
ja 0x21f2
xorl %edx, %edx
divq %r12
movq %rax, %rbp
movq (%r14), %rsi
movq 0x8(%r15), %r9
movq (%rsp), %rdi
movq %rcx, %rdx
movq %rax, %rcx
movq %r12, %r8
callq 0x1805
movq %rax, (%rsp)
addq %rbp, (%r14)
movq (%rbx), %rbx
testq %rbx, %rbx
jne 0x21a5
jmp 0x2204
movq $0x0, (%rsp)
movq (%rsp), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x132b(%rip), %rdi      # 0x3549
leaq 0x1207(%rip), %rsi      # 0x342c
leaq 0x13ac(%rip), %rcx      # 0x35d8
movl $0x154, %edx            # imm = 0x154
callq 0x1050
leaq 0x1235(%rip), %rdi      # 0x3472
leaq 0x11e8(%rip), %rsi      # 0x342c
leaq 0x138d(%rip), %rcx      # 0x35d8
movl $0x145, %edx            # imm = 0x145
callq 0x1050
leaq 0x1248(%rip), %rdi      # 0x34a4
leaq 0x11c9(%rip), %rsi      # 0x342c
leaq 0x136e(%rip), %rcx      # 0x35d8
movl $0x146, %edx            # imm = 0x146
callq 0x1050
leaq 0x1393(%rip), %rdi      # 0x360e
leaq 0x11aa(%rip), %rsi      # 0x342c
leaq 0x134f(%rip), %rcx      # 0x35d8
movl $0x147, %edx            # imm = 0x147
callq 0x1050
// File: /workspace/github_c_makefile_star2_O1/JulStrat[P]bams/bams.c
// Function: bams_great
void *
bams_great(const BAMS * set, const void *key, size_t *key_num)
{
    SET_NODE *curr;
    size_t key_size;
    char *low, *high;
    char *r = NULL;
    char *t;
    size_t great = 0;
    const void *tkey;

    assert(NULL != set);
    assert(NULL != key);
    assert(NULL != key_num);

    curr = set->head;
    key_size = set->key_size;

    if (set->type == COPY_POINTER) {
        POINTER_ADDR(key, tkey);
    }

    *key_num = 0;
    while (NULL != curr) {
        low = (char *) bisect_right(key, curr->keys, curr->length,
                                    key_size, set->compare);
        high = (char *) curr->keys + curr->length * key_size;
        assert(high >= low);
        great = (size_t) ((high - low) / key_size);
        if (great > 0) {
            t = merge_into(r, *key_num, low, great,
                           key_size, set->compare);
            /*
             * free(r); 
             */
            r = t;
            *key_num += great;
        }
        curr = curr->next;
    }

    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, 0x8(%rsp)
testq %rdi, %rdi
je 0x2565
movq %rsi, %r13
testq %rsi, %rsi
je 0x2584
cmpq $0x0, 0x8(%rsp)
je 0x25a3
movq %rdi, %r15
movq 0x10(%rdi), %rbx
cmpl $0x0, 0x20(%rdi)
jne 0x24a8
leaq 0x10(%rsp), %rax
movq %r13, (%rax)
movq %rax, %r13
movq (%r15), %r12
movq 0x8(%rsp), %rax
movq $0x0, (%rax)
testq %rbx, %rbx
je 0x252b
movq $0x0, (%rsp)
movq 0x8(%rsp), %r14
movq 0x8(%rbx), %rdx
movq 0x10(%rbx), %rsi
movq 0x8(%r15), %r8
movq %r13, %rdi
movq %r12, %rcx
callq 0x1a3c
movq %rax, %rcx
movq 0x8(%rbx), %rax
imulq %r12, %rax
addq 0x10(%rbx), %rax
subq %rcx, %rax
jb 0x2546
cmpq %rax, %r12
ja 0x2521
xorl %edx, %edx
divq %r12
movq %rax, %rbp
movq (%r14), %rsi
movq 0x8(%r15), %r9
movq (%rsp), %rdi
movq %rcx, %rdx
movq %rax, %rcx
movq %r12, %r8
callq 0x1805
movq %rax, (%rsp)
addq %rbp, (%r14)
movq (%rbx), %rbx
testq %rbx, %rbx
jne 0x24c9
jmp 0x2533
movq $0x0, (%rsp)
movq (%rsp), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x104b(%rip), %rdi      # 0x3598
leaq 0xed8(%rip), %rsi       # 0x342c
leaq 0x1104(%rip), %rcx      # 0x365f
movl $0x1aa, %edx            # imm = 0x1AA
callq 0x1050
leaq 0xf06(%rip), %rdi       # 0x3472
leaq 0xeb9(%rip), %rsi       # 0x342c
leaq 0x10e5(%rip), %rcx      # 0x365f
movl $0x19a, %edx            # imm = 0x19A
callq 0x1050
leaq 0xf19(%rip), %rdi       # 0x34a4
leaq 0xe9a(%rip), %rsi       # 0x342c
leaq 0x10c6(%rip), %rcx      # 0x365f
movl $0x19b, %edx            # imm = 0x19B
callq 0x1050
leaq 0x1064(%rip), %rdi      # 0x360e
leaq 0xe7b(%rip), %rsi       # 0x342c
leaq 0x10a7(%rip), %rcx      # 0x365f
movl $0x19c, %edx            # imm = 0x19C
callq 0x1050
// File: /workspace/github_c_makefile_star2_O1/JulStrat[P]bams/bams.c
// Function: bams_array
void *
bams_array(const BAMS * set, size_t *key_num)
{
    SET_NODE *curr;
    char *r = NULL;
    char *t;

    assert(NULL != set);
    assert(NULL != key_num);

    curr = set->head;
    *key_num = 0;
    while (NULL != curr) {
        t = merge_into(r, *key_num, curr->keys, curr->length,
                       set->key_size, set->compare);
        /*
         * free(r); 
         */
        r = t;
        *key_num += curr->length;
        curr = curr->next;
    }

    return r;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x2615
movq %rsi, %rbx
testq %rsi, %rsi
je 0x2634
movq %rdi, %r14
movq 0x10(%rdi), %r15
movq $0x0, (%rbx)
xorl %eax, %eax
testq %r15, %r15
je 0x260f
movq (%rbx), %rsi
movq 0x8(%r15), %rcx
movq 0x10(%r15), %rdx
movq (%r14), %r8
movq 0x8(%r14), %r9
movq %rax, %rdi
callq 0x1805
movq 0x8(%r15), %rcx
addq %rcx, (%rbx)
movq (%r15), %r15
jmp 0x25e4
popq %rbx
popq %r14
popq %r15
retq
leaq 0xe56(%rip), %rdi       # 0x3472
leaq 0xe09(%rip), %rsi       # 0x342c
leaq 0x106c(%rip), %rcx      # 0x3696
movl $0x1c2, %edx            # imm = 0x1C2
callq 0x1050
leaq 0xfd3(%rip), %rdi       # 0x360e
leaq 0xdea(%rip), %rsi       # 0x342c
leaq 0x104d(%rip), %rcx      # 0x3696
movl $0x1c3, %edx            # imm = 0x1C3
callq 0x1050
// File: /workspace/github_c_makefile_star2_O1/JulStrat[P]bams/bams.c
// Function: bams_clear
void
bams_clear(BAMS * set)
{
    SET_NODE *curr;
    SET_NODE *next;

    assert(NULL != set);

    curr = set->head;
    while (NULL != curr) {
        next = curr->next;
        free(curr->keys);
        free(curr);
        curr = next;
    }
    set->head = NULL;
    set->size = 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x26bf
movq %rdi, %rbx
movq 0x10(%rdi), %r14
addq $0x10, %rbx
testq %r14, %r14
je 0x26b3
movq (%r14), %r15
movq 0x10(%r14), %rdi
callq 0x1030
movq %r14, %rdi
callq 0x1030
movq %r15, %r14
testq %r15, %r15
jne 0x2697
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
popq %rbx
popq %r14
popq %r15
retq
leaq 0xdac(%rip), %rdi       # 0x3472
leaq 0xd5f(%rip), %rsi       # 0x342c
leaq 0x100a(%rip), %rcx      # 0x36de
movl $0x1e3, %edx            # imm = 0x1E3
callq 0x1050
// File: /workspace/github_c_makefile_star2_O1/JulStrat[P]bams/bams.c
// Function: bams_free
void
bams_free(BAMS * set)
{
    SET_NODE *curr;
    SET_NODE *next;

    assert(NULL != set);

    curr = set->head;
    while (NULL != curr) {
        next = curr->next;
        free(curr->keys);
        free(curr);
        curr = next;
    }
    free(set);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x271d
movq %rdi, %rbx
movq 0x10(%rdi), %r14
testq %r14, %r14
je 0x2710
movq (%r14), %r15
movq 0x10(%r14), %rdi
callq 0x1030
movq %r14, %rdi
callq 0x1030
movq %r15, %r14
testq %r15, %r15
jne 0x26f4
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x1030
leaq 0xd4e(%rip), %rdi       # 0x3472
leaq 0xd01(%rip), %rsi       # 0x342c
leaq 0xfc4(%rip), %rcx       # 0x36f6
movl $0x1f6, %edx            # imm = 0x1F6
callq 0x1050
// File: /workspace/github_c_makefile_star2_O1/JulStrat[P]bams/bams.c
// Function: bams_check_structure
int
bams_check_structure(const BAMS * set)
{
    SET_NODE *curr;
    char *off;

    size_t set_size = 0;
    size_t node_len = 0;
    size_t key_size;

    assert(NULL != set);

    curr = set->head;
    key_size = set->key_size;

    while (NULL != curr) {
        if ((node_len >= curr->length) || (0 == curr->length)) {
            return 1;
        }
        /*
         * check if node length is power of two 
         */
        node_len = curr->length;
        /*
         * printf("node len: %d\n", node_len); 
         */
        while (0 == (node_len & 1)) {
            node_len >>= 1;
        }
        if (node_len > 1) {
            return 2;
        }
        node_len = curr->length;
        set_size += node_len;

        /*
         * check current node keys 
         */
        off = (char *) (curr->keys);
        while (node_len-- > 1) {
            if ((set->compare) (off, off + key_size) > 0) {
                return 3;
            }
            off += key_size;
        }

        curr = curr->next;
    }
    if (set_size != set->size) {
        return 4;
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x27e5
movq %rdi, %rbx
movq 0x10(%rdi), %r12
testq %r12, %r12
je 0x27b9
movq (%rbx), %r13
xorl %r15d, %r15d
movq 0x8(%r12), %rbp
testq %rbp, %rbp
je 0x27d7
movq %rbp, %rax
movq %rax, %rcx
shrq %rax
testb $0x1, %cl
je 0x276f
cmpq $0x1, %rcx
ja 0x27de
addq %rbp, %r15
movq 0x10(%r12), %rdi
incq %rbp
decq %rbp
cmpq $0x2, %rbp
jb 0x27a7
leaq (%rdi,%r13), %r14
movq %r14, %rsi
callq *0x8(%rbx)
movq %r14, %rdi
testl %eax, %eax
jle 0x278b
jmp 0x27b2
movq (%r12), %r12
testq %r12, %r12
jne 0x2762
jmp 0x27bc
movl $0x3, %eax
jmp 0x27c8
xorl %r15d, %r15d
xorl %eax, %eax
cmpq 0x18(%rbx), %r15
setne %al
shll $0x2, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %eax
jmp 0x27c8
movl $0x2, %eax
jmp 0x27c8
leaq 0xc86(%rip), %rdi       # 0x3472
leaq 0xc39(%rip), %rsi       # 0x342c
leaq 0xf13(%rip), %rcx       # 0x370d
movl $0x20c, %edx            # imm = 0x20C
callq 0x1050
// File: /workspace/github_c_makefile_star2_O1/phluid61[P]hsf/src/key.c
// Function: SH_Key__init
SH_Key*
SH_Key__init(sh_char_t* value, size_t n, int* err) {
	SH_Key* obj;
	sh_char_t* ptr;
	sh_char_t  c;
	size_t m;

	__cascade(err, (SH_Key*)0);

	if (n < 1 || n > SH_KEY_LENGTH_MAX) {
		__raise(err, SH_E_KEY_TOO_LONG);
		return (SH_Key*)0;
	}

	if (*value < (sh_char_t)'a' || *value > (sh_char_t)'z') {
		__raise(err, SH_E_KEY_BAD_CHAR);
		return (SH_Key*)0;
	}

	ptr = value;
	m = 0;
	while (m < n) {
		c = *ptr;
		if (
				(c >= (sh_char_t)'a' && c <= (sh_char_t)'z') ||
				(c >= (sh_char_t)'0' && c <= (sh_char_t)'9') ||
				 c == (sh_char_t)'_' || c == (sh_char_t)'-' || c == (sh_char_t)'*') {
			ptr++;
			m++;
		} else {
			__raise(err, SH_E_KEY_BAD_CHAR);
			return (SH_Key*)0;
		}
	}

	obj = (SH_Key*)malloc(sizeof(SH_Key));
	if ((SH_Key*)0 == obj) {
		__raise(err, SH_E_MALLOC_ERROR);
		return (SH_Key*)0;
	}

	obj->value = (sh_char_t*)calloc(sizeof(sh_char_t), m + 1);
	if ((sh_char_t*)0 == obj->value) {
		free(obj);
		__raise(err, SH_E_MALLOC_ERROR);
		return (SH_Key*)0;
	}

	memcpy((void*)obj->value, (const void*)value, m);
	obj->length = m;

	__clear(err);
	return obj;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
testq %rdx, %rdx
je 0x115f
cmpl $0x0, (%rbx)
je 0x115f
xorl %r12d, %r12d
jmp 0x1223
leaq -0x41(%r14), %rax
cmpq $-0x41, %rax
ja 0x1173
movl $0x200001, %eax         # imm = 0x200001
jmp 0x1219
movb (%r15), %al
addb $-0x7b, %al
cmpb $-0x1a, %al
jae 0x1186
movl $0x200002, %eax         # imm = 0x200002
jmp 0x1219
testq %r14, %r14
je 0x11d1
xorl %eax, %eax
movabsq $0x20000000000009, %rcx # imm = 0x20000000000009
movb (%r15,%rax), %dl
leal -0x61(%rdx), %esi
cmpb $0x1a, %sil
setb %sil
leal -0x30(%rdx), %edi
cmpb $0xa, %dil
setb %dil
orb %sil, %dil
jne 0x11c7
movzbl %dl, %edx
addl $-0x2a, %edx
cmpl $0x35, %edx
ja 0x117c
btq %rdx, %rcx
jae 0x117c
incq %rax
cmpq %rax, %r14
jne 0x1197
jmp 0x11d4
xorl %r14d, %r14d
movl $0x10, %edi
callq 0x1060
testq %rax, %rax
je 0x1214
movq %rax, %r12
leaq 0x1(%r14), %rsi
movl $0x1, %edi
callq 0x1040
movq %rax, (%r12)
testq %rax, %rax
je 0x1232
movq %rax, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x1050
xorl %eax, %eax
movq %r14, 0x8(%r12)
jmp 0x121c
movl $0x80000001, %eax       # imm = 0x80000001
xorl %r12d, %r12d
testq %rbx, %rbx
je 0x1223
movl %eax, (%rbx)
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %r12, %rdi
callq 0x1030
xorl %r12d, %r12d
movl $0x80000001, %eax       # imm = 0x80000001
jmp 0x121c
// File: /workspace/github_c_makefile_star2_O1/phluid61[P]hsf/src/key.c
// Function: SH_Key__destroy
void
SH_Key__destroy(SH_Key* obj, int* err) {
	__cascade(err,);
	if ((sh_char_t*)0 != obj->value) {
		free(obj->value);
	}
	free(obj);
	__clear(err);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
testq %rsi, %rsi
je 0x1258
cmpl $0x0, (%rbx)
jne 0x1278
movq (%r14), %rdi
testq %rdi, %rdi
je 0x1265
callq 0x1030
movq %r14, %rdi
callq 0x1030
testq %rbx, %rbx
je 0x1278
movl $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/phluid61[P]hsf/src/key.c
// Function: SH_Key__hash
uint8_t
SH_Key__hash(SH_Key* obj, int* err) {
	size_t buflen;
	uint8_t* ptr;
	uint8_t hsh = UINT8_C(1);

	__cascade(err, UINT8_C(0));

	buflen = obj->length; /* assumes sizeof(uint8_t) and sizeof(sh_char_t) are both 1 */
	ptr = (uint8_t*)(obj->value);

	for (; buflen > 0; buflen--) {
		hsh = (hsh << 3) | (hsh >> 5);
		hsh ^= (uint8_t)*ptr;
		ptr++;
	}

	__clear(err);
	return hsh;
}

// Assembly:
testq %rsi, %rsi
je 0x128d
cmpl $0x0, (%rsi)
je 0x128d
xorl %eax, %eax
retq
movq 0x8(%rdi), %rcx
testq %rcx, %rcx
je 0x12ad
movq (%rdi), %rdx
movb $0x1, %al
xorl %edi, %edi
rolb $0x3, %al
xorb (%rdx,%rdi), %al
incq %rdi
cmpq %rdi, %rcx
jne 0x129d
jmp 0x12af
movb $0x1, %al
testq %rsi, %rsi
je 0x128c
movl $0x0, (%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/phluid61[P]hsf/src/key.c
// Function: SH_Key__equal
sh_bool_t
SH_Key__equal(SH_Key* obj, SH_Key* other, int* err) {
	size_t i;

	__cascade(err, SH_FALSE);

	if (obj->length != other->length) {
		__clear(err);
		return SH_FALSE;
	}

	for (i = 0; i < obj->length; i++) {
		if (obj->value[i] != other->value[i]) {
			__clear(err);
			return SH_FALSE;
		}
	}

	__clear(err);
	return SH_TRUE;
}

// Assembly:
testq %rdx, %rdx
je 0x12c8
cmpl $0x0, (%rdx)
je 0x12c8
xorl %eax, %eax
retq
movq 0x8(%rdi), %rax
cmpq 0x8(%rsi), %rax
jne 0x12f5
testq %rax, %rax
je 0x12f1
movq (%rdi), %rcx
movq (%rsi), %rsi
xorl %edi, %edi
movb (%rcx,%rdi), %r8b
cmpb (%rsi,%rdi), %r8b
jne 0x12f5
incq %rdi
cmpq %rdi, %rax
jne 0x12df
movb $-0x1, %al
jmp 0x12f7
xorl %eax, %eax
testq %rdx, %rdx
je 0x12c7
movl $0x0, (%rdx)
retq
// File: /workspace/github_c_makefile_star2_O1/phluid61[P]hsf/src/key.c
// Function: SH_Key__to_s
sh_char_t*
SH_Key__to_s(SH_Key* obj, int* err) {
	sh_char_t* str;

	__cascade(err, (sh_char_t*)0);

	str = (sh_char_t*)malloc(sizeof(sh_char_t) * (obj->length + 1)); /*FIXME*/
	if ((sh_char_t*)0 == str) {
		__raise(err, SH_E_MALLOC_ERROR);
		return (sh_char_t*)0;
	}

	memcpy((void*)str, (const void*)(obj->value), obj->length + 1);

	__clear(err);
	return str;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r15
testq %rsi, %rsi
je 0x1320
cmpl $0x0, (%rbx)
je 0x1320
xorl %r14d, %r14d
jmp 0x1358
movq 0x8(%r15), %r12
incq %r12
movq %r12, %rdi
callq 0x1060
testq %rax, %rax
je 0x1349
movq %rax, %r14
movq (%r15), %rsi
movq %rax, %rdi
movq %r12, %rdx
callq 0x1050
xorl %eax, %eax
jmp 0x1351
movl $0x80000001, %eax       # imm = 0x80000001
xorl %r14d, %r14d
testq %rbx, %rbx
je 0x1358
movl %eax, (%rbx)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq