LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/fgheng[P]keysound/src/cJSON.cc
// Function: cJSON_Minify
void cJSON_Minify(char *json)
{
	char *into=json;
	while (*json)
	{
		if (*json==' ') json++;
		else if (*json=='\t') json++;	/* Whitespace characters. */
		else if (*json=='\r') json++;
		else if (*json=='\n') json++;
		else if (*json=='/' && json[1]=='/')  while (*json && *json!='\n') json++;	/* double-slash comments, to end of line. */
		else if (*json=='/' && json[1]=='*') {while (*json && !(*json=='*' && json[1]=='/')) json++;json+=2;}	/* multiline comments. */
		else if (*json=='\"'){*into++=*json++;while (*json && *json!='\"'){if (*json=='\\') *into++=*json++;*into++=*json++;}*into++=*json++;} /* string literals, which are \" sensitive. */
		else *into++=*json++;			/* All other characters. */
	}
	*into=0;	/* and null-terminate. */
}

// Assembly:
movq %rdi, %rax
movzbl (%rdi), %ecx
cmpl $0x9, %ecx
je 0x9766
cmpl $0xa, %ecx
je 0x9766
cmpl $0xd, %ecx
je 0x9766
cmpl $0x20, %ecx
je 0x9766
cmpl $0x22, %ecx
je 0x976b
cmpl $0x2f, %ecx
je 0x97a8
testl %ecx, %ecx
jne 0x97fd
jmp 0x980a
incq %rdi
jmp 0x9738
movb $0x22, (%rax)
movzbl 0x1(%rdi), %ecx
cmpl $0x5c, %ecx
je 0x9788
testl %ecx, %ecx
je 0x979b
cmpl $0x22, %ecx
je 0x979b
incq %rax
incq %rdi
jmp 0x9797
movb $0x5c, 0x1(%rax)
addq $0x2, %rax
movb 0x2(%rdi), %cl
addq $0x2, %rdi
movb %cl, (%rax)
jmp 0x976e
addq $0x2, %rdi
movb %cl, 0x1(%rax)
addq $0x2, %rax
jmp 0x9738
movzbl 0x1(%rdi), %edx
cmpl $0x2f, %edx
je 0x97e8
cmpl $0x2a, %edx
jne 0x97fd
addq $0x2, %rdi
movb $0x2f, %cl
cmpb $0x2a, %cl
je 0x97d1
movzbl %cl, %ecx
testl %ecx, %ecx
je 0x9738
movb -0x1(%rdi), %cl
jmp 0x97dd
movb -0x1(%rdi), %cl
cmpb $0x2f, %cl
je 0x9738
incq %rdi
jmp 0x97bc
movb 0x1(%rdi), %dl
incq %rdi
testb %dl, %dl
je 0x9738
movzbl %dl, %ecx
cmpl $0xa, %ecx
jne 0x97e2
jmp 0x9738
incq %rdi
movb %cl, (%rax)
incq %rax
jmp 0x9738
movb $0x0, (%rax)
retq
// File: /workspace/github_cpp_makefile_star2_O2/fgheng[P]keysound/src/cJSON.cc
// Function: parse_hex4(char const*)
static unsigned parse_hex4(const char *str)
{
	unsigned h=0;
	if (*str>='0' && *str<='9') h+=(*str)-'0'; else if (*str>='A' && *str<='F') h+=10+(*str)-'A'; else if (*str>='a' && *str<='f') h+=10+(*str)-'a'; else return 0;
	h=h<<4;str++;
	if (*str>='0' && *str<='9') h+=(*str)-'0'; else if (*str>='A' && *str<='F') h+=10+(*str)-'A'; else if (*str>='a' && *str<='f') h+=10+(*str)-'a'; else return 0;
	h=h<<4;str++;
	if (*str>='0' && *str<='9') h+=(*str)-'0'; else if (*str>='A' && *str<='F') h+=10+(*str)-'A'; else if (*str>='a' && *str<='f') h+=10+(*str)-'a'; else return 0;
	h=h<<4;str++;
	if (*str>='0' && *str<='9') h+=(*str)-'0'; else if (*str>='A' && *str<='F') h+=10+(*str)-'A'; else if (*str>='a' && *str<='f') h+=10+(*str)-'a'; else return 0;
	return h;
}

// Assembly:
movb (%rdi), %cl
leal -0x30(%rcx), %eax
cmpb $0xa, %al
jb 0x9a3b
leal -0x41(%rcx), %eax
cmpb $0x5, %al
ja 0x9a2b
addb $-0x37, %cl
jmp 0x9a39
leal -0x61(%rcx), %eax
cmpb $0x5, %al
ja 0x9ad0
addb $-0x57, %cl
movl %ecx, %eax
movb 0x1(%rdi), %dl
leal -0x30(%rdx), %ecx
cmpb $0xa, %cl
jb 0x9a60
leal -0x41(%rdx), %ecx
cmpb $0x5, %cl
ja 0x9a53
addb $-0x37, %dl
jmp 0x9a5e
leal -0x61(%rdx), %ecx
cmpb $0x5, %cl
ja 0x9ad0
addb $-0x57, %dl
movl %edx, %ecx
movb 0x2(%rdi), %sil
leal -0x30(%rsi), %edx
cmpb $0xa, %dl
jb 0x9a88
leal -0x41(%rsi), %edx
cmpb $0x5, %dl
ja 0x9a7a
addb $-0x37, %sil
jmp 0x9a86
leal -0x61(%rsi), %edx
cmpb $0x5, %dl
ja 0x9ad0
addb $-0x57, %sil
movl %esi, %edx
movb 0x3(%rdi), %sil
leal -0x30(%rsi), %edi
cmpb $0xa, %dil
jb 0x9ab3
leal -0x41(%rsi), %edi
cmpb $0x5, %dil
ja 0x9aa4
addb $-0x37, %sil
jmp 0x9ab1
leal -0x61(%rsi), %edi
cmpb $0x5, %dil
ja 0x9ad0
addb $-0x57, %sil
movl %esi, %edi
movzbl %al, %eax
movzbl %cl, %ecx
shll $0x8, %eax
shll $0x4, %ecx
addl %eax, %ecx
movzbl %dl, %edx
addl %ecx, %edx
shll $0x4, %edx
movzbl %dil, %eax
addl %edx, %eax
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/fgheng[P]keysound/src/cJSON.cc
// Function: ensure(printbuffer*, int)
static char* ensure(printbuffer *p,int needed)
{
	char *newbuffer;int newsize;
	if (!p || !p->buffer) return 0;
	needed+=p->offset;
	if (needed<=p->length) return p->buffer+p->offset;

	newsize=pow2gt(needed);
	newbuffer=(char*)cJSON_malloc(newsize);
	if (!newbuffer) {cJSON_free(p->buffer);p->length=0,p->buffer=0;return 0;}
	if (newbuffer) memcpy(newbuffer,p->buffer,p->length);
	cJSON_free(p->buffer);
	p->length=newsize;
	p->buffer=newbuffer;
	return newbuffer+p->offset;
}

