LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/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 0xb352
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movslq 0xc(%rdi), %rcx
addl %ecx, %esi
cmpl 0x8(%rdi), %esi
jle 0xb355
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 *0x801d(%rip)           # 0x13340
testq %rax, %rax
je 0xb35a
movq %rax, %r14
movq (%rbx), %rsi
movslq 0x8(%rbx), %rdx
movq %rax, %rdi
callq 0x32c0
movq (%rbx), %rdi
callq *0x8005(%rip)           # 0x13348
movl %ebp, 0x8(%rbx)
movq %r14, (%rbx)
movslq 0xc(%rbx), %rax
addq %r14, %rax
jmp 0xb373
xorl %eax, %eax
retq
addq %rcx, %rax
jmp 0xb373
movq (%rbx), %rdi
callq *0x7fe5(%rip)           # 0x13348
movl $0x0, 0x8(%rbx)
movq $0x0, (%rbx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0xb3a4
jp 0xb3a4
testq %rsi, %rsi
je 0xb3f5
movq %rsi, %rdi
movl $0x2, %esi
callq 0xb2da
jmp 0xb400
ucomisd 0x340c(%rip), %xmm2     # 0xe7b8
jb 0xb416
movsd 0x340a(%rip), %xmm0     # 0xe7c0
ucomisd %xmm2, %xmm0
jb 0xb416
movq %rdi, %r14
xorps %xmm0, %xmm0
cvtsi2sdl 0x28(%rdi), %xmm0
subsd %xmm2, %xmm0
andpd 0x342d(%rip), %xmm0     # 0xe800
movsd 0x33ed(%rip), %xmm1     # 0xe7c8
ucomisd %xmm0, %xmm1
jb 0xb416
testq %rsi, %rsi
je 0xb42f
movq %rsi, %rdi
movl $0x15, %esi
callq 0xb2da
jmp 0xb43a
movl $0x2, %edi
callq *0x7f40(%rip)           # 0x13340
movq %rax, %rbx
testq %rax, %rax
je 0xb4bb
movw $0x30, (%rbx)
jmp 0xb4f5
movapd %xmm2, (%rsp)
testq %rsi, %rsi
je 0xb45c
movq %rsi, %rdi
movl $0x40, %esi
callq 0xb2da
jmp 0xb467
movl $0x15, %edi
callq *0x7f06(%rip)           # 0x13340
movq %rax, %rbx
testq %rax, %rax
je 0xb4bb
movl 0x28(%r14), %edx
leaq 0x344a(%rip), %rsi      # 0xe897
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3090
jmp 0xb4f5
movl $0x40, %edi
callq *0x7ed9(%rip)           # 0x13340
movq %rax, %rbx
testq %rax, %rax
movapd (%rsp), %xmm0
je 0xb4bb
callq 0x3590
movapd (%rsp), %xmm4
movapd 0x337a(%rip), %xmm2     # 0xe800
movapd %xmm4, %xmm1
andpd %xmm2, %xmm1
movsd 0x333a(%rip), %xmm3     # 0xe7d0
ucomisd %xmm1, %xmm3
jbe 0xb4bf
subsd %xmm4, %xmm0
andpd %xmm2, %xmm0
movsd 0x331c(%rip), %xmm2     # 0xe7c8
ucomisd %xmm0, %xmm2
jb 0xb4bf
leaq 0x33e1(%rip), %rsi      # 0xe89a
jmp 0xb4e7
xorl %ebx, %ebx
jmp 0xb4f5
movsd 0x3311(%rip), %xmm0     # 0xe7d8
ucomisd %xmm1, %xmm0
ja 0xb4e0
ucomisd 0x330b(%rip), %xmm1     # 0xe7e0
ja 0xb4e0
leaq 0x33c4(%rip), %rsi      # 0xe8a2
jmp 0xb4e7
leaq 0x33b8(%rip), %rsi      # 0xe89f
movq %rbx, %rdi
movapd %xmm4, %xmm0
movb $0x1, %al
callq 0x3090
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x82b8
callq 0x99d8
movl $0x0, 0xc(%rsp)
leaq 0x208a(%rip), %rdi      # 0xeaed
leaq 0x2185(%rip), %rsi      # 0xebef
callq 0x33f0
testq %rax, %rax
je 0xcab3
movq %rax, %rbx
leaq 0x1e19(%rip), %rsi      # 0xe897
leaq 0xc(%rsp), %rdx
movq %rax, %rdi
xorl %eax, %eax
callq 0x3620
cmpl $0x1, %eax
jne 0xcab3
movq %rbx, %rdi
callq 0x3370
movl 0xc(%rsp), %ebx
callq 0x34d0
cmpl %eax, %ebx
jne 0xcab3
leaq 0x203f(%rip), %rdi      # 0xeaed
callq 0x3600
addq $0x10, %rsp
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 %rbx
cmpl $0x401, %edi            # imm = 0x401
jl 0xcdff
movq 0x61fd(%rip), %rbx      # 0x12fc0
leaq 0x1e0f(%rip), %rsi      # 0xebd9
movl $0x17, %edx
movq %rbx, %rdi
callq 0x33d0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3340
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
popq %rbx
jmp 0x3230
movl %edi, %ebx
leaq 0x92f8(%rip), %rdi      # 0x16100
callq 0x34e0
testl %eax, %eax
jne 0xce2c
movslq %ebx, %rax
leaq 0x8ee5(%rip), %rcx      # 0x15d00
movb $0x1, (%rax,%rcx)
leaq 0x92da(%rip), %rdi      # 0x16100
popq %rbx
jmp 0x32a0
movl %eax, %edi
callq 0x3210
// File: /workspace/github_cpp_makefile_star2_O3/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 %rbx
cmpl $0x401, %edi            # imm = 0x401
jl 0xce7f
movq 0x617d(%rip), %rbx      # 0x12fc0
leaq 0x1da7(%rip), %rsi      # 0xebf1
movl $0x1a, %edx
movq %rbx, %rdi
callq 0x33d0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3340
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
popq %rbx
jmp 0x3230
movl %edi, %ebx
leaq 0x9278(%rip), %rdi      # 0x16100
callq 0x34e0
testl %eax, %eax
jne 0xceac
movslq %ebx, %rax
leaq 0x8e65(%rip), %rcx      # 0x15d00
movb $0x0, (%rax,%rcx)
leaq 0x925a(%rip), %rdi      # 0x16100
popq %rbx
jmp 0x32a0
movl %eax, %edi
callq 0x3210
// File: /workspace/github_cpp_makefile_star2_O3/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 0xcf02
pushq %rbx
movq 0x60fd(%rip), %rbx      # 0x12fc0
leaq 0x1d19(%rip), %rsi      # 0xebe3
movl $0xd, %edx
movq %rbx, %rdi
callq 0x33d0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3340
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3230
xorl %eax, %eax
popq %rbx
retq
movslq %edi, %rax
leaq 0x8df4(%rip), %rcx      # 0x15d00
cmpb $0x0, (%rax,%rcx)
setne %al
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 %rax
leaq 0x91da(%rip), %rdi      # 0x16100
callq 0x34e0
testl %eax, %eax
jne 0xcf48
leaq 0x8d92(%rip), %rdi      # 0x15cc8
callq 0xd544
leaq 0x91be(%rip), %rdi      # 0x16100
popq %rax
jmp 0x32a0
movl %eax, %edi
callq 0x3210
// File: /workspace/github_cpp_makefile_star2_O3/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
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rsi
leaq 0x1(%rbx), %rax
cmpq %rax, %rsi
cmovbeq %rax, %rsi
movq %rbp, %rdi
callq 0x2f4e
cmpq %r13, 0x20(%r14)
jbe 0x2ee7
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 0x2e2a
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %r15, %rcx
movq (%rsp), %r8
callq 0x2e2a
movq 0x30(%r14), %rax
leaq (,%rbp,2), %rcx
addq %rbp, %rcx
leaq (%r12,%r12,2), %rdx
movl (%rax,%rdx,8), %edx
addl (%rax,%rcx,8), %edx
leaq (%rbx,%rbx,2), %rcx
movl %edx, (%rax,%rcx,8)
movq %rbp, 0x8(%rax,%rcx,8)
movq %r12, 0x10(%rax,%rcx,8)
jmp 0x2f22
cmpq $-0x1, 0x28(%r14)
jne 0x2ef2
movq %rbx, 0x28(%r14)
movq (%r15), %rax
cmpq %r12, %rax
je 0x2f09
leaq 0x4(%rax), %rcx
movq %rcx, (%r15)
movl (%rax), %eax
movq (%rbp), %rcx
jmp 0x2f11
movl 0x60(%r14), %eax
movq 0x30(%r14), %rcx
leaq (%rbx,%rbx,2), %rdx
movl %eax, (%rcx,%rdx,8)
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, 0x8(%rcx,%rdx,8)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x31ab
cmpq %rbx, %r14
jbe 0x317d
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 0x31c9
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 0x3210
movl $0x10, %edi
callq 0x2070
movq %rax, %rbx
leaq 0x1037(%rip), %rsi      # 0x41f6
movq %rax, %rdi
callq 0x2040
jmp 0x31e5
movl $0x10, %edi
callq 0x2070
movq %rax, %rbx
leaq 0x102f(%rip), %rsi      # 0x420c
movq %rax, %rdi
callq 0x2040
movq 0x2de4(%rip), %rsi      # 0x5fd0
movq 0x2dd5(%rip), %rdx      # 0x5fc8
movq %rbx, %rdi
callq 0x2180
jmp 0x31fd
movq %rax, %r14
movq %rbx, %rdi
callq 0x20e0
movq %r14, %rdi
callq 0x21a0
// File: /workspace/github_cpp_makefile_star2_O3/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 %rdi, %r15
xorl %eax, %eax
cmpq %rdx, %rsi
ja 0x328f
movq %r9, %rbx
movq %rdx, %rbp
movq %rsi, %r12
xorl %esi, %esi
cmpq %rbx, %rbp
jne 0x323a
cmpq %r8, %r12
je 0x3297
leaq (%r8,%rbx), %r13
shrq %r13
cmpq %rbp, %r13
movq %rbp, %rdx
cmovbq %r13, %rdx
movq 0x30(%r15), %rax
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %r14
movq 0x8(%rax,%r14), %rcx
movq %r15, %rdi
movl %esi, 0x4(%rsp)
movq %r12, %rsi
movq %r13, %r9
callq 0x3210
incq %r13
cmpq %r12, %r13
cmovaq %r13, %r12
movq 0x30(%r15), %rcx
movq 0x10(%rcx,%r14), %rcx
addl 0x4(%rsp), %eax
movq %r13, %r8
movl %eax, %esi
cmpq %rbp, %r12
jbe 0x3230
addq $0x60, %r15
movl %eax, %esi
jmp 0x32a6
leaq (%rcx,%rcx,2), %rax
shlq $0x3, %rax
addq 0x30(%r15), %rax
movq %rax, %r15
addl (%r15), %esi
movl %esi, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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
cmpl $0x0, 0x24(%rdi)
jle 0x180d8
movapd %xmm0, %xmm1
movq %rsi, %rbx
movq %rdi, %r14
movsd 0xeefe3(%rip), %xmm0    # 0x107008
xorl %r13d, %r13d
xorl %r15d, %r15d
movq 0x18(%r14), %rax
movq (%rax,%r13,8), %r12
cmpl $0x0, 0x3c(%r12)
jg 0x180c6
movapd %xmm0, (%rsp)
movq %r12, %rdi
movapd %xmm1, 0x10(%rsp)
callq 0x38bf0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6781f
movapd 0x10(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jae 0x18070
movapd (%rsp), %xmm0
jmp 0x180c6
movq %r12, %rdi
movapd %xmm0, 0x20(%rsp)
callq 0x38bf0
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 0x180be
movapd %xmm4, %xmm0
movapd %xmm3, %xmm5
cmovneq %r12, %r15
movapd %xmm5, %xmm1
incq %r13
movslq 0x24(%r14), %rax
cmpq %rax, %r13
jl 0x1802b
jmp 0x180db
xorl %r15d, %r15d
movq %r15, %rax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0xc0cf4
movq %r15, %rdi
xorl %esi, %esi
callq 0x15a10
movq %r14, %rdi
movq %rbx, %rsi
movl $0x1, %edx
callq 0x42dba
cmpl $0x0, 0x1500a4(%rip)    # 0x16cdbc
je 0x1cdd5
leaq 0xeb152(%rip), %rdi     # 0x107e77
callq 0x15970
movq %rsp, %rdi
callq 0xc0d56
leaq 0xea879(%rip), %rdi     # 0x1075b2
movb $0x1, %al
callq 0x15080
movsd 0x8(%rbx), %xmm0
movsd 0x10(%rbx), %xmm1
movsd 0x18(%rbx), %xmm2
movsd 0x20(%rbx), %xmm3
leaq 0xeae0a(%rip), %rdi     # 0x107b65
movb $0x4, %al
callq 0x15080
movsd 0x28(%rbx), %xmm0
movsd 0x30(%rbx), %xmm1
movsd 0x38(%rbx), %xmm2
movsd 0x40(%rbx), %xmm3
leaq 0xeae10(%rip), %r14     # 0x107b8d
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 0x14f193(%rip), %rax    # 0x16bf60
movq (%rax), %rdi
callq 0x15750
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/apps/sflprocess/sflprocess.cpp
// Function: CreateMultiresolutionNodes(gaps::R3SurfelScene*, char const*, double, double, double)
static int
CreateMultiresolutionNodes(R3SurfelScene *scene, const char *node_name,
  RNScalar min_complexity, RNScalar min_resolution, RNScalar min_multiresolution_factor)
{
  // Start statistics
  RNTime start_time;
  start_time.Read();

  // Get surfel tree
  R3SurfelTree *tree = scene->Tree();
  if (!tree) {
    RNFail("Scene has no surfel tree\n");
    return 0;
  }    

  // Temporary
  if (strcmp(node_name, "All")) {
    RNFail("-create_multiresolution_nodes only supported for All nodes\n");
    return 0;
  }

  // Create multiresolution nodes
  tree->CreateMultiresolutionNodes(min_complexity, min_resolution, min_multiresolution_factor);

  // Print statistics
  if (print_verbose) {
    printf("Created multiresolution nodes  ...\n");
    printf("  Time = %.2f seconds\n", start_time.Elapsed());
    printf("  # Nodes = %d\n", tree->NNodes());
    fflush(stdout);
  }

  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movsd %xmm2, 0x10(%rsp)
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, (%rsp)
movq %rsi, %r15
movq %rdi, %r14
leaq 0x18(%rsp), %r12
movq %r12, %rdi
callq 0xc0cf4
xorl %ebx, %ebx
movq %r12, %rdi
xorl %esi, %esi
callq 0x15a10
movq 0x8(%r14), %r14
testq %r14, %r14
je 0x1e87e
leaq 0xe928b(%rip), %rsi     # 0x107af2
movq %r15, %rdi
callq 0x158b0
testl %eax, %eax
je 0x1e89a
leaq 0xe94ff(%rip), %rdi     # 0x107d79
xorl %ebx, %ebx
jmp 0x1e885
leaq 0xe9236(%rip), %rdi     # 0x107abb
xorl %eax, %eax
callq 0xc3e02
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %r14, %rdi
movsd (%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
callq 0x3abe8
movl $0x1, %ebx
cmpl $0x0, 0x14e4fd(%rip)    # 0x16cdbc
je 0x1e88c
leaq 0xe9659(%rip), %rdi     # 0x107f21
callq 0x15970
leaq 0x18(%rsp), %rdi
callq 0xc0d56
leaq 0xe8cd4(%rip), %rdi     # 0x1075b2
movb $0x1, %al
callq 0x15080
movl 0x24(%r14), %esi
leaq 0xe8dd4(%rip), %rdi     # 0x1076c4
xorl %eax, %eax
callq 0x15080
movq 0x14d662(%rip), %rax    # 0x16bf60
movq (%rax), %rdi
callq 0x15750
jmp 0x1e88c
// File: /workspace/github_cpp_makefile_star2_O3/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
movl $0xfffffff8, %ecx       # imm = 0xFFFFFFF8
movl %eax, %edx
andl $0x1, %eax
negl %eax
sarl %edx
andl $0xedb88320, %eax       # imm = 0xEDB88320
xorl %edx, %eax
incl %ecx
jne 0x1bdb
notl %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/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
xorl %esi, %esi
movl $0x0, (%rdx,%rsi)
movups %xmm0, (%rax,%rsi,4)
addq $0x4, %rsi
cmpq $0x400, %rsi            # imm = 0x400
jne 0x1c0a
incq %rcx
addq $0x400, %rdx            # imm = 0x400
addq $0x1000, %rax           # imm = 0x1000
cmpq $0x100, %rcx            # imm = 0x100
jne 0x1c08
movl $0x51000100, 0x145004(%rdi) # imm = 0x51000100
movl $0x0, 0x141000(%rdi)
movb $0x1, 0x145008(%rdi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x1d0a
movb $0x0, 0x145006(%rbx)
movw $0x100, 0x145004(%rbx)  # imm = 0x100
movl $0x0, 0x141000(%rbx)
leaq 0x40008(%rbx), %r14
xorl %r15d, %r15d
xorl %r12d, %r12d
movl $0x0, (%rbx,%r12)
movq -0x8(%r14,%r12,4), %rdi
testq %rdi, %rdi
je 0x1cab
movl $0x1, %esi
callq 0x1150
movq $0x0, -0x8(%r14,%r12,4)
movq (%r14,%r12,4), %rdi
testq %rdi, %rdi
je 0x1cc7
movl $0x1, %esi
callq 0x1150
movq $0x0, (%r14,%r12,4)
addq $0x4, %r12
cmpq $0x400, %r12            # imm = 0x400
jne 0x1c8f
incq %r15
addq $0x400, %rbx            # imm = 0x400
addq $0x1000, %r14           # imm = 0x1000
cmpq $0x100, %r15            # imm = 0x100
jne 0x1c8c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rdi
callq 0x7e91
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1de5
movq %rdi, %rbx
cmpb $0x1, 0x145004(%rdi)
jne 0x1de5
cmpl $0x6, 0x141000(%rbx)
je 0x1de5
leaq 0x140000(%rbx), %rdi
movl $0x242, %esi            # imm = 0x242
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x10d0
testl %eax, %eax
js 0x1dec
movl %eax, %ebp
movl 0x141000(%rbx), %eax
cmpl $0x1, %eax
jne 0x1d74
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2498
movl 0x141000(%rbx), %eax
cmpl $0x2, %eax
jne 0x1d89
movq %rbx, %rdi
movl %ebp, %esi
callq 0x279a
movl 0x141000(%rbx), %eax
cmpl $0x3, %eax
jne 0x1d9e
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2f32
movl 0x141000(%rbx), %eax
cmpl $0x5, %eax
jne 0x1db3
movq %rbx, %rdi
movl %ebp, %esi
callq 0x32a0
movl 0x141000(%rbx), %eax
cmpl $0x4, %eax
jne 0x1dc8
movq %rbx, %rdi
movl %ebp, %esi
callq 0x3554
movl 0x141000(%rbx), %eax
cmpl $0x7, %eax
jne 0x1dd7
movq %rbx, %rdi
movl %ebp, %esi
callq 0x386a
movl %ebp, %edi
callq 0x1220
movb $0x0, 0x145004(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x655d(%rip), %rsi      # 0x8350
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2410
// File: /workspace/github_cpp_makefile_star2_O3/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:
movw $0xffff, %ax            # imm = 0xFFFF
testq %rdx, %rdx
je 0x1e3a
xorl %ecx, %ecx
movzbl (%rsi,%rcx), %edi
shll $0x8, %edi
xorl %edi, %eax
movl $0x8, %edi
leal (%rax,%rax), %r8d
movl %r8d, %r9d
xorl $0x1021, %r9d           # imm = 0x1021
testw %ax, %ax
cmovnsl %r8d, %r9d
movl %r9d, %eax
decl %edi
jne 0x1e17
incl %ecx
cmpq %rdx, %rcx
jb 0x1e09
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 %rbx
movl 0x28(%rsp), %ecx
movl 0x64(%rsp), %eax
movl 0x5c(%rsp), %edx
movl %ecx, %esi
subl %edx, %esi
movl %edx, %r8d
negl %r8d
cmpl %edx, %eax
cmovbl %esi, %r8d
addl %eax, %r8d
cmpl %r8d, %esi
movl %r8d, %eax
cmovbl %esi, %eax
movl %r8d, %r9d
subl %eax, %r9d
xorl %edi, %edi
cmpl %r8d, %esi
movq 0x18(%rsp), %rsi
cmovbl %r9d, %edi
testl %eax, %eax
je 0x1ec3
movl %eax, %r8d
movw $0xffff, %bx            # imm = 0xFFFF
xorl %r9d, %r9d
leal (%rdx,%r9), %r10d
movzbl (%rsi,%r10), %r10d
shll $0x8, %r10d
xorl %r10d, %ebx
movl $0x8, %r10d
leal (%rbx,%rbx), %r11d
movl %r11d, %ebp
xorl $0x1021, %ebp           # imm = 0x1021
testw %bx, %bx
cmovnsl %r11d, %ebp
movl %ebp, %ebx
decl %r10d
jne 0x1e9e
incq %r9
cmpq %r8, %r9
jne 0x1e88
jmp 0x1ec7
movw $0xffff, %bx            # imm = 0xFFFF
testl %edi, %edi
je 0x1f06
movl %edi, %r8d
xorl %r9d, %r9d
movzbl (%rsi,%r9), %r10d
shll $0x8, %r10d
xorl %r10d, %ebx
movl $0x8, %r10d
leal (%rbx,%rbx), %r11d
movl %r11d, %ebp
xorl $0x1021, %ebp           # imm = 0x1021
testw %bx, %bx
cmovnsl %r11d, %ebp
movl %ebp, %ebx
decl %r10d
jne 0x1ee3
incq %r9
cmpq %r8, %r9
jne 0x1ed1
addl %edx, %eax
testl %edi, %edi
cmovnel %edi, %eax
xorl %edi, %edi
xorl %edx, %edx
divl %ecx
movl %edx, %eax
movb %bh, (%rsi,%rax)
incl %edx
cmpl %ecx, %edx
cmovel %edi, %edx
movb %bl, (%rsi,%rdx)
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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)
movq $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 0x23e0
xorl %eax, %eax
cmpq $0x0, 0x8(%r9)
sete %al
jmp 0x23e5
movl $0x1, %eax
orl %r8d, %eax
jne 0x2409
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
nop
// File: /workspace/github_cpp_makefile_star2_O3/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:
testl %esi, %esi
je 0x72b2
movl %esi, %ecx
xorl %edx, %edx
leaq 0x3f4f(%rip), %rsi      # 0xb1e0
xorl %eax, %eax
movzwl %ax, %eax
movb (%rdi,%rdx), %r8b
xorb %al, %r8b
shrl $0x8, %eax
movzbl %r8b, %r8d
xorw (%rsi,%r8,2), %ax
incq %rdx
cmpl %edx, %ecx
jne 0x7293
jmp 0x72b4
xorl %eax, %eax
rolw $0x8, %ax
retq
// File: /workspace/github_cpp_makefile_star2_O3/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, 0x3d30(%rip)      # 0xb608
movl %esi, %eax
addq %rdi, %rax
movq %rax, 0x3d2c(%rip)      # 0xb610
callq 0x7ac9
movq 0x3d18(%rip), %rax      # 0xb608
xorl %ebp, %ebp
cmpq 0x3d17(%rip), %rax      # 0xb610
jae 0x799e
xorl %ebp, %ebp
leaq 0x3d18(%rip), %r15      # 0xb620
movl $0xfff, %r12d           # imm = 0xFFF
callq 0x7e06
movl %eax, %r14d
cmpl $0xff, %eax
jg 0x7941
movb %r14b, (%rbx)
incq %rbx
movslq 0x5e6e(%rip), %rax      # 0xd798
leal 0x1(%rax), %ecx
movb %r14b, (%rax,%r15)
andl $0xfff, %ecx            # imm = 0xFFF
movl %ecx, 0x5e5b(%rip)      # 0xd798
incl %ebp
jmp 0x798a
movl 0x5e50(%rip), %r13d     # 0xd798
callq 0x7e4b
addl $0xffffff03, %r14d      # imm = 0xFFFFFF03
notl %eax
addl %r13d, %eax
movl %r14d, %ecx
movl %eax, %edx
andl %r12d, %edx
movb (%rdx,%r15), %dl
movb %dl, (%rbx)
incq %rbx
movslq 0x5e27(%rip), %rsi      # 0xd798
leal 0x1(%rsi), %edi
movb %dl, (%rsi,%r15)
andl %r12d, %edi
movl %edi, 0x5e17(%rip)      # 0xd798
incl %eax
decl %ecx
jne 0x795c
addl %r14d, %ebp
movq 0x3c77(%rip), %rax      # 0xb608
cmpq 0x3c78(%rip), %rax      # 0xb610
jb 0x790e
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_O3/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 0x5dc6(%rip), %edx      # 0xd7a0
movl 0x5dbc(%rip), %eax      # 0xd79c
cmpl $0x8, %edx
ja 0x7a31
movq 0x3c1c(%rip), %rdi      # 0xb608
movq 0x3c1d(%rip), %rsi      # 0xb610
xorl %r8d, %r8d
cmpq %rsi, %rdi
jae 0x7a0d
leaq 0x1(%rdi), %rcx
movq %rcx, 0x3c02(%rip)      # 0xb608
movzbl (%rdi), %r8d
movq %rcx, %rdi
movb $0x8, %cl
subb %dl, %cl
shll %cl, %r8d
orl %r8d, %eax
movl %eax, 0x5d7f(%rip)      # 0xd79c
leal 0x8(%rdx), %ecx
movb %cl, 0x5d7a(%rip)       # 0xd7a0
testl %edx, %edx
movl $0x8, %edx
je 0x79f3
jmp 0x7a33
movl %edx, %ecx
leal (%rax,%rax), %edx
movl %edx, 0x5d60(%rip)      # 0xd79c
decb %cl
movb %cl, 0x5d5c(%rip)       # 0xd7a0
shrl $0xf, %eax
andl $0x1, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x5d4e(%rip), %edx      # 0xd7a0
movl 0x5d44(%rip), %eax      # 0xd79c
cmpl $0x9, %edx
jae 0x7aad
movq 0x3ba4(%rip), %rdi      # 0xb608
movq 0x3ba5(%rip), %rsi      # 0xb610
xorl %r9d, %r9d
cmpq %rsi, %rdi
jae 0x7a85
leaq 0x1(%rdi), %rcx
movq %rcx, 0x3b8a(%rip)      # 0xb608
movzbl (%rdi), %r9d
movq %rcx, %rdi
movl %edx, %r8d
movb $0x8, %cl
subb %dl, %cl
shll %cl, %r9d
orl %r9d, %eax
movl %eax, 0x5d04(%rip)      # 0xd79c
leal 0x8(%r8), %ecx
movb %cl, 0x5cfe(%rip)       # 0xd7a0
testl %edx, %edx
movl $0x8, %edx
je 0x7a6b
jmp 0x7ab3
addb $-0x8, %dl
movl %edx, %r8d
movl %eax, %ecx
shll $0x8, %ecx
movl %ecx, 0x5cde(%rip)      # 0xd79c
movb %r8b, 0x5cdb(%rip)      # 0xd7a0
movzbl %ah, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/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:
movl $0x0, 0x5cc9(%rip)      # 0xd79c
movb $0x0, 0x5cc6(%rip)      # 0xd7a0
xorl %esi, %esi
leaq 0x4b7d(%rip), %rax      # 0xc660
leaq 0x57c6(%rip), %rcx      # 0xd2b0
leaq 0x505f(%rip), %rdx      # 0xcb50
xorl %edi, %edi
movw $0x1, (%rsi,%rax)
leal 0x273(%rdi), %r8d
movw %r8w, (%rsi,%rcx)
movw %di, 0x4e6(%rsi,%rdx)
incl %edi
addq $0x2, %rsi
cmpq $0x274, %rsi            # imm = 0x274
jne 0x7af3
movw $0x13a, %si             # imm = 0x13A
xorl %edi, %edi
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
cmpq $0x272, %rdi            # imm = 0x272
jne 0x7b22
pushq %rax
movw $0xffff, 0x4fe6(%rip)   # imm = 0xFFFF
movw $0x0, 0x54cb(%rip)      # 0xd034
leaq 0x3ab0(%rip), %rdi      # 0xb620
movl $0xfc4, %edx            # imm = 0xFC4
movl $0x20, %esi
callq 0x10a0
movl $0xfc4, 0x5c0f(%rip)    # imm = 0xFC4
popq %rax
retq
// File: /workspace/github_cpp_makefile_star2_O3/atsidaev[P]trx2x/DiskImage.cpp
// Function: reconst()
void reconst(void)
{
  int i, j, k;
  int f, l;

  /* collect leaf nodes in the first half of the table */
  /* and replace the freq by (freq + 1) / 2. */
  j = 0;
  for(i = 0; i < T; i++)
  {
    if(son[i] >= T)
    {
      freq[j] = (freq[i] + 1) / 2;
      son[j] = son[i];
      j++;
    }
  }
  /* begin constructing tree by connecting sons */
  for(i = 0, j = N_CHAR; j < T; i += 2, j++)
  {
    k = i + 1;
    f = freq[j] = freq[i] + freq[k];
    for(k = j - 1; f < freq[k]; k--);
    k++;
    l = (j - k) * sizeof(*freq);
    memcpy(&freq[k + 1], &freq[k], l);
    freq[k] = f;
    memcpy(&son[k + 1], &son[k], l);
    son[k] = i;
  }
  /* connect prnt */
  for (i = 0; i < T; i++)
    if ((k = son[i]) >= T) prnt[k] = i;
    else prnt[k] = prnt[k + 1] = i;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
xorl %eax, %eax
leaq 0x570e(%rip), %rdi      # 0xd2b0
leaq 0x4ab7(%rip), %r12      # 0xc660
xorl %ecx, %ecx
movzwl (%rax,%rdi), %edx
cmpl $0x273, %edx            # imm = 0x273
jb 0x7bce
movzwl (%rax,%r12), %esi
incl %esi
shrl %esi
movslq %ecx, %rcx
movw %si, (%r12,%rcx,2)
movw %dx, (%rdi,%rcx,2)
incl %ecx
addq $0x2, %rax
cmpq $0x4e6, %rax            # imm = 0x4E6
jne 0x7bab
movl $0x13a, %eax            # imm = 0x13A
movabsq $-0x13b00000000, %r9    # imm = 0xFFFFFEC500000000
movabsq $-0x13c00000000, %rsi   # imm = 0xFFFFFEC400000000
leaq 0x4cd8(%rip), %r15      # 0xc8d2
movabsq $-0x100000000, %rbp     # imm = 0xFFFFFFFF00000000
xorl %ecx, %ecx
movzwl 0x2(%r12,%rcx,2), %r14d
movq %rcx, 0x8(%rsp)
addw (%r12,%rcx,2), %r14w
movq %rax, 0x20(%rsp)
movw %r14w, (%r12,%rax,2)
xorl %eax, %eax
xorl %ebx, %ebx
movq %rax, %rcx
addq %rbp, %rbx
addq $-0x2, %rax
cmpw (%r15,%rcx), %r14w
jb 0x7c24
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
subl %eax, %ecx
movq %rbx, %r13
subq %rsi, %r13
sarq $0x1f, %r13
leaq (%r12,%r13), %rdi
subq %r9, %rbx
sarq $0x1f, %rbx
movq %rsi, 0x10(%rsp)
leaq (%r12,%rbx), %rsi
movslq %ecx, %rdx
movq %rdx, (%rsp)
movq %r9, 0x18(%rsp)
callq 0x10e0
movw %r14w, (%rbx,%r12)
leaq 0x5639(%rip), %r14      # 0xd2b0
addq %r14, %r13
leaq (%r14,%rbx), %rsi
movq %r13, %rdi
movq (%rsp), %rdx
callq 0x10e0
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %r9
movq 0x8(%rsp), %rcx
movw %cx, (%rbx,%r14)
addq $0x2, %rcx
movq 0x20(%rsp), %rax
incq %rax
addq %rbp, %r9
addq %rbp, %rsi
addq $0x2, %r15
cmpq $0x273, %rax            # imm = 0x273
jne 0x7c06
xorl %eax, %eax
leaq 0x4e87(%rip), %rcx      # 0xcb50
movswq (%r14), %rdx
cmpq $0x273, %rdx            # imm = 0x273
jae 0x7ce0
leal 0x1(%rdx), %esi
movzwl %si, %esi
movw %ax, (%rcx,%rsi,2)
movw %ax, (%rcx,%rdx,2)
incq %rax
addq $0x2, %r14
cmpq $0x273, %rax            # imm = 0x273
jne 0x7cc9
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/atsidaev[P]trx2x/DiskImage.cpp
// Function: update(int)
void update(int c)
{
  int i, j, k, l;

  if(freq[R] == MAX_FREQ) reconst();

  c = prnt[c + T];
  do {
    k = ++freq[c];

    /* if the order is disturbed, exchange nodes */
    if (k > freq[l = c + 1])
    {
      while (k > freq[++l]);
      l--;
      freq[c] = freq[l];
      freq[l] = k;

      i = son[c];
      prnt[i] = l;
      if (i < T) prnt[i + 1] = l;

      j = son[l];
      son[l] = i;

      prnt[j] = c;
      if (j < T) prnt[j + 1] = c;
      son[c] = j;

      c = l;
    }
  } while ((c = prnt[c]) != 0);  /* repeat up to root */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
xorl %eax, %eax
cmpw 0x4e30(%rip), %ax       # 0xcb44
jno 0x7d1b
callq 0x7b8b
addl $0x273, %ebx            # imm = 0x273
leaq 0x4e28(%rip), %rax      # 0xcb50
movzwl (%rax,%rbx,2), %edi
leaq 0x492d(%rip), %rcx      # 0xc660
movabsq $0x100000000, %rdx      # imm = 0x100000000
leaq 0x556c(%rip), %rsi      # 0xd2b0
movswq %di, %r8
movzwl (%rcx,%r8,2), %r11d
incl %r11d
movw %r11w, (%rcx,%r8,2)
cmpw 0x2(%rcx,%r8,2), %r11w
jbe 0x7dea
movzwl %r8w, %r10d
movq %r8, %r9
shlq $0x20, %r9
leaq (%rcx,%r8,2), %r14
addq $0x4, %r14
xorl %ebx, %ebx
movq %rbx, %r15
addq %rdx, %r9
incq %rbx
cmpw (%r14,%r15,2), %r11w
ja 0x7d76
movq %r9, %r14
sarq $0x1f, %r14
movzwl (%r14,%rcx), %ebp
movw %bp, (%rcx,%r8,2)
movw %r11w, (%r14,%rcx)
movswq (%rsi,%r8,2), %r11
movq %r10, %r14
addq %rbx, %r14
movw %r14w, (%rax,%r11,2)
cmpq $0x272, %r11            # imm = 0x272
ja 0x7dbf
movzwl %r11w, %ebx
movw %r14w, 0x2(%rax,%rbx,2)
sarq $0x20, %r9
movswq (%rsi,%r9,2), %rbx
movw %r11w, (%rsi,%r9,2)
movw %di, (%rax,%rbx,2)
cmpq $0x272, %rbx            # imm = 0x272
ja 0x7de3
movzwl %bx, %edi
movw %r10w, 0x2(%rax,%rdi,2)
movw %bx, (%rsi,%r8,2)
jmp 0x7ded
movq %r8, %r9
movzwl (%rax,%r9,2), %edi
testw %di, %di
jne 0x7d44
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/atsidaev[P]trx2x/DiskImage.cpp
// Function: DecodeChar()
int DecodeChar(void)
{
  int c;

  c = son[R];

  /* travel from root to leaf, */
  /* choosing the smaller child node (son[]) if the read bit is 0, */
  /* the bigger (son[]+1} if 1 */
  while(c < T) c = son[c + GetBit()];
  c -= T;
  update(c);
  return c;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movswl 0x5983(%rip), %ebx      # 0xd794
cmpl $0x272, %ebx            # imm = 0x272
ja 0x7e34
leaq 0x5490(%rip), %r14      # 0xd2b0
callq 0x79d3
addl %ebx, %eax
movswl (%r14,%rax,2), %ebx
cmpl $0x273, %ebx            # imm = 0x273
jb 0x7e20
addl $0xfffffd8d, %ebx       # imm = 0xFFFFFD8D
movl %ebx, %edi
callq 0x7d02
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/atsidaev[P]trx2x/DiskImage.cpp
// Function: DecodePosition()
int DecodePosition(void)
{
  int i, j, c;

  /* recover upper 6 bits from table */
  i = GetByte();
  c = (int)d_code[i] << 6;
  j = d_len[i];
  /* read lower 6 bits verbatim */
  j -= 2;
  while (j--) i = (i << 1) + GetBit();
  return c | (i & 0x3f);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
callq 0x7a4b
movl %eax, %ebx
movl %eax, %eax
leaq 0x3581(%rip), %rcx      # 0xb3e0
movzbl (%rax,%rcx), %ebp
leaq 0x3676(%rip), %rcx      # 0xb4e0
movzbl (%rax,%rcx), %r14d
addl $-0x2, %r14d
je 0x7e82
callq 0x79d3
leal (%rax,%rbx,2), %ebx
decl %r14d
jne 0x7e75
shll $0x6, %ebp
andl $0x3f, %ebx
orl %ebp, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/soybin[P]idyll/src/gui.cpp
// Function: gui::update(int*, int)
void update(int* curV, int tarV) {
		double lockedValue = *curV;

		do {
			lockedValue = *curV;
			// width of logo is 34 characters. two of which
			// will be used for the extremes of the bar.
			// terminal colors are represented with expressions
			// like "\033[x;xx"
			std::cout << "\r\033[1;36m[";
			int quantity = 1 + 32 * lockedValue / tarV;
			for (int i = 0; i < 32; ++i) {
				std::cout << (i < quantity ? "\033[1;36m=" : "\033[0m-");
			}
			std::cout << "\033[1;36m]";
			std::cout.flush();
			std::this_thread::sleep_for(std::chrono::milliseconds(5));
		} while (lockedValue < tarV);
		std::cout << "\033[0;36m\n";
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, -0x40(%rbp)
cvtsi2sd %esi, %xmm0
movq 0xcee5(%rip), %r13      # 0x12fb0
movsd %xmm0, -0x30(%rbp)
movq -0x40(%rbp), %rax
xorps %xmm1, %xmm1
cvtsi2sdl (%rax), %xmm1
movsd %xmm1, -0x38(%rbp)
movl $0x9, %edx
movq %r13, %rdi
leaq 0x870f(%rip), %rsi      # 0xe7fe
callq 0x3310
movsd -0x38(%rbp), %xmm0
mulsd 0x856f(%rip), %xmm0     # 0xe670
divsd -0x30(%rbp), %xmm0
addsd 0x856a(%rip), %xmm0     # 0xe678
cvttsd2si %xmm0, %ebx
xorl %r15d, %r15d
leaq 0x86ec(%rip), %r12      # 0xe808
leaq 0x86ee(%rip), %r14      # 0xe811
xorl %eax, %eax
cmpl %ebx, %r15d
setl %al
movq %r14, %rsi
cmovlq %r12, %rsi
leaq (%rax,%rax,2), %rdx
addq $0x5, %rdx
movq %r13, %rdi
callq 0x3310
incl %r15d
cmpl $0x20, %r15d
jne 0x6123
movl $0x8, %edx
movq %r13, %rdi
leaq 0x86bd(%rip), %rsi      # 0xe817
callq 0x3310
movq %r13, %rdi
callq 0x31b0
movq $0x0, -0x50(%rbp)
movq $0x4c4b40, -0x48(%rbp)  # imm = 0x4C4B40
leaq -0x50(%rbp), %r14
movq %r14, %rdi
movq %r14, %rsi
callq 0x30b0
cmpl $-0x1, %eax
jne 0x6195
callq 0x3040
cmpl $0x4, (%rax)
je 0x617b
movsd -0x30(%rbp), %xmm0
ucomisd -0x38(%rbp), %xmm0
ja 0x60d0
movq 0xce04(%rip), %rdi      # 0x12fb0
leaq 0x866d(%rip), %rsi      # 0xe820
movl $0x8, %edx
callq 0x3310
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq