LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/zenkj[P]luajit-arm64/src/host/minilua.c
// Function: singlematch
static int singlematch(int c,const char*p,const char*ep){
switch(*p){
case'.':return 1;
case'%':return match_class(c,uchar(*(p+1)));
case'[':return matchbracketclass(c,p,ep-1);
default:return(uchar(*p)==c);
}
}

// Assembly:
movzbl (%rsi), %ecx
cmpl $0x5b, %ecx
je 0x1106e
cmpl $0x2e, %ecx
je 0x1106a
cmpl $0x25, %ecx
jne 0x11076
movzbl 0x1(%rsi), %esi
jmp 0x110f3
pushq $0x1
popq %rax
retq
decq %rdx
jmp 0x10fce
xorl %eax, %eax
cmpl %edi, %ecx
sete %al
retq
// File: /workspace/github_c_makefile_star2_O2/zenkj[P]luajit-arm64/src/host/minilua.c
// Function: max_expand
static const char*max_expand(MatchState*ms,const char*s,
const char*p,const char*ep){
ptrdiff_t i=0;
while((s+i)<ms->src_end&&singlematch(uchar(*(s+i)),p,ep))
i++;
while(i>=0){
const char*res=match(ms,(s+i),ep+1);
if(res)return res;
i--;
}
return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %r15
movq 0x8(%rdi), %rbp
xorl %r13d, %r13d
leaq (%r14,%r13), %rax
cmpq %rbp, %rax
jae 0x110bc
movzbl (%rax), %edi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x1104f
testl %eax, %eax
je 0x110bc
incq %r13
jmp 0x1109c
incq %rbx
xorl %r12d, %r12d
testq %r13, %r13
js 0x110e1
leaq (%r14,%r13), %rsi
movq %r15, %rdi
movq %rbx, %rdx
callq 0x10afa
decq %r13
testq %rax, %rax
je 0x110c2
movq %rax, %r12
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/zenkj[P]luajit-arm64/src/host/minilua.c
// Function: match_class
static int match_class(int c,int cl){
int res;
switch(tolower(cl)){
case'a':res=isalpha(c);break;
case'c':res=iscntrl(c);break;
case'd':res=isdigit(c);break;
case'l':res=islower(c);break;
case'p':res=ispunct(c);break;
case's':res=isspace(c);break;
case'u':res=isupper(c);break;
case'w':res=isalnum(c);break;
case'x':res=isxdigit(c);break;
case'z':res=(c==0);break;
default:return(cl==c);
}
return(islower(cl)?res:!res);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movl %edi, %ebp
movl %esi, %edi
callq 0x31b0
leal -0x6c(%rax), %ecx
cmpl $0xe, %ecx
ja 0x11135
leaq 0x12ef(%rip), %rax      # 0x12400
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
callq 0x32e0
movq (%rax), %rcx
movl %ebp, %edx
movzwl (%rcx,%rdx,2), %r14d
andl $0x200, %r14d           # imm = 0x200
jmp 0x11226
cmpl $0x64, %eax
je 0x11210
cmpl $0x63, %eax
je 0x111fb
cmpl $0x61, %eax
jne 0x11167
callq 0x32e0
movq (%rax), %rcx
movl %ebp, %edx
movzwl (%rcx,%rdx,2), %r14d
andl $0x400, %r14d           # imm = 0x400
jmp 0x11226
xorl %eax, %eax
cmpl %ebp, %ebx
sete %al
jmp 0x1123c
callq 0x32e0
movq (%rax), %rcx
movl %ebp, %edx
movzwl (%rcx,%rdx,2), %r14d
andl $0x2000, %r14d          # imm = 0x2000
jmp 0x11226
callq 0x32e0
movq (%rax), %rcx
movl %ebp, %edx
movzwl (%rcx,%rdx,2), %r14d
andl $0x4, %r14d
jmp 0x11226
xorl %r14d, %r14d
testl %ebp, %ebp
sete %r14b
callq 0x32e0
jmp 0x11226
callq 0x32e0
movq (%rax), %rcx
movl %ebp, %edx
movzwl (%rcx,%rdx,2), %r14d
andl $0x1000, %r14d          # imm = 0x1000
jmp 0x11226
callq 0x32e0
movq (%rax), %rcx
movl %ebp, %edx
movzwl (%rcx,%rdx,2), %r14d
andl $0x100, %r14d           # imm = 0x100
jmp 0x11226
callq 0x32e0
movq (%rax), %rcx
movl %ebp, %edx
movzwl (%rcx,%rdx,2), %r14d
andl $0x8, %r14d
jmp 0x11226
callq 0x32e0
movq (%rax), %rcx
movl %ebp, %edx
movzwl (%rcx,%rdx,2), %r14d
andl $0x2, %r14d
jmp 0x11226
callq 0x32e0
movq (%rax), %rcx
movl %ebp, %edx
movzwl (%rcx,%rdx,2), %r14d
andl $0x800, %r14d           # imm = 0x800
movq (%rax), %rcx
movl %ebx, %edx
xorl %eax, %eax
testl %r14d, %r14d
sete %al
testb $0x2, 0x1(%rcx,%rdx,2)
cmovnel %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/zenkj[P]luajit-arm64/src/host/minilua.c
// Function: push_onecapture
static void push_onecapture(MatchState*ms,int i,const char*s,
const char*e){
if(i>=ms->level){
if(i==0)
lua_pushlstring(ms->L,s,e-s);
else
luaL_error(ms->L,"invalid capture index");
}
else{
ptrdiff_t l=ms->capture[i].len;
if(l==(-1))luaL_error(ms->L,"unfinished capture");
if(l==(-2))
lua_pushinteger(ms->L,ms->capture[i].init-ms->src_init+1);
else
lua_pushlstring(ms->L,ms->capture[i].init,l);
}
}

// Assembly:
pushq %rax
movq %rdi, %rax
cmpl %esi, 0x18(%rdi)
jle 0x11271
movslq %esi, %rcx
shlq $0x4, %rcx
addq %rax, %rcx
addq $0x20, %rcx
movq 0x8(%rcx), %rdx
movq 0x10(%rax), %rdi
cmpq $-0x2, %rdx
je 0x11288
cmpq $-0x1, %rdx
je 0x112b5
movq (%rcx), %rsi
jmp 0x11282
movq 0x10(%rax), %rdi
testl %esi, %esi
jne 0x112ac
subq %rdx, %rcx
movq %rdx, %rsi
movq %rcx, %rdx
popq %rax
jmp 0x8937
movq (%rcx), %rcx
subq (%rax), %rcx
incq %rcx
movq 0x10(%rdi), %rax
cvtsi2sd %rcx, %xmm0
movsd %xmm0, (%rax)
movl $0x3, 0x8(%rax)
addq $0x10, 0x10(%rdi)
popq %rax
retq
leaq 0x1edd(%rip), %rsi      # 0x13190
jmp 0x112bc
leaq 0x1eea(%rip), %rsi      # 0x131a6
xorl %eax, %eax
callq 0x9546
// File: /workspace/github_c_makefile_star2_O2/zenkj[P]luajit-arm64/src/host/minilua.c
// Function: luaL_checknumber
static lua_Number luaL_checknumber(lua_State*L,int narg){
lua_Number d=lua_tonumber(L,narg);
if(d==0&&!lua_isnumber(L,narg))
tag_error(L,narg,3);
return d;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
callq 0xe1c4
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x112f5
jp 0x112f5
movq %r14, %rdi
movl %ebx, %esi
movsd %xmm0, (%rsp)
callq 0x9d18
movsd (%rsp), %xmm0
testl %eax, %eax
je 0x112fd
addq $0x8, %rsp
popq %rbx
popq %r14
retq
pushq $0x3
popq %rdx
movq %r14, %rdi
movl %ebx, %esi
callq 0x9bbf
// File: /workspace/github_c_makefile_star2_O2/zenkj[P]luajit-arm64/src/host/minilua.c
// Function: addintlen
static void addintlen(char*form){
size_t l=strlen(form);
char spec=form[l-1];
strcpy(form+l-1,"l");
form[l+sizeof("l")-2]=spec;
form[l+sizeof("l")-1]='\0';
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x30e0
movb -0x1(%rbx,%rax), %cl
movw $0x6c, -0x1(%rbx,%rax)
movb %cl, (%rbx,%rax)
movb $0x0, 0x1(%rbx,%rax)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/zenkj[P]luajit-arm64/src/host/minilua.c
// Function: gmatch_aux
static int gmatch_aux(lua_State*L){
MatchState ms;
size_t ls;
const char*s=lua_tolstring(L,lua_upvalueindex(1),&ls);
const char*p=lua_tostring(L,lua_upvalueindex(2));
const char*src;
ms.L=L;
ms.src_init=s;
ms.src_end=s+ls;
for(src=s+(size_t)lua_tointeger(L,lua_upvalueindex(3));
src<=ms.src_end;
src++){
const char*e;
ms.level=0;
if((e=match(&ms,src,p))!=NULL){
lua_Integer newstart=e-s;
if(e==src)newstart++;
lua_pushinteger(L,newstart);
lua_replace(L,lua_upvalueindex(3));
return push_captures(&ms,src,e);
}
}
return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rdi, %rbx
movq %rsp, %r14
movl $0xffffd8ed, %esi       # imm = 0xFFFFD8ED
movq %r14, %rdx
callq 0x3b4c
movq %rax, %r15
movq %rbx, %rdi
movl $0xffffd8ec, %esi       # imm = 0xFFFFD8EC
xorl %edx, %edx
callq 0x3b4c
movq %rax, %r13
leaq 0x8(%rsp), %rbp
movq %rbx, 0x10(%rbp)
movq %r15, (%rbp)
movq (%r14), %r14
addq %r15, %r14
movq %r14, 0x8(%rbp)
movq %rbx, %rdi
movl $0xffffd8eb, %esi       # imm = 0xFFFFD8EB
callq 0x9ce9
movq %rax, %r12
addq %r15, %r12
cmpq %r14, %r12
ja 0x113b2
andl $0x0, 0x20(%rsp)
movq %rbp, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x10afa
testq %rax, %rax
jne 0x113b6
incq %r12
movq 0x10(%rsp), %r14
jmp 0x1138b
xorl %eax, %eax
jmp 0x113fd
movq %rax, %r14
subq %r15, %rax
xorl %ecx, %ecx
cmpq %r14, %r12
sete %cl
addq %rax, %rcx
movq 0x10(%rbx), %rax
cvtsi2sd %rcx, %xmm0
movsd %xmm0, (%rax)
movl $0x3, 0x8(%rax)
addq $0x10, 0x10(%rbx)
movq %rbx, %rdi
movl $0xffffd8eb, %esi       # imm = 0xFFFFD8EB
callq 0xeda5
leaq 0x8(%rsp), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x10e94
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/zenkj[P]luajit-arm64/src/host/minilua.c
// Function: luaL_findtable
static const char*luaL_findtable(lua_State*L,int idx,
const char*fname,int szhint){
const char*e;
lua_pushvalue(L,idx);
do{
e=strchr(fname,'.');
if(e==NULL)e=fname+strlen(fname);
lua_pushlstring(L,fname,e-fname);
lua_rawget(L,-2);
if(lua_isnil(L,-1)){
lua_pop(L,1);
lua_createtable(L,0,(*e=='.'?1:szhint));
lua_pushlstring(L,fname,e-fname);
lua_pushvalue(L,-2);
lua_settable(L,-4);
}
else if(!lua_istable(L,-1)){
lua_pop(L,2);
return fname;
}
lua_remove(L,-2);
fname=e+1;
}while(*e=='.');
return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, 0x4(%rsp)
movq %rdx, %r13
movq %rdi, %r14
callq 0x8917
pushq $-0x2
popq %r15
pushq $-0x1
popq %r12
movq %r13, %rdi
pushq $0x2e
popq %rsi
callq 0x30f0
movq %rax, %rbp
testq %rax, %rax
jne 0x11452
movq %r13, %rdi
callq 0x30e0
movq %rax, %rbp
addq %r13, %rbp
movq %rbp, %rbx
subq %r13, %rbx
movq %r14, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x8937
movq %r14, %rdi
movl %r15d, %esi
callq 0xe19c
movq %r14, %rdi
movl %r12d, %esi
callq 0x965e
testl %eax, %eax
je 0x11492
movq %r14, %rdi
movl %r12d, %esi
callq 0x965e
cmpl $0x5, %eax
je 0x114e2
jmp 0x11500
addq $-0x10, 0x10(%r14)
cmpb $0x2e, (%rbp)
pushq $0x1
popq %rsi
je 0x114a4
movl 0x4(%rsp), %esi
movq %r14, %rdi
callq 0x37dc
movq %r14, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x8937
movq %r14, %rdi
movl %r15d, %esi
callq 0x8917
movq 0x10(%r14), %rcx
leaq -0x40(%rcx), %rsi
leaq -0x20(%rcx), %rdx
addq $-0x10, %rcx
movq %r14, %rdi
callq 0x6c84
addq $-0x20, 0x10(%r14)
movq %r14, %rdi
movl %r15d, %esi
callq 0xe2cd
leaq 0x1(%rbp), %r13
cmpb $0x2e, (%rbp)
je 0x11431
xorl %r13d, %r13d
jmp 0x11505
addq $-0x20, 0x10(%r14)
movq %r13, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/zenkj[P]luajit-arm64/src/host/minilua.c
// Function: tohex
static int tohex(lua_State*L){
UB b=barg(L,1);
int n=lua_isnone(L,2)?8:(int)barg(L,2);
const char*hexdigits="0123456789abcdef";
char buf[8];
int i;
if(n<0){n=-n;hexdigits="0123456789ABCDEF";}
if(n>8)n=8;
for(i=(int)n;--i>=0;){buf[i]=hexdigits[b&15];b>>=4;}
lua_pushlstring(L,buf,(size_t)n);
return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
pushq $0x1
popq %rsi
callq 0x118a7
movl %eax, %ebp
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x965e
pushq $0x8
popq %r14
cmpl $-0x1, %eax
je 0x1184b
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x118a7
testl %eax, %eax
leaq 0x1aa7(%rip), %rdx      # 0x132e5
leaq 0x1a8f(%rip), %rcx      # 0x132d4
cmovsq %rdx, %rcx
jmp 0x11855
leaq 0x1a82(%rip), %rcx      # 0x132d4
movl %r14d, %eax
movl %eax, %edx
negl %edx
cmovsl %eax, %edx
cmpl $0x8, %edx
cmovgel %r14d, %edx
testl %edx, %edx
jle 0x1187d
movl %ebp, %esi
andl $0xf, %esi
movb (%rcx,%rsi), %sil
movb %sil, 0x7(%rsp,%rdx)
decq %rdx
shrl $0x4, %ebp
jmp 0x11863
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
cmpl $0x8, %ecx
cmovbl %ecx, %r14d
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x8937
pushq $0x1
popq %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/zenkj[P]luajit-arm64/src/host/minilua.c
// Function: barg
static UB barg(lua_State*L,int idx){
union{lua_Number n;U64 b;}bn;
bn.n=lua_tonumber(L,idx)+6755399441055744.0;
if(bn.n==0.0&&!lua_isnumber(L,idx))luaL_typerror(L,idx,"number");
return(UB)bn.b;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
callq 0xe1c4
addsd 0xd43(%rip), %xmm0      # 0x12600
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x118e1
jp 0x118e1
movq %r14, %rdi
movl %ebx, %esi
movsd %xmm0, (%rsp)
callq 0x9d18
movsd (%rsp), %xmm0
testl %eax, %eax
je 0x118ee
movq %xmm0, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0xe34(%rip), %rdx       # 0x12729
movq %r14, %rdi
movl %ebx, %esi
callq 0x9be1
// File: /workspace/github_c_makefile_star2_O2/zenkj[P]luajit-arm64/src/host/minilua.c
// Function: errfile
static int errfile(lua_State*L,const char*what,int fnameindex){
const char*serr=strerror(errno);
const char*filename=lua_tostring(L,fnameindex)+1;
lua_pushfstring(L,"cannot %s %s: %s",what,filename,serr);
lua_remove(L,fnameindex);
return(5+1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
callq 0x3050
movl (%rax), %edi
callq 0x32b0
movq %rax, %r12
movq %r14, %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0x3b4c
leaq 0x1(%rax), %rcx
leaq 0x19d6(%rip), %rsi      # 0x1330b
movq %r14, %rdi
movq %r15, %rdx
movq %r12, %r8
xorl %eax, %eax
callq 0x9ae7
movq %r14, %rdi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xe2cd
// File: /workspace/github_c_makefile_star2_O2/zenkj[P]luajit-arm64/src/host/minilua.c
// Function: getF
static const char*getF(lua_State*L,void*ud,size_t*size){
LoadF*lf=(LoadF*)ud;
(void)L;
if(lf->extraline){
lf->extraline=0;
*size=1;
return"\n";
}
if(feof(lf->f))return NULL;
*size=fread(lf->buff,1,sizeof(lf->buff),lf->f);
return(*size>0)?lf->buff:NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
cmpl $0x0, (%rsi)
je 0x1197c
andl $0x0, (%rbx)
movq $0x1, (%r14)
leaq 0xfa8(%rip), %rbx       # 0x12922
jmp 0x119af
movq 0x8(%rbx), %rdi
callq 0x3180
testl %eax, %eax
je 0x1198d
xorl %ebx, %ebx
jmp 0x119af
movq 0x8(%rbx), %rcx
addq $0x10, %rbx
pushq $0x1
popq %rsi
movl $0x2000, %edx           # imm = 0x2000
movq %rbx, %rdi
callq 0x30a0
movq %rax, (%r14)
testq %rax, %rax
cmoveq %rax, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/ramirezsebas[P]TP-LISTINGS/./src/capitulo_4/4.13/spin-condvar.c
// Function: main
int main(){
	int i, flag_is_set;
	pthread_t thread_id;
	char option;

	initialize_flag();

	pthread_create(&thread_id, NULL, &thread_function, NULL);

	printf("Presione enter para empezar a generar listas aleatorias...\n");

	getchar();

	do{
		set_thread_flag(1);

		while(get_thread_flag());

		for(i = 0; i < TAM; ++i)
			printf("%d, ", lista_random[i]);

		printf("\nGenerar otra?: (s/n)\n");
		scanf("%c", &option);
		getchar();
		printf("\n");

	}while(option == 's');

	printf("\nPrograma finalizado!\n");
	
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
callq 0x1304
leaq 0xaf(%rip), %rdx        # 0x12b8
leaq -0x38(%rbp), %rdi
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x10a0
leaq 0xdef(%rip), %rdi       # 0x200c
callq 0x1040
callq 0x1070
leaq -0x29(%rbp), %r12
pushq $0xa
popq %r13
leaq 0x2e6a(%rip), %r14      # 0x40a0
leaq 0xdc7(%rip), %rbx       # 0x2004
pushq $0x1
popq %rdi
callq 0x12da
callq 0x1360
testl %eax, %eax
jne 0x1245
xorl %r15d, %r15d
cmpq $0x50, %r15
je 0x126b
movl (%r15,%r14), %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1050
addq $0x4, %r15
jmp 0x1251
leaq 0xdd5(%rip), %rdi       # 0x2047
callq 0x1040
leaq 0xd8b(%rip), %rdi       # 0x2009
movq %r12, %rsi
xorl %eax, %eax
callq 0x10b0
callq 0x1070
movl %r13d, %edi
callq 0x1030
cmpb $0x73, -0x29(%rbp)
je 0x123d
leaq 0xdbb(%rip), %rdi       # 0x205d
callq 0x1040
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/ramirezsebas[P]TP-LISTINGS/./src/capitulo_4/4.13/spin-condvar.c
// Function: thread_function
void* thread_function (void* thread_arg){
	srand(time(NULL));
	while (1) {
		if (get_thread_flag())
			do_work ();
	}

	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
xorl %edi, %edi
callq 0x1080
movl %eax, %edi
callq 0x1060
callq 0x1360
testl %eax, %eax
je 0x12ca
callq 0x131f
jmp 0x12ca
// File: /workspace/github_c_makefile_star2_O2/ramirezsebas[P]TP-LISTINGS/./src/capitulo_4/4.13/spin-condvar.c
// Function: do_work
void do_work(){
	int i;
	for(i = 0; i < TAM; ++i)
		lista_random[i] = rand() % 100;
	set_thread_flag(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
xorl %ebx, %ebx
pushq $0x64
popq %r14
leaq 0x2d6a(%rip), %r15      # 0x40a0
cmpq $0x50, %rbx
je 0x134f
callq 0x10e0
cltd
idivl %r14d
movl %edx, (%rbx,%r15)
addq $0x4, %rbx
jmp 0x1336
xorl %edi, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x12da
// File: /workspace/github_c_makefile_star2_O2/ramirezsebas[P]TP-LISTINGS/./src/capitulo_4/4.13/spin-condvar.c
// Function: get_thread_flag
int get_thread_flag(){
	int flag_is_set;
	/* Protect the flag with a mutex lock. */
	pthread_mutex_lock (&thread_flag_mutex);
	flag_is_set = thread_flag;
	pthread_mutex_unlock (&thread_flag_mutex);

	return flag_is_set;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0x2d82(%rip), %rbx      # 0x40f0
movq %rbx, %rdi
callq 0x10d0
movl 0x2d9b(%rip), %r14d     # 0x4118
movq %rbx, %rdi
callq 0x1090
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/demo/output.c
// Function: main
int main(int argc, char **argv) {
    (void)argc; (void)argv;
    int ret = tb_init();
    if (ret) {
        fprintf(stderr, "tb_init() failed with error code %d\n", ret);
        return 1;
    }

    draw_all();

    struct tb_event ev;
    while (tb_poll_event(&ev)) {
        switch (ev.type) {
        case TB_EVENT_KEY:
            switch (ev.key) {
            case TB_KEY_ESC:
                goto done;
                break;
            }
            break;
        case TB_EVENT_RESIZE:
            draw_all();
            break;
        }
    }
done:
    tb_shutdown();
    return 0;
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
callq 0x3d12
testl %eax, %eax
jne 0x33ad
callq 0x33cc
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x45c2
testl %eax, %eax
je 0x33a0
movzbl 0x8(%rsp), %eax
cmpl $0x2, %eax
je 0x3399
cmpl $0x1, %eax
jne 0x3374
cmpw $0x1b, 0xa(%rsp)
jne 0x3374
jmp 0x33a0
callq 0x33cc
jmp 0x3374
callq 0x3d1e
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
retq
movq 0x5c3c(%rip), %rcx      # 0x8ff0
movq (%rcx), %rdi
leaq 0x2c46(%rip), %rsi      # 0x6004
movl %eax, %edx
xorl %eax, %eax
callq 0x3160
pushq $0x1
popq %rax
jmp 0x33a7
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/demo/output.c
// Function: print_combinations_table
static void print_combinations_table(int sx, int sy, const uint16_t *attrs, int attrs_n) {
    int i, c;
    for (i = 0; i < attrs_n; i++) {
        for (c = TB_DEFAULT; c <= TB_WHITE; c++) {
            uint16_t bg = attrs[i] | c;
            draw_line(sx, sy, bg);
            sy++;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, 0x10(%rsp)
movl %edi, (%rsp)
xorl %eax, %eax
testl %edx, %edx
cmovlel %eax, %edx
movq %rdx, 0x8(%rsp)
pushq $0x1
popq %r15
xorl %ecx, %ecx
cmpq 0x8(%rsp), %rcx
je 0x3630
xorl %edx, %edx
movq %rcx, 0x18(%rsp)
cmpl $0x9, %edx
je 0x3628
movq 0x10(%rsp), %rax
movzwl (%rax,%rcx,2), %eax
movl %edx, 0x4(%rsp)
orw %dx, %ax
xorl %ecx, %ecx
movzwl %ax, %r12d
xorl %ebx, %ebx
movl (%rsp), %eax
movl %eax, %ebp
cmpq $0x4, %rcx
je 0x3615
leaq 0x2a72(%rip), %rax      # 0x6030
movq %rcx, 0x20(%rsp)
movzwl (%rax,%rcx,2), %r13d
xorl %r14d, %r14d
leal (%r14,%rbp), %edi
cmpl $0x9, %r14d
je 0x3609
movl %r13d, %eax
orl %r14d, %eax
movslq %ebx, %rbx
leaq 0x2a5b(%rip), %rcx      # 0x6040
movsbl (%rbx,%rcx), %edx
movzwl %ax, %ecx
movl %r15d, %esi
movl %r12d, %r8d
callq 0x44b0
incl %ebx
cmpl $0x24, %ebx
movl $0x0, %eax
cmovel %eax, %ebx
incl %r14d
jmp 0x35cb
movq 0x20(%rsp), %rcx
incq %rcx
movl %edi, %ebp
jmp 0x35b1
incl %r15d
movl 0x4(%rsp), %edx
incl %edx
movq 0x18(%rsp), %rcx
jmp 0x358b
incq %rcx
jmp 0x3579
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/termbox.c
// Function: bytebuffer_init
static void bytebuffer_init(struct bytebuffer *b, int cap) {
    b->cap = 0;
    b->len = 0;
    b->buf = 0;

    if (cap > 0) {
        b->cap = cap;
        b->buf = malloc(cap); // just assume malloc works always
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
andq $0x0, 0x8(%rdi)
movl %esi, 0xc(%rdi)
movl %esi, %edi
callq 0x31b0
movq %rax, (%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/termbox.c
// Function: send_clear
static void send_clear(void) {
    send_attr(foreground, background);
    bytebuffer_puts(&output_buffer, funcs[T_CLEAR_SCREEN]);
    if (!IS_CURSOR_HIDDEN(cursor_x, cursor_y))
        write_cursor(cursor_x, cursor_y);
    bytebuffer_flush(&output_buffer, inout);

    /* we need to invalidate cursor position too and these two vars are
     * used only for simple cursor positioning optimization, cursor
     * actually may be in the correct place, but we simply discard
     * optimization once and it gives us simple solution for the case when
     * cursor moved */
    lastx = LAST_COORD_INIT;
    lasty = LAST_COORD_INIT;
}

// Assembly:
pushq %rax
movzwl 0x5d63(%rip), %edi      # 0x9924
movzwl 0x5d5e(%rip), %esi      # 0x9926
callq 0x4099
movq 0x5d24(%rip), %rax      # 0x98f8
movq 0x20(%rax), %rdi
callq 0x3ba5
movl 0x556d(%rip), %edi      # 0x9150
cmpl $-0x1, %edi
sete %al
movl 0x5565(%rip), %esi      # 0x9154
cmpl $-0x1, %esi
sete %cl
orb %al, %cl
jne 0x3bfe
callq 0x4378
movl 0x5c8c(%rip), %edi      # 0x9890
callq 0x3e85
orl $-0x1, 0x5538(%rip)     # 0x9148
orl $-0x1, 0x5535(%rip)     # 0x914c
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/termbox.c
// Function: update_term_size
static void update_term_size(void) {
    struct winsize sz;
    memset(&sz, 0, sizeof(sz));

    ioctl(inout, TIOCGWINSZ, &sz);

    termw = sz.ws_col > 0 ? sz.ws_col : 80;
    termh = sz.ws_row > 0 ? sz.ws_row : 24;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
leaq 0x8(%rsp), %rbx
andq $0x0, (%rbx)
movl 0x5c63(%rip), %edi      # 0x9890
movl $0x5413, %esi           # imm = 0x5413
movq %rbx, %rdx
xorl %eax, %eax
callq 0x3110
movzwl 0x2(%rbx), %eax
testw %ax, %ax
pushq $0x50
popq %rcx
cmovnel %eax, %ecx
movl $0xffff, %eax           # imm = 0xFFFF
andl %eax, %ecx
movl %ecx, 0x54ea(%rip)      # 0x9140
movl (%rbx), %ecx
testw %cx, %cx
pushq $0x18
popq %rdx
cmovnel %ecx, %edx
andl %eax, %edx
movl %edx, 0x54db(%rip)      # 0x9144
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/termbox.c
// Function: cellbuf_init
static void cellbuf_init(struct cellbuf *buf, int width, int height) {
    buf->cells =
        (struct tb_cell *)malloc(sizeof(struct tb_cell) * width * height);
    assert(buf->cells);
    buf->width = width;
    buf->height = height;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
movslq %esi, %rax
movslq %edx, %rdi
imulq %rax, %rdi
shlq $0x3, %rdi
callq 0x31b0
movq %rax, 0x8(%r14)
testq %rax, %rax
je 0x3ca2
movl %ebp, (%r14)
movl %ebx, 0x4(%r14)
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x26c2(%rip), %rdi      # 0x636b
leaq 0x26c6(%rip), %rsi      # 0x6376
leaq 0x26c9(%rip), %rcx      # 0x6380
movl $0x3ff, %edx            # imm = 0x3FF
callq 0x30e0
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/termbox.c
// Function: cellbuf_clear
static void cellbuf_clear(struct cellbuf *buf) {
    int i;
    int ncells = buf->width * buf->height;

    for (i = 0; i < ncells; ++i) {
        buf->cells[i].ch = ' ';
        buf->cells[i].fg = foreground;
        buf->cells[i].bg = background;
    }
}

// Assembly:
movl 0x4(%rdi), %eax
imull (%rdi), %eax
movzwl 0x5c56(%rip), %ecx      # 0x9924
movzwl 0x5c51(%rip), %edx      # 0x9926
xorl %esi, %esi
testl %eax, %eax
cmovlel %esi, %eax
cmpq %rsi, %rax
je 0x3cfe
movq 0x8(%rdi), %r8
movl $0x20, (%r8,%rsi,8)
movw %cx, 0x4(%r8,%rsi,8)
movw %dx, 0x6(%r8,%rsi,8)
incq %rsi
jmp 0x3cdc
retq
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/termbox.c
// Function: tb_shutdown
void tb_shutdown(void) {
    if (termw == -1) {
        fputs("tb_shutdown() should not be called twice.", stderr);
        abort();
    }

    bytebuffer_puts(&output_buffer, funcs[T_SHOW_CURSOR]);
    bytebuffer_puts(&output_buffer, funcs[T_SGR0]);
    bytebuffer_puts(&output_buffer, funcs[T_CLEAR_SCREEN]);
    bytebuffer_puts(&output_buffer, funcs[T_EXIT_CA]);
    bytebuffer_puts(&output_buffer, funcs[T_EXIT_KEYPAD]);
    bytebuffer_puts(&output_buffer, funcs[T_EXIT_MOUSE]);
    bytebuffer_flush(&output_buffer, inout);
    tcsetattr(inout, TCSAFLUSH, &orig_tios);

    shutdown_term();
    close(inout);
    close(winch_fds[0]);
    close(winch_fds[1]);

    cellbuf_free(&back_buffer);
    cellbuf_free(&front_buffer);
    bytebuffer_free(&output_buffer);
    bytebuffer_free(&input_buffer);
    termw = termh = -1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
cmpl $-0x1, 0x5416(%rip)     # 0x9140
je 0x3e6a
movq 0x5bc1(%rip), %rax      # 0x98f8
movq 0x10(%rax), %rdi
callq 0x3ba5
movq 0x5bb1(%rip), %rax      # 0x98f8
movq 0x28(%rax), %rdi
callq 0x3ba5
movq 0x5ba1(%rip), %rax      # 0x98f8
movq 0x20(%rax), %rdi
callq 0x3ba5
movq 0x5b91(%rip), %rax      # 0x98f8
movq 0x8(%rax), %rdi
callq 0x3ba5
movq 0x5b81(%rip), %rax      # 0x98f8
movq 0x58(%rax), %rdi
callq 0x3ba5
movq 0x5b71(%rip), %rax      # 0x98f8
movq 0x68(%rax), %rdi
callq 0x3ba5
movl 0x5afa(%rip), %edi      # 0x9890
callq 0x3e85
movl 0x5aef(%rip), %edi      # 0x9890
leaq 0x5af4(%rip), %rdx      # 0x989c
pushq $0x2
popq %rsi
callq 0x31f0
cmpb $0x1, 0x5b71(%rip)      # 0x9928
jne 0x3e05
movq 0x5b70(%rip), %rbx      # 0x9930
xorl %r14d, %r14d
cmpq $0x16, %r14
je 0x3dd7
movq (%rbx,%r14,8), %rdi
callq 0x3040
incq %r14
jmp 0x3dc3
movq 0x5b1a(%rip), %r14      # 0x98f8
xorl %r15d, %r15d
cmpq $0xc, %r15
je 0x3df5
movq (%r14,%r15,8), %rdi
callq 0x3040
incq %r15
jmp 0x3de1
movq %rbx, %rdi
callq 0x3040
movq %r14, %rdi
callq 0x3040
movl 0x5a85(%rip), %edi      # 0x9890
callq 0x3120
movl 0x5a7e(%rip), %edi      # 0x9894
callq 0x3120
movl 0x5a77(%rip), %edi      # 0x9898
callq 0x3120
leaq 0x5ad3(%rip), %rdi      # 0x9900
callq 0x3ea2
leaq 0x5ad7(%rip), %rdi      # 0x9910
callq 0x3ea2
leaq 0x5aa3(%rip), %rdi      # 0x98e8
callq 0x3eab
leaq 0x5a87(%rip), %rdi      # 0x98d8
callq 0x3eab
orl $-0x1, 0x52e7(%rip)     # 0x9144
orl $-0x1, 0x52dc(%rip)     # 0x9140
popq %rbx
popq %r14
popq %r15
retq
movq 0x517f(%rip), %rax      # 0x8ff0
movq (%rax), %rsi
leaq 0x2276(%rip), %rdi      # 0x60f1
callq 0x30f0
callq 0x3050
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/termbox.c
// Function: update_size
static void update_size(void) {
    update_term_size();
    cellbuf_resize(&back_buffer, termw, termh);
    cellbuf_resize(&front_buffer, termw, termh);
    cellbuf_clear(&front_buffer);
    send_clear();
}

// Assembly:
pushq %rbx
callq 0x3c19
movl 0x50e2(%rip), %esi      # 0x9140
movl 0x50e0(%rip), %edx      # 0x9144
leaq 0x5895(%rip), %rdi      # 0x9900
callq 0x4ae4
movl 0x50ca(%rip), %esi      # 0x9140
movl 0x50c8(%rip), %edx      # 0x9144
leaq 0x588d(%rip), %rbx      # 0x9910
movq %rbx, %rdi
callq 0x4ae4
movq %rbx, %rdi
callq 0x3cc1
popq %rbx
jmp 0x3bb9
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/termbox.c
// Function: send_char
static void send_char(int x, int y, uint32_t c) {
    char buf[7];
    int bw = tb_utf8_unicode_to_char(buf, c);
    if (x - 1 != lastx || y != lasty)
        write_cursor(x, y);
    lastx = x;
    lasty = y;
    if (!c)
        buf[0] = ' '; // replace 0 with whitespace
    bytebuffer_append(&output_buffer, buf, bw);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movl %esi, %r14d
movl %edi, %r15d
leaq 0x1(%rsp), %rdi
movl %edx, %esi
callq 0x509e
movl %eax, %ebx
leal -0x1(%r15), %eax
cmpl 0x4e14(%rip), %eax      # 0x9148
jne 0x433f
cmpl %r14d, 0x4e0f(%rip)     # 0x914c
je 0x434a
movl %r15d, %edi
movl %r14d, %esi
callq 0x4378
movl %r15d, 0x4df7(%rip)     # 0x9148
movl %r14d, 0x4df4(%rip)     # 0x914c
testl %ebp, %ebp
jne 0x4361
movb $0x20, 0x1(%rsp)
leaq 0x1(%rsp), %rdi
movl %ebx, %esi
callq 0x4a1c
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/termbox.c
// Function: write_cursor
static void write_cursor(int x, int y) {
    char buf[32];
    WRITE_LITERAL("\033[");
    WRITE_INT(y + 1);
    WRITE_LITERAL(";");
    WRITE_INT(x + 1);
    WRITE_LITERAL("H");
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movl %esi, %ebp
movl %edi, %ebx
leaq 0x1fdd(%rip), %rdi      # 0x6368
pushq $0x2
popq %rsi
callq 0x4a1c
incl %ebp
movq %rsp, %r14
movl %ebp, %edi
movq %r14, %rsi
callq 0x4a63
movq %r14, %rdi
movl %eax, %esi
callq 0x4a1c
leaq 0x1fff(%rip), %rdi      # 0x63b2
pushq $0x1
popq %rbp
movl %ebp, %esi
callq 0x4a1c
incl %ebx
movl %ebx, %edi
movq %r14, %rsi
callq 0x4a63
movq %r14, %rdi
movl %eax, %esi
callq 0x4a1c
leaq 0x1ee2(%rip), %rdi      # 0x62bc
movl %ebp, %esi
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x4a1c
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/termbox.c
// Function: tb_set_cursor
void tb_set_cursor(int cx, int cy) {
    if (IS_CURSOR_HIDDEN(cursor_x, cursor_y) && !IS_CURSOR_HIDDEN(cx, cy))
        bytebuffer_puts(&output_buffer, funcs[T_SHOW_CURSOR]);

    if (!IS_CURSOR_HIDDEN(cursor_x, cursor_y) && IS_CURSOR_HIDDEN(cx, cy))
        bytebuffer_puts(&output_buffer, funcs[T_HIDE_CURSOR]);

    cursor_x = cx;
    cursor_y = cy;
    if (!IS_CURSOR_HIDDEN(cursor_x, cursor_y))
        write_cursor(cursor_x, cursor_y);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movl %edi, %ebp
movl 0x4d59(%rip), %ecx      # 0x9150
cmpl $-0x1, %ecx
setne %dl
movl 0x4d51(%rip), %eax      # 0x9154
cmpl $-0x1, %eax
setne %sil
cmpl $-0x1, %ebx
je 0x4435
cmpl $-0x1, %ebp
je 0x4435
andb %sil, %dl
jne 0x4435
movq 0x54d8(%rip), %rax      # 0x98f8
movq 0x10(%rax), %rdi
callq 0x3ba5
movl 0x4d21(%rip), %ecx      # 0x9150
movl 0x4d1f(%rip), %eax      # 0x9154
cmpl $-0x1, %ebx
sete %dl
cmpl $-0x1, %ebp
sete %r14b
orb %dl, %r14b
cmpb $0x1, %r14b
jne 0x4465
cmpl $-0x1, %ecx
je 0x4465
cmpl $-0x1, %eax
je 0x4465
movq 0x549c(%rip), %rax      # 0x98f8
movq 0x18(%rax), %rdi
callq 0x3ba5
movl %ebp, 0x4ce5(%rip)      # 0x9150
movl %ebx, 0x4ce3(%rip)      # 0x9154
testb %r14b, %r14b
je 0x447b
popq %rbx
popq %r14
popq %rbp
retq
movl %ebp, %edi
movl %ebx, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x4378
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/termbox.c
// Function: tb_blit
void tb_blit(int x, int y, int w, int h, const struct tb_cell *cells) {
    if (x + w < 0 || x >= back_buffer.width)
        return;
    if (y + h < 0 || y >= back_buffer.height)
        return;
    int xo = 0, yo = 0, ww = w, hh = h;
    if (x < 0) {
        xo = -x;
        ww -= xo;
        x = 0;
    }
    if (y < 0) {
        yo = -y;
        hh -= yo;
        y = 0;
    }
    if (ww > back_buffer.width - x)
        ww = back_buffer.width - x;
    if (hh > back_buffer.height - y)
        hh = back_buffer.height - y;

    int sy;
    struct tb_cell *dst = &CELL(&back_buffer, x, y);
    const struct tb_cell *src = cells + yo * w + xo;
    size_t size = sizeof(struct tb_cell) * ww;

    for (sy = 0; sy < hh; ++sy) {
        memcpy(dst, src, size);
        dst += back_buffer.width;
        src += w;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %r9d
addl %edi, %r9d
setns %r10b
movl 0x541f(%rip), %eax      # 0x9900
cmpl %edi, %eax
setg %r11b
movl %ecx, %ebx
addl %esi, %ebx
setns %r14b
andb %r10b, %r14b
andb %r11b, %r14b
movl 0x5409(%rip), %ebp      # 0x9904
cmpl %esi, %ebp
setg %r10b
andb %r14b, %r10b
cmpb $0x1, %r10b
jne 0x45b1
movl %edi, %r10d
negl %r10d
movl %edi, %r11d
sarl $0x1f, %r11d
andl %r10d, %r11d
xorl %r10d, %r10d
testl %edi, %edi
cmovnsl %edx, %r9d
cmovlel %r10d, %edi
movl %esi, %r14d
negl %r14d
movl %esi, %r15d
sarl $0x1f, %r15d
andl %r14d, %r15d
testl %esi, %esi
cmovlel %r10d, %esi
cmovsl %ebx, %ecx
movl %eax, %r12d
subl %edi, %r12d
cmpl %r12d, %r9d
cmovll %r9d, %r12d
subl %esi, %ebp
cmpl %ebp, %ecx
cmovll %ecx, %ebp
imull %eax, %esi
addl %edi, %esi
movslq %esi, %rbx
shlq $0x3, %rbx
addq 0x539d(%rip), %rbx      # 0x9908
imull %edx, %r15d
movslq %r15d, %rax
leaq (%r8,%rax,8), %rax
leaq (%rax,%r11,8), %r14
movslq %r12d, %r15
shlq $0x3, %r15
movslq %edx, %r12
testl %ebp, %ebp
cmovlel %r10d, %ebp
shlq $0x3, %r12
subl $0x1, %ebp
jb 0x45b1
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x3170
movslq 0x5358(%rip), %rax      # 0x9900
leaq (%rbx,%rax,8), %rbx
addq %r12, %r14
jmp 0x458e
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/termbox.c
// Function: tb_peek_event
int tb_peek_event(struct tb_event *event, int timeout) {
    struct timeval tv;
    tv.tv_sec = timeout / 1000;
    tv.tv_usec = (timeout - (tv.tv_sec * 1000)) * 1000;
    return wait_fill_event(event, &tv);
}

// Assembly:
subq $0x18, %rsp
movl %esi, %ecx
movl $0x3e8, %esi            # imm = 0x3E8
movl %ecx, %eax
cltd
idivl %esi
cltq
leaq 0x8(%rsp), %rsi
movq %rax, (%rsi)
movslq %ecx, %rcx
imulq $-0x3e8, %rax, %rax     # imm = 0xFC18
addq %rcx, %rax
imulq $0x3e8, %rax, %rax      # imm = 0x3E8
movq %rax, 0x8(%rsi)
callq 0x45c6
addq $0x18, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/termbox.c
// Function: tb_clear
void tb_clear(void) {
    if (buffer_size_change_request) {
        update_size();
        buffer_size_change_request = 0;
    }
    cellbuf_clear(&back_buffer);
}

// Assembly:
cmpl $0x0, 0x511f(%rip)      # 0x9920
je 0x4817
pushq %rax
callq 0x4052
movl $0x0, 0x510d(%rip)      # 0x9920
addq $0x8, %rsp
leaq 0x50e2(%rip), %rdi      # 0x9900
jmp 0x3cc1
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/termbox.c
// Function: tb_select_input_mode
int tb_select_input_mode(int mode) {
    if (mode) {
        if ((mode & (TB_INPUT_ESC | TB_INPUT_ALT)) == 0)
            mode |= TB_INPUT_ESC;

        /* technically termbox can handle that, but let's be nice and show here
           what mode is actually used */
        if ((mode & (TB_INPUT_ESC | TB_INPUT_ALT)) ==
            (TB_INPUT_ESC | TB_INPUT_ALT))
            mode &= ~TB_INPUT_ALT;

        inputmode = mode;
        if (mode & TB_INPUT_MOUSE) {
            bytebuffer_puts(&output_buffer, funcs[T_ENTER_MOUSE]);
            bytebuffer_flush(&output_buffer, inout);
        } else {
            bytebuffer_puts(&output_buffer, funcs[T_EXIT_MOUSE]);
            bytebuffer_flush(&output_buffer, inout);
        }
    }
    return inputmode;
}

// Assembly:
testl %edi, %edi
je 0x4870
pushq %rax
xorl %eax, %eax
testb $0x3, %dil
sete %al
orl %edi, %eax
movl %eax, %ecx
notl %ecx
movl %eax, %edx
andl $-0x3, %edx
testb $0x3, %cl
cmovnel %eax, %edx
movl %edx, 0x4910(%rip)      # 0x9158
xorl %eax, %eax
testb $0x4, %dl
sete %al
movq 0x50a1(%rip), %rcx      # 0x98f8
movq 0x60(%rcx,%rax,8), %rdi
callq 0x3ba5
movl 0x5029(%rip), %edi      # 0x9890
callq 0x3e85
addq $0x8, %rsp
movl 0x48e2(%rip), %eax      # 0x9158
retq
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/termbox.c
// Function: terminfo_try_path
static char *terminfo_try_path(const char *path, const char *term) {
    char tmp[4096];
    snprintf(tmp, sizeof(tmp), "%s/%c/%s", path, term[0], term);
    tmp[sizeof(tmp) - 1] = '\0';
    char *data = read_file(tmp);
    if (data) {
        return data;
    }

    // fallback to darwin specific dirs structure
    snprintf(tmp, sizeof(tmp), "%s/%x/%s", path, term[0], term);
    tmp[sizeof(tmp) - 1] = '\0';
    return read_file(tmp);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x1000, %rsp           # imm = 0x1000
movq %rsi, %rbx
movq %rdi, %r14
movsbl (%rsi), %r8d
leaq 0x18ba(%rip), %rdx      # 0x61a1
movq %rsp, %r15
movl $0x1000, %esi           # imm = 0x1000
movq %r15, %rdi
movq %r14, %rcx
movq %rbx, %r9
xorl %eax, %eax
callq 0x30d0
movb $0x0, 0xfff(%r15)
movq %r15, %rdi
callq 0x4954
testq %rax, %rax
jne 0x4947
movsbl (%rbx), %r8d
leaq 0x188b(%rip), %rdx      # 0x61aa
movq %rsp, %r15
movl $0x1000, %esi           # imm = 0x1000
movq %r15, %rdi
movq %r14, %rcx
movq %rbx, %r9
xorl %eax, %eax
callq 0x30d0
movb $0x0, 0xfff(%r15)
movq %r15, %rdi
callq 0x4954
addq $0x1000, %rsp           # imm = 0x1000
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/termbox.c
// Function: read_file
static char *read_file(const char *file) {
    FILE *f = fopen(file, "rb");
    if (!f)
        return 0;

    struct stat st;
    if (fstat(fileno(f), &st) != 0) {
        fclose(f);
        return 0;
    }

    char *data = malloc(st.st_size);
    if (!data) {
        fclose(f);
        return 0;
    }

    if (fread(data, 1, st.st_size, f) != (size_t)st.st_size) {
        fclose(f);
        free(data);
        return 0;
    }

    fclose(f);
    return data;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x98, %rsp
leaq 0x184a(%rip), %rsi      # 0x61b3
callq 0x3210
testq %rax, %rax
je 0x4996
movq %rax, %rbx
movq %rax, %rdi
callq 0x3180
leaq 0x8(%rsp), %rsi
movl %eax, %edi
callq 0x3240
testl %eax, %eax
je 0x49ab
movq %rbx, %rdi
callq 0x30b0
xorl %r14d, %r14d
movq %r14, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x38(%rsp), %r15
movq %r15, %rdi
callq 0x31b0
testq %rax, %rax
je 0x498e
movq %rax, %r14
pushq $0x1
popq %rsi
movq %rax, %rdi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3090
movq %rax, %r12
movq %rbx, %rdi
callq 0x30b0
cmpq %r15, %r12
je 0x4999
movq %r14, %rdi
callq 0x3040
jmp 0x4996
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/termbox.c
// Function: try_compatible
static int try_compatible(const char *term, const char *name,
                          const char **tkeys, const char **tfuncs) {
    if (strstr(term, name)) {
        keys = tkeys;
        funcs = tfuncs;
        return 0;
    }

    return EUNSUPPORTED_TERM;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
callq 0x3250
testq %rax, %rax
je 0x4a11
movq %r14, 0x4f2a(%rip)      # 0x9930
movq %rbx, 0x4eeb(%rip)      # 0x98f8
xorl %eax, %eax
jmp 0x4a14
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/termbox.c
// Function: convertnum
static int convertnum(uint32_t num, char *buf) {
    int i, l = 0;
    int ch;
    do {
        buf[l++] = '0' + (num % 10);
        num /= 10;
    } while (num);
    for (i = 0; i < l / 2; i++) {
        ch = buf[i];
        buf[i] = buf[l - 1 - i];
        buf[l - 1 - i] = ch;
    }
    return l;
}

// Assembly:
xorl %ecx, %ecx
pushq $0xa
popq %r8
movl %edi, %eax
xorl %edx, %edx
divl %r8d
orb $0x30, %dl
movb %dl, (%rsi,%rcx)
incq %rcx
cmpl $0x9, %edi
movl %eax, %edi
ja 0x4a69
movq %rcx, %rax
shrq %rax
negq %rax
leal -0x1(%rcx), %edx
movslq %edx, %rdx
addq %rsi, %rdx
xorl %edi, %edi
cmpq %rdi, %rax
je 0x4aaf
movb (%rsi), %r8b
movb (%rdx,%rdi), %r9b
movb %r9b, (%rsi)
movb %r8b, (%rdx,%rdi)
decq %rdi
incq %rsi
jmp 0x4a94
movl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/termbox.c
// Function: bytebuffer_reserve
static void bytebuffer_reserve(struct bytebuffer *b, int cap) {
    if (b->cap >= cap) {
        return;
    }

    // prefer doubling capacity
    if (b->cap * 2 >= cap) {
        cap = b->cap * 2;
    }

    char *newbuf = realloc(b->buf, cap);
    b->buf = newbuf;
    b->cap = cap;
}

// Assembly:
movl 0xc(%rdi), %eax
cmpl %esi, %eax
jge 0x4ae3
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
addl %eax, %eax
cmpl %esi, %eax
cmovlel %esi, %eax
movq (%rdi), %rdi
movslq %eax, %r14
movq %r14, %rsi
callq 0x31c0
movq %rax, (%rbx)
movl %r14d, 0xc(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/termbox.c
// Function: cellbuf_resize
static void cellbuf_resize(struct cellbuf *buf, int width, int height) {
    if (buf->width == width && buf->height == height)
        return;

    int oldw = buf->width;
    int oldh = buf->height;
    struct tb_cell *oldcells = buf->cells;

    cellbuf_init(buf, width, height);
    cellbuf_clear(buf);

    int minw = (width < oldw) ? width : oldw;
    int minh = (height < oldh) ? height : oldh;
    int i;

    for (i = 0; i < minh; ++i) {
        struct tb_cell *csrc = oldcells + (i * oldw);
        struct tb_cell *cdst = buf->cells + (i * width);
        memcpy(cdst, csrc, sizeof(struct tb_cell) * minw);
    }

    free(oldcells);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movslq (%rdi), %r13
movl %r13d, %eax
xorl %esi, %eax
movl 0x4(%rdi), %r15d
movl %r15d, %ecx
xorl %edx, %ecx
orl %eax, %ecx
jne 0x4b16
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %edx, %ebx
movl %esi, %r12d
movq %rdi, %r14
movq 0x8(%rdi), %rax
movq %rax, 0x8(%rsp)
callq 0x3c6f
movq %r14, 0x10(%rsp)
movq %r14, %rdi
callq 0x3cc1
cmpl %r12d, %r13d
movslq %r12d, %rbp
cmovll %r13d, %r12d
cmpl %ebx, %r15d
cmovll %r15d, %ebx
movslq %r12d, %r12
shlq $0x3, %r12
xorl %r15d, %r15d
testl %ebx, %ebx
cmovlel %r15d, %ebx
shlq $0x3, %r13
movq %r13, %r14
shlq $0x3, %rbp
movq 0x8(%rsp), %r13
subq $0x1, %rbx
jb 0x4b8f
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rdi
addq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x3170
addq %r14, %r13
addq %rbp, %r15
jmp 0x4b6a
movq 0x8(%rsp), %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3040
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/termbox.c
// Function: read_up_to
static int read_up_to(int n) {
    assert(n > 0);
    const int prevlen = input_buffer.len;
    bytebuffer_resize(&input_buffer, prevlen + n);

    int read_n = 0;
    while (read_n <= n) {
        ssize_t r = 0;
        if (read_n < n) {
            r = read(inout, input_buffer.buf + prevlen + read_n, n - read_n);
        }
#ifdef __CYGWIN__
        // While linux man for tty says when VMIN == 0 && VTIME == 0, read
        // should return 0 when there is nothing to read, cygwin's read returns
        // -1. Not sure why and if it's correct to ignore it, but let's pretend
        // it's zero.
        if (r < 0)
            r = 0;
#endif
        if (r < 0) {
            // EAGAIN / EWOULDBLOCK shouldn't occur here
            assert(errno != EAGAIN && errno != EWOULDBLOCK);
            return -1;
        } else if (r > 0) {
            read_n += r;
        } else {
            bytebuffer_resize(&input_buffer, prevlen + read_n);
            return read_n;
        }
    }
    assert(!"unreachable");
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movslq 0x49b2(%rip), %r14      # 0x98e0
leal 0x40(%r14), %ebp
movl %ebp, %edi
callq 0x502f
xorl %ecx, %ecx
pushq $0x40
popq %r15
cmpl $0x40, %ecx
jg 0x4f9e
movl %ecx, %ebx
je 0x4f7b
movl 0x4942(%rip), %edi      # 0x9890
movq 0x4983(%rip), %rax      # 0x98d8
addq %r14, %rax
movslq %ebx, %rsi
addq %rax, %rsi
movl %r15d, %edx
subl %ebx, %edx
callq 0x3140
testq %rax, %rax
js 0x4f84
leal (%rbx,%rax), %ecx
testq %rax, %rax
jne 0x4f3f
addl %ebx, %r14d
movl %r14d, %ebp
movl %ebp, %edi
callq 0x502f
jmp 0x4f91
callq 0x3060
cmpl $0xb, (%rax)
je 0x4fbd
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x14b0(%rip), %rdi      # 0x6455
leaq 0x13ca(%rip), %rsi      # 0x6376
leaq 0x1466(%rip), %rcx      # 0x6419
movl $0x4c2, %edx            # imm = 0x4C2
callq 0x30e0
leaq 0x1469(%rip), %rdi      # 0x642d
leaq 0x13ab(%rip), %rsi      # 0x6376
leaq 0x1447(%rip), %rcx      # 0x6419
movl $0x4b9, %edx            # imm = 0x4B9
callq 0x30e0
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/termbox.c
// Function: bytebuffer_truncate
static void bytebuffer_truncate(struct bytebuffer *b, int n) {
    if (n <= 0)
        return;
    if (n > b->len)
        n = b->len;
    const int nmove = b->len - n;
    memmove(b->buf, b->buf + n, nmove);
    b->len -= n;
}

// Assembly:
testl %edi, %edi
jle 0x500e
pushq %rbx
movl 0x48f9(%rip), %ecx      # 0x98e0
cmpl %edi, %ecx
cmovll %ecx, %edi
subl %edi, %ecx
movq 0x48e3(%rip), %rax      # 0x98d8
movslq %edi, %rbx
leaq (%rax,%rbx), %rsi
movslq %ecx, %rdx
movq %rax, %rdi
callq 0x31d0
subl %ebx, 0x48d3(%rip)      # 0x98e0
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/termbox.c
// Function: starts_with
static bool starts_with(const char *s1, int len, const char *s2) {
    int n = 0;
    while (*s2 && n < len) {
        if (*s1++ != *s2++)
            return false;
        n++;
    }
    return *s2 == 0;
}

// Assembly:
xorl %eax, %eax
movb (%rdx,%rax), %cl
testb %cl, %cl
je 0x5026
cmpl %esi, %eax
jge 0x5026
cmpb %cl, (%rdi,%rax)
jne 0x502c
incq %rax
jmp 0x5011
testb %cl, %cl
sete %al
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/utf8.c
// Function: tb_utf8_char_to_unicode
int tb_utf8_char_to_unicode(uint32_t *out, const char *c) {
    if (*c == 0)
        return TB_EOF;

    int i;
    unsigned char len = tb_utf8_char_length(*c);
    unsigned char mask = utf8_mask[len - 1];
    uint32_t result = c[0] & mask;
    for (i = 1; i < len; ++i) {
        result <<= 6;
        result |= c[i] & 0x3f;
    }

    *out = result;
    return (int)len;
}

// Assembly:
movzbl (%rsi), %ecx
testq %rcx, %rcx
je 0x509a
leaq 0x1409(%rip), %rax      # 0x6470
movzbl (%rcx,%rax), %eax
leaq 0x14fe(%rip), %rdx      # 0x6570
movb -0x1(%rax,%rdx), %dl
andb %cl, %dl
movzbl %dl, %ecx
pushq $0x1
popq %rdx
cmpq %rax, %rdx
jae 0x5097
shll $0x6, %ecx
movzbl (%rsi,%rdx), %r8d
andl $0x3f, %r8d
orl %r8d, %ecx
incq %rdx
jmp 0x507e
movl %ecx, (%rdi)
retq
pushq $-0x1
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/termbox[P]termbox/utf8.c
// Function: tb_utf8_unicode_to_char
int tb_utf8_unicode_to_char(char *out, uint32_t c) {
    int len = 0;
    int first;
    int i;

    if (c < 0x80) {
        first = 0;
        len = 1;
    } else if (c < 0x800) {
        first = 0xc0;
        len = 2;
    } else if (c < 0x10000) {
        first = 0xe0;
        len = 3;
    } else if (c < 0x200000) {
        first = 0xf0;
        len = 4;
    } else if (c < 0x4000000) {
        first = 0xf8;
        len = 5;
    } else {
        first = 0xfc;
        len = 6;
    }

    for (i = len - 1; i > 0; --i) {
        out[i] = (c & 0x3f) | 0x80;
        c >>= 6;
    }
    out[0] = c | first;

    return len;
}

// Assembly:
cmpl $0x80, %esi
jae 0x50ac
xorl %ecx, %ecx
pushq $0x1
jmp 0x50dd
cmpl $0x800, %esi            # imm = 0x800
jae 0x50bd
movl $0xc0, %ecx
pushq $0x2
jmp 0x50dd
cmpl $0x10000, %esi          # imm = 0x10000
jae 0x50ce
movl $0xe0, %ecx
pushq $0x3
jmp 0x50dd
cmpl $0x200000, %esi         # imm = 0x200000
jae 0x5107
movl $0xf0, %ecx
pushq $0x4
popq %rax
movl %eax, %eax
movq %rax, %rdx
cmpq $0x2, %rdx
jl 0x5101
movl %esi, %r8d
andb $0x3f, %r8b
orb $-0x80, %r8b
movb %r8b, -0x1(%rdi,%rdx)
decq %rdx
shrl $0x6, %esi
jmp 0x50e3
orl %ecx, %esi
movb %sil, (%rdi)
retq
xorl %ecx, %ecx
cmpl $0x4000000, %esi        # imm = 0x4000000
setae %cl
pushq $0x6
popq %rax
sbbl $0x0, %eax
leal 0xf8(,%rcx,4), %ecx
jmp 0x50de
// File: /workspace/github_c_makefile_star2_O2/antonblanchard[P]will-it-scale/tests/unix1.c
// Function: testcase
void testcase(unsigned long long *iterations, unsigned long nr)
{
	int fd[2];
	char c;
	int ret;

	socketpair(AF_UNIX, SOCK_STREAM, 0, fd);

	while (1) {
		do {
			ret = write(fd[WRITE], &c, 1);
		} while (ret != 1 && errno == EINTR);

		do {
			ret = read(fd[READ], &c, 1);
		} while (ret != 1 && errno == EINTR);

		(*iterations)++;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
pushq $0x1
popq %rdi
leaq 0x8(%rsp), %rcx
movl %edi, %esi
xorl %edx, %edx
callq 0x2170
leaq 0x7(%rsp), %r14
pushq $0x1
popq %r15
movl 0xc(%rsp), %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x20d0
cmpl $0x1, %eax
je 0x2b74
callq 0x2070
cmpl $0x4, (%rax)
je 0x2b56
movl 0x8(%rsp), %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2140
cmpl $0x1, %eax
je 0x2b92
callq 0x2070
cmpl $0x4, (%rax)
je 0x2b74
incq (%rbx)
jmp 0x2b56