LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/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 0x8c93
movq %rsi, %rbx
testq %rsi, %rsi
je 0x8c89
addq $0x7, %rbx
andq $-0x8, %rbx
movq (%rax), %rcx
movq 0x8(%rcx), %rax
leaq (%rax,%rbx), %rdx
cmpq (%rcx), %rdx
ja 0x8c60
addq %rcx, %rax
addq $0x18, %rax
movq %rdx, 0x8(%rcx)
jmp 0x8c8b
movq %rdi, %r14
movq (%rdi), %rsi
cmpq %rbx, %rsi
cmovbeq %rbx, %rsi
callq 0x8cb2
testb %al, %al
je 0x8c89
movq 0x10(%r14), %rax
movq (%rax), %rcx
movq 0x8(%rcx), %rax
addq %rax, %rbx
movq %rbx, %rdx
jmp 0x8c53
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x3501(%rip), %rdi      # 0xc19b
leaq 0x345b(%rip), %rsi      # 0xc0fc
leaq 0x4449(%rip), %rcx      # 0xd0f1
movl $0x141, %edx            # imm = 0x141
callq 0x31c0
// File: /workspace/github_cpp_makefile_star2_O2/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
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
jne 0x8cdc
pushq $0x1
popq %rdi
callq 0x3280
movq %rax, %rdi
movq %rax, 0x8(%rbx)
movq 0x10(%rbx), %rax
movq %rdi, 0x8(%rax)
leaq 0x18(%r14), %rsi
callq 0x7360
testq %rax, %rax
je 0x8d00
movq %r14, (%rax)
andq $0x0, 0x8(%rax)
movq 0x10(%rbx), %rcx
movq (%rcx), %rdx
movq %rdx, 0x10(%rax)
movq %rax, (%rcx)
testq %rax, %rax
setne %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x8e82
movq %rsi, %r15
movl %ebx, %r12d
movq %rcx, %rdi
movq %r12, %rsi
callq 0x8e97
andq 0x8(%r14), %r13
orq %rax, %r13
movq %r13, 0x8(%r14)
shlq $0x5, %r12
movq %rax, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x3210
jmp 0x8e86
andq %r13, 0x8(%r14)
movl %ebx, 0x4(%r14)
movl %ebx, (%r14)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/NovaGL[P]HarmonyHubControl/./rapidjson/allocators.h
// Function: rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>::Realloc(void*, unsigned long, unsigned long)
void* Realloc(void* originalPtr, size_t originalSize, size_t newSize) {
        if (originalPtr == 0)
            return Malloc(newSize);

        RAPIDJSON_NOEXCEPT_ASSERT(shared_->refcount > 0);
        if (newSize == 0)
            return NULL;

        originalSize = RAPIDJSON_ALIGN(originalSize);
        newSize = RAPIDJSON_ALIGN(newSize);

        // Do not shrink if new size is smaller than original
        if (originalSize >= newSize)
            return originalPtr;

        // Simply expand it if it is the last allocation and there is sufficient space
        if (originalPtr == GetChunkBuffer(shared_) + shared_->chunkHead->size - originalSize) {
            size_t increment = static_cast<size_t>(newSize - originalSize);
            if (shared_->chunkHead->size + increment <= shared_->chunkHead->capacity) {
                shared_->chunkHead->size += increment;
                return originalPtr;
            }
        }

        // Realloc process: allocate and copy memory, do not free original buffer.
        if (void* newBuffer = Malloc(newSize)) {
            if (originalSize)
                std::memcpy(newBuffer, originalPtr, originalSize);
            return newBuffer;
        }
        else
            return NULL;
    }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0x8f5d
movq 0x10(%rdi), %rax
cmpq $0x0, 0x10(%rax)
je 0x8f84
testq %rcx, %rcx
je 0x8f6c
movq %rdx, %r14
movq %rsi, %rbx
addq $0x7, %r14
andq $-0x8, %r14
addq $0x7, %rcx
andq $-0x8, %rcx
movq %rcx, %rsi
subq %r14, %rsi
jbe 0x8f6e
movq (%rax), %rax
movq 0x8(%rax), %rdx
leaq (%rax,%rdx), %r8
subq %r14, %r8
addq $0x18, %r8
cmpq %rbx, %r8
jne 0x8f36
addq %rsi, %rdx
cmpq (%rax), %rdx
jbe 0x8f7e
movq %rcx, %rsi
callq 0x8c24
testq %rax, %rax
je 0x8f6c
testq %r14, %r14
je 0x8f79
movq %rax, %rdi
movq %rbx, %rsi
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3210
movq %rcx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x8c24
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
jmp 0x8f6e
movq %rdx, 0x8(%rax)
jmp 0x8f6e
leaq 0x3210(%rip), %rdi      # 0xc19b
leaq 0x316a(%rip), %rsi      # 0xc0fc
leaq 0x461c(%rip), %rcx      # 0xd5b5
movl $0x154, %edx            # imm = 0x154
callq 0x31c0
nop
// File: /workspace/github_cpp_makefile_star2_O2/NovaGL[P]HarmonyHubControl/./rapidjson/document.h
// Function: rapidjson::GenericMemberIterator<false, rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>> rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>>::DoFindMember<rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>>(rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>> const&)
MemberIterator DoFindMember(const GenericValue<Encoding, SourceAllocator>& name) {
        MemberIterator member = MemberBegin();
        for ( ; member != MemberEnd(); ++member)
            if (name.StringEqual(member->name))
                break;
        return member;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
callq 0x99f0
movq %rsp, %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x6c44
movq (%r14), %rsi
cmpq (%rsp), %rsi
je 0x99e1
movq %rbx, %rdi
callq 0x9a2c
testb %al, %al
jne 0x99e1
addq $0x20, (%r14)
jmp 0x99bb
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/NovaGL[P]HarmonyHubControl/csocket.cpp
// Function: csocket::resolveHost(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, hostent**)
int csocket::resolveHost(const std::string& szRemoteHostName, struct hostent** pHostEnt)
{
    if (szRemoteHostName.length() == 0) 
    {
        return FAILURE;
    }

    if ( ! s_bSocketsInitialized )
    {
#ifdef _WIN32
        WORD wVersionRequested;  
        WSADATA wsaData; 
        int err; 

        wVersionRequested = MAKEWORD(2, 0); 
        err = WSAStartup(wVersionRequested, &wsaData); 
#endif
    }

    *pHostEnt = gethostbyname( szRemoteHostName.c_str() );

    if (*pHostEnt == NULL) 
    {
        unsigned long uhostname = inet_addr ( szRemoteHostName.c_str() );
        *pHostEnt = gethostbyaddr( reinterpret_cast<char *>(&uhostname), 
            sizeof(unsigned long),
            AF_INET);

        if (*pHostEnt == NULL)
        {
            return FAILURE;
        }
    }

    return SUCCESS;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
pushq $0x1
popq %rbx
cmpq $0x0, 0x8(%rdi)
je 0xa292
movq %rsi, %r14
movq %rdi, %r15
movq (%rdi), %rdi
callq 0x3300
movq %rax, (%r14)
testq %rax, %rax
jne 0xa290
movq (%r15), %rdi
callq 0x3290
movl %eax, %eax
leaq 0x8(%rsp), %rdi
movq %rax, (%rdi)
pushq $0x8
popq %rsi
pushq $0x2
popq %rdx
callq 0x3370
movq %rax, (%r14)
testq %rax, %rax
je 0xa292
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
cmpl $0x1, 0x2c(%rdi)
jne 0xa445
movq %rsi, %rbx
movq %rdi, %r14
xorl %eax, %eax
cmpq $0x10, %rax
je 0xa44c
andq $0x0, 0x10(%rsp,%rax,8)
incq %rax
jmp 0xa434
pushq $-0x1
jmp 0xa4d0
movl 0x8(%r14), %ecx
pushq $0x40
popq %rsi
movl %ecx, %eax
cltd
idivl %esi
movslq %eax, %rdx
shll $0x6, %eax
subl %eax, %ecx
pushq $0x1
popq %rax
shlq %cl, %rax
orq %rax, 0x10(%rsp,%rdx,8)
xorps %xmm1, %xmm1
ucomiss %xmm0, %xmm1
jae 0xa495
cvttss2si %xmm0, %eax
cvttps2dq %xmm0, %xmm1
cvtdq2ps %xmm1, %xmm1
subss %xmm1, %xmm0
mulss 0x483e(%rip), %xmm0     # 0xecc8
cltq
cvttss2si %xmm0, %ecx
movslq %ecx, %rcx
jmp 0xa499
xorl %eax, %eax
xorl %ecx, %ecx
movq %rsp, %r8
movq %rax, (%r8)
movq %rcx, 0x8(%r8)
xorl %r15d, %r15d
leaq 0x10(%rsp), %rsi
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3260
testl %eax, %eax
js 0xa4c6
je 0xa4e2
cmpl $0x1, %eax
jne 0xa4d2
movb $0x1, (%rbx)
jmp 0xa4d2
movl $0x2, 0x2c(%r14)
pushq $0x1
popq %r15
movl %r15d, %eax
addq $0x90, %rsp
popq %rbx
popq %r14
popq %r15
retq
movb $0x0, (%rbx)
jmp 0xa4d2
nop
// File: /workspace/github_cpp_makefile_star2_O2/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
cmpl $0x1, 0x2c(%rdi)
jne 0xa569
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 0x33c0
movq %rax, %r12
testl %r12d, %r12d
jns 0xa530
testb %bpl, %bpl
je 0xa56d
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x33a0
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 0xa55d
testl %r13d, %r13d
jle 0xa55d
addq %rax, %r14
testb %bpl, %bpl
jne 0xa50a
movl 0x4(%rsp), %eax
subl %r13d, %eax
movl %eax, %r12d
jmp 0xa56d
pushq $-0x1
popq %r12
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_O2/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:
cmpl $0x1, 0x2c(%rdi)
jne 0xa5b9
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
movl %edx, %ebp
testl %ebp, %ebp
jle 0xa5bd
movl 0x8(%r14), %edi
movl %ebp, %edx
movq %r15, %rsi
callq 0x3140
testl %eax, %eax
js 0xa5c3
subl %eax, %ebp
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
addq %rax, %r15
jmp 0xa597
pushq $-0x1
popq %rax
retq
subl %ebp, %ebx
movl %ebx, %eax
jmp 0xa5cb
movl $0x2, 0x2c(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Themaister[P]umusd/alsa.cpp
// Function: ALSA::stop()
void ALSA::stop()
{
   if (pcm)
   {
      snd_pcm_drop(pcm);
      snd_pcm_close(pcm);
   }

   pcm = nullptr;
   fds.clear();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x30(%rdi), %rdi
testq %rdi, %rdi
je 0x4909
callq 0x4040
movq 0x30(%rbx), %rdi
callq 0x4380
andq $0x0, 0x30(%rbx)
movq 0x38(%rbx), %rax
cmpq %rax, 0x40(%rbx)
je 0x491c
movq %rax, 0x40(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq (%rsi), %r14
movq 0x8(%rsi), %rsi
movq 0x30(%rdi), %rdi
subq %r14, %rsi
callq 0x4140
movq %rax, %r15
pushq $0x1
popq %rbp
testq %r15, %r15
je 0x4ce6
movq 0x30(%rbx), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x4060
movq %rax, %r12
cmpq $-0x56, %rax
je 0x4cb9
cmpq $-0x4, %r12
je 0x4cb9
cmpq $-0x20, %r12
jne 0x4ccd
movq 0x30(%rbx), %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x43c0
testl %eax, %eax
jns 0x4cd2
jmp 0x4cef
testq %r12, %r12
js 0x4d0b
movq 0x30(%rbx), %rdi
movq %r12, %rsi
callq 0x4330
addq %rax, %r14
subq %r12, %r15
jmp 0x4c90
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x4430
movq %rax, %rbx
leaq 0x840a(%rip), %rsi      # 0xd10b
movq %rax, %rdi
callq 0x40d0
jmp 0x4d25
pushq $0x10
popq %rdi
callq 0x4430
movq %rax, %rbx
leaq 0x8407(%rip), %rsi      # 0xd124
movq %rax, %rdi
callq 0x40d0
movq 0x10274(%rip), %rsi     # 0x14fa0
movq 0x102ad(%rip), %rdx     # 0x14fe0
movq %rbx, %rdi
callq 0x41c0
jmp 0x4d3d
movq %rax, %r14
movq %rbx, %rdi
callq 0x45c0
movq %r14, %rdi
callq 0x4200
// File: /workspace/github_cpp_makefile_star2_O2/Themaister[P]umusd/alsa.cpp
// Function: ALSA::pollfds[abi:cxx11]() const
EventHandled::PollList ALSA::pollfds() const
{
   EventHandled::PollList list;
   for (auto fd : fds)
   {
      list.push_back({fd.fd,
            (fd.events & POLLIN ? EPOLLIN : 0) |
            (fd.events & POLLOUT ? EPOLLOUT : 0)});
   }

   return list;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rdi, 0x8(%rdi)
movq %rdi, (%rdi)
andq $0x0, 0x10(%rdi)
movq 0x38(%rsi), %r15
movq 0x40(%rsi), %r12
movq %rsp, %r14
cmpq %r12, %r15
je 0x4d9a
movl (%r15), %eax
movzwl 0x4(%r15), %ecx
movl %eax, (%rsp)
andl $0x5, %ecx
movl %ecx, 0x4(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4f38
addq $0x8, %r15
jmp 0x4d72
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x4f7e
movq %r14, %rdi
callq 0x4200
// File: /workspace/github_cpp_makefile_star2_O2/Themaister[P]umusd/alsa.cpp
// Function: ALSA::handle(EventHandler&)
void ALSA::handle(EventHandler &handler)
{
   if (!pcm)
      return;

   for (auto &fd : fds)
      fd.revents = 0;

   if (poll(fds.data(), fds.size(), 0) < 0)
      throw std::runtime_error("ALSA poll failed.");

   unsigned short revents;
   if (snd_pcm_poll_descriptors_revents(pcm, fds.data(),
            fds.size(), &revents) < 0)
      throw std::runtime_error("ALSA revents failed.\n");

   if (!(revents & POLLOUT))
      return;

   Audio::handle(handler);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpq $0x0, 0x30(%rdi)
je 0x4e2d
movq %rsi, %rbx
movq %rdi, %r14
movq 0x38(%rdi), %rdi
movq 0x40(%r14), %rsi
movq %rdi, %rax
cmpq %rsi, %rax
je 0x4de8
andw $0x0, 0x6(%rax)
addq $0x8, %rax
jmp 0x4dd8
subq %rdi, %rsi
sarq $0x3, %rsi
xorl %edx, %edx
callq 0x4400
testl %eax, %eax
js 0x4e35
movq 0x30(%r14), %rdi
movq 0x38(%r14), %rsi
movq 0x40(%r14), %rdx
subq %rsi, %rdx
shrq $0x3, %rdx
leaq 0x6(%rsp), %rcx
callq 0x4640
testl %eax, %eax
js 0x4e51
testb $0x4, 0x6(%rsp)
je 0x4e2d
movq %r14, %rdi
movq %rbx, %rsi
callq 0x52f8
addq $0x8, %rsp
popq %rbx
popq %r14
retq
pushq $0x10
popq %rdi
callq 0x4430
movq %rax, %rbx
leaq 0x82f4(%rip), %rsi      # 0xd13b
movq %rax, %rdi
callq 0x40d0
jmp 0x4e6b
pushq $0x10
popq %rdi
callq 0x4430
movq %rax, %rbx
leaq 0x82ea(%rip), %rsi      # 0xd14d
movq %rax, %rdi
callq 0x40d0
movq 0x1012e(%rip), %rsi     # 0x14fa0
movq 0x10167(%rip), %rdx     # 0x14fe0
movq %rbx, %rdi
callq 0x41c0
jmp 0x4e83
movq %rax, %r14
movq %rbx, %rdi
callq 0x45c0
movq %r14, %rdi
callq 0x4200
// File: /workspace/github_cpp_makefile_star2_O2/Themaister[P]umusd/audio.cpp
// Function: Audio::handle(EventHandler&)
void Audio::handle(EventHandler &handler)
{
   if (auto tmp = ff.lock())
   {
      auto buf = tmp->decode();
      if (buf.empty())
      {
         try
         {
            remote->next();
         }
         catch(...)
         {}
      }
      else
         write(buf);
   }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x18(%rdi), %rsi
leaq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x54c0
movq (%r14), %rdi
testq %rdi, %rdi
je 0x5356
callq 0x8c62
movq %rsp, %rdi
movq %rax, %rsi
callq 0x539a
movq (%rsp), %rax
cmpq 0x8(%rsp), %rax
je 0x5344
movq (%rbx), %rax
movq %rsp, %rsi
movq %rbx, %rdi
callq *0x38(%rax)
jmp 0x534e
movq 0x28(%rbx), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movq %rsp, %rdi
callq 0x5534
leaq 0x20(%rsp), %rdi
callq 0x5444
addq $0x28, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rdi
callq 0x4050
callq 0x4570
jmp 0x534e
movq %rax, %rbx
movq %rsp, %rdi
callq 0x5534
jmp 0x5387
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x5444
movq %rbx, %rdi
callq 0x4200
nop
// File: /workspace/github_cpp_makefile_star2_O2/Themaister[P]umusd/command.cpp
// Function: Command::parse_command(EventHandler&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
std::string Command::parse_command(EventHandler &event, const std::string &cmd)
{
   auto split = cmd.find(' ');
   auto first_arg = cmd.find('\"', split);
   auto last_arg = cmd.rfind('\"');

   auto name = cmd.substr(0, split);

   std::string arg;
   if (last_arg > first_arg)
      arg = cmd.substr(first_arg + 1, last_arg - first_arg - 1);

   auto &cb = command_map[name];
   if (cb)
      return cb(event, string_split(arg, "\n"));
   else
      throw std::runtime_error(stringify("Unrecognized command: \"", name, "\""));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rcx, %r12
movq %rdx, 0x28(%rsp)
movq %rsi, %r15
movq %rdi, %rbx
pushq $0x20
popq %rsi
movq %rcx, %rdi
xorl %edx, %edx
callq 0x4670
movq %rax, %r14
pushq $0x22
popq %rbp
movq %r12, %rdi
movl %ebp, %esi
movq %rax, %rdx
callq 0x4670
movq %rax, %r13
pushq $-0x1
popq %rdx
movq %r12, %rdi
movl %ebp, %esi
callq 0x4460
movq %rax, %rbp
leaq 0x68(%rsp), %rdi
movq %r12, %rsi
xorl %edx, %edx
movq %r14, %rcx
callq 0x4630
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
cmpq %r13, %rbp
jbe 0x5e08
leaq 0x1(%r13), %rdx
notq %r13
addq %r13, %rbp
leaq 0x8(%rsp), %rdi
movq %r12, %rsi
movq %rbp, %rcx
callq 0x4630
leaq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %r14
movq %r14, %rsi
callq 0x44a0
movq %r14, %rdi
callq 0x4540
addq $0x20, %r15
leaq 0x68(%rsp), %rsi
movq %r15, %rdi
callq 0x6dd0
movq %rax, %r15
cmpq $0x0, 0x10(%rax)
je 0x5e9f
leaq 0x7b1e(%rip), %rsi      # 0xd948
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x4eca
leaq 0x30(%rsp), %rdi
leaq 0x48(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x6e4e
leaq 0x30(%rsp), %rcx
movq %rbx, %rdi
movq %r15, %rsi
movq 0x28(%rsp), %rdx
callq 0x6e36
leaq 0x30(%rsp), %rdi
callq 0x6f16
leaq 0x8(%rsp), %rdi
callq 0x4540
leaq 0x48(%rsp), %rdi
callq 0x4540
leaq 0x68(%rsp), %rdi
callq 0x4540
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x4430
movq %rax, %r14
leaq 0x734d(%rip), %rsi      # 0xd1fe
leaq 0x735c(%rip), %rcx      # 0xd214
leaq 0x8(%rsp), %rdi
leaq 0x68(%rsp), %rdx
callq 0x6f37
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x40e0
xorl %ebp, %ebp
movq 0xf0c0(%rip), %rsi      # 0x14fa0
movq 0xf0f9(%rip), %rdx      # 0x14fe0
movq %r14, %rdi
callq 0x41c0
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4540
testb %bpl, %bpl
jne 0x5f06
jmp 0x5f35
movq %rax, %rbx
movq %r14, %rdi
callq 0x45c0
jmp 0x5f35
jmp 0x5f32
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x6f16
jmp 0x5f24
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4540
jmp 0x5f35
jmp 0x5f32
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x4540
leaq 0x68(%rsp), %rdi
callq 0x4540
movq %rbx, %rdi
callq 0x4200
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x4610
testq %rax, %rax
jle 0x6056
addq 0x40(%rbx), %rax
movq %rax, 0x40(%rbx)
jmp 0x6070
movq %r14, %rdi
movq %rbx, %rsi
callq 0x8122
leaq 0x48(%rbx), %rdi
xorl %esi, %esi
callq 0x70ca
movq 0x40(%rbx), %rax
cmpq 0x28(%rbx), %rax
jae 0x607e
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %r14, %rdi
movq %rbx, %rsi
callq 0x8122
addq $0x48, %rbx
pushq $0x1
popq %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x70ca
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x50, %rsp
movq %rdx, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
leaq 0x10(%rsp), %rdi
callq 0x4180
movq 0x10(%rsp), %rdi
movq (%r14), %rsi
leaq 0x8(%rsp), %r15
movq %r15, %rdx
callq 0x4110
leaq 0x30(%rsp), %r12
leaq 0x7(%rsp), %r13
testq %rax, %rax
je 0x6eca
movq %r12, %rdi
movq %rax, %rsi
movq %r13, %rdx
callq 0x4eca
movq %rbx, %rdi
movq %r12, %rsi
callq 0x717e
movq %r12, %rdi
callq 0x4540
movq (%r14), %rsi
xorl %edi, %edi
movq %r15, %rdx
callq 0x4110
jmp 0x6e95
leaq 0x10(%rsp), %rdi
callq 0x4540
movq %rbx, %rax
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %r14
jmp 0x6f06
movq %rax, %r14
jmp 0x6efc
movq %rax, %r14
leaq 0x30(%rsp), %rdi
callq 0x4540
leaq 0x10(%rsp), %rdi
callq 0x4540
movq %rbx, %rdi
callq 0x6f16
movq %r14, %rdi
callq 0x4200
// File: /workspace/github_cpp_makefile_star2_O2/Themaister[P]umusd/./utils.hpp
// Function: string_join(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<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::string string_join(const std::vector<std::string> &list, const std::string &delim)
{
   std::string res;
   for (auto &str : list)
   {
      res += str;
      res += delim;
   }

   return res;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
movq (%rsi), %r15
movq 0x8(%rsi), %r12
cmpq %r12, %r15
je 0x79eb
movq %rbx, %rdi
movq %r15, %rsi
callq 0x45f0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x45f0
addq $0x20, %r15
jmp 0x79ca
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x4540
movq %r14, %rdi
callq 0x4200
nop
// File: /workspace/github_cpp_makefile_star2_O2/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, %rdi
callq 0x7b2a
leaq 0x57de(%rip), %rsi      # 0xd289
leaq 0x7(%rsp), %rdx
movq %rbx, %rdi
callq 0x4eca
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
jmp 0x7ac5
movq %rax, %r14
cmpl $0x1, %edx
jne 0x7b1a
movq %r14, %rdi
callq 0x4050
movq (%rax), %rcx
movq %rax, %rdi
callq *0x10(%rcx)
movq 0xd4c3(%rip), %rdi      # 0x14fa8
movq %rax, %rsi
callq 0x44c0
movq %rax, %rdi
callq 0x42d0
leaq 0x5790(%rip), %rsi      # 0xd28c
leaq 0x6(%rsp), %rdx
movq %rbx, %rdi
callq 0x4eca
callq 0x4570
jmp 0x7ab8
jmp 0x7b12
movq %rax, %r14
callq 0x4570
movq %r14, %rdi
callq 0x4200
movq %rax, %rdi
callq 0x4e96
// File: /workspace/github_cpp_makefile_star2_O2/Themaister[P]umusd/eventhandler.cpp
// Function: EventHandler::add(std::weak_ptr<EventHandled>)
void EventHandler::add(std::weak_ptr<EventHandled> handler)
{
   auto fd_ptr = handler.lock();

   for (auto fd : fd_ptr->pollfds())
   {
      struct epoll_event event{};
      event.events = fd.events;
      event.data.fd = fd.fd;

      cb_map[event.data.fd] = [this, handler]() {
         if (auto tmp = handler.lock())
            tmp->handle(*this);
      };

      if (epoll_ctl(epfd, EPOLL_CTL_ADD, event.data.fd, &event) < 0)
         throw std::runtime_error("Failed to add epoll fd to list.\n");
   }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdi, %r14
leaq 0x58(%rsp), %r15
movq %r15, %rdi
movq %rsi, 0x50(%rsp)
callq 0x84d4
movq (%r15), %rsi
movq (%rsi), %rax
leaq 0x68(%rsp), %rbx
movq %rbx, %rdi
callq *(%rax)
leaq 0x38(%rsp), %rbp
leaq 0x8(%r14), %r15
movq %rbx, %r12
movq (%r12), %r12
cmpq %rbx, %r12
je 0x80ac
andl $0x0, 0x8(%rsp)
movq 0x10(%r12), %xmm0
pshufd $0xe1, %xmm0, %xmm0     # xmm0 = xmm0[1,0,2,3]
movq %xmm0, (%rsp)
movq %r14, 0x30(%rsp)
movq %rbp, %rdi
movq 0x50(%rsp), %rsi
callq 0x84a0
movq %r15, %rdi
leaq 0x4(%rsp), %rsi
callq 0x8368
movq %rax, %r13
pxor %xmm0, %xmm0
movdqa %xmm0, 0x20(%rsp)
movdqa %xmm0, 0x10(%rsp)
pushq $0x18
popq %rdi
callq 0x43a0
movaps 0x30(%rsp), %xmm0
movups %xmm0, (%rax)
movq 0x40(%rsp), %rcx
movq %rcx, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%rbp)
movq %rax, 0x10(%rsp)
movaps 0x10(%rsp), %xmm0
movaps %xmm0, 0x80(%rsp)
movups (%r13), %xmm1
movaps %xmm1, 0x10(%rsp)
movups %xmm0, (%r13)
movq 0x10(%r13), %rax
movq %rax, 0x20(%rsp)
leaq 0x2b4(%rip), %rax       # 0x82ea
movq %rax, 0x10(%r13)
movq 0x18(%r13), %rax
movq %rax, 0x28(%rsp)
leaq 0x24a(%rip), %rax       # 0x8294
movq %rax, 0x18(%r13)
leaq 0x10(%rsp), %rdi
callq 0x7162
leaq 0x40(%rsp), %rdi
callq 0x4f44
movl (%r14), %edi
movl 0x4(%rsp), %edx
pushq $0x1
popq %rsi
movq %rsp, %rcx
callq 0x4080
testl %eax, %eax
jns 0x7f90
pushq $0x10
popq %rdi
callq 0x4430
movq %rax, %r14
leaq 0x54d1(%rip), %rsi      # 0xd55f
movq %rax, %rdi
callq 0x40d0
movq 0xcf03(%rip), %rsi      # 0x14fa0
movq 0xcf3c(%rip), %rdx      # 0x14fe0
movq %r14, %rdi
callq 0x41c0
leaq 0x68(%rsp), %rdi
callq 0x4f7e
leaq 0x60(%rsp), %rdi
callq 0x5444
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x810f
movq %rax, %rbx
jmp 0x8105
movq %rax, %rbx
movq %r14, %rdi
callq 0x45c0
jmp 0x8105
movq %rax, %rbx
jmp 0x80fb
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x7162
leaq 0x40(%rsp), %rdi
callq 0x4f44
leaq 0x68(%rsp), %rdi
callq 0x4f7e
leaq 0x60(%rsp), %rdi
callq 0x5444
movq %rbx, %rdi
callq 0x4200
nop
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq $0x10
popq %rdx
pushq $-0x1
popq %rcx
callq 0x4190
testl %eax, %eax
js 0x8244
leaq 0x8(%rbx), %r14
movl %eax, %r13d
leaq 0x24(%rsp), %r15
movq %rsp, %r12
subq $0x1, %r13
jb 0x822e
movq %r14, %rdi
movq %r15, %rsi
callq 0x8368
movq %r12, %rdi
movq %rax, %rsi
callq 0x83e6
cmpq $0x0, 0x10(%rsp)
je 0x8220
movq %r12, %rdi
callq 0x842c
movq %r12, %rdi
callq 0x7162
addq $0xc, %r15
jmp 0x81f4
movb 0x4(%rbx), %al
xorb $0x1, %al
addq $0xe0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
pushq $0x10
popq %rdi
callq 0x4430
movq %rax, %rbx
leaq 0x532a(%rip), %rsi      # 0xd580
movq %rax, %rdi
callq 0x40d0
movq 0xcd3b(%rip), %rsi      # 0x14fa0
movq 0xcd74(%rip), %rdx      # 0x14fe0
movq %rbx, %rdi
callq 0x41c0
movq %rax, %r14
movq %rbx, %rdi
callq 0x45c0
jmp 0x828c
movq %rax, %r14
movq %rsp, %rdi
callq 0x7162
movq %r14, %rdi
callq 0x4200
// File: /workspace/github_cpp_makefile_star2_O2/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 %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0x10(%rdi)
leaq 0x18(%rdi), %r14
movq %r14, %rdi
callq 0x8ef6
xorps %xmm0, %xmm0
movups %xmm0, 0x91(%rbx)
movups %xmm0, 0x88(%rbx)
callq 0x4210
leaq 0x28(%rbx), %rdi
movq %r15, %rsi
callq 0x4320
movq (%r15), %rsi
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x4470
testl %eax, %eax
js 0x880c
movq (%rbx), %rdi
xorl %esi, %esi
callq 0x44f0
testl %eax, %eax
js 0x8828
movq %rbx, %rdi
callq 0x88c8
movq %rbx, %rdi
callq 0x89cc
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
pushq $0x10
popq %rdi
callq 0x4430
movq %rax, %r15
leaq 0x4d9a(%rip), %rsi      # 0xd5b8
movq %rax, %rdi
callq 0x40d0
jmp 0x8842
pushq $0x10
popq %rdi
callq 0x4430
movq %rax, %r15
leaq 0x4d94(%rip), %rsi      # 0xd5ce
movq %rax, %rdi
callq 0x40d0
movq 0xc757(%rip), %rsi      # 0x14fa0
movq 0xc790(%rip), %rdx      # 0x14fe0
movq %r15, %rdi
callq 0x41c0
jmp 0x885a
movq %rax, %r12
movq %r15, %rdi
callq 0x45c0
jmp 0x886f
movq %rax, %r15
jmp 0x88a0
movq %rax, %r12
movq %r12, %rdi
callq 0x4050
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x8885
callq 0x4600
cmpq $0x0, (%rbx)
je 0x8893
movq %rbx, %rdi
callq 0x4530
callq 0x4590
movq %rax, %r15
callq 0x4570
addq $0x88, %rbx
movq %rbx, %rdi
callq 0x5534
movq %r14, %rdi
callq 0x7dd2
movq %r15, %rdi
callq 0x4200
movq %rax, %rdi
callq 0x4e96
nop
// File: /workspace/github_cpp_makefile_star2_O2/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), %edx
xorl %ecx, %ecx
cmpq %rcx, %rdx
je 0x88f3
movq 0x30(%rax), %rsi
movq (%rsi,%rcx,8), %rsi
movq 0x8(%rsi), %rsi
cmpl $0x1, 0xc(%rsi)
je 0x88f8
incq %rcx
jmp 0x88d7
movl 0x10(%rbx), %ecx
jmp 0x88fb
movl %ecx, 0x10(%rbx)
testl %ecx, %ecx
js 0x8947
movq 0x30(%rax), %rax
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rax
movl 0x18(%rax), %edi
callq 0x4340
testq %rax, %rax
je 0x8963
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 0x4490
testl %eax, %eax
js 0x897f
addq $0x8, %rsp
popq %rbx
popq %r14
retq
pushq $0x10
popq %rdi
callq 0x4430
movq %rax, %rbx
leaq 0x4ca4(%rip), %rsi      # 0xd5fd
movq %rax, %rdi
callq 0x40d0
jmp 0x899e
pushq $0x10
popq %rdi
callq 0x4430
movq %rax, %rbx
leaq 0x4ca8(%rip), %rsi      # 0xd61d
movq %rax, %rdi
callq 0x40d0
jmp 0x899e
andq $0x0, 0x8(%rbx)
pushq $0x10
popq %rdi
callq 0x4430
movq %rax, %rbx
leaq 0x4cad(%rip), %rsi      # 0xd643
movq %rax, %rdi
callq 0x40d0
movq 0xc5fb(%rip), %rsi      # 0x14fa0
movq 0xc634(%rip), %rdx      # 0x14fe0
movq %rbx, %rdi
callq 0x41c0
jmp 0x89b8
jmp 0x89b8
movq %rax, %r14
movq %rbx, %rdi
callq 0x45c0
movq %r14, %rdi
callq 0x4200
nop
// File: /workspace/github_cpp_makefile_star2_O2/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), %esi
callq 0x8b8a
movl %eax, 0x20(%rbx)
movq (%rbx), %rax
movq 0x30(%rax), %rcx
movslq 0x10(%rbx), %rdx
movq (%rcx,%rdx,8), %rcx
cvtsi2sdq 0x28(%rcx), %xmm0
movq 0x18(%rcx), %rcx
cvtsi2sd %ecx, %xmm1
shrq $0x20, %rcx
cvtsi2sd %ecx, %xmm2
divsd %xmm2, %xmm1
mulsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm0
movss %xmm0, 0x24(%rbx)
movq 0x4b0(%rax), %rsi
movq %rbx, %rdi
callq 0x8bc8
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 0x8bc8
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x8a68
callq 0x4600
cmpq $0x0, (%rbx)
je 0x8a76
movq %rbx, %rdi
callq 0x4530
leaq 0x88(%rbx), %rdi
callq 0x5534
addq $0x18, %rbx
movq %rbx, %rdi
popq %rbx
jmp 0x7dd2
movq %rax, %rdi
callq 0x4e96
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x8b1f
callq 0x4600
andq $0x0, 0x8(%rbx)
cmpq $0x0, (%rbx)
je 0x8b32
movq %rbx, %rdi
callq 0x4530
movq (%rbx), %rax
jmp 0x8b34
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)
leaq 0x18(%r14), %rsi
leaq 0x18(%rbx), %rdi
callq 0x8f2a
movl $0x88, %edi
leaq (%r14,%rdi), %rsi
addq %rbx, %rdi
callq 0x909a
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_O2/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 %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x4a11(%rip), %rsi      # 0xd5ea
movq %r14, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x4550
testq %rax, %rax
je 0x8bfc
movq 0x8(%rax), %rsi
testq %rsi, %rsi
je 0x8bfc
leaq 0x28(%rbx), %rdi
callq 0x4030
leaq 0x49ed(%rip), %rsi      # 0xd5f0
movq %r14, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x4550
testq %rax, %rax
je 0x8c26
movq 0x8(%rax), %rsi
testq %rsi, %rsi
je 0x8c26
leaq 0x48(%rbx), %rdi
callq 0x4030
leaq 0x49ca(%rip), %rsi      # 0xd5f7
movq %r14, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x4550
testq %rax, %rax
je 0x8c5a
movq 0x8(%rax), %rsi
testq %rsi, %rsi
je 0x8c5a
addq $0x68, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4030
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/Themaister[P]umusd/ffmpeg.cpp
// Function: FF::seek(float)
bool FF::seek(float pos)
{
   int flags = (pos < last_pos) ? AVSEEK_FLAG_BACKWARD : 0;

   double seek_to = pos / av_q2d(fctx->streams[aud_stream]->time_base);
   if (seek_to < 0.0)
      seek_to = 0.0;

   if (av_seek_frame(fctx, aud_stream, seek_to, flags) < 0)
      return false;

   last_pos = pos;
   avcodec_flush_buffers(actx);
   return true;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movss 0x14(%rdi), %xmm1
xorl %ecx, %ecx
ucomiss %xmm0, %xmm1
seta %cl
movss %xmm0, 0x4(%rsp)
cvtss2sd %xmm0, %xmm0
movq (%rdi), %rdi
movq 0x30(%rdi), %rax
movslq 0x10(%rbx), %rsi
movq (%rax,%rsi,8), %rax
movq 0x18(%rax), %rax
cvtsi2sd %eax, %xmm1
shrq $0x20, %rax
cvtsi2sd %eax, %xmm2
divsd %xmm2, %xmm1
divsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
maxsd %xmm0, %xmm1
cvttsd2si %xmm1, %rdx
callq 0x44e0
movl %eax, %ebp
testl %eax, %eax
js 0x8eea
movss 0x4(%rsp), %xmm0
movss %xmm0, 0x14(%rbx)
movq 0x8(%rbx), %rdi
callq 0x4420
testl %ebp, %ebp
setns %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Themaister[P]umusd/ffmpeg.cpp
// Function: void copy_deplanar<short>(unsigned char*, unsigned char**, int, int)
inline void copy_deplanar(std::uint8_t *out, std::uint8_t **in, int frames, int channels)
{
   T* out_ptr = reinterpret_cast<T*>(out);
   for (int c = 0; c < channels; c++, out_ptr++)
   {
      const T* in_ptr = reinterpret_cast<T*>(in[c]);
      for (int i = 0; i < frames; i++)
         out_ptr[i * channels] = in_ptr[i];
   }
}

// Assembly:
pushq %rbx
movslq %ecx, %rax
xorl %ecx, %ecx
testl %edx, %edx
cmovlel %ecx, %edx
testl %eax, %eax
movl $0x0, %r8d
cmovgl %eax, %r8d
addq %rax, %rax
cmpq %r8, %rcx
je 0x8fe4
movq (%rsi,%rcx,8), %r9
movq %rdi, %r10
xorl %r11d, %r11d
cmpq %r11, %rdx
je 0x8fdb
movzwl (%r9,%r11,2), %ebx
movw %bx, (%r10)
incq %r11
addq %rax, %r10
jmp 0x8fc5
incq %rcx
addq $0x2, %rdi
jmp 0x8fb6
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x95f8
leaq 0x8(%rsp), %rdi
callq 0x9780
leaq 0x8(%rsp), %rdi
callq 0x942e
xorl %eax, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
retq
movq %rdx, %r14
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x942e
jmp 0x93e1
movq %rdx, %r14
movq %rax, %rbx
cmpl $0x1, %r14d
jne 0x941e
movq %rbx, %rdi
callq 0x4050
movq (%rax), %rcx
movq %rax, %rdi
callq *0x10(%rcx)
movq 0xbba9(%rip), %rdi      # 0x14fa8
movq %rax, %rsi
callq 0x44c0
movq %rax, %rdi
callq 0x42d0
callq 0x4570
jmp 0x93bc
movq %rax, %rbx
callq 0x4570
movq %rbx, %rdi
callq 0x4200
movq %rax, %rdi
callq 0x4e96
// File: /workspace/github_cpp_makefile_star2_O2/Themaister[P]umusd/player.cpp
// Function: Player::Player()
Player::Player()
{
   cmd = std::make_shared<TCPCommand>(42878);
   cmd->set_remote(*this);

   event = std::unique_ptr<EventHandler>(new EventHandler);
   dev = std::shared_ptr<Audio>(new ALSA);
   dev->set_remote(*this);

   event->add(cmd);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0xb440(%rip), %rax      # 0x14a50
movq %rax, (%rdi)
leaq 0x18(%rdi), %r14
leaq 0x40(%rdi), %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdi)
movups %xmm0, 0x18(%rdi)
movups %xmm0, 0x28(%rdi)
andq $0x0, 0x38(%rdi)
movq %r15, %rdi
callq 0x9ee0
leaq 0x14(%rsp), %rsi
movl $0xa77e, (%rsi)         # imm = 0xA77E
movq %rsp, %rdi
callq 0x9e0b
leaq 0x8(%rbx), %r12
movq %rsp, %rsi
movq %r12, %rdi
callq 0xa3c0
leaq 0x8(%rsp), %rdi
callq 0x5444
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x10(%rax)
pushq $0x38
popq %rdi
callq 0x43a0
movq %rax, %r13
movq %rax, %rdi
callq 0x7ea0
movq %rsp, %rbp
andq $0x0, (%rbp)
movq %r14, %rdi
movq %r13, %rsi
callq 0xa0e6
movq %rbp, %rdi
callq 0x9472
pushq $0x50
popq %rdi
callq 0x43a0
movq %rax, %r13
movq %rax, %rdi
callq 0x488c
movq %rsp, %rdi
movq %r13, %rsi
callq 0xa3ee
leaq 0x20(%rbx), %rdi
movq %rsp, %rsi
callq 0xa4c2
leaq 0x8(%rsp), %rdi
callq 0x5444
movq 0x20(%rbx), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x10(%rax)
movq (%r14), %r13
leaq 0x18(%rsp), %rbp
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa4f0
movq %r13, %rdi
movq %rbp, %rsi
callq 0x7f4e
leaq 0x20(%rsp), %rdi
callq 0x4f44
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r12
leaq 0x20(%rsp), %rdi
callq 0x4f44
jmp 0x974a
movq %rax, %r12
pushq $0x50
jmp 0x9731
movq %rax, %r12
pushq $0x38
popq %rsi
movq %r13, %rdi
callq 0x4070
jmp 0x974a
jmp 0x9747
jmp 0x9747
movq %rax, %r12
jmp 0x9752
jmp 0x9747
movq %rax, %r12
movq %r15, %rdi
callq 0x948c
leaq 0x38(%rbx), %rdi
callq 0x5444
leaq 0x28(%rbx), %rdi
callq 0x5444
movq %r14, %rdi
callq 0x9472
addq $0x10, %rbx
movq %rbx, %rdi
callq 0x5444
movq %r12, %rdi
callq 0x4200
// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
cmpq $0x0, 0x8(%rsi)
je 0x97b0
leaq 0x40(%rbx), %rdi
callq 0xa6f4
leaq 0x40(%rbx), %rdi
callq 0xa7e8
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x9e29
leaq 0x30(%rbx), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xa69c
leaq 0x18(%rsp), %rdi
callq 0x5444
movq 0x20(%rbx), %rbx
movq %rsp, %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0xa6ca
movq %rbx, %rdi
movq %r14, %rsi
callq 0x52e8
leaq 0x8(%rsp), %rdi
callq 0x4f44
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4f44
movq %rbx, %rdi
callq 0x4200