LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/ivanzamanov[P]kmeans/src/common/stem.cpp
// Function: cvc(int)
static int cvc(int i)
{  if (i < k0+2 || !cons(i) || cons(i-1) || !cons(i-2)) return FALSE;
   {  int ch = b[i];
      if (ch == 'w' || ch == 'x' || ch == 'y') return FALSE;
   }
   return TRUE;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl 0x2549(%rip), %eax      # 0x409c
addl $0x2, %eax
xorl %ebx, %ebx
cmpl %edi, %eax
jg 0x1b98
movl %edi, %r14d
callq 0x1ba2
testl %eax, %eax
je 0x1b98
leal -0x1(%r14), %edi
callq 0x1ba2
testl %eax, %eax
jne 0x1b98
leal -0x2(%r14), %edi
callq 0x1ba2
testl %eax, %eax
je 0x1b98
movq 0x2507(%rip), %rax      # 0x4090
movslq %r14d, %rcx
movb (%rax,%rcx), %al
addb $-0x7a, %al
xorl %ebx, %ebx
cmpb $-0x3, %al
setb %bl
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/ivanzamanov[P]kmeans/src/common/utils.cpp
// Function: writeToken(char const*, int)
void writeToken(const char* buffer, int fd) {
	int len = strlen(buffer);
	int bytesWritten = write(fd, buffer, len);
	if(len != bytesWritten) {
		printf("Error writing token\n");
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
callq 0x1060
movslq %eax, %r15
movl %ebx, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x1050
cmpl %eax, %r15d
jne 0x1c5e
popq %rbx
popq %r14
popq %r15
retq
leaq 0x5ec(%rip), %rdi       # 0x2251
popq %rbx
popq %r14
popq %r15
jmp 0x10c0
// File: /workspace/github_cpp_makefile_star2_O2/ivanzamanov[P]kmeans/src/common/utils.cpp
// Function: lowercaseToken(char*)
void lowercaseToken(char* token) {
	char* str = token;
	while(*str != '\0') {
		char c = *str;
		if(c >= 'A' && c <= 'Z') {
			*str = c + DIFF;
		}		
		str++;
	}
}

// Assembly:
movb (%rdi), %al
testb %al, %al
je 0x1c86
leal -0x41(%rax), %ecx
cmpb $0x19, %cl
ja 0x1c81
orb $0x20, %al
movb %al, (%rdi)
incq %rdi
jmp 0x1c6f
retq
// File: /workspace/github_cpp_makefile_star2_O2/ivanzamanov[P]kmeans/src/common/utils.cpp
// Function: readToken(char const*, int&, char*, int)
bool readToken(const char* data, int& offset, char* buffer, int buffLength) {
	const char* str = data + offset;
	if(*str == '\0')
		return false;
	int leading = 0;
	while(!isAlphanumeric(*str) && *str != '\0') {
		str++;
		leading++;
	}

	int i = 0;
	while(shouldRead(*str) && i < buffLength) {
		*(buffer + i) = *str;
		i++;
		str++;
	}

	offset = offset + leading + i;
	buffer[i] = 0;
	return i > 0;
}

// Assembly:
movslq (%rsi), %rax
movb (%rdi,%rax), %r8b
testb %r8b, %r8b
je 0x1d52
addq %rdi, %rax
incq %rax
xorl %edi, %edi
testb %r8b, %r8b
je 0x1cfa
leal -0x30(%r8), %r9d
cmpb $0xa, %r9b
jb 0x1cfa
movl %r8d, %r9d
andb $-0x21, %r9b
addb $-0x41, %r9b
cmpb $0x19, %r9b
jbe 0x1cfa
movb (%rax,%rdi), %r8b
incq %rdi
jmp 0x1cd1
pushq %rbx
movslq %ecx, %rcx
movl %edi, %r9d
negl %r9d
xorl %r10d, %r10d
movl %r8d, %r11d
andb $-0x21, %r11b
addb $-0x41, %r11b
cmpb $0x1a, %r11b
setae %r11b
leal -0x30(%r8), %ebx
cmpb $0xa, %bl
setae %bl
testb %r11b, %bl
jne 0x1d42
cmpq %rcx, %r10
jge 0x1d42
movb %r8b, (%rdx,%r10)
leaq (%rax,%r10), %r8
incq %r10
movb (%rdi,%r8), %r8b
decl %r9d
jmp 0x1d07
subl %r9d, (%rsi)
movb $0x0, (%rdx,%r10)
testq %r10, %r10
setne %al
popq %rbx
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/jpcima[P]faustmd/./thirdparty/gsl-lite.hpp
// Function: unsigned long gsl::detail::string_length<char>(char*, unsigned long)
gsl_api inline gsl_constexpr14 std::size_t string_length( T * ptr, std::size_t max )
{
    if ( ptr == gsl_nullptr || max <= 0 )
        return 0;

    std::size_t len = 0;
    while ( len < max && ptr[len] ) // NOLINT
        ++len;

    return len;
}

// Assembly:
testq %rdi, %rdi
sete %cl
testq %rsi, %rsi
sete %dl
orb %cl, %dl
je 0x71e1
xorl %eax, %eax
retq
movq %rsi, %rax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x71f9
cmpb $0x0, (%rdi,%rcx)
je 0x71f6
incq %rcx
jmp 0x71e6
movq %rcx, %rax
retq
// File: /workspace/github_cpp_makefile_star2_O2/jpcima[P]faustmd/./thirdparty/gsl-lite.hpp
// Function: gsl::span<char>::subspan(unsigned long, unsigned long) const
span subspan( index_type offset, index_type count ) const gsl_noexcept
    {
        Expects(
            0 <= offset && offset <= this->size() &&
            0 <= count  && count <= this->size() - offset );
        return span( this->data() + offset, count );
    }

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rax
movq (%rdi), %rsi
movq 0x8(%rdi), %rcx
subq %rsi, %rcx
subq %rax, %rcx
jb 0x757b
cmpq %rdx, %rcx
jb 0x757b
addq %rax, %rsi
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x71fa
movq (%rbx), %rax
movq 0x8(%rbx), %rdx
addq $0x10, %rsp
popq %rbx
retq
callq 0x6110
// File: /workspace/github_cpp_makefile_star2_O2/jpcima[P]faustmd/./thirdparty/gsl-lite.hpp
// Function: std::ostream& gsl::detail::write_to_stream<std::ostream, gsl::basic_string_span<char>>(std::ostream&, gsl::basic_string_span<char> const&)
gsl_api Stream & write_to_stream( Stream & os, Span const & spn )
{
    typename Stream::sentry sentry( os );

    if ( !os )
        return os;

    const std::streamsize length = narrow<std::streamsize>( spn.length() );

    // Whether, and how, to pad
    const bool pad = ( length < os.width() );
    const bool left_pad = pad && ( os.flags() & std::ios_base::adjustfield ) == std::ios_base::right;

    if ( left_pad )
        write_padding( os, os.width() - length );

    // Write span characters
    os.rdbuf()->sputn( spn.begin(), length );

    if ( pad && !left_pad )
        write_padding( os, os.width() - length );

    // Reset output stream width
    os.width(0);

    return os;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r15
movq %rdi, %rbx
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x6350
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%rbx,%rax)
jne 0x7813
movq 0x8(%r15), %rdi
subq (%r15), %rdi
callq 0x783e
movq %rax, %r14
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq 0x10(%rbx,%rax), %r12
movq %r12, %rsi
subq %r14, %rsi
jle 0x77ce
movl $0xb0, %ecx
andl 0x18(%rbx,%rax), %ecx
cmpl $0x80, %ecx
jne 0x77ce
movq %rbx, %rdi
callq 0x784d
movq (%rbx), %rax
movq -0x18(%rax), %rax
movb $0x1, %bpl
jmp 0x77d0
xorl %ebp, %ebp
movq 0xe8(%rbx,%rax), %rdi
movq (%r15), %rsi
movq (%rdi), %rax
movq %r14, %rdx
callq *0x60(%rax)
cmpq %r14, %r12
setle %al
orb %bpl, %al
jne 0x7806
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq 0x10(%rbx,%rax), %rsi
subq %r14, %rsi
movq %rbx, %rdi
callq 0x784d
movq (%rbx), %rax
movq -0x18(%rax), %rax
andq $0x0, 0x10(%rbx,%rax)
movq %rsp, %rdi
callq 0x6780
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x6780
movq %rbx, %rdi
callq 0x6730
// File: /workspace/github_cpp_makefile_star2_O2/jpcima[P]faustmd/call_faust.cpp
// Function: parse_cstrlit(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, gsl::basic_string_span<char const>)
static bool parse_cstrlit(std::string &dst, const gsl::cstring_span src)
{
    size_t n = src.size();
    if (src.size() < 2 || src[0] != '"' || src[n - 1] != '"')
        return false;

    for (size_t i = 1; i < n - 1; ++i) {
        char c = src[i];
        if (c != '\\')
            dst.push_back(c);
        else {
            if (++i == n - 1)
                return false;
            c = src[i];
            switch (c) {
            case '0': dst.push_back('\0'); break;
            case 'a': dst.push_back('\a'); break;
            case 'b': dst.push_back('\b'); break;
            case 't': dst.push_back('\t'); break;
            case 'n': dst.push_back('\n'); break;
            case 'v': dst.push_back('\v'); break;
            case 'f': dst.push_back('\f'); break;
            case 'r': dst.push_back('\r'); break;
            default: dst.push_back(c); break;
            }
        }
    }

    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
subq %rsi, %rbx
cmpq $0x2, %rbx
jae 0x8ca2
xorl %r13d, %r13d
jmp 0x8d6f
movq %rdi, %r14
xorl %r13d, %r13d
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0x14a6e
cmpb $0x22, (%rax)
jne 0x8d6f
decq %rbx
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x14a6e
cmpb $0x22, (%rax)
jne 0x8c9a
pushq $0x1
popq %r15
leaq 0x8(%rsp), %r12
leaq 0x2150a(%rip), %rbp     # 0x2a1ec
cmpq %rbx, %r15
setae %r13b
jae 0x8d6f
movq %r12, %rdi
movq %r15, %rsi
callq 0x14a6e
movb (%rax), %al
cmpb $0x5c, %al
jne 0x8d5c
incq %r15
cmpq %rbx, %r15
je 0x8d6f
movq %r12, %rdi
movq %r15, %rsi
callq 0x14a6e
movb (%rax), %al
movzbl %al, %ecx
leal -0x6e(%rcx), %edx
cmpl $0x8, %edx
jbe 0x8d38
cmpl $0x30, %ecx
je 0x8d52
cmpl $0x66, %ecx
je 0x8d5a
cmpl $0x62, %ecx
je 0x8d56
cmpl $0x61, %ecx
jne 0x8d5c
movb $0x7, %al
jmp 0x8d5c
movslq (%rbp,%rdx,4), %rcx
addq %rbp, %rcx
jmpq *%rcx
movb $0xa, %al
jmp 0x8d5c
movb $0xb, %al
jmp 0x8d5c
movb $0x9, %al
jmp 0x8d5c
movb $0xd, %al
jmp 0x8d5c
xorl %eax, %eax
jmp 0x8d5c
movb $0x8, %al
jmp 0x8d5c
movb $0xc, %al
movsbl %al, %esi
movq %r14, %rdi
callq 0x6370
incq %r15
jmp 0x8ce2
movl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/jpcima[P]faustmd/metadata.cpp
// Function: cstrlit[abi:cxx11](gsl::basic_string_span<char const>)
static const std::string cstrlit(gsl::cstring_span text)
{
    std::string lit;
    lit.push_back('u');
    lit.push_back('8');
    lit.push_back('"');

    for (char c : text) {
        switch (c) {
        case '\a': lit.push_back('\\'); lit.push_back('a'); break;
        case '\b': lit.push_back('\\'); lit.push_back('b'); break;
        case '\t': lit.push_back('\\'); lit.push_back('t'); break;
        case '\n': lit.push_back('\\'); lit.push_back('n'); break;
        case '\v': lit.push_back('\\'); lit.push_back('v'); break;
        case '\f': lit.push_back('\\'); lit.push_back('f'); break;
        case '\r': lit.push_back('\\'); lit.push_back('r'); break;
        case '"': case '\\': lit.push_back('\\'); lit.push_back(c); break;
        default: lit.push_back(c); break;
        }
    }

    lit.push_back('"');
    return lit;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
pushq $0x75
popq %rsi
callq 0x6370
pushq $0x38
popq %rsi
movq %rbx, %rdi
callq 0x6370
pushq $0x22
popq %rsi
movq %rbx, %rdi
callq 0x6370
pushq $0x5c
popq %rbp
leaq 0x152a5(%rip), %r12     # 0x2b390
cmpq %r14, %r15
je 0x1619d
movb (%r15), %r13b
movzbl %r13b, %eax
leal -0x7(%rax), %ecx
cmpl $0x6, %ecx
ja 0x1611b
movslq (%r12,%rcx,4), %rax
addq %r12, %rax
jmpq *%rax
movb $0x61, %r13b
movq %rbx, %rdi
movl %ebp, %esi
callq 0x6370
jmp 0x16189
cmpl $0x22, %eax
je 0x16125
cmpl $0x5c, %eax
jne 0x16189
movq %rbx, %rdi
movl %ebp, %esi
callq 0x6370
jmp 0x16189
movb $0x76, %r13b
movq %rbx, %rdi
movl %ebp, %esi
callq 0x6370
jmp 0x16189
movb $0x74, %r13b
movq %rbx, %rdi
movl %ebp, %esi
callq 0x6370
jmp 0x16189
movb $0x6e, %r13b
movq %rbx, %rdi
movl %ebp, %esi
callq 0x6370
jmp 0x16189
movb $0x62, %r13b
movq %rbx, %rdi
movl %ebp, %esi
callq 0x6370
jmp 0x16189
movb $0x66, %r13b
movq %rbx, %rdi
movl %ebp, %esi
callq 0x6370
jmp 0x16189
movb $0x72, %r13b
movq %rbx, %rdi
movl %ebp, %esi
callq 0x6370
movsbl %r13b, %esi
movq %rbx, %rdi
callq 0x6370
incq %r15
jmp 0x160eb
pushq $0x22
popq %rsi
movq %rbx, %rdi
callq 0x6370
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x161bc
movq %rax, %r14
movq %rbx, %rdi
callq 0x61d0
movq %r14, %rdi
callq 0x6730
// File: /workspace/github_cpp_makefile_star2_O2/jpcima[P]faustmd/metadata.cpp
// Function: Metadata::Widget::type_from_name(gsl::basic_string_span<char const>)
Metadata::Widget::Type Metadata::Widget::type_from_name(gsl::cstring_span name)
{
    Metadata::Widget::Type t = (Metadata::Widget::Type)-1;

    if (name == "button")
        t = Type::Button;
    else if (name == "checkbox")
        t = Type::CheckBox;
    else if (name == "vslider")
        t = Type::VSlider;
    else if (name == "hslider")
        t = Type::HSlider;
    else if (name == "nentry")
        t = Type::NEntry;
    else if (name == "vbargraph")
        t = Type::VBarGraph;
    else if (name == "hbargraph")
        t = Type::HBarGraph;

    return t;
}

// Assembly:
subq $0x18, %rsp
leaq 0x8(%rsp), %rax
movq %rdi, (%rax)
movq %rsi, 0x8(%rax)
leaq 0x1476d(%rip), %rsi     # 0x2b79e
movq %rax, %rdi
callq 0x172ee
movl %eax, %ecx
xorl %eax, %eax
testb %cl, %cl
jne 0x170bd
leaq 0x1475d(%rip), %rsi     # 0x2b7a5
leaq 0x8(%rsp), %rdi
callq 0x17333
testb %al, %al
je 0x1705a
pushq $0x1
jmp 0x170bc
leaq 0x1474d(%rip), %rsi     # 0x2b7ae
leaq 0x8(%rsp), %rdi
callq 0x17378
testb %al, %al
je 0x17073
pushq $0x2
jmp 0x170bc
leaq 0x1473c(%rip), %rsi     # 0x2b7b6
leaq 0x8(%rsp), %rdi
callq 0x17378
testb %al, %al
je 0x1708c
pushq $0x3
jmp 0x170bc
leaq 0x1472b(%rip), %rsi     # 0x2b7be
leaq 0x8(%rsp), %rdi
callq 0x172ee
testb %al, %al
je 0x170a5
pushq $0x4
jmp 0x170bc
leaq 0x14719(%rip), %rsi     # 0x2b7c5
leaq 0x8(%rsp), %rdi
callq 0x173bd
testb %al, %al
je 0x170c2
pushq $0x5
popq %rax
addq $0x18, %rsp
retq
leaq 0x14706(%rip), %rsi     # 0x2b7cf
leaq 0x8(%rsp), %rdi
callq 0x173bd
movzbl %al, %eax
decl %eax
orl $0x6, %eax
jmp 0x170bd
nop
// File: /workspace/github_cpp_makefile_star2_O2/jpcima[P]faustmd/metadata.cpp
// Function: Metadata::Widget::scale_from_name(gsl::basic_string_span<char const>)
Metadata::Widget::Scale Metadata::Widget::scale_from_name(gsl::cstring_span name)
{
    Metadata::Widget::Scale s = (Metadata::Widget::Scale)-1;

    if (name == "log")
        s = Scale::Log;
    else if (name == "exp")
        s = Scale::Exp;

    return s;
}

// Assembly:
subq $0x18, %rsp
leaq 0x8(%rsp), %rax
movq %rdi, (%rax)
movq %rsi, 0x8(%rax)
leaq 0x146e4(%rip), %rsi     # 0x2b7d9
movq %rax, %rdi
callq 0x17402
testb %al, %al
je 0x17106
pushq $0x1
popq %rax
jmp 0x1711f
leaq 0x146d0(%rip), %rsi     # 0x2b7dd
leaq 0x8(%rsp), %rdi
callq 0x17402
movzbl %al, %eax
decl %eax
orl $0x2, %eax
addq $0x18, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O2/jpcima[P]faustmd/metadata.cpp
// Function: mangle[abi:cxx11](gsl::basic_string_span<char const>)
static const std::string mangle(gsl::cstring_span name)
{
    std::string id;
    size_t n = name.size();
    id.reserve(n);

    for (size_t i = 0; i < n; ++i) {
        char c = name[i];
        bool al = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
        bool num = c >= '0' && c <= '9';
        c = (!al && (!num || i == 0)) ? '_' : c;
        id.push_back(c);
    }

    return id;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movq %rsi, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
movb $0x0, 0x10(%rdi)
subq %rsi, %r14
movq %r14, %rsi
callq 0x6650
xorl %r15d, %r15d
leaq 0x8(%rsp), %r12
cmpq %r15, %r14
je 0x1721c
movq %r12, %rdi
movq %r15, %rsi
callq 0x14a6e
movb (%rax), %al
movl %eax, %ecx
andb $-0x21, %cl
addb $-0x41, %cl
cmpb $0x1a, %cl
jb 0x1720a
leal -0x3a(%rax), %ecx
cmpb $-0xa, %cl
setb %cl
testq %r15, %r15
sete %dl
orb %cl, %dl
movb $0x5f, %cl
jne 0x1720c
movl %eax, %ecx
movsbl %cl, %esi
movq %rbx, %rdi
callq 0x6370
incq %r15
jmp 0x171d6
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x1722d
movq %rax, %r14
movq %rbx, %rdi
callq 0x61d0
movq %r14, %rdi
callq 0x6730
// File: /workspace/github_cpp_makefile_star2_O2/t0mm4rx[P]piscine_cpp/day01/ex04/exo04.cpp
// Function: main
int main()
{
	std::string str = "HI THIS IS BRAIN";
	std::string *ptr = &str;
	std::string &ref = str;

	std::cout << "String:    " << str << std::endl;
	std::cout << "Pointer:   " << *ptr << std::endl;
	std::cout << "Reference: " << ref << std::endl;
}

// Assembly:
pushq %rbx
subq $0x30, %rsp
leaq 0xdec(%rip), %rsi       # 0x2004
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x12c6
movq 0x2daa(%rip), %rdi      # 0x3fd8
leaq 0xde0(%rip), %rsi       # 0x2015
callq 0x10a0
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x1090
movq %rax, %rdi
callq 0x1050
movq 0x2d82(%rip), %rdi      # 0x3fd8
leaq 0xdc4(%rip), %rsi       # 0x2021
callq 0x10a0
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x1090
movq %rax, %rdi
callq 0x1050
movq 0x2d5a(%rip), %rdi      # 0x3fd8
leaq 0xda8(%rip), %rsi       # 0x202d
callq 0x10a0
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x1090
movq %rax, %rdi
callq 0x1050
leaq 0x10(%rsp), %rdi
callq 0x1040
xorl %eax, %eax
addq $0x30, %rsp
popq %rbx
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x1040
movq %rbx, %rdi
callq 0x10c0
// File: /workspace/github_cpp_makefile_star2_O2/lns[P]team-tactic-topic-model/./lda.cpp
// Function: LDA<unsigned int, unsigned int, unsigned char>::read_data(char const*)
void read_data(const char * filename)
	{
		FILE * f = fopen(filename,"r");
		if(!f)
			printf("Cannot open %s for reading.\n",filename);
		uint32_t d;
		word_t w;
		player_t p;
		float x,y;
		while(true) {
			if(5>fscanf(f,"%u %u %u %f %f\n",&d,&w,&p,&x,&y))
				return;
			n_word = n_word>w?n_word:(w+1);
			n_player = n_player>p?n_player:(p+1);
			while(dat.size()<=d)
				dat.push_back(vector<Token>());
			dat[d].push_back({w,p,0,x,y});
		}
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x2a71(%rip), %rsi      # 0x4244
movq %r15, %rdi
callq 0x1130
movq %rax, %r14
testq %rax, %rax
jne 0x17f4
leaq 0x28e3(%rip), %rdi      # 0x40cd
movq %r15, %rsi
xorl %eax, %eax
callq 0x1040
leaq 0x58(%rbx), %r15
leaq 0x18(%rsp), %r13
pushq $0x18
popq %r12
leaq 0x20(%rsp), %rbp
leaq 0x14(%rsp), %rax
movq %rax, (%rsp)
movq %r14, %rdi
leaq 0x28d1(%rip), %rsi      # 0x40ea
leaq 0x1c(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0xc(%rsp), %r8
movq %r13, %r9
xorl %eax, %eax
callq 0x11f0
cmpl $0x4, %eax
jle 0x18dc
movl 0x10(%rsp), %eax
leal 0x1(%rax), %ecx
movl 0x4(%rbx), %edx
movl 0x8(%rbx), %esi
cmpl %eax, %edx
cmoval %edx, %ecx
movl %ecx, 0x4(%rbx)
movl 0xc(%rsp), %eax
leal 0x1(%rax), %ecx
cmpl %eax, %esi
cmoval %esi, %ecx
movl %ecx, 0x8(%rbx)
movq 0x58(%rbx), %rdi
movq 0x60(%rbx), %rax
subq %rdi, %rax
cqto
idivq %r12
movl 0x1c(%rsp), %ecx
cmpq %rcx, %rax
ja 0x189b
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
andq $0x0, 0x30(%rsp)
movq %r15, %rdi
movq %rbp, %rsi
callq 0x216a
movq %rbp, %rdi
callq 0x2118
jmp 0x185f
imulq $0x18, %rcx, %rax
addq %rax, %rdi
movl 0x10(%rsp), %eax
movl %eax, 0x20(%rsp)
movl 0xc(%rsp), %eax
movl %eax, 0x24(%rsp)
movb $0x0, 0x28(%rsp)
movss 0x18(%rsp), %xmm0
movss %xmm0, 0x2c(%rsp)
movss 0x14(%rsp), %xmm0
movss %xmm0, 0x30(%rsp)
movq %rbp, %rsi
callq 0x237c
jmp 0x1806
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x2118
movq %rbx, %rdi
callq 0x11c0
// File: /workspace/github_cpp_makefile_star2_O2/lns[P]team-tactic-topic-model/./lda.cpp
// Function: LDA<unsigned int, unsigned int, unsigned char>::set_K(unsigned char)
void set_K(topic_t K)
	{
		topic.clear();
		topic.resize(K);
		theta.clear();
		for(topic_t k=0;k<K;k++) {
			theta.push_back(vector<uint32_t>());
			theta[k].resize(dat.size());
			topic[k].make(n_word,n_player);
		}
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %ebx
movq %rdi, %r14
leaq 0x70(%rdi), %r15
movq %r15, %rdi
callq 0x2524
movl %ebx, %esi
movq %r15, %rdi
callq 0x252c
leaq 0x88(%r14), %r15
movq %r15, %rdi
callq 0x255c
shll $0x6, %ebx
xorl %r13d, %r13d
movq %rsp, %r12
xorl %ebp, %ebp
cmpq %rbp, %rbx
je 0x19a8
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
andq $0x0, 0x10(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x28d2
movq %r12, %rdi
callq 0x1fae
movq 0x88(%r14), %rdi
addq %r13, %rdi
movq 0x60(%r14), %rax
subq 0x58(%r14), %rax
cqto
pushq $0x18
popq %rcx
idivq %rcx
movq %rax, %rsi
callq 0x2564
movq 0x70(%r14), %rdi
addq %rbp, %rdi
movl 0x4(%r14), %esi
movl 0x8(%r14), %edx
callq 0x2596
addq $0x40, %rbp
addq $0x18, %r13
jmp 0x1943
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x1fae
movq %rbx, %rdi
callq 0x11c0
// File: /workspace/github_cpp_makefile_star2_O2/lns[P]team-tactic-topic-model/./lda.cpp
// Function: LDA<unsigned int, unsigned int, unsigned char>::config(Prior const&, unsigned int)
void config(const Prior& p, uint32_t buffer_size)
	{
		prior = p;
		pct_log_a.make(buffer_size,log,prior.alpha);
		pct_log_b.make(buffer_size,log,prior.beta);
		pct_log_Nb.make(buffer_size,log,n_word*prior.beta);
	}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edx, %ebx
movq %rdi, %r14
leaq 0x10(%rdi), %rdi
pushq $0x9
popq %rcx
rep  movsq (%rsi), %es:(%rdi)
leaq 0xa0(%r14), %rdi
movsd 0x10(%r14), %xmm0
movq 0x55ee(%rip), %r15      # 0x6fe0
movl %edx, %esi
movq %r15, %rdx
callq 0x2c9c
leaq 0xc0(%r14), %rdi
movsd 0x18(%r14), %xmm0
movl %ebx, %esi
movq %r15, %rdx
callq 0x2c9c
leaq 0xe0(%r14), %rdi
movl 0x4(%r14), %eax
cvtsi2sd %rax, %xmm0
mulsd 0x18(%r14), %xmm0
movl %ebx, %esi
movq %r15, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x2c9c
// File: /workspace/github_cpp_makefile_star2_O2/lns[P]team-tactic-topic-model/./lda.cpp
// Function: LDA<unsigned int, unsigned int, unsigned char>::gibbs(bool)
void gibbs(bool first_run=false)
	{
		static vector<uint32_t> x;
		if(x.size()!=dat.size()) {
			x.clear();
			for(uint32_t d=0;d<dat.size();d++)
				x.push_back(d);
		}
		shuffle(&(x[0]),dat.size());
		for(uint32_t d=0;d<dat.size();d++)
			for(uint32_t i=0;i<dat[x[d]].size();i++)
				reassign(x[d],i,first_run);
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movb 0x56ea(%rip), %al       # 0x7140
testb %al, %al
je 0x1b60
movq 0x56cb(%rip), %r8       # 0x7130
movq 0x56bc(%rip), %rdi      # 0x7128
movq %r8, %r9
subq %rdi, %r9
sarq $0x2, %r9
movq 0x58(%rbx), %rsi
movq 0x60(%rbx), %rcx
movq %rcx, %rax
subq %rsi, %rax
pushq $0x18
popq %r12
cqto
idivq %r12
cmpq %rax, %r9
je 0x1ae4
cmpq %rdi, %r8
je 0x1a9e
movq %rdi, 0x5692(%rip)      # 0x7130
xorl %eax, %eax
leaq 0x5681(%rip), %r14      # 0x7128
leaq 0x4(%rsp), %r15
subq %rsi, %rcx
movl %eax, 0x4(%rsp)
movl %eax, %esi
movq %rcx, %rax
cqto
idivq %r12
cmpq %rsi, %rax
jbe 0x1add
movq %r14, %rdi
movq %r15, %rsi
callq 0x2d16
movl 0x4(%rsp), %eax
incl %eax
movq 0x58(%rbx), %rsi
movq 0x60(%rbx), %rcx
jmp 0x1aac
movq 0x5644(%rip), %rdi      # 0x7128
movl %eax, %esi
callq 0x2d34
movq 0x58(%rbx), %rcx
xorl %r15d, %r15d
pushq $0x14
popq %r13
movzbl %bpl, %ebp
movl %r15d, %r15d
movq 0x60(%rbx), %rax
subq %rcx, %rax
cqto
idivq %r12
cmpq %r15, %rax
jbe 0x1b51
xorl %r14d, %r14d
movl %r14d, %edi
movq 0x560d(%rip), %rax      # 0x7128
movl (%rax,%r15,4), %esi
imulq $0x18, %rsi, %rdx
movq 0x8(%rcx,%rdx), %rax
subq (%rcx,%rdx), %rax
cqto
idivq %r13
cmpq %rdi, %rax
jbe 0x1b4c
movq %rbx, %rdi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x2d9c
incl %r14d
movq 0x58(%rbx), %rcx
jmp 0x1b11
incl %r15d
jmp 0x1afa
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x55d9(%rip), %rdi      # 0x7140
callq 0x11e0
testl %eax, %eax
je 0x1a5e
xorps %xmm0, %xmm0
movups %xmm0, 0x55aa(%rip)     # 0x7128
andq $0x0, 0x55b2(%rip)      # 0x7138
leaq 0x559b(%rip), %rsi      # 0x7128
leaq 0x414(%rip), %rdi       # 0x1fa8
leaq 0x556d(%rip), %rdx      # 0x7108
callq 0x10e0
leaq 0x5599(%rip), %rdi      # 0x7140
callq 0x10a0
jmp 0x1a5e
nop
// File: /workspace/github_cpp_makefile_star2_O2/lns[P]team-tactic-topic-model/./lda.cpp
// Function: LDA<unsigned int, unsigned int, unsigned char>::output_topics(_IO_FILE*)
void output_topics(FILE* fo)
	{
		for(topic_t k=0;k<topic.size();k++) {
			for(word_t w=0;w<n_word-1;w++)
				fprintf(fo,"%u\t",topic[k].c[w]);
			fprintf(fo,"%u\n",topic[k].c[n_word-1]);
		}
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
xorl %r13d, %r13d
leaq 0x2561(%rip), %r15      # 0x412e
movzbl %r13b, %r13d
movq 0x78(%r14), %rax
subq 0x70(%r14), %rax
sarq $0x6, %rax
cmpq %r13, %rax
jbe 0x1c2e
movl %r13d, %ebp
shll $0x6, %ebp
xorl %r12d, %r12d
movl 0x4(%r14), %eax
decl %eax
movq 0x70(%r14), %rcx
movq 0x8(%rcx,%rbp), %rcx
cmpq %rax, %r12
jae 0x1c15
movl (%rcx,%r12,4), %edx
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x1170
incq %r12
jmp 0x1beb
movl (%rcx,%rax,4), %edx
movq %rbx, %rdi
leaq 0x24a5(%rip), %rsi      # 0x40c7
xorl %eax, %eax
callq 0x1170
incb %r13b
jmp 0x1bcd
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/lns[P]team-tactic-topic-model/./lda.cpp
// Function: LDA<unsigned int, unsigned int, unsigned char>::output_positions(_IO_FILE*)
void output_positions(FILE* fo)
	{
		double kappa0 = prior.kappa0;
		double mu0_x = prior.mu0_x;
		double mu0_y = prior.mu0_y;
		for(topic_t k=0;k<topic.size();k++) {
			for(player_t p=0;p<n_player;p++) {
				uint32_t n = topic[k].n[p];
				fprintf(fo,"%le\t%le",
						(kappa0*mu0_x+topic[k].x[p])/(kappa0+n),
						(kappa0*mu0_y+topic[k].y[p])/(kappa0+n));
				if(p!=n_player-1)
					fprintf(fo,"\t");
				else
					fprintf(fo,"\n");
			}
		}
	}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movsd 0x30(%rdi), %xmm0
xorl %r12d, %r12d
movsd 0x20(%rdi), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
movsd 0x28(%rdi), %xmm1
movsd %xmm0, 0x18(%rsp)
mulsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
leaq 0x24ae(%rip), %r15      # 0x4132
movzbl %r12b, %r12d
movq 0x78(%r14), %rax
subq 0x70(%r14), %rax
sarq $0x6, %rax
cmpq %r12, %rax
jbe 0x1d25
xorl %r13d, %r13d
movl 0x8(%r14), %eax
cmpq %rax, %r13
jae 0x1d1d
movq 0x70(%r14), %rax
movl %r12d, %ecx
shll $0x6, %ecx
movq 0x10(%rax,%rcx), %rdx
movq 0x18(%rax,%rcx), %rsi
movl (%rdx,%r13,4), %edx
cvtss2sd (%rsi,%r13,4), %xmm0
cvtsi2sd %rdx, %xmm2
addsd 0x10(%rsp), %xmm0
addsd 0x18(%rsp), %xmm2
divsd %xmm2, %xmm0
movq 0x20(%rax,%rcx), %rax
cvtss2sd (%rax,%r13,4), %xmm1
addsd 0x8(%rsp), %xmm1
divsd %xmm2, %xmm1
movq %rbx, %rdi
movq %r15, %rsi
movb $0x2, %al
callq 0x1170
movl 0x8(%r14), %eax
decl %eax
xorl %edi, %edi
cmpq %rax, %r13
sete %dil
addl $0x9, %edi
movq %rbx, %rsi
callq 0x1140
incq %r13
jmp 0x1ca0
incb %r12b
jmp 0x1c84
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/lns[P]team-tactic-topic-model/./lda.cpp
// Function: LDA<unsigned int, unsigned int, unsigned char>::output_assignments(_IO_FILE*)
void output_assignments(FILE* fo)
	{
		for(uint32_t d=0;d<dat.size();d++) {
			for(uint32_t i=0;i<dat[d].size()-1;i++)
				fprintf(fo,"%u ",dat[d][i].z);
			fprintf(fo,"%u\n",dat[d][dat[d].size()-1].z);
		}
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x14
popq %rbp
leaq 0x23eb(%rip), %r15      # 0x413a
xorl %edi, %edi
movl %edi, %edi
movq 0x58(%r14), %rcx
movq 0x60(%r14), %rax
subq %rcx, %rax
cqto
pushq $0x18
popq %rsi
idivq %rsi
cmpq %rdi, %rax
jbe 0x1dd6
xorl %eax, %eax
movq %rdi, (%rsp)
imulq $0x18, %rdi, %r12
movl %eax, %r13d
movq (%rcx,%r12), %rsi
movq 0x8(%rcx,%r12), %rax
subq %rsi, %rax
cqto
idivq %rbp
decq %rax
cmpq %r13, %rax
jbe 0x1db1
imulq $0x14, %r13, %rax
movzbl 0x8(%rsi,%rax), %edx
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x1170
leal 0x1(%r13), %eax
movq 0x58(%r14), %rcx
jmp 0x1d75
imulq $0x14, %rax, %rax
movzbl 0x8(%rsi,%rax), %edx
movq %rbx, %rdi
leaq 0x2303(%rip), %rsi      # 0x40c7
xorl %eax, %eax
callq 0x1170
movq (%rsp), %rdi
incl %edi
jmp 0x1d51
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/lns[P]team-tactic-topic-model/./lda.cpp
// Function: LDA<unsigned int, unsigned int, unsigned char>::output_theta(_IO_FILE*)
void output_theta(FILE* fo)
	{
		for(uint32_t d=0;d<dat.size();d++) {
			for(topic_t k=0;k<topic.size()-1;k++)
				fprintf(fo,"%u\t",theta[k][d]);
			fprintf(fo,"%u\n",theta[topic.size()-1][d]);
		}
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x18
popq %r13
leaq 0x232c(%rip), %r15      # 0x412e
xorl %eax, %eax
movl %eax, %ebp
movq 0x60(%r14), %rax
subq 0x58(%r14), %rax
cqto
idivq %r13
cmpq %rbp, %rax
jbe 0x1e79
xorl %eax, %eax
movzbl %al, %r12d
movq 0x78(%r14), %rcx
subq 0x70(%r14), %rcx
movq 0x88(%r14), %rax
sarq $0x6, %rcx
decq %rcx
cmpq %r12, %rcx
jbe 0x1e58
imulq $0x18, %r12, %rcx
movq (%rax,%rcx), %rax
movl (%rax,%rbp,4), %edx
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x1170
leal 0x1(%r12), %eax
jmp 0x1e1a
imulq $0x18, %rcx, %rcx
movq (%rax,%rcx), %rax
movl (%rax,%rbp,4), %edx
movq %rbx, %rdi
leaq 0x225a(%rip), %rsi      # 0x40c7
xorl %eax, %eax
callq 0x1170
leal 0x1(%rbp), %eax
jmp 0x1e04
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/lns[P]team-tactic-topic-model/./lda.cpp
// Function: Topic::destroy()
void destroy()
	{
		delete[] c;
		delete[] n;
		delete[] x;
		delete[] y;
		delete[] xx;
		delete[] xy;
		delete[] yy;
		memset(this,0,sizeof(*this));
	}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x204e
callq 0x1150
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x205c
callq 0x1150
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x206a
callq 0x1150
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x2078
callq 0x1150
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x2086
callq 0x1150
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x2094
callq 0x1150
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x20a2
callq 0x1150
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rbx)
movups %xmm0, 0x20(%rbx)
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/lns[P]team-tactic-topic-model/./lda.cpp
// Function: Topic::make(unsigned int, unsigned int)
void make(uint32_t n_word, uint32_t n_player)
	{
		destroy();
		c_sum = 0;
		c = new uint32_t[n_word]();
		n = new uint32_t[n_player]();
		x = new float[n_player]();
		y = new float[n_player]();
		xx= new float[n_player]();
		xy= new float[n_player]();
		yy= new float[n_player]();
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %rbx
callq 0x203c
andl $0x0, (%rbx)
movl %r14d, %r14d
shlq $0x2, %r14
movq %r14, %rdi
callq 0x1030
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x1090
movq %r15, 0x8(%rbx)
movl %ebp, %r14d
shlq $0x2, %r14
movq %r14, %rdi
callq 0x1030
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x1090
movq %r15, 0x10(%rbx)
movq %r14, %rdi
callq 0x1030
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x1090
movq %r15, 0x18(%rbx)
movq %r14, %rdi
callq 0x1030
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x1090
movq %r15, 0x20(%rbx)
movq %r14, %rdi
callq 0x1030
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x1090
movq %r15, 0x28(%rbx)
movq %r14, %rdi
callq 0x1030
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x1090
movq %r15, 0x30(%rbx)
movq %r14, %rdi
callq 0x1030
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x1090
movq %r15, 0x38(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/lns[P]team-tactic-topic-model/./pct.cpp
// Function: PCT::make(unsigned int, double (*)(double), double)
void make(uint32_t _len, double (*_func)(double), double _delta)
	{
		len = _len;
		func = _func;
		delta = _delta;
		destroy();
		x = new double[len];
		for(uint32_t i=0;i<len;i++)
			x[i] = i + delta;
		for(uint32_t i=0;i<len;i++)
			x[i] = func(x[i]);
	}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl %esi, (%rdi)
movq %rdx, 0x8(%rdi)
movsd %xmm0, 0x10(%rdi)
callq 0x1f38
movl (%rbx), %r14d
leaq (,%r14,8), %rdi
callq 0x1030
movq %rax, 0x18(%rbx)
movsd 0x10(%rbx), %xmm0
xorl %ecx, %ecx
cmpq %rcx, %r14
je 0x2ce9
movl %ecx, %edx
cvtsi2sd %rdx, %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rax,%rcx,8)
incq %rcx
jmp 0x2ccf
xorl %r15d, %r15d
movl %r14d, %ecx
cmpq %rcx, %r15
jae 0x2d0f
movsd (%rax,%r15,8), %xmm0
callq *0x8(%rbx)
movq 0x18(%rbx), %rax
movsd %xmm0, (%rax,%r15,8)
incq %r15
movl (%rbx), %r14d
jmp 0x2cec
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/lns[P]team-tactic-topic-model/./rng.cpp
// Function: void shuffle<unsigned int>(unsigned int*, unsigned int)
void shuffle(T* x, uint32_t len)
{
	for(uint32_t i=0;i<len-1;i++)
	{
		uint32_t j = i+lcg64()%(len-1-i);
		// swap x[i] & x[j]
		T t = x[i];
		x[i] = x[j];
		x[j] = t;
	}
}

// Assembly:
pushq %rbx
decl %esi
movq 0x43e2(%rip), %rcx      # 0x7120
movq %rsi, %r8
negq %r8
movabsq $0x1, %r9
xorl %r10d, %r10d
movabsq $-0x42e60443a3f800b, %r11 # imm = 0xFBD19FBBC5C07FF5
leaq (%r8,%r9), %rax
cmpq $0x1, %rax
je 0x2d9a
imulq %r11, %rcx
incq %rcx
movq %rcx, 0x43ad(%rip)      # 0x7120
movl %esi, %ebx
movq %rcx, %rax
xorl %edx, %edx
divq %rbx
addl %r10d, %edx
movl -0x4(%rdi,%r9,4), %eax
movl (%rdi,%rdx,4), %ebx
movl %ebx, -0x4(%rdi,%r9,4)
movl %eax, (%rdi,%rdx,4)
incq %r10
incq %r9
decl %esi
jmp 0x2d5b
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/lns[P]team-tactic-topic-model/./rng.cpp
// Function: void prop_exp<double>(double*, unsigned int)
inline void prop_exp(T* x, uint32_t len)
{
	T mean = 0;
	for(uint32_t i=0;i<len;i++)
		if(std::isfinite(x[i]))
			mean += x[i];
	mean /= len;
	for(uint32_t i=0;i<len;i++)
		x[i] = exp(x[i]-mean);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl %esi, %r14d
xorpd %xmm1, %xmm1
xorl %eax, %eax
movabsq $0x7ff0000000000000, %rcx # imm = 0x7FF0000000000000
cmpq %rax, %r14
je 0x3600
movq (%rbx,%rax,8), %xmm0
movq %xmm0, %rdx
btrq $0x3f, %rdx
cmpq %rcx, %rdx
jge 0x35fb
addsd %xmm0, %xmm1
incq %rax
jmp 0x35de
cvtsi2sd %r14, %xmm0
divsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
xorl %r15d, %r15d
cmpq %r15, %r14
je 0x3633
movsd (%rbx,%r15,8), %xmm0
subsd 0x8(%rsp), %xmm0
callq 0x11d0
movsd %xmm0, (%rbx,%r15,8)
incq %r15
jmp 0x3612
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/wenzhelu[P]RUDP/Listener.cpp
// Function: Listener::getTimeout(int)
void Listener::getTimeout(int ack)
{
    tp end=std::chrono::system_clock::now();
    tp start;
    if(master->startTimes.find(ack)==master->startTimes.end()) {
        return;
    }
    else
    {
        start=master->startTimes.at(ack);
        master->startTimes.erase(master->startTimes.begin(),++master->startTimes.find(ack));
    }
    
    
    this->sRTT=ms((end - start).count()/1000000);
    int u,phi,delta;
    u=1;
    phi=4;
    delta=2;
    this->eRTT=this->eRTT+std::chrono::milliseconds((this->sRTT.count()-this->eRTT.count())/delta);
    this->deviation=this->deviation+std::chrono::milliseconds(abs(this->sRTT.count()-this->eRTT.count())/delta-this->deviation.count());
    master->TimeOut=u*this->eRTT.count()+phi*this->deviation.count();
    master->RTT=this->eRTT.count();
//    debug_print("Timeout: %u, RTT: %u, sRTT: %u, all in ms\n", master->TimeOut, master->RTT, sRTT.count());
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %r15d
movq %rdi, %rbx
callq 0x2050
movq %rax, %r14
movq 0x20(%rbx), %rdi
addq $0x20, %rdi
leaq -0x34(%rbp), %rsi
movl %r15d, (%rsi)
callq 0x2a38
movq 0x20(%rbx), %rdi
leaq 0x28(%rdi), %rcx
cmpq %rcx, %rax
je 0x289b
addq $0x20, %rdi
leaq -0x30(%rbp), %rsi
movl %r15d, (%rsi)
callq 0x2a00
subq (%rax), %r14
movq 0x20(%rbx), %r12
movq 0x38(%r12), %r13
addq $0x20, %r12
leaq -0x2c(%rbp), %rsi
movl %r15d, (%rsi)
movq %r12, %rdi
callq 0x2a38
movq %rax, %rdi
callq 0x2190
movq %r12, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x2aa6
movl $0xf4240, %ecx          # imm = 0xF4240
movq %r14, %rax
cqto
idivq %rcx
movq %rax, %rcx
movq %rax, 0x10(%rbx)
movq 0x8(%rbx), %rsi
movq 0x20(%rbx), %rdi
subq %rsi, %rax
pushq $0x2
popq %r8
cqto
idivq %r8
addq %rsi, %rax
movq %rax, 0x8(%rbx)
subq %rax, %rcx
movq %rcx, %rdx
negq %rdx
cmovsq %rcx, %rdx
shrq %rdx
movq %rdx, 0x18(%rbx)
leal (%rax,%rdx,4), %ecx
movl %ecx, 0x18(%rdi)
movl %eax, 0x14(%rdi)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/wenzhelu[P]RUDP/Listener.cpp
// Function: Listener::update(unsigned int)
void Listener::update(unsigned int ack)
{
    if(master->status==statusEnum::SLOW_START)
    {
        //        master->slowStartNum++;
        if(ack==master->sendBase)
        {
            this->duplicateACK+=1;
            if(this->duplicateACK==3)
                this->fastRecovery();
        }
        else
        {
            this->index(ack);
            if(master->cWnd>=master->throughput)
                master->status=statusEnum::CONG_AVOID;
        }
    }
    else if(master->status==statusEnum::FAST_REC)
    {
        if(ack==master->sendBase)
            ;
        else
        {
            
            master->status=statusEnum::CONG_AVOID;
            this->linear(ack);
        }
        
    }
    else
    {
        //        master->congestNum++;
        if(ack==master->sendBase)
        {
            this->duplicateACK+=1;
            if(this->duplicateACK==3)
                this->fastRecovery();
        }
        else
        {
            this->linear(ack);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x20(%rdi), %rcx
movl (%rcx), %eax
movl 0xc(%rcx), %edx
cmpl $0x1, %edx
je 0x28e6
testl %edx, %edx
jne 0x28f3
cmpl %esi, %eax
je 0x28f7
movq %rbx, %rdi
callq 0x2950
movq 0x20(%rbx), %rax
movl 0x10(%rax), %ecx
cmpl 0x8(%rax), %ecx
jb 0x2910
movl $0x2, 0xc(%rax)
jmp 0x2910
cmpl %esi, %eax
je 0x2910
movl $0x2, 0xc(%rcx)
jmp 0x2917
cmpl %esi, %eax
jne 0x2917
movl (%rbx), %eax
incl %eax
movl %eax, (%rbx)
cmpl $0x3, %eax
jne 0x2910
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2926
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x296e
nop
// File: /workspace/github_cpp_makefile_star2_O2/wenzhelu[P]RUDP/Listener.cpp
// Function: Listener::fastRecovery()
void Listener::fastRecovery()
{
    this->duplicateACK=0;
    master->throughput=master->cWnd/2;
    master->cWnd=master->throughput;
    master->status=statusEnum::FAST_REC;
    master->sender->resend = true;
    debug_print("Duplicate ACK happens\n", nullptr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
andl $0x0, (%rdi)
movq 0x20(%rdi), %rax
movl 0x10(%rax), %ecx
shrl %ecx
movl %ecx, 0x8(%rax)
movl %ecx, 0x10(%rax)
movl $0x1, 0xc(%rax)
movq 0x610(%rax), %rax
movb $0x1, 0x39(%rax)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/wenzhelu[P]RUDP/Listener.cpp
// Function: Listener::linear(unsigned int)
void Listener::linear(unsigned int ack)
{
    this->ACKcwnd+=(ack-master->sendBase);
    master->cWnd+=(ACKcwnd*master->PACKET_SIZE)/master->cWnd;
    if(master->cWnd>master->winSize)
        master->cWnd=master->winSize;
    this->ACKcwnd=0;
    master->sendBase=ack;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x20(%rdi), %rcx
movl %esi, %eax
subl (%rcx), %eax
addl 0x4(%rdi), %eax
imull $0x5b4, %eax, %eax      # imm = 0x5B4
movl 0x4(%rcx), %r8d
movl 0x10(%rcx), %r9d
xorl %edx, %edx
divl %r9d
addl %r9d, %eax
cmpl %r8d, %eax
cmovael %r8d, %eax
movl %eax, 0x10(%rcx)
andl $0x0, 0x4(%rdi)
movl %esi, (%rcx)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/wenzhelu[P]RUDP/RUDP.cpp
// Function: RUDP::init(unsigned int, char const*, char const*, char const*)
void RUDP::init(uint window, const char *port, const char *remoteIp, const char *remotePort) {
    srand(time(nullptr));   // set random seed
    memset(buff, 0, PACKET_SIZE + HEADER_LEN);
    this->sendBase = 0;
    // make the sequence number in the buffer the same with send base
    *(uint *)(this->buff) = this->sendBase;
    this->winSize = window;
    this->status = SLOW_START;
    this->cWnd = PACKET_SIZE;
    this->close = false;
    this->RTT = 500;
    this->TimeOut = 3000;
    this->throughput = 100000000;
    this->congestNum = 0;
    this->slowStartNum = 0;
    
    this->sock = new Usock();
    this->sock->init(port, remoteIp, remotePort);
    this->sender = new Sender(this);
    this->listener = new Listener(this);
    
    th_sender = new thread(&Sender::sending, sender);
    th_listener = new thread(&Listener::recAns, listener);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %r12
movl %esi, %r13d
movq %rdi, %rbx
xorl %edi, %edi
callq 0x2210
movl %eax, %edi
callq 0x2230
leaq 0x50(%rbx), %rdi
andl $0x0, (%rbx)
movl $0x5c0, %edx            # imm = 0x5C0
xorl %esi, %esi
callq 0x2150
movl %r13d, 0x4(%rbx)
movl $0x5b4, 0x10(%rbx)      # imm = 0x5B4
movb $0x0, 0x620(%rbx)
movabsq $0xbb8000001f4, %rax    # imm = 0xBB8000001F4
movq %rax, 0x14(%rbx)
movq $0x5f5e100, 0x8(%rbx)   # imm = 0x5F5E100
andq $0x0, 0x640(%rbx)
pushq $0x24
popq %rdi
callq 0x2250
movq %rax, %r13
movq %rax, %rdi
callq 0x381c
movq %r13, 0x628(%rbx)
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x3822
pushq $0x68
popq %rdi
callq 0x2250
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2fa4
leaq 0x610(%rbx), %r15
movq %r14, 0x610(%rbx)
pushq $0x30
popq %rdi
callq 0x2250
andl $0x0, 0x28(%rax)
andq $0x0, (%rax)
movq %rbx, 0x20(%rax)
movq %rax, 0x618(%rbx)
pushq $0x8
popq %rdi
callq 0x2250
movq %rax, %r14
leaq 0x619(%rip), %rax       # 0x32dc
leaq -0x38(%rbp), %rsi
movq %rax, (%rsi)
andq $0x0, 0x8(%rsi)
movq %r14, %rdi
movq %r15, %rdx
callq 0x2dde
leaq 0x618(%rbx), %r15
movq %r14, 0x638(%rbx)
pushq $0x8
popq %rdi
callq 0x2250
movq %rax, %r14
leaq -0x726(%rip), %rax      # 0x25d4
leaq -0x38(%rbp), %rsi
movq %rax, (%rsi)
andq $0x0, 0x8(%rsi)
movq %r14, %rdi
movq %r15, %rdx
callq 0x2e5c
movq %r14, 0x630(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2d2b
jmp 0x2d2b
movq %rax, %rbx
movq %r14, %rdi
jmp 0x2d39
movq %rax, %rbx
movq %r13, %rdi
callq 0x2220
movq %rbx, %rdi
callq 0x2370
// File: /workspace/github_cpp_makefile_star2_O2/wenzhelu[P]RUDP/RUDP.cpp
// Function: RUDP::shutdown()
void RUDP::shutdown() {
    // stop protocol running
    close = true;
    th_sender->join();
    th_listener->join();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb $0x1, 0x620(%rdi)
movq 0x638(%rdi), %rdi
callq 0x2360
movq 0x630(%rbx), %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2360
// File: /workspace/github_cpp_makefile_star2_O2/wenzhelu[P]RUDP/RUDP.cpp
// Function: RUDP::cleanUp()
void RUDP::cleanUp() {
    // release resources like socket and heap memory
    sock->closeSock();
    delete th_listener;
    delete th_sender;
    delete sender;
    delete listener;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x628(%rdi), %rdi
callq 0x3902
movq 0x630(%rbx), %r14
testq %r14, %r14
je 0x2d9e
movq %r14, %rdi
callq 0x2eda
movq %r14, %rdi
callq 0x2220
movq 0x638(%rbx), %r14
testq %r14, %r14
je 0x2dba
movq %r14, %rdi
callq 0x2eda
movq %r14, %rdi
callq 0x2220
movq 0x610(%rbx), %rdi
callq 0x2220
movq 0x618(%rbx), %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x2220
// File: /workspace/github_cpp_makefile_star2_O2/wenzhelu[P]RUDP/sender.cpp
// Function: Sender::beginTask()
void Sender::beginTask() {
    diff = master->sendBase;
    curPtr = master->sendBase;
    timerBase = master->sendBase;
    sendTime = system_clock::now();
    th_timer = new thread(&Sender::timing, this);
    pending = true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
movq 0x48(%rdi), %rax
movl (%rax), %eax
movl %eax, 0x40(%rdi)
movl %eax, 0x3c(%rdi)
movl %eax, 0x58(%rdi)
callq 0x2050
movq %rax, 0x60(%rbx)
pushq $0x8
popq %rdi
callq 0x2250
leaq 0x43(%rip), %rcx        # 0x3060
leaq -0x28(%rbp), %rsi
movq %rcx, (%rsi)
andq $0x0, 0x8(%rsi)
movq %rax, %r14
leaq -0x18(%rbp), %rdx
movq %rbx, (%rdx)
movq %rax, %rdi
callq 0x34c8
movq %r14, 0x50(%rbx)
movb $0x1, 0x38(%rbx)
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
movq %r14, %rdi
callq 0x2220
movq %rbx, %rdi
callq 0x2370
nop
// File: /workspace/github_cpp_makefile_star2_O2/wenzhelu[P]RUDP/sender.cpp
// Function: Sender::timing()
void Sender::timing() {
    // timer loop in this function
    while (pending) {
        tp cur = system_clock::now();
        if (getDurMs(sendTime, cur) >= master->TimeOut) {
            // time to check sendBase
            // aggressive mode:
            // set up a begin send time before sending the file
            // then every send time later on is set by timer.
            // we continuously check timerBase and sendBase every RTT
            // if sendBase larger than sendBase, we have a time out.
            // Why called aggressive mode? we make timer very active and
            // not rely on "send" behavior to avoid stuck in sending.
//            debug_print("timerBase: %u, sendBase: %u\n", timerBase, master->sendBase);
            if (timerBase >= master->sendBase) {
                // data loss timeout!
                master->status = SLOW_START;
                master->throughput = master->cWnd >> 1;
                master->cWnd = RUDP::PACKET_SIZE;
//                debug_print("Timeout! Send base: %u, cWnd: %u, throughput: %u\n", master->sendBase, master->cWnd, master->throughput);
                resend = true;
            } else {
                timerBase = master->sendBase;
                sendTime = cur;
            }
        }
        this_thread::sleep_for(milliseconds(master->TimeOut)); // experimental sleep time
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl $0xf4240, %r15d         # imm = 0xF4240
leaq -0x28(%rbp), %r14
movabsq $0x5b400000000, %r12    # imm = 0x5B400000000
cmpb $0x1, 0x38(%rbx)
jne 0x30db
callq 0x2050
movq %rax, %rcx
subq 0x60(%rbx), %rax
cqto
idivq %r15
movq 0x48(%rbx), %rsi
movl 0x18(%rsi), %edx
cmpl %eax, %edx
ja 0x30cb
movl (%rsi), %eax
cmpl %eax, 0x58(%rbx)
jae 0x30bb
movl %eax, 0x58(%rbx)
movq %rcx, 0x60(%rbx)
movl 0x18(%rsi), %edx
jmp 0x30cb
movl 0x10(%rsi), %eax
movq %r12, 0xc(%rsi)
shrl %eax
movl %eax, 0x8(%rsi)
movb $0x1, 0x39(%rbx)
movl %edx, %eax
movq %rax, -0x28(%rbp)
movq %r14, %rdi
callq 0x29a5
jmp 0x3086
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/wenzhelu[P]RUDP/sender.cpp
// Function: Sender::endTask()
void Sender::endTask() {
    // all buffer received
    // no data pending to send
    // unlock busy
    pending = false;
    delete [] userBuff;
    userBuff = nullptr;
    userDataLen = 0;
    diff = 0;
    master->startTimes.clear();
    th_timer->join();   // must wait for thread ends before deleting
    delete th_timer;
    // sending finish signal
    master->setDataBit(0);
    master->setFinBit(1);
    master->sock->write(master->buff, RUDP::PACKET_SIZE);
    master->setFinBit(0);
    busy.unlock();
    debug_print("send one file end\n", nullptr);
    debug_print("RTT: %u\n, slow start packets: %u, congestion avoidance packets: %u\n", master->RTT, master->slowStartNum, master->congestNum);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movb $0x0, 0x38(%rdi)
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x3103
callq 0x22b0
andq $0x0, (%rbx)
andl $0x0, 0x8(%rbx)
andl $0x0, 0x40(%rbx)
movq 0x48(%rbx), %rdi
addq $0x20, %rdi
callq 0x2b06
movq 0x50(%rbx), %rdi
callq 0x2360
movq 0x50(%rbx), %r14
testq %r14, %r14
je 0x3136
movq %r14, %rdi
callq 0x2eda
movq %r14, %rdi
callq 0x2220
movq 0x48(%rbx), %rdi
xorl %esi, %esi
callq 0x2b6c
movq 0x48(%rbx), %rdi
pushq $0x1
popq %rsi
callq 0x2b98
movq 0x48(%rbx), %rsi
movq 0x628(%rsi), %rdi
addq $0x50, %rsi
movl $0x5b4, %edx            # imm = 0x5B4
callq 0x38e8
movq 0x48(%rbx), %rdi
xorl %esi, %esi
callq 0x2b98
addq $0x10, %rbx
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x21a0
nop