LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: iZhangHui[P]CppPrimer/CH08_TheIOLibrary/examples/buf.cc
// Function: main
int main()
{
	// writes hi and a newline, then flushes the buffer
    cout << "hi!" << endl;  

	// writes hi, then flushes the buffer; adds no data
    cout << "hi!" << flush; 

	// writes hi and a null, then flushes the buffer
    cout << "hi!" << ends;  

    cout << unitbuf;         // all writes will be flushed immediately

	// any output is flushed immediately, no buffering
    cout << "first" << " second" << endl;

	cout << nounitbuf;       // returns to normal buffering

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x0, -0x4(%rbp)
movq 0x2dfa(%rip), %rdi      # 0x3fd0
leaq 0xe27(%rip), %rsi       # 0x2004
callq 0x1050
movq %rax, %rdi
movq 0x2dd4(%rip), %rsi      # 0x3fc0
callq 0x1060
movq 0x2dd8(%rip), %rdi      # 0x3fd0
leaq 0xe05(%rip), %rsi       # 0x2004
callq 0x1050
movq %rax, %rdi
movq 0x2dca(%rip), %rsi      # 0x3fd8
callq 0x1060
movq 0x2db6(%rip), %rdi      # 0x3fd0
leaq 0xde3(%rip), %rsi       # 0x2004
callq 0x1050
movq %rax, %rdi
movq 0x2d80(%rip), %rsi      # 0x3fb0
callq 0x1060
movq 0x2d94(%rip), %rdi      # 0x3fd0
leaq 0x5d(%rip), %rsi        # 0x12a0
callq 0x1030
movq 0x2d81(%rip), %rdi      # 0x3fd0
leaq 0xdb2(%rip), %rsi       # 0x2008
callq 0x1050
movq %rax, %rdi
leaq 0xda9(%rip), %rsi       # 0x200e
callq 0x1050
movq %rax, %rdi
movq 0x2d4c(%rip), %rsi      # 0x3fc0
callq 0x1060
movq 0x2d50(%rip), %rdi      # 0x3fd0
leaq 0x49(%rip), %rsi        # 0x12d0
callq 0x1030
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: akw0088[P]openssl/base64_dec.c
// Function: main
int main(int argc, char *argv[])
{
	if (argc < 2)
	{
		printf("Usage: base64_dec file.base64\r\n");
		return -1;
	}

	unsigned int size = 0;

	char *buffer = get_file(argv[1], &size);
	if (buffer == NULL)
	{
		printf("Unable to open %s\r\n", argv[1]);
		return -1;
	}

	unsigned char *decode = (unsigned char *)malloc(size);
	if (decode == NULL)
	{
		perror("malloc failed");
		return -1;
	}
	memset(decode, 0, size);
	size_t length = size;



	printf("Base64: %s\n", buffer);
	base64decode(buffer, strlen(buffer), decode, &length);
	printf("decode: %s\nlength %d\n", decode, (int)length);


	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x2, -0x8(%rbp)
jge 0x13c6
leaq 0xc94(%rip), %rdi       # 0x2047
movb $0x0, %al
callq 0x1070
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x14a2
movl $0x0, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x14(%rbp), %rsi
callq 0x1200
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x140b
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0xc6f(%rip), %rdi       # 0x2067
movb $0x0, %al
callq 0x1070
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x14a2
movl -0x14(%rbp), %eax
movl %eax, %edi
callq 0x10b0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x1435
leaq 0xc54(%rip), %rdi       # 0x207b
callq 0x10e0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x14a2
movq -0x28(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, %edx
xorl %esi, %esi
callq 0x1080
movl -0x14(%rbp), %eax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rsi
leaq 0xc32(%rip), %rdi       # 0x2089
movb $0x0, %al
callq 0x1070
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rdi
callq 0x1060
movq -0x38(%rbp), %rdi
movq %rax, %rsi
movq -0x28(%rbp), %rdx
leaq -0x30(%rbp), %rcx
callq 0x1790
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rax
movl %eax, %edx
leaq 0xc01(%rip), %rdi       # 0x2095
movb $0x0, %al
callq 0x1070
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: roberty65[P]bServer/frame/testClient/testBenchmark.cpp
// Function: _send_req(int, int, char*, int, char const*)
static int __send_req(int fd, int cmd, char *reqbuf, int size, const char *tag)
{
	struct proto_h16_head *h = (struct proto_h16_head *)reqbuf;
	int msize = size + sizeof(*h);

	h->len = msize;
	h->cmd = cmd;
	h->ver = 1;
	h->syn = 2;
	h->ack = 3;
	*(int *)(h + 1) = 0; // to tell echo rsp immediately

	while (true) {
		ssize_t wlen = beyondy::XbsWriteN(fd, reqbuf, msize, timeout);
		if (wlen < 0 && errno == EINTR) continue;
		if (wlen != msize) {
			fprintf(stdout, "FAIL: %s pkg-size=%d, write req failed: %m\n", tag, size);
			return -1;	
		}

		break;
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
movslq -0x1c(%rbp), %rax
addq $0x10, %rax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movl -0xc(%rbp), %eax
movw %ax, %cx
movq -0x30(%rbp), %rax
movw %cx, 0x4(%rax)
movq -0x30(%rbp), %rax
movw $0x1, 0x6(%rax)
movq -0x30(%rbp), %rax
movl $0x2, 0x8(%rax)
movq -0x30(%rbp), %rax
movl $0x3, 0xc(%rax)
movq -0x30(%rbp), %rax
movl $0x0, 0x10(%rax)
movl -0x8(%rbp), %edi
movq -0x18(%rbp), %rsi
movslq -0x34(%rbp), %rdx
movslq 0x4268(%rip), %rcx      # 0x7188
callq 0x3170
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jge 0x2f3c
callq 0x2040
cmpl $0x4, (%rax)
jne 0x2f3c
jmp 0x2f0e
movq -0x40(%rbp), %rax
movslq -0x34(%rbp), %rcx
cmpq %rcx, %rax
je 0x2f71
movq 0x4068(%rip), %rax      # 0x6fb8
movq (%rax), %rdi
movq -0x28(%rbp), %rdx
movl -0x1c(%rbp), %ecx
leaq 0x22fe(%rip), %rsi      # 0x525f
movb $0x0, %al
callq 0x2210
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2f7a
jmp 0x2f73
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: roberty65[P]bServer/frame/testClient/testBenchmark.cpp
// Function: _read_rsp(int, char*, int, char const*)
static int __read_rsp(int fd, char *rspbuf, int size, const char *tag)
{
	while (true) {
		int msize = size + sizeof(struct proto_h16_head);
		ssize_t rlen = beyondy::XbsReadN(fd, rspbuf, msize, timeout);

		if (rlen != msize) {
			fprintf(stdout, "FAIL: %s pkg-size=%d, read rsp failed: %m\n", tag, msize);
			return -1;	
		}

		break;
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movslq -0x14(%rbp), %rax
addq $0x10, %rax
movl %eax, -0x24(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
movslq -0x24(%rbp), %rdx
movslq 0x41c5(%rip), %rcx      # 0x7188
callq 0x34d0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movslq -0x24(%rbp), %rcx
cmpq %rcx, %rax
je 0x3001
movq 0x3fd8(%rip), %rax      # 0x6fb8
movq (%rax), %rdi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
leaq 0x229a(%rip), %rsi      # 0x528b
movb $0x0, %al
callq 0x2210
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x300a
jmp 0x3003
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: akw0088[P]openssl/base64_enc.c
// Function: main
int main(int argc, char *argv[])
{
	if (argc < 2)
	{
		printf("Usage: base64_enc file.bin\r\n");
		return -1;
	}

	unsigned int size = 0;

	char *encode = get_file(argv[1], &size);
	int buf_size = (size / 3) * 4;
	if (size % 3)
		buf_size += 4;

	char *buffer = (char *)malloc(buf_size);
	if (buffer == NULL)
	{
		perror("malloc failed");
		return -1;
	}

	memset(buffer, 0, buf_size);
	base64encode(encode, size, buffer, buf_size);
	buffer[buf_size] = 0;
	printf("Base64: %s\n", buffer);

	write_file((char *)"file.base64", buffer, buf_size);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x2, -0x8(%rbp)
jge 0x13b6
leaq 0xca4(%rip), %rdi       # 0x2047
movb $0x0, %al
callq 0x1060
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1484
movl $0x0, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x14(%rbp), %rsi
callq 0x11f0
movq %rax, -0x20(%rbp)
movl -0x14(%rbp), %eax
movl $0x3, %ecx
xorl %edx, %edx
divl %ecx
shll $0x2, %eax
movl %eax, -0x24(%rbp)
movl -0x14(%rbp), %eax
movl $0x3, %ecx
xorl %edx, %edx
divl %ecx
cmpl $0x0, %edx
je 0x13fe
movl -0x24(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x24(%rbp)
movslq -0x24(%rbp), %rdi
callq 0x10a0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x1427
leaq 0xc4b(%rip), %rdi       # 0x2064
callq 0x10d0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1484
movq -0x30(%rbp), %rdi
movslq -0x24(%rbp), %rdx
xorl %esi, %esi
callq 0x1070
movq -0x20(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, %esi
movq -0x30(%rbp), %rdx
movslq -0x24(%rbp), %rcx
callq 0x1490
movq -0x30(%rbp), %rax
movslq -0x24(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x30(%rbp), %rsi
leaq 0xc0f(%rip), %rdi       # 0x2072
movb $0x0, %al
callq 0x1060
movq -0x30(%rbp), %rsi
movl -0x24(%rbp), %edx
leaq 0xc06(%rip), %rdi       # 0x207e
callq 0x12e0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: eschwabe[P]interview-practice/src/towers.cpp
// Function: PrintStacks(Adapter<std::stack<int, std::deque<int, std::allocator<int>>>>&, Adapter<std::stack<int, std::deque<int, std::allocator<int>>>>&, Adapter<std::stack<int, std::deque<int, std::allocator<int>>>>&)
void PrintStacks(MyStack& source, MyStack& dest, MyStack& temp) {

    cout << "SRC: ";
    for(auto i : source.get_container()) {
        cout << i << " ";
    }
    cout << endl;

    cout << "DEST: ";
    for(auto i : dest.get_container()) {
        cout << i << " ";
    }
    cout << endl;

    cout << "TEMP: ";
    for(auto i : temp.get_container()) {
        cout << i << " ";
    }
    cout << endl;
    cout << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq 0x4c9a(%rip), %rdi      # 0x5fd8
leaq 0x1cbf(%rip), %rsi      # 0x3004
callq 0x10a0
movq -0x8(%rbp), %rdi
callq 0x1700
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x1710
movq -0x20(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x1740
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x1770
testb $0x1, %al
jne 0x1384
jmp 0x13bb
leaq -0x40(%rbp), %rdi
callq 0x17a0
movl (%rax), %eax
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %esi
movq 0x4c3c(%rip), %rdi      # 0x5fd8
callq 0x1120
movq %rax, %rdi
leaq 0x1c5d(%rip), %rsi      # 0x3008
callq 0x10a0
leaq -0x40(%rbp), %rdi
callq 0x17c0
jmp 0x1371
movq 0x4c16(%rip), %rdi      # 0x5fd8
movq 0x4bff(%rip), %rsi      # 0x5fc8
callq 0x10d0
movq 0x4c03(%rip), %rdi      # 0x5fd8
leaq 0x1c2e(%rip), %rsi      # 0x300a
callq 0x10a0
movq -0x10(%rbp), %rdi
callq 0x1700
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0x1710
movq -0x70(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x1740
leaq -0x90(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x1770
testb $0x1, %al
jne 0x1427
jmp 0x146a
leaq -0x90(%rbp), %rdi
callq 0x17a0
movl (%rax), %eax
movl %eax, -0xb4(%rbp)
movl -0xb4(%rbp), %esi
movq 0x4b90(%rip), %rdi      # 0x5fd8
callq 0x1120
movq %rax, %rdi
leaq 0x1bb1(%rip), %rsi      # 0x3008
callq 0x10a0
leaq -0x90(%rbp), %rdi
callq 0x17c0
jmp 0x140e
movq 0x4b67(%rip), %rdi      # 0x5fd8
movq 0x4b50(%rip), %rsi      # 0x5fc8
callq 0x10d0
movq 0x4b54(%rip), %rdi      # 0x5fd8
leaq 0x1b86(%rip), %rsi      # 0x3011
callq 0x10a0
movq -0x18(%rbp), %rdi
callq 0x1700
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rsi
leaq -0xe0(%rbp), %rdi
callq 0x1710
movq -0xc0(%rbp), %rsi
leaq -0x100(%rbp), %rdi
callq 0x1740
leaq -0xe0(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x1770
testb $0x1, %al
jne 0x14df
jmp 0x1522
leaq -0xe0(%rbp), %rdi
callq 0x17a0
movl (%rax), %eax
movl %eax, -0x104(%rbp)
movl -0x104(%rbp), %esi
movq 0x4ad8(%rip), %rdi      # 0x5fd8
callq 0x1120
movq %rax, %rdi
leaq 0x1af9(%rip), %rsi      # 0x3008
callq 0x10a0
leaq -0xe0(%rbp), %rdi
callq 0x17c0
jmp 0x14c6
movq 0x4aaf(%rip), %rdi      # 0x5fd8
movq 0x4a98(%rip), %rsi      # 0x5fc8
callq 0x10d0
movq 0x4a9c(%rip), %rdi      # 0x5fd8
movq 0x4a85(%rip), %rsi      # 0x5fc8
callq 0x10d0
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: eschwabe[P]interview-practice/src/towers.cpp
// Function: MoveDisc(Adapter<std::stack<int, std::deque<int, std::allocator<int>>>>&, Adapter<std::stack<int, std::deque<int, std::allocator<int>>>>&, Adapter<std::stack<int, std::deque<int, std::allocator<int>>>>&, int)
void MoveDisc(MyStack& source, MyStack& dest, MyStack& temp, int count) {
    if(count == 0) {
        return;
    }
    if(count > 1) {
        MoveDisc(source, dest, temp, count-1);
    }

    MoveDisc(dest, temp, source, count-1);
    dest.push(source.top());
    source.pop();
    PrintStacks(s_source, s_dest, s_temp);
    MoveDisc(temp, dest, source, count-1);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x1582
jmp 0x160d
cmpl $0x1, -0x1c(%rbp)
jle 0x159f
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
callq 0x1560
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x8(%rbp), %rdx
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
callq 0x1560
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1840
movq -0x28(%rbp), %rdi
movq %rax, %rsi
callq 0x1810
movq -0x8(%rbp), %rdi
callq 0x1860
leaq 0x4ae5(%rip), %rdi      # 0x60c8
leaq 0x4b7e(%rip), %rsi      # 0x6168
leaq 0x4b27(%rip), %rdx      # 0x6118
callq 0x1320
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x8(%rbp), %rdx
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
callq 0x1560
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: eschwabe[P]interview-practice/src/towers.cpp
// Function: main
int main()
{

    const int N = 3;
    for(int i = N; i > 0; --i) {
        s_source.push(i);
    }

    PrintStacks(s_source, s_dest, s_temp);

    MoveDisc(s_source, s_dest, s_temp, N);

    PrintStacks(s_source, s_dest, s_temp);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x0, -0x4(%rbp)
movl $0x3, -0x8(%rbp)
movl $0x3, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jle 0x165e
leaq 0x4a7e(%rip), %rdi      # 0x60c8
leaq -0xc(%rbp), %rsi
callq 0x1810
movl -0xc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x163d
leaq 0x4a63(%rip), %rdi      # 0x60c8
leaq 0x4afc(%rip), %rsi      # 0x6168
leaq 0x4aa5(%rip), %rdx      # 0x6118
callq 0x1320
leaq 0x4a49(%rip), %rdi      # 0x60c8
leaq 0x4ae2(%rip), %rsi      # 0x6168
leaq 0x4a8b(%rip), %rdx      # 0x6118
movl $0x3, %ecx
callq 0x1560
leaq 0x4a2a(%rip), %rdi      # 0x60c8
leaq 0x4ac3(%rip), %rsi      # 0x6168
leaq 0x4a6c(%rip), %rdx      # 0x6118
callq 0x1320
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: graphitemaster[P]smbf/smbf.cpp
// Function: u::getline[abi:cxx11](u::file&)
u::optional<u::string> getline(u::file &fp) {
    u::string s;
    for (;;) {
        char buf[256];
        if (!fgets(buf, sizeof(buf), fp.get())) {
            if (feof(fp.get())) {
                if (s.empty())
                    return u::none;
                else
                    return u::move(s);
            }
            abort();
        }
        size_t n = strlen(buf);
        if (n && buf[n - 1] == '\n')
            --n;
        s.append(buf, n);
        if (n < sizeof(buf) - 1)
            return u::move(s);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rdi, -0x158(%rbp)
movq %rdi, %rax
movq %rax, -0x150(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x2290
movq -0x10(%rbp), %rdi
callq 0x2540
movq %rax, %rdx
leaq -0x130(%rbp), %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x22f0
movq %rax, -0x160(%rbp)
jmp 0x2673
movq -0x160(%rbp), %rax
cmpq $0x0, %rax
jne 0x272c
movq -0x10(%rbp), %rdi
callq 0x2540
movq %rax, %rdi
callq 0x22d0
cmpl $0x0, %eax
je 0x2727
leaq -0x30(%rbp), %rdi
callq 0x2320
testb $0x1, %al
jne 0x26ad
jmp 0x26f1
movq -0x158(%rbp), %rdi
movq $-0x1, %rsi
callq 0x6dd0
jmp 0x26c2
movl $0x1, -0x140(%rbp)
jmp 0x27d1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x138(%rbp)
movl %eax, -0x13c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x2110
jmp 0x27ea
leaq -0x30(%rbp), %rdi
callq 0x6df0
movq %rax, -0x168(%rbp)
jmp 0x2703
movq -0x168(%rbp), %rsi
movq -0x158(%rbp), %rdi
callq 0x6e00
jmp 0x2718
movl $0x1, -0x140(%rbp)
jmp 0x27d1
callq 0x20f0
leaq -0x130(%rbp), %rdi
callq 0x20c0
movq %rax, -0x148(%rbp)
cmpq $0x0, -0x148(%rbp)
je 0x2773
movq -0x148(%rbp), %rax
subq $0x1, %rax
movsbl -0x130(%rbp,%rax), %eax
cmpl $0xa, %eax
jne 0x2773
movq -0x148(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdx
leaq -0x30(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x2040
jmp 0x278c
cmpq $0xff, -0x148(%rbp)
jae 0x27cc
leaq -0x30(%rbp), %rdi
callq 0x6df0
movq %rax, -0x170(%rbp)
jmp 0x27ab
movq -0x170(%rbp), %rsi
movq -0x158(%rbp), %rdi
callq 0x6e00
jmp 0x27c0
movl $0x1, -0x140(%rbp)
jmp 0x27d1
jmp 0x264d
leaq -0x30(%rbp), %rdi
callq 0x2110
movq -0x150(%rbp), %rax
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
movq -0x138(%rbp), %rdi
callq 0x2330
nopw %cs:(%rax,%rax)
// File: graphitemaster[P]smbf/smbf.cpp
// Function: vertexCacheData::findTriangle(unsigned long)
size_t vertexCacheData::findTriangle(size_t triangle) {
    for (size_t i = 0; i < indices.size(); i++)
        if (indices[i] == triangle)
            return i;
    return (size_t)-1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
callq 0x6e30
movq %rax, %rcx
movq -0x30(%rbp), %rax
cmpq %rcx, %rax
jae 0x28ad
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x6e50
movq (%rax), %rax
cmpq -0x18(%rbp), %rax
jne 0x289d
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x28b5
jmp 0x289f
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x2860
movq $-0x1, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nop
// File: graphitemaster[P]smbf/smbf.cpp
// Function: vertexCacheData::moveTriangle(unsigned long)
void vertexCacheData::moveTriangle(size_t triangle) {
    size_t index = findTriangle(triangle);
    assert(index != (size_t)-1);

    // Erase the index and add it to the end
    indices.erase(indices.begin() + index,
                  indices.begin() + index + 1);
    indices.push_back(triangle);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x60(%rbp)
movq -0x10(%rbp), %rsi
callq 0x2840
movq %rax, -0x18(%rbp)
cmpq $-0x1, -0x18(%rbp)
je 0x28ee
jmp 0x290d
leaq 0xd77f(%rip), %rdi      # 0x10074
leaq 0xd78c(%rip), %rsi      # 0x10088
movl $0x324, %edx            # imm = 0x324
leaq 0xd789(%rip), %rcx      # 0x10091
callq 0x2120
movq -0x60(%rbp), %rdi
callq 0x6f00
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x6f30
movq %rax, -0x28(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x6f70
movq -0x60(%rbp), %rdi
callq 0x6f00
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0x6f30
movq %rax, -0x48(%rbp)
leaq -0x48(%rbp), %rdi
movl $0x1, %esi
callq 0x6f30
movq %rax, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x6f70
movq -0x60(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x6e70
movq -0x60(%rbp), %rdi
movq %rax, -0x58(%rbp)
leaq -0x10(%rbp), %rsi
callq 0x6fb0
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)
// File: graphitemaster[P]smbf/smbf.cpp
// Function: vertexCache::findVertex(unsigned long)
size_t vertexCache::findVertex(size_t vertex) {
    for (size_t i = 0; i < 32; i++)
        if (m_cache[i] == vertex)
            return i;
    return (size_t)-1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq $0x0, -0x20(%rbp)
cmpq $0x20, -0x20(%rbp)
jae 0x2a7f
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq -0x18(%rbp), %rax
jne 0x2a6f
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x2a87
jmp 0x2a71
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x2a4c
movq $-0x1, -0x8(%rbp)
movq -0x8(%rbp), %rax
popq %rbp
retq
nopl (%rax)
// File: graphitemaster[P]smbf/smbf.cpp
// Function: vertexCache::addVertex(unsigned long)
void vertexCache::addVertex(size_t vertex) {
    size_t w = findVertex(vertex);
    // remove the vertex for later reinsertion at the top
    if (w != (size_t)-1)
        removeVertex(w);
    else // not found, cache miss!
        m_misses++;
    // shift all vertices down to make room for the new top vertex
    for (size_t i = 39; i != 0; i--)
        m_cache[i] = m_cache[i - 1];
    // add new vertex to cache
    m_cache[0] = vertex;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x28(%rbp)
movq -0x10(%rbp), %rsi
callq 0x2a30
movq %rax, -0x18(%rbp)
cmpq $-0x1, -0x18(%rbp)
je 0x2b1b
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x2a90
jmp 0x2b31
movq -0x28(%rbp), %rax
movq 0x140(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x140(%rax)
movq $0x27, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x2b66
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rdx
movq -0x20(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x20(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x2b39
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
movq %rcx, (%rax)
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: graphitemaster[P]smbf/smbf.cpp
// Function: vertexCache::getCacheMissCount(std::vector<unsigned long, std::allocator<unsigned long>> const&)
size_t vertexCache::getCacheMissCount(const u::vector<size_t> &indices) {
    clear();
    for (auto &it : indices)
        addVertex(it);
    return m_misses;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x38(%rbp)
callq 0x2b80
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x7040
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x7070
movq %rax, -0x28(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x70a0
testb $0x1, %al
jne 0x2c42
jmp 0x2c6a
leaq -0x20(%rbp), %rdi
callq 0x70e0
movq -0x38(%rbp), %rdi
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rsi
callq 0x2ae0
leaq -0x20(%rbp), %rdi
callq 0x7100
jmp 0x2c2f
movq -0x38(%rbp), %rax
movq 0x140(%rax), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: graphitemaster[P]smbf/smbf.cpp
// Function: vertexCacheOptimizer::optimize(std::vector<unsigned long, std::allocator<unsigned long>>&)
vertexCacheOptimizer::result vertexCacheOptimizer::optimize(u::vector<size_t> &indices) {
    size_t find = (size_t)-1;
    for (size_t i = 0; i < indices.size(); i++)
        if (find == (size_t)-1 || (find != (size_t)-1 && indices[i] > find))
            find = indices[i];
    if (find == (size_t)-1)
        return kErrorNoVertices;

    result begin = init(indices, find + 1);
    if (begin != kSuccess)
        return begin;

    // Process
    while (process())
        ;

    // Rewrite the indices
    for (size_t i = 0; i < m_drawList.size(); i++)
        for (size_t j = 0; j < 3; j++)
            indices[3 * i + j] = m_triangles[m_drawList[i]].vertices[j];

    return kSuccess;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movq $-0x1, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rdi
callq 0x6e30
movq %rax, %rcx
movq -0x50(%rbp), %rax
cmpq %rcx, %rax
jae 0x2dfd
cmpq $-0x1, -0x20(%rbp)
je 0x2dd9
cmpq $-0x1, -0x20(%rbp)
je 0x2ded
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x6e50
movq (%rax), %rax
cmpq -0x20(%rbp), %rax
jbe 0x2ded
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x6e50
movq (%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x2def
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x2d98
cmpq $-0x1, -0x20(%rbp)
jne 0x2e10
movl $0x2, -0x4(%rbp)
jmp 0x2efa
movq -0x48(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
addq $0x1, %rdx
callq 0x2f10
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x2e39
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x2efa
jmp 0x2e3b
movq -0x48(%rbp), %rdi
callq 0x7280
testb $0x1, %al
jne 0x2e4a
jmp 0x2e4c
jmp 0x2e3b
movq $0x0, -0x38(%rbp)
movq -0x48(%rbp), %rdi
movq -0x38(%rbp), %rax
movq %rax, -0x58(%rbp)
addq $0x48, %rdi
callq 0x6e30
movq %rax, %rcx
movq -0x58(%rbp), %rax
cmpq %rcx, %rax
jae 0x2ef3
movq $0x0, -0x40(%rbp)
cmpq $0x3, -0x40(%rbp)
jae 0x2ee0
movq -0x48(%rbp), %rdi
movq %rdi, %rax
addq $0x18, %rax
movq %rax, -0x68(%rbp)
addq $0x48, %rdi
movq -0x38(%rbp), %rsi
callq 0x6e50
movq -0x68(%rbp), %rdi
movq (%rax), %rsi
callq 0x7320
movq -0x40(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rdi
imulq $0x3, -0x38(%rbp), %rsi
addq -0x40(%rbp), %rsi
callq 0x6e50
movq -0x60(%rbp), %rcx
movq %rcx, (%rax)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x2e7d
jmp 0x2ee2
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x2e54
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: graphitemaster[P]smbf/smbf.cpp
// Function: vertexCacheOptimizer::calcVertexScore(unsigned long)
float vertexCacheOptimizer::calcVertexScore(size_t vertex) {
    vertexCacheData *v = &m_vertices[vertex];
    if (v->remainingValence == (size_t)-1 || v->remainingValence == 0)
        return -1.0f; // No triangle needs this vertex

    float value = 0.0f;
    if (v->cachePosition == (size_t)-1) {
        // Vertex is not in FIFO cache.
    } else {
        if (v->cachePosition < 3) {
            // This vertex was used in the last triangle. It has fixed score
            // in whichever of the tree it's in.
            value = kLastTriScore;
        } else {
            // Points for being heigh in the cache
            const float scale = 1.0f / (32 - 3);
            value = 1.0f - (v->cachePosition - 3) * scale;
            value = powf(value, kCacheDecayPower);
        }
    }

    // Bonus points for having a low number of triangles.
    float valenceBoost = powf(float(v->remainingValence), -kValenceBoostPower);
    value += kValenceBoostScale * valenceBoost;
    return value;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x7340
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq $-0x1, 0x30(%rax)
je 0x31e7
movq -0x20(%rbp), %rax
cmpq $0x0, 0x30(%rax)
jne 0x31f9
movss 0xce29(%rip), %xmm0     # 0x10018
movss %xmm0, -0x4(%rbp)
jmp 0x3333
xorps %xmm0, %xmm0
movss %xmm0, -0x24(%rbp)
movq -0x20(%rbp), %rax
cmpq $-0x1, 0x18(%rax)
jne 0x3211
jmp 0x32be
movq -0x20(%rbp), %rax
cmpq $0x3, 0x18(%rax)
jae 0x322e
movss 0xcdec(%rip), %xmm0     # 0x10010
movss %xmm0, -0x24(%rbp)
jmp 0x32bc
movl $0x3d0d3dcb, -0x28(%rbp) # imm = 0x3D0D3DCB
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
addq $-0x3, %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x34(%rbp)
testq %rax, %rax
movss %xmm0, -0x30(%rbp)
js 0x3276
movss -0x34(%rbp), %xmm0
movss %xmm0, -0x30(%rbp)
movss -0x30(%rbp), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movss 0xcd78(%rip), %xmm1     # 0x10008
mulss %xmm1, %xmm0
movss 0xcd70(%rip), %xmm1     # 0x1000c
addss %xmm1, %xmm0
movss %xmm0, -0x24(%rbp)
movss -0x24(%rbp), %xmm0
movss 0xcd52(%rip), %xmm1     # 0x10004
callq 0x22e0
movss %xmm0, -0x24(%rbp)
jmp 0x32be
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x3c(%rbp)
testq %rax, %rax
movss %xmm0, -0x38(%rbp)
js 0x32fb
movss -0x3c(%rbp), %xmm0
movss %xmm0, -0x38(%rbp)
movss -0x38(%rbp), %xmm0
movss 0xcd0c(%rip), %xmm1     # 0x10014
callq 0x22e0
movss %xmm0, -0x2c(%rbp)
movss -0x2c(%rbp), %xmm0
movss -0x24(%rbp), %xmm1
addss %xmm0, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x24(%rbp)
movss -0x24(%rbp), %xmm0
movss %xmm0, -0x4(%rbp)
movss -0x4(%rbp), %xmm0
addq $0x40, %rsp
popq %rbp
retq
nop
// File: graphitemaster[P]smbf/smbf.cpp
// Function: vertexCacheOptimizer::fullScoreRecalculation()
size_t vertexCacheOptimizer::fullScoreRecalculation() {
    // Calculate score for all vertices
    for (size_t i = 0; i < m_vertices.size(); i++)
        m_vertices[i].currentScore = calcVertexScore(i);

    // Calculate scores for all active triangles
    float maxScore = 0.0f;
    size_t maxScoreTriangle = (size_t)-1;
    bool firstTime = true;

    for (size_t i = 0; i < m_triangles.size(); i++) {
        auto &it = m_triangles[i];
        if (it.rendered)
            continue;

        // Sum the score of all the triangle's vertices
        float sum = m_vertices[it.vertices[0]].currentScore +
                    m_vertices[it.vertices[1]].currentScore +
                    m_vertices[it.vertices[2]].currentScore;
        it.currentScore = sum;

        if (firstTime || sum > maxScore) {
            firstTime = false;
            maxScore = sum;
            maxScoreTriangle = i;
        }
    }

    return maxScoreTriangle;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq $0x0, -0x10(%rbp)
movq -0x48(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
callq 0x7360
movq %rax, %rcx
movq -0x50(%rbp), %rax
cmpq %rcx, %rax
jae 0x33b0
movq -0x48(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x31b0
movq -0x48(%rbp), %rdi
movss %xmm0, -0x54(%rbp)
movq -0x10(%rbp), %rsi
callq 0x7340
movss -0x54(%rbp), %xmm0
movss %xmm0, 0x20(%rax)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x335c
xorps %xmm0, %xmm0
movss %xmm0, -0x14(%rbp)
movq $-0x1, -0x20(%rbp)
movb $0x1, -0x21(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x48(%rbp), %rdi
movq -0x30(%rbp), %rax
movq %rax, -0x60(%rbp)
addq $0x18, %rdi
callq 0x7380
movq %rax, %rcx
movq -0x60(%rbp), %rax
cmpq %rcx, %rax
jae 0x34b7
movq -0x48(%rbp), %rdi
addq $0x18, %rdi
movq -0x30(%rbp), %rsi
callq 0x7320
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
testb $0x1, (%rax)
je 0x3414
jmp 0x34a6
movq -0x48(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x7340
movq -0x48(%rbp), %rdi
movss 0x20(%rax), %xmm0
movss %xmm0, -0x68(%rbp)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x7340
movss -0x68(%rbp), %xmm0
movq -0x48(%rbp), %rdi
addss 0x20(%rax), %xmm0
movss %xmm0, -0x64(%rbp)
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x7340
movss -0x64(%rbp), %xmm0
addss 0x20(%rax), %xmm0
movss %xmm0, -0x3c(%rbp)
movss -0x3c(%rbp), %xmm0
movq -0x38(%rbp), %rax
movss %xmm0, 0x4(%rax)
testb $0x1, -0x21(%rbp)
jne 0x348e
movss -0x3c(%rbp), %xmm0
ucomiss -0x14(%rbp), %xmm0
jbe 0x34a4
movb $0x0, -0x21(%rbp)
movss -0x3c(%rbp), %xmm0
movss %xmm0, -0x14(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x34a6
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x33cc
movq -0x20(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: graphitemaster[P]smbf/smbf.cpp
// Function: vertexCacheOptimizer::initialPass()
vertexCacheOptimizer::result vertexCacheOptimizer::initialPass() {
    for (size_t i = 0; i < m_indices.size(); i++) {
        size_t index = m_indices[i];
        if (index == (size_t)-1 || index >= m_vertices.size())
            return kErrorInvalidIndex;
        m_vertices[index].totalValence++;
        m_vertices[index].remainingValence++;
        m_vertices[index].indices.push_back(i / 3);
    }
    m_bestTriangle = fullScoreRecalculation();
    return kSuccess;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
addq $0x30, %rdi
callq 0x6e30
movq %rax, %rcx
movq -0x38(%rbp), %rax
cmpq %rcx, %rax
jae 0x35c7
movq -0x30(%rbp), %rdi
addq $0x30, %rdi
movq -0x18(%rbp), %rsi
callq 0x6e50
movq (%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $-0x1, -0x20(%rbp)
je 0x354d
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
callq 0x7360
movq %rax, %rcx
movq -0x40(%rbp), %rax
cmpq %rcx, %rax
jb 0x3559
movl $0x1, -0x4(%rbp)
jmp 0x35e5
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x7340
movq -0x30(%rbp), %rdi
movq 0x28(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x28(%rax)
movq -0x20(%rbp), %rsi
callq 0x7340
movq -0x30(%rbp), %rdi
movq 0x30(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x30(%rax)
movq -0x20(%rbp), %rsi
callq 0x7340
movq %rax, %rdi
movq -0x18(%rbp), %rax
movl $0x3, %ecx
xorl %edx, %edx
divq %rcx
movq %rax, -0x28(%rbp)
leaq -0x28(%rbp), %rsi
callq 0x73b0
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x34ec
movq -0x30(%rbp), %rdi
callq 0x3340
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x1a8(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop
// File: graphitemaster[P]smbf/smbf.cpp
// Function: vertexCacheOptimizer::addTriangle(unsigned long)
void vertexCacheOptimizer::addTriangle(size_t triangle) {
    // reset all cache positions
    for (size_t i = 0; i < 32; i++) {
        size_t find = m_vertexCache.getCachedVertex(i);
        if (find == (size_t)-1)
            continue;
        m_vertices[find].cachePosition = (size_t)-1;
    }

    triangleCacheData *t = &m_triangles[triangle];
    if (t->rendered)
        return;

    for (size_t i = 0; i < 3; i++) {
        // Add all the triangle's vertices to the cache
        m_vertexCache.addVertex(t->vertices[i]);
        vertexCacheData *v = &m_vertices[t->vertices[i]];

        // Decrease the remaining valence.
        v->remainingValence--;

        // Move the added triangle to the end of the vertex's triangle index
        // list such that the first `remainingValence' triangles in the index
        // list are only the active ones.
        v->moveTriangle(triangle);
    }

    // It's been rendered, mark it
    m_drawList.push_back(triangle);
    t->rendered = true;

    // Update all the vertex cache positions
    for (size_t i = 0; i < 32; i++) {
        size_t index = m_vertexCache.getCachedVertex(i);
        if (index == (size_t)-1)
            continue;
        m_vertices[index].cachePosition = i;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movq $0x0, -0x18(%rbp)
cmpq $0x20, -0x18(%rbp)
jae 0x3658
movq -0x50(%rbp), %rdi
addq $0x60, %rdi
movq -0x18(%rbp), %rsi
callq 0x2c80
movq %rax, -0x20(%rbp)
cmpq $-0x1, -0x20(%rbp)
jne 0x3635
jmp 0x364a
movq -0x50(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x7340
movq $-0x1, 0x18(%rax)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x3610
movq -0x50(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0x7320
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
testb $0x1, (%rax)
je 0x367b
jmp 0x3759
movq $0x0, -0x30(%rbp)
cmpq $0x3, -0x30(%rbp)
jae 0x36e9
movq -0x50(%rbp), %rdi
addq $0x60, %rdi
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rsi
callq 0x2ae0
movq -0x50(%rbp), %rdi
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rsi
callq 0x7340
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x30(%rax)
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x28c0
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x3683
movq -0x50(%rbp), %rdi
addq $0x48, %rdi
leaq -0x10(%rbp), %rsi
callq 0x6fb0
movq -0x28(%rbp), %rax
movb $0x1, (%rax)
movq $0x0, -0x40(%rbp)
cmpq $0x20, -0x40(%rbp)
jae 0x3759
movq -0x50(%rbp), %rdi
addq $0x60, %rdi
movq -0x40(%rbp), %rsi
callq 0x2c80
movq %rax, -0x48(%rbp)
cmpq $-0x1, -0x48(%rbp)
jne 0x372e
jmp 0x374b
movq -0x50(%rbp), %rdi
movq -0x40(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x48(%rbp), %rsi
callq 0x7340
movq -0x58(%rbp), %rcx
movq %rcx, 0x18(%rax)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x3709
addq $0x60, %rsp
popq %rbp
retq
nop
// File: graphitemaster[P]smbf/smbf.cpp
// Function: vertexCacheOptimizer::cleanFlags()
bool vertexCacheOptimizer::cleanFlags() {
    bool found = false;
    for (size_t i = 0; i < 32; i++) {
        size_t find = m_vertexCache.getCachedVertex(i);
        if (find == (size_t)-1)
            continue;

        vertexCacheData *v = &m_vertices[find];
        for (size_t j = 0; j < v->remainingValence; j++) {
            triangleCacheData *t = &m_triangles[v->indices[j]];
            found = true;
            // Clear flags
            t->calculated = false;
            for (size_t k = 0; k < 3; k++)
                m_vertices[t->vertices[k]].calculated = false;
        }
    }
    return found;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movb $0x0, -0x9(%rbp)
movq $0x0, -0x18(%rbp)
cmpq $0x20, -0x18(%rbp)
jae 0x3865
movq -0x48(%rbp), %rdi
addq $0x60, %rdi
movq -0x18(%rbp), %rsi
callq 0x2c80
movq %rax, -0x20(%rbp)
cmpq $-0x1, -0x20(%rbp)
jne 0x37ac
jmp 0x3854
movq -0x48(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x7340
movq %rax, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jae 0x3852
movq -0x48(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x50(%rbp)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x6e50
movq -0x50(%rbp), %rdi
movq (%rax), %rsi
callq 0x7320
movq %rax, -0x38(%rbp)
movb $0x1, -0x9(%rbp)
movq -0x38(%rbp), %rax
movb $0x0, 0x20(%rax)
movq $0x0, -0x40(%rbp)
cmpq $0x3, -0x40(%rbp)
jae 0x383f
movq -0x48(%rbp), %rdi
movq -0x38(%rbp), %rax
movq -0x40(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rsi
callq 0x7340
movb $0x0, 0x38(%rax)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x3810
jmp 0x3841
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x37c5
jmp 0x3854
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x3780
movb -0x9(%rbp), %al
andb $0x1, %al
addq $0x50, %rsp
popq %rbp
retq
// File: graphitemaster[P]smbf/smbf.cpp
// Function: vertexCacheOptimizer::triangleScoreRecalculation(unsigned long)
void vertexCacheOptimizer::triangleScoreRecalculation(size_t triangle) {
    triangleCacheData *t = &m_triangles[triangle];

    // Calculate vertex scores
    float sum = 0.0f;
    for (size_t i = 0; i < 3; i++) {
        vertexCacheData *v = &m_vertices[t->vertices[i]];
        float score = v->calculated ? v->currentScore : calcVertexScore(t->vertices[i]);
        v->currentScore = score;
        v->calculated = true;
        sum += score;
    }

    t->currentScore = sum;
    t->calculated = true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x40(%rbp)
addq $0x18, %rdi
movq -0x10(%rbp), %rsi
callq 0x7320
movq %rax, -0x18(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x1c(%rbp)
movq $0x0, -0x28(%rbp)
cmpq $0x3, -0x28(%rbp)
jae 0x3943
movq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rsi
callq 0x7340
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
testb $0x1, 0x38(%rax)
je 0x38e8
movq -0x30(%rbp), %rax
movss 0x20(%rax), %xmm0
movss %xmm0, -0x44(%rbp)
jmp 0x3903
movq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rsi
callq 0x31b0
movss %xmm0, -0x44(%rbp)
movss -0x44(%rbp), %xmm0
movss %xmm0, -0x34(%rbp)
movss -0x34(%rbp), %xmm0
movq -0x30(%rbp), %rax
movss %xmm0, 0x20(%rax)
movq -0x30(%rbp), %rax
movb $0x1, 0x38(%rax)
movss -0x34(%rbp), %xmm0
addss -0x1c(%rbp), %xmm0
movss %xmm0, -0x1c(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x38a9
movss -0x1c(%rbp), %xmm0
movq -0x18(%rbp), %rax
movss %xmm0, 0x4(%rax)
movq -0x18(%rbp), %rax
movb $0x1, 0x20(%rax)
addq $0x50, %rsp
popq %rbp
retq
nop
// File: graphitemaster[P]smbf/smbf.cpp
// Function: vertexCacheOptimizer::partialScoreRecalculation()
size_t vertexCacheOptimizer::partialScoreRecalculation() {
    // Iterate through all the vertices of the cache
    bool firstTime = true;
    float maxScore = 0.0f;
    size_t maxScoreTriangle = (size_t)-1;
    for (size_t i = 0; i < 32; i++) {
        size_t find = m_vertexCache.getCachedVertex(i);
        if (find == (size_t)-1)
            continue;

        vertexCacheData *v = &m_vertices[find];

        // Iterate through all the active triangles of this vertex
        for (size_t j = 0; j < v->remainingValence; j++) {
            size_t triangle = v->indices[j];
            triangleCacheData *t = &m_triangles[triangle];

            // Calculate triangle score if it isn't already calculated
            if (!t->calculated)
                triangleScoreRecalculation(triangle);

            float score = t->currentScore;
            // Found a triangle to process
            if (firstTime || score > maxScore) {
                firstTime = false;
                maxScore = score;
                maxScoreTriangle = triangle;
            }
        }
    }
    return maxScoreTriangle;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movb $0x1, -0x9(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x10(%rbp)
movq $-0x1, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
cmpq $0x20, -0x20(%rbp)
jae 0x3a82
movq -0x58(%rbp), %rdi
addq $0x60, %rdi
movq -0x20(%rbp), %rsi
callq 0x2c80
movq %rax, -0x28(%rbp)
cmpq $-0x1, -0x28(%rbp)
jne 0x39bc
jmp 0x3a71
movq -0x58(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x7340
movq %rax, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq -0x30(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jae 0x3a6f
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x6e50
movq -0x58(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x40(%rbp)
addq $0x18, %rdi
movq -0x40(%rbp), %rsi
callq 0x7320
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
testb $0x1, 0x20(%rax)
jne 0x3a27
movq -0x58(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x3870
movq -0x48(%rbp), %rax
movss 0x4(%rax), %xmm0
movss %xmm0, -0x4c(%rbp)
testb $0x1, -0x9(%rbp)
jne 0x3a46
movss -0x4c(%rbp), %xmm0
ucomiss -0x10(%rbp), %xmm0
jbe 0x3a5c
movb $0x0, -0x9(%rbp)
movss -0x4c(%rbp), %xmm0
movss %xmm0, -0x10(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x3a5e
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x39d5
jmp 0x3a71
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x3990
movq -0x18(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)
// File: graphitemaster[P]smbf/smbf.cpp
// Function: vertexCacheOptimizer::process()
inline bool vertexCacheOptimizer::process() {
    if (m_drawList.size() == m_triangles.size())
        return false;

    // Add the selected triangle to the draw list
    addTriangle(m_bestTriangle);

    // Recalculate the vertex and triangle scores and select the best triangle
    // for the next iteration.
    m_bestTriangle = cleanFlags() ? partialScoreRecalculation() : fullScoreRecalculation();

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x20(%rbp)
addq $0x48, %rdi
callq 0x6e30
movq -0x20(%rbp), %rdi
movq %rax, -0x18(%rbp)
addq $0x18, %rdi
callq 0x7380
movq %rax, %rcx
movq -0x18(%rbp), %rax
cmpq %rcx, %rax
jne 0x72c0
movb $0x0, -0x1(%rbp)
jmp 0x730e
movq -0x20(%rbp), %rdi
movq 0x1a8(%rdi), %rsi
callq 0x35f0
movq -0x20(%rbp), %rdi
callq 0x3760
testb $0x1, %al
jne 0x72df
jmp 0x72ee
movq -0x20(%rbp), %rdi
callq 0x3960
movq %rax, -0x28(%rbp)
jmp 0x72fb
movq -0x20(%rbp), %rdi
callq 0x3340
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq -0x28(%rbp), %rcx
movq %rcx, 0x1a8(%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: graphitemaster[P]smbf/smbf.cpp
// Function: u::sscanf(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, char const*, ...)
inline int sscanf(const u::string &thing, const char *fmt, ...) {
    va_list va;
    va_start(va, fmt);
    int value = detail::c99vsscanf(thing.c_str(), fmt, va);
    va_end(va);
    return value;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
testb %al, %al
je 0x79cb
movaps %xmm0, -0xc0(%rbp)
movaps %xmm1, -0xb0(%rbp)
movaps %xmm2, -0xa0(%rbp)
movaps %xmm3, -0x90(%rbp)
movaps %xmm4, -0x80(%rbp)
movaps %xmm5, -0x70(%rbp)
movaps %xmm6, -0x60(%rbp)
movaps %xmm7, -0x50(%rbp)
movq %r9, -0xc8(%rbp)
movq %r8, -0xd0(%rbp)
movq %rcx, -0xd8(%rbp)
movq %rdx, -0xe0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0xf0(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x30, -0x2c(%rbp)
movl $0x10, -0x30(%rbp)
movq -0x8(%rbp), %rdi
callq 0x20a0
movq %rax, %rdi
movq -0x10(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x2800
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
addq $0xf0, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: graphitemaster[P]smbf/smbf.cpp
// Function: u::split[abi:cxx11](char const*, char)
inline u::vector<u::string> split(const char *str, char ch = ' ') {
    u::vector<u::string> result;
    do {
        const char *begin = str;
        while (*str != ch && *str)
            str++;
        result.push_back(u::string(begin, str));
    } while (*str++);
    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x68(%rbp)
movb %dl, %al
movq %rdi, %rcx
movq %rcx, -0x60(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movb $0x0, -0x12(%rbp)
callq 0x88c0
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
movsbl -0x11(%rbp), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x69(%rbp)
je 0x87c5
movq -0x10(%rbp), %rax
cmpb $0x0, (%rax)
setne %al
movb %al, -0x69(%rbp)
movb -0x69(%rbp), %al
testb $0x1, %al
jne 0x87ce
jmp 0x87dc
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x87a4
movq -0x20(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq -0x41(%rbp), %rdi
movq %rdi, -0x78(%rbp)
callq 0x2340
movq -0x88(%rbp), %rsi
movq -0x80(%rbp), %rdx
movq -0x78(%rbp), %rcx
leaq -0x40(%rbp), %rdi
callq 0x8190
jmp 0x8816
movq -0x68(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x88e0
jmp 0x8825
leaq -0x40(%rbp), %rdi
callq 0x2110
leaq -0x41(%rbp), %rdi
callq 0x2200
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
cmpb $0x0, (%rax)
jne 0x879c
movb $0x1, -0x12(%rbp)
testb $0x1, -0x12(%rbp)
jne 0x889b
jmp 0x8892
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x887e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x2110
leaq -0x41(%rbp), %rdi
callq 0x2200
movq -0x68(%rbp), %rdi
callq 0x7bd0
jmp 0x88a8
movq -0x68(%rbp), %rdi
callq 0x7bd0
movq -0x60(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x2330
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: graphitemaster[P]smbf/smbf.cpp
// Function: m::abs(float)
inline float abs(float v) {
    union {
        float f;
        int b;
    } data = { v };
    data.b &= 0x7FFFFFFF;
    return data.f;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movss %xmm0, -0x4(%rbp)
movss -0x4(%rbp), %xmm0
movss %xmm0, -0x8(%rbp)
movl -0x8(%rbp), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x8(%rbp)
movss -0x8(%rbp), %xmm0
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop