LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/nilesr[P]dotter/./stb/stb_image_write.h
// Function: stbiw__write_run_data
void stbiw__write_run_data(stbi__write_context *s, int length, unsigned char databyte)
{
   unsigned char lengthbyte = STBIW_UCHAR(length+128);
   STBIW_ASSERT(length+128 <= 255);
   s->func(s->context, &lengthbyte, 1);
   s->func(s->context, &databyte, 1);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movb %dl, 0x7(%rsp)
leal -0x80(%rsi), %eax
movb %al, 0x6(%rsp)
cmpl $0x80, %esi
jge 0x1955
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
leaq 0x6(%rsp), %rsi
pushq $0x1
popq %rbp
movl %ebp, %edx
callq *(%rbx)
movq 0x8(%rbx), %rdi
leaq 0x7(%rsp), %rsi
movl %ebp, %edx
callq *(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x85fc(%rip), %rdi      # 0x9f58
leaq 0x8607(%rip), %rsi      # 0x9f6a
leaq 0x8618(%rip), %rcx      # 0x9f82
movl $0x203, %edx            # imm = 0x203
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/nilesr[P]dotter/./stb/stb_image_write.h
// Function: stbiw__write_dump_data
void stbiw__write_dump_data(stbi__write_context *s, int length, unsigned char *data)
{
   unsigned char lengthbyte = STBIW_UCHAR(length);
   STBIW_ASSERT(length <= 128); // inconsistent with spec but consistent with official code
   s->func(s->context, &lengthbyte, 1);
   s->func(s->context, data, length);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebp
movb %bpl, 0xf(%rsp)
cmpl $0x81, %esi
jge 0x19b3
movq %rdx, %r14
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
leaq 0xf(%rsp), %rsi
pushq $0x1
popq %rdx
callq *(%rbx)
movq 0x8(%rbx), %rdi
movq %r14, %rsi
movl %ebp, %edx
callq *(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x860e(%rip), %rdi      # 0x9fc8
leaq 0x85a9(%rip), %rsi      # 0x9f6a
leaq 0x860e(%rip), %rcx      # 0x9fd6
movl $0x20b, %edx            # imm = 0x20B
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/nilesr[P]dotter/./stb/stb_image_write.h
// Function: stbi_write_hdr_core
static int stbi_write_hdr_core(stbi__write_context *s, int x, int y, int comp, float *data)
{
   if (y <= 0 || x <= 0 || data == NULL)
      return 0;
   else {
      // Each component is stored separately. Allocate scratch space for full output scanline.
      unsigned char *scratch = (unsigned char *) STBIW_MALLOC(x*4);
      int i, len;
      char buffer[128];
      char header[] = "#?RADIANCE\n# Written by stb_image_write.h\nFORMAT=32-bit_rle_rgbe\n";
      s->func(s->context, header, sizeof(header)-1);

      len = sprintf(buffer, "EXPOSURE=          1.0000000000000\n\n-Y %d +X %d\n", y, x);
      s->func(s->context, buffer, len);

      for(i=0; i < y; i++)
         stbiw__write_hdr_scanline(s, x, comp, scratch, data + comp*i*x);
      STBIW_FREE(scratch);
      return 1;
   }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movl %ecx, %ebp
movl %edx, %ebx
testl %edx, %edx
setle %al
testl %esi, %esi
setle %cl
orb %al, %cl
movq %r8, 0x18(%rsp)
testq %r8, %r8
sete %dl
xorl %eax, %eax
orb %cl, %dl
jne 0x1d63
movl %esi, %r14d
movq %rdi, %r15
leal (,%r14,4), %edi
callq 0x1100
movq %rax, 0x10(%rsp)
leaq 0x8c0f(%rip), %rsi      # 0xa8e0
pushq $0x42
popq %rcx
leaq 0x20(%rsp), %rax
movq %rax, %rdi
rep  movsb (%rsi), %es:(%rdi)
movq 0x8(%r15), %rdi
pushq $0x41
popq %rdx
movq %rax, %rsi
callq *(%r15)
leaq 0x858a(%rip), %rsi      # 0xa27c
xorl %r13d, %r13d
leaq 0x70(%rsp), %r12
movq %r12, %rdi
movl %ebx, %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0x1180
movq 0x8(%r15), %rdi
movq %r12, %rsi
movl %eax, %edx
movl %ebx, 0xc(%rsp)
movq %r14, %rbx
movq %r15, %r14
callq *(%r15)
movl %ebp, %r15d
movq %rbx, %r12
imull %ebx, %ebp
movl 0xc(%rsp), %ebx
subq $0x1, %rbx
jb 0x1d56
movslq %r13d, %r13
movq 0x18(%rsp), %rax
leaq (%rax,%r13,4), %r8
movq %r14, %rdi
movl %r12d, %esi
movl %r15d, %edx
movq 0x10(%rsp), %rcx
callq 0x19d2
addl %ebp, %r13d
jmp 0x1d2c
movq 0x10(%rsp), %rdi
callq 0x1030
pushq $0x1
popq %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/nilesr[P]dotter/./stb/stb_image_write.h
// Function: stbi_write_png
STBIWDEF int stbi_write_png(char const *filename, int x, int y, int comp, const void *data, int stride_bytes)
{
   FILE *f;
   int len;
   unsigned char *png = stbi_write_png_to_mem((unsigned char *) data, stride_bytes, x, y, comp, &len);
   if (png == NULL) return 0;
   f = fopen(filename, "wb");
   if (!f) { STBIW_FREE(png); return 0; }
   fwrite(png, 1, len, f);
   fclose(f);
   STBIW_FREE(png);
   return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %r9d, %r10d
movl %ecx, %eax
movl %edx, %ecx
movl %esi, %edx
movq %rdi, %r14
leaq 0xc(%rsp), %r9
movq %r8, %rdi
movl %r10d, %esi
movl %eax, %r8d
callq 0x2646
testq %rax, %rax
je 0x2cab
movq %rax, %rbx
leaq 0x7467(%rip), %rsi      # 0xa0e2
movq %r14, %rdi
callq 0x1160
testq %rax, %rax
je 0x2caf
movq %rax, %r14
movslq 0xc(%rsp), %rdx
pushq $0x1
popq %rsi
movq %rbx, %rdi
movq %rax, %rcx
callq 0x1190
movq %r14, %rdi
callq 0x1060
pushq $0x1
popq %rbp
jmp 0x2cb1
xorl %ebp, %ebp
jmp 0x2cb9
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x1030
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/nilesr[P]dotter/dotter.c
// Function: dist
double dist(uint8_t* a, uint8_t* b, box_t box, int width) {
   double res = 0;
   // Add up the differences in each pixel
   for (int x = box.x1; x < box.x2; x++) {
      for (int y = box.y1; y < box.y2; y++) {
         res += subtract(getpixel(a, x, y, width), getpixel(b, x, y, width));
      }
   }
   // divide by the area (width*height) of the box
   return res / ((box.x2 - box.x1) * (box.y2 - box.y1));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r13
movq %rdi, %rbp
movq %rdx, %r9
sarq $0x20, %r9
movq %rcx, %rbx
sarq $0x20, %rbx
movslq %r8d, %rax
movq %rdx, 0x8(%rsp)
movslq %edx, %r14
movq %rcx, 0x10(%rsp)
movslq %ecx, %rcx
movq %rcx, 0x20(%rsp)
movq %r9, 0x18(%rsp)
movq %r9, %rcx
imulq %rax, %rcx
addq %r14, %rcx
leaq (%rcx,%rcx,2), %rcx
addq %rcx, %rbp
leaq (%rax,%rax,2), %r15
addq %rcx, %r13
xorpd %xmm0, %xmm0
movsd %xmm0, (%rsp)
cmpq 0x20(%rsp), %r14
jge 0x48eb
movq %r13, 0x30(%rsp)
movq %rbp, 0x28(%rsp)
movq 0x18(%rsp), %r12
cmpq %rbx, %r12
jge 0x48d4
movq %rbp, %rdi
movq %r13, %rsi
callq 0x4803
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
incq %r12
addq %r15, %rbp
addq %r15, %r13
jmp 0x48ab
incq %r14
movq 0x28(%rsp), %rbp
addq $0x3, %rbp
movq 0x30(%rsp), %r13
addq $0x3, %r13
jmp 0x4895
movq 0x10(%rsp), %rdx
movq %rdx, %rax
shrq $0x20, %rax
movq 0x8(%rsp), %rsi
movq %rsi, %rcx
shrq $0x20, %rcx
subl %esi, %edx
subl %ecx, %eax
imull %edx, %eax
cvtsi2sd %eax, %xmm1
movsd (%rsp), %xmm0
divsd %xmm1, %xmm0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x4934
subl %eax, 0x8(%rdi)
andl $0x0, (%rdi)
xorl %eax, %eax
movl 0x4(%rdi), %r8d
movl 0xc(%rdi), %r9d
testl %r8d, %r8d
jns 0x494f
subl %r8d, %r9d
movl %r9d, 0xc(%rdi)
andl $0x0, 0x4(%rdi)
xorl %r8d, %r8d
cmpl %edx, %r9d
jle 0x4965
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 0x4977
addl %ecx, %ecx
subl %ecx, %edx
movl %edx, 0x8(%rdi)
subl %ecx, %eax
movl %eax, (%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r12
pushq %rbx
movq %rdx, %r10
movl %r10d, %eax
subl %esi, %eax
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
cltd
idivl %ebp
movl %eax, %r11d
subl %esi, %r11d
movq %rsi, %rbx
movslq %esi, %r14
movq %rsi, %r12
shrq $0x20, %r12
movq %r10, %rsi
movslq %r10d, %r15
shrq $0x20, %r10
subl %r12d, %r10d
cvtsi2sd %r9d, %xmm0
movl %r10d, %eax
cltd
idivl %ebp
sarq $0x20, %rbx
sarq $0x20, %rsi
movslq %r8d, %r8
subl %r12d, %eax
movq %rbx, %rdx
imulq %r8, %rdx
addq %r14, %rdx
leaq (%rdx,%rdx,2), %rdx
addq %rdi, %rdx
leaq (%r8,%r8,2), %rdi
cmpq %r15, %r14
jge 0x4a2e
leal (%r11,%r14), %r8d
imull %r8d, %r8d
movq %rdx, %r9
movq %rbx, %r10
cmpq %rsi, %r10
jge 0x4a25
leal (%rax,%r10), %ebp
imull %ebp, %ebp
addl %r8d, %ebp
cvtsi2sd %ebp, %xmm1
sqrtsd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x4a1d
movb 0x2(%rcx), %bpl
movb %bpl, 0x2(%r9)
movzwl (%rcx), %ebp
movw %bp, (%r9)
incq %r10
addq %rdi, %r9
jmp 0x49f1
incq %r14
addq $0x3, %rdx
jmp 0x49de
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/starius[P]dna-complement/dna-complement.c
// Function: initializeTranslate
void initializeTranslate() {
    int i;
    for (i = 0; i < NCHARS; i++) {
        translate[i] = i;
    }
    translate['A'] = 'T';
    translate['T'] = 'A';
    translate['G'] = 'C';
    translate['C'] = 'G';
    translate['a'] = 't';
    translate['t'] = 'a';
    translate['g'] = 'c';
    translate['c'] = 'g';
#if USE_SHORT
    int x, y;
    for (x = 0; x < NCHARS; x++) {
        for (y = 0; y < NCHARS; y++) {
            unsigned short in_xy = (x << 8) | y;
            unsigned short out_xy =
                ((unsigned short)(translate[x]) << 8) |
                (unsigned short)(translate[y]);
            short_translate[in_xy] = out_xy;
        }
    }
#endif
}

// Assembly:
xorl %ecx, %ecx
leaq 0x2ecb(%rip), %rax      # 0x4070
cmpq $0x100, %rcx            # imm = 0x100
je 0x11b6
movb %cl, (%rcx,%rax)
incq %rcx
jmp 0x11a5
movb $0x54, 0x2ef4(%rip)     # 0x40b1
movb $0x41, 0x2f00(%rip)     # 0x40c4
movb $0x43, 0x2eec(%rip)     # 0x40b7
movb $0x47, 0x2ee1(%rip)     # 0x40b3
movb $0x74, 0x2ef8(%rip)     # 0x40d1
movb $0x61, 0x2f04(%rip)     # 0x40e4
movb $0x63, 0x2ef0(%rip)     # 0x40d7
movb $0x67, 0x2ee5(%rip)     # 0x40d3
leaq 0x2f7b(%rip), %rcx      # 0x4170
xorl %edx, %edx
cmpq $0x100, %rdx            # imm = 0x100
je 0x1230
movzbl (%rdx,%rax), %esi
shll $0x8, %esi
xorl %edi, %edi
cmpq $0x100, %rdi            # imm = 0x100
je 0x1224
movsbl (%rdi,%rax), %r8d
orl %esi, %r8d
movw %r8w, (%rcx,%rdi,2)
incq %rdi
jmp 0x1209
incq %rdx
addq $0x200, %rcx            # imm = 0x200
jmp 0x11f7
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x2437
callq 0x3fdc
cmpl $0x3, %ebx
jne 0x2469
movq 0x8(%r14), %rdi
leaq 0x8(%rsp), %rsi
callq 0x5d90
testq %rax, %rax
jne 0x2497
callq 0x2090
cmpl $0x0, (%rax)
jne 0x24c9
leaq 0x7be1(%rip), %rdi      # 0xa041
xorl %eax, %eax
callq 0x41e8
jmp 0x248f
movq 0xdb88(%rip), %rax      # 0xfff8
movq (%rax), %rdi
leaq 0x7b8a(%rip), %rsi      # 0xa004
leaq 0x7b9a(%rip), %rdx      # 0xa01b
leaq 0x7ba0(%rip), %rcx      # 0xa028
xorl %eax, %eax
callq 0x21b0
pushq $0x1
popq %rdi
callq 0x22a0
movq %rax, %rbx
movq 0x10(%r14), %r15
leaq 0x7bbe(%rip), %rsi      # 0xa063
movq %r15, %rdi
callq 0x21a0
testl %eax, %eax
jne 0x24df
movq 0x8(%rsp), %rdi
leaq 0x7ba6(%rip), %rsi      # 0xa063
leaq 0x7ba8(%rip), %rdx      # 0xa06c
pushq $0x1
popq %rcx
jmp 0x2507
movq %rax, %rbx
leaq 0x7b6e(%rip), %rdi      # 0xa041
xorl %eax, %eax
callq 0x4059
andl $0x0, (%rbx)
jmp 0x248f
leaq 0x7b86(%rip), %rsi      # 0xa06c
movq %r15, %rdi
callq 0x21a0
testl %eax, %eax
jne 0x2523
movq 0x8(%rsp), %rdi
leaq 0x7b6e(%rip), %rsi      # 0xa06c
leaq 0x7b5e(%rip), %rdx      # 0xa063
xorl %ecx, %ecx
callq 0x255c
testl %eax, %eax
jne 0x248f
movq %rbx, %rdi
callq 0x5ecb
xorl %edi, %edi
callq 0x22a0
leaq 0x7b47(%rip), %rsi      # 0xa071
movq %r15, %rdi
callq 0x21a0
testl %eax, %eax
jne 0x254d
movq 0x8(%rsp), %rdi
movq 0x10(%r14), %rsi
callq 0x27f6
testl %eax, %eax
je 0x2536
jmp 0x248f
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x27f6
jmp 0x250c
// File: /workspace/github_c_makefile_star2_O2/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:
cmpq $0x20, %rcx
jne 0x16f44
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %r8, %r14
movq %rsi, %rbx
movzbl %bl, %eax
movl $0x100, %r13d           # imm = 0x100
subq %rax, %r13
leaq (%rsi,%r13), %rcx
addq $0x20, %rcx
testq %r8, %r8
je 0x1702e
cmpq %rcx, (%r9)
jae 0x16f48
pushq $-0x1
popq %rax
jmp 0x17030
pushq $-0x1
popq %rax
retq
movq %rdi, %rsi
movq %rcx, 0x8(%rsp)
leaq (%rbx,%r13), %rbp
leaq 0x10(%rsp), %rax
xorl %ecx, %ecx
cmpq $0x8, %rcx
je 0x16f82
xorl %edi, %edi
cmpq $0x20, %rdi
je 0x16f79
movb (%rdx,%rdi), %r8b
rolb %cl, %r8b
movb %r8b, (%rax,%rdi)
incq %rdi
jmp 0x16f63
incq %rcx
addq $0x20, %rax
jmp 0x16f5b
movq %r9, (%rsp)
movups (%rdx), %xmm0
movups 0x10(%rdx), %xmm1
movups %xmm1, 0x10(%r14)
movups %xmm0, (%r14)
leaq 0x20(%r14), %r15
movq %r15, %rdi
movq %rbx, %rdx
callq 0x10d0
cmpq %rbx, %rbp
jbe 0x16fba
addq %r15, %rbx
movq %rbx, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x1080
movb %r13b, 0x1f(%r14,%rbp)
pushq $0x20
popq %rbp
leaq 0x110(%rsp), %r13
movl $0x100, %r12d           # imm = 0x100
movq 0x8(%rsp), %rcx
cmpq %rcx, %rbp
jae 0x1702a
leaq (%r14,%rbp), %rbx
xorl %eax, %eax
cmpq $0x100, %rax            # imm = 0x100
je 0x16ff5
movb 0x10(%rsp,%rax), %cl
xorb %cl, (%r15,%rax)
incq %rax
jmp 0x16fe0
movq %rbx, %rdi
movq %r13, %rsi
callq 0x10a0
movl $0x100, %edx            # imm = 0x100
leaq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x10d0
movl $0x100, %edx            # imm = 0x100
movq %rbx, %rdi
movq %r13, %rsi
callq 0x10d0
addq %r12, %rbp
addq %r12, %r15
jmp 0x16fd0
movq (%rsp), %r9
xorl %eax, %eax
movq %rcx, (%r9)
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r12
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
movaps 0x70a(%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 0x1c3c
movl %eax, %ebp
leaq 0x10(%rsp), %rdi
callq 0x1080
movabsq $0x400000000, %r12      # imm = 0x400000000
leaq 0x8(%rsp), %r14
pushq $0x1
popq %r15
movq %r12, 0x8(%rsp)
movl %ebp, 0x8(%rsp)
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x11f0
testl %eax, %eax
js 0x1c23
incq (%rbx)
jmp 0x1c04
leaq 0x684(%rip), %rdi       # 0x22ae
leaq 0x63c(%rip), %rsi       # 0x226d
leaq 0x643(%rip), %rcx       # 0x227b
pushq $0x18
jmp 0x1c53
leaq 0x622(%rip), %rdi       # 0x2265
leaq 0x623(%rip), %rsi       # 0x226d
leaq 0x62a(%rip), %rcx       # 0x227b
pushq $0xe
popq %rdx
callq 0x1130
// File: /workspace/github_c_makefile_star2_O2/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 0x5bb0(%rip), %rcx      # 0x8304
cmpq $-0x1, %rcx
je 0x2778
leaq 0x5bcf(%rip), %rsi      # 0x8330
xorl %edx, %edx
pushq $-0x1
popq %rax
cmpq %rdx, %rcx
je 0x2785
cmpl %edi, (%rsi)
je 0x2786
incq %rdx
addq $0x4, %rsi
jmp 0x2766
movl $0x0, 0x5ba2(%rip)      # 0x8324
pushq $-0x1
popq %rax
retq
movl %edx, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x5b74(%rip), %rcx      # 0x8304
cmpq $-0x1, %rcx
je 0x27a9
leaq 0x5b93(%rip), %rax      # 0x8330
movl (%rax,%rcx,4), %eax
decl %ecx
movl %ecx, 0x5b5c(%rip)      # 0x8304
retq
pushq %rax
movl $0x0, 0x5b70(%rip)      # 0x8324
leaq 0x291a(%rip), %rdi      # 0x50d5
callq 0x20c0
pushq $-0x7f
popq %rax
addq $0x8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x5b35(%rip), %rax      # 0x8304
cmpl 0x5b2b(%rip), %eax      # 0x8300
jne 0x27ec
pushq %rax
leaq 0x2922(%rip), %rdi      # 0x5101
callq 0x20c0
pushq $-0x80
popq %rax
addq $0x8, %rsp
retq
leaq 0x1(%rax), %rcx
movl %ecx, 0x5b0e(%rip)      # 0x8304
leaq 0x5b33(%rip), %rcx      # 0x8330
movl %edi, 0x4(%rcx,%rax,4)
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/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
xorl %r14d, %r14d
movl 0x50(%rsp), %ebp
movq %rsp, %rbx
cmpq $0x0, (%r15)
je 0x2869
movq %rbx, %rdi
callq 0x21e0
callq 0x25a0
testl %eax, %eax
je 0x2874
cmpl $-0x1, %eax
je 0x28bd
testl %ebp, %ebp
jne 0x2856
xorl %edi, %edi
callq 0x2580
movl 0x4(%rsp), %edi
callq 0x21d0
movl (%rsp), %r14d
addq $0x8, %r15
jmp 0x282f
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl %r14d, %edi
xorl %esi, %esi
callq 0x2170
cmpq $0x0, 0x8(%r15)
je 0x2891
movl 0x4(%rsp), %edi
pushq $0x1
popq %rsi
callq 0x2170
movl (%rsp), %edi
callq 0x21d0
movq (%r15), %rsi
movq (%rsi), %rdi
callq 0x2490
cmpl $-0x1, %eax
jne 0x28bd
movq (%r15), %rax
movq (%rax), %rsi
leaq 0x2752(%rip), %rdi      # 0x5008
xorl %eax, %eax
callq 0x2180
pushq $0x1
popq %rdi
callq 0x24e0
// File: /workspace/github_c_makefile_star2_O2/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 0x5a24(%rip), %rsi      # 0x8320
pushq $-0x1
popq %rdi
pushq $0x1
popq %rdx
callq 0x2410
movl 0x61f7(%rip), %edi      # 0x8b04
testl %edi, %edi
je 0x293f
xorl %esi, %esi
callq 0x2300
testl %eax, %eax
jne 0x293f
movl 0x61e2(%rip), %edi      # 0x8b04
pushq $0x14
popq %rsi
callq 0x3439
movl 0x61d4(%rip), %edi      # 0x8b04
callq 0x27c8
movl $0x1, 0x59e5(%rip)      # 0x8324
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/johanDa9u[P]MiniShell/src/shell.c
// Function: to_stop
void to_stop()
{
	if (isempty() != 1)
	{
		Kill(pop(), SIGTERM);
	}
	if (top == -1)
	{
		suspendedJobs = 0;
	}
}

// Assembly:
cmpl $-0x1, 0x597b(%rip)     # 0x8304
je 0x29aa
pushq %rax
callq 0x2789
pushq $0xf
popq %rsi
movl %eax, %edi
callq 0x3439
cmpl $-0x1, 0x5962(%rip)     # 0x8304
leaq 0x8(%rsp), %rsp
je 0x29b4
retq
movl $0x0, 0x5970(%rip)      # 0x8324
movl $0x0, 0x5966(%rip)      # 0x8324
retq
// File: /workspace/github_c_makefile_star2_O2/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, 0x592c(%rip)     # 0x8304
je 0x29f1
leaq 0x2654(%rip), %rdi      # 0x5035
callq 0x20c0
movl $0x2710, %edi           # imm = 0x2710
popq %rax
jmp 0x25b0
movl $0x0, 0x5929(%rip)      # 0x8324
xorl %edi, %edi
callq 0x24e0
// File: /workspace/github_c_makefile_star2_O2/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
xorl %r15d, %r15d
movq (%rbx,%r15,8), %r14
testq %r14, %r14
je 0x32c0
movq %r14, %r12
movq (%r12), %rdi
testq %rdi, %rdi
je 0x32b3
callq 0x2050
addq $0x8, %r12
jmp 0x329f
movq %r14, %rdi
callq 0x2050
incq %r15
jmp 0x3293
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2050
// File: /workspace/github_c_makefile_star2_O2/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 0x34d0
movq 0x8(%rsp), %rax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r14
retq
leaq 0x1d47(%rip), %rdi      # 0x521e
callq 0x32f0
// File: /workspace/github_c_makefile_star2_O2/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 0x3582
movl %ebx, %eax
popq %rbx
retq
leaq 0x1d09(%rip), %rdi      # 0x5292
callq 0x32f0
// File: /workspace/github_c_makefile_star2_O2/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 0x3755
popq %rcx
retq
leaq 0x1bce(%rip), %rdi      # 0x532a
callq 0x32f0
// File: /workspace/github_c_makefile_star2_O2/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
andl $0x0, (%rax)
movq %r14, %rdi
callq 0x2320
testq %rax, %rax
jne 0x3785
cmpl $0x0, (%rbx)
jne 0x378d
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x1ba4(%rip), %rdi      # 0x5338
callq 0x32f0
// File: /workspace/github_c_makefile_star2_O2/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 0x39df
popq %rax
retq
leaq 0x1a69(%rip), %rsi      # 0x544f
movl %eax, %edi
callq 0x335f
// File: /workspace/github_c_makefile_star2_O2/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 0x3a19
js 0x3a25
popq %rax
retq
leaq 0x1a51(%rip), %rdi      # 0x5471
callq 0x3393
leaq 0x1a75(%rip), %rdi      # 0x54a1
callq 0x32f0
// File: /workspace/github_c_makefile_star2_O2/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 %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r15
movl %edi, %ebp
pushq $-0x1
popq %r14
movq %rdx, %r12
testq %r12, %r12
je 0x3b69
movl %ebp, %edi
movq %r15, %rsi
movq %r12, %rdx
callq 0x2220
testq %rax, %rax
js 0x3b55
jne 0x3b61
jmp 0x3b69
callq 0x2070
cmpl $0x4, (%rax)
jne 0x3b6f
xorl %eax, %eax
subq %rax, %r12
addq %rax, %r15
jmp 0x3b3a
subq %r12, %rbx
movq %rbx, %r14
movq %r14, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
pushq $-0x1
popq %r12
movq %rdx, %r15
testq %r15, %r15
je 0x3bc0
movl %ebp, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2110
testq %rax, %rax
jg 0x3bb5
callq 0x2070
cmpl $0x4, (%rax)
jne 0x3bbd
xorl %eax, %eax
subq %rax, %r15
addq %rax, %r14
jmp 0x3b92
movq %r12, %rbx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r13
pushq $-0x1
popq %r14
movq %rdx, %r12
testq %r12, %r12
je 0x3c16
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x3c29
testq %rax, %rax
js 0x3c1c
je 0x3c16
subq %rax, %r12
addq %rax, %r15
jmp 0x3bf4
subq %r12, %rbx
movq %rbx, %r14
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x10(%rdi), %r13
movl 0x4(%rdi), %ebp
pushq $-0x1
popq %r14
testl %ebp, %ebp
jg 0x3c79
movl (%rbx), %edi
movl $0x2000, %edx           # imm = 0x2000
movq %r13, %rsi
callq 0x2220
movq %rax, %rbp
movl %ebp, 0x4(%rbx)
testl %ebp, %ebp
js 0x3c6d
je 0x3c9e
movq %r13, 0x8(%rbx)
jmp 0x3c48
callq 0x2070
cmpl $0x4, (%rax)
je 0x3c48
jmp 0x3ca1
movl %ebp, %eax
cmpq %r12, %rax
cmovael %r12d, %ebp
movq 0x8(%rbx), %rsi
movslq %ebp, %r14
movq %r15, %rdi
movq %r14, %rdx
callq 0x22e0
addq %r14, 0x8(%rbx)
subl %r14d, 0x4(%rbx)
jmp 0x3ca1
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rsi, %rbx
cmpq $0x1, %rdx
movq %rdx, %rax
adcq $0x0, %rax
movq %rax, 0x10(%rsp)
movq %rdi, %r15
xorl %ebp, %ebp
pushq $0x1
popq %r13
leaq 0x1(%rbp), %r12
cmpq %r14, %r12
jae 0x3d27
movq %r15, %rdi
leaq 0xf(%rsp), %rsi
movq %r13, %rdx
callq 0x3c29
cmpq $0x1, %rax
jne 0x3d18
movb 0xf(%rsp), %al
movb %al, (%rbx,%rbp)
incq %rbp
cmpb $0xa, %al
jne 0x3ce0
addq %rbp, %rbx
incq %rbp
movq %rbp, %r12
jmp 0x3d2f
testq %rax, %rax
jne 0x3d3a
testq %rbp, %rbp
je 0x3d3f
addq %rbp, %rbx
jmp 0x3d2f
addq %rbp, %rbx
movq 0x10(%rsp), %r12
movb $0x0, (%rbx)
decl %r12d
movslq %r12d, %rax
jmp 0x3d41
pushq $-0x1
popq %rax
jmp 0x3d41
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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, %r15
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), %r14
movq %r14, %rcx
callq 0x2510
testl %eax, %eax
jne 0x3e67
pushq $-0x1
popq %rbx
movq (%r14), %r14
testq %r14, %r14
je 0x3e50
movl 0x4(%r14), %edi
movl 0x8(%r14), %esi
movl 0xc(%r14), %edx
callq 0x25d0
testl %eax, %eax
js 0x3e48
movl %eax, %ebp
movq 0x18(%r14), %rsi
movl 0x10(%r14), %edx
movl %eax, %edi
callq 0x24f0
cmpl $-0x1, %eax
jne 0x3e4e
movl %ebp, %edi
callq 0x21d0
testl %eax, %eax
js 0x3e96
addq $0x28, %r14
jmp 0x3e0a
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 0x418a(%rip), %rcx      # 0x7ff8
movq (%rcx), %r14
movl %eax, %edi
callq 0x2190
leaq 0x1711(%rip), %rsi      # 0x5590
movq %r14, %rdi
movq %r15, %rdx
movq %rbx, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x2290
pushq $-0x2
jmp 0x3ec2
movq 0x415b(%rip), %rax      # 0x7ff8
movq (%rax), %rbx
callq 0x2070
movl (%rax), %edi
callq 0x2530
leaq 0x16fd(%rip), %rsi      # 0x55b0
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2290
pushq $-0x1
popq %rbx
jmp 0x3e5a
// File: /workspace/github_c_makefile_star2_O2/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 0x12c9
popq %rcx
retq
pushq $0x1
popq %rdi
callq 0x1190
// File: /workspace/github_c_makefile_star2_O2/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
cmpq $0x80, %r14
je 0x12f2
movq (%rbx,%r14,8), %rdi
callq 0x1030
incq %r14
jmp 0x12db
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1030
// File: /workspace/github_c_makefile_star2_O2/teodorst[P]app-huffman/huffman_serial.c
// Function: huffman_decompress
int huffman_decompress(char* input_filename, char* output_filename, char *codification_filename) {
    unsigned long long int nbits = 0;

    FILE* codification_fp = open_file(codification_filename, "r");

    char** codification = read_configuration(codification_fp, &nbits);

    fprintf(stderr, "got bits");

    /* for each codification find the leaf and save it into a buffer */
    node_t* root = build_huffman_tree_from_codification(codification);
    fprintf(stderr, "got tree");
    // int top = 0;
    // char path[MAX_BITS_CODE];
    // print_codes(root, path, top);
    /* read the bytes from the inputfile,  */

    FILE* input_fp = open_file(input_filename, "r");
    FILE* out_fp = open_file(output_filename, "w");

    /* decode the bytes using huffman tree */
    decode_bytes(input_fp, out_fp, root, nbits);

    free_codification_matrix(codification);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, 0x8(%rsp)
movq %rdi, %r12
leaq 0x10(%rsp), %rbx
andq $0x0, (%rbx)
leaq 0x1b29(%rip), %rsi      # 0x3004
movq %rdx, %rdi
callq 0x12bc
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1f5a
movq %rax, %r15
movq 0x3b00(%rip), %r14      # 0x4ff8
movq (%r14), %rcx
leaq 0x1b06(%rip), %rdi      # 0x3008
pushq $0x8
popq %rbp
pushq $0x1
popq %r13
movq %rbp, %rsi
movq %r13, %rdx
callq 0x11a0
movq %r15, %rdi
callq 0x22d1
movq %rax, %rbx
movq (%r14), %rcx
leaq 0x1ae8(%rip), %rdi      # 0x3011
movq %rbp, %rsi
movq %r13, %rdx
callq 0x11a0
movq %r12, %rdi
leaq 0x1ac6(%rip), %rsi      # 0x3004
callq 0x12bc
movq %rax, %r12
leaq 0x1ab9(%rip), %rsi      # 0x3006
movq 0x8(%rsp), %rdi
callq 0x12bc
leaq 0x10(%rsp), %rcx
movq (%rcx), %rcx
movq %r12, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x1993
movq %r15, %rdi
callq 0x12d1
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x15bc
movq %rsi, %rbx
movq 0x8(%rsi), %r14
leaq 0x1a7f(%rip), %rsi      # 0x301c
movq %r14, %rdi
callq 0x10f0
testl %eax, %eax
je 0x15d9
leaq 0x1a6a(%rip), %rsi      # 0x301a
movq %r14, %rdi
callq 0x10f0
testl %eax, %eax
je 0x15ec
leaq 0x1a62(%rip), %rdi      # 0x3025
callq 0x1060
leaq 0x1a64(%rip), %rdi      # 0x3033
callq 0x1060
pushq $0x1
popq %rax
jmp 0x15ff
movq 0x10(%rbx), %rdi
movq 0x18(%rbx), %rsi
movq 0x20(%rbx), %rdx
callq 0x1301
jmp 0x15fd
movq 0x10(%rbx), %rdi
movq 0x18(%rbx), %rsi
movq 0x20(%rbx), %rdx
callq 0x14b5
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O2/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), %eax
cmpl 0xc(%rdi), %eax
jne 0x1648
leal (%rax,%rax), %ecx
testl %eax, %eax
pushq $0x4
popq %rax
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
testl %eax, %eax
jle 0x166f
movl (%r14), %esi
movl %eax, %edx
movq (%rbx), %rcx
testl %edx, %edx
je 0x1674
movl %edx, %edi
shrl %edi
movq (%rcx,%rdi,8), %r8
cmpl %esi, (%r8)
jle 0x1674
movl %edx, %edx
movq %r8, (%rcx,%rdx,8)
movl %edi, %edx
jmp 0x1651
movq (%rbx), %rcx
movl %eax, %edx
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_O2/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 0x1731
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 0x16df
movq (%rdi), %r9
movslq %r10d, %r11
movq (%r9,%r11,8), %r11
movl (%r11), %r11d
movq (%r9,%r8,8), %r9
cmpl (%r9), %r11d
jl 0x16dc
movl %edx, %r10d
movl %r10d, %r9d
leal (%rdx,%rdx), %r10d
addl $0x2, %r10d
cmpl %ecx, %r10d
jge 0x170a
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 0x1707
movl %r9d, %r10d
movl %r10d, %r9d
cmpl %r9d, %edx
je 0x172d
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 0x16b0
popq %rbx
popq %r14
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
xorl %r12d, %r12d
pushq $0x18
popq %r15
cmpq $0x80, %r12
je 0x1782
movq (%r14,%r12,8), %r13
testq %r13, %r13
je 0x177d
movq %r15, %rdi
callq 0x1120
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movl %r13d, (%rax)
movb %r12b, 0x4(%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1613
incq %r12
jmp 0x174a
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x1915(%rip), %r14      # 0x30b0
xorl %r15d, %r15d
cmpq $0x80, %r15
je 0x17bf
movq (%rbx,%r15,8), %rsi
testq %rsi, %rsi
je 0x17ba
movq %r14, %rdi
xorl %eax, %eax
callq 0x10a0
incq %r15
jmp 0x179e
pushq $0xa
popq %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x1040
// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x8
popq %rsi
movl $0x80, %edi
callq 0x10e0
movq %rax, %r14
movq %rsp, %r15
pushq $0x1
popq %r12
movl $0x6400000, %edx        # imm = 0x6400000
movq %r15, %rdi
xorl %esi, %esi
callq 0x10b0
movl $0x6400000, %edx        # imm = 0x6400000
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rcx
callq 0x1070
testq %rax, %rax
je 0x1856
movl $0x6400000, %ecx        # imm = 0x6400000
cmpq %rcx, %rax
jb 0x1845
movl $0x6400000, %eax        # imm = 0x6400000
movq %r15, %rdi
xorl %esi, %esi
movl %eax, %edx
movq %r14, %rcx
callq 0x17cc
jmp 0x180f
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
// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x18
popq %rdi
callq 0x1120
movb %bl, 0x4(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
popq %rbx
retq