LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/FH0[P]tun_direct/lwip-2.1.2/src/core/inet_chksum.c
// Function: inet_cksum_pseudo_partial_base
static u16_t
inet_cksum_pseudo_partial_base(struct pbuf *p, u8_t proto, u16_t proto_len,
                               u16_t chksum_len, u32_t acc)
{
  struct pbuf *q;
  int swapped = 0;
  u16_t chklen;

  /* iterate through all pbuf in chain */
  for (q = p; (q != NULL) && (chksum_len > 0); q = q->next) {
    LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): checksumming pbuf %p (has next %p) \n",
                             (void *)q, (void *)q->next));
    chklen = q->len;
    if (chklen > chksum_len) {
      chklen = chksum_len;
    }
    acc += LWIP_CHKSUM(q->payload, chklen);
    chksum_len = (u16_t)(chksum_len - chklen);
    LWIP_ASSERT("delete me", chksum_len < 0x7fff);
    /*LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): unwrapped lwip_chksum()=%"X32_F" \n", acc));*/
    /* fold the upper bit down */
    acc = FOLD_U32T(acc);
    if (q->len % 2 != 0) {
      swapped = !swapped;
      acc = SWAP_BYTES_IN_WORD(acc);
    }
    /*LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): wrapped lwip_chksum()=%"X32_F" \n", acc));*/
  }

  if (swapped) {
    acc = SWAP_BYTES_IN_WORD(acc);
  }

  acc += (u32_t)lwip_htons((u16_t)proto);
  acc += (u32_t)lwip_htons(proto_len);

  /* Fold 32-bit sum to 16 bits
     calling this twice is probably faster than if statements... */
  acc = FOLD_U32T(acc);
  acc = FOLD_U32T(acc);
  LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): pbuf chain lwip_chksum()=%"X32_F"\n", acc));
  return (u16_t)~(acc & 0xffffUL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %ebp
movl %ecx, %r15d
movl %edx, 0x4(%rsp)
movl %esi, (%rsp)
movq %rdi, %r12
xorl %r13d, %r13d
testw %r15w, %r15w
je 0x132cb
testq %r12, %r12
je 0x132cb
movzwl 0x12(%r12), %r14d
cmpw %r15w, %r14w
movl %r14d, %ebx
cmovael %r15d, %ebx
movq 0x8(%r12), %rdi
movzwl %bx, %esi
callq 0x1302c
subl %ebx, %r15d
cmpw $0x7fff, %r15w          # imm = 0x7FFF
jae 0x13317
movzwl %ax, %eax
addl %eax, %ebp
movl %ebp, %eax
shrl $0x10, %eax
movzwl %bp, %ebp
addl %eax, %ebp
testb $0x1, %r14b
je 0x132c5
xorl %eax, %eax
testl %r13d, %r13d
sete %al
rolw $0x8, %bp
movzwl %bp, %ebp
movl %eax, %r13d
movq (%r12), %r12
jmp 0x1326a
movl %ebp, %eax
rolw $0x8, %ax
testl %r13d, %r13d
movzwl %ax, %ebx
cmovel %ebp, %ebx
movzbl (%rsp), %edi
callq 0x12ed0
movzwl %ax, %ebp
movzwl 0x4(%rsp), %edi
callq 0x12ed0
movzwl %ax, %eax
addl %ebp, %eax
addl %ebx, %eax
movzwl %ax, %ecx
shrl $0x10, %eax
addl %eax, %ecx
movl %ecx, %eax
shrl $0x10, %eax
addl %ecx, %eax
notl %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xfae(%rip), %rdi       # 0x142cc
leaq 0x3568(%rip), %rsi      # 0x1688d
leaq 0x356b(%rip), %rcx      # 0x16897
movl $0x1a0, %edx            # imm = 0x1A0
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O2/FH0[P]tun_direct/lwip-2.1.2/src/core/inet_chksum.c
// Function: ip6_chksum_pseudo_partial
u16_t
ip6_chksum_pseudo_partial(struct pbuf *p, u8_t proto, u16_t proto_len,
                          u16_t chksum_len, const ip6_addr_t *src, const ip6_addr_t *dest)
{
  u32_t acc = 0;
  u32_t addr;
  u8_t addr_part;

  for (addr_part = 0; addr_part < 4; addr_part++) {
    addr = src->addr[addr_part];
    acc = (u32_t)(acc + (addr & 0xffffUL));
    acc = (u32_t)(acc + ((addr >> 16) & 0xffffUL));
    addr = dest->addr[addr_part];
    acc = (u32_t)(acc + (addr & 0xffffUL));
    acc = (u32_t)(acc + ((addr >> 16) & 0xffffUL));
  }
  /* fold down to 16 bits */
  acc = FOLD_U32T(acc);
  acc = FOLD_U32T(acc);

  return inet_cksum_pseudo_partial_base(p, proto, proto_len, chksum_len, acc);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %r8, %rax
xorl %r10d, %r10d
movl $0xffff, %r11d          # imm = 0xFFFF
xorl %r8d, %r8d
cmpq $0x4, %r10
je 0x13388
movl (%rax,%r10,4), %ebx
movl %ebx, %ebp
andl %r11d, %ebp
addl %r8d, %ebp
shrl $0x10, %ebx
movl (%r9,%r10,4), %r8d
movl %r8d, %r14d
andl %r11d, %r14d
addl %ebx, %r14d
addl %ebp, %r14d
shrl $0x10, %r8d
addl %r14d, %r8d
incq %r10
jmp 0x13357
movl %r8d, %eax
shrl $0x10, %eax
movl $0xffff, %r9d           # imm = 0xFFFF
andl %r9d, %r8d
addl %eax, %r8d
movl %r8d, %eax
shrl $0x10, %eax
andl %r9d, %r8d
addl %eax, %r8d
movzbl %sil, %esi
movzwl %dx, %edx
movzwl %cx, %ecx
popq %rbx
popq %r14
popq %rbp
jmp 0x1324c
// File: /workspace/github_c_makefile_star2_O2/FH0[P]tun_direct/lwip-2.1.2/src/core/inet_chksum.c
// Function: inet_chksum_pbuf
u16_t
inet_chksum_pbuf(struct pbuf *p)
{
  u32_t acc;
  struct pbuf *q;
  int swapped = 0;

  acc = 0;
  for (q = p; q != NULL; q = q->next) {
    acc += LWIP_CHKSUM(q->payload, q->len);
    acc = FOLD_U32T(acc);
    if (q->len % 2 != 0) {
      swapped = !swapped;
      acc = SWAP_BYTES_IN_WORD(acc);
    }
  }

  if (swapped) {
    acc = SWAP_BYTES_IN_WORD(acc);
  }
  return (u16_t)~(acc & 0xffffUL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
xorl %r15d, %r15d
testq %rbx, %rbx
je 0x13443
movq 0x8(%rbx), %rdi
movzwl 0x12(%rbx), %ebp
movl %ebp, %esi
callq 0x1302c
movzwl %ax, %eax
addl %eax, %r14d
movl %r14d, %eax
shrl $0x10, %eax
movzwl %r14w, %r14d
addl %eax, %r14d
testb $0x1, %bpl
je 0x1343e
xorl %eax, %eax
testl %r15d, %r15d
sete %al
rolw $0x8, %r14w
movzwl %r14w, %r14d
movl %eax, %r15d
movq (%rbx), %rbx
jmp 0x133fd
movl %r14d, %eax
rolw $0x8, %ax
testl %r15d, %r15d
cmovel %r14d, %eax
notl %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/antonblanchard[P]will-it-scale/tests/fallocate1.c
// Function: testcase
void testcase(unsigned long long *iterations, unsigned long nr)
{
	char tmpfile[] = "/dev/shm/willitscale.XXXXXX";
	int fd = mkstemp(tmpfile);
	unsigned long place = 0;
	assert(fd >= 0);
	unlink(tmpfile);

	while (1) {
		int ret = fallocate(fd, 0, place, BUFLEN);
		if (errno != EINTR)
			assert(ret == 0);
		place += BUFLEN;
		if (place >= FILESIZE) {
			ret = ftruncate(fd, 0);
			assert(ret == 0);
			place = 0;
		}
		(*iterations)++;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movups 0x718(%rip), %xmm0      # 0x22ec
movq %rsp, %rdi
movups %xmm0, 0xc(%rdi)
movaps 0x6fe(%rip), %xmm0      # 0x22e0
movaps %xmm0, (%rdi)
callq 0x11f0
testl %eax, %eax
js 0x1c46
movl %eax, %ebp
movq %rsp, %rdi
callq 0x1080
xorl %r14d, %r14d
movl $0x2000, %ecx           # imm = 0x2000
movl %ebp, %edi
xorl %esi, %esi
movq %r14, %rdx
callq 0x1170
movl %eax, %r15d
callq 0x1070
cmpl $0x4, (%rax)
je 0x1c1e
testl %r15d, %r15d
jne 0x1c5f
addq $0x2000, %r14           # imm = 0x2000
cmpq $0x100000, %r14         # imm = 0x100000
jb 0x1c41
movl %ebp, %edi
xorl %esi, %esi
callq 0x1120
movl $0x0, %r14d
testl %eax, %eax
jne 0x1c78
incq (%rbx)
jmp 0x1bfb
leaq 0x631(%rip), %rdi       # 0x227e
leaq 0x632(%rip), %rsi       # 0x2286
leaq 0x63e(%rip), %rcx       # 0x2299
pushq $0x14
jmp 0x1c8f
leaq 0x666(%rip), %rdi       # 0x22cc
leaq 0x619(%rip), %rsi       # 0x2286
leaq 0x625(%rip), %rcx       # 0x2299
pushq $0x1a
jmp 0x1c8f
leaq 0x64d(%rip), %rdi       # 0x22cc
leaq 0x600(%rip), %rsi       # 0x2286
leaq 0x60c(%rip), %rcx       # 0x2299
pushq $0x1e
popq %rdx
callq 0x1130
// File: /workspace/github_c_makefile_star2_O2/keithnoguchi[P]pearls-in-action/0xd/main_test.c
// Function: main
int main(void)
{
	int fail = 0;
	int i = 0;

	printf("=====================\n");
	printf("Column 0xd: Searching\n");
	printf("=====================\n");

	if (test_set1(&i))
		fail++;

	return fail;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x4(%rsp), %rbx
andl $0x0, (%rbx)
leaq 0xe5b(%rip), %r14       # 0x201a
movq %r14, %rdi
callq 0x1050
leaq 0xe36(%rip), %rdi       # 0x2004
callq 0x1050
movq %r14, %rdi
callq 0x1050
movq %rbx, %rdi
callq 0x1324
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/keithnoguchi[P]pearls-in-action/0xd/set1.c
// Function: alloc_set1
struct set *alloc_set1(int nr, int max)
{
	struct set1 *s;
	int i;

	s = malloc(sizeof(struct set1)+sizeof(int)*(nr+1));
	if (!s)
		return NULL;

	s->max = max;
	s->set = set;
	s->alloc = nr+1;
	for (i = 0; i < nr; i++)
		s->x[i] = 0;
	s->n = 0;	/* n does not incluse the sentinel */
	s->x[0] = max;	/* sentinel */
	return &s->set;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movl %edi, %r14d
movslq %edi, %rax
leaq 0x34(,%rax,4), %rdi
callq 0x1090
xorl %edx, %edx
testq %rax, %rax
je 0x1259
leal 0x1(%r14), %esi
movl %ebx, 0x4(%rax)
movq %rax, %rcx
addq $0x8, %rcx
movups 0x2657(%rip), %xmm0     # 0x3880
movups %xmm0, 0x8(%rax)
movups 0x265c(%rip), %xmm0     # 0x3890
movups %xmm0, 0x18(%rax)
movl %esi, 0x28(%rax)
testl %r14d, %r14d
cmovlel %edx, %r14d
cmpq %rdx, %r14
je 0x1251
andl $0x0, 0x2c(%rax,%rdx,4)
incq %rdx
jmp 0x1242
andl $0x0, (%rax)
movl %ebx, 0x2c(%rax)
jmp 0x125b
xorl %ecx, %ecx
movq %rcx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/keithnoguchi[P]pearls-in-action/0xd/set1.c
// Function: insert
static int insert(struct set *b, int x)
{
	struct set1 *s = container_of(b, struct set1, set);
	int i, j;

	assert(x < s->max);

	/* find the position */
	for (i = 0; s->x[i] < x; i++)
		;

	/* ignore the duplicate */
	if (s->x[i] == x)
		return -1;

	/* array is full */
	if (s->n+1 == s->alloc)
		return -2;

	/* shift array */
	for (j = s->n+1; j > i; j--)
		s->x[j] = s->x[j-1];

	/* put the value */
	s->x[i] = x;
	s->n++;

	return i;
}

// Assembly:
pushq %rax
cmpl %esi, -0x4(%rdi)
jle 0x12e6
leaq 0x24(%rdi), %rdx
pushq $-0x1
popq %rax
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
movabsq $0x100000000, %r8       # imm = 0x100000000
movq %rdx, %r9
addq %r8, %rcx
addq $0x4, %rdx
incl %eax
cmpl %esi, (%r9)
jl 0x1295
jne 0x12ac
pushq $-0x1
jmp 0x12bc
movslq -0x8(%rdi), %r8
leal 0x1(%r8), %r9d
cmpl 0x20(%rdi), %r9d
jne 0x12bf
pushq $-0x2
popq %rax
jmp 0x12e4
sarq $0x20, %rcx
addq $0xa, %r8
leaq -0x9(%r8), %r9
cmpq %rcx, %r9
jle 0x12de
movl -0x4(%rdi,%r8,4), %r9d
movl %r9d, (%rdi,%r8,4)
decq %r8
jmp 0x12c7
movl %esi, -0x4(%rdx)
incl -0x8(%rdi)
popq %rcx
retq
leaq 0xd43(%rip), %rdi       # 0x2030
leaq 0xd47(%rip), %rsi       # 0x203b
leaq 0xd47(%rip), %rcx       # 0x2042
pushq $0x26
popq %rdx
callq 0x1080
// File: /workspace/github_c_makefile_star2_O2/keithnoguchi[P]pearls-in-action/0xd/set1.c
// Function: report
static void report(const struct set *b, int x[])
{
	struct set1 *s = container_of(b, struct set1, set);
	int i;

	for (i = 0; i < s->n; i++)
		x[i] = s->x[i];
	x[i] = s->x[i]; /* copy sentinel */
}

// Assembly:
xorl %eax, %eax
movslq -0x8(%rdi), %rcx
cmpq %rcx, %rax
jge 0x131a
movl 0x24(%rdi,%rax,4), %ecx
movl %ecx, (%rsi,%rax,4)
incq %rax
jmp 0x1305
movl 0x24(%rdi,%rax,4), %ecx
movl %ecx, (%rsi,%rax,4)
retq
nop
// File: /workspace/github_c_makefile_star2_O2/ikbenlike[P]nngutils/src/tty.c
// Function: main
int main(int argc, char **argv){
    bool silent = false;
    if(argc > 1){
        if(strcmp(argv[1], "--quiet")){
            silent = true;
        }
        else if(strcmp(argv[1], "-s")){
            silent = true;
        }
        else if(strcmp(argv[1], "--silent")){
            silent = true;
        }
        else {
            fprintf(stderr, "%s: incorrect argument %s\n", argv[0], argv[1]);
            return 1;
        }
    }
    char *tty = ttyname(STDIN_FILENO);
    if(tty == NULL){
        fprintf(stderr, "%s: %s\n", argv[0], strerror(errno));
        return 1;
    }
    if(silent == false){
        puts(tty);
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %r14d
cmpl $0x2, %edi
jl 0x11df
movq 0x8(%rbx), %r15
leaq 0xe58(%rip), %rsi       # 0x2004
movq %r15, %rdi
callq 0x1050
testl %eax, %eax
jne 0x11df
cmpb $0x2d, (%r15)
jne 0x11df
cmpb $0x73, 0x1(%r15)
jne 0x11df
cmpb $0x0, 0x2(%r15)
jne 0x11df
leaq 0xe39(%rip), %rsi       # 0x200c
movq %r15, %rdi
callq 0x1050
testl %eax, %eax
je 0x1240
xorl %r15d, %r15d
xorl %edi, %edi
callq 0x1070
testq %rax, %rax
je 0x120a
cmpl $0x1, %r14d
jg 0x11fc
movq %rax, %rdi
callq 0x1040
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x2de7(%rip), %rax      # 0x3ff8
movq (%rax), %r14
movq (%rbx), %rbx
callq 0x1030
movl (%rax), %edi
callq 0x1080
leaq 0xe06(%rip), %rsi       # 0x2030
movq %r14, %rdi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x1060
pushq $0x1
popq %r15
jmp 0x11fc
movq 0x2db1(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq (%rbx), %rdx
leaq 0xdc1(%rip), %rsi       # 0x2015
movq %r15, %rcx
jmp 0x1233
// File: /workspace/github_c_makefile_star2_O2/aap[P]rx-0/misc/crt.c
// Function: err
void
err(char *fmt, ...)
{
	va_list ap;
	va_start(ap, fmt);
	fprintf(stderr, "error: ");
	vfprintf(stderr, fmt, ap);
	fprintf(stderr, "\n");
	va_end(ap);
	exit(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rbx
leaq -0xe0(%rbp), %rdi
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movq %r8, 0x20(%rdi)
movq %r9, 0x28(%rdi)
testb %al, %al
je 0x2607
movaps %xmm0, -0xb0(%rbp)
movaps %xmm1, -0xa0(%rbp)
movaps %xmm2, -0x90(%rbp)
movaps %xmm3, -0x80(%rbp)
movaps %xmm4, -0x70(%rbp)
movaps %xmm5, -0x60(%rbp)
movaps %xmm6, -0x50(%rbp)
movaps %xmm7, -0x40(%rbp)
leaq -0x30(%rbp), %r14
movq %rdi, 0x10(%r14)
leaq 0x10(%rbp), %rax
movq %rax, 0x8(%r14)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%r14)
movq 0x59b5(%rip), %r15      # 0x7fe0
movq (%r15), %rcx
leaq 0x2bfb(%rip), %rdi      # 0x5230
pushq $0x7
popq %rsi
pushq $0x1
popq %rdx
callq 0x2480
movq (%r15), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2320
movq (%r15), %rsi
pushq $0xa
popq %rdi
callq 0x22e0
pushq $0x1
popq %rdi
callq 0x22d0
// File: /workspace/github_c_makefile_star2_O2/aap[P]rx-0/misc/crt.c
// Function: resize
void
resize(void)
{
	int w, h;
	SDL_GetWindowSize(window, &w, &h);
	printf("resize %d %d\n", w, h);
	texrect.x = (w-1024)/2;
	texrect.y = (h-1024)/2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq 0x5be0(%rip), %rdi      # 0x8298
leaq -0x18(%rbp), %r14
leaq -0x14(%rbp), %rbx
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2110
movl (%r14), %esi
movl (%rbx), %edx
leaq 0x2b61(%rip), %rdi      # 0x5238
xorl %eax, %eax
callq 0x2040
movl $0xfffffc00, %ecx       # imm = 0xFFFFFC00
movl (%r14), %eax
addl %ecx, %eax
pushq $0x2
popq %rsi
cltd
idivl %esi
movl %eax, 0x5bac(%rip)      # 0x82a0
addl (%rbx), %ecx
movl %ecx, %eax
cltd
idivl %esi
movl %eax, 0x5ba3(%rip)      # 0x82a4
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/aap[P]rx-0/misc/crt.c
// Function: keydn
void
keydn(int scancode)
{
	int i;
	u32 ojoys[NUMJOYS];

	for(i = 0; i < NUMJOYS; i++)
		ojoys[i] = joys[i].b;
	switch(scancode){
	case SDL_SCANCODE_ESCAPE:
		exit(0);
		break;

	case SDL_SCANCODE_E: KEY1(04);
	case SDL_SCANCODE_X: KEY1(010);
	case SDL_SCANCODE_C: KEY1(020000);
	case SDL_SCANCODE_A: KEY1(020);
	case SDL_SCANCODE_D: KEY1(040);
	case SDL_SCANCODE_S: KEY1(0100);
	case SDL_SCANCODE_W: KEY1(0200);

	case SDL_SCANCODE_U: KEY2(04);
	case SDL_SCANCODE_N: KEY2(010);
	case SDL_SCANCODE_M: KEY2(020000);
	case SDL_SCANCODE_J: KEY2(020);
	case SDL_SCANCODE_L: KEY2(040);
	case SDL_SCANCODE_K: KEY2(0100);
	case SDL_SCANCODE_I: KEY2(0200);

	case SDL_SCANCODE_F:
		fullscreen = !fullscreen;
		SDL_SetWindowFullscreen(window, modes[fullscreen]);
		resize();
		break;
	}
	for(i = 0; i < NUMJOYS; i++)
		if(joys[i].b != ojoys[i])
			updatejoy(&joys[i]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
xorl %eax, %eax
leaq 0x5b92(%rip), %rbx      # 0x82b0
cmpq $0x10, %rax
je 0x2732
movl 0x4(%rbx,%rax,4), %ecx
movl %ecx, -0x20(%rbp,%rax)
addq $0x4, %rax
jmp 0x271e
addl $-0x4, %edi
cmpl $0x25, %edi
ja 0x2805
leaq 0x2953(%rip), %rax      # 0x5098
movslq (%rax,%rdi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
orb $0x10, 0x5b5f(%rip)     # 0x82b4
jmp 0x2805
orb $-0x80, 0x5b53(%rip)    # 0x82b4
jmp 0x2805
orb $0x8, 0x5b57(%rip)      # 0x82c4
jmp 0x2805
orb $0x4, 0x5b4b(%rip)      # 0x82c4
jmp 0x2805
orb $0x20, 0x5b2f(%rip)     # 0x82b4
jmp 0x2805
orb $-0x80, 0x5b36(%rip)    # 0x82c4
jmp 0x2805
orb $0x40, 0x5b1d(%rip)     # 0x82b4
jmp 0x2805
orb $0x20, 0x5b15(%rip)     # 0x82b5
jmp 0x2805
orb $0x10, 0x5b1b(%rip)     # 0x82c4
jmp 0x2805
orb $0x40, 0x5b12(%rip)     # 0x82c4
jmp 0x2805
orb $0x8, 0x5af9(%rip)      # 0x82b4
jmp 0x2805
orb $0x4, 0x5af0(%rip)      # 0x82b4
jmp 0x2805
xorl %eax, %eax
cmpl $0x0, 0x5b21(%rip)      # 0x82f0
sete %al
movl %eax, 0x5b18(%rip)      # 0x82f0
movq 0x5ab9(%rip), %rdi      # 0x8298
leaq 0x5a86(%rip), %rcx      # 0x826c
movl (%rcx,%rax,4), %esi
callq 0x2290
callq 0x26a6
jmp 0x2805
orb $0x20, 0x5ac9(%rip)     # 0x82c5
jmp 0x2805
orb $0x20, 0x5abf(%rip)     # 0x82c4
xorl %r14d, %r14d
cmpq $0x4, %r14
je 0x2829
movl 0x4(%rbx), %eax
cmpl -0x20(%rbp,%r14,4), %eax
je 0x2820
movq %rbx, %rdi
callq 0x267c
incq %r14
addq $0x10, %rbx
jmp 0x2808
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
xorl %edi, %edi
callq 0x22d0
// File: /workspace/github_c_makefile_star2_O2/aap[P]rx-0/misc/crt.c
// Function: keyup
void
keyup(int scancode)
{
	int i;
	u32 ojoys[NUMJOYS];

	for(i = 0; i < NUMJOYS; i++)
		ojoys[i] = joys[i].b;
	switch(scancode){
	case SDL_SCANCODE_E: KEY1(04);
	case SDL_SCANCODE_X: KEY1(010);
	case SDL_SCANCODE_C: KEY1(020000);
	case SDL_SCANCODE_A: KEY1(020);
	case SDL_SCANCODE_D: KEY1(040);
	case SDL_SCANCODE_S: KEY1(0100);
	case SDL_SCANCODE_W: KEY1(0200);

	case SDL_SCANCODE_U: KEY2(04);
	case SDL_SCANCODE_N: KEY2(010);
	case SDL_SCANCODE_M: KEY2(020000);
	case SDL_SCANCODE_J: KEY2(020);
	case SDL_SCANCODE_L: KEY2(040);
	case SDL_SCANCODE_K: KEY2(0100);
	case SDL_SCANCODE_I: KEY2(0200);
	}
	for(i = 0; i < NUMJOYS; i++)
		if(joys[i].b != ojoys[i])
			updatejoy(&joys[i]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
xorl %eax, %eax
leaq 0x5a63(%rip), %rbx      # 0x82b0
cmpq $0x10, %rax
je 0x2861
movl 0x4(%rbx,%rax,4), %ecx
movl %ecx, -0x20(%rbp,%rax)
addq $0x4, %rax
jmp 0x284d
addl $-0x4, %edi
cmpl $0x17, %edi
ja 0x288c
movl $0xd43f1d, %eax         # imm = 0xD43F1D
btl %edi, %eax
jae 0x288c
movl %edi, %eax
leaq 0x5494(%rip), %rcx      # 0x7d10
movq (%rcx,%rax,8), %rcx
leaq 0x28a9(%rip), %rdx      # 0x5130
movl (%rdx,%rax,4), %eax
andl %eax, (%rcx)
xorl %r14d, %r14d
cmpq $0x4, %r14
je 0x28b0
movl 0x4(%rbx), %eax
cmpl -0x20(%rbp,%r14,4), %eax
je 0x28a7
movq %rbx, %rdi
callq 0x267c
incq %r14
addq $0x10, %rbx
jmp 0x288f
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/aap[P]rx-0/misc/crt.c
// Function: joyhat
void
joyhat(SDL_JoyHatEvent *he)
{
//	printf("%d %d %d\n", he->which, he->hat, he->value);
	u32 i, b;
	i = he->which;
	if(i >= NUMJOYS)
		return;

	b = 0;
	switch(he->value){
	case SDL_HAT_UP:	b = 0200; break;
	case SDL_HAT_RIGHTUP:	b = 0240; break;
	case SDL_HAT_RIGHT:	b = 0040; break;
	case SDL_HAT_RIGHTDOWN:	b = 0140; break;
	case SDL_HAT_DOWN:	b = 0100; break;
	case SDL_HAT_LEFTDOWN:	b = 0120; break;
	case SDL_HAT_LEFT:	b = 0020; break;
	case SDL_HAT_LEFTUP:	b = 0220; break;
	}

	joys[i].b &= ~0360;
	joys[i].b |= b;
	updatejoy(&joys[i]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl 0x8(%rdi), %eax
cmpq $0x3, %rax
jbe 0x28fa
popq %rbp
retq
movb 0xd(%rdi), %dl
decb %dl
xorl %ecx, %ecx
cmpb $0xb, %dl
ja 0x2913
movzbl %dl, %ecx
leaq 0x28c4(%rip), %rdx      # 0x51d4
movl (%rdx,%rcx,4), %ecx
shlq $0x4, %rax
leaq 0x5992(%rip), %rdx      # 0x82b0
movl $0xffffff0f, %esi       # imm = 0xFFFFFF0F
andl 0x4(%rax,%rdx), %esi
leaq (%rdx,%rax), %rdi
orl %ecx, %esi
movl %esi, 0x4(%rax,%rdx)
popq %rbp
jmp 0x267c
// File: /workspace/github_c_makefile_star2_O2/aap[P]rx-0/misc/crt.c
// Function: joybtn
void
joybtn(SDL_JoyButtonEvent *be)
{
	u32 i, b;
	i = be->which;
	if(i >= NUMJOYS)
		return;

	b = joys[i].map(be->button);
	if(be->state){
		joys[i].b |= b;
		updatejoy(&joys[i]);
	}else{
		joys[i].b &= ~b;
		updatejoy(&joys[i]);
	}

//	printf("%d %d %d. %o\n", be->which, be->button, be->state, joys[i].b);
}

// Assembly:
movl 0x8(%rdi), %eax
cmpq $0x3, %rax
jbe 0x2941
retq
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
shlq $0x4, %rax
leaq 0x595a(%rip), %rcx      # 0x82b0
leaq (%rcx,%rax), %rbx
movzbl 0xc(%rdi), %edi
callq *0x8(%rax,%rcx)
cmpb $0x0, 0xd(%r14)
je 0x296e
orl %eax, 0x4(%rbx)
jmp 0x2973
notl %eax
andl %eax, 0x4(%rbx)
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x267c
// File: /workspace/github_c_makefile_star2_O2/aap[P]rx-0/misc/crt.c
// Function: joyinit
void
joyinit(void)
{
	int i, n;
	SDL_Joystick *j;

	SDL_JoystickEventState(SDL_ENABLE);

	for(i = 0; i < NUMJOYS; i++){
		joys[i].i = i;
		joys[i].map = btnmap_ds3;
	}

	n = SDL_NumJoysticks();
	for(i = 0; i < n && i < NUMJOYS; i++){
		j = SDL_JoystickOpen(i);
		if(j == nil)
			continue;
		if(strcmp(SDL_JoystickNameForIndex(i), "Twin USB Joystick") == 0)
			joys[i].map = btnmap_ds2;
		printf("joy %d: %s\n", i, SDL_JoystickNameForIndex(i));
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
pushq $0x1
popq %rdi
callq 0x2240
leaq 0x591c(%rip), %rax      # 0x82b8
xorl %ecx, %ecx
leaq -0xd3(%rip), %rdx       # 0x28d2
cmpq $0x4, %rcx
je 0x29ba
movl %ecx, -0x8(%rax)
movq %rdx, (%rax)
incq %rcx
addq $0x10, %rax
jmp 0x29a5
callq 0x2170
movslq %eax, %r12
leaq 0x58ef(%rip), %r13      # 0x82b8
leaq 0x2876(%rip), %rbx      # 0x5246
leaq 0x2881(%rip), %r14      # 0x5258
xorl %r15d, %r15d
cmpq %r12, %r15
jge 0x2a35
cmpq $0x3, %r15
ja 0x2a35
movl %r15d, %edi
callq 0x2120
testq %rax, %rax
je 0x2a2c
movl %r15d, %edi
callq 0x2330
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2350
testl %eax, %eax
jne 0x2a14
leaq -0x157(%rip), %rax      # 0x28b9
movq %rax, (%r13)
movl %r15d, %edi
callq 0x2330
movq %r14, %rdi
movl %r15d, %esi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2040
incq %r15
addq $0x10, %r13
jmp 0x29da
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/aap[P]rx-0/misc/crt.c
// Function: mouse
void
mouse(int button, int state, int x, int y)
{
	u32 pen = 0x80000000;
	pen |= x;
	pen |= y<<10;
	if(state) pen |= 1<<20;
	if(state || penstate != !!state)
		write(sock, &pen, 4);
	penstate = !!state;
//	printf("%d %d %d %d\n", button, state, x, y);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %esi, %ebx
shll $0xa, %ecx
xorl %eax, %eax
testl %esi, %esi
setne %al
shll $0x14, %eax
orl %edx, %ecx
orl %eax, %ecx
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, -0xc(%rbp)
movl 0x5888(%rip), %eax      # 0x82f4
orl %esi, %eax
je 0x2a82
movl 0x581a(%rip), %edi      # 0x8290
leaq -0xc(%rbp), %rsi
pushq $0x4
popq %rdx
callq 0x20f0
xorl %eax, %eax
testl %ebx, %ebx
setne %al
movl %eax, 0x5865(%rip)      # 0x82f4
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/aap[P]rx-0/misc/crt.c
// Function: startcrt
void
startcrt(int fd, void *arg)
{
	static CRT CRT_;

	sock = fd;
	threadcreate(pixelthread, &CRT_);
	threadcreate(renderthread, &CRT_);
for(;;) sleep(1);
	exit(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, 0x57dc(%rip)      # 0x8290
leaq 0x2a(%rip), %rdi        # 0x2ae5
leaq 0x5836(%rip), %rbx      # 0x82f8
movq %rbx, %rsi
callq 0x38a6
leaq 0xfd(%rip), %rdi        # 0x2bce
movq %rbx, %rsi
callq 0x38a6
pushq $0x1
popq %rbx
movl %ebx, %edi
callq 0x21c0
jmp 0x2adc
// File: /workspace/github_c_makefile_star2_O2/aap[P]rx-0/misc/crt.c
// Function: pixelthread
static void*
pixelthread(void *arg)
{
	u32 cmd;
	int x;
	int y;
	int intensity;
	int i, v;
	Pixel *px;
	CRT *crt = arg;

	while(readn(sock, &cmd, 4) == 0){
		/* Queue pixel to display */
		x = cmd&01777;
		y = cmd>>10 & 01777;
//printf("%o %o\n", x, y);
		y = 1023-y;
		intensity = cmd>>20 & 7;

		intensity = pxintensity[intensity];
		i = 1024*y + x;
		v = crt->pxvals[i];

		lock(&crtlock);
		if(cmd & 1<<23)
			age++;

		if(intensity){
			if(v == 0){
				/* Add new pixel */
				px = &crt->pxlist[crt->numPixels++];
				px->x = x;
				px->y = y;
				px->l = blurLevelsDefault;
				crt->pxvals[i] = intensity;
			}else if(intensity > v)
				/* Intensify old pixel */
				crt->pxvals[i] = intensity;
		}
		unlock(&crtlock);
	}
	exit(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, -0x38(%rbp)
movl 0x5790(%rip), %edi      # 0x8290
leaq -0x2c(%rbp), %rsi
pushq $0x4
popq %rdx
callq 0x3e9a
testl %eax, %eax
jne 0x2bc6
movl -0x2c(%rbp), %eax
movl %eax, %r14d
andl $0x3ff, %r14d           # imm = 0x3FF
movl %eax, %r13d
notl %r13d
shrl $0xa, %r13d
andl $0x3ff, %r13d           # imm = 0x3FF
shrl $0x14, %eax
andl $0x7, %eax
leaq 0x1d057dd(%rip), %rcx   # 0x1d0831c
movb (%rax,%rcx), %r15b
movl %r13d, %r12d
shll $0xa, %r12d
orq %r14, %r12
movq -0x38(%rbp), %rax
movb 0x1600014(%rax,%r12), %bl
leaq 0x1d057c8(%rip), %rdi   # 0x1d08328
callq 0x3704
testb $-0x80, -0x2a(%rbp)
je 0x2b71
incl 0x1d057a7(%rip)         # 0x1d08318
testb %r15b, %r15b
je 0x2bb5
testb %bl, %bl
je 0x2b81
cmpb %bl, %r15b
ja 0x2ba9
jmp 0x2bb5
movq -0x38(%rbp), %rdx
movslq 0x600000(%rdx), %rax
leal 0x1(%rax), %ecx
movl %ecx, 0x600000(%rdx)
imulq $0x6, %rax, %rax
movw %r14w, (%rdx,%rax)
movw %r13w, 0x2(%rdx,%rax)
movb $0x4, 0x4(%rdx,%rax)
movq -0x38(%rbp), %rax
movb %r15b, 0x1600014(%rax,%r12)
leaq 0x1d0576c(%rip), %rdi   # 0x1d08328
callq 0x37d8
jmp 0x2afa
pushq $0x1
popq %rdi
callq 0x22d0
// File: /workspace/github_c_makefile_star2_O2/aap[P]rx-0/misc/crt.c
// Function: threadmain
int
threadmain(int argc, char *argv[])
{
	int port = 3400;
	ARGBEGIN{
	case 'p':
		port = atoi(EARGF(usage()));
		break;
	case 's':
		winsize = atoi(EARGF(usage()));
		break;
	}ARGEND;

	serve(port, startcrt, nil);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
cmpq $0x0, 0x1d04ea6(%rip)   # 0x1d08310
jne 0x3476
movq (%rbx), %rax
movq %rax, 0x1d04e9a(%rip)   # 0x1d08310
movl $0xd48, %r14d           # imm = 0xD48
leaq 0x1e02(%rip), %r15      # 0x5285
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x3500
cmpb $0x2d, (%rdi)
jne 0x3500
movzbl 0x1(%rdi), %eax
cmpl $0x2d, %eax
je 0x34a0
testl %eax, %eax
jne 0x34a6
jmp 0x3500
cmpb $0x0, 0x2(%rdi)
je 0x3500
addq $0x8, %rbx
incq %rdi
testb %al, %al
je 0x3483
incq %rdi
cmpb $0x73, %al
je 0x34dc
movzbl %al, %eax
cmpl $0x70, %eax
jne 0x34fc
cmpb $0x0, (%rdi)
jne 0x34d2
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x351e
addq $0x8, %rbx
callq 0x23e0
movl %eax, %r14d
jmp 0x34f9
cmpb $0x0, (%rdi)
jne 0x34ee
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x351e
addq $0x8, %rbx
callq 0x23e0
movl %eax, 0x4d6f(%rip)      # 0x8268
movq %r15, %rdi
movb (%rdi), %al
jmp 0x34ad
leaq -0xa5f(%rip), %rsi      # 0x2aa8
movl %r14d, %edi
xorl %edx, %edx
callq 0x3fc1
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x342a
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/one-one/dthread.c
// Function: dthread_init
void dthread_init() {

    dthread_spin_init(&lock);

    threads = (list *)malloc(sizeof(list));
    main_thread_pid = getpid();
    init_threads(threads);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
andl $0x0, 0x2ee9(%rip)      # 0x40e0
pushq $0x18
popq %rdi
callq 0x10b0
movq %rax, 0x2ee2(%rip)      # 0x40e8
callq 0x1060
movl %eax, 0x2edf(%rip)      # 0x40f0
movq 0x2ed0(%rip), %rdi      # 0x40e8
popq %rbp
jmp 0x1628
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/one-one/dthread.c
// Function: dthread_cleanup
void dthread_cleanup() {
    dthread_spin_lock(&lock);
    dthread *td;
    
    int count = threads->count;

    for(int i = 0; i < count; i++){
        td = remove_last(threads);
        if(td != NULL)
            free(td);
    }
    //final threads remove
    free(threads);
    dthread_spin_unlock(&lock);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x2eaa(%rip), %rdi      # 0x40e0
callq 0x1286
movq 0x2ea6(%rip), %rax      # 0x40e8
movl 0x10(%rax), %eax
xorl %ebx, %ebx
testl %eax, %eax
cmovgl %eax, %ebx
movq 0x2e95(%rip), %rdi      # 0x40e8
subl $0x1, %ebx
jb 0x1267
callq 0x16f3
movq %rax, %rdi
callq 0x1030
jmp 0x124c
callq 0x1030
cmpl $0x1, 0x2e6d(%rip)      # 0x40e0
jne 0x127f
movl $0x0, 0x2e61(%rip)      # 0x40e0
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/one-one/dthread.c
// Function: dthread_create
int dthread_create(dthread_t *thread, void *(*start_routine) (void *), void *args) {

    dthread_spin_lock(&lock);
    struct dthread *t;
    t = (dthread *) malloc(sizeof(dthread));
    if(t == NULL) {
        dthread_spin_unlock(&lock);
        return -1;        
    }
    int clone_return;
    char *stack_top;

    // by using mmap allocate the stack
    t->stack = mmap(NULL, THREAD_STACK_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0);
    if (t->stack == MAP_FAILED) {
        dthread_spin_unlock(&lock);
        return EAGAIN;
    }
    
    stack_top = t->stack + THREAD_STACK_SIZE;

    t->args = args;
    t->start_routine = start_routine;
    t->state = JOINABLE;
    clone_return = clone(fn, stack_top, SIGCHLD | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_VM, (void *)t);
    if(clone_return == -1) {
        dthread_spin_unlock(&lock);
        return EINVAL;
    }
    t->tid = clone_return;      //assigning the thread_id

    insert_beg(threads, t);
    *thread = t->tid;
    dthread_spin_unlock(&lock);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x2df3(%rip), %rdi      # 0x40e0
callq 0x1286
pushq $0x30
popq %rdi
callq 0x10b0
testq %rax, %rax
je 0x137a
movq %rax, %r14
pushq $0x3
popq %rdx
pushq $-0x1
popq %r8
movl $0x10000, %esi          # imm = 0x10000
xorl %edi, %edi
movl $0x20022, %ecx          # imm = 0x20022
xorl %r9d, %r9d
callq 0x1070
movq %rax, 0x10(%r14)
cmpq $-0x1, %rax
je 0x137e
addq $0x10000, %rax          # imm = 0x10000
movq %r12, 0x20(%r14)
movq %r15, 0x18(%r14)
movl $0x1, 0x8(%r14)
leaq -0x8f(%rip), %rdi       # 0x12b5
xorl %r15d, %r15d
movq %rax, %rsi
movl $0xf11, %edx            # imm = 0xF11
movq %r14, %rcx
xorl %eax, %eax
callq 0x1050
cmpl $-0x1, %eax
je 0x1382
cltq
movq %rax, (%r14)
movq 0x2d7e(%rip), %rdi      # 0x40e8
movq %r14, %rsi
callq 0x1638
movq (%r14), %rax
movq %rax, (%rbx)
jmp 0x1386
pushq $-0x1
jmp 0x1384
pushq $0xb
jmp 0x1384
pushq $0x16
popq %r15
cmpl $0x1, 0x2d53(%rip)      # 0x40e0
jne 0x1399
movl $0x0, 0x2d47(%rip)      # 0x40e0
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/one-one/dthread.c
// Function: dthread_exit
void dthread_exit(void *retval) {
    dthread_t tid = dthread_self();

    //get the node with tid and change its return value;
    dthread *td = get_node_by_tid(threads, tid);
    
    if(main_thread_pid == tid) {
        // fetch all the tid and pass it to join function 
        node *ptr;
        if(threads->head == NULL) {
            // printf("\nEmpty");
            return;
        }
        dthread_spin_lock(&lock);
        ptr = threads->head;
        dthread_spin_unlock(&lock);

        while(ptr != NULL) {
            if(ptr->td->state == JOINABLE) {
                dthread_join(ptr->td->tid, NULL);
            }
            ptr = ptr->next;
        }
        dthread_cleanup();
        exit(0);
    }
    if(td == NULL) {
        return;
    }
    
    td->retval = retval;
    exit(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x143a
movq %rax, %r14
movq 0x2d2a(%rip), %rdi      # 0x40e8
movq %rax, %rsi
callq 0x1754
movslq 0x2d23(%rip), %rcx      # 0x40f0
cmpq %rcx, %r14
jne 0x1402
movq 0x2d0f(%rip), %rax      # 0x40e8
movq (%rax), %rbx
testq %rbx, %rbx
je 0x1407
leaq 0x2cf8(%rip), %rdi      # 0x40e0
callq 0x1286
cmpl $0x1, 0x2cec(%rip)      # 0x40e0
jne 0x1423
movl $0x0, 0x2ce0(%rip)      # 0x40e0
jmp 0x1423
testq %rax, %rax
jne 0x142f
popq %rbx
popq %r14
popq %rbp
retq
movq (%rbx), %rax
cmpl $0x1, 0x8(%rax)
jne 0x141f
movq (%rax), %rdi
xorl %esi, %esi
callq 0x1447
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
jne 0x140c
callq 0x1229
jmp 0x1433
movq %rbx, 0x28(%rax)
xorl %edi, %edi
callq 0x10e0
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/one-one/dthread.c
// Function: dthread_join
int dthread_join(dthread_t thread, void **retval) {

    // function shall suspend execution of the calling thread until the target thread terminates,
    dthread_spin_lock(&lock);
    dthread *td = get_node_by_tid(threads, thread);
    dthread_t tid = dthread_self();
    dthread_spin_unlock(&lock);

    //join calling from same calling function
    if(tid == thread) {
        return EDEADLK;
    }

    if(td == NULL){
        return ESRCH;
    }

    
    if(td->state == JOINED) {
        return EINVAL;
    }
    int status;

    if(td->state == JOINABLE) {
        td->state = JOINED;
        waitpid(thread,&status, 0);
        if(status == -1) {
            perror("waitpid");
            exit(EXIT_FAILURE);
        }
    } 
    //updating the retval
    if(retval) {
        *retval = td->retval;
    }
    return 0; //success
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x2c7d(%rip), %rdi      # 0x40e0
callq 0x1286
movq 0x2c79(%rip), %rdi      # 0x40e8
movq %r15, %rsi
callq 0x1754
movq %rax, %r14
callq 0x143a
cmpl $0x1, 0x2c5a(%rip)      # 0x40e0
jne 0x1492
movl $0x0, 0x2c4e(%rip)      # 0x40e0
cmpq %r15, %rax
jne 0x149b
pushq $0x23
jmp 0x14af
testq %r14, %r14
je 0x14ad
movl 0x8(%r14), %eax
cmpl $0x2, %eax
jne 0x14bd
pushq $0x16
jmp 0x14af
pushq $0x3
popq %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x1, %eax
jne 0x14e2
movl $0x2, 0x8(%r14)
leaq -0x24(%rbp), %r12
movl %r15d, %edi
movq %r12, %rsi
xorl %edx, %edx
callq 0x10c0
cmpl $-0x1, (%r12)
je 0x14f2
testq %rbx, %rbx
je 0x14ee
movq 0x28(%r14), %rax
movq %rax, (%rbx)
xorl %eax, %eax
jmp 0x14b0
leaq 0xb0b(%rip), %rdi       # 0x2004
callq 0x10d0
pushq $0x1
popq %rdi
callq 0x10e0
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/one-one/dthread.c
// Function: dthread_kill
int dthread_kill(dthread_t thread, int sig) {
    //if sig is 0, no signal is sent
    if(sig == 0) {
        return 0;
    }

    if(sig < 0 || sig > 64) {
        return EINVAL;
    }
    //check if the thread exist
    dthread *temp = get_node_by_tid(threads,thread);

    if(temp == NULL) {
        return ESRCH;
    }
    
    temp->state = SIGNAL;
    int status = kill(thread,sig);
    return status;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
testl %esi, %esi
je 0x151c
movl %esi, %ebx
cmpl $0x40, %esi
jbe 0x1520
pushq $0x16
jmp 0x154e
xorl %eax, %eax
jmp 0x154f
movq %rdi, %r14
movq 0x2bbe(%rip), %rdi      # 0x40e8
movq %r14, %rsi
callq 0x1754
testq %rax, %rax
je 0x154c
movl $0x3, 0x8(%rax)
movl %r14d, %edi
movl %ebx, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x10a0
pushq $0x3
popq %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/one-one/dthread.c
// Function: dthread_mutex_lock
int dthread_mutex_lock(dthread_mutex_t *mutex) {
    
    unsigned int temp = __sync_val_compare_and_swap(mutex, 0, 1);
    if(temp != 0) {
        do  {
            if((temp == 2) || __sync_val_compare_and_swap(mutex, 1, 2) != 0)
                syscall(SYS_futex, mutex, FUTEX_WAIT_PRIVATE, 2, 0, 0, 0);
        } while((temp = __sync_val_compare_and_swap(mutex, 0, 2)) != 0);
    }
    return 0;
}

// Assembly:
pushq $0x1
popq %rcx
xorl %eax, %eax
lock
cmpxchgl %ecx, (%rdi)
je 0x15db
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
pushq $0x2
popq %r14
pushq $0x1
popq %r15
cmpl $0x2, %eax
je 0x15a7
movl %r15d, %eax
lock
cmpxchgl %r14d, (%rbx)
testl %eax, %eax
je 0x15c8
andl $0x0, (%rsp)
movl $0xca, %edi
movq %rbx, %rsi
movl $0x80, %edx
movl %r14d, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x1090
xorl %eax, %eax
lock
cmpxchgl %r14d, (%rbx)
jne 0x1596
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/one-one/dthread.c
// Function: dthread_mutex_unlock
int dthread_mutex_unlock(dthread_mutex_t *mutex) {
    if(__sync_fetch_and_sub(mutex, 1) != 1)  {
    *mutex = 0;
    syscall(SYS_futex, mutex, FUTEX_WAKE_PRIVATE, 1, 0, 0, 0);
   }
   return 0;
}

// Assembly:
lock
decl (%rdi)
je 0x1614
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, %rsi
andl $0x0, (%rdi)
andl $0x0, (%rsp)
pushq $0x1
popq %rcx
movl $0xca, %edi
movl $0x81, %edx
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x1090
addq $0x10, %rsp
popq %rbp
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/one-one/singlyll.c
// Function: insert_beg
void insert_beg(list *t, dthread *td) {
    //add condition for maximum
    node *ptr;
    ptr = (node*)malloc(sizeof(node));
    if(ptr == NULL) {
        printf("\nMemory full");
        return;
    }
    ptr->td = td;
    ptr->next = NULL;
    if(t->head == NULL) {
        t->head = ptr;
        t->tail = ptr;
    }
    else {
        ptr->next = t->head;
        t->head = ptr;
    }
    t->count = t->count + 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
pushq $0x10
popq %rdi
callq 0x10b0
testq %rax, %rax
je 0x1668
movq %r14, (%rax)
andq $0x0, 0x8(%rax)
movq (%rbx), %rcx
testq %rcx, %rcx
je 0x167a
movq %rcx, 0x8(%rax)
jmp 0x167e
leaq 0x99d(%rip), %rdi       # 0x200c
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x1080
movq %rax, 0x8(%rbx)
movq %rax, (%rbx)
incl 0x10(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/one-one/singlyll.c
// Function: remove_last
dthread* remove_last(list *t) {
    node *temp;
    dthread *td;
    if(t->count == 0) {
        printf("\nEmpty list");
        return NULL;
    }
    temp = t->head;
    if(t->count == 1) {
        td = temp->td;
        t->tail = NULL;
        t->head = NULL;
        t->count = t->count -1;
        return td;
    }
    
    while(temp->next != t->tail ) {
        temp = temp->next;
    }
    td = t->tail->td;
    t->tail = temp;
    t->tail->next = NULL;
    t->count = t->count -1;
    return td;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl 0x10(%rdi), %eax
testl %eax, %eax
je 0x1717
movq (%rdi), %rcx
cmpl $0x1, %eax
jne 0x1729
movq (%rcx), %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
andl $0x0, 0x10(%rdi)
jmp 0x174a
leaq 0x917(%rip), %rdi       # 0x2035
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x1080
jmp 0x174a
movq 0x8(%rdi), %rdx
movq %rcx, %rsi
movq 0x8(%rcx), %rcx
cmpq %rdx, %rcx
jne 0x172d
movq (%rdx), %rbx
movq %rsi, 0x8(%rdi)
andq $0x0, 0x8(%rsi)
decl %eax
movl %eax, 0x10(%rdi)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/one-one/singlyll.c
// Function: get_node_by_tid
dthread* get_node_by_tid(list *t, dthread_t tid) {
    node *temp;
    dthread *td;
    if(t->tail == NULL) {
        return NULL;
    }
    temp = t->head;
    while(temp != NULL) {
        if(tid == temp->td->tid) {
            return temp->td;
        }
        else {
            temp = temp->next;
        }
    }
    return NULL;
}

// Assembly:
cmpq $0x0, 0x8(%rdi)
je 0x1775
pushq %rbp
movq %rsp, %rbp
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x1778
movq (%rdi), %rax
addq $0x8, %rdi
cmpq %rsi, (%rax)
jne 0x175f
jmp 0x177a
xorl %eax, %eax
retq
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/nh13[P]ksw/src/parasail/tests/test_verify_rowcols.c
// Function: diff_array
static inline int diff_array(
        unsigned long size,
        int *a,
        int *b)
{
    unsigned long i = 0;
    for (i=0; i<size; ++i) {
        if (a[i] != b[i]) return 1;
    }
    return 0;
}

// Assembly:
xorl %eax, %eax
pushq $0x1
popq %rcx
xorl %r8d, %r8d
cmpq %r8, %rdi
je 0x14bafa
movl (%rsi,%r8,4), %r9d
leaq 0x1(%r8), %r10
cmpl (%rdx,%r8,4), %r9d
movq %r10, %r8
je 0x14bae2
movl %ecx, %eax
retq
nop
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]libcperciva/tests/mpool/main.c
// Function: main
int
main(int argc, char * argv[])
{
	unsigned long sets, reps;
	unsigned int use_mpool;
	long long delta_us;

	WARNP_INIT;

	/* Parse args. */
	if ((argc != 4) || (PARSENUM(&sets, argv[1])) ||
	    (PARSENUM(&reps, argv[2])) || (PARSENUM(&use_mpool, argv[3]))) {
		printf("usage: test_mpool SETS REPS TYPE\n");
		goto err0;
	}

	/* Sanity check. */
	if (!((sets > 0) && (reps > 0))) {
		fprintf(stderr, "SETS and REPS must be greater than zero\n");
		goto err0;
	}

	/* Time memory allocation method, and output it. */
	if ((delta_us = time_func(sets, reps, use_mpool)) < 0)
		goto err0;
	printf("%lld\n", delta_us);

	/* Success! */
	exit(0);

err0:
	/* Failure! */
	exit(1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movl %edi, %ebp
movq (%rsi), %rdi
testq %rdi, %rdi
je 0x1672
callq 0x1a0c
cmpl $0x4, %ebp
jne 0x1703
callq 0x1060
movq %rax, %r15
andl $0x0, (%rax)
movq 0x8(%rbx), %rdi
pushq $-0x1
popq %rdx
movq %rdx, %rsi
callq 0x173b
cmpl $0x0, (%r15)
jne 0x1703
movq %rax, %r14
movq 0x10(%rbx), %rdi
pushq $-0x1
popq %rdx
movq %rdx, %rsi
callq 0x173b
cmpl $0x0, (%r15)
jne 0x1703
movq %rax, %r12
movq 0x18(%rbx), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x173b
cmpl $0x0, (%r15)
jne 0x1703
testq %r14, %r14
setne %cl
testq %r12, %r12
setne %dl
testb %dl, %cl
jne 0x1711
movq 0x2912(%rip), %rax      # 0x3ff8
movq (%rax), %rcx
leaq 0x9c3(%rip), %rdi       # 0x20b3
pushq $0x28
popq %rsi
pushq $0x1
popq %rdx
callq 0x1180
pushq $0x1
popq %rdi
callq 0x1170
leaq 0xa9f(%rip), %rdi       # 0x21a9
callq 0x1070
jmp 0x16fb
movq %r14, %rdi
movq %r12, %rsi
movl %eax, %edx
callq 0x12b5
testq %rax, %rax
js 0x16fb
leaq 0x9b2(%rip), %rdi       # 0x20dc
movq %rax, %rsi
xorl %eax, %eax
callq 0x10a0
xorl %edi, %edi
callq 0x1170
// File: /workspace/github_c_makefile_star2_O2/codeniko[P]CS214-Malloc-Free/Test2.c
// Function: main
void main()
{
    int* p = malloc(sizeof(int));
    *p = 5;
    printf("address: %p, value: %d\n",p, *p);
    free(p);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0xeaa(%rip), %rbx       # 0x2004
pushq $0x4
popq %rdi
pushq $0x6
popq %rdx
movq %rbx, %rsi
callq 0x1198
movq %rax, %r14
movl $0x5, (%rax)
leaq 0xe94(%rip), %rdi       # 0x200c
pushq $0x5
popq %rdx
movq %rax, %rsi
xorl %eax, %eax
callq 0x1030
pushq $0x9
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x12d1
nop
// File: /workspace/github_c_makefile_star2_O2/wuxb45[P]SLB/ibkvcli.c
// Function: test_ibkv
int
test_ibkv(const int argc, char ** const argv)
{
  if (argc < 6 || (strcmp(argv[0], "api") != 0)) {
    return -1;
  }

  const u64 pid = strtoull(argv[1], NULL, 10);
  char * const host = argv[2];
  const int pn = atoi(argv[3]);
  const u64 depth = strtoull(argv[4], NULL, 10);
  const u64 batch = strtoull(argv[5], NULL, 10);

  char *pref[64] = {};
  for (int i = 0; i < 6; i++) {
    pref[i] = argv[i];
  }
  pref[6] = NULL;

  struct worker_info wi;
  wi.port = ib_port_create(pid);
  wi.host = host;
  wi.pn = pn;
  wi.depth = depth;
  wi.batch = batch;

  struct pass_info pi = {};
  pi.api = &wi;
  pi.vctr_size = 4;
  pi.wf = ibkv_worker;
  pi.af = ibkv_analyze;
  const int n2 = maptest_passes(argc - 6, argv + 6, pref, &pi);
  ib_port_destroy(wi.port);
  if (n2 < 0) {
    return n2;
  }
  return 6 + n2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x268, %rsp            # imm = 0x268
pushq $-0x1
popq %r15
cmpl $0x6, %edi
jl 0x6957
movq %rsi, %rbx
movl %edi, %r14d
movq (%rsi), %rdi
leaq 0xb7d3(%rip), %rsi      # 0x12010
callq 0x64b0
testl %eax, %eax
jne 0x6957
movq 0x8(%rbx), %rdi
xorl %r12d, %r12d
pushq $0xa
popq %r15
xorl %esi, %esi
movl %r15d, %edx
callq 0x6580
movq %rax, -0x38(%rbp)
movq 0x10(%rbx), %rax
movq %rax, -0x40(%rbp)
movq 0x18(%rbx), %rdi
callq 0x63e0
movl %eax, -0x2c(%rbp)
movq 0x20(%rbx), %rdi
xorl %esi, %esi
movl %r15d, %edx
callq 0x6580
movq %rax, %r13
movq 0x28(%rbx), %rdi
xorl %esi, %esi
movl %r15d, %edx
callq 0x6580
movq %rax, %r15
leaq -0x290(%rbp), %rdi
movl $0x200, %edx            # imm = 0x200
xorl %esi, %esi
callq 0x6080
cmpq $0x6, %r12
je 0x68c3
movq (%rbx,%r12,8), %rax
movq %rax, -0x290(%rbp,%r12,8)
incq %r12
jmp 0x68ac
leaq -0x290(%rbp), %rax
andq $0x0, 0x30(%rax)
movq -0x38(%rbp), %rdi
callq 0x113ac
leaq -0x90(%rbp), %r12
movq %rax, (%r12)
movq -0x40(%rbp), %rax
movq %rax, 0x8(%r12)
movl -0x2c(%rbp), %eax
movl %eax, 0x10(%r12)
movq %r13, 0x18(%r12)
movq %r15, 0x20(%r12)
leaq -0x68(%rbp), %rcx
andq $0x0, (%rcx)
movq %r12, 0x8(%rcx)
movq $0x4, 0x10(%rcx)
leaq 0x53(%rip), %rax        # 0x696c
movq %rax, 0x18(%rcx)
leaq 0x454(%rip), %rax       # 0x6d78
movq %rax, 0x20(%rcx)
addl $-0x6, %r14d
addq $0x30, %rbx
movl %r14d, %edi
movq %rbx, %rsi
leaq -0x290(%rbp), %rdx
callq 0x106b3
movl %eax, %ebx
movq (%r12), %rdi
callq 0x114e3
leal 0x6(%rbx), %r15d
testl %ebx, %ebx
cmovsl %ebx, %r15d
movl %r15d, %eax
addq $0x268, %rsp            # imm = 0x268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wuxb45[P]SLB/ibkvcli.c
// Function: ibkv_analyze
static bool
ibkv_analyze(struct vctr * const va, const double dt, struct damp * const damp, char * const out)
{
  u64 v[8];
  for (u64 i = 0; i < 4; i++) {
    v[i] = vctr_get(va, i);
  }

  const u64 nrop = v[XSA] + v[XDA] + v[XGA] + v[XPA];
  const double mops = ((double)nrop) / (dt * 1.0e6);
  const bool done = damp_add_test(damp, mops);
  const double havg = damp_average(damp);
  const char * const pat = " set %"PRIu64" del %"PRIu64" get %"PRIu64" pro %"PRIu64" mops %.2lf havg %.2lf\n";
  sprintf(out, pat, v[XSA], v[XDA], v[XGA], v[XPA], mops, havg);
  return done;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, -0x38(%rbp)
movq %rsi, %r14
vmovsd %xmm0, -0x30(%rbp)
movq %rdi, %r15
xorl %r12d, %r12d
cmpq $0x4, %r12
je 0x6db6
movq %r15, %rdi
movq %r12, %rsi
callq 0x9464
movq %rax, -0x80(%rbp,%r12,8)
incq %r12
jmp 0x6d9b
movq -0x80(%rbp), %r15
movq -0x78(%rbp), %r12
movq -0x70(%rbp), %r13
movq -0x68(%rbp), %rbx
leaq (%r13,%rbx), %rcx
addq %r12, %rcx
addq %r15, %rcx
vcvtusi2sd %rcx, %xmm1, %xmm0
vmovsd -0x30(%rbp), %xmm1
vmulsd 0xb224(%rip), %xmm1, %xmm1 # 0x12008
vdivsd %xmm1, %xmm0, %xmm0
vmovsd %xmm0, -0x30(%rbp)
movq %r14, %rdi
callq 0x92bd
movq %r14, %rdi
movl %eax, %r14d
callq 0x91ca
vmovapd %xmm0, %xmm1
leaq 0xb209(%rip), %rsi      # 0x12014
movq -0x38(%rbp), %rdi
movq %r15, %rdx
movq %r12, %rcx
movq %r13, %r8
movq %rbx, %r9
vmovsd -0x30(%rbp), %xmm0
movb $0x2, %al
callq 0x6300
movl %r14d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wjmelements[P]evm/evm.c
// Function: disassemble
static void disassemble(const char *contents) {
    disassembleInit();
    while (disassembleValid(&contents)) {
        disassembleNextOp(&contents);
    }
    disassembleFinalize();
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
leaq 0x8(%rsp), %rbx
movq %rdi, (%rbx)
xorl %eax, %eax
callq 0xdb5c
movq %rbx, %rdi
callq 0xe0d9
testl %eax, %eax
je 0x377d
movq %rbx, %rdi
callq 0xdc00
jmp 0x3767
xorl %eax, %eax
callq 0xe0ea
addq $0x10, %rsp
popq %rbx
retq