LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/janmojzis[P]mcencrypt/poly1305.c
// Function: poly1305_verify
int poly1305_verify(const unsigned char *h, const unsigned char *in, unsigned long long l, const unsigned char *k) {

    unsigned char correct[16];
    unsigned int d = 0;
    long long i;

    poly1305(correct, in, l, k);

    for (i = 0; i < 16; ++i) d |= correct[i] ^ h[i];
    return (1 & ((d - 1) >> 8)) - 1;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq %rsp, %rdi
callq 0x649b
xorl %eax, %eax
xorl %ecx, %ecx
movb (%rbx,%rax), %dl
xorb (%rsp,%rax), %dl
movzbl %dl, %edx
orl %edx, %ecx
incq %rax
cmpq $0x10, %rax
jne 0x64fc
decl %ecx
xorl %eax, %eax
btl $0x8, %ecx
adcl $-0x1, %eax
addq $0x10, %rsp
popq %rbx
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/janmojzis[P]mcencrypt/randombytes.c
// Function: randombytes
void randombytes(void *xv, unsigned long long xlen) {

    long long i;
    unsigned char *x = xv;

    if (fd == -1) {
        for (;;) {
#ifdef O_CLOEXEC
            fd = open("/dev/urandom", O_RDONLY | O_CLOEXEC);
#else
            fd = open("/dev/urandom", O_RDONLY);
            fcntl(fd, F_SETFD, 1);
#endif
            if (fd != -1) break;
            sleep(1);
        }
    }

    while (xlen > 0) {
        if (xlen < 1048576) i = xlen; else i = 1048576;

        i = read(fd, x, i);
        if (i < 1) {
            sleep(1);
            continue;
        }

        x += i;
        xlen -= i;
    }
    __asm__ __volatile__("" : : "r"(xv) : "memory");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
cmpl $-0x1, 0x3b6c(%rip)     # 0xa0a8
jne 0x6587
leaq 0x181b(%rip), %rdi      # 0x7d60
movl $0x80000, %esi          # imm = 0x80000
xorl %eax, %eax
callq 0x1100
movl %eax, 0x3b51(%rip)      # 0xa0a8
cmpl $-0x1, %eax
jne 0x6587
leaq 0x17fd(%rip), %r15      # 0x7d60
movl $0x1, %edi
callq 0x1110
movq %r15, %rdi
movl $0x80000, %esi          # imm = 0x80000
xorl %eax, %eax
callq 0x1100
movl %eax, 0x3b26(%rip)      # 0xa0a8
cmpl $-0x1, %eax
je 0x6563
testq %r14, %r14
sete %bpl
je 0x65da
movl $0x100000, %r13d        # imm = 0x100000
movq %rbx, %r15
cmpq %r13, %r14
movl $0x100000, %r12d        # imm = 0x100000
cmovbq %r14, %r12
movl 0x3afc(%rip), %edi      # 0xa0a8
movq %r15, %rsi
movq %r12, %rdx
callq 0x1090
testq %rax, %rax
jg 0x65ce
movl $0x1, %edi
callq 0x1110
testb $0x1, %bpl
je 0x65a6
jmp 0x65da
addq %rax, %r15
subq %rax, %r14
sete %bpl
jne 0x6599
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/janmojzis[P]mcencrypt/readblock.c
// Function: readblock
long long readblock(int fd, void *x, long long xlen) {

    long long r;
    char *buf = x;

    while (xlen > 0) {
        r = xlen;
        if (r > 1048576) r = 1048576; 
        r = read(fd, buf, r);
        if (r == 0) break;
        if (r == -1) {
            if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) {
                struct pollfd p;
                p.fd = fd;
                p.events = POLLIN;
                poll(&p, 1, -1);
                continue;
            }
            return -1;
        }
        buf += r; xlen -= r;
    }
    return (buf - (char *)x);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
testq %rdx, %rdx
setg %bl
jle 0x669f
movq %rdx, %r15
movl %edi, %ebp
movl $0x100000, %eax         # imm = 0x100000
leaq 0x10(%rsp), %r12
movq %rsi, %r14
movq %rsi, 0x8(%rsp)
cmpq %rax, %r15
movl $0x100000, %r13d        # imm = 0x100000
cmovlq %r15, %r13
movl %ebp, %edi
movq %r14, %rsi
movq %r13, %rdx
callq 0x1090
cmpq $-0x1, %rax
jne 0x6675
callq 0x1040
movl (%rax), %eax
cmpl $0xb, %eax
je 0x6651
cmpl $0x4, %eax
jne 0x66b4
movl %ebp, 0x10(%rsp)
movw $0x1, 0x14(%rsp)
movl $0x1, %esi
movq %r12, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x10d0
testb $0x1, %bl
jne 0x662d
jmp 0x669a
testq %rax, %rax
je 0x669a
addq %rax, %r14
movq %r15, %rcx
subq %rax, %rcx
testq %rcx, %rcx
setg %bl
subq %rax, %r15
movq 0x8(%rsp), %rsi
movl $0x100000, %eax         # imm = 0x100000
jg 0x6620
jmp 0x669f
movq 0x8(%rsp), %rsi
subq %rsi, %r14
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq $-0x1, %r14
jmp 0x66a2
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/janmojzis[P]mcencrypt/root.c
// Function: eval
gf eval(gf *f, gf a)
{
	int i;
	gf r;
	
	r = f[ SYS_T ];

	for (i = SYS_T-1; i >= 0; i--)
	{
		r = gf_mul(r, a);
		r = gf_add(r, f[i]);
	}

	return r;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movzwl 0x100(%rdi), %eax
movl $0x7f, %r14d
movzwl %si, %ebp
movzwl %ax, %edi
movl %ebp, %esi
callq 0x4f64
movzwl (%rbx,%r14,2), %esi
movzwl %ax, %edi
callq 0x4f5f
addq $-0x1, %r14
jb 0x66d7
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/janmojzis[P]mcencrypt/synd.c
// Function: synd
void synd(gf *out, gf *f, gf *L, unsigned char *r)
{
	int i, j;
	gf e, e_inv, c;

	for (j = 0; j < 2*SYS_T; j++)
		out[j] = 0;

	for (i = 0; i < SYS_N; i++)
	{
		c = (r[i/8] >> (i%8)) & 1;

		e = eval(f, L[i]);
		e_inv = gf_inv(gf_mul(e,e));

		for (j = 0; j < 2*SYS_T; j++)
		{
			out[j] = gf_add(out[j], gf_mul(e_inv, c));
			e_inv = gf_mul(e_inv, L[i]);
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, 0x10(%rsp)
movq %rdx, %r15
movq %rsi, 0x8(%rsp)
movq %rdi, %r12
movq $0x0, (%rsp)
movl $0x200, %edx            # imm = 0x200
xorl %esi, %esi
callq 0x1070
movq (%rsp), %rdx
movl %edx, %eax
shrl $0x3, %eax
movq 0x10(%rsp), %rcx
movzbl (%rcx,%rax), %eax
movl %edx, %ecx
andl $0x7, %ecx
xorl %ebx, %ebx
btl %ecx, %eax
setb %bl
movzwl (%r15,%rdx,2), %esi
movq 0x8(%rsp), %rdi
callq 0x66c0
movzwl %ax, %edi
movl %edi, %esi
callq 0x4f64
movzwl %ax, %edi
callq 0x56e3
movzwl %bx, %ebp
xorl %r14d, %r14d
movzwl (%r12,%r14,2), %r13d
movzwl %ax, %ebx
movl %ebx, %edi
movl %ebp, %esi
callq 0x4f64
movzwl %ax, %esi
movl %r13d, %edi
callq 0x4f5f
movw %ax, (%r12,%r14,2)
movq (%rsp), %rax
movzwl (%r15,%rax,2), %esi
movl %ebx, %edi
callq 0x4f64
incq %r14
cmpq $0x100, %r14            # imm = 0x100
jne 0x6a3c
movq (%rsp), %rcx
incq %rcx
movq %rcx, (%rsp)
cmpq $0x2000, %rcx           # imm = 0x2000
jne 0x69f6
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/janmojzis[P]mcencrypt/transpose.c
// Function: transpose_64x64
void transpose_64x64(uint64_t * out, uint64_t * in)
{
	int i, j, s, d;

	uint64_t x, y;
	uint64_t masks[6][2] = {
	                        {0x5555555555555555, 0xAAAAAAAAAAAAAAAA},
	                        {0x3333333333333333, 0xCCCCCCCCCCCCCCCC},
	                        {0x0F0F0F0F0F0F0F0F, 0xF0F0F0F0F0F0F0F0},
	                        {0x00FF00FF00FF00FF, 0xFF00FF00FF00FF00},
	                        {0x0000FFFF0000FFFF, 0xFFFF0000FFFF0000},
	                        {0x00000000FFFFFFFF, 0xFFFFFFFF00000000}
	                       };

	for (i = 0; i < 64; i++)
		out[i] = in[i];

	for (d = 5; d >= 0; d--)
	{
		s = 1 << d;

		for (i = 0; i < 64; i += s*2)
		for (j = i; j < i+s; j++)
		{
			x = (out[j] & masks[d][0]) | ((out[j+s] & masks[d][0]) << s);
			y = ((out[j] & masks[d][1]) >> s) | (out[j+s] & masks[d][1]);

			out[j+0] = x;
			out[j+s] = y;
		}
	}
}

// Assembly:
xorl %eax, %eax
movq (%rsi,%rax,8), %rcx
movq %rcx, (%rdi,%rax,8)
incq %rax
cmpq $0x40, %rax
jne 0x6aa2
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl $0x5, %ecx
movl $0x1, %edx
shll %cl, %edx
movl $0x2, %r8d
shll %cl, %r8d
movq %rcx, -0x8(%rsp)
shlq $0x4, %rcx
movslq %r8d, %r8
movslq %edx, %r9
leaq 0x1288(%rip), %rax      # 0x7d70
movq (%rcx,%rax), %r10
movq 0x8(%rcx,%rax), %r11
leaq (%rdi,%r9,8), %rbx
xorl %r14d, %r14d
leaq (%r14,%r9), %r15
movq %r14, %r12
movq (%rdi,%r12,8), %r13
movq %r10, %rbp
andq %r13, %rbp
movq (%rbx,%r12,8), %rax
movq %rax, %rsi
andq %r10, %rsi
movl %edx, %ecx
shlq %cl, %rsi
andq %r11, %r13
shrq %cl, %r13
orq %rbp, %rsi
andq %r11, %rax
orq %r13, %rax
movq %rsi, (%rdi,%r12,8)
movq %rax, (%rbx,%r12,8)
incq %r12
cmpq %r15, %r12
jl 0x6aff
addq %r8, %r14
cmpq $0x40, %r14
jl 0x6af8
movq -0x8(%rsp), %rcx
subq $0x1, %rcx
jae 0x6ac2
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/janmojzis[P]mcencrypt/writeall.c
// Function: writeall
int writeall(int fd, const void *xv, long long xlen) {

    const unsigned char *x = xv;
    long long w;
    while (xlen > 0) {
        w = xlen;
        if (w > 1048576) w = 1048576;
        w = write(fd, x, w);
        if (w < 0) {
            if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) {
                struct pollfd p;
                p.fd = fd;
                p.events = POLLOUT | POLLERR;
                poll(&p, 1, -1);
                continue;
            }
            return -1;
        }
        x += w;
        xlen -= w;
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
xorl %eax, %eax
testq %rdx, %rdx
setg %bl
jle 0x6c6e
movq %rdx, %r14
movq %rsi, %r15
movl %edi, %ebp
movl $0x100000, %eax         # imm = 0x100000
movq %rsp, %r12
cmpq %rax, %r14
movl $0x100000, %r13d        # imm = 0x100000
cmovlq %r14, %r13
movl %ebp, %edi
movq %r15, %rsi
movq %r13, %rdx
callq 0x1060
testq %rax, %rax
jns 0x6c4c
callq 0x1040
movl (%rax), %eax
cmpl $0xb, %eax
je 0x6c29
cmpl $0x4, %eax
jne 0x6c69
movl %ebp, (%rsp)
movw $0xc, 0x4(%rsp)
movl $0x1, %esi
movq %r12, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x10d0
testb $0x1, %bl
jne 0x6c06
jmp 0x6c65
addq %rax, %r15
movq %r14, %rcx
subq %rax, %rcx
testq %rcx, %rcx
setg %bl
subq %rax, %r14
movl $0x100000, %eax         # imm = 0x100000
jg 0x6bf9
xorl %eax, %eax
jmp 0x6c6e
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/s3lase[P]v6shell/sh6.c
// Function: syntax
static struct tnode *
syntax(char **p1, char **p2)
{

	while (p1 < p2)
		if (any(**p1, EOC))
			p1++;
		else
			return syn1(p1, p2);
	return NULL;
}

// Assembly:
cmpq %rsi, %rdi
jae 0x2a6a
leaq 0x274e(%rip), %rax      # 0x518e
movq (%rdi), %rcx
movb (%rcx), %cl
movq %rax, %rdx
movb (%rdx), %r8b
testb %r8b, %r8b
je 0x2a58
incq %rdx
cmpb %cl, %r8b
jne 0x2a48
testb %r8b, %r8b
je 0x3518
addq $0x8, %rdi
cmpq %rsi, %rdi
jb 0x2a40
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/s3lase[P]v6shell/sh6.c
// Function: tfree
static void
tfree(struct tnode *t)
{

	if (t == NULL)
		return;
	switch (t->ntype) {
	case TLIST:
	case TPIPE:
		tfree(t->nleft);
		tfree(t->nright);
		break;
	case TCOMMAND:
		free(t->nav);
		break;
	case TSUBSHELL:
		tfree(t->nsub);
		break;
	}
	free(t);
}

// Assembly:
testq %rdi, %rdi
je 0x32d9
pushq %rbx
movq %rdi, %rbx
movl 0x34(%rdi), %eax
leal -0x1(%rax), %ecx
cmpl $0x2, %ecx
jb 0x32da
cmpl $0x3, %eax
je 0x32ed
cmpl $0x4, %eax
jne 0x32f6
movq 0x10(%rbx), %rdi
jmp 0x32e6
retq
movq (%rbx), %rdi
callq 0x32b5
movq 0x8(%rbx), %rdi
callq 0x32b5
jmp 0x32f6
movq 0x28(%rbx), %rdi
callq 0x2050
movq %rbx, %rdi
popq %rbx
jmp 0x2050
// File: /workspace/github_c_makefile_star2_O1/s3lase[P]v6shell/sh6.c
// Function: xgetc
static char
xgetc(bool dolsub)
{
	int n;
	char c;

	if (peekc != EOS) {
		c = peekc;
		peekc = EOS;
		return c;
	}

	if (wordp >= &word[WORDMAX - 5]) {
		wordp -= 10;
		while (xgetc(!DOLSUB) != EOL)
			;	/* nothing */
		wordp += 10;
		error_message = ERR_TMARGS;
		goto geterr;
	}
	if (linep >= &line[LINEMAX - 5]) {
		linep -= 10;
		while (xgetc(!DOLSUB) != EOL)
			;	/* nothing */
		linep += 10;
		error_message = ERR_TMCHARS;
		goto geterr;
	}

getd:
	if (dolp != NULL) {
		c = *dolp++ & ASCII;
		if (c != EOS)
			return c;
		dolp = NULL;
	}
	c = readc();
	if (c == DOLLAR && dolsub) {
		c = readc();
		if (c >= '0' && c <= '9') {
			n = c - '0';
			if (IS_DIGIT(n, c) && n < dolc)
				dolp = (n > 0) ? dolv[n] : name;
			goto getd;
		}
		if (c == DOLLAR) {
			dolp = apid;
			goto getd;
		}
	}
	/* Ignore all EOS/NUL characters. */
	if (c == EOS) do {
		if (++nul_count >= LINEMAX) {
			error_message = ERR_TMCHARS;
			goto geterr;
		}
		c = readc();
	} while (c == EOS);
	return c;

geterr:
	error = true;
	return EOL;
}

// Assembly:
movb 0x66e3(%rip), %al       # 0x99e8
testb %al, %al
je 0x3311
movb $0x0, 0x66d8(%rip)      # 0x99e8
retq
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq 0x66b0(%rip), %rax      # 0x99d0
leaq 0x6681(%rip), %rcx      # 0x99a8
cmpq %rcx, %rax
jae 0x33ed
movq 0x4689(%rip), %rax      # 0x79c0
leaq 0x467d(%rip), %rcx      # 0x79bb
cmpq %rcx, %rax
jae 0x3418
movl %edi, %ebx
leaq 0x1e33(%rip), %r14      # 0x5183
leaq 0x3e29(%rip), %r15      # 0x7180
leaq 0x66a2(%rip), %r12      # 0x9a00
movq 0x668b(%rip), %rax      # 0x99f0
testq %rax, %rax
je 0x338a
leaq 0x1(%rax), %rcx
movq %rcx, 0x667b(%rip)      # 0x99f0
movb (%rax), %al
andb $0x7f, %al
jne 0x3454
movq $0x0, 0x6666(%rip) # 0x99f0
callq 0x348c
cmpb $0x24, %al
jne 0x3460
testb %bl, %bl
je 0x3460
callq 0x348c
leal -0x30(%rax), %ecx
cmpb $0x9, %cl
ja 0x33da
movzbl %al, %ecx
addl $-0x30, %ecx
cmpb %al, (%rcx,%r14)
jne 0x335e
cmpl 0x3dd2(%rip), %ecx      # 0x7190
jge 0x335e
leaq (,%rcx,8), %rcx
addq 0x3db9(%rip), %rcx      # 0x7188
cmpb $0x31, %al
cmovbq %r15, %rcx
movq (%rcx), %rcx
jmp 0x33e1
movq %r12, %rcx
cmpb $0x24, %al
jne 0x3460
movq %rcx, 0x6608(%rip)      # 0x99f0
jmp 0x335e
addq $-0x50, %rax
movq %rax, 0x65d8(%rip)      # 0x99d0
leaq 0x1d62(%rip), %rbx      # 0x5161
leaq 0x65ca(%rip), %r14      # 0x99d0
xorl %edi, %edi
callq 0x32ff
cmpb $0xa, %al
jne 0x3406
movl $0x50, %eax
jmp 0x3441
addq $-0xa, %rax
movq %rax, 0x459d(%rip)      # 0x79c0
leaq 0x1d45(%rip), %rbx      # 0x516f
leaq 0x458f(%rip), %r14      # 0x79c0
xorl %edi, %edi
callq 0x32ff
cmpb $0xa, %al
jne 0x3431
movl $0xa, %eax
addq %rax, (%r14)
movq %rbx, 0x6595(%rip)      # 0x99e0
movb $0x1, 0x6586(%rip)      # 0x99d8
movb $0xa, %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
testb %al, %al
jne 0x3454
leaq 0x1d04(%rip), %rbx      # 0x516f
movl 0x656b(%rip), %eax      # 0x99dc
leal 0x1(%rax), %ecx
movl %ecx, 0x6562(%rip)      # 0x99dc
cmpl $0x7fe, %eax            # imm = 0x7FE
jg 0x3444
callq 0x348c
testb %al, %al
je 0x346b
jmp 0x3454
// File: /workspace/github_c_makefile_star2_O1/s3lase[P]v6shell/sh6.c
// Function: readc
static char
readc(void)
{
	char c;

	if (argv2p != NULL) {
		if (argv2p == (char *)-1)
			exit(status);
		if ((c = (*argv2p++ & ASCII)) == EOS) {
			argv2p = (char *)-1;
			c = EOL;
		}
		return c;
	}
	if (one_line_flag == 1)
		exit(status);
	if (read(FD0, &c, (size_t)1) != 1)
		exit(status);
	if ((c &= ASCII) == EOL && one_line_flag == 2)
		one_line_flag = 1;

	return c;
}

// Assembly:
pushq %rax
movq 0x3d04(%rip), %rax      # 0x7198
testq %rax, %rax
je 0x34c6
cmpq $-0x1, %rax
je 0x350d
leaq 0x1(%rax), %rcx
movq %rcx, 0x3cee(%rip)      # 0x7198
movb (%rax), %al
andb $0x7f, %al
movb %al, 0x7(%rsp)
jne 0x3507
movq $-0x1, 0x3cd9(%rip) # 0x7198
movb $0xa, 0x7(%rsp)
jmp 0x3507
cmpl $0x1, 0x3cd3(%rip)      # 0x71a0
je 0x350d
leaq 0x7(%rsp), %rsi
movl $0x1, %edx
xorl %edi, %edi
callq 0x21a0
cmpq $0x1, %rax
jne 0x350d
movb 0x7(%rsp), %al
andb $0x7f, %al
movb %al, 0x7(%rsp)
cmpb $0xa, %al
jne 0x3507
cmpl $0x2, 0x3ca5(%rip)      # 0x71a0
jne 0x3507
movl $0x1, 0x3c99(%rip)      # 0x71a0
movb 0x7(%rsp), %al
popq %rcx
retq
movl 0x3ca1(%rip), %edi      # 0x71b4
callq 0x2250
// File: /workspace/github_c_makefile_star2_O1/s3lase[P]v6shell/sh6.c
// Function: syn1
static struct tnode *
syn1(char **p1, char **p2)
{
	struct tnode *t;
	int c, subcnt;
	char **p;

	subcnt = 0;
	for (p = p1; p < p2; p++)
		switch (**p) {
		case LPARENTHESIS:
			subcnt++;
			continue;

		case RPARENTHESIS:
			subcnt--;
			if (subcnt < 0)
				goto synerr;
			continue;

		case SEMICOLON:
		case AMPERSAND:
		case EOL:
			if (subcnt == 0) {
				c = **p;
				t = talloc();
				t->ntype  = TLIST;
				t->nleft  = syn2(p1, p);
				if (c == AMPERSAND && t->nleft != NULL)
					t->nleft->nflags |= FAND | FINTR | FPRS;
				t->nright = syntax(p + 1, p2);
				t->nflags = 0;
				return t;
			}
			break;
		}

	if (subcnt == 0)
		return syn2(p1, p2);

synerr:
	error = true;
	return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r15
cmpq %rsi, %rdi
jae 0x3581
xorl %eax, %eax
movq %r15, %r14
movq (%r14), %rcx
movb (%rcx), %bpl
movzbl %bpl, %ecx
cmpl $0x27, %ecx
jle 0x3552
cmpl $0x3b, %ecx
je 0x355c
cmpl $0x29, %ecx
je 0x3562
cmpl $0x28, %ecx
jne 0x3568
incl %eax
jmp 0x3568
cmpl $0xa, %ecx
je 0x355c
cmpl $0x26, %ecx
jne 0x3568
testl %eax, %eax
jne 0x3568
jmp 0x3591
testl %eax, %eax
jle 0x3575
decl %eax
addq $0x8, %r14
cmpq %rbx, %r14
jb 0x3530
testl %eax, %eax
je 0x3581
movb $0x1, 0x645c(%rip)      # 0x99d8
xorl %r12d, %r12d
jmp 0x35fc
movq %r15, %rdi
movq %rbx, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x3608
movl $0x38, %edi
callq 0x36cf
movq %rax, %r12
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movq $0x0, 0x30(%rax)
movl $0x1, 0x34(%rax)
movq %r15, %rdi
movq %r14, %rsi
callq 0x3608
movq %rax, (%r12)
cmpb $0x26, %bpl
setne %cl
testq %rax, %rax
sete %dl
orb %cl, %dl
jne 0x35df
orb $-0x3f, 0x30(%rax)
addq $0x8, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2a34
movq %rax, 0x8(%r12)
movl $0x0, 0x30(%r12)
movq %r12, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/s3lase[P]v6shell/sh6.c
// Function: syn2
static struct tnode *
syn2(char **p1, char **p2)
{
	struct tnode *t;
	int subcnt;
	char **p;

	subcnt = 0;
	for (p = p1; p < p2; p++)
		switch (**p) {
		case LPARENTHESIS:
			subcnt++;
			continue;

		case RPARENTHESIS:
			subcnt--;
			continue;

		case VERTICALBAR:
		case CARET:
			if (subcnt == 0) {
				t = talloc();
				t->ntype  = TPIPE;
				t->nleft  = syn3(p1, p);
				t->nright = syn2(p + 1, p2);
				t->nflags = 0;
				return t;
			}
			break;
		}

	return syn3(p1, p2);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r15
cmpq %rsi, %rdi
jae 0x3654
xorl %eax, %eax
movq %r15, %r14
movq (%r14), %rcx
movzbl (%rcx), %ecx
cmpl $0x5d, %ecx
jg 0x3639
cmpl $0x28, %ecx
je 0x3649
cmpl $0x29, %ecx
jne 0x364b
decl %eax
jmp 0x364b
cmpl $0x5e, %ecx
je 0x3643
cmpl $0x7c, %ecx
jne 0x364b
testl %eax, %eax
jne 0x364b
jmp 0x366a
incl %eax
addq $0x8, %r14
cmpq %rbx, %r14
jb 0x3620
movq %r15, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x3719
movl $0x38, %edi
callq 0x36cf
movq %rax, %r12
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movq $0x0, 0x30(%rax)
movl $0x2, 0x34(%rax)
movq %r15, %rdi
movq %r14, %rsi
callq 0x3719
movq %rax, (%r12)
addq $0x8, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3608
movq %rax, 0x8(%r12)
movl $0x0, 0x30(%r12)
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/s3lase[P]v6shell/sh6.c
// Function: pwait
static void
pwait(pid_t cp)
{
	pid_t tp;
	int s;

	if (cp == 0)
		return;
	for (;;) {
		tp = wait(&s);
		if (tp == -1)
			break;
		if (s != 0) {
			if (WIFSIGNALED(s) != 0)
				status = prsig(s, tp, cp);
			else if (WIFEXITED(s) != 0)
				status = WEXITSTATUS(s);
			if (status >= FC_ERR) {
				if (status == FC_ERR)
					status = SH_ERR;
				err(status, NULL);
			}
		} else
			status = SH_TRUE;
		if (tp == cp)
			break;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edi, %r12d
leaq 0xc(%rsp), %r14
leaq 0x1818(%rip), %r15      # 0x5191
movq %r14, %rdi
callq 0x2280
cmpl $-0x1, %eax
je 0x3ab3
movl %eax, %r13d
movl 0xc(%rsp), %ebx
testq %rbx, %rbx
je 0x39d9
movl %ebx, %ebp
andl $0x7f, %ebp
movl %ebp, %eax
shll $0x18, %eax
addl $0x1000000, %eax        # imm = 0x1000000
cmpl $0x2000000, %eax        # imm = 0x2000000
jl 0x39e8
cmpl $0xd, %ebp
ja 0x39c5
leaq 0x33c8(%rip), %rax      # 0x6d80
movq (%rax,%rbp,8), %rax
cmpb $0x0, (%rax)
je 0x3a64
cmpl $0xd, %ebp
ja 0x39f8
movl %ebp, %eax
leaq 0x33ad(%rip), %rcx      # 0x6d80
movq (%rcx,%rax,8), %rcx
jmp 0x3a23
movl $0x0, 0x37d1(%rip)      # 0x71b4
jmp 0x3aaa
testl %ebp, %ebp
jne 0x3a86
movzbl %bh, %eax
jmp 0x3a80
movl $0x21, %esi
leaq 0x10(%rsp), %rdi
leaq 0x186c(%rip), %rdx      # 0x5275
movl %ebp, %ecx
xorl %eax, %eax
callq 0x2130
leaq 0x1863(%rip), %rcx      # 0x527c
cmpl $0x21, %eax
jae 0x3a23
leaq 0x10(%rsp), %rcx
movq %r15, %r8
testb %bl, %bl
jns 0x3a31
leaq 0x1875(%rip), %r8       # 0x52a6
movl $0x2, %edi
cmpl %r12d, %r13d
jne 0x3a51
leaq 0x185e(%rip), %rsi      # 0x52a0
movq %rcx, %rdx
movq %r8, %rcx
xorl %eax, %eax
callq 0x3cd6
jmp 0x3a7a
leaq 0x1844(%rip), %rsi      # 0x529c
movl %r13d, %edx
xorl %eax, %eax
callq 0x3cd6
jmp 0x3a7a
movl $0x2, %edi
leaq 0x19a2(%rip), %rsi      # 0x5412
movq %r15, %rdx
xorl %eax, %eax
callq 0x3cd6
leal 0x80(%rbp), %eax
movl %eax, 0x372e(%rip)      # 0x71b4
cmpl $0x7c, 0x3727(%rip)     # 0x71b4
jl 0x3aaa
jne 0x3a9b
movl $0x2, 0x3719(%rip)      # 0x71b4
movl 0x3713(%rip), %edi      # 0x71b4
xorl %esi, %esi
xorl %eax, %eax
callq 0x3b1c
cmpl %r12d, %r13d
jne 0x3979
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/s3lase[P]v6shell/sh6.c
// Function: sh_errexit
static void
sh_errexit(int es)
{

#ifdef	DEBUG
	fd_print(FD2, "sh_errexit: es == %d;\n", es);
#endif

	status = es;
	if (prompt == NULL) {
		(void)lseek(FD0, (off_t)0, SEEK_END);
		EXIT(status);
	}
	if (getpid() != getmypid())
		_exit(status);
}

// Assembly:
pushq %rbx
movl %edi, 0x36eb(%rip)      # 0x71b4
cmpq $0x0, 0x36d7(%rip)      # 0x71a8
je 0x3ae5
callq 0x20e0
movl %eax, %ebx
callq 0x3d79
cmpl %eax, %ebx
jne 0x3b0e
popq %rbx
retq
xorl %edi, %edi
xorl %esi, %esi
movl $0x2, %edx
callq 0x2150
callq 0x20e0
movl %eax, %ebx
callq 0x3d79
movl 0x36af(%rip), %edi      # 0x71b4
cmpl %eax, %ebx
jne 0x3b14
callq 0x2250
movl 0x36a0(%rip), %edi      # 0x71b4
callq 0x2080
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/s3lase[P]v6shell/sasignal.c
// Function: sasignal
action_type
sasignal(int sig, action_type act)
{
	struct sigaction a, oa;

	(void)memset(&a, 0, sizeof(a));
	(void)sigemptyset(&a.sa_mask);
	(void)sigaddset(&a.sa_mask, sig);

	a.sa_handler = act;
	a.sa_flags   = SA_RESTART;

	if (sigaction(sig, &a, &oa) < 0)
		return SIG_ERR;

	return oa.sa_handler;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rsi, %rbx
movl %edi, %ebp
leaq 0xa0(%rsp), %r14
movl $0x98, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x2160
leaq 0xa8(%rsp), %r15
movq %r15, %rdi
callq 0x21d0
movq %r15, %rdi
movl %ebp, %esi
callq 0x2290
movq %rbx, -0x8(%r15)
movl $0x10000000, 0x80(%r15) # imm = 0x10000000
leaq 0x8(%rsp), %rdx
movl %ebp, %edi
movq %r14, %rsi
callq 0x20b0
movl %eax, %ecx
movq $-0x1, %rax
testl %ecx, %ecx
js 0x435f
movq 0x8(%rsp), %rax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/somethingnew2-0[P]CS537-P4/client.c
// Function: clientSend
void clientSend(int fd, char *filename)
{
  char buf[MAXLINE];
  char hostname[MAXLINE];

  Gethostname(hostname, MAXLINE);

  /* Form and send the HTTP request */
  sprintf(buf, "GET %s HTTP/1.1\n", filename);
  sprintf(buf, "%shost: %s\n\r\n", buf, hostname);
  Rio_writen(fd, buf, strlen(buf));
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x4008, %rsp           # imm = 0x4008
movq %rsi, %r14
movl %edi, %ebx
movq %rsp, %r15
movl $0x2000, %esi           # imm = 0x2000
movq %r15, %rdi
callq 0x16f1
leaq 0xbce(%rip), %rsi       # 0x2004
leaq 0x2000(%rsp), %r12
movq %r12, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x11f0
leaq 0xbc3(%rip), %rsi       # 0x2015
movq %r12, %rdi
movq %r12, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x11f0
movq %r12, %rdi
callq 0x1080
movl %ebx, %edi
movq %r12, %rsi
movq %rax, %rdx
callq 0x1b9b
addq $0x4008, %rsp           # imm = 0x4008
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/somethingnew2-0[P]CS537-P4/client.c
// Function: clientPrint
void clientPrint(int fd)
{
  rio_t rio;
  char buf[MAXBUF];  
  int length = 0;
  int n;
  
  Rio_readinitb(&rio, fd);

  /* Read and display the HTTP Header */
  n = Rio_readlineb(&rio, buf, MAXBUF);
  while (strcmp(buf, "\r\n") && (n > 0)) {
    printf("Header: %s", buf);
    n = Rio_readlineb(&rio, buf, MAXBUF);

    /* If you want to look for certain HTTP tags... */
    if (sscanf(buf, "Content-Length: %d ", &length) == 1) {
      printf("Length = %d\n", length);
    }
  }

  /* Read and display the HTTP Body */
  n = Rio_readlineb(&rio, buf, MAXBUF);
  while (n > 0) {
    printf("%s", buf);
    n = Rio_readlineb(&rio, buf, MAXBUF);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4028, %rsp           # imm = 0x4028
movl %edi, %esi
movl $0x0, 0xc(%rsp)
leaq 0x2018(%rsp), %rbx
movq %rbx, %rdi
callq 0x1bb7
leaq 0x10(%rsp), %r14
movl $0x2000, %edx           # imm = 0x2000
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1be2
movl $0xa0d, %ecx            # imm = 0xA0D
xorl (%r14), %ecx
movzbl 0x2(%r14), %edx
orw %cx, %dx
je 0x155d
testl %eax, %eax
jle 0x155d
leaq 0x10(%rsp), %r14
leaq 0x2018(%rsp), %r15
leaq 0xb3a(%rip), %r12       # 0x202e
leaq 0xc(%rsp), %r13
movl $0xa0d, %ebx            # imm = 0xA0D
leaq 0xb1e(%rip), %rdi       # 0x2023
movq %r14, %rsi
xorl %eax, %eax
callq 0x10b0
movl $0x2000, %edx           # imm = 0x2000
movq %r15, %rdi
movq %r14, %rsi
callq 0x1be2
movq %rax, %rbp
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x1150
cmpl $0x1, %eax
jne 0x1549
movl 0xc(%rsp), %esi
leaq 0xb00(%rip), %rdi       # 0x2042
xorl %eax, %eax
callq 0x10b0
movl 0x10(%rsp), %eax
xorl %ebx, %eax
movzbl 0x12(%rsp), %ecx
orw %ax, %cx
je 0x155d
testl %ebp, %ebp
jg 0x14fe
leaq 0x2018(%rsp), %rdi
leaq 0x10(%rsp), %rsi
movl $0x2000, %edx           # imm = 0x2000
callq 0x1be2
testl %eax, %eax
jle 0x15ad
leaq 0xaac(%rip), %rbx       # 0x202b
leaq 0x10(%rsp), %r14
leaq 0x2018(%rsp), %r15
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x10b0
movl $0x2000, %edx           # imm = 0x2000
movq %r15, %rdi
movq %r14, %rsi
callq 0x1be2
testl %eax, %eax
jg 0x158c
addq $0x4028, %rsp           # imm = 0x4028
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/somethingnew2-0[P]CS537-P4/client.c
// Function: main
int main(int argc, char *argv[])
{
  char *host, *filename;
  int port;
  int clientfd;

  if (argc != 4) {
    fprintf(stderr, "Usage: %s <host> <port> <filename>\n", argv[0]);
    exit(1);
  }

  host = argv[1];
  port = atoi(argv[2]);
  filename = argv[3];

  /* Open a single connection to the specified host and port */
  clientfd = Open_clientfd(host, port);
  
  clientSend(clientfd, filename);
  clientPrint(clientfd);
    
  Close(clientfd);

  exit(0);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
cmpl $0x4, %edi
jne 0x1607
movq 0x8(%rbx), %r14
movq 0x10(%rbx), %rdi
callq 0x11c0
movq 0x18(%rbx), %rbx
movq %r14, %rdi
movl %eax, %esi
callq 0x1d3a
movl %eax, %ebp
movl %eax, %edi
movq %rbx, %rsi
callq 0x140c
movl %ebp, %edi
callq 0x1486
movl %ebp, %edi
callq 0x17ce
xorl %edi, %edi
callq 0x1200
movq 0x29ea(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq (%rbx), %rdx
leaq 0xa34(%rip), %rsi       # 0x204f
xorl %eax, %eax
callq 0x1110
movl $0x1, %edi
callq 0x1200
// File: /workspace/github_c_makefile_star2_O1/somethingnew2-0[P]CS537-P4/cs537.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 0x197e
movq %rsi, %r14
movl %edi, %ebp
movq %rbx, %r15
movl %ebp, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x10e0
testq %rax, %rax
js 0x196a
jne 0x1976
jmp 0x197e
callq 0x1030
cmpl $0x4, (%rax)
jne 0x198f
xorl %eax, %eax
addq %rax, %r14
subq %rax, %r15
jne 0x1954
subq %r15, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq $-0x1, %rbx
jmp 0x1981
// File: /workspace/github_c_makefile_star2_O1/somethingnew2-0[P]CS537-P4/cs537.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;       /* errorno 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 0x19de
movq %rsi, %r14
movl %edi, %ebp
movq %rbx, %r15
movl %ebp, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x1060
testq %rax, %rax
jg 0x19cd
callq 0x1030
cmpl $0x4, (%rax)
jne 0x19d7
xorl %eax, %eax
addq %rax, %r14
subq %rax, %r15
jne 0x19af
jmp 0x19de
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/somethingnew2-0[P]CS537-P4/cs537.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) {
            if (errno == EINTR) /* interrupted by sig handler return */
                nread = 0;      /* 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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdx, %r15
testq %rdx, %rdx
je 0x1a45
movq %rsi, %r14
movq %rdi, %r12
movq %rbx, %r15
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x1a60
testq %rax, %rax
js 0x1a31
jne 0x1a3d
jmp 0x1a45
callq 0x1030
cmpl $0x4, (%rax)
jne 0x1a57
xorl %eax, %eax
addq %rax, %r14
subq %rax, %r15
jne 0x1a1a
subq %r15, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq $-0x1, %rbx
jmp 0x1a48
// File: /workspace/github_c_makefile_star2_O1/somethingnew2-0[P]CS537-P4/cs537.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 0x1aaf
leaq 0x10(%rbx), %r13
xorl %r15d, %r15d
movl (%rbx), %edi
movl $0x2000, %edx           # imm = 0x2000
movq %r13, %rsi
callq 0x10e0
movl %eax, 0x4(%rbx)
testl %eax, %eax
js 0x1a9e
je 0x1ad2
movq %r13, 0x8(%rbx)
jmp 0x1aa8
callq 0x1030
cmpl $0x4, (%rax)
jne 0x1adf
movl 0x4(%rbx), %eax
testl %eax, %eax
jle 0x1a80
movl %eax, %ecx
cmpq %r12, %rcx
cmovael %r12d, %eax
movq 0x8(%rbx), %rsi
movslq %eax, %r15
movq %r14, %rdi
movq %r15, %rdx
callq 0x1130
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 0x1ad2
// File: /workspace/github_c_makefile_star2_O1/somethingnew2-0[P]CS537-P4/cs537.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')
                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;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movl $0x1, %ebx
cmpq $0x2, %rdx
jb 0x1b6d
movq %rdx, %r15
movq %rdi, %r12
movl $0x1, %eax
leaq 0xf(%rsp), %r13
movq %rax, %rbx
movl $0x1, %edx
movq %r12, %rdi
movq %r13, %rsi
callq 0x1a60
cmpq $0x1, %rax
jne 0x1b44
movb 0xf(%rsp), %al
movb %al, -0x1(%r14,%rbx)
cmpb $0xa, %al
je 0x1b5c
leaq 0x1(%rbx), %rax
cmpq %rax, %r15
jne 0x1b13
jmp 0x1b5f
testq %rax, %rax
jne 0x1b53
cmpq $0x1, %rbx
jne 0x1b67
xorl %ebx, %ebx
jmp 0x1b71
movq $-0x1, %rbx
jmp 0x1b71
movq %rbx, %r15
addq %rbx, %r14
movq %r15, %rbx
jmp 0x1b6d
addq %rbx, %r14
decq %r14
movb $0x0, (%r14)
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/somethingnew2-0[P]CS537-P4/cs537.c
// Function: open_clientfd
int open_clientfd(char *hostname, int port) 
{
    int clientfd;
    struct hostent *hp;
    struct sockaddr_in serveraddr;

    if ((clientfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
        return -1; /* check errno for cause of error */

    /* Fill in the server's IP address and port */
    if ((hp = gethostbyname(hostname)) == NULL)
        return -2; /* check h_errno for cause of error */
    bzero((char *) &serveraddr, sizeof(serveraddr));
    serveraddr.sin_family = AF_INET;
    bcopy((char *)hp->h_addr, 
          (char *)&serveraddr.sin_addr.s_addr, hp->h_length);
    serveraddr.sin_port = htons(port);

    /* Establish a connection with the server */
    if (connect(clientfd, (SA *) &serveraddr, sizeof(serveraddr)) < 0)
        return -1;
    return clientfd;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebp
movq %rdi, %r14
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x1270
testl %eax, %eax
js 0x1c77
movl %eax, %ebx
movq %r14, %rdi
callq 0x1100
testq %rax, %rax
je 0x1c7e
xorps %xmm0, %xmm0
leaq 0x4(%rsp), %r14
movaps %xmm0, -0x4(%r14)
movw $0x2, -0x4(%r14)
movq 0x18(%rax), %rcx
movq (%rcx), %rsi
movslq 0x14(%rax), %rdx
movq %r14, %rdi
callq 0x1190
rolw $0x8, %bp
movw %bp, -0x2(%r14)
movq %rsp, %rsi
movl %ebx, %edi
movl $0x10, %edx
callq 0x1210
testl %eax, %eax
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovnsl %ebx, %eax
jmp 0x1c83
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x1c83
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/somethingnew2-0[P]CS537-P4/cs537.c
// Function: open_listenfd
int open_listenfd(int port) 
{
    int listenfd, optval=1;
    struct sockaddr_in serveraddr;
  
    /* Create a socket descriptor */
    if ((listenfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
      fprintf(stderr, "socket failed\n");
      return -1;
    }
 
    /* Eliminates "Address already in use" error from bind. */
    if (setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, 
                   (const void *)&optval , sizeof(int)) < 0) {
      fprintf(stderr, "setsockopt failed\n");
      return -1;
    }

    /* Listenfd will be an endpoint for all requests to port
       on any IP address for this host */
    bzero((char *) &serveraddr, sizeof(serveraddr));
    serveraddr.sin_family = AF_INET; 
    serveraddr.sin_addr.s_addr = htonl(INADDR_ANY); 
    serveraddr.sin_port = htons((unsigned short)port); 
    if (bind(listenfd, (SA *)&serveraddr, sizeof(serveraddr)) < 0) {
      fprintf(stderr, "bind failed\n");
      return -1;
    }

    /* Make it a listening socket ready to accept connection requests */
    if (listen(listenfd, LISTENQ) < 0) {
      fprintf(stderr, "listen failed\n");
      return -1;
    }
    return listenfd;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x28, %rsp
movl %edi, %ebp
movl $0x1, 0xc(%rsp)
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x1270
testl %eax, %eax
js 0x1d19
movl %eax, %ebx
leaq 0xc(%rsp), %rcx
movl %eax, %edi
movl $0x1, %esi
movl $0x2, %edx
movl $0x4, %r8d
callq 0x1040
testl %eax, %eax
js 0x1d20
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rsi
movaps %xmm0, (%rsi)
movw $0x2, (%rsi)
movl $0x0, 0x4(%rsi)
rolw $0x8, %bp
movw %bp, 0x2(%rsi)
movl %ebx, %edi
movl $0x10, %edx
callq 0x1180
testl %eax, %eax
js 0x1d27
movl %ebx, %edi
movl $0x400, %esi            # imm = 0x400
callq 0x1160
testl %eax, %eax
jns 0x1d31
callq 0x1290
jmp 0x1d2c
callq 0x12f6
jmp 0x1d2c
callq 0x12d4
jmp 0x1d2c
callq 0x12b2
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/somethingnew2-0[P]CS537-P4/cs537.c
// Function: Open_clientfd
int Open_clientfd(char *hostname, int port) 
{
    int rc;

    if ((rc = open_clientfd(hostname, port)) < 0) {
        if (rc == -1)
            unix_error("Open_clientfd Unix error");
        else        
            dns_error("Open_clientfd DNS error");
    }
    return rc;
}

// Assembly:
pushq %rax
callq 0x1bfb
testl %eax, %eax
js 0x1d46
popq %rcx
retq
cmpl $-0x1, %eax
jne 0x1d57
leaq 0x4e9(%rip), %rdi       # 0x223b
callq 0x162c
leaq 0x4f6(%rip), %rdi       # 0x2254
callq 0x169b
// File: /workspace/github_c_makefile_star2_O1/halcy[P]quasi_crystals_bot/Quasi.c
// Function: Configure
void Configure(float* paramsIn, int* paletteIn)
{
    SetDuration(3.0);
    SetAspect(1.0 / 1.0);
    for(int i = 0; i < 256; i++) {
        palette[i] = RGBi(paletteIn[i * 3], paletteIn[i * 3 + 1], paletteIn[i * 3 + 2]);
    }
    
    for(int i = 0; i < 16; i++) {
        params[i] = paramsIn[i];
    }
    printf("Lin %f / Pol %f / OfLin %f / OfPol %f\n", params[0], params[1], params[2], params[3]);
    printf("Pal entry 0: %d %d %d\n", paletteIn[0], paletteIn[1], paletteIn[2]);
    printf("Pal entry 255: %d %d %d\n", paletteIn[768 - 3], paletteIn[768 - 2], paletteIn[768 - 1]);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movss 0xcbb6(%rip), %xmm0     # 0xe004
callq 0x2d99
movss 0xcbad(%rip), %xmm0     # 0xe008
callq 0x2d90
movq $-0xc00, %rax           # imm = 0xF400
leaq 0x10cd2(%rip), %rcx     # 0x12140
movss 0xcb96(%rip), %xmm0     # 0xe00c
movl 0xc00(%rbx,%rax), %edx
testl %edx, %edx
js 0x149b
xorps %xmm1, %xmm1
cvtsi2ss %edx, %xmm1
minss %xmm0, %xmm1
cvttss2si %xmm1, %edx
shll $0x8, %edx
orl $0xff, %edx
jmp 0x14a0
movl $0xff, %edx
movl 0xc04(%rbx,%rax), %r8d
xorl %esi, %esi
testl %r8d, %r8d
movl $0x0, %edi
js 0x14c7
xorps %xmm1, %xmm1
cvtsi2ss %r8d, %xmm1
minss %xmm0, %xmm1
cvttss2si %xmm1, %edi
shll $0x10, %edi
movl 0xc08(%rbx,%rax), %r8d
testl %r8d, %r8d
js 0x14e7
xorps %xmm1, %xmm1
cvtsi2ss %r8d, %xmm1
minss %xmm0, %xmm1
cvttss2si %xmm1, %esi
shll $0x18, %esi
orl %edx, %edi
orl %esi, %edi
movl %edi, (%rcx)
addq $0x4, %rcx
addq $0xc, %rax
jne 0x1476
xorl %eax, %eax
leaq 0x1103c(%rip), %rcx     # 0x12540
movss (%r14,%rax), %xmm0
movss %xmm0, (%rax,%rcx)
leaq 0x4(%rax), %rax
cmpq $0x40, %rax
jne 0x1504
xorps %xmm0, %xmm0
cvtss2sd 0x1101c(%rip), %xmm0    # 0x12540
xorps %xmm1, %xmm1
cvtss2sd 0x11015(%rip), %xmm1    # 0x12544
cvtss2sd 0x11011(%rip), %xmm2    # 0x12548
cvtss2sd 0x1100d(%rip), %xmm3    # 0x1254c
leaq 0xcb2a(%rip), %rdi      # 0xe070
movb $0x4, %al
callq 0x10b0
movl (%rbx), %esi
movl 0x4(%rbx), %edx
movl 0x8(%rbx), %ecx
leaq 0xcb3b(%rip), %rdi      # 0xe097
xorl %eax, %eax
callq 0x10b0
movl 0xbf4(%rbx), %esi
movl 0xbf8(%rbx), %edx
leaq 0xcb38(%rip), %rdi      # 0xe0ae
movl 0xbfc(%rbx), %ecx
xorl %eax, %eax
leaq 0x8(%rsp), %rsp
popq %rbx
popq %r14
jmp 0x10b0
// File: /workspace/github_c_makefile_star2_O1/halcy[P]quasi_crystals_bot/Quasi.c
// Function: PixelLoop
Pixel PixelLoop(float x, float y, float time)
{
    float crystal = quasi(vec2(x, y), time * 2.0f * M_PI);
    int crystal_quant = (int)(crystal*255.0);

    crystal_quant = crystal_quant < 0 ? 0 : crystal_quant;
    crystal_quant = crystal_quant > 255 ? 255 : crystal_quant;

    return(palette[crystal_quant]);
}

// Assembly:
pushq %rax
addss %xmm2, %xmm2
cvtss2sd %xmm2, %xmm2
mulsd 0xc4bb(%rip), %xmm2     # 0xe058
cvtsd2ss %xmm2, %xmm2
insertps $0x10, %xmm1, %xmm0     # xmm0 = xmm0[0],xmm1[0],xmm0[2,3]
movaps %xmm2, %xmm1
callq 0x1598
cvtss2sd %xmm0, %xmm0
mulsd 0xc4ad(%rip), %xmm0     # 0xe068
cvttsd2si %xmm0, %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovgl %eax, %ecx
movl $0xff, %eax
cmpl %eax, %ecx
cmovgel %eax, %ecx
leaq 0x10569(%rip), %rax     # 0x12140
movl (%rax,%rcx,4), %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/halcy[P]quasi_crystals_bot/./Engine/Helpers.h
// Function: Render
static inline void RunPixelLoop(Bitmap *screen,float time,PixelLoopFunction *func)
{
	for(int sy=0;sy<screen->height;sy++)
	for(int sx=0;sx<screen->width;sx++)
	{
		float x=ScreenXToPixelLoop(screen,sx);
		float y=ScreenYToPixelLoop(screen,sy);

		DrawPixelNoClip(screen,sx,sy,func(x,y,time));
	}
}

// Assembly:
cmpw $0x0, 0x2(%rdi)
jle 0x1cff
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
addss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
mulsd 0xc453(%rip), %xmm0     # 0xe058
cvtsd2ss %xmm0, %xmm1
movaps 0xc410(%rip), %xmm4     # 0xe020
movl $0xff, %r12d
xorl %r14d, %r14d
movss %xmm1, 0x4(%rsp)
movswl (%rbx), %eax
testl %eax, %eax
jle 0x1ce0
leal 0x1(%r14,%r14), %r15d
xorl %ebp, %ebp
movl $0x1, %r13d
movl %eax, %ecx
movl %r13d, %edx
movswl 0x2(%rbx), %esi
subl %eax, %edx
cmpw %si, %cx
cmovlel %esi, %ecx
movswl %cx, %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movss 0xc3ae(%rip), %xmm3     # 0xe008
divss %xmm0, %xmm3
movl %r15d, %eax
subl %esi, %eax
xorps %xmm2, %xmm2
cvtsi2ss %eax, %xmm2
xorps %xmm0, %xmm0
cvtsi2ss %edx, %xmm0
xorps %xmm4, %xmm2
mulss %xmm3, %xmm0
mulss %xmm3, %xmm2
insertps $0x10, %xmm2, %xmm0     # xmm0 = xmm0[0],xmm2[0],xmm0[2,3]
callq 0x1598
cvtss2sd %xmm0, %xmm0
mulsd 0xc3d5(%rip), %xmm0     # 0xe068
cvttsd2si %xmm0, %eax
testl %eax, %eax
movl $0x0, %ecx
cmovlel %ecx, %eax
cmpl %r12d, %eax
cmovgel %r12d, %eax
leaq 0x10491(%rip), %rcx     # 0x12140
movl (%rcx,%rax,4), %ecx
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x7b87
movaps 0xc35a(%rip), %xmm4     # 0xe020
movss 0x4(%rsp), %xmm1
incl %ebp
movzwl (%rbx), %ecx
movswl %cx, %eax
addl $0x2, %r13d
cmpl %eax, %ebp
jl 0x1c39
incl %r14d
movswl 0x2(%rbx), %eax
cmpl %eax, %r14d
jl 0x1c1f
leaq 0x8(%rsp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/halcy[P]quasi_crystals_bot/Engine/GIF.c
// Function: WriteGIFHeader
void WriteGIFHeader(FILE *fh,int width,int height,Palette palette,int numcolours,int background)
{
	uint8_t flags=0;

	int palettesize=0;
	if(palette && numcolours>0)
	{
		int exp;
		if(numcolours>128) exp=8;
		else if(numcolours>64) exp=7;
		else if(numcolours>32) exp=6;
		else if(numcolours>16) exp=5;
		else if(numcolours>8) exp=4;
		else if(numcolours>4) exp=3;
		else if(numcolours>2) exp=2;
		else exp=1;

		flags|=0x80|0x70|0x00|(exp-1); // GCT present, 8-bit entries, not sorted, number of entries.
		palettesize=1<<exp;
	}

	uint8_t header[]=
	{
		'G','I','F','8','9','a',
		width&0xff,width>>8,
		height&0xff,height>>8,
		flags,
		background,
		0, // Pixel Aspect Ratio
	};

	Write(fh,header,sizeof(header));
	for(int i=0;i<palettesize;i++)
	{
		uint8_t entry[3]={0,0,0};
		if(i<numcolours)
		{
			entry[0]=ExtractRed(palette[i]);
			entry[1]=ExtractGreen(palette[i]);
			entry[2]=ExtractBlue(palette[i]);
		}
		Write(fh,entry,3);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq -0x28(%rsp), %rsp
movl %r8d, %ebp
movq %rcx, 0x10(%rsp)
testq %rcx, %rcx
sete %cl
testl %r8d, %r8d
setle %r10b
xorl %r8d, %r8d
movl %esi, %eax
orb %cl, %r10b
movq %rdi, %r14
movl $0x0, %ebx
jne 0x2066
cmpl $0x80, %ebp
movl $0x8, %ecx
jg 0x2057
cmpl $0x40, %ebp
movl $0x7, %ecx
jg 0x2057
cmpl $0x20, %ebp
movl $0x6, %ecx
jg 0x2057
cmpl $0x10, %ebp
movl $0x5, %ecx
jg 0x2057
cmpl $0x8, %ebp
movl $0x4, %ecx
jg 0x2057
cmpl $0x4, %ebp
movl $0x3, %ecx
jg 0x2057
xorl %ecx, %ecx
cmpl $0x3, %ebp
setge %cl
incl %ecx
leal -0x1(%rcx), %r8d
movl $0x1, %ebx
orb $-0x10, %r8b
shll %cl, %ebx
leaq 0x1b(%rsp), %rsi
movl $0x38464947, (%rsi)     # imm = 0x38464947
movw $0x6139, 0x4(%rsi)      # imm = 0x6139
movb %al, 0x6(%rsi)
movb %ah, 0x22(%rsp)
movb %dl, 0x8(%rsi)
movb %dh, 0x24(%rsp)
movb %r8b, 0xa(%rsi)
movb %r9b, 0xb(%rsi)
movb $0x0, 0xc(%rsi)
movl $0xd, %edx
movq %r14, %rdi
callq 0x2158
testl %ebx, %ebx
je 0x2148
movslq %ebp, %r12
movl %ebx, %r13d
xorl %ebp, %ebp
movl $0xff, %ebx
leaq 0xc(%rsp), %r15
cmpq %r12, %rbp
movb $0x0, 0xe(%rsp)
movw $0x0, 0xc(%rsp)
jge 0x212c
movq 0x10(%rsp), %rax
movl (%rax,%rbp,4), %edi
movl %edi, %esi
andl $0xff, %esi
je 0x2107
movl %edi, %ecx
shrl $0x8, %ecx
andl %ebx, %ecx
movl %ecx, %eax
shll $0x8, %eax
subl %ecx, %eax
xorl %edx, %edx
divl %esi
movl %edi, %edx
shrl $0x10, %edx
andl %ebx, %edx
movl %edx, %ecx
shll $0x8, %ecx
movb %al, 0xc(%rsp)
subl %edx, %ecx
movl %ecx, %eax
xorl %edx, %edx
divl %esi
jmp 0x210e
movb $0x0, 0xc(%rsp)
xorl %eax, %eax
testl %esi, %esi
movb %al, 0xd(%rsp)
je 0x2126
shrl $0x18, %edi
movl %edi, %eax
shll $0x8, %eax
subl %edi, %eax
xorl %edx, %edx
divl %esi
jmp 0x2128
xorl %eax, %eax
movb %al, 0xe(%rsp)
movl $0x3, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2158
incq %rbp
cmpq %rbp, %r13
jne 0x20b8
leaq 0x28(%rsp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/halcy[P]quasi_crystals_bot/Engine/GIF.c
// Function: WriteGIFApplicationExtension
void WriteGIFApplicationExtension(FILE *fh,char name[8],uint8_t authentication[3],uint8_t *content,int length)
{
	uint8_t appext[]=
	{
		0x21,0xff, // Extension Introducer, Application Label
		0x0b, // Block size
		name[0],name[1],name[2],name[3],name[4],name[5],name[6],name[7],
		authentication[0],authentication[1],authentication[2],
	};

	Write(fh,appext,sizeof(appext));

	while(length)
	{
		int blocklen=length;
		if(blocklen>255) blocklen=255;

		Write(fh,(uint8_t[1]){blocklen},1);
		Write(fh,content,blocklen);

		content+=blocklen;
		length-=blocklen;
	}
	Write(fh,(uint8_t[1]){0x00},1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq -0x18(%rsp), %rsp
leaq (%rsi), %rax
leaq 0xa(%rsp), %rsi
movw $0xff21, (%rsi)         # imm = 0xFF21
movb $0xb, 0x2(%rsi)
movb (%rax), %r9b
movb %r9b, 0x3(%rsi)
movb 0x1(%rax), %r9b
movb %r9b, 0x4(%rsi)
movb 0x2(%rax), %r9b
movb %r9b, 0x5(%rsi)
movb 0x3(%rax), %r9b
movb %r9b, 0x6(%rsi)
movb 0x4(%rax), %r9b
movb %r9b, 0x7(%rsi)
movb 0x5(%rax), %r9b
movb %r9b, 0x8(%rsi)
movb 0x6(%rax), %r9b
movb %r9b, 0x9(%rsi)
movb 0x7(%rax), %al
movb %al, 0xa(%rsi)
movb (%rdx), %al
movb %al, 0xb(%rsi)
movb 0x1(%rdx), %al
movl %r8d, %ebp
movb %al, 0xc(%rsi)
movq %rcx, %r14
movb 0x2(%rdx), %al
movq %rdi, %rbx
movb %al, 0xd(%rsi)
movl $0xe, %edx
callq 0x2158
testl %ebp, %ebp
je 0x22a1
movl $0xff, %r13d
leaq 0x8(%rsp), %r15
cmpl %r13d, %ebp
movl $0xff, %r12d
cmovll %ebp, %r12d
movb %r12b, 0x8(%rsp)
movl $0x1, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2158
movslq %r12d, %r12
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x2158
addq %r12, %r14
subl %r12d, %ebp
jne 0x2266
leaq 0x9(%rsp), %rsi
movb $0x0, (%rsi)
movl $0x1, %edx
movq %rbx, %rdi
callq 0x2158
leaq 0x18(%rsp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq