LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/nilesr[P]dotter/dotter.c
// Function: correct
void correct(box_t* box, int width, int height, int radius) {
   if (box->x1 < 0) {
      box->x2 += -box->x1;
      box->x1 += -box->x1;
   }
   if (box->y1 < 0) {
      box->y2 += -box->y1;
      box->y1 += -box->y1;
   }
   if (box->y2 > height) {
      box->y2 -= radius * 2;
      box->y1 -= radius * 2;
   }
   if (box->x2 > width) {
      box->x2 -= radius * 2;
      box->x1 -= radius * 2;
   }
}

// Assembly:
movl (%rdi), %eax
testl %eax, %eax
jns 0x4d03
subl %eax, 0x8(%rdi)
movl $0x0, (%rdi)
xorl %eax, %eax
movl 0x4(%rdi), %r8d
movl 0xc(%rdi), %r9d
testl %r8d, %r8d
jns 0x4d21
subl %r8d, %r9d
movl %r9d, 0xc(%rdi)
movl $0x0, 0x4(%rdi)
xorl %r8d, %r8d
cmpl %edx, %r9d
jle 0x4d37
leal (%rcx,%rcx), %edx
subl %edx, %r9d
movl %r9d, 0xc(%rdi)
subl %edx, %r8d
movl %r8d, 0x4(%rdi)
movl 0x8(%rdi), %edx
cmpl %esi, %edx
jle 0x4d49
addl %ecx, %ecx
subl %ecx, %edx
movl %edx, 0x8(%rdi)
subl %ecx, %eax
movl %eax, (%rdi)
retq
// File: /workspace/github_c_makefile_star2_O3/nilesr[P]dotter/dotter.c
// Function: draw
void draw(uint8_t* image, box_t box, uint8_t* color, int width, int radius) {
   // Center coordinates of the circle
   int cx = box.x1 + ((box.x2 - box.x1)/2);
   int cy = box.y1 + ((box.y2 - box.y1)/2);
   // For each pixel
   for (int x = box.x1; x < box.x2; x++) {
      for (int y = box.y1; y < box.y2; y++) {
         // If it's inside the circle, copy the color to that pixel
         if (sqrt(square(x - cx) + square(y - cy)) <= radius) {
            uint8_t* pixel = getpixel(image, x, y, width);
            memcpy(pixel, color, 3);
         }
      }
   }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %edx, %ebx
subl %esi, %ebx
jle 0x4e21
movq %rdx, %rax
shrq $0x20, %rax
movq %rsi, %r10
shrq $0x20, %r10
movl %eax, %r11d
subl %r10d, %r11d
movl %r11d, %ebp
shrl $0x1f, %ebp
addl %r11d, %ebp
sarl %ebp
movl %ebx, %r11d
shrl $0x1f, %r11d
addl %ebx, %r11d
sarl %r11d
addl %esi, %r11d
negl %r11d
cvtsi2sd %r9d, %xmm0
movq %rsi, %rbx
sarq $0x20, %rbx
movslq %r8d, %r14
movslq %esi, %rsi
movslq %edx, %r8
sarq $0x20, %rdx
movl %ebx, %r9d
subq %rbx, %rdx
imulq %r14, %rbx
addq %rsi, %rbx
leaq (%rbx,%rbx,2), %rbx
addq %rbx, %rdi
leaq (%r14,%r14,2), %rbx
subl %ebp, %r9d
subl %r10d, %r9d
cmpl %r10d, %eax
jle 0x4e15
leal (%r11,%rsi), %ebp
imull %ebp, %ebp
movq %rdx, %r14
movl %r9d, %r15d
movq %rdi, %r12
movl %r15d, %r13d
imull %r15d, %r13d
addl %ebp, %r13d
xorps %xmm1, %xmm1
cvtsi2sd %r13d, %xmm1
sqrtsd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x4e0a
movb 0x2(%rcx), %r13b
movb %r13b, 0x2(%r12)
movzwl (%rcx), %r13d
movw %r13w, (%r12)
addq %rbx, %r12
incl %r15d
decq %r14
jne 0x4ddc
incq %rsi
addq $0x3, %rdi
cmpq %r8, %rsi
jne 0x4dc7
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/tests/mux/main.c
// Function: main
int
main(int argc, char * argv[])
{
	struct wire_requestqueue * Q;
	struct kivaloo_cookie * K;

	WARNP_INIT;

	/* Check number of arguments. */
	if (argc != 3) {
		fprintf(stderr, "usage: test_mux %s %s\n",
		    "<socketname>", "{ping | pong | <prefix>}");
		exit(1);
	}

	/* Open a connection to MUX. */
	if ((K = kivaloo_open(argv[1], &Q)) == NULL) {
		warnp("Could not connecto to MUX daemon.");
		exit(1);
	}

	if (strcmp(argv[2], "ping") == 0) {
		if (pingpong(Q, "pingpong", "ping", "pong", 1))
			exit(1);
	} else if (strcmp(argv[2], "pong") == 0) {
		if (pingpong(Q, "pingpong", "pong", "ping", 0))
			exit(1);
	} else if (strcmp(argv[2], "loop") == 0) {
		/* Repeatedly create/read/delete 10^4 pairs until we die. */
		do {
			if (createmany(Q, 10000, argv[2]))
				exit(1);
		} while (1);
	} else {
		/* Test creating 10000 pairs and reading them back. */
		if (createmany(Q, 10000, argv[2]))
			exit(1);
	}

	/* Free the request queue and network connection. */
	kivaloo_close(K);

	/* Success! */
	exit(0);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movl %edi, %ebx
movq (%rsi), %rdi
testq %rdi, %rdi
je 0x2567
callq 0x446c
cmpl $0x3, %ebx
jne 0x2599
movq 0x8(%r14), %rdi
leaq 0x8(%rsp), %rsi
callq 0x668c
testq %rax, %rax
jne 0x25c9
callq 0x2090
cmpl $0x0, (%rax)
jne 0x25fd
leaq 0x8ab1(%rip), %rdi      # 0xb041
xorl %eax, %eax
callq 0x460b
jmp 0x25bf
movq 0xea58(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
leaq 0x8a5a(%rip), %rsi      # 0xb004
leaq 0x8a6a(%rip), %rdx      # 0xb01b
leaq 0x8a70(%rip), %rcx      # 0xb028
xorl %eax, %eax
callq 0x21c0
movl $0x1, %edi
callq 0x22b0
movq %rax, %rbx
movq 0x10(%r14), %r15
leaq 0x8a8c(%rip), %rsi      # 0xb063
movq %r15, %rdi
callq 0x21b0
testl %eax, %eax
jne 0x2616
movq 0x8(%rsp), %rdi
leaq 0x8a74(%rip), %rsi      # 0xb063
leaq 0x8a76(%rip), %rdx      # 0xb06c
movl $0x1, %ecx
jmp 0x263e
movq %rax, %rbx
leaq 0x8a3a(%rip), %rdi      # 0xb041
xorl %eax, %eax
callq 0x44ec
movl $0x0, (%rbx)
jmp 0x25bf
leaq 0x8a4f(%rip), %rsi      # 0xb06c
movq %r15, %rdi
callq 0x21b0
testl %eax, %eax
jne 0x265a
movq 0x8(%rsp), %rdi
leaq 0x8a37(%rip), %rsi      # 0xb06c
leaq 0x8a27(%rip), %rdx      # 0xb063
xorl %ecx, %ecx
callq 0x2693
testl %eax, %eax
jne 0x25bf
movq %rbx, %rdi
callq 0x67d5
xorl %edi, %edi
callq 0x22b0
leaq 0x8a10(%rip), %rsi      # 0xb071
movq %r15, %rdi
callq 0x21b0
testl %eax, %eax
jne 0x2684
movq 0x8(%rsp), %rdi
movq 0x10(%r14), %rsi
callq 0x294f
testl %eax, %eax
je 0x266d
jmp 0x25bf
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x294f
jmp 0x2643
// File: /workspace/github_c_makefile_star2_O3/antonblanchard[P]will-it-scale/tests/poll1.c
// Function: testcase
void testcase(unsigned long long *iterations, unsigned long nr)
{
	char tmpfile[] = "/tmp/willitscale.XXXXXX";
	int fd = mkstemp(tmpfile);

	assert(fd >= 0);
	unlink(tmpfile);

	while (1) {
		struct pollfd pfd[1];

		memset(&pfd, 0, sizeof(pfd));
		pfd[0].fd = fd;
		pfd[0].events = POLLOUT;

		assert(poll(pfd, 1, 0) >= 0);

		(*iterations)++;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movaps 0x5fc(%rip), %xmm0      # 0x2300
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
movabsq $0x5858585858582e, %rax # imm = 0x5858585858582E
movq %rax, 0x10(%rdi)
callq 0x11e0
testl %eax, %eax
js 0x1d96
movl %eax, %ebp
movabsq $0x400000000, %r15      # imm = 0x400000000
leaq 0x10(%rsp), %rdi
callq 0x1080
leaq 0x8(%rsp), %rdi
movq %r15, (%rdi)
movl %ebp, (%rdi)
movl $0x1, %esi
xorl %edx, %edx
callq 0x11f0
testl %eax, %eax
js 0x1d77
leaq 0x8(%rsp), %r14
incq (%rbx)
movq %r15, 0x8(%rsp)
movl %ebp, 0x8(%rsp)
movl $0x1, %esi
movq %r14, %rdi
xorl %edx, %edx
callq 0x11f0
testl %eax, %eax
jns 0x1d58
leaq 0x560(%rip), %rdi       # 0x22de
leaq 0x518(%rip), %rsi       # 0x229d
leaq 0x51f(%rip), %rcx       # 0x22ab
movl $0x18, %edx
callq 0x1130
leaq 0x4f8(%rip), %rdi       # 0x2295
leaq 0x4f9(%rip), %rsi       # 0x229d
leaq 0x500(%rip), %rcx       # 0x22ab
movl $0xe, %edx
callq 0x1130
// File: /workspace/github_c_makefile_star2_O3/johanDa9u[P]MiniShell/src/shell.c
// Function: pop
int pop()
{
	int data;

	if (isempty() == 0)
	{
		data = stack[top];
		top = top - 1;
		return data;
	}
	else
	{
		printf("Could not retrieve process, Stack is empty.\n");
		return -127;
	}
}

// Assembly:
movslq 0x5a62(%rip), %rcx      # 0x8304
cmpq $-0x1, %rcx
je 0x28bb
leaq 0x5a81(%rip), %rax      # 0x8330
movl (%rax,%rcx,4), %eax
decl %ecx
movl %ecx, 0x5a4a(%rip)      # 0x8304
retq
pushq %rax
movl $0x0, 0x5a5e(%rip)      # 0x8324
leaq 0x2808(%rip), %rdi      # 0x50d5
callq 0x20c0
movl $0xffffff81, %eax       # imm = 0xFFFFFF81
addq $0x8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O3/johanDa9u[P]MiniShell/src/shell.c
// Function: push
int push(int data)
{

	if (isfull() == 0)
	{
		top = top + 1;
		stack[top] = data;
		return 0;
	}
	else
	{
		printf("Could not insert job, Stack is full.\n");
		return -128;
	}
}

// Assembly:
movslq 0x5a21(%rip), %rax      # 0x8304
cmpl 0x5a17(%rip), %eax      # 0x8300
jne 0x2902
pushq %rax
leaq 0x280e(%rip), %rdi      # 0x5101
callq 0x20c0
movl $0xffffff80, %eax       # imm = 0xFFFFFF80
addq $0x8, %rsp
retq
leaq 0x1(%rax), %rcx
movl %ecx, 0x59f8(%rip)      # 0x8304
leaq 0x5a1d(%rip), %rcx      # 0x8330
movl %edi, 0x4(%rcx,%rax,4)
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/johanDa9u[P]MiniShell/src/shell.c
// Function: handle_stp
void handle_stp(int sig)
{
	waitpid(-1, &status, WNOHANG);
	if (((child_pid != 0) && (kill(child_pid, 0) == 0)))
	{
		Kill(child_pid, SIGTSTP);
		push(child_pid);
		suspendedJobs = 1;
	}
}

// Assembly:
pushq %rax
leaq 0x5903(%rip), %rsi      # 0x8320
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x1, %edx
callq 0x2410
movl 0x60d2(%rip), %edi      # 0x8b04
testl %edi, %edi
je 0x2a93
xorl %esi, %esi
callq 0x2300
testl %eax, %eax
jne 0x2a93
movl 0x60bd(%rip), %edi      # 0x8b04
movl $0x14, %esi
callq 0x3689
movslq 0x58ac(%rip), %rax      # 0x8304
cmpl 0x58a2(%rip), %eax      # 0x8300
jne 0x2a6e
leaq 0x269a(%rip), %rdi      # 0x5101
callq 0x20c0
jmp 0x2a89
movl 0x6090(%rip), %ecx      # 0x8b04
leaq 0x1(%rax), %rdx
movl %edx, 0x5886(%rip)      # 0x8304
leaq 0x58ab(%rip), %rdx      # 0x8330
movl %ecx, 0x4(%rdx,%rax,4)
movl $0x1, 0x5891(%rip)      # 0x8324
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O3/johanDa9u[P]MiniShell/src/shell.c
// Function: to_stop
void to_stop()
{
	if (isempty() != 1)
	{
		Kill(pop(), SIGTERM);
	}
	if (top == -1)
	{
		suspendedJobs = 0;
	}
}

// Assembly:
movslq 0x581b(%rip), %rax      # 0x8304
cmpq $-0x1, %rax
je 0x2b1b
pushq %rax
leaq 0x5839(%rip), %rcx      # 0x8330
movl (%rcx,%rax,4), %edi
decl %eax
movl %eax, 0x5802(%rip)      # 0x8304
movl $0xf, %esi
callq 0x3689
cmpl $-0x1, 0x57f1(%rip)     # 0x8304
leaq 0x8(%rsp), %rsp
je 0x2b25
retq
movl $0x0, 0x57ff(%rip)      # 0x8324
movl $0x0, 0x57f5(%rip)      # 0x8324
retq
// File: /workspace/github_c_makefile_star2_O3/johanDa9u[P]MiniShell/src/shell.c
// Function: quit
void quit()
{
	if (isempty() != 1)
	{
		puts("\n Il y a des processus arretés.");
		usleep(10000);
	}
	else
	{
		exit(0);
	}
}

// Assembly:
pushq %rax
cmpl $-0x1, 0x5781(%rip)     # 0x8304
je 0x2b9c
leaq 0x24a9(%rip), %rdi      # 0x5035
callq 0x20c0
movl $0x2710, %edi           # imm = 0x2710
popq %rax
jmp 0x25b0
movl $0x0, 0x577e(%rip)      # 0x8324
xorl %edi, %edi
callq 0x24e0
// File: /workspace/github_c_makefile_star2_O3/johanDa9u[P]MiniShell/src/readcmd.c
// Function: freeseq
static void freeseq(char ***seq)
{
	int i, j;

	for (i=0; seq[i]!=0; i++) {
		char **cmd = seq[i];

		for (j=0; cmd[j]!=0; j++) free(cmd[j]);
		free(cmd);
	}
	free(seq);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %r14
testq %r14, %r14
je 0x350d
xorl %r15d, %r15d
movq (%r14), %rdi
testq %rdi, %rdi
je 0x34f8
leaq 0x8(%r14), %r12
callq 0x2050
movq (%r12), %rdi
addq $0x8, %r12
testq %rdi, %rdi
jne 0x34e6
movq %r14, %rdi
callq 0x2050
movq 0x8(%rbx,%r15,8), %r14
incq %r15
testq %r14, %r14
jne 0x34da
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2050
// File: /workspace/github_c_makefile_star2_O3/johanDa9u[P]MiniShell/src/csapp.c
// Function: Signal
handler_t *Signal(int signum, handler_t *handler) 
{
    struct sigaction action, old_action;

    action.sa_handler = handler;  
    sigemptyset(&action.sa_mask); /* Block sigs of type being handled */
    action.sa_flags = SA_RESTART; /* Restart syscalls if possible */

    if (sigaction(signum, &action, &old_action) < 0)
	unix_error("Signal error");
    return (old_action.sa_handler);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movl %edi, %ebx
leaq 0xa8(%rsp), %r14
movq %rsi, -0x8(%r14)
movq %r14, %rdi
callq 0x22a0
movl $0x10000000, 0x80(%r14) # imm = 0x10000000
leaq 0xa0(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movl %ebx, %edi
callq 0x20e0
testl %eax, %eax
js 0x3720
movq 0x8(%rsp), %rax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r14
retq
leaq 0x1af7(%rip), %rdi      # 0x521e
callq 0x3540
// File: /workspace/github_c_makefile_star2_O3/johanDa9u[P]MiniShell/src/csapp.c
// Function: Sigsuspend
int Sigsuspend(const sigset_t *set)
{
    int rc = sigsuspend(set); /* always returns -1 */
    if (errno != EINTR)
        unix_error("Sigsuspend error");
    return rc;
}

// Assembly:
pushq %rbx
callq 0x2390
movl %eax, %ebx
callq 0x2070
cmpl $0x4, (%rax)
jne 0x37d2
movl %ebx, %eax
popq %rbx
retq
leaq 0x1ab9(%rip), %rdi      # 0x5292
callq 0x3540
// File: /workspace/github_c_makefile_star2_O3/johanDa9u[P]MiniShell/src/csapp.c
// Function: Sio_putl
ssize_t Sio_putl(long v)
{
    ssize_t n;
  
    if ((n = sio_putl(v)) < 0)
	sio_error("Sio_putl error");
    return n;
}

// Assembly:
pushq %rax
callq 0x37fd
testq %rax, %rax
js 0x38d1
popq %rcx
retq
leaq 0x19cb(%rip), %rdi      # 0x52a3
callq 0x37de
movl $0x1, %edi
callq 0x20a0
// File: /workspace/github_c_makefile_star2_O3/johanDa9u[P]MiniShell/src/csapp.c
// Function: Sio_puts
ssize_t Sio_puts(char s[])
{
    ssize_t n;
  
    if ((n = sio_puts(s)) < 0)
	sio_error("Sio_puts error");
    return n;
}

// Assembly:
pushq %rax
movq %rdi, %rsi
movq $-0x1, %rdx
cmpb $0x0, 0x1(%rsi,%rdx)
leaq 0x1(%rdx), %rdx
jne 0x38f2
movl $0x1, %edi
callq 0x2110
testq %rax, %rax
js 0x390e
popq %rcx
retq
leaq 0x199d(%rip), %rdi      # 0x52b2
callq 0x37de
movl $0x1, %edi
callq 0x20a0
// File: /workspace/github_c_makefile_star2_O3/johanDa9u[P]MiniShell/src/csapp.c
// Function: Opendir
DIR *Opendir(const char *name) 
{
    DIR *dirp = opendir(name); 

    if (!dirp)
        unix_error("opendir error");
    return dirp;
}

// Assembly:
pushq %rax
callq 0x2140
testq %rax, %rax
je 0x3a1e
popq %rcx
retq
leaq 0x1905(%rip), %rdi      # 0x532a
callq 0x3540
// File: /workspace/github_c_makefile_star2_O3/johanDa9u[P]MiniShell/src/csapp.c
// Function: Readdir
struct dirent *Readdir(DIR *dirp)
{
    struct dirent *dep;
    
    errno = 0;
    dep = readdir(dirp);
    if ((dep == NULL) && (errno != 0))
        unix_error("readdir error");
    return dep;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
callq 0x2070
movq %rax, %rbx
movl $0x0, (%rax)
movq %r14, %rdi
callq 0x2320
testq %rax, %rax
jne 0x3a51
cmpl $0x0, (%rbx)
jne 0x3a59
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x18d8(%rip), %rdi      # 0x5338
callq 0x3540
// File: /workspace/github_c_makefile_star2_O3/johanDa9u[P]MiniShell/src/csapp.c
// Function: Getnameinfo
void Getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, 
                 size_t hostlen, char *serv, size_t servlen, int flags)
{
    int rc;

    if ((rc = getnameinfo(sa, salen, host, hostlen, serv, 
                          servlen, flags)) != 0) 
        gai_error(rc, "Getnameinfo error");
}

// Assembly:
pushq %rax
movl 0x10(%rsp), %eax
movl %eax, (%rsp)
callq 0x21f0
testl %eax, %eax
jne 0x3ca4
popq %rax
retq
leaq 0x17a4(%rip), %rsi      # 0x544f
movl %eax, %edi
callq 0x35af
// File: /workspace/github_c_makefile_star2_O3/johanDa9u[P]MiniShell/src/csapp.c
// Function: Inet_pton
void Inet_pton(int af, const char *src, void *dst) 
{
    int rc;

    rc = inet_pton(af, src, dst);
    if (rc == 0)
	app_error("inet_pton error: invalid dotted-decimal address");
    else if (rc < 0)
        unix_error("Inet_pton error");
}

// Assembly:
pushq %rax
callq 0x22f0
testl %eax, %eax
je 0x3cde
js 0x3ce3
popq %rax
retq
callq 0x2617
leaq 0x17b7(%rip), %rdi      # 0x54a1
callq 0x3540
// File: /workspace/github_c_makefile_star2_O3/johanDa9u[P]MiniShell/src/csapp.c
// Function: rio_readn
ssize_t rio_readn(int fd, void *usrbuf, size_t n) 
{
    size_t nleft = n;
    ssize_t nread;
    char *bufp = usrbuf;

    while (nleft > 0) {
	if ((nread = read(fd, bufp, nleft)) < 0) {
	    if (errno == EINTR) /* Interrupted by sig handler return */
		nread = 0;      /* and call read() again */
	    else
		return -1;      /* errno set by read() */ 
	} 
	else if (nread == 0)
	    break;              /* EOF */
	nleft -= nread;
	bufp += nread;
    }
    return (n - nleft);         /* Return >= 0 */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
testq %rdx, %rdx
je 0x3e14
movq %rsi, %r15
movl %edi, %ebp
movq %rbx, %r14
movl %ebp, %edi
movq %r15, %rsi
movq %r14, %rdx
callq 0x2220
testq %rax, %rax
js 0x3e00
jne 0x3e0c
jmp 0x3e17
callq 0x2070
cmpl $0x4, (%rax)
jne 0x3e28
xorl %eax, %eax
addq %rax, %r15
subq %rax, %r14
jne 0x3dea
xorl %r14d, %r14d
subq %r14, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq $-0x1, %rbx
jmp 0x3e1a
// File: /workspace/github_c_makefile_star2_O3/johanDa9u[P]MiniShell/src/csapp.c
// Function: rio_writen
ssize_t rio_writen(int fd, void *usrbuf, size_t n) 
{
    size_t nleft = n;
    ssize_t nwritten;
    char *bufp = usrbuf;

    while (nleft > 0) {
	if ((nwritten = write(fd, bufp, nleft)) <= 0) {
	    if (errno == EINTR)  /* Interrupted by sig handler return */
		nwritten = 0;    /* and call write() again */
	    else
		return -1;       /* errno set by write() */
	}
	nleft -= nwritten;
	bufp += nwritten;
    }
    return n;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdx, %rdx
je 0x3e70
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
movq %rdx, %r15
movl %ebp, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2110
testq %rax, %rax
jg 0x3e66
callq 0x2070
cmpl $0x4, (%rax)
jne 0x3e74
xorl %eax, %eax
addq %rax, %r14
subq %rax, %r15
jne 0x3e48
jmp 0x3e7b
xorl %ebx, %ebx
jmp 0x3e7b
movq $-0x1, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/johanDa9u[P]MiniShell/src/csapp.c
// Function: rio_readnb
ssize_t rio_readnb(rio_t *rp, void *usrbuf, size_t n) 
{
    size_t nleft = n;
    ssize_t nread;
    char *bufp = usrbuf;
    
    while (nleft > 0) {
	if ((nread = rio_read(rp, bufp, nleft)) < 0) 
            return -1;          /* errno set by read() */ 
	else if (nread == 0)
	    break;              /* EOF */
	nleft -= nread;
	bufp += nread;
    }
    return (n - nleft);         /* return >= 0 */
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
testq %rdx, %rdx
je 0x3ed1
movq %rsi, %r15
movq %rdi, %r12
movq %rbx, %r14
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x3eef
testq %rax, %rax
js 0x3ed9
je 0x3ed4
addq %rax, %r15
subq %rax, %r14
jne 0x3eb4
xorl %r14d, %r14d
subq %r14, %rbx
jmp 0x3ee0
movq $-0x1, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/johanDa9u[P]MiniShell/src/csapp.c
// Function: rio_read
static ssize_t rio_read(rio_t *rp, char *usrbuf, size_t n)
{
    int cnt;

    while (rp->rio_cnt <= 0) {  /* Refill if buf is empty */
	rp->rio_cnt = read(rp->rio_fd, rp->rio_buf, 
			   sizeof(rp->rio_buf));
	if (rp->rio_cnt < 0) {
	    if (errno != EINTR) /* Interrupted by sig handler return */
		return -1;
	}
	else if (rp->rio_cnt == 0)  /* EOF */
	    return 0;
	else 
	    rp->rio_bufptr = rp->rio_buf; /* Reset buffer ptr */
    }

    /* Copy min(n, rp->rio_cnt) bytes from internal buf to user buf */
    cnt = n;          
    if (rp->rio_cnt < n)   
	cnt = rp->rio_cnt;
    memcpy(usrbuf, rp->rio_bufptr, cnt);
    rp->rio_bufptr += cnt;
    rp->rio_cnt -= cnt;
    return cnt;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movl 0x4(%rdi), %eax
testl %eax, %eax
jle 0x3f39
movl %eax, %ecx
cmpq %r15, %rcx
cmovael %r15d, %eax
movq 0x8(%rbx), %rsi
movslq %eax, %r15
movq %r14, %rdi
movq %r15, %rdx
callq 0x22e0
addq %r15, 0x8(%rbx)
subl %r15d, 0x4(%rbx)
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x10(%rbx), %r12
movl (%rbx), %edi
movl $0x2000, %edx           # imm = 0x2000
movq %r12, %rsi
callq 0x2220
movl %eax, 0x4(%rbx)
testl %eax, %eax
jns 0x3f66
callq 0x2070
cmpl $0x4, (%rax)
je 0x3f3d
movq $-0x1, %r15
jmp 0x3f2a
je 0x3f6e
movq %r12, 0x8(%rbx)
jmp 0x3f07
xorl %r15d, %r15d
jmp 0x3f2a
// File: /workspace/github_c_makefile_star2_O3/johanDa9u[P]MiniShell/src/csapp.c
// Function: rio_readlineb
ssize_t rio_readlineb(rio_t *rp, void *usrbuf, size_t maxlen) 
{
    int n, rc;
    char c, *bufp = usrbuf;

    for (n = 1; n < maxlen; n++) { 
        if ((rc = rio_read(rp, &c, 1)) == 1) {
	    *bufp++ = c;
	    if (c == '\n') {
                n++;
     		break;
            }
	} else if (rc == 0) {
	    if (n == 1)
		return 0; /* EOF, no data read */
	    else
		break;    /* EOF, some data was read */
	} else
	    return -1;	  /* Error */
    }
    *bufp = 0;
    return n-1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movl $0x1, %r13d
cmpq $0x2, %rdx
jb 0x3ffa
movq %rdx, %r14
movq %rdi, %r15
movl $0x1, %eax
leaq 0xf(%rsp), %r12
movq %rax, %r13
movl $0x1, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x3eef
cmpq $0x1, %rax
jne 0x3fd0
movb 0xf(%rsp), %al
movb %al, -0x1(%rbx,%r13)
cmpb $0xa, %al
je 0x3fe8
leaq 0x1(%r13), %rax
cmpq %rax, %r14
jne 0x3f9f
jmp 0x3fec
testq %rax, %rax
jne 0x3fdf
cmpq $0x1, %r13
jne 0x3ff4
xorl %eax, %eax
jmp 0x4003
movq $-0x1, %rax
jmp 0x4003
leaq 0x1(%r13), %r14
addq %r13, %rbx
movq %r14, %r13
jmp 0x3ffa
addq %r13, %rbx
decq %rbx
movb $0x0, (%rbx)
decl %r13d
movslq %r13d, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/johanDa9u[P]MiniShell/src/csapp.c
// Function: open_clientfd
int open_clientfd(char *hostname, char *port) {
    int clientfd, rc;
    struct addrinfo hints, *listp, *p;

    /* Get a list of potential server addresses */
    memset(&hints, 0, sizeof(struct addrinfo));
    hints.ai_socktype = SOCK_STREAM;  /* Open a connection */
    hints.ai_flags = AI_NUMERICSERV;  /* ... using a numeric port arg. */
    hints.ai_flags |= AI_ADDRCONFIG;  /* Recommended for connections */
    if ((rc = getaddrinfo(hostname, port, &hints, &listp)) != 0) {
        fprintf(stderr, "getaddrinfo failed (%s:%s): %s\n", hostname, port, gai_strerror(rc));
        return -2;
    }
  
    /* Walk the list for one that we can successfully connect to */
    for (p = listp; p; p = p->ai_next) {
        /* Create a socket descriptor */
        if ((clientfd = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) < 0) 
            continue; /* Socket failed, try the next */

        /* Connect to the server */
        if (connect(clientfd, p->ai_addr, p->ai_addrlen) != -1) 
            break; /* Success */
        if (close(clientfd) < 0) { /* Connect failed, try another */  //line:netp:openclientfd:closefd
            fprintf(stderr, "open_clientfd: close failed: %s\n", strerror(errno));
            return -1;
        } 
    } 

    /* Clean up */
    freeaddrinfo(listp);
    if (!p) /* All connects failed */
        return -1;
    else    /* The last connect succeeded */
        return clientfd;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rsi, %rbx
movq %rdi, %r14
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdx
movaps %xmm0, (%rdx)
movaps %xmm0, 0x10(%rdx)
movaps %xmm0, 0x20(%rdx)
movl $0x1, 0x8(%rdx)
movl $0x420, (%rdx)          # imm = 0x420
leaq 0x8(%rsp), %rcx
callq 0x2510
testl %eax, %eax
jne 0x4134
movq 0x8(%rsp), %r14
testq %r14, %r14
je 0x411c
movl 0x4(%r14), %edi
movl 0x8(%r14), %esi
movl 0xc(%r14), %edx
callq 0x25d0
testl %eax, %eax
js 0x4107
movl %eax, %ebx
movq 0x18(%r14), %rsi
movl 0x10(%r14), %edx
movl %eax, %edi
callq 0x24f0
cmpl $-0x1, %eax
jne 0x4115
movl %ebx, %edi
callq 0x21d0
testl %eax, %eax
js 0x4166
movq 0x28(%r14), %r14
testq %r14, %r14
jne 0x40d1
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq 0x8(%rsp), %rdi
jmp 0x4123
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
xorl %edi, %edi
callq 0x25c0
movl %ebx, %eax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq 0x3ebd(%rip), %rcx      # 0x7ff8
movq (%rcx), %r15
movl %eax, %edi
callq 0x2190
leaq 0x1444(%rip), %rsi      # 0x5590
movq %r15, %rdi
movq %r14, %rdx
movq %rbx, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x2290
movl $0xfffffffe, %ebx       # imm = 0xFFFFFFFE
jmp 0x4128
callq 0x268c
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x4128
// File: /workspace/github_c_makefile_star2_O3/teodorst[P]app-huffman/priority_queue.c
// Function: push
void push(heap_t *heap, node_t* new_node) {
	if (heap->len == heap->size) {
		heap->size = heap->size ? heap->size * 2 : 4;
		heap->nodes = (node_t **) realloc(heap->nodes, heap->size * sizeof(node_t*));
	}
	
	int i, j;
	i = heap->len;
	j = i / 2;
	if (heap->len > 0) {
		
		while (i >= 0 && heap->nodes[j]->priority > new_node->priority && i != j) {
			heap->nodes[i] = heap->nodes[j];
			i = j;
			j /= 2;
		}
	}
	heap->nodes[i] = new_node;
	heap->len ++;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl 0x8(%rdi), %ecx
movq (%rdi), %rax
cmpl 0xc(%rdi), %ecx
jne 0x16cd
leal (%rcx,%rcx), %edx
testl %ecx, %ecx
movl $0x4, %ecx
cmovnel %edx, %ecx
movl %ecx, 0xc(%rbx)
movslq %ecx, %rsi
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x1150
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
testl %ecx, %ecx
jle 0x1702
movl (%r14), %edx
movl %ecx, %edi
shrl %edi
movq (%rax,%rdi,8), %r8
cmpl %edx, (%r8)
jle 0x1702
movl %ecx, %esi
movl %esi, %r9d
movl %edi, %esi
movq %r8, (%rax,%r9,8)
movq (%rbx), %rax
testl %edi, %edi
je 0x1704
movl %esi, %edi
shrl %edi
movq (%rax,%rdi,8), %r8
cmpl %edx, (%r8)
jg 0x16e3
jmp 0x1704
movl %ecx, %esi
movslq %esi, %rdx
movq %r14, (%rax,%rdx,8)
incl %ecx
movl %ecx, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/teodorst[P]app-huffman/priority_queue.c
// Function: pop
node_t* pop(heap_t* heap) {
	if (heap->len == 0) {
		return NULL;
	}

	int i, j, k;
	node_t* old_node = heap->nodes[0];
	heap->nodes[0] = heap->nodes[heap->len - 1];
	heap->len --;
	
	i = 0;
	while (1) {
		k = i;
		j = 2 * i + 1;
		if (j < heap->len && heap->nodes[j]->priority < heap->nodes[k]->priority) {
			k = j;
		}
		if (j + 1 < heap->len && heap->nodes[j + 1]->priority < heap->nodes[k]->priority) {
			k = j + 1;
		}
		if (i == k) {
			break;
		}
		heap->nodes[i] = heap->nodes[k];
		i = k;
		heap->nodes[i] = heap->nodes[heap->len];
	}

	return old_node;
}

// Assembly:
movslq 0x8(%rdi), %rcx
xorl %edx, %edx
testq %rcx, %rcx
je 0x17c1
pushq %r14
pushq %rbx
movq (%rdi), %rsi
movq (%rsi), %rax
movq -0x8(%rsi,%rcx,8), %r8
movq %r8, (%rsi)
decl %ecx
movl %ecx, 0x8(%rdi)
movslq %ecx, %rsi
leal 0x1(,%rdx,2), %r10d
movslq %edx, %r8
movl %edx, %r9d
cmpl %ecx, %r10d
jge 0x176f
movq (%rdi), %r9
movslq %r10d, %r11
movq (%r9,%r11,8), %r11
movl (%r11), %r11d
movq (%r9,%r8,8), %r9
cmpl (%r9), %r11d
jl 0x176c
movl %edx, %r10d
movl %r10d, %r9d
leal (%rdx,%rdx), %r10d
addl $0x2, %r10d
cmpl %ecx, %r10d
jge 0x179a
movq (%rdi), %r11
movslq %r10d, %rbx
movq (%r11,%rbx,8), %rbx
movl (%rbx), %ebx
movslq %r9d, %r14
movq (%r11,%r14,8), %r11
cmpl (%r11), %ebx
jl 0x1797
movl %r9d, %r10d
movl %r10d, %r9d
cmpl %r9d, %edx
je 0x17bd
movq (%rdi), %rdx
movslq %r9d, %r10
movq (%rdx,%r10,8), %r11
movq %r11, (%rdx,%r8,8)
movq (%rdi), %rdx
movq (%rdx,%rsi,8), %r8
movq %r8, (%rdx,%r10,8)
movl %r9d, %edx
jmp 0x1740
popq %rbx
popq %r14
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/teodorst[P]app-huffman/priority_queue.c
// Function: insert_values_in_queue
void insert_values_in_queue(unsigned long long int* frequecy, heap_t* h){
	int i;

	/* add all the letters into the heap */
	for (i = 0 ; i < 128 ; i++) {
		if (frequecy[i] > 0) {
			node_t* node = (node_t*) malloc (sizeof(struct node_t));
			node->left = node->right = NULL;
			node->priority = frequecy[i];
			node->data = i;
			push(h, node);
		}
	}

}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
xorl %r15d, %r15d
movq (%r14,%r15,8), %r12
testq %r12, %r12
je 0x1801
movl $0x18, %edi
callq 0x1120
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movl %r12d, (%rax)
movb %r15b, 0x4(%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1693
incq %r15
cmpq $0x80, %r15
jne 0x17d5
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/teodorst[P]app-huffman/frequency.c
// Function: compute_frequency
unsigned long long int* compute_frequency(FILE *fp) {
	size_t nread = 0;
	int chunk_size = 0;
	char buf[CHUNK];
	unsigned long long int* frequency = (unsigned long long int*) calloc(128, sizeof(unsigned long long int));

	memset(buf, '\0', CHUNK);
	while((nread = fread(buf, 1, CHUNK, fp)) > 0) {
		chunk_size = CHUNK > nread ? nread : CHUNK;
		compute_frequency_for_chunk(buf, 0, chunk_size, frequency);
		memset(buf, '\0', CHUNK);
	}
	fseek(fp, 0, SEEK_SET);
	return frequency;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x6400008, %rsp        # imm = 0x6400008
movq %rdi, %rbx
movl $0x80, %edi
movl $0x8, %esi
callq 0x10e0
movq %rax, %r14
movq %rsp, %r15
movl $0x6400000, %r12d       # imm = 0x6400000
movl $0x6400000, %edx        # imm = 0x6400000
movq %r15, %rdi
xorl %esi, %esi
callq 0x10b0
movl $0x1, %esi
movl $0x6400000, %edx        # imm = 0x6400000
movq %r15, %rdi
movq %rbx, %rcx
callq 0x1070
testq %rax, %rax
je 0x1913
movq %rsp, %r15
cmpq %r12, %rax
cmovaeq %r12, %rax
xorl %ecx, %ecx
movzbl (%rsp,%rcx), %edx
incq (%r14,%rdx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x18da
movl $0x6400000, %edx        # imm = 0x6400000
movq %r15, %rdi
xorl %esi, %esi
callq 0x10b0
movl $0x1, %esi
movl $0x6400000, %edx        # imm = 0x6400000
movq %r15, %rdi
movq %rbx, %rcx
callq 0x1070
testq %rax, %rax
jne 0x18d1
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1140
movq %r14, %rax
addq $0x6400008, %rsp        # imm = 0x6400008
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/teodorst[P]app-huffman/huffman.c
// Function: decode_bytes_for_chunk
int decode_bytes_for_chunk(node_t *root, char *buffer, unsigned long long int nbits, node_t **remainig_node, char* out_buffer) {

    int i, j;
    node_t *node = *remainig_node;
    unsigned long long int nbytes = nbits % 8 == 0 ? nbits/8 : nbits/8 + 1;
    unsigned long long int count_bits = 0L;
    int bit;
    int length = 0;

    for (i = 0; i < nbytes; i++) {
        for (j = 7 ; j >= 0 && count_bits < nbits; j--) {

            /* get bit */
            bit = (buffer[i] >> j) & 1;

            if (bit == 0) {
                /* go left in tree*/
                node = node->left;
            } else {
                /* go right in tree */
                node = node->right;
            }

            /* depth search from the root */
            if (node->left == NULL && node->right == NULL) {
                out_buffer[length ++] = node->data;
                node = root;
            }

            count_bits ++;
        }
    }

    *remainig_node = node;
    return length;
}

// Assembly:
movq (%rcx), %r9
xorl %r10d, %r10d
testb $0x7, %dl
setne %r10b
movq %rdx, %rax
shrq $0x3, %rax
addq %rax, %r10
je 0x19cd
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
xorl %r11d, %r11d
xorl %eax, %eax
xorl %ebx, %ebx
cmpq %rdx, %rbx
jae 0x19bd
movl $0x7, %ebp
movsbl (%rsi,%r11), %r14d
xorl %r15d, %r15d
btl %ebp, %r14d
setb %r15b
movq 0x8(%r9,%r15,8), %r9
cmpq $0x0, 0x8(%r9)
jne 0x19b0
cmpq $0x0, 0x10(%r9)
jne 0x19b0
movb 0x4(%r9), %r9b
movslq %eax, %r14
incl %eax
movb %r9b, (%r8,%r14)
movq %rdi, %r9
incq %rbx
addl $-0x1, %ebp
jae 0x19bd
cmpq %rdx, %rbx
jb 0x197d
incq %r11
cmpq %r10, %r11
jne 0x1973
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x19cf
xorl %eax, %eax
movq %r9, (%rcx)
retq
// File: /workspace/github_c_makefile_star2_O3/teodorst[P]app-huffman/huffman.c
// Function: decode_bytes_for_chunk_pthreads
int decode_bytes_for_chunk_pthreads(node_t *root, char *buffer, unsigned long long int nbits, char* out_buffer) {

    int i, j;
    node_t *node = root;
    unsigned long long int nbytes = nbits % 8 == 0 ? nbits/8 : nbits/8 + 1;
    unsigned long long int count_bits = 0L;
    int bit;
    int length = 0;
    for (i = 0; i < nbytes; i++) {
        for (j = 7 ; j >= 0 && count_bits < nbits; j--) {

            /* get bit */
            bit = (buffer[i] >> j) & 1;

            if (bit == 0) {
                /* go left in tree*/
                node = node->left;

            } else {
                /* go right in tree */
                node = node->right;
            }

            /* depth search from the root */
            if (node->left == NULL && node->right == NULL) {
                out_buffer[length ++] = node->data;
                node = root;
            }

            count_bits ++;
        }
    }

    return length;
}

// Assembly:
xorl %r8d, %r8d
testb $0x7, %dl
setne %r8b
movq %rdx, %rax
shrq $0x3, %rax
addq %rax, %r8
je 0x1a4e
pushq %rbp
pushq %r14
pushq %rbx
xorl %r9d, %r9d
xorl %eax, %eax
xorl %r10d, %r10d
movq %rdi, %r11
cmpq %rdx, %r10
jae 0x1a41
movl $0x7, %ebx
movsbl (%rsi,%r9), %ebp
xorl %r14d, %r14d
btl %ebx, %ebp
setb %r14b
movq 0x8(%r11,%r14,8), %r11
cmpq $0x0, 0x8(%r11)
jne 0x1a34
cmpq $0x0, 0x10(%r11)
jne 0x1a34
movb 0x4(%r11), %r11b
movslq %eax, %r14
incl %eax
movb %r11b, (%rcx,%r14)
movq %rdi, %r11
incq %r10
addl $-0x1, %ebx
jae 0x1a41
cmpq %rdx, %r10
jb 0x1a02
incq %r9
cmpq %r8, %r9
jne 0x19f8
popq %rbx
popq %r14
popq %rbp
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/teodorst[P]app-huffman/huffman.c
// Function: write_codification_for_input_file
unsigned long long int write_codification_for_input_file(char **codification, FILE* input_fp, FILE* output_fp) {
    size_t nread = 0;
    int chunk_size = 0;
    char *buf = calloc(CHUNK, sizeof(char));
    char *output_buffer = calloc(CHUNK, sizeof(char));
    char output_char = 0;
    int output_buffer_contor = 0;
    int contor = 7;
    unsigned long long int bits = 0L;

    while((nread = fread(buf, 1, CHUNK, input_fp)) > 0) {
        chunk_size = CHUNK > nread ? nread : CHUNK;
        write_codification_for_chunk(buf, chunk_size, codification, output_buffer, &output_buffer_contor, &output_char, &contor, &bits);
        fwrite(output_buffer, 1, output_buffer_contor, output_fp);
        memset(buf, '\0', CHUNK);
        memset(output_buffer, '\0', CHUNK);
        output_buffer_contor = 0;
    }

    // if there are some bits to write in the last byte.
    if (contor > 7 && contor > -1 ) {
        fwrite(&output_char, 1, 1, output_fp);
    }

    return bits;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl $0x6400000, %ebp        # imm = 0x6400000
movl $0x6400000, %edi        # imm = 0x6400000
movl $0x1, %esi
callq 0x10e0
movq %rax, %r12
movl $0x6400000, %edi        # imm = 0x6400000
movl $0x1, %esi
callq 0x10e0
movq %rax, %r13
movb $0x0, 0x7(%rsp)
movl $0x0, 0x8(%rsp)
movl $0x7, 0xc(%rsp)
movq $0x0, 0x10(%rsp)
movl $0x1, %esi
movl $0x6400000, %edx        # imm = 0x6400000
movq %r12, %rdi
movq %r14, %rcx
callq 0x1070
testq %rax, %rax
je 0x1d01
cmpq %rbp, %rax
cmovaeq %rbp, %rax
movq %r12, %rdi
movl %eax, %esi
movq %r15, %rdx
movq %r13, %rcx
leaq 0x8(%rsp), %r8
leaq 0x7(%rsp), %r9
leaq 0x10(%rsp), %rax
pushq %rax
leaq 0x14(%rsp), %rax
pushq %rax
callq 0x1d15
addq $0x10, %rsp
movslq 0x8(%rsp), %rdx
movl $0x1, %esi
movq %r13, %rdi
movq %rbx, %rcx
callq 0x11a0
movl $0x6400000, %edx        # imm = 0x6400000
movq %r12, %rdi
xorl %esi, %esi
callq 0x10b0
movl $0x6400000, %edx        # imm = 0x6400000
movq %r13, %rdi
xorl %esi, %esi
callq 0x10b0
movl $0x0, 0x8(%rsp)
movl $0x1, %esi
movl $0x6400000, %edx        # imm = 0x6400000
movq %r12, %rdi
movq %r14, %rcx
callq 0x1070
testq %rax, %rax
jne 0x1c63
cmpl $0x8, 0xc(%rsp)
jl 0x1d01
movsbl 0x7(%rsp), %edi
movq %rbx, %rsi
callq 0x10d0
movq 0x10(%rsp), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/teodorst[P]app-huffman/huffman.c
// Function: write_codification_for_chunk
void write_codification_for_chunk(char *chunk, int chunk_size, char **codification, char* output_buffer,
    int *output_buffer_contor, char* output_char, int* contor, unsigned long long int* bits) {
    int i, j;

    for (i = 0; i < chunk_size; i ++) {
        char *codif = codification[(unsigned char)chunk[i]];
        for (j = 0; j < strlen(codif); j ++) {
            *output_char |= (codif[j] - 48) << *contor;
            *contor -= 1;
            *bits += 1;
            if (*contor == -1) {
                output_buffer[*output_buffer_contor] = *output_char;
                *contor = 7;
                *output_char = 0;
                *output_buffer_contor += 1;
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, 0x20(%rsp)
movq %rdx, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
testl %esi, %esi
jle 0x1dce
movq %r9, %rbx
movq %r8, %r14
movq 0x68(%rsp), %r12
movq 0x60(%rsp), %r13
movl %esi, %eax
movq %rax, (%rsp)
xorl %ecx, %ecx
movq 0x8(%rsp), %rax
movq %rcx, 0x18(%rsp)
movzbl (%rax,%rcx), %eax
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rbp
cmpb $0x0, (%rbp)
je 0x1dc0
xorl %r15d, %r15d
movzbl (%rbp,%r15), %eax
addl $0xd0, %eax
movb (%r13), %cl
shll %cl, %eax
orb %al, (%rbx)
subl $0x1, (%r13)
setae %al
incq (%r12)
testb %al, %al
jne 0x1db0
movb (%rbx), %al
movslq (%r14), %rcx
movq 0x20(%rsp), %rdx
movb %al, (%rdx,%rcx)
movl $0x7, (%r13)
movb $0x0, (%rbx)
incl (%r14)
incq %r15
movq %rbp, %rdi
callq 0x1090
cmpq %r15, %rax
ja 0x1d72
movq 0x18(%rsp), %rcx
incq %rcx
cmpq (%rsp), %rcx
jne 0x1d52
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/teodorst[P]app-huffman/huffman.c
// Function: write_codification_for_chunk_pthreads
void write_codification_for_chunk_pthreads(char *chunk, int index, int upper_limit, char **codification,
    char *output_buffer, int *output_buffer_contor, unsigned long long int *bits) {

    *output_buffer_contor = index;
    *bits = 0;
    int output_buffer_contor_static = index;
    int contor = 7;
    int i, j;
    char output_char = 0;
    char *codif = NULL;
    int codif_size = 0;

    for (i = index; i < upper_limit; i ++) {
        codif = codification[(unsigned char)chunk[i]];
        codif_size = strlen(codif);
        for (j = 0; j < codif_size; j ++) {
            output_char |= (codif[j] - 48) << contor;
            contor --;
            *bits += 1;

            if (contor == -1) {
                output_buffer[output_buffer_contor_static++] = output_char;
                output_char = 0;
                contor = 7;
            }
        }
    }

    if (contor > -1 && contor < 7) {
        output_buffer[output_buffer_contor_static] = output_char;
        output_buffer_contor_static += 1;
    }

    *output_buffer_contor = output_buffer_contor_static - index;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, 0x28(%rsp)
movq %rdi, 0x20(%rsp)
movq 0x70(%rsp), %r15
movl %esi, (%r9)
movq $0x0, (%r15)
movl %esi, %ebp
cmpl %edx, %esi
jge 0x1ebf
movq %r8, %r14
movq %r9, 0x10(%rsp)
movslq %esi, %rcx
movslq %edx, %rax
movq %rax, 0x18(%rsp)
movl $0x7, %r13d
xorl %r12d, %r12d
movl %esi, 0xc(%rsp)
movl %esi, %ebp
movq 0x20(%rsp), %rax
movq %rcx, 0x30(%rsp)
movzbl (%rax,%rcx), %eax
movq 0x28(%rsp), %rcx
movq (%rcx,%rax,8), %rbx
movq %rbx, %rdi
callq 0x1090
testl %eax, %eax
jle 0x1e98
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
xorl %edx, %edx
movl %r12d, %esi
movzbl (%rbx,%rdx), %r12d
addl $0xd0, %r12d
movl %r13d, %ecx
shll %cl, %r12d
orb %sil, %r12b
incq (%r15)
subl $0x1, %r13d
jae 0x1e8d
movslq %ebp, %rcx
incl %ebp
movb %r12b, (%r14,%rcx)
movl $0x7, %r13d
xorl %r12d, %r12d
incq %rdx
movl %r12d, %esi
cmpq %rdx, %rax
jne 0x1e5d
movq 0x30(%rsp), %rcx
incq %rcx
cmpq 0x18(%rsp), %rcx
jne 0x1e30
cmpl $0x6, %r13d
ja 0x1eb6
movslq %ebp, %rbp
movb %r12b, (%r14,%rbp)
incl %ebp
movq 0x10(%rsp), %r9
movl 0xc(%rsp), %esi
subl %esi, %ebp
movl %ebp, (%r9)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/teodorst[P]app-huffman/huffman.c
// Function: write_codification
void write_codification(FILE* codification_fp, char **codification) {
    int i, codification_length = 0;
    char *output_string = (char*) calloc(MAX_BITS_CODE + 5, sizeof(char));

    // write codification matrix length
    for(i = 0; i < 128; i ++) {
        if (codification[i] != NULL) {
            codification_length ++;
        }
    }

    sprintf(output_string, "%d\n", codification_length);
    fwrite(output_string, 1, strlen(output_string), codification_fp);
    memset(output_string, '\0', MAX_BITS_CODE + 5);

    for (i = 0; i < MAX_BITS_CODE; i ++) {
        if (codification[i] != NULL) {
            sprintf(output_string, "%c : %s\n", i, codification[i]);
            fwrite(output_string, strlen(codification[i]) + 5, 1, codification_fp);
            memset(output_string, 0, MAX_BITS_CODE + 5);
        }
    }
    free(output_string);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl $0x84, %edi
movl $0x1, %esi
callq 0x10e0
movq %rax, %r15
pxor %xmm0, %xmm0
xorl %eax, %eax
pcmpeqd %xmm2, %xmm2
pxor %xmm1, %xmm1
movdqu (%rbx,%rax,8), %xmm3
pcmpeqd %xmm0, %xmm3
pshufd $0xbd, %xmm3, %xmm4     # xmm4 = xmm3[1,3,3,2]
pshufd $0xe8, %xmm3, %xmm3     # xmm3 = xmm3[0,2,2,3]
pand %xmm4, %xmm3
paddd %xmm3, %xmm1
psubd %xmm2, %xmm1
addq $0x2, %rax
cmpq $0x80, %rax
jne 0x1f2c
pshufd $0x55, %xmm1, %xmm0     # xmm0 = xmm1[1,1,1,1]
paddd %xmm1, %xmm0
movd %xmm0, %edx
leaq 0x117d(%rip), %rsi      # 0x30e8
movq %r15, %rdi
xorl %eax, %eax
callq 0x1180
movq %r15, %rdi
callq 0x1090
movl $0x1, %esi
movq %r15, %rdi
movq %rax, %rdx
movq %r14, %rcx
callq 0x11a0
movl $0x84, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x10b0
leaq 0x1146(%rip), %r12      # 0x30ec
xorl %r13d, %r13d
movq (%rbx,%r13,8), %rcx
testq %rcx, %rcx
je 0x1fee
movq %r15, %rdi
movq %r12, %rsi
movl %r13d, %edx
xorl %eax, %eax
callq 0x1180
movq (%rbx,%r13,8), %rdi
callq 0x1090
leaq 0x5(%rax), %rsi
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rcx
callq 0x11a0
movl $0x84, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x10b0
incq %r13
cmpq $0x7f, %r13
jne 0x1fa9
movq %r15, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x1030
// File: /workspace/github_c_makefile_star2_O3/teodorst[P]app-huffman/huffman.c
// Function: write_metadata_file_pthreads
void write_metadata_file_pthreads(FILE* codification_fp, char **codification, size_t size, int num_threads, unsigned long long int* nbits_buffer, int *output_buffer_contors) {
    // write codification
    write_codification(codification_fp, codification);

    // write number of bits
    fprintf(codification_fp, "%d\n%lu\n", num_threads, size);
    int i;
    for (i = 0; i < num_threads; i ++) {
        fprintf(codification_fp, "%llu %d\n", nbits_buffer[i], output_buffer_contors[i]);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %rbx
movq %r8, %r14
movl %ecx, %ebp
movq %rdx, %r12
movq %rdi, %r15
callq 0x1efd
leaq 0x10ae(%rip), %rsi      # 0x30db
movq %r15, %rdi
movl %ebp, %edx
movq %r12, %rcx
xorl %eax, %eax
callq 0x1100
testl %ebp, %ebp
jle 0x2068
movl %ebp, %r13d
leaq 0x1099(%rip), %r12      # 0x30e3
xorl %ebp, %ebp
movq (%r14,%rbp,8), %rdx
movl (%rbx,%rbp,4), %ecx
movq %r15, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x1100
incq %rbp
cmpq %rbp, %r13
jne 0x204c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/teodorst[P]app-huffman/huffman.c
// Function: read_configuration
char** read_configuration(FILE *codification_fp, unsigned long long int *nbits) {
    char **codification = (char**) calloc(128, sizeof(char*));
    char *line = NULL;
    ssize_t nread;
    char index;
    int i;
    size_t line_length;
    int codification_length;

    // read number of lines from codification
    fscanf(codification_fp, "%d", &codification_length);
    fgetc(codification_fp);

    // read codification
    for(i = 0; i < codification_length; i ++ ) {
        nread = getline(&line, &line_length, codification_fp);
        if (nread == 1) {
            index = line[0];
            nread = getline(&line, &line_length, codification_fp);
            if (nread != -1) {
                line[nread-1] = '\0';
                codification[(unsigned char)index] = strdup(line+3);
            }
        } else {
            line[nread-1] = '\0';
            sscanf(line, "%c", &index);
            codification[(unsigned char)index] = strdup(line+4);
        }
    }


    // read number of bits
    fscanf(codification_fp, "%llu", nbits);

    free(line);
    return codification;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, 0x18(%rsp)
movq %rdi, %r15
movl $0x80, %edi
movl $0x8, %esi
callq 0x10e0
movq %rax, %rbx
movq $0x0, 0x8(%rsp)
leaq 0x1053(%rip), %rsi      # 0x3102
leaq 0x14(%rsp), %r14
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x1050
movq %r15, %rdi
callq 0x10c0
cmpl $0x0, (%r14)
jle 0x216a
leaq 0x8(%rsp), %r12
leaq 0x20(%rsp), %r13
leaq 0x7(%rsp), %r14
xorl %ebp, %ebp
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x1170
movq 0x8(%rsp), %rcx
cmpq $0x1, %rax
jne 0x212c
movb (%rcx), %al
movb %al, 0x7(%rsp)
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x1170
cmpq $-0x1, %rax
je 0x215e
movq 0x8(%rsp), %rcx
movb $0x0, -0x1(%rcx,%rax)
movq 0x8(%rsp), %rdi
addq $0x3, %rdi
jmp 0x2150
movb $0x0, -0x1(%rcx,%rax)
movq 0x8(%rsp), %rdi
leaq 0xfb8(%rip), %rsi       # 0x30f5
movq %r14, %rdx
xorl %eax, %eax
callq 0x1130
movq 0x8(%rsp), %rdi
addq $0x4, %rdi
callq 0x11b0
movzbl 0x7(%rsp), %ecx
movq %rax, (%rbx,%rcx,8)
incl %ebp
cmpl 0x14(%rsp), %ebp
jl 0x20e4
leaq 0xf87(%rip), %rsi       # 0x30f8
movq %r15, %rdi
movq 0x18(%rsp), %rdx
xorl %eax, %eax
callq 0x1050
movq 0x8(%rsp), %rdi
callq 0x1030
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq