LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/NovaGL[P]HarmonyHubControl/HarmonyHubControl.cpp
// Function: WriteAuthorizationTokenFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
int WriteAuthorizationTokenFile(const std::string& strAuthorizationToken)
{
    std::ofstream AuthorizationTokenFileStream;
    AuthorizationTokenFileStream.open(HARMONY_HUB_AUTHORIZATION_TOKEN_FILENAME);
    if(!AuthorizationTokenFileStream.is_open())
    {
        return 1;
    }
    AuthorizationTokenFileStream << strAuthorizationToken;
    AuthorizationTokenFileStream.close();

    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rdi, %r14
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x3480
leaq 0x5f99(%rip), %rsi      # 0xc989
movq %rbx, %rdi
movl $0x10, %edx
callq 0x3050
leaq 0x78(%rsp), %rdi
callq 0x30b0
movl $0x1, %ebx
testb %al, %al
je 0x6a2d
movq (%r14), %rsi
movq 0x8(%r14), %rdx
leaq 0x8(%rsp), %rdi
callq 0x3310
xorl %ebx, %ebx
leaq 0x8(%rsp), %rdi
callq 0x33c0
movq 0xd59c(%rip), %rax      # 0x13fd0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x10(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x8(%rsp,%rcx)
callq 0x3210
leaq 0x100(%rsp), %rdi
callq 0x3110
movl %ebx, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x33f0
movq %rbx, %rdi
callq 0x34a0
// File: /workspace/github_cpp_makefile_star2_O3/NovaGL[P]HarmonyHubControl/./rapidjson/document.h
// Function: rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator>::~GenericDocument()
~GenericDocument() {
        // Clear the ::ValueType before ownAllocator is destroyed, ~ValueType()
        // runs last and may access its elements or members which would be freed
        // with an allocator like MemoryPoolAllocator (CrtAllocator does not
        // free its data when destroyed, but MemoryPoolAllocator does).
        if (ownAllocator_) {
            ValueType::SetNull();
        }
        Destroy();
    }

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpq $0x0, 0x18(%rdi)
je 0x85cd
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq %rbx, %rdi
callq 0x8fde
movq 0x30(%rbx), %rdi
callq 0x3320
movq 0x28(%rbx), %rdi
movl $0x1, %esi
popq %rbx
jmp 0x3290
nop
// File: /workspace/github_cpp_makefile_star2_O3/NovaGL[P]HarmonyHubControl/HarmonyHubControl.cpp
// Function: Device::toString[abi:cxx11]()
std::string toString()
    {       
	std::string ret = m_strType;
	ret.append("\":\"");        
        ret.append(m_strLabel);
	ret.append("\"");
        ret.append(",\"ID\" :");
        ret.append(m_strID);
        ret.append(",\"");
        ret.append(m_strManufacturer);
	ret.append("\":\""); 
        ret.append(m_strModel);
	ret.append("\"");      
        ret.append(",\"Functions\": { \n ");
        std::vector<Function>::iterator it = m_vecFunctions.begin();
        std::vector<Function>::iterator ite = m_vecFunctions.end();
        for(; it != ite; ++it)
        {
            ret.append(it->toString());
        }
        ret=ret.substr(0, ret.size()-2);
        ret.append("}\n");
        return ret;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x10(%rdi), %r12
movq %r12, (%rdi)
movq 0x80(%rsi), %rsi
movq 0x88(%r14), %rdx
addq %rsi, %rdx
callq 0x8d32
leaq 0x38e3(%rip), %rsi      # 0xc0f9
movq %rbx, %rdi
callq 0x34f0
movq 0x20(%r14), %rsi
movq 0x28(%r14), %rdx
movq %rbx, %rdi
callq 0x3100
leaq 0x4724(%rip), %rsi      # 0xcf59
movq %rbx, %rdi
callq 0x34f0
leaq 0x470c(%rip), %rsi      # 0xcf50
movq %rbx, %rdi
callq 0x34f0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbx, %rdi
callq 0x3100
leaq 0x46f6(%rip), %rsi      # 0xcf58
movq %rbx, %rdi
callq 0x34f0
movq 0x40(%r14), %rsi
movq 0x48(%r14), %rdx
movq %rbx, %rdi
callq 0x3100
leaq 0x3878(%rip), %rsi      # 0xc0f9
movq %rbx, %rdi
callq 0x34f0
movq 0x60(%r14), %rsi
movq 0x68(%r14), %rdx
movq %rbx, %rdi
callq 0x3100
leaq 0x46b9(%rip), %rsi      # 0xcf59
movq %rbx, %rdi
callq 0x34f0
leaq 0x46ac(%rip), %rsi      # 0xcf5b
movq %rbx, %rdi
callq 0x34f0
movq 0xa0(%r14), %r15
movq 0xa8(%r14), %rbp
cmpq %rbp, %r15
je 0x8911
leaq 0x18(%rsp), %r13
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x8b20
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x3100
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x8908
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3290
addq $0x38, %r15
cmpq %rbp, %r15
jne 0x88d4
movq 0x8(%rbx), %rcx
addq $-0x2, %rcx
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x32c0
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3330
movq (%r14), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x8952
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0x4615(%rip), %rsi      # 0xcf6e
movq %rbx, %rdi
callq 0x34f0
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8979
jmp 0x8979
jmp 0x8979
movq %rax, %r14
jmp 0x8998
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x8998
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3290
movq (%rbx), %rdi
cmpq %r12, %rdi
je 0x89ac
movq (%r12), %rsi
incq %rsi
callq 0x3290
movq %r14, %rdi
callq 0x34a0
// File: /workspace/github_cpp_makefile_star2_O3/NovaGL[P]HarmonyHubControl/HarmonyHubControl.cpp
// Function: Function::toString[abi:cxx11]()
std::string toString()
    {
        std::string ret=("\"");
	ret.append(m_strName);
	ret.append("\":[");
        std::vector<Action>::iterator it = m_vecActions.begin();
        std::vector<Action>::iterator ite = m_vecActions.end();
        for(; it != ite; ++it)
        {
	ret.append("\n\t");
	ret.append("\"");
        ret.append(it->toString());
	ret.append("\",");
        }
        ret=ret.substr(0, ret.size()-1);
        ret.append("],\n");
        return ret;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, 0x20(%rsp)
movq %rax, (%rdi)
leaq 0x4412(%rip), %rsi      # 0xcf59
leaq 0x440c(%rip), %rdx      # 0xcf5a
callq 0x8dc8
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbx, %rdi
callq 0x3100
leaq 0x4408(%rip), %rsi      # 0xcf71
movq %rbx, %rdi
callq 0x34f0
movq 0x20(%r14), %rbp
movq 0x28(%r14), %r15
cmpq %r15, %rbp
je 0x8bfd
leaq 0x10(%rsp), %r14
movq %rsp, %r12
leaq 0x4055(%rip), %r13      # 0xcbe2
movq %rbx, %rdi
leaq 0x43de(%rip), %rsi      # 0xcf75
callq 0x34f0
movq %rbx, %rdi
leaq 0x43b3(%rip), %rsi      # 0xcf59
callq 0x34f0
movq %r14, (%rsp)
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x8d32
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x3100
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x8be9
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3290
movq %rbx, %rdi
movq %r13, %rsi
callq 0x34f0
addq $0x60, %rbp
cmpq %r15, %rbp
jne 0x8b8d
movq 0x8(%rbx), %rcx
decq %rcx
movq %rsp, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x32c0
movq %rsp, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3330
movq (%r14), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x8c39
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3290
leaq 0x4338(%rip), %rsi      # 0xcf78
movq %rbx, %rdi
callq 0x34f0
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8c7d
jmp 0x8c7d
jmp 0x8c7d
jmp 0x8c7d
movq %rax, %r15
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x8c80
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3290
jmp 0x8c80
movq %rax, %r15
movq (%rbx), %rdi
movq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x8c98
movq (%rax), %rsi
incq %rsi
callq 0x3290
movq %r15, %rdi
callq 0x34a0
// File: /workspace/github_cpp_makefile_star2_O3/NovaGL[P]HarmonyHubControl/./rapidjson/allocators.h
// Function: rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>::MemoryPoolAllocator(unsigned long, rapidjson::CrtAllocator*)
explicit
    MemoryPoolAllocator(size_t chunkSize = kDefaultChunkCapacity, BaseAllocator* baseAllocator = 0) : 
        chunk_capacity_(chunkSize),
        baseAllocator_(baseAllocator ? baseAllocator : RAPIDJSON_NEW(BaseAllocator)()),
        shared_(static_cast<SharedData*>(baseAllocator_ ? baseAllocator_->Malloc(SIZEOF_SHARED_DATA + SIZEOF_CHUNK_HEADER) : 0))
    {
        RAPIDJSON_ASSERT(baseAllocator_ != 0);
        RAPIDJSON_ASSERT(shared_ != 0);
        if (baseAllocator) {
            shared_->ownBaseAllocator = 0;
        }
        else {
            shared_->ownBaseAllocator = baseAllocator_;
        }
        shared_->chunkHead = GetChunkHead(shared_);
        shared_->chunkHead->capacity = 0;
        shared_->chunkHead->size = 0;
        shared_->chunkHead->next = 0;
        shared_->ownBuffer = true;
        shared_->refcount = 1;
    }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rsi, (%rdi)
testq %rdx, %rdx
je 0x8f4a
xorl %r14d, %r14d
jmp 0x8f5a
movl $0x1, %edi
callq 0x3270
movq %rax, %r14
movq %rax, %rdx
movq %rdx, 0x8(%rbx)
movl $0x38, %edi
callq 0x3350
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x8fa2
movq %r14, 0x8(%rax)
movq %rax, %rcx
addq $0x20, %rcx
movq %rcx, (%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movq $0x0, 0x30(%rax)
movb $0x1, 0x18(%rax)
movq $0x1, 0x10(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x41e5(%rip), %rdi      # 0xd18e
leaq 0x414c(%rip), %rsi      # 0xd0fc
leaq 0x415e(%rip), %rcx      # 0xd115
movl $0xaf, %edx
callq 0x31a0
nop
// File: /workspace/github_cpp_makefile_star2_O3/NovaGL[P]HarmonyHubControl/./rapidjson/allocators.h
// Function: rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>::~MemoryPoolAllocator()
~MemoryPoolAllocator() RAPIDJSON_NOEXCEPT {
        if (!shared_) {
            // do nothing if moved
            return;
        }
        if (shared_->refcount > 1) {
            --shared_->refcount;
            return;
        }
        Clear();
        BaseAllocator *a = shared_->ownBaseAllocator;
        if (shared_->ownBuffer) {
            baseAllocator_->Free(shared_);
        }
        RAPIDJSON_DELETE(a);
    }

// Assembly:
movq 0x10(%rdi), %rax
testq %rax, %rax
je 0x9018
movq 0x10(%rax), %rcx
cmpq $0x2, %rcx
jb 0x9019
decq %rcx
movq %rcx, 0x10(%rax)
retq
pushq %rbx
movq %rdi, %rbx
callq 0x9044
movq 0x10(%rbx), %rdi
movq 0x8(%rdi), %rbx
cmpb $0x1, 0x18(%rdi)
jne 0x9035
callq 0x3320
movl $0x1, %esi
movq %rbx, %rdi
popq %rbx
jmp 0x3290
nop
// File: /workspace/github_cpp_makefile_star2_O3/NovaGL[P]HarmonyHubControl/./rapidjson/allocators.h
// Function: rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>::Clear()
void Clear() RAPIDJSON_NOEXCEPT {
        RAPIDJSON_NOEXCEPT_ASSERT(shared_->refcount > 0);
        for (;;) {
            ChunkHeader* c = shared_->chunkHead;
            if (!c->next) {
                break;
            }
            shared_->chunkHead = c->next;
            baseAllocator_->Free(c);
        }
        shared_->chunkHead->size = 0;
    }

// Assembly:
pushq %rbx
movq 0x10(%rdi), %rax
cmpq $0x0, 0x10(%rax)
je 0x9077
movq %rdi, %rbx
movq (%rax), %rdi
movq 0x10(%rdi), %rcx
testq %rcx, %rcx
je 0x906d
movq %rcx, (%rax)
callq 0x3320
movq 0x10(%rbx), %rax
jmp 0x9053
movq $0x0, 0x8(%rdi)
popq %rbx
retq
leaq 0x411d(%rip), %rdi      # 0xd19b
leaq 0x4077(%rip), %rsi      # 0xd0fc
leaq 0x4125(%rip), %rcx      # 0xd1b1
movl $0x115, %edx            # imm = 0x115
callq 0x31a0
// File: /workspace/github_cpp_makefile_star2_O3/NovaGL[P]HarmonyHubControl/./rapidjson/allocators.h
// Function: rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>::Malloc(unsigned long)
void* Malloc(size_t size) {
        RAPIDJSON_NOEXCEPT_ASSERT(shared_->refcount > 0);
        if (!size)
            return NULL;

        size = RAPIDJSON_ALIGN(size);
        if (RAPIDJSON_UNLIKELY(shared_->chunkHead->size + size > shared_->chunkHead->capacity))
            if (!AddChunk(chunk_capacity_ > size ? chunk_capacity_ : size))
                return NULL;

        void *buffer = GetChunkBuffer(shared_) + shared_->chunkHead->size;
        shared_->chunkHead->size += size;
        return buffer;
    }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x10(%rdi), %rax
cmpq $0x0, 0x10(%rax)
je 0xa1c5
movq %rsi, %rbx
testq %rsi, %rsi
je 0xa1bb
addq $0x7, %rbx
andq $-0x8, %rbx
movq (%rax), %rcx
movq 0x8(%rcx), %rax
leaq (%rax,%rbx), %rdx
cmpq (%rcx), %rdx
ja 0xa192
addq %rcx, %rax
addq $0x18, %rax
movq %rdx, 0x8(%rcx)
jmp 0xa1bd
movq %rdi, %r14
movq (%rdi), %rsi
cmpq %rbx, %rsi
cmovbeq %rbx, %rsi
callq 0xa1e4
testb %al, %al
je 0xa1bb
movq 0x10(%r14), %rax
movq (%rax), %rcx
movq 0x8(%rcx), %rax
addq %rax, %rbx
movq %rbx, %rdx
jmp 0xa185
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x2fcf(%rip), %rdi      # 0xd19b
leaq 0x2f29(%rip), %rsi      # 0xd0fc
leaq 0x3ea2(%rip), %rcx      # 0xe07c
movl $0x141, %edx            # imm = 0x141
callq 0x31a0
// File: /workspace/github_cpp_makefile_star2_O3/NovaGL[P]HarmonyHubControl/./rapidjson/allocators.h
// Function: rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>::AddChunk(unsigned long)
bool AddChunk(size_t capacity) {
        if (!baseAllocator_)
            shared_->ownBaseAllocator = baseAllocator_ = RAPIDJSON_NEW(BaseAllocator)();
        if (ChunkHeader* chunk = static_cast<ChunkHeader*>(baseAllocator_->Malloc(SIZEOF_CHUNK_HEADER + capacity))) {
            chunk->capacity = capacity;
            chunk->size = 0;
            chunk->next = shared_->chunkHead;
            shared_->chunkHead = chunk;
            return true;
        }
        else
            return false;
    }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
cmpq $0x0, 0x8(%rdi)
jne 0xa20b
movl $0x1, %edi
callq 0x3270
movq %rax, 0x8(%rbx)
movq 0x10(%rbx), %rcx
movq %rax, 0x8(%rcx)
movq %r14, %rdi
addq $0x18, %rdi
je 0xa23b
callq 0x3350
testq %rax, %rax
je 0xa23b
movq %r14, (%rax)
movq $0x0, 0x8(%rax)
movq 0x10(%rbx), %rcx
movq (%rcx), %rdx
movq %rdx, 0x10(%rax)
movq %rax, (%rcx)
movb $0x1, %al
jmp 0xa23d
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/NovaGL[P]HarmonyHubControl/./rapidjson/document.h
// Function: rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>>::SetObjectRaw(rapidjson::GenericMember<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>>*, unsigned int, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>&)
void SetObjectRaw(Member* members, SizeType count, Allocator& allocator) {
        data_.f.flags = kObjectFlag;
        if (count) {
            Member* m = DoAllocMembers(count, allocator);
            SetMembersPointer(m);
            std::memcpy(static_cast<void*>(m), members, count * sizeof(Member));
#if RAPIDJSON_USE_MEMBERSMAP
            Map* &map = GetMap(m);
            MapIterator* mit = GetMapIterators(map);
            for (SizeType i = 0; i < count; i++) {
                new (&mit[i]) MapIterator(map->insert(MapPair(m[i].name.data_, i)));
            }
#endif
        }
        else
            SetMembersPointer(0);
        data_.o.size = data_.o.capacity = count;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %edx, %ebx
movq %rdi, %r14
movabsq $-0x1000000000000, %r13 # imm = 0xFFFF000000000000
movw $0x3, 0xe(%rdi)
testl %edx, %edx
je 0xa358
movq %rsi, %r15
movl %ebx, %r12d
shlq $0x5, %r12
movq %rcx, %rdi
movq %r12, %rsi
callq 0xa156
andq 0x8(%r14), %r13
orq %rax, %r13
movq %r13, 0x8(%r14)
movq %rax, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x31f0
jmp 0xa35c
andq %r13, 0x8(%r14)
movl %ebx, 0x4(%r14)
movl %ebx, (%r14)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/NovaGL[P]HarmonyHubControl/csocket.cpp
// Function: csocket::~csocket()
csocket::~csocket()
{
    if ( m_socketState != csocket::CLOSED )
    {
#ifdef _WIN32
        closesocket(m_socket);
#else
        ::close(m_socket);
#endif
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x859f(%rip), %rax      # 0x13d98
movq %rax, (%rdi)
cmpl $0x0, 0x2c(%rdi)
je 0xb80a
movl 0x8(%rbx), %edi
callq 0x3500
movq 0x30(%rbx), %rdi
addq $0x40, %rbx
cmpq %rbx, %rdi
je 0xb823
movq (%rbx), %rsi
incq %rsi
popq %rbx
jmp 0x3290
popq %rbx
retq
movq %rax, %rdi
callq 0x8a2d
nop
// File: /workspace/github_cpp_makefile_star2_O3/NovaGL[P]HarmonyHubControl/csocket.cpp
// Function: csocket::canRead(bool*, float)
int csocket::canRead( bool* readyToRead, float waitTime )
{
    if (m_socketState != CONNECTED )
    {
        return ERROR_INAPPROPRIATE_STATE;
    }

    fd_set  fds;
    FD_ZERO(&fds);
    FD_SET(m_socket, &fds);
    int     nfds = 0;

    timeval timeout;

    if ( waitTime <= 0.0f ) 
    {
        timeout.tv_sec = 0;
        timeout.tv_usec = 0;
    } 
    else 
    {
        timeout.tv_sec  = (int)(waitTime);
        timeout.tv_usec = (int)(1000000.0f * 
            (waitTime - (float)timeout.tv_sec));
    }

    
#ifdef _WIN32
    nfds = m_socket+1;
#endif

    int n = select(nfds, &fds, NULL, NULL, &timeout);
    if ( n < 0 ) 
    {
        m_socketState = ERRORED;
        return FAILURE;
    }

    if (n == 1) 
    {
        *readyToRead = true;
        return SUCCESS;
    }

    if (n == 0)
    {
        *readyToRead = false;
    }

    return SUCCESS;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x90, %rsp
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
cmpl $0x1, 0x2c(%rdi)
jne 0xbb40
movq %rsi, %rbx
movq %rdi, %r14
xorps %xmm1, %xmm1
movaps %xmm1, 0x70(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm1, 0x50(%rsp)
movaps %xmm1, 0x40(%rsp)
movaps %xmm1, 0x30(%rsp)
movaps %xmm1, 0x20(%rsp)
movaps %xmm1, 0x10(%rsp)
movaps %xmm1, (%rsp)
movl 0x8(%rdi), %ecx
leal 0x3f(%rcx), %eax
testl %ecx, %ecx
cmovnsl %ecx, %eax
movl %eax, %edx
andl $-0x40, %edx
subl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
sarl $0x6, %eax
cltq
orq %rdx, (%rsp,%rax,8)
xorps %xmm1, %xmm1
ucomiss %xmm0, %xmm1
jae 0xbaf9
cvttss2si %xmm0, %eax
cvttps2dq %xmm0, %xmm1
cvtdq2ps %xmm1, %xmm1
subss %xmm1, %xmm0
mulss 0x3f5a(%rip), %xmm0     # 0xfa48
cltq
cvttss2si %xmm0, %ecx
movslq %ecx, %rcx
jmp 0xbafd
xorl %eax, %eax
xorl %ecx, %ecx
leaq 0x80(%rsp), %r8
movq %rax, (%r8)
movq %rcx, 0x8(%r8)
xorl %r15d, %r15d
movq %rsp, %rsi
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3240
testl %eax, %eax
js 0xbb2d
je 0xbb3d
cmpl $0x1, %eax
jne 0xbb40
movb $0x1, (%rbx)
jmp 0xbb40
movl $0x2, 0x2c(%r14)
movl $0x1, %r15d
jmp 0xbb40
movb $0x0, (%rbx)
movl %r15d, %eax
addq $0x90, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/NovaGL[P]HarmonyHubControl/csocket.cpp
// Function: csocket::read(char*, unsigned int, bool)
int csocket::read( char* pDataBuffer, unsigned int numBytesToRead, bool bReadAll )
{
    if (m_socketState != CONNECTED ) 
    {
        return ERROR_INAPPROPRIATE_STATE;
    }

    int numBytesRemaining = numBytesToRead;
    int numBytesRead = 0;

    do 
    {
#ifdef _WIN32
        numBytesRead = recv( m_socket, pDataBuffer, numBytesRemaining, 0 );
#else
        numBytesRead = static_cast<int>(::read( m_socket, pDataBuffer, numBytesRemaining));
#endif

        if (numBytesRead < 0)
        {
            if ( bReadAll ) 
            {
#ifdef _WIN32
                Sleep(BLOCK_RETRY_INTERVAL_MSECS);
#else
                usleep(BLOCK_RETRY_INTERVAL_MSECS * 1000);
#endif
            } 
            else 
            {
                return numBytesRead;
            }
        } 
        
        if ( numBytesRead > 0 ) 
        {
            numBytesRemaining -= numBytesRead;
            pDataBuffer += numBytesRead;
        }

        if (numBytesRead == 0)
        {
            break;              
        }
        
    } while ((numBytesRemaining > 0) && (bReadAll) );

    return(numBytesToRead - numBytesRemaining);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
cmpl $0x1, 0x2c(%rdi)
jne 0xbbd5
movl %ecx, %ebp
movq %rsi, %r14
movq %rdi, %r15
xorl %ebx, %ebx
movl %edx, 0x4(%rsp)
movl %edx, %r13d
movl 0x8(%r15), %edi
movslq %r13d, %rdx
movq %r14, %rsi
callq 0x33d0
movq %rax, %r12
testl %r12d, %r12d
jns 0xbb9e
testb %bpl, %bpl
je 0xbbd5
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x33b0
movl %r12d, %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
testl %r12d, %r12d
cmovleq %rbx, %rax
movl $0x0, %ecx
cmovgl %r12d, %ecx
subl %ecx, %r13d
testl %r12d, %r12d
je 0xbbcb
testl %r13d, %r13d
jle 0xbbcb
addq %rax, %r14
testb %bpl, %bpl
jne 0xbb78
movl 0x4(%rsp), %eax
subl %r13d, %eax
movl %eax, %r12d
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/NovaGL[P]HarmonyHubControl/csocket.cpp
// Function: csocket::write(char const*, unsigned int)
int csocket::write( const char* pDataBuffer, unsigned int numBytesToWrite )
{
    if (m_socketState != CONNECTED ) 
    {
        return ERROR_INAPPROPRIATE_STATE;
    }

    int numBytesRemaining = numBytesToWrite;
    int numBytestWritten = 0;

    while (numBytesRemaining  > 0) 
    {
#ifdef _WIN32
        numBytestWritten = send( m_socket, pDataBuffer, numBytesRemaining, 0 );
#else
        numBytestWritten= ::write( m_socket, pDataBuffer, numBytesRemaining );
#endif

        if (numBytestWritten < 0) 
        {
            m_socketState = ERRORED;
            return numBytestWritten;      
        }

        numBytesRemaining  -= numBytestWritten;
        pDataBuffer += numBytestWritten;
    }

    return(numBytesToWrite - numBytesRemaining);
}

// Assembly:
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0x1, 0x2c(%rdi)
jne 0xbc43
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %edx, %ebp
testl %edx, %edx
jle 0xbc2b
movq %rsi, %r15
movq %rdi, %r14
movl %ebx, %ebp
movl 0x8(%r14), %edi
movl %ebp, %edx
movq %r15, %rsi
callq 0x3120
testl %eax, %eax
js 0xbc31
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
addq %rcx, %r15
subl %eax, %ebp
jg 0xbc0a
subl %ebp, %ebx
movl %ebx, %eax
jmp 0xbc39
movl $0x2, 0x2c(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/Themaister[P]umusd/alsa.cpp
// Function: ALSA::write(std::vector<unsigned char, std::allocator<unsigned char>> const&)
void ALSA::write(const FF::Buffer &buf)
{
   auto buffer = buf.data();
   auto size = snd_pcm_bytes_to_frames(pcm, buf.size());

   while (size)
   {
      auto frames = snd_pcm_writei(pcm, buffer, size);
      if (frames == -EPIPE || frames == -EINTR || frames == -ESTRPIPE)
      {
         if (snd_pcm_recover(pcm, frames, 1) < 0)
            throw std::runtime_error("Failed to recover ALSA.\n");
      }
      else if (frames < 0)
         throw std::runtime_error("ALSA failed to write.\n");

      buffer += snd_pcm_frames_to_bytes(pcm, frames);
      size -= frames;
   }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rsi), %r14
movq 0x8(%rsi), %rsi
movq 0x30(%rdi), %rdi
subq %r14, %rsi
callq 0x5130
testq %rax, %rax
je 0x5f6e
movq %rax, %r15
movq 0x30(%rbx), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x5060
movq %rax, %r12
cmpq $-0x56, %rax
je 0x5f3e
cmpq $-0x4, %r12
je 0x5f3e
cmpq $-0x20, %r12
jne 0x5f55
movq 0x30(%rbx), %rdi
movl %r12d, %esi
movl $0x1, %edx
callq 0x53b0
testl %eax, %eax
jns 0x5f5a
jmp 0x5f7a
testq %r12, %r12
js 0x5f98
movq 0x30(%rbx), %rdi
movq %r12, %rsi
callq 0x5320
addq %rax, %r14
subq %r12, %r15
jne 0x5f1a
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movl $0x10, %edi
callq 0x5420
movq %rax, %rbx
leaq 0x91d9(%rip), %rsi      # 0xf167
movq %rax, %rdi
callq 0x50d0
jmp 0x5fb4
movl $0x10, %edi
callq 0x5420
movq %rax, %rbx
leaq 0x91d4(%rip), %rsi      # 0xf180
movq %rax, %rdi
callq 0x50d0
movq 0xffdd(%rip), %rsi      # 0x15f98
movq 0x1001e(%rip), %rdx     # 0x15fe0
movq %rbx, %rdi
callq 0x51c0
jmp 0x5fcc
movq %rax, %r14
movq %rbx, %rdi
callq 0x55f0
movq %r14, %rdi
callq 0x5200
nop
// File: /workspace/github_cpp_makefile_star2_O3/Themaister[P]umusd/command.cpp
// Function: SocketReply::handle(EventHandler&)
void SocketReply::handle(EventHandler &handler)
{
   size_t to_write = data.size() - ptr;

   ssize_t ret = write(fd, data.data() + ptr, to_write);
   if (ret <= 0)
   {
      handler.remove(*this);
      end_cb(false);
   }
   else
      ptr += ret;

   if (ptr >= data.size())
   {
      handler.remove(*this);
      end_cb(true);
   }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x28(%rdi), %rdx
movq 0x40(%rdi), %rsi
subq %rsi, %rdx
movl 0x18(%rdi), %edi
addq 0x20(%rbx), %rsi
callq 0x5620
testq %rax, %rax
jle 0x7836
addq 0x40(%rbx), %rax
movq %rax, 0x40(%rbx)
jmp 0x785d
movq %r14, %rdi
movq %rbx, %rsi
callq 0x9e3c
movb $0x0, 0x6(%rsp)
cmpq $0x0, 0x58(%rbx)
je 0x788e
leaq 0x48(%rbx), %rdi
leaq 0x6(%rsp), %rsi
callq *0x60(%rbx)
movq 0x40(%rbx), %rax
cmpq 0x28(%rbx), %rax
jb 0x7886
movq %r14, %rdi
movq %rbx, %rsi
callq 0x9e3c
movb $0x1, 0x7(%rsp)
cmpq $0x0, 0x58(%rbx)
je 0x788e
leaq 0x48(%rbx), %rdi
leaq 0x7(%rsp), %rsi
callq *0x60(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x52e0
nop
// File: /workspace/github_cpp_makefile_star2_O3/Themaister[P]umusd/./utils.hpp
// Function: string_split(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
inline std::vector<std::string> string_split(const std::string &str, const std::string &delim)
{
   std::vector<std::string> res;
   auto tmp = str;

   char *cookie;
   const char *s = strtok_r(&tmp[0], delim.c_str(), &cookie);
   while (s)
   {
      res.push_back(s);
      s = strtok_r(nullptr, delim.c_str(), &cookie);
   }

   return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
movq (%rsi), %rax
movq 0x8(%rsi), %rdx
addq %rax, %rdx
movq %rsp, %rdi
movq %rax, %rsi
callq 0x8d46
movq (%rsp), %rdi
movq (%r14), %rsi
leaq 0x20(%rsp), %rdx
callq 0x5100
testq %rax, %rax
je 0x899f
movq %rax, %r13
leaq 0x38(%rsp), %rbp
leaq 0x28(%rsp), %r15
leaq 0x20(%rsp), %r12
movq %rbp, 0x28(%rsp)
movq %r13, %rdi
callq 0x5120
leaq (%rax,%r13), %rdx
movq %r15, %rdi
movq %r13, %rsi
callq 0x64c4
movq %rbx, %rdi
movq %r15, %rsi
callq 0x8ddc
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x898a
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x5070
movq (%r14), %rsi
xorl %edi, %edi
movq %r12, %rdx
callq 0x5100
movq %rax, %r13
testq %rax, %rax
jne 0x894c
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x89ba
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x5070
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x8a0b
movq %rax, %r14
jmp 0x89f0
movq %rax, %r14
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0x89f0
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x5070
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x8a0b
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x5070
movq %rbx, %rdi
callq 0x8a1c
movq %r14, %rdi
callq 0x5200
nop
// File: /workspace/github_cpp_makefile_star2_O3/Themaister[P]umusd/command.cpp
// Function: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> plain_action<std::_Bind<void (Remote::* (Remote*))()>>(std::_Bind<void (Remote::* (Remote*))()>)
inline std::string plain_action(Delegate func)
{
   try
   {
      func();
      return "OK";
   }
   catch(const std::exception &e)
   {
      std::cerr << e.what() << std::endl;
      return "ERROR";
   }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rsi), %rax
movq 0x10(%rsi), %rdi
addq 0x8(%rsi), %rdi
testb $0x1, %al
je 0x96f3
movq (%rdi), %rcx
movq -0x1(%rcx,%rax), %rax
callq *%rax
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x5be2(%rip), %rsi      # 0xf2e5
leaq 0x5bdd(%rip), %rdx      # 0xf2e7
movq %rbx, %rdi
callq 0x64c4
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
jmp 0x971f
movq %rax, %r14
cmpl $0x1, %edx
jne 0x977d
movq %r14, %rdi
callq 0x5050
movq (%rax), %rcx
movq %rax, %rdi
callq *0x10(%rcx)
movq 0xc861(%rip), %rdi      # 0x15fa0
movq %rax, %rsi
callq 0x54d0
movq %rax, %rdi
callq 0x52c0
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x5b8b(%rip), %rsi      # 0xf2e8
leaq 0x5b89(%rip), %rdx      # 0xf2ed
movq %rbx, %rdi
callq 0x64c4
callq 0x5590
jmp 0x9712
jmp 0x9775
movq %rax, %r14
callq 0x5590
movq %r14, %rdi
callq 0x5200
movq %rax, %rdi
callq 0x6406
// File: /workspace/github_cpp_makefile_star2_O3/Themaister[P]umusd/eventhandler.cpp
// Function: EventHandler::wait()
bool EventHandler::wait()
{
   struct epoll_event events[16];
   int ret = epoll_wait(epfd, events, 16, -1);
   if (ret < 0)
      throw std::runtime_error("epoll_wait() failed.\n");

   for (int i = 0; i < ret; i++)
   {
      auto cb = cb_map[events[i].data.fd];
      if (cb)
         cb();
   }

   return !killed;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe0, %rsp
movq %rdi, %rbx
movl (%rdi), %edi
leaq 0x20(%rsp), %rsi
movl $0x10, %edx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x5190
testl %eax, %eax
js 0x9fc1
je 0x9fab
leaq 0x8(%rbx), %r14
movl %eax, %r13d
leaq 0x24(%rsp), %r15
movq %rsp, %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0xa15a
movq %r12, %rdi
movq %rax, %rsi
callq 0xa1c0
cmpq $0x0, 0x10(%rsp)
je 0x9fa2
movq %r12, %rdi
callq *0x18(%rsp)
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x9fa2
movq %r12, %rdi
movq %r12, %rsi
movl $0x3, %edx
callq *%rax
addq $0xc, %r15
decq %r13
jne 0x9f66
movb 0x4(%rbx), %al
xorb $0x1, %al
addq $0xe0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movl $0x10, %edi
callq 0x5420
movq %rax, %r14
leaq 0x560b(%rip), %rsi      # 0xf5e0
movq %rax, %rdi
callq 0x50d0
movq 0xbfb4(%rip), %rsi      # 0x15f98
movq 0xbff5(%rip), %rdx      # 0x15fe0
movq %r14, %rdi
callq 0x51c0
movq %rax, %rbx
movq %r14, %rdi
callq 0x55f0
jmp 0xa01c
jmp 0xa024
movq %rax, %rbx
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0xa01c
movq %rsp, %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq %rbx, %rdi
callq 0x5200
movq %rax, %rdi
callq 0x6406
// File: /workspace/github_cpp_makefile_star2_O3/Themaister[P]umusd/ffmpeg.cpp
// Function: FF::FF(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
FF::FF(const std::string &path)
   : fctx(nullptr), actx(nullptr), aud_stream(-1), last_pos(0.0f), planar_audio(false)
{
   av_register_all();

   try
   {
      media_info.title = path;

      if (avformat_open_input(&fctx, path.c_str(), nullptr, nullptr) < 0)
         throw std::runtime_error("Failed to open file.\n");

      if (avformat_find_stream_info(fctx, nullptr) < 0)
         throw std::runtime_error("Failed to get stream info.\n");

      resolve_codecs();
      get_media_info();
   } 
   catch(...)
   {
      if (actx)
         avcodec_close(actx);
      if (fctx)
         avformat_close_input(&fctx);
      throw;
   }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0x10(%rdi)
leaq 0x38(%rdi), %rax
movq %rax, 0x28(%rdi)
xorl %eax, %eax
movq %rax, 0x30(%rdi)
movb %al, 0x38(%rdi)
leaq 0x58(%rdi), %rcx
movq %rcx, 0x48(%rdi)
movq %rax, 0x50(%rdi)
movb %al, 0x58(%rdi)
leaq 0x78(%rdi), %rcx
movq %rcx, 0x68(%rdi)
movq %rax, 0x70(%rdi)
movb %al, 0x78(%rdi)
movups %xmm0, 0x88(%rdi)
movups %xmm0, 0x91(%rdi)
callq 0x5210
leaq 0x28(%rbx), %rdi
movq %r14, %rsi
callq 0x5310
movq (%r14), %rsi
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x5470
testl %eax, %eax
js 0xa543
movq (%rbx), %rdi
xorl %esi, %esi
callq 0x5500
testl %eax, %eax
js 0xa561
movq %rbx, %rdi
callq 0xa616
movq %rbx, %rdi
callq 0xa726
popq %rbx
popq %r14
popq %r15
retq
movl $0x10, %edi
callq 0x5420
movq %rax, %r14
leaq 0x50e1(%rip), %rsi      # 0xf638
movq %rax, %rdi
callq 0x50d0
jmp 0xa57d
movl $0x10, %edi
callq 0x5420
movq %rax, %r14
leaq 0x50d9(%rip), %rsi      # 0xf64e
movq %rax, %rdi
callq 0x50d0
movq 0xba14(%rip), %rsi      # 0x15f98
movq 0xba55(%rip), %rdx      # 0x15fe0
movq %r14, %rdi
callq 0x51c0
jmp 0xa595
movq %rax, %r15
movq %r14, %rdi
callq 0x55f0
jmp 0xa5aa
movq %rax, %r14
jmp 0xa5db
movq %rax, %r15
movq %r15, %rdi
callq 0x5050
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0xa5c0
callq 0x5610
cmpq $0x0, (%rbx)
je 0xa5ce
movq %rbx, %rdi
callq 0x5540
callq 0x55c0
movq %rax, %r14
callq 0x5590
leaq 0x88(%rbx), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0xa5f9
movq 0x98(%rbx), %rsi
subq %rdi, %rsi
callq 0x5070
addq $0x18, %rbx
movq %rbx, %rdi
callq 0x9acc
movq %r14, %rdi
callq 0x5200
movq %rax, %rdi
callq 0x6406
nop
// File: /workspace/github_cpp_makefile_star2_O3/Themaister[P]umusd/ffmpeg.cpp
// Function: FF::resolve_codecs()
void FF::resolve_codecs()
{
   for (unsigned i = 0; i < fctx->nb_streams; i++)
   {
      if (fctx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
      {
         aud_stream = i;
         break;
      }
   }

   if (aud_stream < 0)
      throw std::runtime_error("Failed to locate audio stream.\n");

   AVCodec *codec = avcodec_find_decoder(fctx->streams[aud_stream]->codec->codec_id);
   if (!codec)
      throw std::runtime_error("Failed to locate decoder for stream.\n");

   actx = fctx->streams[aud_stream]->codec;
   if (avcodec_open2(actx, codec, nullptr) < 0)
   {
      actx = nullptr;
      throw std::runtime_error("Failed to open codec.\n");
   }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rax
movl 0x2c(%rax), %ecx
testq %rcx, %rcx
je 0xa649
movq 0x30(%rax), %rsi
xorl %edx, %edx
movq (%rsi,%rdx,8), %rdi
movq 0x8(%rdi), %rdi
cmpl $0x1, 0xc(%rdi)
je 0xa646
incq %rdx
cmpq %rdx, %rcx
jne 0xa62e
jmp 0xa649
movl %edx, 0x10(%rbx)
movslq 0x10(%rbx), %rcx
testq %rcx, %rcx
js 0xa698
movq 0x30(%rax), %rax
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
movl 0x18(%rax), %edi
callq 0x5330
testq %rax, %rax
je 0xa6b6
movq (%rbx), %rcx
movq 0x30(%rcx), %rcx
movslq 0x10(%rbx), %rdx
movq (%rcx,%rdx,8), %rcx
movq 0x8(%rcx), %rdi
movq %rdi, 0x8(%rbx)
movq %rax, %rsi
xorl %edx, %edx
callq 0x5480
testl %eax, %eax
js 0xa6d4
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl $0x10, %edi
callq 0x5420
movq %rax, %rbx
leaq 0x4fd1(%rip), %rsi      # 0xf67d
movq %rax, %rdi
callq 0x50d0
jmp 0xa6f8
movl $0x10, %edi
callq 0x5420
movq %rax, %rbx
leaq 0x4fd3(%rip), %rsi      # 0xf69d
movq %rax, %rdi
callq 0x50d0
jmp 0xa6f8
movq $0x0, 0x8(%rbx)
movl $0x10, %edi
callq 0x5420
movq %rax, %rbx
leaq 0x4fd3(%rip), %rsi      # 0xf6c3
movq %rax, %rdi
callq 0x50d0
movq 0xb899(%rip), %rsi      # 0x15f98
movq 0xb8da(%rip), %rdx      # 0x15fe0
movq %rbx, %rdi
callq 0x51c0
jmp 0xa712
jmp 0xa712
movq %rax, %r14
movq %rbx, %rdi
callq 0x55f0
movq %r14, %rdi
callq 0x5200
nop
// File: /workspace/github_cpp_makefile_star2_O3/Themaister[P]umusd/ffmpeg.cpp
// Function: FF::get_media_info()
void FF::get_media_info()
{
   media_info.channels = actx->channels;
   media_info.rate = actx->sample_rate;
   media_info.fmt = fmt_conv(actx->sample_fmt);

   media_info.duration = fctx->streams[aud_stream]->duration * av_q2d(fctx->streams[aud_stream]->time_base);

   get_metadata(fctx->metadata);
   get_metadata(fctx->streams[aud_stream]->metadata);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rax
movq 0x190(%rax), %xmm0
pshufd $0xe1, %xmm0, %xmm0     # xmm0 = xmm0[1,0,2,3]
movq %xmm0, 0x18(%rdi)
movl 0x198(%rax), %eax
leal -0x1(%rax), %ecx
cmpl $0x7, %ecx
ja 0xa77a
leaq 0x4ea3(%rip), %rdx      # 0xf5f8
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movb $0x1, 0xa0(%rbx)
movl $0x1, %eax
jmp 0xa78a
movb $0x1, 0xa0(%rbx)
movl $0x3, %eax
jmp 0xa78a
xorl %eax, %eax
jmp 0xa78a
movb $0x1, 0xa0(%rbx)
movl $0x2, %eax
movl %eax, 0x20(%rbx)
movq (%rbx), %rax
movq 0x30(%rax), %rcx
movslq 0x10(%rbx), %rdx
movq (%rcx,%rdx,8), %rcx
xorps %xmm0, %xmm0
cvtsi2sdq 0x28(%rcx), %xmm0
movq 0x18(%rcx), %rcx
cvtsi2sd %ecx, %xmm1
shrq $0x20, %rcx
cvtsi2sd %ecx, %xmm2
divsd %xmm2, %xmm1
mulsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movss %xmm0, 0x24(%rbx)
movq 0x4b0(%rax), %rsi
movq %rbx, %rdi
callq 0xa9fc
movq (%rbx), %rax
movq 0x30(%rax), %rax
movslq 0x10(%rbx), %rcx
movq (%rax,%rcx,8), %rax
movq 0x48(%rax), %rsi
movq %rbx, %rdi
popq %rbx
jmp 0xa9fc
// File: /workspace/github_cpp_makefile_star2_O3/Themaister[P]umusd/ffmpeg.cpp
// Function: FF::~FF()
FF::~FF()
{
   if (actx)
      avcodec_close(actx);
   if (fctx)
      avformat_close_input(&fctx);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0xa806
callq 0x5610
cmpq $0x0, (%rbx)
je 0xa814
movq %rbx, %rdi
callq 0x5540
movq 0x88(%rbx), %rdi
testq %rdi, %rdi
je 0xa82f
movq 0x98(%rbx), %rsi
subq %rdi, %rsi
callq 0x5070
movq 0x68(%rbx), %rdi
leaq 0x78(%rbx), %rax
cmpq %rax, %rdi
je 0xa847
movq (%rax), %rsi
incq %rsi
callq 0x5070
movq 0x48(%rbx), %rdi
leaq 0x58(%rbx), %rax
cmpq %rax, %rdi
je 0xa85f
movq (%rax), %rsi
incq %rsi
callq 0x5070
movq 0x28(%rbx), %rdi
addq $0x38, %rbx
cmpq %rbx, %rdi
je 0xa878
movq (%rbx), %rsi
incq %rsi
popq %rbx
jmp 0x5070
popq %rbx
retq
movq %rax, %rdi
callq 0x6406
// File: /workspace/github_cpp_makefile_star2_O3/Themaister[P]umusd/ffmpeg.cpp
// Function: FF::operator=(FF&&)
FF& FF::operator=(FF &&ff)
{
   if (actx)
   {
      avcodec_close(actx);
      actx = nullptr;
   }

   if (fctx)
      avformat_close_input(&fctx);

   std::swap(fctx, ff.fctx);
   std::swap(actx, ff.actx);
   aud_stream = ff.aud_stream;
   media_info = ff.media_info;
   buffer = std::move(ff.buffer);
   planar_audio = ff.planar_audio;

   return *this;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0xa92a
callq 0x5610
movq $0x0, 0x8(%rbx)
cmpq $0x0, (%rbx)
je 0xa93d
movq %rbx, %rdi
callq 0x5540
movq (%rbx), %rax
jmp 0xa93f
xorl %eax, %eax
movq (%r14), %rcx
movq %rcx, (%rbx)
movq %rax, (%r14)
movq 0x8(%rbx), %rax
movq 0x8(%r14), %rcx
movq %rcx, 0x8(%rbx)
movq %rax, 0x8(%r14)
movl 0x10(%r14), %eax
movl %eax, 0x10(%rbx)
movups 0x18(%r14), %xmm0
movups %xmm0, 0x18(%rbx)
leaq 0x28(%rbx), %rdi
leaq 0x28(%r14), %rsi
callq 0x5310
leaq 0x48(%rbx), %rdi
leaq 0x48(%r14), %rsi
callq 0x5310
leaq 0x68(%rbx), %rdi
leaq 0x68(%r14), %rsi
callq 0x5310
movl $0x88, %edi
leaq (%r14,%rdi), %rsi
addq %rbx, %rdi
callq 0xaea2
movb 0xa0(%r14), %al
movb %al, 0xa0(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/Themaister[P]umusd/ffmpeg.cpp
// Function: FF::get_metadata(AVDictionary*)
void FF::get_metadata(AVDictionary *meta)
{
   auto entry = av_dict_get(meta, "title", nullptr, 0);
   if (entry && entry->value)
      media_info.title = entry->value;

   entry = av_dict_get(meta, "artist", nullptr, 0);
   if (entry && entry->value)
      media_info.artist = entry->value;

   entry = av_dict_get(meta, "album", nullptr, 0);
   if (entry && entry->value)
      media_info.album = entry->value;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x4c58(%rip), %rsi      # 0xf66a
movq %r14, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x5560
testq %rax, %rax
je 0xaa4f
movq 0x8(%rax), %r15
testq %r15, %r15
je 0xaa4f
leaq 0x28(%rbx), %r12
movq 0x30(%rbx), %r13
movq %r15, %rdi
callq 0x5120
movq %r12, %rdi
xorl %esi, %esi
movq %r13, %rdx
movq %r15, %rcx
movq %rax, %r8
callq 0x54b0
leaq 0x4c1a(%rip), %rsi      # 0xf670
movq %r14, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x5560
testq %rax, %rax
je 0xaa93
movq 0x8(%rax), %r15
testq %r15, %r15
je 0xaa93
leaq 0x48(%rbx), %r12
movq 0x50(%rbx), %r13
movq %r15, %rdi
callq 0x5120
movq %r12, %rdi
xorl %esi, %esi
movq %r13, %rdx
movq %r15, %rcx
movq %rax, %r8
callq 0x54b0
leaq 0x4bdd(%rip), %rsi      # 0xf677
movq %r14, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x5560
testq %rax, %rax
je 0xaae0
movq 0x8(%rax), %r14
testq %r14, %r14
je 0xaae0
movq 0x70(%rbx), %r15
addq $0x68, %rbx
movq %r14, %rdi
callq 0x5120
movq %rbx, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %r14, %rcx
movq %rax, %r8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x54b0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/Themaister[P]umusd/main.cpp
// Function: main
int main(int argc, char *argv[])
{
   try
   {
      Player p;
      p.run();
   }
   catch(const std::exception &e)
   {
      std::cerr << e.what() << std::endl;
   }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
leaq 0x8(%rsp), %rdi
callq 0xb530
leaq 0x8(%rsp), %rdi
callq 0xb7ee
leaq 0xa85b(%rip), %rax      # 0x15a48
addq $0x10, %rax
leaq 0xb8(%rsp), %rdi
movq %rax, -0xb0(%rdi)
callq 0xb382
leaq 0x68(%rsp), %rbx
movq %rbx, %rdi
callq 0xb382
movq -0x20(%rbx), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0xb22d
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x5070
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0xb23c
callq 0x69c2
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xb24b
callq 0x69c2
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0xb34e
movq -0x8(%rbx), %rdi
testq %rdi, %rdi
je 0xb266
callq 0x69c2
xorl %eax, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
retq
movq %rdx, %r14
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xb2d8
jmp 0xb28b
movq %rdx, %r14
movq %rax, %rbx
cmpl $0x1, %r14d
jne 0xb2c8
movq %rbx, %rdi
callq 0x5050
movq (%rax), %rcx
movq %rax, %rdi
callq *0x10(%rcx)
movq 0xacf7(%rip), %rdi      # 0x15fa0
movq %rax, %rsi
callq 0x54d0
movq %rax, %rdi
callq 0x52c0
callq 0x5590
jmp 0xb266
movq %rax, %rbx
callq 0x5590
movq %rbx, %rdi
callq 0x5200
movq %rax, %rdi
callq 0x6406
// File: /workspace/github_cpp_makefile_star2_O3/Themaister[P]umusd/player.cpp
// Function: Player::play_media(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void Player::play_media(const std::string &path)
{
   if (!path.empty())
      queue.current(path);

   ff = std::make_shared<FF>(queue.current());
   dev->set_media(ff);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
cmpq $0x0, 0x8(%rsi)
je 0xb81c
leaq 0x40(%rbx), %rdi
callq 0xc85c
leaq 0x40(%rbx), %rdi
callq 0xc9d4
leaq 0x28(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x20(%rsp), %r14
leaq 0xf(%rsp), %rdx
movq %r14, %rsi
movq %rax, %rcx
callq 0xc788
movq (%r14), %rcx
movq 0x8(%r14), %rax
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
movq %rcx, 0x30(%rbx)
movq 0x38(%rbx), %rdi
movq %rax, 0x38(%rbx)
testq %rdi, %rdi
je 0xb87e
callq 0x69c2
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0xb87a
callq 0x69c2
movq 0x38(%rbx), %rax
movq 0x20(%rbx), %rdi
movq 0x30(%rbx), %rcx
movq %rcx, 0x10(%rsp)
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0xb8aa
movq 0xa6f4(%rip), %rcx      # 0x15f90
cmpb $0x0, (%rcx)
je 0xb8a6
incl 0xc(%rax)
jmp 0xb8aa
lock
incl 0xc(%rax)
leaq 0x10(%rsp), %rsi
callq 0x6820
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0xb8ea
movq 0xa6cb(%rip), %rax      # 0x15f90
cmpb $0x0, (%rax)
je 0xb8d5
movl 0xc(%rdi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0xc(%rdi)
jmp 0xb8df
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
lock
xaddl %eax, 0xc(%rdi)
cmpl $0x1, %eax
jne 0xb8ea
movq (%rdi), %rax
callq *0x18(%rax)
addq $0x38, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0xb904
callq 0x5767
movq %rbx, %rdi
callq 0x5200
// File: /workspace/github_cpp_makefile_star2_O3/Themaister[P]umusd/player.cpp
// Function: Player::next()
void Player::next()
{
   FF::MediaInfo old_info{};
   if (ff)
      old_info = ff->info();

   queue.next();
   play_media();

   auto &new_info = ff->info();

   // Attempt gapless
   if (old_info.channels != new_info.channels ||
         old_info.rate != new_info.rate ||
         old_info.fmt != new_info.fmt ||
         !ff ||
         !dev->active())
   {
      event->remove(*dev);
      play_audio();
   }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x90, %rsp
movq %rdi, %rbx
leaq 0x40(%rsp), %r15
xorps %xmm0, %xmm0
movaps %xmm0, -0x20(%r15)
movq %r15, -0x10(%r15)
xorl %eax, %eax
movq %rax, -0x8(%r15)
movb %al, (%r15)
leaq 0x60(%rsp), %r12
movq %r12, -0x10(%r12)
movq %rax, -0x8(%r12)
movb %al, (%r12)
leaq 0x80(%rsp), %r13
movq %r13, -0x10(%r13)
movq %rax, -0x8(%r13)
movb %al, (%r13)
movq 0x30(%rdi), %rdi
testq %rdi, %rdi
je 0xbccb
callq 0xadea
movq %rax, %r14
leaq 0x30(%rsp), %rdi
movups (%rax), %xmm0
movaps %xmm0, -0x10(%rdi)
leaq 0x10(%rax), %rsi
callq 0x5310
leaq 0x50(%rsp), %rdi
leaq 0x30(%r14), %rsi
callq 0x5310
leaq 0x70(%rsp), %rdi
addq $0x50, %r14
movq %r14, %rsi
callq 0x5310
leaq 0x40(%rbx), %rdi
callq 0xc9ec
leaq 0x10(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x3ce5(%rip), %rdx      # 0xf9c9
movq %rsp, %rdi
movq %rdx, %rsi
callq 0x64c4
movq %rsp, %rsi
movq %rbx, %rdi
callq 0xb802
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0xbd10
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x5070
movq 0x30(%rbx), %rdi
callq 0xadea
movl 0x20(%rsp), %ecx
cmpl (%rax), %ecx
jne 0xbd48
movl 0x24(%rsp), %ecx
cmpl 0x4(%rax), %ecx
jne 0xbd48
movl 0x28(%rsp), %ecx
cmpl 0x8(%rax), %ecx
jne 0xbd48
cmpq $0x0, 0x30(%rbx)
je 0xbd48
movq 0x20(%rbx), %rdi
movq (%rdi), %rax
callq *0x48(%rax)
testb %al, %al
jne 0xbd5d
movq 0x18(%rbx), %rdi
movq 0x20(%rbx), %rsi
callq 0x9e3c
movq %rbx, %rdi
callq 0xb90c
movq 0x70(%rsp), %rdi
cmpq %r13, %rdi
je 0xbd77
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x5070
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0xbd8e
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x5070
movq 0x30(%rsp), %rdi
cmpq %r15, %rdi
je 0xbda5
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x5070
addq $0x90, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0xbdd8
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x5070
jmp 0xbdd8
jmp 0xbdd5
jmp 0xbdd5
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x9acc
movq %rbx, %rdi
callq 0x5200
// File: /workspace/github_cpp_makefile_star2_O3/Themaister[P]umusd/player.cpp
// Function: Player::unpause()
void Player::unpause()
{
   auto info = media_info();
   if (!dev->active())
   {
      dev->init(info.channels, info.rate, info.fmt, dev->default_device());
      event->add(dev);
   }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xa0, %rsp
movq %rdi, %rbx
movq (%rdi), %rax
leaq 0x30(%rsp), %rdi
movq %rbx, %rsi
callq *0x48(%rax)
movq 0x20(%rbx), %rdi
movq (%rdi), %rax
callq *0x48(%rax)
testb %al, %al
jne 0xc06c
movq 0x20(%rbx), %r14
movl 0x30(%rsp), %ebp
movl 0x34(%rsp), %r15d
movl 0x38(%rsp), %r12d
movq (%r14), %rax
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq *0x28(%rax)
movq (%r14), %rax
leaq 0x10(%rsp), %r8
movq %r14, %rdi
movl %ebp, %esi
movl %r15d, %edx
movl %r12d, %ecx
callq *0x30(%rax)
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbfff
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5070
movq 0x18(%rbx), %rdi
movq 0x20(%rbx), %rax
movq %rax, (%rsp)
movq 0x28(%rbx), %rax
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0xc02e
movq 0x9f70(%rip), %rcx      # 0x15f90
cmpb $0x0, (%rcx)
je 0xc02a
incl 0xc(%rax)
jmp 0xc02e
lock
incl 0xc(%rax)
movq %rsp, %rsi
callq 0x9c16
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xc06c
movq 0x9f49(%rip), %rax      # 0x15f90
cmpb $0x0, (%rax)
je 0xc057
movl 0xc(%rdi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0xc(%rdi)
jmp 0xc061
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
lock
xaddl %eax, 0xc(%rdi)
cmpl $0x1, %eax
jne 0xc06c
movq (%rdi), %rax
callq *0x18(%rax)
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xc08d
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x5070
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xc0a8
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x5070
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xc0c3
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x5070
addq $0xa0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xc11a
leaq 0x10(%rsp), %r14
movq %rbx, %rsi
movq %r14, %rcx
callq 0x57d8
movq (%r14), %rbx
jmp 0xc11a
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xc11a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5070
jmp 0xc11a
jmp 0xc117
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x9acc
movq %rbx, %rdi
callq 0x5200