// Assembly:
movq (%rdi), %rax
testq %rax, %rax
je 0x9b4b
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movslq 0xc(%rdi), %rcx
addl %ecx, %esi
cmpl 0x8(%rdi), %esi
jle 0x9b4e
decl %esi
movl %esi, %eax
sarl %eax
orl %esi, %eax
movl %eax, %ecx
sarl $0x2, %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x4, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x8, %ecx
orl %eax, %ecx
movl %ecx, %ebp
sarl $0x10, %ebp
orl %ecx, %ebp
incl %ebp
movslq %ebp, %rdi
callq *0x8804(%rip)           # 0x12320
testq %rax, %rax
je 0x9b53
movq %rax, %r14
movq (%rbx), %rsi
movslq 0x8(%rbx), %rdx
movq %rax, %rdi
callq 0x3280
movq (%rbx), %rdi
callq *0x87ec(%rip)           # 0x12328
movl %ebp, 0x8(%rbx)
movq %r14, (%rbx)
movslq 0xc(%rbx), %rax
addq %r14, %rax
jmp 0x9b66
xorl %eax, %eax
retq
addq %rcx, %rax
jmp 0x9b66
movq (%rbx), %rdi
callq *0x87cc(%rip)           # 0x12328
andl $0x0, 0x8(%rbx)
andq $0x0, (%rbx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/fgheng[P]keysound/src/cJSON.cc
// Function: print_number(cJSON*, printbuffer*)
static char *print_number(cJSON *item,printbuffer *p)
{
	char *str=0;
	double d=item->valuedouble;
	if (d==0)
	{
		if (p)	str=ensure(p,2);
		else	str=(char*)cJSON_malloc(2);	/* special case for 0. */
		if (str) strcpy(str,"0");
	}
	else if (fabs(((double)item->valueint)-d)<=DBL_EPSILON && d<=INT_MAX && d>=INT_MIN)
	{
		if (p)	str=ensure(p,21);
		else	str=(char*)cJSON_malloc(21);	/* 2^64+1 can be represented in 21 chars. */
		if (str)	sprintf(str,"%d",item->valueint);
	}
	else
	{
		if (p)	str=ensure(p,64);
		else	str=(char*)cJSON_malloc(64);	/* This is a nice tradeoff. */
		if (str)
		{
			if (fabs(floor(d)-d)<=DBL_EPSILON && fabs(d)<1.0e60)sprintf(str,"%.0f",d);
			else if (fabs(d)<1.0e-6 || fabs(d)>1.0e9)			sprintf(str,"%e",d);
			else												sprintf(str,"%f",d);
		}
	}
	return str;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movsd 0x30(%rdi), %xmm2
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm2
jne 0x9b97
jp 0x9b97
testq %rsi, %rsi
je 0x9be5
pushq $0x2
popq %rax
movq %rsi, %rdi
movl %eax, %esi
callq 0x9ad3
jmp 0x9bee
ucomisd 0x2ce1(%rip), %xmm2     # 0xc880
jb 0x9c04
movsd 0x2cdf(%rip), %xmm0     # 0xc888
ucomisd %xmm2, %xmm0
jb 0x9c04
movq %rdi, %r14
cvtsi2sdl 0x28(%rdi), %xmm0
subsd %xmm2, %xmm0
andpd 0x2cfd(%rip), %xmm0     # 0xc8c0
movsd 0x2cc5(%rip), %xmm1     # 0xc890
ucomisd %xmm0, %xmm1
jb 0x9c04
testq %rsi, %rsi
je 0x9c1d
pushq $0x15
popq %rax
movq %rsi, %rdi
movl %eax, %esi
callq 0x9ad3
jmp 0x9c26
pushq $0x2
popq %rdi
callq *0x8732(%rip)           # 0x12320
movq %rax, %rbx
testq %rax, %rax
je 0x9ca5
movw $0x30, (%rbx)
jmp 0x9cdf
movapd %xmm2, (%rsp)
testq %rsi, %rsi
je 0x9c48
pushq $0x40
popq %rax
movq %rsi, %rdi
movl %eax, %esi
callq 0x9ad3
jmp 0x9c51
pushq $0x15
popq %rdi
callq *0x86fa(%rip)           # 0x12320
movq %rax, %rbx
testq %rax, %rax
je 0x9ca5
movl 0x28(%r14), %edx
leaq 0x2d1e(%rip), %rsi      # 0xc957
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3080
jmp 0x9cdf
pushq $0x40
popq %rdi
callq *0x86cf(%rip)           # 0x12320
movq %rax, %rbx
testq %rax, %rax
movapd (%rsp), %xmm0
je 0x9ca5
callq 0x3540
movapd (%rsp), %xmm4
movapd 0x2c50(%rip), %xmm2     # 0xc8c0
movapd %xmm4, %xmm1
andpd %xmm2, %xmm1
movsd 0x2c18(%rip), %xmm3     # 0xc898
ucomisd %xmm1, %xmm3
jbe 0x9ca9
subsd %xmm4, %xmm0
andpd %xmm2, %xmm0
movsd 0x2bfa(%rip), %xmm2     # 0xc890
ucomisd %xmm0, %xmm2
jb 0x9ca9
leaq 0x2cb7(%rip), %rsi      # 0xc95a
jmp 0x9cd1
xorl %ebx, %ebx
jmp 0x9cdf
movsd 0x2bef(%rip), %xmm0     # 0xc8a0
ucomisd %xmm1, %xmm0
ja 0x9cca
ucomisd 0x2be9(%rip), %xmm1     # 0xc8a8
ja 0x9cca
leaq 0x2c9a(%rip), %rsi      # 0xc962
jmp 0x9cd1
leaq 0x2c8e(%rip), %rsi      # 0xc95f
movq %rbx, %rdi
movapd %xmm4, %xmm0
movb $0x1, %al
callq 0x3080
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/fgheng[P]keysound/src/main.cc
// Function: kill_exists_process()
static void kill_exists_process() {
    static std::string cmd =
        std::string("ps ax | grep ") +
        program_invocation_short_name +
        " | grep -v grep";

    pid_t pid = 0;

    FILE *tmp = fopen(PID_FILE, "r");

    // 文件存在，读取文件		If the file exists, read the file
    if (tmp != NULL && fscanf(tmp, "%d", &pid) ==1) {
        fclose(tmp);
    } else {
        // 文件不存在，使用命令获取	File does not exist, use command to get
        // 成功获取pid			the PID successfully
        sscanf(execute(cmd).c_str(), "%d", &pid);
    }

    if (pid > 0 && pid != getpid() /*&& pid_is_real(pid)*/) {
        kill(pid, SIGINT);
        remove(PID_FILE);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x78, %rsp
movb 0xa024(%rip), %al       # 0x14c98
testb %al, %al
je 0xad8c
andl $0x0, 0xc(%rsp)
leaq 0x1f24(%rip), %rdi      # 0xcbac
leaq 0x15ac(%rip), %rsi      # 0xc23b
callq 0x3390
testq %rax, %rax
je 0xacc4
movq %rax, %rbx
leaq 0x1cb4(%rip), %rsi      # 0xc957
leaq 0xc(%rsp), %rdx
movq %rax, %rdi
xorl %eax, %eax
callq 0x35b0
cmpl $0x1, %eax
jne 0xacc4
movq %rbx, %rdi
callq 0x3320
jmp 0xad58
movq 0x9fad(%rip), %rdi      # 0x14c78
leaq 0x1569(%rip), %rsi      # 0xc23b
callq 0x3100
movq %rax, %rbx
leaq 0x1c8e(%rip), %rsi      # 0xc96f
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x6efa
testq %rbx, %rbx
je 0xad35
leaq 0x30(%rsp), %r14
pushq $0x40
popq %rbp
leaq 0x10(%rsp), %r15
movq %rbx, %rdi
callq 0x34b0
testl %eax, %eax
jne 0xad2d
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x34c0
testq %rax, %rax
je 0xad02
movq %r15, %rdi
movq %r14, %rsi
callq 0x35c0
jmp 0xad02
movq %rbx, %rdi
callq 0x3430
leaq 0x10(%rsp), %rbx
movq (%rbx), %rdi
leaq 0x1c13(%rip), %rsi      # 0xc957
leaq 0xc(%rsp), %rdx
xorl %eax, %eax
callq 0x3300
movq %rbx, %rdi
callq 0x3618
movl 0xc(%rsp), %ebx
testl %ebx, %ebx
jle 0xad81
callq 0x3480
cmpl %eax, %ebx
je 0xad81
movl 0xc(%rsp), %edi
pushq $0x2
popq %rsi
callq 0x3440
leaq 0x1e30(%rip), %rdi      # 0xcbac
callq 0x3590
addq $0x78, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9f05(%rip), %rdi      # 0x14c98
callq 0x35a0
testl %eax, %eax
je 0xac7c
leaq 0x1de7(%rip), %rsi      # 0xcb8e
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x6efa
movq 0x7213(%rip), %rax      # 0x11fd0
movq (%rax), %rdx
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x6e83
leaq 0x9ea2(%rip), %rdi      # 0x14c78
leaq 0x1dbf(%rip), %rdx      # 0xcb9c
leaq 0x30(%rsp), %rsi
callq 0x6e83
leaq 0x30(%rsp), %rdi
callq 0x3618
movq 0x71a0(%rip), %rbx      # 0x11f98
leaq 0x10(%rsp), %rdi
callq 0x3618
leaq 0x9e6f(%rip), %rsi      # 0x14c78
leaq 0x7500(%rip), %rdx      # 0x12310
movq %rbx, %rdi
callq 0x3290
leaq 0x9e79(%rip), %rdi      # 0x14c98
callq 0x31e0
jmp 0xac7c
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x3618
jmp 0xae3b
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x3618
jmp 0xae4a
movq %rax, %rbx
leaq 0x9e47(%rip), %rdi      # 0x14c98
callq 0x31d0
jmp 0xae65
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x3618
movq %rbx, %rdi
callq 0x3570
// File: /workspace/github_cpp_makefile_star2_O2/fgheng[P]keysound/./include/usage.hpp
// Function: usage()
static void usage()
{
    std::cout   << "Usage: keysound [OPTION]...\n"
                << "Play sound while pressed keyboard keys.\n"
                << "\n"
                << "  -f, --file=WAV_FILE        play sound use FILE\n"
                << "  -j, --json=JSON_FILE       config keyboard sound by json\n"
                << "  -d, --dir=DIR              config keyboard sound by direction\n"
                << "  -l, --log=LOG_FILE         log file (not implemented)\n"
                << "  -D, --daemon               run in background\n"
                << "  -k, --kill                 stop all\n"
                << "  -?, -h, --help             help\n";
}

// Assembly:
pushq %rax
movq 0x7143(%rip), %rdi      # 0x11fb8
leaq 0x1b6a(%rip), %rsi      # 0xc9e6
callq 0x3310
leaq 0x1b7b(%rip), %rsi      # 0xca03
movq %rax, %rdi
callq 0x3310
leaq 0x1c7b(%rip), %rsi      # 0xcb12
movq %rax, %rdi
callq 0x3310
leaq 0x1b86(%rip), %rsi      # 0xca2c
movq %rax, %rdi
callq 0x3310
leaq 0x1ba9(%rip), %rsi      # 0xca5e
movq %rax, %rdi
callq 0x3310
leaq 0x1bd6(%rip), %rsi      # 0xca9a
movq %rax, %rdi
callq 0x3310
leaq 0x1c08(%rip), %rsi      # 0xcadb
movq %rax, %rdi
callq 0x3310
leaq 0x1c32(%rip), %rsi      # 0xcb14
movq %rax, %rdi
callq 0x3310
leaq 0x1c53(%rip), %rsi      # 0xcb44
movq %rax, %rdi
callq 0x3310
leaq 0x1c6b(%rip), %rsi      # 0xcb6b
movq %rax, %rdi
popq %rax
jmp 0x3310
// File: /workspace/github_cpp_makefile_star2_O2/fgheng[P]keysound/src/main.cc
// Function: signal_handler(int)
static void signal_handler(int signal) {
    stop_detect();
    stop_play();

    // 删除文件		Delete Files
    post_process();
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
callq 0x750c
callq 0x8638
andl $0x0, 0xc(%rsp)
leaq 0x1c88(%rip), %rdi      # 0xcbac
leaq 0x1310(%rip), %rsi      # 0xc23b
callq 0x3390
testq %rax, %rax
je 0xaf74
movq %rax, %rbx
leaq 0x1a18(%rip), %rsi      # 0xc957
leaq 0xc(%rsp), %rdx
movq %rax, %rdi
xorl %eax, %eax
callq 0x35b0
cmpl $0x1, %eax
jne 0xaf74
movq %rbx, %rdi
callq 0x3320
movl 0xc(%rsp), %ebx
callq 0x3480
cmpl %eax, %ebx
jne 0xaf74
leaq 0x1c3d(%rip), %rdi      # 0xcbac
callq 0x3590
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/fgheng[P]keysound/src/utils.cc
// Function: add_event_id(int)
void add_event_id(int event_id) {
    if (event_id > FILE_NUMS) {
        std::cout << "add error file is lager" << std::endl;
        return;
    }
    mtx.lock();
    key_detects_bool[event_id] = true;
    mtx.unlock();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x401, %edi            # imm = 0x401
jl 0xb1e9
movq 0x6dea(%rip), %rdi      # 0x11fb8
leaq 0x1ac3(%rip), %rsi      # 0xcc98
callq 0x3310
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3180
movl %edi, %ebx
leaq 0x9eee(%rip), %r14      # 0x150e0
movq %r14, %rdi
callq 0x85fc
movslq %ebx, %rax
leaq 0x9adc(%rip), %rcx      # 0x14ce0
movb $0x1, (%rax,%rcx)
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3260
// File: /workspace/github_cpp_makefile_star2_O2/fgheng[P]keysound/src/utils.cc
// Function: del_event_id(int)
void del_event_id(int event_id) {
    if (event_id > FILE_NUMS) {
        std::cout << "delete error file is lager" << std::endl;
        return;
    }
    mtx.lock();
    key_detects_bool[event_id] = false;
    mtx.unlock();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x401, %edi            # imm = 0x401
jl 0xb245
movq 0x6d8e(%rip), %rdi      # 0x11fb8
leaq 0x1a7f(%rip), %rsi      # 0xccb0
callq 0x3310
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3180
movl %edi, %ebx
leaq 0x9e92(%rip), %r14      # 0x150e0
movq %r14, %rdi
callq 0x85fc
movslq %ebx, %rax
leaq 0x9a80(%rip), %rcx      # 0x14ce0
movb $0x0, (%rax,%rcx)
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3260
// File: /workspace/github_cpp_makefile_star2_O2/fgheng[P]keysound/src/utils.cc
// Function: event_id_exists(int)
bool event_id_exists(int event_id) {
    if (event_id > FILE_NUMS) {
        std::cout << "file is lager" << std::endl;
        return false;
    }
    return key_detects_bool[event_id];
}

// Assembly:
cmpl $0x401, %edi            # imm = 0x401
jl 0xb29e
pushq %rax
movq 0x6d35(%rip), %rdi      # 0x11fb8
leaq 0x1a18(%rip), %rsi      # 0xcca2
callq 0x3310
movq %rax, %rdi
callq 0x3180
xorl %eax, %eax
addq $0x8, %rsp
retq
movslq %edi, %rax
leaq 0x9a38(%rip), %rcx      # 0x14ce0
cmpb $0x0, (%rax,%rcx)
setne %al
retq
// File: /workspace/github_cpp_makefile_star2_O2/fgheng[P]keysound/src/utils.cc
// Function: clear_all_key_detect_threads()
void clear_all_key_detect_threads() {
    mtx.lock();
    // std::memset(key_detects_bool, 0, FILE_NUMS);
    // key_detects.erase(key_detects.begin(), key_detects.end());
    key_detects.clear();
    mtx.unlock();
}

// Assembly:
pushq %rbx
leaq 0x9e1e(%rip), %rbx      # 0x150e0
movq %rbx, %rdi
callq 0x85fc
leaq 0x99d7(%rip), %rdi      # 0x14ca8
callq 0xb90c
movq %rbx, %rdi
popq %rbx
jmp 0x3260
// File: /workspace/github_cpp_makefile_star2_O2/aydarbiktimirov[P]data-structures/src/include/persistent-data-structure.cpp
// Function: CAbstractPersistentDataStructure::SetVersion(unsigned long)
CAbstractPersistentDataStructure &CAbstractPersistentDataStructure::SetVersion(size_t version)
{
	if (version >= version_count)
	{
		throw std::out_of_range("version out of bounds");
	}

	current_version = version;
	return *this;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpq %rsi, 0x8(%rdi)
jbe 0x232d
movq %rsi, 0x10(%rdi)
movq %rdi, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
pushq $0x10
popq %rdi
callq 0x20a0
movq %rax, %rbx
leaq 0x1cc5(%rip), %rsi      # 0x4004
movq %rax, %rdi
callq 0x2030
movq 0x4c82(%rip), %rsi      # 0x6fd0
movq 0x4c73(%rip), %rdx      # 0x6fc8
movq %rbx, %rdi
callq 0x21a0
movq %rax, %r14
movq %rbx, %rdi
callq 0x20f0
movq %r14, %rdi
callq 0x21c0
// File: /workspace/github_cpp_makefile_star2_O2/aydarbiktimirov[P]data-structures/src/include/persistent-segment-tree.h
// Function: void CPersistentSegmentTree<int, std::plus<int>>::BuildTree<__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>>(unsigned long, unsigned long, __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>&, __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>)
void CPersistentSegmentTree<T, Operation>::BuildTree(size_t current, size_t current_depth_count, InputIterator &from, InputIterator to)
{ // построение поддерева, аналогично построению в эфемерном дереве отрезков
	values.resize(std::max(values.size(), current + 1));

	if (current_depth_count >= element_count)
	{
		if (values_first_index == (size_t)-1)
		{
			values_first_index = current;
		}

		if (from != to)
		{
			values[current] = CNode(*(from++));
		} else {
			values[current] = CNode(default_value);
		}
	} else {
		size_t left = 2 * current + 1;
		size_t right = 2 * current + 2;

		BuildTree(left, current_depth_count * 2, from, to);
		BuildTree(right, current_depth_count * 2, from, to);

		values[current] = CNode(Operation()(values[left].value, values[right].value), left, right);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r12
movq %rcx, %r15
movq %rdx, %r13
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x30(%rdi), %rbp
movq 0x38(%rdi), %rax
subq 0x30(%rdi), %rax
pushq $0x18
popq %rcx
cqto
idivq %rcx
incq %rsi
cmpq %rsi, %rax
cmovaq %rax, %rsi
movq %rbp, %rdi
callq 0x2d5e
cmpq %r13, 0x20(%r14)
jbe 0x2c5d
leaq 0x1(,%rbx,2), %rbp
movq %r12, %r8
movq %r12, (%rsp)
leaq 0x2(,%rbx,2), %r12
addq %r13, %r13
movq %r14, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0x2bb2
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %r15, %rcx
movq (%rsp), %r8
callq 0x2bb2
movq 0x30(%r14), %rax
imulq $0x18, %rbp, %rcx
imulq $0x18, %r12, %rdx
movl (%rax,%rdx), %edx
addl (%rax,%rcx), %edx
imulq $0x18, %rbx, %rcx
movl %edx, (%rax,%rcx)
movq %rbp, 0x8(%rax,%rcx)
movq %r12, 0x10(%rax,%rcx)
jmp 0x2c98
cmpq $-0x1, 0x28(%r14)
jne 0x2c68
movq %rbx, 0x28(%r14)
movq (%r15), %rax
cmpq %r12, %rax
je 0x2c7f
leaq 0x4(%rax), %rcx
movq %rcx, (%r15)
movl (%rax), %eax
movq (%rbp), %rcx
jmp 0x2c87
movl 0x60(%r14), %eax
movq 0x30(%r14), %rcx
imulq $0x18, %rbx, %rdx
movl %eax, (%rcx,%rdx)
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, 0x8(%rcx,%rdx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/aydarbiktimirov[P]data-structures/src/include/persistent-segment-tree.h
// Function: CPersistentSegmentTree<int, std::plus<int>>::operator()(unsigned long, unsigned long, unsigned long) const
T CPersistentSegmentTree<T, Operation>::operator()(size_t left, size_t right, size_t version) const
{
	if (version >= this->GetVersionCount())
	{
		throw std::out_of_range("version doesn't exist");
	}
	if (left > right)
	{
		return operator()(right, left);
	}
	if (right >= element_count)
	{
		throw std::out_of_range("index out of bounds");
	}

	return Calculate(left, right, roots[version], 0, values_first_index);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r12
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq (%rdi), %rax
callq *0x18(%rax)
cmpq %r12, %rax
jbe 0x2fcd
cmpq %rbx, %r14
jbe 0x2f9f
movq (%r15), %rax
movq 0x30(%rax), %rax
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmpq *%rax
cmpq %rbx, 0x20(%r15)
jbe 0x2fe9
movq 0x28(%r15), %r9
movq 0x48(%r15), %rax
movq (%rax,%r12,8), %rcx
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
xorl %r8d, %r8d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x302e
pushq $0x10
popq %rdi
callq 0x20a0
movq %rax, %rbx
leaq 0x122f(%rip), %rsi      # 0x420e
movq %rax, %rdi
callq 0x2030
jmp 0x3003
pushq $0x10
popq %rdi
callq 0x20a0
movq %rax, %rbx
leaq 0x1229(%rip), %rsi      # 0x4224
movq %rax, %rdi
callq 0x2030
movq 0x3fc6(%rip), %rsi      # 0x6fd0
movq 0x3fb7(%rip), %rdx      # 0x6fc8
movq %rbx, %rdi
callq 0x21a0
jmp 0x301b
movq %rax, %r14
movq %rbx, %rdi
callq 0x20f0
movq %r14, %rdi
callq 0x21c0
// File: /workspace/github_cpp_makefile_star2_O2/aydarbiktimirov[P]data-structures/src/include/persistent-segment-tree.h
// Function: CPersistentSegmentTree<int, std::plus<int>>::Calculate(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long) const
T CPersistentSegmentTree<T, Operation>::Calculate(size_t from, size_t to, size_t current, size_t left_bound, size_t right_bound) const
{ // сумма элементов между left_bound и right_bound хранится в элемнете current
	if (from > to)
	{
		return default_value;
	}
	if (from == left_bound && to == right_bound)
	{
		return values[current].value;
	}
	size_t middle_bound = (left_bound + right_bound) / 2;
	return Operation()(Calculate(from, std::min(to, middle_bound), values[current].left, left_bound, middle_bound),
		Calculate(std::max(middle_bound + 1, from), to, values[current].right, middle_bound + 1, right_bound));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, (%rsp)
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %r14
xorl %r15d, %r15d
cmpq %r12, %r13
ja 0x30a4
cmpq (%rsp), %r12
jne 0x3059
cmpq %r8, %r13
je 0x30aa
movq (%rsp), %rax
leaq (%r8,%rax), %rbp
shrq %rbp
cmpq %r12, %rbp
movq %r12, %rdx
cmovbq %rbp, %rdx
movq 0x30(%r14), %rax
imulq $0x18, %rcx, %rbx
movq 0x8(%rax,%rbx), %rcx
movq %r14, %rdi
movq %r13, %rsi
movq %rbp, %r9
callq 0x302e
incq %rbp
cmpq %r13, %rbp
cmovaq %rbp, %r13
movq 0x30(%r14), %rcx
movq 0x10(%rcx,%rbx), %rcx
addl %eax, %r15d
movq %rbp, %r8
jmp 0x3049
addq $0x60, %r14
jmp 0x30b5
imulq $0x18, %rcx, %rax
addq 0x30(%r14), %rax
movq %rax, %r14
addl (%r14), %r15d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/aydarbiktimirov[P]data-structures/src/include/persistent-segment-tree.h
// Function: CPersistentSegmentTree<int, std::plus<int>>::AddBranch(unsigned long, int const&, unsigned long, unsigned long, unsigned long, unsigned long)
void CPersistentSegmentTree<T, Operation>::AddBranch(size_t changed_position, const T &changed_value, size_t previous, size_t current_depth_count, size_t left_bound, size_t right_bound)
{ // добавление новой ветки рекурсивно сверху вниз
	size_t new_node = values.size();
	values.push_back(CNode());

	if (current_depth_count >= element_count)
	{ // добрались до листа
		values[new_node] = CNode(changed_value);
	} else {
		size_t middle_bound = (left_bound + right_bound) / 2; // добавляем поддеревья в зависимости от того, которое из поддеревьев изменилось
		if (changed_position <= middle_bound)
		{
			values[new_node].left = values.size();
			values[new_node].right = values[previous].right;
			AddBranch(changed_position, changed_value, values[previous].left, 2 * current_depth_count, left_bound, middle_bound);
		} else {
			values[new_node].left = values[previous].left;
			values[new_node].right = values.size();
			AddBranch(changed_position, changed_value, values[previous].right, 2 * current_depth_count, middle_bound + 1, right_bound);
		}

		values[new_node].value = Operation()(values[values[new_node].left].value, values[values[new_node].right].value); // вычисление значения для новой вершины
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, 0x18(%rsp)
movq %r8, %r14
movq %rcx, 0x10(%rsp)
movq %rdx, %r15
movq %rdi, %r12
movq 0x38(%rdi), %rbp
subq 0x30(%rdi), %rbp
leaq 0x20(%rsp), %rax
andl $0x0, (%rax)
movq %rsi, %rbx
leaq 0x30(%rdi), %r13
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, 0x8(%rax)
movq %r13, %rdi
movq %rax, %rsi
callq 0x3342
cmpq %r14, 0x20(%r12)
jbe 0x317e
movq %r15, %r10
movq 0x70(%rsp), %r15
movq 0x18(%rsp), %r11
leaq (%r15,%r11), %r9
shrq %r9
addq %r14, %r14
cmpq %rbx, %r9
jae 0x3194
movq 0x30(%r12), %rcx
imulq $0x18, 0x10(%rsp), %rdi
movq 0x8(%rcx,%rdi), %rax
movq %rax, 0x8(%rcx,%rbp)
movq 0x38(%r12), %rax
subq %rcx, %rax
pushq $0x18
popq %r8
cqto
idivq %r8
movq %rax, 0x10(%rcx,%rbp)
movq 0x10(%rcx,%rdi), %rcx
incq %r9
movq %r15, (%rsp)
movq %r12, %rdi
movq %rbx, %rsi
movq %r10, %rdx
movq %r14, %r8
jmp 0x31d6
movl (%r15), %eax
movq (%r13), %rcx
movl %eax, (%rcx,%rbp)
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, 0x8(%rcx,%rbp)
jmp 0x31f4
movq 0x30(%r12), %rcx
movq 0x38(%r12), %rax
subq %rcx, %rax
pushq $0x18
popq %rdi
cqto
idivq %rdi
movq %rax, 0x8(%rcx,%rbp)
imulq $0x18, 0x10(%rsp), %rax
movq 0x10(%rcx,%rax), %rdx
movq %rdx, 0x10(%rcx,%rbp)
movq 0x8(%rcx,%rax), %rcx
movq %r9, (%rsp)
movq %r12, %rdi
movq %rbx, %rsi
movq %r10, %rdx
movq %r14, %r8
movq %r11, %r9
callq 0x30ca
movq (%r13), %rax
imulq $0x18, 0x8(%rax,%rbp), %rcx
imulq $0x18, 0x10(%rax,%rbp), %rdx
movl (%rax,%rdx), %edx
addl (%rax,%rcx), %edx
movl %edx, (%rax,%rbp)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/apps/sflprocess/sflprocess.cpp
// Function: FindClosestLeafNode(gaps::R3SurfelTree*, gaps::R3Point const&, double)
R3SurfelNode *
FindClosestLeafNode(R3SurfelTree *tree, const R3Point& query_position, RNLength max_distance)
{
  // Find closest node
  R3SurfelNode *closest_node = NULL;
  RNLength closest_distance = max_distance;
  RNVolume closest_volume = FLT_MAX;
  for (int i = 0; i < tree->NNodes(); i++) {
    R3SurfelNode *node = tree->Node(i);
    if (node->NParts() > 0) continue;
    RNLength distance = R3Distance(node->BBox(), query_position);
    if (distance <= closest_distance) {
      RNVolume volume = node->BBox().Volume();
      if ((distance < closest_distance) || (volume < closest_volume)) {
        closest_distance = distance;
        closest_volume = volume;
        closest_node = node;
      }
    }
  }

  // Return closest node
  return closest_node;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x30, %rsp
movapd %xmm0, %xmm1
movq %rsi, %rbx
movq %rdi, %r14
movsd 0xd483d(%rip), %xmm0    # 0xec008
xorl %r13d, %r13d
xorl %r15d, %r15d
movslq 0x24(%r14), %rax
cmpq %rax, %r13
jge 0x17881
movq 0x18(%r14), %rax
movq (%rax,%r13,8), %r12
cmpl $0x0, 0x3c(%r12)
jg 0x17879
movapd %xmm0, (%rsp)
movq %r12, %rdi
movapd %xmm1, 0x10(%rsp)
callq 0x34be4
movq %rbx, %rdi
movq %rax, %rsi
callq 0x5ebcf
movapd 0x10(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jae 0x17823
movapd (%rsp), %xmm0
jmp 0x17879
movq %r12, %rdi
movapd %xmm0, 0x20(%rsp)
callq 0x34be4
movq (%rax), %rcx
movq %rax, %rdi
callq *0x60(%rcx)
movapd 0x20(%rsp), %xmm5
movapd 0x10(%rsp), %xmm3
movapd %xmm5, %xmm1
cmpltpd %xmm3, %xmm1
movapd %xmm0, %xmm2
movapd (%rsp), %xmm4
cmpltpd %xmm4, %xmm2
orpd %xmm1, %xmm2
movd %xmm2, %eax
testb $0x1, %al
jne 0x17871
movapd %xmm4, %xmm0
movapd %xmm3, %xmm5
cmovneq %r12, %r15
movapd %xmm5, %xmm1
incq %r13
jmp 0x177d1
movq %r15, %rax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/apps/sflprocess/sflprocess.cpp
// Function: CheckForArgument(int, char**, char const*)
static int 
CheckForArgument(int argc, char **argv, const char *argument)
{
  // Check for -v in program arguments
  for (int i = 1; i < argc; i++) 
    if (!strcmp(argv[i], argument)) return 1;
  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movslq %edi, %r15
pushq $0x1
popq %rcx
movq %rcx, %r12
cmpq %r15, %rcx
jge 0x1c8da
movq (%r14,%r12,8), %rdi
movq %rbx, %rsi
callq 0x158e0
leaq 0x1(%r12), %rcx
testl %eax, %eax
jne 0x1c8bd
xorl %eax, %eax
cmpq %r15, %r12
setl %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/apps/sflprocess/sflprocess.cpp
// Function: Transform(gaps::R3SurfelScene*, gaps::R3Affine const&)
static int
Transform(R3SurfelScene *scene, const R3Affine& transformation)
{
  // Start statistics
  RNTime start_time;
  start_time.Read();

  // Transform scene
  // (actually change xyz of surfels, not just update scene transformation)
  scene->Transform(transformation, TRUE);

  // Print statistics
  if (print_verbose) {
    const R4Matrix& m = transformation.Matrix();
    printf("Tranformed scene ...\n");
    printf("  Time = %.2f seconds\n", start_time.Elapsed());
    printf("  Matrix = %12.6f %12.6f %12.6f %12.6f\n", m[0][0], m[0][1], m[0][2], m[0][3]); 
    printf("           %12.6f %12.6f %12.6f %12.6f\n", m[1][0], m[1][1], m[1][2], m[1][3]); 
    printf("           %12.6f %12.6f %12.6f %12.6f\n", m[2][0], m[2][1], m[2][2], m[2][3]); 
    printf("           %12.6f %12.6f %12.6f %12.6f\n", m[3][0], m[3][1], m[3][2], m[3][3]); 
    fflush(stdout);
  }

  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq %rsp, %r15
movq %r15, %rdi
callq 0xaf4d6
movq %r15, %rdi
callq 0x1d806
pushq $0x1
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3dc2e
cmpl $0x0, 0x13cf43(%rip)    # 0x159ddc
je 0x1cf56
leaq 0xcffc0(%rip), %rdi     # 0xece66
callq 0x15990
movq %rsp, %rdi
callq 0xaf510
leaq 0xcf6e7(%rip), %rdi     # 0xec5a1
movb $0x1, %al
callq 0x15080
movsd 0x8(%rbx), %xmm0
movsd 0x10(%rbx), %xmm1
movsd 0x18(%rbx), %xmm2
movsd 0x20(%rbx), %xmm3
leaq 0xcfc78(%rip), %rdi     # 0xecb54
movb $0x4, %al
callq 0x15080
movsd 0x28(%rbx), %xmm0
movsd 0x30(%rbx), %xmm1
movsd 0x38(%rbx), %xmm2
movsd 0x40(%rbx), %xmm3
leaq 0xcfc7e(%rip), %r14     # 0xecb7c
movq %r14, %rdi
movb $0x4, %al
callq 0x15080
movsd 0x48(%rbx), %xmm0
movsd 0x50(%rbx), %xmm1
movsd 0x58(%rbx), %xmm2
movsd 0x60(%rbx), %xmm3
movq %r14, %rdi
movb $0x4, %al
callq 0x15080
movsd 0x68(%rbx), %xmm0
movsd 0x70(%rbx), %xmm1
movsd 0x78(%rbx), %xmm2
movsd 0x80(%rbx), %xmm3
movq %r14, %rdi
movb $0x4, %al
callq 0x15080
movq 0x13c032(%rip), %rax    # 0x158f80
movq (%rax), %rdi
callq 0x15750
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/atsidaev[P]trx2x/./utils.h
// Function: make_uppercase(char*)
inline void make_uppercase(char* str) {
	while (*str != 0) {
		if (*str >= 'a' && *str <= 'z')
			*str -= 'a' - 'A';
		str++;
	}
}

// Assembly:
movb (%rdi), %al
testb %al, %al
je 0x186c
leal -0x61(%rax), %ecx
cmpb $0x19, %cl
ja 0x1867
addb $-0x20, %al
movb %al, (%rdi)
incq %rdi
jmp 0x1855
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/atsidaev[P]trx2x/DiskImage.cpp
// Function: CalcCRC32(int, unsigned char)
int32_t CalcCRC32(int32_t CRC, unsigned char Symbol)
{
   int32_t temp;
   CRC ^= -1l ^ Symbol;
   for(int k = 8; k--;) 
      { temp = -(CRC & 1), CRC >>= 1, CRC ^= 0xEDB88320ul & temp; }
   CRC ^= -1l;
   return CRC;
}

// Assembly:
movl %edi, %eax
xorl %esi, %eax
notl %eax
pushq $-0x8
popq %rcx
testl %ecx, %ecx
je 0x1892
movl %eax, %edx
andl $0x1, %edx
negl %edx
sarl %eax
andl $0xedb88320, %edx       # imm = 0xEDB88320
xorl %edx, %eax
incl %ecx
jmp 0x1879
notl %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/atsidaev[P]trx2x/DiskImage.cpp
// Function: TDiskImage::TDiskImage()
TDiskImage::TDiskImage()
{
   AddBOOT = false;

   for(int t=0; t < 256; t++)
      for(int s=0; s < 256; s++)
      {
         FTrackLength[t][s] = 0;
         FTracksPtr[t][s][0] = NULL;
         FTracksPtr[t][s][1] = NULL;
      }

   DiskPresent = false;
   ReadOnly = true;
   Changed = false;
   FType = DIT_UNK;
   MaxTrack = 81;
   MaxSide = 0x01;
}

// Assembly:
movb $0x0, 0x145009(%rdi)
leaq 0x40000(%rdi), %rax
xorl %ecx, %ecx
xorps %xmm0, %xmm0
movq %rdi, %rdx
cmpq $0x100, %rcx            # imm = 0x100
je 0x18e0
xorl %esi, %esi
cmpq $0x400, %rsi            # imm = 0x400
je 0x18ce
andl $0x0, (%rdx,%rsi)
movups %xmm0, (%rax,%rsi,4)
addq $0x4, %rsi
jmp 0x18b7
incq %rcx
addq $0x400, %rdx            # imm = 0x400
addq $0x1000, %rax           # imm = 0x1000
jmp 0x18ac
movl $0x51000100, 0x145004(%rdi) # imm = 0x51000100
andl $0x0, 0x141000(%rdi)
movb $0x1, 0x145008(%rdi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/atsidaev[P]trx2x/DiskImage.cpp
// Function: TDiskImage::~TDiskImage()
TDiskImage::~TDiskImage()
{
   FlushImage();
   ReadOnly = true;
   DiskPresent = false;
   Changed = false;
   FType = DIT_UNK;

   for(int t=0; t < 256; t++)
      for(int s=0; s < 256; s++)
      {
         FTrackLength[t][s] = 0;
         if(FTracksPtr[t][s][0]) delete FTracksPtr[t][s][0];
         FTracksPtr[t][s][0] = NULL;
         if(FTracksPtr[t][s][1]) delete FTracksPtr[t][s][1];
         FTracksPtr[t][s][1] = NULL;
      }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
callq 0x19a4
movb $0x0, 0x145006(%rbx)
movw $0x100, 0x145004(%rbx)  # imm = 0x100
andl $0x0, 0x141000(%rbx)
leaq 0x40008(%rbx), %r15
xorl %r12d, %r12d
pushq $0x1
popq %r14
cmpq $0x100, %r12            # imm = 0x100
je 0x1991
xorl %r13d, %r13d
cmpq $0x400, %r13            # imm = 0x400
je 0x197e
andl $0x0, (%rbx,%r13)
movq -0x8(%r15,%r13,4), %rdi
testq %rdi, %rdi
je 0x195c
movq %r14, %rsi
callq 0x1140
andq $0x0, -0x8(%r15,%r13,4)
movq (%r15,%r13,4), %rdi
testq %rdi, %rdi
je 0x1973
movq %r14, %rsi
callq 0x1140
andq $0x0, (%r15,%r13,4)
addq $0x4, %r13
jmp 0x193c
incq %r12
addq $0x400, %rbx            # imm = 0x400
addq $0x1000, %r15           # imm = 0x1000
jmp 0x1930
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rdi
callq 0x6dab
nop
// File: /workspace/github_cpp_makefile_star2_O2/atsidaev[P]trx2x/DiskImage.cpp
// Function: TDiskImage::FlushImage()
void TDiskImage::FlushImage()
{
   if(ReadOnly) return;
   if(!Changed) return;
   if(FType==DIT_HOB) return;

   int hfile = open((char*)FFileName, O_CREAT | O_RDWR | O_TRUNC | O_BINARY, 0666);
   if(hfile < 0)
   {
      ShowError(ERR_CANTWRITE);
      return;
   }

   if(FType==DIT_TRD) writeTRD(hfile);
   if(FType==DIT_SCL) writeSCL(hfile);
   if(FType==DIT_FDI) writeFDI(hfile);
   if(FType==DIT_UDI) writeUDI(hfile);
   if(FType==DIT_TD0) writeTD0(hfile);
   if(FType==DIT_FDD) writeFDD(hfile);

   close(hfile);
   Changed = false;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
cmpb $0x0, 0x145005(%rdi)
jne 0x1a7f
movq %rdi, %rbx
cmpb $0x1, 0x145004(%rdi)
jne 0x1a7f
cmpl $0x6, 0x141000(%rbx)
je 0x1a7f
leaq 0x140000(%rbx), %rdi
movl $0x242, %esi            # imm = 0x242
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x10c0
testl %eax, %eax
js 0x1a86
movl %eax, %ebp
movl 0x141000(%rbx), %eax
cmpl $0x1, %eax
jne 0x1a0e
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2048
movl 0x141000(%rbx), %eax
cmpl $0x2, %eax
jne 0x1a23
movq %rbx, %rdi
movl %ebp, %esi
callq 0x225a
movl 0x141000(%rbx), %eax
cmpl $0x3, %eax
jne 0x1a38
movq %rbx, %rdi
movl %ebp, %esi
callq 0x27be
movl 0x141000(%rbx), %eax
cmpl $0x5, %eax
jne 0x1a4d
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2ad6
movl 0x141000(%rbx), %eax
cmpl $0x4, %eax
jne 0x1a62
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2d46
movl 0x141000(%rbx), %eax
cmpl $0x7, %eax
jne 0x1a71
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2fd2
movl %ebp, %edi
callq 0x1200
movb $0x0, 0x145004(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x5867(%rip), %rsi      # 0x72f4
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x201c
// File: /workspace/github_cpp_makefile_star2_O2/atsidaev[P]trx2x/DiskImage.cpp
// Function: TDiskImage::MakeVGCRC(unsigned char*, unsigned long)
unsigned short TDiskImage::MakeVGCRC(unsigned char *data, unsigned long length)
{
   unsigned short CRC = 0xFFFF;
   for(unsigned int i=0; i < length; i++)
   {
      CRC ^= data[i] << 8;
      for(unsigned int j=0; j < 8; j++)
      {
         if(CRC & 0x8000) CRC = (CRC << 1) ^ 0x1021;
         else CRC <<= 1;
      }
   }
   return CRC;          // H<-->L !!!
}

// Assembly:
xorl %ecx, %ecx
movw $0xffff, %ax            # imm = 0xFFFF
pushq $0x8
popq %rdi
movl %ecx, %ecx
cmpq %rdx, %rcx
jae 0x1adb
movzbl (%rsi,%rcx), %r8d
shll $0x8, %r8d
xorl %r8d, %eax
movl %edi, %r8d
subl $0x1, %r8d
jb 0x1ad7
leal (%rax,%rax), %r9d
movl %r9d, %r10d
xorl $0x1021, %r10d          # imm = 0x1021
testw %ax, %ax
cmovnsl %r9d, %r10d
movl %r10d, %eax
jmp 0x1ab7
incl %ecx
jmp 0x1aa1
retq
// File: /workspace/github_cpp_makefile_star2_O2/atsidaev[P]trx2x/DiskImage.cpp
// Function: TDiskImage::ApplySectorCRC(VGFIND_SECTOR)
void TDiskImage::ApplySectorCRC(VGFIND_SECTOR vgfs)
{
   unsigned char *TrackPtr = vgfs.vgfa.TrackPointer;
   unsigned int TrackLen = vgfs.vgfa.TrackLength;
   unsigned int len = vgfs.OffsetEndSector - vgfs.MarkedOffsetSector;
   if(vgfs.OffsetEndSector < vgfs.MarkedOffsetSector)
      len = (TrackLen-vgfs.MarkedOffsetSector)+vgfs.OffsetEndSector;

   unsigned int off1 = vgfs.MarkedOffsetSector;
   unsigned int len1 = TrackLen-vgfs.MarkedOffsetSector;
   if(len1 > len) len1 = len;
   unsigned int off2 = 0;
   unsigned int len2 = 0;
   if(len1 < len) len2 = len - len1;

   unsigned int i;
   unsigned short CRC = 0xFFFF;
   for(i=0; i < len1; i++)
   {
      CRC ^= TrackPtr[off1+i] << 8;
      for(unsigned int j=0; j < 8; j++)
      {
         if(CRC & 0x8000) CRC = (CRC << 1) ^ 0x1021;
         else CRC <<= 1;
      }
   }
   for(i=0; i < len2; i++)
   {
      CRC ^= TrackPtr[off2+i] << 8;
      for(unsigned int j=0; j < 8; j++)
      {
         if(CRC & 0x8000) CRC = (CRC << 1) ^ 0x1021;
         else CRC <<= 1;
      }
   }
   unsigned int crcoff = (off1+len1)%TrackLen;
   if(len2) crcoff = (off2+len2)%TrackLen;

   TrackPtr[crcoff] = (unsigned char)(CRC>>8);
   TrackPtr[(crcoff+1)%TrackLen] = (unsigned char)(CRC&0xFF);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
movq 0x28(%rsp), %rcx
movl 0x38(%rsp), %esi
movl 0x74(%rsp), %eax
movl 0x6c(%rsp), %edx
movl %esi, %r8d
subl %edx, %r8d
movl %edx, %r9d
negl %r9d
cmpl %edx, %eax
cmovbl %r8d, %r9d
addl %eax, %r9d
cmpl %r9d, %r8d
movl %r9d, %eax
cmovbl %r8d, %eax
movl %r9d, %edi
subl %eax, %edi
movw $0xffff, %bx            # imm = 0xFFFF
xorl %r10d, %r10d
movl $0x8, %r11d
cmpq %rax, %r10
je 0x1b5e
leal (%rdx,%r10), %r14d
movzbl (%rcx,%r14), %ebp
shll $0x8, %ebp
xorl %ebp, %ebx
movl %r11d, %ebp
subl $0x1, %ebp
jb 0x1b59
leal (%rbx,%rbx), %r14d
movl %r14d, %r15d
xorl $0x1021, %r15d          # imm = 0x1021
testw %bx, %bx
cmovnsl %r14d, %r15d
movl %r15d, %ebx
jmp 0x1b3a
incq %r10
jmp 0x1b24
xorl %r10d, %r10d
cmpl %r9d, %r8d
cmovael %r10d, %edi
movl $0x8, %r8d
cmpq %rdi, %r10
je 0x1ba5
movzbl (%rcx,%r10), %r9d
shll $0x8, %r9d
xorl %r9d, %ebx
movl %r8d, %r9d
subl $0x1, %r9d
jb 0x1ba0
leal (%rbx,%rbx), %r11d
movl %r11d, %ebp
xorl $0x1021, %ebp           # imm = 0x1021
testw %bx, %bx
cmovnsl %r11d, %ebp
movl %ebp, %ebx
jmp 0x1b82
incq %r10
jmp 0x1b6e
addl %edx, %eax
testq %rdi, %rdi
cmovnel %edi, %eax
xorl %edi, %edi
xorl %edx, %edx
divl %esi
movl %edx, %eax
movb %bh, (%rcx,%rax)
incl %edx
cmpl %esi, %edx
cmovel %edi, %edx
movb %bl, (%rcx,%rdx)
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/atsidaev[P]trx2x/DiskImage.cpp
// Function: TDiskImage::FindTrack(unsigned char, unsigned char, VGFIND_TRACK*)
bool TDiskImage::FindTrack(unsigned char CYL, unsigned char SIDE, VGFIND_TRACK *vgft)
{
   vgft->FoundTrack = false;
   vgft->TrackPointer = NULL;
   vgft->ClkPointer = NULL;
   vgft->TrackLength = 0;

   if( (!DiskPresent) | 
       ((CYL > MaxTrack)||(SIDE > MaxSide)) |
       ((!FTracksPtr[CYL][SIDE][0])||(!FTracksPtr[CYL][SIDE][1])) )
   {
      return false;           // ERROR: disk not ready
   }

   vgft->TrackPointer = FTracksPtr[CYL][SIDE][0];
   vgft->ClkPointer = FTracksPtr[CYL][SIDE][1];
   vgft->TrackLength = FTrackLength[CYL][SIDE];
   vgft->FoundTrack = true;
   return true;
}

// Assembly:
xorps %xmm0, %xmm0
movups %xmm0, (%rcx)
andq $0x0, 0xd(%rcx)
movzbl 0x145006(%rdi), %eax
xorl $0x1, %eax
cmpb %sil, 0x145007(%rdi)
setb %r8b
cmpb %dl, 0x145008(%rdi)
setb %r9b
orb %r8b, %r9b
movzbl %r9b, %r8d
orl %eax, %r8d
movl %esi, %eax
shll $0xc, %eax
addq %rdi, %rax
movl %edx, %r9d
shll $0x4, %r9d
addq %rax, %r9
addq $0x40000, %r9           # imm = 0x40000
movq (%r9), %r10
testq %r10, %r10
je 0x1fef
xorl %eax, %eax
cmpq $0x0, 0x8(%r9)
sete %al
jmp 0x1ff2
pushq $0x1
popq %rax
orl %r8d, %eax
jne 0x2016
movl %esi, %esi
movl %edx, %edx
movq %r10, (%rcx)
movq 0x8(%r9), %r8
movq %r8, 0x8(%rcx)
shll $0xa, %esi
addq %rsi, %rdi
movl (%rdi,%rdx,4), %edx
movl %edx, 0x10(%rcx)
movb $0x1, 0x14(%rcx)
testl %eax, %eax
sete %al
retq
// File: /workspace/github_cpp_makefile_star2_O2/atsidaev[P]trx2x/DiskImage.cpp
// Function: TD0CRC(unsigned char*, unsigned int)
unsigned short TD0CRC(unsigned char *buf, unsigned int len)
{
   unsigned short CRC = 0;
   int j;
   for(unsigned int i=0; i < len; i++)
   {
      CRC ^= *buf++;
      j = CRC & 0xFF;
      CRC &= 0xFF00;
      CRC = (CRC<<8)|(CRC>>8);
      CRC ^= ((unsigned short*)tbltd0crc)[ j ];
   }
   return (CRC<<8)|(CRC>>8);
}

// Assembly:
movl %esi, %ecx
xorl %edx, %edx
leaq 0x3d41(%rip), %rsi      # 0xa1d0
xorl %eax, %eax
cmpl %edx, %ecx
je 0x64b0
movzwl %ax, %eax
movb (%rdi,%rdx), %r8b
xorb %al, %r8b
shrl $0x8, %eax
movzbl %r8b, %r8d
xorw (%rsi,%r8,2), %ax
incq %rdx
jmp 0x6491
rolw $0x8, %ax
retq
// File: /workspace/github_cpp_makefile_star2_O2/atsidaev[P]trx2x/DiskImage.cpp
// Function: unpack_lzh(unsigned char*, unsigned int, unsigned char*)
unsigned unpack_lzh(unsigned char *src, unsigned size, unsigned char *buf) 
{
  packed_ptr = src; 
  packed_end = src+size;
  int  i, j, k, c;
  unsigned count = 0;
  StartHuff();

//  while (count < textsize)  // textsize - sizeof unpacked data
  while (packed_ptr < packed_end)
  {
    c = DecodeChar();
    if(c < 256)
    {
      *buf++ = c;
      text_buf[r++] = c;
      r &= (N - 1);
      count++;
    } else {
      i = (r - DecodePosition() - 1) & (N - 1);
      j = c - 255 + THRESHOLD;
      for (k = 0; k < j; k++)
      {
        c = text_buf[(i + k) & (N - 1)];
        *buf++ = c;
        text_buf[r++] = c;
        r &= (N - 1);
        count++;
      }
    }
  }
  return count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, 0x3dfe(%rip)      # 0xa5f8
movl %esi, %eax
addq %rdi, %rax
movq %rax, 0x3dfa(%rip)      # 0xa600
callq 0x69c7
xorl %ebp, %ebp
leaq 0x3dfc(%rip), %r15      # 0xa610
movl $0xfff, %r12d           # imm = 0xFFF
movq 0x3dd7(%rip), %rax      # 0xa5f8
cmpq 0x3dd8(%rip), %rax      # 0xa600
jae 0x68b2
callq 0x6d23
movl %eax, %r14d
cmpl $0xff, %eax
jg 0x6861
movb %r14b, (%rbx)
incq %rbx
movslq 0x5f3e(%rip), %rax      # 0xc788
leal 0x1(%rax), %ecx
movb %r14b, (%rax,%r15)
andl $0xfff, %ecx            # imm = 0xFFF
movl %ecx, 0x5f2b(%rip)      # 0xc788
incl %ebp
jmp 0x681a
movl 0x5f20(%rip), %r13d     # 0xc788
callq 0x6d64
addl $0xffffff03, %r14d      # imm = 0xFFFFFF03
notl %eax
addl %r13d, %eax
movl %r14d, %ecx
subl $0x1, %ecx
jb 0x68aa
movl %eax, %edx
andl %r12d, %edx
movb (%rdx,%r15), %dl
movb %dl, (%rbx)
incq %rbx
movslq 0x5ef2(%rip), %rsi      # 0xc788
leal 0x1(%rsi), %edi
movb %dl, (%rsi,%r15)
andl %r12d, %edi
movl %edi, 0x5ee2(%rip)      # 0xc788
incl %eax
jmp 0x687c
addl %r14d, %ebp
jmp 0x681a
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/atsidaev[P]trx2x/DiskImage.cpp
// Function: GetBit()
int GetBit(void)      /* get one bit */
{
  int i;

  while (getlen <= 8)
  {
    if((i = readChar()) == -1) i = 0;
    getbuf |= i << (8 - getlen);
    getlen += 8;
  }
  i = getbuf;
  getbuf <<= 1;
  getlen--;
  return ((i>>15) & 1);
}

// Assembly:
movzbl 0x5ea3(%rip), %edx      # 0xc790
movq 0x3d04(%rip), %rsi      # 0xa5f8
movl 0x5e92(%rip), %eax      # 0xc78c
movq 0x3cff(%rip), %rdi      # 0xa600
pushq $0x8
popq %rcx
subl %edx, %ecx
cmpl $0x8, %edx
ja 0x693f
xorl %r8d, %r8d
cmpq %rdi, %rsi
jae 0x6925
leaq 0x1(%rsi), %r9
movq %r9, 0x3cda(%rip)       # 0xa5f8
movzbl (%rsi), %r8d
movq %r9, %rsi
shll %cl, %r8d
orl %r8d, %eax
movl %eax, 0x5e5b(%rip)      # 0xc78c
addl $0x8, %edx
movb %dl, 0x5e56(%rip)       # 0xc790
addl $-0x8, %ecx
jmp 0x6906
leal (%rax,%rax), %ecx
movl %ecx, 0x5e44(%rip)      # 0xc78c
decb %dl
movb %dl, 0x5e40(%rip)       # 0xc790
shrl $0xf, %eax
andl $0x1, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/atsidaev[P]trx2x/DiskImage.cpp
// Function: GetByte()
int GetByte(void)     /* get one byte */
{
  unsigned i;

  while (getlen <= 8)
  {
    if((i = readChar()) == -1) i = 0;
    getbuf |= i << (8 - getlen);
    getlen += 8;
  }
  i = getbuf;
  getbuf <<= 8;
  getlen -= 8;
  return (i >> 8) & 0xFF;
}

// Assembly:
movzbl 0x5e32(%rip), %eax      # 0xc790
movq 0x3c93(%rip), %rsi      # 0xa5f8
movl 0x5e21(%rip), %edx      # 0xc78c
movq 0x3c8e(%rip), %rdi      # 0xa600
pushq $0x8
popq %rcx
subl %eax, %ecx
cmpl $0x8, %eax
ja 0x69b0
xorl %r8d, %r8d
cmpq %rdi, %rsi
jae 0x6996
leaq 0x1(%rsi), %r9
movq %r9, 0x3c69(%rip)       # 0xa5f8
movzbl (%rsi), %r8d
movq %r9, %rsi
shll %cl, %r8d
orl %r8d, %edx
movl %edx, 0x5dea(%rip)      # 0xc78c
addl $0x8, %eax
movb %al, 0x5de5(%rip)       # 0xc790
addl $-0x8, %ecx
jmp 0x6977
movl %edx, %ecx
shll $0x8, %ecx
movl %ecx, 0x5dd1(%rip)      # 0xc78c
addb $-0x8, %al
movb %al, 0x5dcd(%rip)       # 0xc790
movzbl %dh, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/atsidaev[P]trx2x/DiskImage.cpp
// Function: StartHuff()
void StartHuff(void)
{
  int i, j;

  getbuf = 0, getlen = 0;
  for (i = 0; i < N_CHAR; i++) {
    freq[i] = 1;
    son[i] = i + T;
    prnt[i + T] = i;
  }
  i = 0; j = N_CHAR;
  while (j <= R) {
    freq[j] = freq[i] + freq[i + 1];
    son[j] = i;
    prnt[i] = prnt[i + 1] = j;
    i += 2; j++;
  }
  freq[T] = 0xffff;
  prnt[R] = 0;

  for (i = 0; i < N - F; i++) text_buf[i] = ' ';
  r = N - F;
}

// Assembly:
andl $0x0, 0x5dbe(%rip)      # 0xc78c
movb $0x0, 0x5dbb(%rip)      # 0xc790
xorl %esi, %esi
leaq 0x4c72(%rip), %rax      # 0xb650
leaq 0x58bb(%rip), %rcx      # 0xc2a0
leaq 0x5154(%rip), %rdx      # 0xbb40
xorl %edi, %edi
cmpq $0x274, %rsi            # imm = 0x274
je 0x6a1a
movw $0x1, (%rsi,%rax)
leal 0x273(%rdi), %r8d
movw %r8w, (%rsi,%rcx)
movw %di, 0x4e6(%rsi,%rdx)
incq %rdi
addq $0x2, %rsi
jmp 0x69ee
movw $0x13a, %si             # imm = 0x13A
xorl %edi, %edi
cmpq $0x272, %rdi            # imm = 0x272
je 0x6a56
movzwl 0x2(%rax,%rdi,2), %r8d
addw (%rax,%rdi,2), %r8w
movw %r8w, 0x274(%rdi,%rax)
movw %di, 0x274(%rdi,%rcx)
movw %si, 0x2(%rdx,%rdi,2)
movw %si, (%rdx,%rdi,2)
addq $0x2, %rdi
incl %esi
jmp 0x6a20
orw $-0x1, 0x50d8(%rip)     # 0xbb36
andw $0x0, 0x55be(%rip)      # 0xc024
xorl %eax, %eax
leaq 0x3ba1(%rip), %rcx      # 0xa610
cmpq $0xfc4, %rax            # imm = 0xFC4
je 0x6a80
movb $0x20, (%rax,%rcx)
incq %rax
jmp 0x6a6f
movl $0xfc4, 0x5cfe(%rip)    # imm = 0xFC4
retq