LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/OfficialRepo[P]PokiLib/encrypt.c
// Function: sub_9E9D8
void sub_9E9D8(unsigned char *input, unsigned char*output)
{
	_DWORD temp[0x32C / 4];
	_DWORD temp2[0x100 / 4];
	memcpy(temp2, input, 0x100);
	sub_87568((unsigned char*)temp, (unsigned char*)temp2);
	sub_8930C((unsigned char*)temp);
	sub_8B2F4((unsigned char*)temp);
	sub_8D114((unsigned char*)temp);
	sub_8F0B0((unsigned char*)temp);
	sub_910A8((unsigned char*)temp);
	sub_92E08((unsigned char*)temp);
	sub_94BDC((unsigned char*)temp);
	sub_96984((unsigned char*)temp);
	sub_985E0((unsigned char*)temp);
	sub_9A490((unsigned char*)temp);
	sub_9C42C((unsigned char*)temp);
	sub_9E1C4((unsigned char*)temp, (unsigned char*)temp2);
	memcpy(output, temp2, 0x100);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x430, %rsp            # imm = 0x430
movq %rsi, %rbx
movq %rdi, %rsi
movq %rsp, %r14
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
callq 0x10d0
leaq 0x100(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x1110
movq %r15, %rdi
callq 0x10e0
movq %r15, %rdi
callq 0x1040
movq %r15, %rdi
callq 0x10f0
movq %r15, %rdi
callq 0x10c0
movq %r15, %rdi
callq 0x1090
movq %r15, %rdi
callq 0x1050
movq %r15, %rdi
callq 0x1070
movq %r15, %rdi
callq 0x1100
movq %r15, %rdi
callq 0x1060
movq %r15, %rdi
callq 0x1030
movq %r15, %rdi
callq 0x10b0
movq %r15, %rdi
movq %r14, %rsi
callq 0x1120
movl $0x100, %edx            # imm = 0x100
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10d0
addq $0x430, %rsp            # imm = 0x430
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/OfficialRepo[P]PokiLib/encrypt.c
// Function: encrypt
int encrypt(const unsigned char *input, size_t input_size,
	const unsigned char* iv, size_t iv_size,
	unsigned char* output, size_t * output_size) {
	unsigned char arr2[256];
	unsigned char arr3[256];
	size_t roundedsize, totalsize;

	if (iv_size != 32){
		return -1;
	}

	roundedsize = input_size + (256 - (input_size % 256));
	totalsize = roundedsize + 32;

	if (output == NULL){
		*output_size = totalsize;
		return 0;
	}
	if (*output_size < totalsize){
		*output_size = totalsize;
		return -1;
	}

	for (int j = 0; j < 8; j++){
		for (int i = 0; i < 32; i++){
			arr2[32 * j + i] = rotl8(iv[i], j); //rotate byte left
		}
	}

	memcpy(output, iv, 32);
	memcpy(output + 32, input, input_size);

	if (roundedsize > input_size)
	{
		memset(output + 32 + input_size, 0, roundedsize - input_size); //pad data with zeroes
	}
	output[totalsize - 1] = 256 - (input_size % 256);

	for (size_t offset = 32; offset < totalsize; offset += 256)
	{
		for (int i = 0; i < 256; i++){
			output[offset + i] ^= arr2[i];
		}
		sub_9E9D8(output + offset, arr3); // !! encryption here
		memcpy(arr2, arr3, 256);
		memcpy(output + offset, arr3, 256);
	}

	*output_size = totalsize;
	return 0;
}

// Assembly:
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq $0x20, %rcx
jne 0x170fc
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %r9, %rbx
movq %r8, %r14
movq %rsi, %r15
movzbl %r15b, %eax
movl $0x100, %r13d           # imm = 0x100
subq %rax, %r13
leaq (%rsi,%r13), %rcx
addq $0x20, %rcx
testq %r8, %r8
je 0x170e6
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rcx, (%rbx)
jb 0x170e8
movq %rdi, %rsi
movq %rcx, (%rsp)
leaq (%r15,%r13), %rbp
leaq 0x10(%rsp), %rax
xorl %ecx, %ecx
xorl %edi, %edi
movb (%rdx,%rdi), %r8b
rolb %cl, %r8b
movb %r8b, (%rax,%rdi)
incq %rdi
cmpq $0x20, %rdi
jne 0x1700c
incq %rcx
addq $0x20, %rax
cmpq $0x8, %rcx
jne 0x1700a
movups (%rdx), %xmm0
movups 0x10(%rdx), %xmm1
movups %xmm1, 0x10(%r14)
movups %xmm0, (%r14)
leaq 0x20(%r14), %r12
movq %r12, %rdi
movq %r15, %rdx
callq 0x10d0
cmpq %r15, %rbp
jbe 0x17061
addq %r12, %r15
movq %r15, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x1080
movb %r13b, 0x1f(%r14,%rbp)
movq (%rsp), %rcx
cmpq $0x21, %rcx
jb 0x170e6
movq %rbx, 0x8(%rsp)
movl $0x20, %r13d
leaq 0x110(%rsp), %r15
movl $0x100, %ebx            # imm = 0x100
xorl %eax, %eax
movb 0x10(%rsp,%rax), %cl
xorb %cl, (%r12,%rax)
incq %rax
cmpq $0x100, %rax            # imm = 0x100
jne 0x1708a
leaq (%r14,%r13), %rbp
movq %rbp, %rdi
movq %r15, %rsi
callq 0x10a0
movl $0x100, %edx            # imm = 0x100
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x10d0
movl $0x100, %edx            # imm = 0x100
movq %rbp, %rdi
movq %r15, %rsi
callq 0x10d0
addq %rbx, %r13
addq %rbx, %r12
movq (%rsp), %rcx
cmpq %rcx, %r13
jb 0x17088
xorl %eax, %eax
movq 0x8(%rsp), %rbx
jmp 0x170e8
xorl %eax, %eax
movq %rcx, (%rbx)
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r14
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
movaps 0x66e(%rip), %xmm0      # 0x22d0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
movabsq $0x5858585858582e, %rax # imm = 0x5858585858582E
movq %rax, 0x10(%rdi)
callq 0x11e0
testl %eax, %eax
js 0x1cff
movl %eax, %ebp
leaq 0x10(%rsp), %rdi
callq 0x1080
leaq 0x8(%rsp), %rdi
movq $0x0, (%rdi)
movl %ebp, (%rdi)
movw $0x4, 0x4(%rdi)
movl $0x1, %esi
xorl %edx, %edx
callq 0x11f0
testl %eax, %eax
js 0x1ce0
leaq 0x8(%rsp), %r14
incq (%rbx)
movq $0x0, 0x8(%rsp)
movl %ebp, 0x8(%rsp)
movw $0x4, 0xc(%rsp)
movl $0x1, %esi
movq %r14, %rdi
xorl %edx, %edx
callq 0x11f0
testl %eax, %eax
jns 0x1cb6
leaq 0x5c7(%rip), %rdi       # 0x22ae
leaq 0x57f(%rip), %rsi       # 0x226d
leaq 0x586(%rip), %rcx       # 0x227b
movl $0x18, %edx
callq 0x1130
leaq 0x55f(%rip), %rdi       # 0x2265
leaq 0x560(%rip), %rsi       # 0x226d
leaq 0x567(%rip), %rcx       # 0x227b
movl $0xe, %edx
callq 0x1130
// File: /workspace/github_c_makefile_star2_O1/johanDa9u[P]MiniShell/src/shell.c
// Function: contains
int contains(int x)
{
	if (isempty())
		return -1;
	for (size_t i = 0; i < top; i++)
	{
		if (stack[i] == x)
			return i;
	}
	return -1;

}

// Assembly:
movslq 0x5aa5(%rip), %rcx      # 0x8304
cmpq $-0x1, %rcx
je 0x2888
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
je 0x2887
leaq 0x5abb(%rip), %rsi      # 0x8330
xorl %edx, %edx
cmpl %edi, (%rsi)
je 0x2898
incq %rdx
addq $0x4, %rsi
cmpq %rdx, %rcx
jne 0x2877
retq
movl $0x0, 0x5a92(%rip)      # 0x8324
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
movl %edx, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x280b(%rip), %rdi      # 0x50d8
callq 0x20c0
movl $0xffffff81, %eax       # imm = 0xFFFFFF81
addq $0x8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x2811(%rip), %rdi      # 0x5104
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_O1/johanDa9u[P]MiniShell/src/shell.c
// Function: runPipes
void runPipes(struct cmdline cmd)
{

	/*------------------------------- Definitions ------------------------------ */
	char ***commands = cmd.seq;
	int pipes[2];
	int fd_input = 0;	// a special fd that is being used to chain the execution of the commands

	/*------------------------ Traverse all the commands ----------------------- */
	while (*commands != NULL)
	{

		/*------------------------------ Define pipes ------------------------------ */
		pipe(pipes);

		switch (fork())
		{
			case -1:
				/*---------------------- FORK() has failed ---------------------- */
				exit(1);
				break;
			case 0:
				/*------------------------------ FORKED CHILD PROCESS ----------------------------- */
				dup2(fd_input, STDIN);	//input pipe < STDIN
				if (*(commands + 1) != NULL)
					dup2(pipes[1], STDOUT);	//Redirect the output of the current command (to be executed) if it is not the last one.
				close(pipes[0]);
				if (execvp((*commands)[0], *commands) == -1)
				{
					printf("%s : command not found.\n", (*commands)[0]);
				}
				exit(1);
				break;
			default:
				/*--------------------------------- Parent --------------------------------- */
				if (cmd.in_background == 0)
				{
					wait(NULL);
				}

				close(pipes[1]);
				fd_input = pipes[0];	//UPDATE : input pipe uses the previous one in order to keep a relevant sequence of executions
				commands++;
				break;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq 0x48(%rsp), %r15
cmpq $0x0, (%r15)
je 0x298d
leaq 0x30(%rsp), %rax
movl 0x20(%rax), %ebp
addq $0x8, %r15
xorl %r14d, %r14d
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x21e0
callq 0x25a0
testl %eax, %eax
je 0x2998
cmpl $-0x1, %eax
je 0x29e4
testl %ebp, %ebp
jne 0x2976
xorl %edi, %edi
callq 0x2580
movl 0x4(%rsp), %edi
callq 0x21d0
movl (%rsp), %r14d
cmpq $0x0, (%r15)
leaq 0x8(%r15), %r15
jne 0x2955
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl %r14d, %edi
xorl %esi, %esi
callq 0x2170
cmpq $0x0, (%r15)
je 0x29b6
movl 0x4(%rsp), %edi
movl $0x1, %esi
callq 0x2170
movl (%rsp), %edi
callq 0x21d0
movq -0x8(%r15), %rsi
movq (%rsi), %rdi
callq 0x2490
cmpl $-0x1, %eax
jne 0x29e4
movq -0x8(%r15), %rax
movq (%rax), %rsi
leaq 0x262b(%rip), %rdi      # 0x5008
xorl %eax, %eax
callq 0x2180
movl $0x1, %edi
callq 0x24e0
// File: /workspace/github_c_makefile_star2_O1/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 0x36e1
movslq 0x58ac(%rip), %rax      # 0x8304
cmpl 0x58a2(%rip), %eax      # 0x8300
jne 0x2a6e
leaq 0x269d(%rip), %rdi      # 0x5104
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_O1/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 0x2b12
pushq %rax
leaq 0x5839(%rip), %rcx      # 0x8330
movl (%rcx,%rax,4), %edi
decl %eax
movl %eax, 0x5802(%rip)      # 0x8304
movl $0xf, %esi
callq 0x36e1
addq $0x8, %rsp
jmp 0x2b1c
movl $0x0, 0x5808(%rip)      # 0x8324
cmpl $-0x1, 0x57e1(%rip)     # 0x8304
je 0x2b26
retq
movl $0x0, 0x57f4(%rip)      # 0x8324
retq
// File: /workspace/github_c_makefile_star2_O1/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, 0x5780(%rip)     # 0x8304
je 0x2b9d
leaq 0x24a8(%rip), %rdi      # 0x5035
callq 0x20c0
movl $0x2710, %edi           # imm = 0x2710
popq %rax
jmp 0x25b0
movl $0x0, 0x577d(%rip)      # 0x8324
xorl %edi, %edi
callq 0x24e0
// File: /workspace/github_c_makefile_star2_O1/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 0x3566
xorl %r15d, %r15d
movq (%r14), %rdi
testq %rdi, %rdi
je 0x3551
leaq 0x8(%r14), %r12
callq 0x2050
movq (%r12), %rdi
addq $0x8, %r12
testq %rdi, %rdi
jne 0x353f
movq %r14, %rdi
callq 0x2050
movq 0x8(%rbx,%r15,8), %r14
incq %r15
testq %r14, %r14
jne 0x3533
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2050
// File: /workspace/github_c_makefile_star2_O1/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 0x3778
movq 0x8(%rsp), %rax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r14
retq
leaq 0x1aa4(%rip), %rdi      # 0x5223
callq 0x3598
// File: /workspace/github_c_makefile_star2_O1/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 0x382a
movl %ebx, %eax
popq %rbx
retq
leaq 0x1a66(%rip), %rdi      # 0x5297
callq 0x3598
// File: /workspace/github_c_makefile_star2_O1/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 0x3855
testq %rax, %rax
js 0x3929
popq %rcx
retq
leaq 0x1978(%rip), %rdi      # 0x52a8
callq 0x3836
movl $0x1, %edi
callq 0x20a0
// File: /workspace/github_c_makefile_star2_O1/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 0x394a
movl $0x1, %edi
callq 0x2110
testq %rax, %rax
js 0x3966
popq %rcx
retq
leaq 0x194a(%rip), %rdi      # 0x52b7
callq 0x3836
movl $0x1, %edi
callq 0x20a0
// File: /workspace/github_c_makefile_star2_O1/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 0x3a76
popq %rcx
retq
leaq 0x18b2(%rip), %rdi      # 0x532f
callq 0x3598
// File: /workspace/github_c_makefile_star2_O1/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 0x3aa9
cmpl $0x0, (%rbx)
jne 0x3ab1
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x1885(%rip), %rdi      # 0x533d
callq 0x3598
// File: /workspace/github_c_makefile_star2_O1/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 0x3cfc
popq %rax
retq
leaq 0x1751(%rip), %rsi      # 0x5454
movl %eax, %edi
callq 0x3607
// File: /workspace/github_c_makefile_star2_O1/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 0x3d36
js 0x3d3b
popq %rax
retq
callq 0x2617
leaq 0x1764(%rip), %rdi      # 0x54a6
callq 0x3598
// File: /workspace/github_c_makefile_star2_O1/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
movq %rdx, %r15
testq %rdx, %rdx
je 0x3e6f
movq %rsi, %r14
movl %edi, %ebp
movq %rbx, %r15
movl %ebp, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2220
testq %rax, %rax
js 0x3e5b
jne 0x3e67
jmp 0x3e6f
callq 0x2070
cmpl $0x4, (%rax)
jne 0x3e80
xorl %eax, %eax
addq %rax, %r14
subq %rax, %r15
jne 0x3e45
subq %r15, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq $-0x1, %rbx
jmp 0x3e72
// File: /workspace/github_c_makefile_star2_O1/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
movq %rdx, %rbx
testq %rdx, %rdx
je 0x3ecf
movq %rsi, %r14
movl %edi, %ebp
movq %rbx, %r15
movl %ebp, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2110
testq %rax, %rax
jg 0x3ebe
callq 0x2070
cmpl $0x4, (%rax)
jne 0x3ec8
xorl %eax, %eax
addq %rax, %r14
subq %rax, %r15
jne 0x3ea0
jmp 0x3ecf
movq $-0x1, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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
movq %rdx, %r14
testq %rdx, %rdx
je 0x3f28
movq %rsi, %r15
movq %rdi, %r12
movq %rbx, %r14
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x3f43
testq %rax, %rax
js 0x3f2d
je 0x3f28
addq %rax, %r15
subq %rax, %r14
jne 0x3f0b
subq %r14, %rbx
jmp 0x3f34
movq $-0x1, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
movl 0x4(%rdi), %eax
testl %eax, %eax
jg 0x3f92
leaq 0x10(%rbx), %r13
xorl %r15d, %r15d
movl (%rbx), %edi
movl $0x2000, %edx           # imm = 0x2000
movq %r13, %rsi
callq 0x2220
movl %eax, 0x4(%rbx)
testl %eax, %eax
js 0x3f81
je 0x3fb5
movq %r13, 0x8(%rbx)
jmp 0x3f8b
callq 0x2070
cmpl $0x4, (%rax)
jne 0x3fc2
movl 0x4(%rbx), %eax
testl %eax, %eax
jle 0x3f63
movl %eax, %ecx
cmpq %r12, %rcx
cmovael %r12d, %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
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq $-0x1, %r15
jmp 0x3fb5
// File: /workspace/github_c_makefile_star2_O1/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 0x4052
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 0x3f43
cmpq $0x1, %rax
jne 0x4028
movb 0xf(%rsp), %al
movb %al, -0x1(%rbx,%r13)
cmpb $0xa, %al
je 0x4040
leaq 0x1(%r13), %rax
cmpq %rax, %r14
jne 0x3ff7
jmp 0x4044
testq %rax, %rax
jne 0x4037
cmpq $0x1, %r13
jne 0x404c
xorl %eax, %eax
jmp 0x405b
movq $-0x1, %rax
jmp 0x405b
leaq 0x1(%r13), %r14
addq %r13, %rbx
movq %r14, %r13
jmp 0x4052
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_O1/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 %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %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 0x4184
movq 0x8(%rsp), %r14
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %r14, %r14
je 0x416d
movl 0x4(%r14), %edi
movl 0x8(%r14), %esi
movl 0xc(%r14), %edx
callq 0x25d0
testl %eax, %eax
js 0x4165
movl %eax, %ebp
movq 0x18(%r14), %rsi
movl 0x10(%r14), %edx
movl %eax, %edi
callq 0x24f0
cmpl $-0x1, %eax
jne 0x416b
movl %ebp, %edi
callq 0x21d0
testl %eax, %eax
js 0x41b6
movq 0x28(%r14), %r14
jmp 0x412a
movl %ebp, %ebx
movq 0x8(%rsp), %rdi
callq 0x25c0
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x3e6d(%rip), %rcx      # 0x7ff8
movq (%rcx), %r15
movl %eax, %edi
callq 0x2190
leaq 0x13f9(%rip), %rsi      # 0x5595
movq %r15, %rdi
movq %r14, %rdx
movq %rbx, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x2290
movl $0xfffffffe, %ebx       # imm = 0xFFFFFFFE
jmp 0x4177
callq 0x268c
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x4177
// File: /workspace/github_c_makefile_star2_O1/teodorst[P]app-huffman/huffman_serial.c
// Function: open_file
FILE* open_file(char *filename, char *mode) {
	FILE* fp;
	fp = fopen(filename, mode);

    if (fp == NULL)
        exit(EXIT_FAILURE);

    return fp;
}

// Assembly:
pushq %rax
callq 0x1160
testq %rax, %rax
je 0x1399
popq %rcx
retq
movl $0x1, %edi
callq 0x1190
// File: /workspace/github_c_makefile_star2_O1/teodorst[P]app-huffman/huffman_serial.c
// Function: free_codification_matrix
void free_codification_matrix(char** codification) {
    int i;
    for (i = 0; i < 128; i ++) {
        if (codification[i]) {
            free(codification[i]);
        }
    }
    free(codification);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movq (%rbx,%r14,8), %rdi
testq %rdi, %rdi
je 0x13bb
callq 0x1030
incq %r14
cmpq $0x80, %r14
jne 0x13ad
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1030
// File: /workspace/github_c_makefile_star2_O1/teodorst[P]app-huffman/huffman_serial.c
// Function: main
int main (int argc, char* argv[]) {

	if (argc == 5 && strcmp(argv[OPERATION], "compress") == 0) {
		huffman_compress(argv[INPUT_FILE], argv[OUTPUT_FILE], argv[CODIFICATION]);
	}
	else if (argc == 5 && strcmp(argv[OPERATION], "decompress") == 0) {
		huffman_decompress(argv[INPUT_FILE], argv[OUTPUT_FILE], argv[CODIFICATION]);
	}
	else {
		printf("Bad arguments\n");
		printf("Usage huffman_serial operation[compress/decompress] input_file ouput_file codification_file_name\n");
		return 1;
	}
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x5, %edi
jne 0x1634
movq %rsi, %rbx
movq 0x8(%rsi), %r14
leaq 0x1a07(%rip), %rsi      # 0x301c
movq %r14, %rdi
callq 0x10f0
testl %eax, %eax
je 0x1653
leaq 0x19f2(%rip), %rsi      # 0x301a
movq %r14, %rdi
callq 0x10f0
testl %eax, %eax
je 0x1666
leaq 0x19ea(%rip), %rdi      # 0x3025
callq 0x1060
leaq 0x19ec(%rip), %rdi      # 0x3033
callq 0x1060
movl $0x1, %eax
jmp 0x1679
movq 0x10(%rbx), %rdi
movq 0x18(%rbx), %rsi
movq 0x20(%rbx), %rdx
callq 0x13d6
jmp 0x1677
movq 0x10(%rbx), %rdi
movq 0x18(%rbx), %rsi
movq 0x20(%rbx), %rdx
callq 0x15b3
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/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 0xc(%rdi), %eax
cmpl %eax, 0x8(%rdi)
jne 0x16c7
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x4, %eax
cmovnel %ecx, %eax
movl %eax, 0xc(%rbx)
movq (%rbx), %rdi
movslq %eax, %rsi
shlq $0x3, %rsi
callq 0x1150
movq %rax, (%rbx)
movl 0x8(%rbx), %eax
movl %eax, %edx
testl %eax, %eax
jle 0x1704
movl (%r14), %ecx
movl %eax, %esi
shrl %esi
movq (%rbx), %rdi
movq (%rdi,%rsi,8), %r8
movl %eax, %edx
cmpl %ecx, (%r8)
jle 0x1704
movl %eax, %edx
movl %edx, %r9d
movl %esi, %edx
movq %r8, (%rdi,%r9,8)
testl %esi, %esi
je 0x1704
movl %edx, %esi
shrl %esi
movq (%rbx), %rdi
movq (%rdi,%rsi,8), %r8
cmpl %ecx, (%r8)
jg 0x16e7
movq (%rbx), %rcx
movslq %edx, %rdx
movq %r14, (%rcx,%rdx,8)
incl %eax
movl %eax, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x17c4
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 0x1772
movq (%rdi), %r9
movslq %r10d, %r11
movq (%r9,%r11,8), %r11
movl (%r11), %r11d
movq (%r9,%r8,8), %r9
cmpl (%r9), %r11d
jl 0x176f
movl %edx, %r10d
movl %r10d, %r9d
leal (%rdx,%rdx), %r10d
addl $0x2, %r10d
cmpl %ecx, %r10d
jge 0x179d
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 0x179a
movl %r9d, %r10d
movl %r10d, %r9d
cmpl %r9d, %edx
je 0x17c0
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 0x1743
popq %rbx
popq %r14
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x1804
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 0x17d8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/teodorst[P]app-huffman/frequency.c
// Function: print_frequency
void print_frequency(int chunk_size, unsigned long long int* frequency){
	int i;
	
	for (i = 0 ; i < 128; i++){
		if (frequency[i] != 0)
			printf("%llu ", frequency[i]);
	}

	printf("\n");
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
leaq 0x1885(%rip), %r14      # 0x30b0
xorl %r15d, %r15d
movq (%rbx,%r15,8), %rsi
testq %rsi, %rsi
je 0x1841
movq %r14, %rdi
xorl %eax, %eax
callq 0x10a0
incq %r15
cmpq $0x80, %r15
jne 0x182e
movl $0xa, %edi
popq %rbx
popq %r14
popq %r15
jmp 0x1040
// File: /workspace/github_c_makefile_star2_O1/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 0x191b
movq %rsp, %r15
cmpq %r12, %rax
cmovaeq %r12, %rax
cmpq $0x1, %rax
adcq $0x0, %rax
xorl %ecx, %ecx
movzbl (%rsp,%rcx), %edx
incq (%r14,%rdx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x18e2
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_O1/teodorst[P]app-huffman/huffman.c
// Function: init_node
node_t* init_node(char data) {
    node_t* node = (node_t*) malloc(sizeof(node_t));
    node->data = data;
    node->left = node->right = NULL;
    return node;
}

// Assembly:
pushq %rbx
movl %edi, %ebx
movl $0x18, %edi
callq 0x1120
movb %bl, 0x4(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x19d5
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
xorl %r11d, %r11d
xorl %eax, %eax
xorl %ebx, %ebx
cmpq %rdx, %rbx
jae 0x19c5
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 0x19b8
cmpq $0x0, 0x10(%r9)
jne 0x19b8
movb 0x4(%r9), %r9b
movslq %eax, %r14
incl %eax
movb %r9b, (%r8,%r14)
movq %rdi, %r9
incq %rbx
addl $-0x1, %ebp
jae 0x19c5
cmpq %rdx, %rbx
jb 0x1985
incq %r11
cmpq %r10, %r11
jne 0x197b
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x19d7
xorl %eax, %eax
movq %r9, (%rcx)
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x1a56
pushq %rbp
pushq %r14
pushq %rbx
xorl %r9d, %r9d
xorl %eax, %eax
xorl %r10d, %r10d
movq %rdi, %r11
cmpq %rdx, %r10
jae 0x1a49
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 0x1a3c
cmpq $0x0, 0x10(%r11)
jne 0x1a3c
movb 0x4(%r11), %r11b
movslq %eax, %r14
incl %eax
movb %r11b, (%rcx,%r14)
movq %rdi, %r11
incq %r10
addl $-0x1, %ebx
jae 0x1a49
cmpq %rdx, %r10
jb 0x1a0a
incq %r9
cmpq %r8, %r9
jne 0x1a00
popq %rbx
popq %r14
popq %rbp
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x1cd8
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 0x1d00
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)
jmp 0x1c4d
cmpl $0x8, 0xc(%rsp)
jl 0x1cec
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_O1/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 0x1db9
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 0x1dab
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 0x1d9b
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 0x1d5d
movq 0x18(%rsp), %rcx
incq %rcx
cmpq (%rsp), %rcx
jne 0x1d3d
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r8, %r14
movq %rcx, 0x28(%rsp)
movq %rdi, 0x20(%rsp)
movq 0x70(%rsp), %r15
movl %esi, (%r9)
movq $0x0, (%r15)
xorl %eax, %eax
movl %esi, %ebp
movl $0x0, %r12d
cmpl %edx, %esi
jge 0x1eaa
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 0x1e8b
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 0x1e80
movslq %ebp, %rcx
incl %ebp
movb %r12b, (%r14,%rcx)
movl $0x7, %r13d
xorl %r12d, %r12d
incq %rdx
movl %r12d, %esi
cmpq %rdx, %rax
jne 0x1e50
movq 0x30(%rsp), %rcx
incq %rcx
cmpq 0x18(%rsp), %rcx
jne 0x1e23
cmpl $0x7, %r13d
setb %al
movq 0x10(%rsp), %r9
movl 0xc(%rsp), %esi
testb %al, %al
je 0x1eb7
movslq %ebp, %rbp
movb %r12b, (%r14,%rbp)
incl %ebp
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_O1/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
xorl %eax, %eax
xorl %edx, %edx
cmpq $0x1, (%rbx,%rax,8)
sbbl $-0x1, %edx
incq %rax
cmpq $0x80, %rax
jne 0x1f1a
leaq 0x11b4(%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 0x117d(%rip), %r12      # 0x30ec
xorl %r13d, %r13d
movq (%rbx,%r13,8), %rcx
testq %rcx, %rcx
je 0x1fb7
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 0x1f72
movq %r15, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x1030
// File: /workspace/github_c_makefile_star2_O1/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 0x1ef5
leaq 0x10e5(%rip), %rsi      # 0x30db
movq %r15, %rdi
movl %ebp, %edx
movq %r12, %rcx
xorl %eax, %eax
callq 0x1100
testl %ebp, %ebp
jle 0x2031
movl %ebp, %r13d
leaq 0x10d0(%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 0x2015
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq