LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/aparrish[P]rwet-examples-c/markov_gen.c
// Function: markov_gen_dump
void markov_gen_dump(markov_gen_t* mg) {
	ngram_t* current, * tmp;
	char* joined_nexts, * joined_ngram;
	int joined_len, i;

	printf("ngrams:\n");
	HASH_ITER(hh, mg->ngrams, current, tmp) {
		joined_len = join_new(&joined_ngram, current->ngram, " ");
		joined_len = join_new(&joined_nexts, current->possible_nexts, ", ");
		printf("\t%s -> %s\n", joined_ngram, joined_nexts);
		free(joined_ngram);
		free(joined_nexts);
	}

	printf("beginnings:\n");
	for (i = 0; i < utarray_len(mg->beginnings); i++) {
		current = *((ngram_t**)utarray_eltptr(mg->beginnings, i));
		printf("\t%s\n", current->ngram_key);
	}

	printf("a random beginning:\n");
	current = *((ngram_t**)utarray_choice(mg->beginnings));
	printf("\t%s\n", current->ngram_key);

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x874(%rip), %rdi       # 0x30c2
callq 0x1050
movq 0x8(%rbx), %r15
testq %r15, %r15
jne 0x2860
xorl %eax, %eax
jmp 0x2864
movq 0x28(%r15), %rax
leaq 0x844(%rip), %r12       # 0x30af
leaq 0x10(%rsp), %r13
leaq 0x83b(%rip), %rbp       # 0x30b2
movq %r15, %r14
testq %r14, %r14
je 0x28dd
movq %rax, %r15
movq 0x8(%r14), %rsi
leaq 0x8(%rsp), %rdi
leaq 0x81e(%rip), %rdx       # 0x30b0
callq 0x162c
movq 0x10(%r14), %rsi
movq %r13, %rdi
movq %r12, %rdx
callq 0x162c
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbp, %rdi
xorl %eax, %eax
callq 0x1070
movq 0x8(%rsp), %rdi
callq 0x1030
movq 0x10(%rsp), %rdi
callq 0x1030
movl $0x0, %eax
movq %r15, %r14
testq %r15, %r15
je 0x287a
jmp 0x2860
leaq 0x7e6(%rip), %rdi       # 0x30ca
callq 0x1050
leaq 0x7cd(%rip), %r14       # 0x30bd
xorl %r15d, %r15d
movq 0x10(%rbx), %rax
movl (%rax), %ecx
cmpq %rcx, %r15
jae 0x2920
movq 0x28(%rax), %rcx
movq 0x8(%rax), %rax
imulq %r15, %rax
movq (%rcx,%rax), %rax
movq (%rax), %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x1070
incq %r15
jmp 0x28f3
leaq 0x7af(%rip), %rdi       # 0x30d6
callq 0x1050
callq 0x1160
movq 0x10(%rbx), %rax
movq 0x8(%rax), %r14
movq 0x28(%rax), %r15
callq 0x1160
movq 0x10(%rbx), %rcx
xorl %edx, %edx
divl (%rcx)
imulq %r14, %rdx
movq (%r15,%rdx), %rax
movq (%rax), %rsi
leaq 0x761(%rip), %rdi       # 0x30bd
xorl %eax, %eax
callq 0x1070
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/aparrish[P]rwet-examples-c/markov_gen.c
// Function: markov_gen_free
void markov_gen_free(markov_gen_t* mg) {

	ngram_t* current, * tmp;

	/* free individual ngram structs here */
	HASH_ITER(hh, mg->ngrams, current, tmp) {
		HASH_DEL(mg->ngrams, current);
		free(current->ngram_key);
		utarray_free(current->possible_nexts);
		utarray_free(current->ngram);
		free(current);
	}

	utarray_free(mg->beginnings);
	free(mg);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x8(%rdi), %r15
movq 0x8(%rdi), %r12
testq %r12, %r12
je 0x2992
movq 0x28(%r12), %rax
jmp 0x2994
xorl %eax, %eax
movq %r12, %r14
testq %r14, %r14
je 0x2b20
movq %rax, %r12
movq 0x20(%r14), %rax
testq %rax, %rax
je 0x29b1
movq (%r15), %rcx
jmp 0x29bf
cmpq $0x0, 0x28(%r14)
movq (%r15), %rcx
je 0x2aff
movq 0x18(%rcx), %rdx
movq 0x18(%rdx), %rdi
movq 0x20(%rdx), %rsi
subq %rsi, %rdi
cmpq %rdi, %r14
jne 0x29db
leaq (%rax,%rsi), %rdi
movq %rdi, 0x18(%rdx)
testq %rax, %rax
movq 0x28(%r14), %rdx
leaq 0x10(%rax,%rsi), %rsi
cmoveq %r15, %rsi
cmoveq %rdx, %rcx
movq %rdx, (%rsi)
movq 0x18(%rcx), %rcx
testq %rdx, %rdx
je 0x2a04
movq 0x20(%rcx), %rsi
movq %rax, 0x8(%rdx,%rsi)
movl 0x8(%rcx), %eax
decl %eax
andl 0x4c(%r14), %eax
movq (%rcx), %rdx
shlq $0x4, %rax
decl 0x8(%rdx,%rax)
leaq 0x18(%r14), %rsi
cmpq %rsi, (%rdx,%rax)
jne 0x2a2c
addq %rax, %rdx
movq 0x38(%r14), %rax
movq %rax, (%rdx)
movq 0x30(%r14), %rax
movq 0x38(%r14), %rdx
testq %rax, %rax
je 0x2a3d
movq %rdx, 0x20(%rax)
testq %rdx, %rdx
je 0x2a46
movq %rax, 0x18(%rdx)
decl 0x10(%rcx)
movq (%r14), %rdi
callq 0x1030
movq 0x10(%r14), %rax
cmpl $0x0, 0x4(%rax)
je 0x2a91
cmpq $0x0, 0x20(%rax)
je 0x2a84
xorl %r13d, %r13d
movl (%rax), %ecx
cmpq %rcx, %r13
jae 0x2a84
movq 0x8(%rax), %rdi
imulq %r13, %rdi
addq 0x28(%rax), %rdi
callq *0x20(%rax)
incq %r13
movq 0x10(%r14), %rax
jmp 0x2a65
movq 0x28(%rax), %rdi
callq 0x1030
movq 0x10(%r14), %rax
movq %rax, %rdi
callq 0x1030
movq 0x8(%r14), %rax
cmpl $0x0, 0x4(%rax)
je 0x2ad9
cmpq $0x0, 0x20(%rax)
je 0x2acc
xorl %r13d, %r13d
movl (%rax), %ecx
cmpq %rcx, %r13
jae 0x2acc
movq 0x8(%rax), %rdi
imulq %r13, %rdi
addq 0x28(%rax), %rdi
callq *0x20(%rax)
incq %r13
movq 0x8(%r14), %rax
jmp 0x2aad
movq 0x28(%rax), %rdi
callq 0x1030
movq 0x8(%r14), %rax
movq %rax, %rdi
callq 0x1030
movq %r14, %rdi
callq 0x1030
movl $0x0, %eax
movq %r12, %r14
testq %r12, %r12
je 0x2997
jmp 0x298b
movq 0x18(%rcx), %rax
movq (%rax), %rdi
callq 0x1030
movq (%r15), %rax
movq 0x18(%rax), %rdi
callq 0x1030
andq $0x0, (%r15)
jmp 0x2a49
movq 0x10(%rbx), %rax
cmpl $0x0, 0x4(%rax)
je 0x2b60
cmpq $0x0, 0x20(%rax)
je 0x2b53
xorl %r14d, %r14d
movl (%rax), %ecx
cmpq %rcx, %r14
jae 0x2b53
movq 0x8(%rax), %rdi
imulq %r14, %rdi
addq 0x28(%rax), %rdi
callq *0x20(%rax)
incq %r14
movq 0x10(%rbx), %rax
jmp 0x2b34
movq 0x28(%rax), %rdi
callq 0x1030
movq 0x10(%rbx), %rax
movq %rax, %rdi
callq 0x1030
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x1030
// File: /workspace/github_c_makefile_star2_O2/deepika9294[P]Threading-Library/one-one/test/spin.c
// Function: main
int main() {
	dthread_t th1, th2, th3, th4; 
	int a1,a2,a3,a4;
    dthread_init();
    printf("\n\n");

	a1 = dthread_create(&th1, thread1, NULL);
	a2 = dthread_create(&th2, thread2, NULL);
	a3 = dthread_create(&th3, thread3, NULL);
	a4 = dthread_create(&th4, thread4, NULL);
	if(a1 != 0 || a2 != 0 || a3 !=0 || a4 != 0) {
		printf("Error in creation \n");
		return 0;
	}
	sleep(2);
	run = 0;
	dthread_join(th1, NULL);
	dthread_join(th2, NULL);
	dthread_join(th2, NULL);
	dthread_join(th2, NULL);

	if(c == c1 + c2 + c3 + c4) {
		printf(GREEN "**PASSED**: Spin lock test for race problem between 4 threads\n" NONE);
	}
	else {
		printf(RED "**FAILED**: Spin lock test for race problem between 4 threads\n" NONE);
	}

    // printf("\n%ld %ld %ld %ld %ld %ld\n", c, c1+c2+c3+c4 , c1, c2, c3, c4);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
callq 0x120c
leaq 0x824(%rip), %rdi       # 0x20d9
callq 0x1050
leaq -0x125(%rip), %rsi      # 0x179c
leaq -0x28(%rbp), %rdi
xorl %edx, %edx
callq 0x12f2
movl %eax, %r15d
leaq -0xfa(%rip), %rsi       # 0x17dc
leaq -0x20(%rbp), %rdi
xorl %edx, %edx
callq 0x12f2
movl %eax, %ebx
leaq -0xce(%rip), %rsi       # 0x181c
leaq -0x38(%rbp), %rdi
xorl %edx, %edx
callq 0x12f2
movl %eax, %r14d
leaq -0xa3(%rip), %rsi       # 0x185c
leaq -0x30(%rbp), %rdi
xorl %edx, %edx
callq 0x12f2
testl %r15d, %r15d
jne 0x1986
testl %ebx, %ebx
jne 0x1986
testl %r14d, %r14d
jne 0x1986
testl %eax, %eax
jne 0x1986
pushq $0x2
popq %rdi
callq 0x1100
andq $0x0, 0x276c(%rip)      # 0x4098
movq -0x28(%rbp), %rdi
xorl %esi, %esi
callq 0x1467
movq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0x1467
movq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0x1467
movq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0x1467
movq 0x2771(%rip), %rax      # 0x40d0
addq 0x2762(%rip), %rax      # 0x40c8
addq 0x276b(%rip), %rax      # 0x40d8
addq 0x276c(%rip), %rax      # 0x40e0
cmpq %rax, 0x2745(%rip)      # 0x40c0
jne 0x1994
leaq 0x6bd(%rip), %rdi       # 0x2041
jmp 0x199b
leaq 0x74e(%rip), %rdi       # 0x20db
callq 0x1050
jmp 0x19a2
leaq 0x6f2(%rip), %rdi       # 0x208d
xorl %eax, %eax
callq 0x1090
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/adelciotto[P]scg/examples/transform.c
// Function: main
int main(int arcg, char *argv[]) {
    scg_config_t config = scg_config_new_default();
    config.video.title = "SCG Example: Transform";

    scg_app_t app;
    scg_app_init(&app, config);

    scg_image_t *image = scg_image_new_from_bmp("assets/ball.bmp");
    if (image == NULL) {
        return -1;
    }

    while (scg_app_process_events(&app)) {
        draw(app.draw_target, image, app.elapsed_time);

        scg_app_present(&app);
    }

    scg_image_free(image);
    scg_app_free(&app);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xc8, %rsp
movabsq $0x1e000000280, %rax    # imm = 0x1E000000280
movq %rax, 0x38(%rsp)
movl $0x1, 0x48(%rsp)
xorl %eax, %eax
movb %al, 0x4c(%rsp)
movl $0x1010101, 0x4d(%rsp)  # imm = 0x1010101
movb %al, 0x54(%rsp)
movl $0x40, 0x58(%rsp)
leaq 0x149d(%rip), %rax      # 0x65ac
movq %rax, 0x40(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x20(%rsp)
movups 0x38(%rsp), %xmm0
movups 0x48(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq 0x60(%rsp), %rdi
callq 0x3dc3
leaq 0x1481(%rip), %rdi      # 0x65c3
callq 0x2911
testq %rax, %rax
je 0x51e5
movq %rax, %rbx
leaq 0x60(%rsp), %r14
pushq $0x2
popq %rbp
movq %r14, %rdi
callq 0x4858
testb %al, %al
je 0x51cf
movq 0x98(%rsp), %r15
movss 0x68(%rsp), %xmm0
movss %xmm0, 0x34(%rsp)
movq %r15, %rdi
movl $0xff008080, %esi       # imm = 0xFF008080
callq 0x2c56
movl (%r15), %eax
movl 0x4(%r15), %ecx
movl %ebp, 0x18(%r15)
cltd
idivl %ebp
movl %eax, %r8d
subl 0x4(%rbx), %r8d
movl %ecx, %eax
cltd
idivl %ebp
subl (%rbx), %eax
movq %r15, %rdi
movq %rbx, %rsi
movl %r8d, %edx
movl %eax, %ecx
movss 0x34(%rsp), %xmm0
movss 0xe7b(%rip), %xmm1      # 0x6038
movaps %xmm1, %xmm2
callq 0x2f76
movq %r14, %rdi
callq 0x491f
jmp 0x515b
movq %rbx, %rdi
callq 0x3bb8
leaq 0x60(%rsp), %rdi
callq 0x4bf7
xorl %eax, %eax
jmp 0x51e8
pushq $-0x1
popq %rax
addq $0xc8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/cgaebel[P]pipe/pipe.c
// Function: make_snapshot
static inline snapshot_t make_snapshot(pipe_t* p)
{
    return (snapshot_t) {
        .buffer = p->buffer,
        .bufend = p->bufend,
        .begin  = p->begin,
        .end    = p->end,
        .elem_size = __pipe_elem_size(p),
    };
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, %rax
movq 0x18(%rsi), %rcx
movq %rcx, (%rdi)
movq 0x20(%rsi), %rcx
movq %rcx, 0x8(%rdi)
movq 0x28(%rsi), %rcx
movq %rcx, 0x10(%rdi)
movq 0x30(%rsi), %rcx
movq %rcx, 0x18(%rdi)
movq (%rsi), %rcx
movq %rcx, 0x20(%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xlua.h
// Function: xlua_register
static inline void
xlua_register(lua_State *L,
              int ndxTable,
              const luaL_Reg *regs,
              int ndxUpValue)
{
   const luaL_Reg *preg;

   ndxTable = lua_absindex(L, ndxTable);

   for (preg = regs; preg->func; ++preg) {
      if (ndxUpValue) {
         lua_pushvalue(L, ndxUpValue);
      }
      lua_pushcclosure(L, preg->func, (ndxUpValue ? 1 : 0));
      lua_setfield(L, ndxTable, preg->name);
   }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
pushq $-0x1
popq %rbp
movl %ebp, %esi
callq 0x5982
movl %eax, %r12d
xorl %r13d, %r13d
testl %ebx, %ebx
setne %r13b
addq $0x8, %r14
movq (%r14), %rsi
testq %rsi, %rsi
je 0x3746
testl %ebx, %ebx
je 0x3726
movq %r15, %rdi
movl %ebp, %esi
callq 0x5b84
movq (%r14), %rsi
movq %r15, %rdi
movl %r13d, %edx
callq 0x623a
movq -0x8(%r14), %rdx
movq %r15, %rdi
movl %r12d, %esi
callq 0x661d
addq $0x10, %r14
jmp 0x370d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xlua.h
// Function: xlua_newMT
static inline void
xlua_newMT(lua_State *L, const void *tptr)
{
   // mt = {}
   lua_createtable(L, 0, 0);

   // REGISTRY[mt] = regs
   lua_pushvalue(L, -1);
   lua_pushlightuserdata(L, CONST_CAST(void*) tptr);
   lua_rawset(L, LUA_REGISTRYINDEX);

   // mt.__index = mt
   lua_pushvalue(L, -1);
   lua_setfield(L, -2, "__index");

   // return mt
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
xorl %esi, %esi
xorl %edx, %edx
callq 0x649a
pushq $-0x1
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x5b84
movq %rbx, %rdi
movq %r14, %rsi
callq 0x62d7
movq %rbx, %rdi
movl $0xfff0b9d8, %esi       # imm = 0xFFF0B9D8
callq 0x6683
movq %rbx, %rdi
movl %ebp, %esi
callq 0x5b84
leaq 0x11a16(%rip), %rdx     # 0x151b4
pushq $-0x2
popq %rsi
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x661d
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: xpsocket_try_accept
static int xpsocket_try_accept(lua_State *L)
{
   XPSocket *me = XLUA_CAST(L, 1, XPSocket);
   XPSocket *ps = xpsocket_new(L);

   ps->s = accept(me->s, NULL, NULL);
   if (ps->s == -1) {
      return pushError(L, isRetry(errno) ? "retry" : NULL);
   }

   // Linux: accepted socket does not inherit file status (the nerve!)
   if (setNonBlocking(ps->s, 1) == -1) {
      (void) close(ps->s);
      ps->s = -1;
      return pushError(L, NULL);
   }

   return 1;  // success => return new socket
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1c192(%rip), %rdx     # 0x1f950
leaq 0x11880(%rip), %rcx     # 0x15045
pushq $0x1
popq %rbp
movl %ebp, %esi
callq 0x465c
movq %rax, %r15
movq %rbx, %rdi
callq 0x41ef
movq %rax, %r14
movl (%r15), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3380
movl %eax, (%r14)
cmpl $-0x1, %eax
je 0x380f
movl %eax, %edi
movl %ebp, %esi
callq 0x4243
cmpl $-0x1, %eax
jne 0x3835
movl (%r14), %edi
callq 0x31c0
orl $-0x1, (%r14)
xorl %esi, %esi
jmp 0x382a
callq 0x3060
movl (%rax), %edi
callq 0x57bf
xorl %esi, %esi
testl %eax, %eax
leaq 0x119e2(%rip), %rax     # 0x15208
cmovneq %rax, %rsi
movq %rbx, %rdi
callq 0x4204
pushq $0x2
popq %rbp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: scanNum
static const char *
scanNum(const char *pszNum, unsigned *pn)
{
   const char *psz = pszNum;
   unsigned n = 0;
   while (isDigit(*psz)) {
      n = n *10 + (*psz - '0');
      ++psz;
   }
   *pn = n;
   return psz;
}

// Assembly:
movq %rdi, %rax
xorl %ecx, %ecx
movsbl (%rax), %edx
addl $-0x30, %edx
cmpl $0x9, %edx
ja 0x3c18
imull $0xa, %ecx, %ecx
addl %ecx, %edx
incq %rax
movl %edx, %ecx
jmp 0x3c01
movl %ecx, (%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: addrFromString
static int addrFromString(struct sockaddr_in *psin, const char *psz)
{
   unsigned nums[4] = {0};
   unsigned port = 0;
   size_t i;

   for (i=0; ; ++i) {
      if (!*psz) {
         break;
      }
      if (*psz == ':') {
         psz = scanNum(psz+1, &port);
         break;
      }
      if (i >= ARRAY_LENGTH(nums)) {
         return -1;
      }
      psz = scanNum(psz, &nums[i]);
      if (*psz == '.') {
         ++psz;
      }
   }

   // TODO: syntax validation
   // TODO: range validation

   // POSIX fail: I can find no specifications or docs (POSIX, Linux,
   // MacOS) that indicate to zero the unused fields, but trial and error
   // indicates that it is necessary (at least on MacOS).
   ZERO_REC(*psin);

   if (i > 1) nums[0] *= 0x1000000;
   if (i > 2) nums[1] *= 0x10000;
   if (i > 3) nums[2] *= 0x100;

   // POSIX fail: Port and addr are typed as numbers *yet* stored in network
   // byte order, requiring htons/htonl (still...).
   psin->sin_family = AF_INET;
   psin->sin_addr.s_addr = htonl(nums[0] + nums[1] + nums[2] + nums[3]);
   psin->sin_port = htons(port);
   return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rcx
movq %rdi, %rbx
xorps %xmm0, %xmm0
andl $0x0, 0xc(%rsp)
leaq 0x10(%rsp), %r14
movaps %xmm0, (%r14)
xorl %r15d, %r15d
pushq $-0x1
popq %rbp
movzbl (%rcx), %eax
testl %eax, %eax
je 0x3c83
cmpl $0x3a, %eax
je 0x3c73
cmpq $0x4, %r15
je 0x3cd0
movq %rcx, %rdi
movq %r14, %rsi
callq 0x3bfc
xorl %ecx, %ecx
cmpb $0x2e, (%rax)
sete %cl
addq %rax, %rcx
incq %r15
addq $0x4, %r14
jmp 0x3c42
incq %rcx
leaq 0xc(%rsp), %rsi
movq %rcx, %rdi
callq 0x3bfc
andq $0x0, 0x8(%rbx)
movl 0x10(%rsp), %eax
cmpq $0x2, %r15
jb 0x3cab
shll $0x18, %eax
cmpq $0x2, %r15
je 0x3cab
shll $0x10, 0x14(%rsp)
cmpq $0x4, %r15
jb 0x3cab
shll $0x8, 0x18(%rsp)
movw $0x2, (%rbx)
addl 0x14(%rsp), %eax
addl 0x18(%rsp), %eax
addl 0x1c(%rsp), %eax
bswapl %eax
movl %eax, 0x4(%rbx)
movzwl 0xc(%rsp), %eax
rolw $0x8, %ax
movw %ax, 0x2(%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: xpio_socket
static int xpio_socket(lua_State *L)
{
   XPSocket *me = xpsocket_new(L);
   const char *typeName = luaL_checkstring(L, 1);
   int type;

   if (0 == strcmp(typeName, "TCP")) {
      type = SOCK_STREAM;
   } else if (0 == strcmp(typeName, "UDP")) {
      type = SOCK_DGRAM;
   } else {
      lua_pushnil(L);
      lua_pushstring(L, "xpio: unsupported socket type");
      return 2;
   }

   me->s = socket(AF_INET, type, 0);
   if (me->s == -1) {
      return pushError(L, NULL);
   }

   // Note: *me and me->s will be cleaned up when userdata is collected

   if (setNonBlocking(me->s, 1) == -1) {
      return pushError(L, NULL);
   }

   return 1;   // success => return userdata
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
callq 0x41ef
movq %rax, %r14
pushq $0x1
popq %r15
movq %rbx, %rdi
movl %r15d, %esi
xorl %edx, %edx
callq 0x77e4
movq %rax, %r12
leaq 0x113e6(%rip), %rsi     # 0x150f1
movq %rax, %rdi
callq 0x3230
testl %eax, %eax
je 0x3d4b
leaq 0x113d7(%rip), %rsi     # 0x150f5
movq %r12, %rdi
callq 0x3230
testl %eax, %eax
je 0x3d47
movq %rbx, %rdi
callq 0x604b
leaq 0x113c0(%rip), %rsi     # 0x150f9
movq %rbx, %rdi
callq 0x60f6
pushq $0x2
popq %r14
jmp 0x3d82
pushq $0x2
popq %r15
pushq $0x2
popq %rbp
movl %ebp, %edi
movl %r15d, %esi
xorl %edx, %edx
callq 0x3450
movl %eax, (%r14)
cmpl $-0x1, %eax
je 0x3d75
pushq $0x1
popq %r14
movl %eax, %edi
movl %r14d, %esi
callq 0x4243
cmpl $-0x1, %eax
jne 0x3d82
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4204
movl %ebp, %r14d
movl %r14d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: xpio_tqueue
static int xpio_tqueue(lua_State *L)
{
   XPQueue *me = XPIO_NEWOBJECT(L, XPQueue);

   me->pfds = 0;
   me->nfds = 0;

   lua_createtable(L, 2, 0);             // uservalue
   lua_newtable(L);
   lua_rawseti(L, -2, XPQUEUE_READ);     // uservalue[1] = readers
   lua_newtable(L);
   lua_rawseti(L, -2, XPQUEUE_WRITE);    // uservalue[2] = writers
   lua_newtable(L);
   lua_rawseti(L, -2, XPQUEUE_CHILD);    // uservalue[2] = childWaiters
   lua_setuservalue(L, -2);

   return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x11291(%rip), %rdx     # 0x15030
pushq $0x10
popq %rsi
callq 0x428f
andq $0x0, (%rax)
andl $0x0, 0x8(%rax)
pushq $0x2
popq %r15
movq %rbx, %rdi
movl %r15d, %esi
xorl %edx, %edx
callq 0x649a
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x649a
pushq $-0x2
popq %r14
pushq $0x1
popq %rbp
movq %rbx, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x66f2
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x649a
movq %rbx, %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0x66f2
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x649a
pushq $0x3
popq %rdx
movq %rbx, %rdi
movl %r14d, %esi
callq 0x66f2
movq %rbx, %rdi
movl %r14d, %esi
callq 0x6876
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: xpio_fdopen
static int xpio_fdopen(lua_State *L)
{
   XPSocket *ps = xpsocket_new(L);

   // dup() creates a descriptor for the xpsocket to own (and close on
   // finalization). This avoids one xpsocket unpredictably closing a
   // descriptor used by another xpsocket.
   ps->s = dup((int) checkUInt(L, 1));
   if (ps->s == -1) {
      return pushError(L, NULL);
   }
   return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x41ef
movq %rax, %r14
pushq $0x1
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x4369
movl %eax, %edi
callq 0x3180
movl %eax, (%r14)
cmpl $-0x1, %eax
jne 0x3ec4
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4204
pushq $0x2
popq %rbp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: xpio__nextfd
static int xpio__nextfd(lua_State *L)
{
   struct rlimit rl;
   int fd = 0;
   int flags;
   int fdMax = -1;

   fd = tointegerDefault(L, 2, -1) + 1;

   if (fdMax < 0) {
      if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
         return luaL_error(L, "xpio: getrlimit failed");
      }
      // rlim_max is negative in OSX => use rlim_cur ?
      fdMax = rl.rlim_max - 1;
      if (fdMax < 0) {
         fdMax = rl.rlim_cur - 1;
      }
   }

   for (; fd <= fdMax; ++fd) {
      flags = fcntl(fd, F_GETFD);
      if (flags >= 0 && (flags & FD_CLOEXEC) == 0) {
         lua_pushinteger(L, fd);
         return 1;
      }
   }

   lua_pushnil(L);
   return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
pushq $0x2
popq %rsi
callq 0x4491
movl %eax, %ebp
pushq $0x7
popq %rdi
leaq 0x8(%rsp), %rsi
callq 0x33f0
testl %eax, %eax
js 0x41c3
movl 0x8(%rsp), %r15d
movl 0x10(%rsp), %eax
decl %eax
decl %r15d
testl %eax, %eax
cmovnsl %eax, %r15d
pushq $0x1
popq %r14
cmpl %r15d, %ebp
jge 0x41d9
incl %ebp
movl %ebp, %edi
movl %r14d, %esi
xorl %eax, %eax
callq 0x30e0
testl $0x80000001, %eax       # imm = 0x80000001
jne 0x419c
movslq %ebp, %rsi
movq %rbx, %rdi
callq 0x6071
jmp 0x41e1
leaq 0x10fd3(%rip), %rsi     # 0x1519d
movq %rbx, %rdi
xorl %eax, %eax
callq 0x72e8
movl %eax, %r14d
jmp 0x41e1
movq %rbx, %rdi
callq 0x604b
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: setNonBlocking
static int setNonBlocking(int fd, int bOn)
{
   int flagsAdd = 0;
   int flagsRemove = 0;

   if (bOn) {
      flagsAdd = O_NONBLOCK;
   } else {
      flagsRemove = O_NONBLOCK;
   }

   return fcntl_mod_FL(fd, flagsAdd, flagsRemove);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
movl %edi, %ebx
pushq $0x3
popq %rsi
xorl %eax, %eax
callq 0x30e0
cmpl $-0x1, %eax
je 0x4285
xorl %ecx, %ecx
testl %ebp, %ebp
setne %cl
movl %ecx, %edx
shll $0xb, %edx
negl %ecx
orl $0xfffff7ff, %ecx       # imm = 0xFFFFF7FF
andl %ecx, %eax
orl %edx, %eax
pushq $0x4
popq %rsi
movl %ebx, %edi
movl %eax, %edx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x30e0
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: xpio_newObject
static void *xpio_newObject(lua_State *L, size_t size, const char *mtName)
{
   void *pv;

   lua_getfield(L, lua_upvalueindex(1), mtName);
   pv = xlua_newObject(L, -1, size);
   lua_remove(L, -2);

   return pv;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movl $0xfff0b9d7, %esi       # imm = 0xFFF0B9D7
callq 0x6399
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0x5982
movl %eax, %ebp
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6d23
movq %rax, %r14
movq %rbx, %rdi
movl %ebp, %esi
callq 0x5b84
pushq $-0x2
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x67ca
movq %rbx, %rdi
movl %ebp, %esi
callq 0x5a05
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: xpio_pair
static int xpio_pair(lua_State *L, int nPairType)
{
   XPSocket *psA = xpsocket_new(L);
   XPSocket *psB = xpsocket_new(L);
   int spOut[2];
   int n, err;

   if (nPairType == PAIR_PIPE) {
      err = pipe(spOut);
   } else {
      err = socketpair(AF_UNIX, SOCK_STREAM, 0, spOut);
   }

   if (err) {
      return pushError(L, NULL);
   }

   psA->s = spOut[0];
   psB->s = spOut[1];

   for (n = 0; n <= 1; ++n) {
      if (setNonBlocking(spOut[n], 1) == -1) {
         return pushError(L, NULL);
      }
   }

   return 2;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
callq 0x41ef
movq %rax, %r14
movq %rbx, %rdi
callq 0x41ef
movq %rax, %r15
cmpl $0x1, %ebp
jne 0x4315
movq %rsp, %rdi
callq 0x31d0
jmp 0x4324
pushq $0x1
popq %rdi
movq %rsp, %rcx
movl %edi, %esi
xorl %edx, %edx
callq 0x3290
testl %eax, %eax
jne 0x4354
movl (%rsp), %eax
movl %eax, (%r14)
movl 0x4(%rsp), %eax
movl %eax, (%r15)
xorl %r14d, %r14d
pushq $0x1
popq %rbp
cmpq $0x2, %r14
je 0x435e
movl (%rsp,%r14,4), %edi
movl %ebp, %esi
callq 0x4243
incq %r14
cmpl $-0x1, %eax
jne 0x433b
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4204
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: checkUInt
static unsigned checkUInt(lua_State *L, int ndx)
{
   lua_Number num = luaL_checknumber(L, ndx);
   if (! (num >= 0)) {
      return luaL_error(L, "xpio: invalid argument #%d", ndx);
   }
   if (num > UINT_MAX) {
      return UINT_MAX;
   }
   return (unsigned) num;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
callq 0x78e4
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jae 0x439b
leaq 0x10d8f(%rip), %rsi     # 0x15117
movq %r14, %rdi
movl %ebx, %edx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x72e8
ucomisd 0x10c6d(%rip), %xmm0    # 0x15010
jbe 0x43aa
pushq $-0x1
popq %rax
jmp 0x43af
cvttsd2si %xmm0, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: readStringArray
static char **readStringArray(lua_State *L, int ndxArray)
{
   int numStrings = lengthOf(L, ndxArray);
   char **ptrs = (char**) calloc(numStrings + 1, sizeof(char*));
   if (!ptrs) {
      return NULL;
   }

   int offset = 0;
   for (offset = 0; offset < numStrings; ++offset) {
      lua_rawgeti(L, ndxArray, offset+1);
      size_t len;
      const char *pc = lua_tolstring(L, -1, &len);
      ptrs[offset] = pc ? strdup(pc) : NULL;
      lua_pop(L, 1);
      if (! ptrs[offset]) {
         break;
      }
   }

   return ptrs;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
callq 0x44b2
movl %eax, %r15d
leal 0x1(%r15), %eax
movslq %eax, %rdi
pushq $0x8
popq %rsi
callq 0x3220
movq %rax, %r12
testq %rax, %rax
je 0x443b
xorl %ebp, %ebp
testl %r15d, %r15d
cmovlel %ebp, %r15d
cmpq %rbp, %r15
je 0x443b
leal 0x1(%rbp), %edx
movq %r14, %rdi
movl %ebx, %esi
callq 0x641f
movq %r14, %rdi
pushq $-0x1
popq %rsi
movq %rsp, %rdx
callq 0x5ee7
testq %rax, %rax
je 0x4421
movq %rax, %rdi
callq 0x3400
movq %rax, %r13
jmp 0x4424
xorl %r13d, %r13d
movq %r13, (%r12,%rbp,8)
movq %r14, %rdi
pushq $-0x2
popq %rsi
callq 0x59b7
incq %rbp
testq %r13, %r13
jne 0x43ef
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: handleSIGCHLD
static void handleSIGCHLD(int sig)
{
   int n;
   int oldErrno = errno;
   //printf("SIGCHLD!\n");
   do {
      n = write(sigchldPipe[1], "\1", 1);
   } while (n == -1 && errno == EINTR);
   errno = oldErrno;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
callq 0x3060
movq %rax, %rbx
movl (%rax), %ebp
leaq 0x10d36(%rip), %r14     # 0x1519b
pushq $0x1
popq %r15
movl 0x1bdd5(%rip), %edi     # 0x20244
movq %r14, %rsi
movq %r15, %rdx
callq 0x30f0
cmpl $-0x1, %eax
jne 0x4484
cmpl $0x4, (%rbx)
je 0x4469
movl %ebp, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: lengthOf
static int lengthOf(lua_State *L, int ndx)
{
   int len;
   lua_len(L, ndx);
   len = lua_tointeger(L, -1);
   lua_pop(L, 1);
   return len;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x6ce0
pushq $-0x1
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x5e24
movq %rax, %r14
pushq $-0x2
popq %rsi
movq %rbx, %rdi
callq 0x59b7
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: xpproc_dtor
static int xpproc_dtor(lua_State *L)
{
   XPProc *me = XLUA_CAST(L, 1, XPProc);

   // dequeue from global list
   SLL_DEQUEUE(me, gpHeadProc, XPProc, next);

   if (me->pid) {
      (void) kill(me->pid, SIGKILL);
      me->pid = 0;
   }
   return 0;
}

// Assembly:
pushq %rbx
leaq 0x1b3d4(%rip), %rdx     # 0x1f8c0
leaq 0x10b36(%rip), %rcx     # 0x15029
pushq $0x1
popq %rsi
callq 0x465c
movq %rax, %rbx
leaq 0x1bd4b(%rip), %rax     # 0x20250
movq %rax, %rcx
movq (%rax), %rax
testq %rax, %rax
je 0x451b
cmpq %rbx, %rax
jne 0x4505
movq (%rbx), %rax
movq %rax, (%rcx)
movl 0x8(%rbx), %edi
testl %edi, %edi
je 0x452e
pushq $0x9
popq %rsi
callq 0x32a0
andl $0x0, 0x8(%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: xpproc_kill
static int xpproc_kill(lua_State *L)
{
   XPProc *me = XLUA_CAST(L, 1, XPProc);

   if (me->pid <= 0) {
      return pushError(L, "process not running");
   }

   if (kill(me->pid, SIGKILL) == -1) {
      return pushError(L, NULL);
   }

   lua_pushboolean(L, 1);  // success
   return 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x1b380(%rip), %rdx     # 0x1f8c0
leaq 0x10ae2(%rip), %rcx     # 0x15029
pushq $0x1
popq %rbx
movl %ebx, %esi
callq 0x465c
movl 0x8(%rax), %edi
testl %edi, %edi
jle 0x4571
pushq $0x9
popq %rsi
callq 0x32a0
movq %r14, %rdi
cmpl $-0x1, %eax
je 0x457d
movl %ebx, %esi
callq 0x62bd
jmp 0x4587
leaq 0x10c7c(%rip), %rsi     # 0x151f4
movq %r14, %rdi
jmp 0x457f
xorl %esi, %esi
callq 0x4204
pushq $0x2
popq %rbx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: xpproc_try_wait
static int xpproc_try_wait(lua_State *L)
{
   XPProc *me = XLUA_CAST(L, 1, XPProc);

   if (me->pid > 0) {
      lua_pushnil(L);
      lua_pushstring(L, "retry");
      //printf("... try_wait(%d) --> retry\n", me->pid);
      return 2;
   }

   //printf("... try_wait() --> %x\n", me->status);
   if (WIFEXITED(me->status)) {
      lua_pushstring(L, "exit");
      lua_pushinteger(L, WEXITSTATUS(me->status));
      return 2;
   } else if (WIFSIGNALED(me->status)) {
      lua_pushstring(L, "signal");
      lua_pushinteger(L, WSTOPSIG(me->status));
      return 2;
   } else {
      // exit status not ready
      return pushError(L, "retry");
   }

   // should not happen
   return pushError(L, "xpio: unexpected waitpid() result");
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1b321(%rip), %rdx     # 0x1f8c0
leaq 0x10a83(%rip), %rcx     # 0x15029
pushq $0x1
popq %rsi
callq 0x465c
cmpl $0x0, 0x8(%rax)
jle 0x45cd
movq %rbx, %rdi
callq 0x604b
leaq 0x10c45(%rip), %rsi     # 0x15208
movq %rbx, %rdi
callq 0x60f6
jmp 0x461d
movq %rax, %r14
movl 0xc(%rax), %eax
andl $0x7f, %eax
je 0x45f0
shll $0x18, %eax
addl $0x1000000, %eax        # imm = 0x1000000
cmpl $0x2000000, %eax        # imm = 0x2000000
jl 0x460e
leaq 0x10c25(%rip), %rsi     # 0x15213
jmp 0x45f7
leaq 0x10c17(%rip), %rsi     # 0x1520e
movq %rbx, %rdi
callq 0x60f6
movzbl 0xd(%r14), %esi
movq %rbx, %rdi
callq 0x6071
jmp 0x461d
leaq 0x10bf3(%rip), %rsi     # 0x15208
movq %rbx, %rdi
callq 0x4204
pushq $0x2
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xlua.h
// Function: xlua_checkudata
static inline void*
xlua_checkudata(lua_State *L,
              int narg,
              const luaL_Reg *regs,
              const char *typeName)
{
   // if REGISTRY[getmetatable(udata)] == regs then
   //    return touserdata(udata)
   // else
   //    error(...)
   // end

   void *me = lua_touserdata(L, narg);

   if (me != NULL && lua_getmetatable(L, narg)) {
      lua_rawget(L, LUA_REGISTRYINDEX);
      void *tptr = lua_touserdata(L, -1);
      lua_pop(L, 1);
      if ((const void *)tptr == (const void*) regs) {
         return me;
      }
   }

   const char *msg = lua_pushfstring(L, "%s object expected, got %s",
                                     typeName, luaL_typename(L, narg));
   (void) luaL_argerror(L, narg, msg);
   return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdx, %r13
movl %esi, %ebx
movq %rdi, %r14
callq 0x5fb7
testq %rax, %rax
je 0x46b8
movq %rax, %r12
movq %r14, %rdi
movl %ebx, %esi
callq 0x64f9
testl %eax, %eax
je 0x46b8
movq %r14, %rdi
movl $0xfff0b9d8, %esi       # imm = 0xFFF0B9D8
callq 0x63f3
pushq $-0x1
popq %rsi
movq %r14, %rdi
callq 0x5fb7
movq %rax, %rbp
pushq $-0x2
popq %rsi
movq %r14, %rdi
callq 0x59b7
cmpq %r13, %rbp
je 0x46f3
movq %r14, %rdi
movl %ebx, %esi
callq 0x5ba4
movq %r14, %rdi
movl %eax, %esi
callq 0x5bc3
leaq 0x10b06(%rip), %rsi     # 0x151d9
xorl %r12d, %r12d
movq %r14, %rdi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x618d
movq %r14, %rdi
movl %ebx, %esi
movq %rax, %rdx
callq 0x7204
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: xpqueue_enqueue
static int xpqueue_enqueue(lua_State *L, int ndxTask, int ndxKey, int mode)
{
   ndxTask = lua_absindex(L, ndxTask);
   ndxKey = lua_absindex(L, ndxKey);

   // assert(not task._dequeue)
   lua_getfield(L, ndxTask, "_dequeue");
   if (!lua_isnil(L, -1)) {
      luaL_error(L, "xpio: task scheduled twice");
   }

   // readers/writers/childWaiters[key] = task

   xpqueue_tableFromTask(L, ndxTask, mode);
   lua_pushvalue(L, ndxKey);   // key
   lua_pushvalue(L, ndxTask);  // value
   lua_rawset(L, -3);

   // task.dequeue = xpqueue_dequeue[R/W/C]

   lua_pushcfunction(L, (mode == XPQUEUE_READ ? xpqueue_dequeueR :
                         mode == XPQUEUE_WRITE ? xpqueue_dequeueW :
                         xpqueue_dequeueC));
   lua_setfield(L, ndxTask, "_dequeue");

   // task._dequeuedata = key

   lua_pushvalue(L, ndxKey);
   lua_setfield(L, ndxTask, "_dequeuedata");

   // leave 4 items on the stack
   return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r15d
movl %esi, %r14d
movq %rdi, %rbx
pushq $0x2
popq %rsi
callq 0x5982
movl %eax, %ebp
movq %rbx, %rdi
movl %r14d, %esi
callq 0x5982
movl %eax, %r14d
leaq 0x10ae6(%rip), %rdx     # 0x1521a
movq %rbx, %rdi
movl %ebp, %esi
callq 0x6399
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0x5ba4
testl %eax, %eax
je 0x475e
leaq 0x10acf(%rip), %rsi     # 0x15223
movq %rbx, %rdi
xorl %eax, %eax
callq 0x72e8
movq %rbx, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x47f1
movq %rbx, %rdi
movl %r14d, %esi
callq 0x5b84
movq %rbx, %rdi
movl %ebp, %esi
callq 0x5b84
pushq $-0x3
popq %rsi
movq %rbx, %rdi
callq 0x6683
cmpl $0x2, %r15d
leaq 0xb2(%rip), %rax        # 0x4848
leaq 0xb8(%rip), %rcx        # 0x4855
cmoveq %rax, %rcx
cmpl $0x1, %r15d
leaq 0x8f(%rip), %rsi        # 0x483b
cmovneq %rcx, %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x623a
leaq 0x10a59(%rip), %rdx     # 0x1521a
movq %rbx, %rdi
movl %ebp, %esi
callq 0x661d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x5b84
leaq 0x10a61(%rip), %rdx     # 0x1523e
movq %rbx, %rdi
movl %ebp, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x661d
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: xpqueue_tableFromTask
static void xpqueue_tableFromTask(lua_State *L, int ndxTask, int mode)
{
   lua_getfield(L, ndxTask, "_queue");  // task.tqueue
   (void) XLUA_CAST(L, -1, XPQueue);    // validate queue
   lua_getuservalue(L, -1);
   lua_rawgeti(L, -1, mode);            // readers/writers
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebx
movq %rdi, %r14
leaq 0x10a4a(%rip), %rdx     # 0x1524b
callq 0x6399
leaq 0x1b103(%rip), %rdx     # 0x1f910
leaq 0x1081d(%rip), %rcx     # 0x15031
pushq $-0x1
popq %rbp
movq %r14, %rdi
movl %ebp, %esi
callq 0x465c
movq %r14, %rdi
movl %ebp, %esi
callq 0x654e
movq %r14, %rdi
movl %ebp, %esi
movl %ebx, %edx
popq %rbx
popq %r14
popq %rbp
jmp 0x641f
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: xpqueue_dequeue
static int xpqueue_dequeue(lua_State *L, int mode)
{
   xpqueue_tableFromTask(L, 1, mode);
   lua_getfield(L, 1, "_dequeuedata");  // key = fd
   lua_pushnil(L);                      // value = nil
   lua_rawset(L, -3);                   // readers/writers[fd] = nil

   lua_pushnil(L);
   lua_setfield(L, 1, "_dequeue");      // task.dequeue = nil
   return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %edx
movq %rdi, %rbx
pushq $0x1
popq %rbp
movl %ebp, %esi
callq 0x47f1
leaq 0x109c3(%rip), %rdx     # 0x1523e
movq %rbx, %rdi
movl %ebp, %esi
callq 0x6399
movq %rbx, %rdi
callq 0x604b
pushq $-0x3
popq %rsi
movq %rbx, %rdi
callq 0x6683
movq %rbx, %rdi
callq 0x604b
leaq 0x10973(%rip), %rdx     # 0x1521a
movq %rbx, %rdi
movl %ebp, %esi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x661d
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: xpqueue_dtor
static int xpqueue_dtor(lua_State *L)
{
   XPQueue *me = XLUA_CAST(L, 1, XPQueue);
   if (me->pfds) {
      free(me->pfds);
      me->pfds = NULL;
      me->nfds = 0;
   }
   return 0;
}

// Assembly:
pushq %rbx
leaq 0x1b051(%rip), %rdx     # 0x1f910
leaq 0x1076b(%rip), %rcx     # 0x15031
pushq $0x1
popq %rsi
callq 0x465c
movq (%rax), %rdi
testq %rdi, %rdi
je 0x48e6
movq %rax, %rbx
callq 0x3040
andq $0x0, (%rbx)
andl $0x0, 0x8(%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: xpqueue_isEmpty
static int xpqueue_isEmpty(lua_State *L)
{
   int mode;
   int isEmpty = 1;

   lua_getuservalue(L, 1);

   for (mode = 1; mode <= 3; ++mode) {
      lua_rawgeti(L, -1, mode);
      lua_pushnil(L);
      if (lua_next(L, -2) != 0) {
         isEmpty = 0;
         break;
      }
      lua_pop(L, 1);
   }

   lua_pushboolean(L, isEmpty);
   return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
pushq $0x1
popq %rbp
movl %ebp, %esi
callq 0x654e
pushq $-0x1
popq %r14
pushq $-0x2
popq %r15
movl %ebp, %r12d
cmpl $0x4, %r12d
je 0x4df4
movq %rbx, %rdi
movl %r14d, %esi
movl %r12d, %edx
callq 0x641f
movq %rbx, %rdi
callq 0x604b
movq %rbx, %rdi
movl %r15d, %esi
callq 0x6c49
testl %eax, %eax
jne 0x4df2
movq %rbx, %rdi
movl %r15d, %esi
callq 0x59b7
incl %r12d
jmp 0x4db7
xorl %ebp, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x62bd
pushq $0x1
popq %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: XPQueue_wakeChildWaiters
static int
XPQueue_wakeChildWaiters(XPQueue *me, lua_State *L, int ndxReady, int ndxWaiters)
{
   int nTop = lua_gettop(L);
   int numReady = lengthOf(L, ndxReady);
   int numWaiting = 0;

   ndxReady = lua_absindex(L, ndxReady);
   ndxWaiters = lua_absindex(L, ndxWaiters);

   // enumerate waiters (process -> task)
   lua_pushvalue(L, ndxWaiters);
   for (lua_pushnil(L); lua_next(L, -2) != 0; lua_pop(L, 1)) {
      // xpproc is at -2;  task is at -1

      if (xpproc_isExited(L, -2)) {
         // put task in ready[]
         lua_pushvalue(L, -1);
         lua_rawseti(L, ndxReady, ++numReady);

         // mark task as not pending
         lua_pushnil(L);
         lua_setfield(L, -2, "_dequeue");

         // remove task from childWaiters
         lua_pushvalue(L, -2);
         lua_pushnil(L);
         lua_rawset(L, ndxWaiters);
      } else {
         ++numWaiting;
      }
      //printf("... wcw loop: %d, %d\n", numReady, numWaiting);
   }

   //printf("wakeChildWaiters: numWaiting=%d numReady=%d\n", numWaiting, numReady);

   {
      //int cnt = 0;
      lua_pushvalue(L, ndxWaiters);
      for (lua_pushnil(L); lua_next(L, -2) != 0; lua_pop(L, 1)) {
         //++cnt;
      }
      //printf("wakeChildWaiters: %d waiters left\n", cnt);
   }

   lua_settop(L, nTop);
   return numWaiting;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
callq 0x59a3
movl %eax, 0x10(%rsp)
pushq $-0x1
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x44b2
movl %eax, %r12d
movq %rbx, %rdi
movl %ebp, %esi
callq 0x5982
movl %eax, 0x14(%rsp)
pushq $-0x2
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x5982
movq %rbx, %rdi
movl %eax, 0xc(%rsp)
movl %eax, %esi
callq 0x5b84
movq %rbx, %rdi
callq 0x604b
xorl %r14d, %r14d
leaq 0x1a982(%rip), %r13     # 0x1f8c0
leaq 0x100e4(%rip), %r15     # 0x15029
movq %rbx, %rdi
movl %ebp, %esi
callq 0x6c49
movq %rbx, %rdi
testl %eax, %eax
je 0x4fd1
movl %ebp, %esi
movq %r13, %rdx
movq %r15, %rcx
callq 0x465c
cmpl $0x0, 0x8(%rax)
je 0x4f6e
incl %r14d
jmp 0x4fc2
movq %rbx, %rdi
pushq $-0x1
popq %rsi
callq 0x5b84
incl %r12d
movq %rbx, %rdi
movl 0x14(%rsp), %esi
movl %r12d, %edx
callq 0x66f2
movq %rbx, %rdi
callq 0x604b
movq %rbx, %rdi
movl %ebp, %esi
leaq 0x1027b(%rip), %rdx     # 0x1521a
callq 0x661d
movq %rbx, %rdi
movl %ebp, %esi
callq 0x5b84
movq %rbx, %rdi
callq 0x604b
movq %rbx, %rdi
movl 0xc(%rsp), %esi
callq 0x6683
movq %rbx, %rdi
movl %ebp, %esi
callq 0x59b7
jmp 0x4f45
movl 0xc(%rsp), %esi
callq 0x5b84
movq %rbx, %rdi
callq 0x604b
pushq $-0x2
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x6c49
testl %eax, %eax
je 0x4fff
movq %rbx, %rdi
movl %ebp, %esi
callq 0x59b7
jmp 0x4fe5
movq %rbx, %rdi
movl 0x10(%rsp), %esi
callq 0x59b7
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: xpsocket_dtor
static int xpsocket_dtor(lua_State *L)
{
   XPSocket *me = XLUA_CAST(L, 1, XPSocket);

   if (me->s) {
      close(me->s);
      me->s = -1;
   }
   return 0;
}

// Assembly:
pushq %rbx
leaq 0x1a92b(%rip), %rdx     # 0x1f950
leaq 0x10019(%rip), %rcx     # 0x15045
pushq $0x1
popq %rsi
callq 0x465c
movl (%rax), %edi
testl %edi, %edi
je 0x5045
movq %rax, %rbx
callq 0x31c0
orl $-0x1, (%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: xpsocket_try_connect
static int xpsocket_try_connect(lua_State *L)
{
   XPSocket *me = XLUA_CAST(L, 1, XPSocket);
   const char *addr = luaL_checkstring(L, 2);
   struct sockaddr_in sin;
   int e;

   if (addrFromString(&sin, addr)) {
      return pushError(L, "xpio: mal-formed address");
   }
   e = connect(me->s, (struct sockaddr *)&sin, sizeof sin);

   // POSIX fail: Asynchronous connect oddness.  Instead of EAGAIN or
   // EWOULDBLOCK, we may get either EINPROGRESS or EALREADY to indicate
   // "try again later". Finally, success is indicated by another error code
   // EISCONN. Spec is unclear on whether an actual success result (return
   // value of 0) is possible, and on what the state of the sockaddr must be
   // on calls other than the first.

   if (e && errno != EISCONN) {
      return pushError(L, (isRetry(errno) ? "retry" : NULL));
   }

   lua_pushboolean(L, 1);   // success
   return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x1a8f3(%rip), %rdx     # 0x1f950
leaq 0xffe1(%rip), %rcx      # 0x15045
pushq $0x1
popq %r14
movl %r14d, %esi
callq 0x465c
movq %rax, %r15
pushq $0x2
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0x77e4
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x3c1b
testl %eax, %eax
je 0x50a7
leaq 0x10273(%rip), %rsi     # 0x1530d
movq %rbx, %rdi
callq 0x4204
movl %ebp, %r14d
jmp 0x50d2
movl (%r15), %edi
leaq 0x8(%rsp), %rsi
pushq $0x10
popq %rdx
callq 0x33d0
testl %eax, %eax
je 0x50c7
callq 0x3060
movl (%rax), %edi
cmpl $0x6a, %edi
jne 0x50e0
movq %rbx, %rdi
movl %r14d, %esi
callq 0x62bd
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x57bf
xorl %esi, %esi
testl %eax, %eax
leaq 0x10118(%rip), %rax     # 0x15208
cmovneq %rax, %rsi
jmp 0x509a
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: xpsocket_try_read
static int xpsocket_try_read(lua_State *L)
{
   XPSocket *me = XLUA_CAST(L, 1, XPSocket);
   size_t size = checkUInt(L, 2);
   luaL_Buffer b;
   int n;

   if (size == 0) {
      // POSIX fail: reading zero bytes may or may not test for error
      //   conditions on the socket (depending on implementation).  Here we
      //   avoid potential portability issues.
      lua_pushinteger(L, 0);
      return 1;
   }

   char *pbuf = luaL_buffinitsize(L, &b, size);

   n = read(me->s, pbuf, size);
   if (n >= (size ? 1 : 0)) {
      // success
      luaL_pushresultsize(&b, n);
      return 1;
   } else if (n == 0) {
      // end of stream
      lua_pushnil(L);
      return 1;
   } if (isRetry(errno)) {
      // wait for more
      return pushError(L, "retry");
   } else {
      // actual error
      return pushError(L, NULL);
   }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x2020, %rsp           # imm = 0x2020
movq %rdi, %r14
leaq 0x1a841(%rip), %rdx     # 0x1f950
leaq 0xff2f(%rip), %rcx      # 0x15045
pushq $0x1
popq %rbx
movl %ebx, %esi
callq 0x465c
movq %rax, %r15
pushq $0x2
popq %rbp
movq %r14, %rdi
movl %ebp, %esi
callq 0x4369
testl %eax, %eax
je 0x5169
movl %eax, %r12d
movq %rsp, %rsi
movq %r14, %rdi
movq %r12, %rdx
callq 0x7bf0
movl (%r15), %edi
movq %rax, %rsi
movq %r12, %rdx
callq 0x31e0
testl %eax, %eax
jle 0x5175
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %rsp, %rdi
movq %rax, %rsi
callq 0x7b6b
jmp 0x51a9
movq %r14, %rdi
xorl %esi, %esi
callq 0x6071
jmp 0x51a9
je 0x5193
callq 0x3060
movl (%rax), %edi
callq 0x57bf
testl %eax, %eax
je 0x519d
leaq 0x1007a(%rip), %rsi     # 0x15208
movq %r14, %rdi
jmp 0x51a2
movq %r14, %rdi
callq 0x604b
jmp 0x51a9
movq %r14, %rdi
xorl %esi, %esi
callq 0x4204
movl %ebp, %ebx
movl %ebx, %eax
addq $0x2020, %rsp           # imm = 0x2020
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/monoglot/./xpio_c.c
// Function: xpsocket_try_write
static int xpsocket_try_write(lua_State *L)
{
   XPSocket *me = XLUA_CAST(L, 1, XPSocket);
   const char *data = luaL_checkstring(L, 2);
   int n;

   n = write(me->s, data, lua_rawlen(L, 2));
   if (n < 0) {
      return pushError(L, isRetry(errno) ? "retry" : NULL);
   }

   lua_pushinteger(L, n);
   return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x1a783(%rip), %rdx     # 0x1f950
leaq 0xfe71(%rip), %rcx      # 0x15045
pushq $0x1
popq %r14
movl %r14d, %esi
callq 0x465c
movq %rax, %r15
pushq $0x2
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0x77e4
movq %rax, %r12
movl (%r15), %r15d
movq %rbx, %rdi
movl %ebp, %esi
callq 0x5f57
movl %r15d, %edi
movq %r12, %rsi
movq %rax, %rdx
callq 0x30f0
testl %eax, %eax
js 0x5229
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6071
movl %r14d, %ebp
jmp 0x524c
callq 0x3060
movl (%rax), %edi
callq 0x57bf
xorl %esi, %esi
testl %eax, %eax
leaq 0xffc8(%rip), %rax      # 0x15208
cmovneq %rax, %rsi
movq %rbx, %rdi
callq 0x4204
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq