LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: ixchow[P]http-tweak/tweak.cpp
// Function: tweak::tweak::~tweak()
tweak::~tweak() {
	auto &internal = get_internal();

	std::unique_lock< std::mutex > lock(internal.mutex);

	auto f = internal.tweaks.find(this);
	assert(f != internal.tweaks.end());
	internal.tweaks.erase(f);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
callq 0x6a00
movq %rax, -0x50(%rbp)
jmp 0x6aaf
movq -0x50(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rsi
addq $0x20, %rsi
leaq -0x20(%rbp), %rdi
callq 0xa7d0
jmp 0x6aca
movq -0x58(%rbp), %rax
movq -0x10(%rbp), %rdi
addq $0x48, %rdi
movq %rax, -0x30(%rbp)
leaq -0x30(%rbp), %rsi
callq 0xa890
movq %rax, -0x60(%rbp)
jmp 0x6ae9
movq -0x60(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
addq $0x48, %rdi
callq 0xa8f0
movq %rax, -0x38(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0xa8c0
testb $0x1, %al
jne 0x6b15
jmp 0x6b17
jmp 0x6b36
leaq 0x11693(%rip), %rdi     # 0x181b1
leaq 0x116a7(%rip), %rsi     # 0x181cc
movl $0x46, %edx
leaq 0x116a5(%rip), %rcx     # 0x181d6
callq 0x4330
movq -0x10(%rbp), %rdi
addq $0x48, %rdi
movq -0x28(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rsi
callq 0xa920
movq %rax, -0x68(%rbp)
jmp 0x6b55
movq -0x68(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq -0x20(%rbp), %rdi
callq 0xa850
movq -0x58(%rbp), %rdi
addq $0x60, %rdi
callq 0x55c0
movq -0x58(%rbp), %rdi
addq $0x40, %rdi
callq 0x55e0
movq -0x58(%rbp), %rdi
addq $0x20, %rdi
callq 0x42f0
movq -0x58(%rbp), %rdi
callq 0x42f0
addq $0x70, %rsp
popq %rbp
retq
movq %rax, %rdi
callq 0x5490
nopw %cs:(%rax,%rax)
// File: ixchow[P]http-tweak/tweak.cpp
// Function: tweak::config(unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void config(uint16_t port, std::string const &ui_file) {
	auto &internal = get_internal();
	std::unique_lock< std::mutex > lock(internal.mutex);
	internal.port = port;
	internal.ui_file = ui_file;
	if (internal.server) internal.server.reset(); //kill off server so it will be started with new port.
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movw %di, %ax
movw %ax, -0x2(%rbp)
movq %rsi, -0x10(%rbp)
callq 0x6a00
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rsi
addq $0x20, %rsi
leaq -0x28(%rbp), %rdi
callq 0xa7d0
movw -0x2(%rbp), %cx
movq -0x18(%rbp), %rax
movw %cx, 0x80(%rax)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdi
callq 0x4070
jmp 0x6bfb
movq -0x18(%rbp), %rdi
addq $0x88, %rdi
callq 0xa960
testb $0x1, %al
jne 0x6c11
jmp 0x6c3e
movq -0x18(%rbp), %rdi
addq $0x88, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xa990
jmp 0x6c3e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xa850
jmp 0x6c4d
leaq -0x28(%rbp), %rdi
callq 0xa850
addq $0x40, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x4710
nopw %cs:(%rax,%rax)
// File: ixchow[P]http-tweak/tweak.cpp
// Function: utf8_to_json(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
static std::string utf8_to_json(std::string const &data) {
	std::string ret;
	auto it = std::back_inserter(ret);

	*it = '"'; ++it;
	for (auto c = data.begin(); c != data.end(); ++c) {
		if (*c == '\\' || *c == '"') {
			*it = '\\'; ++it; *it = *c; ++it;
		} else {
			*it = *c; ++it;
		}
	}
	*it = '"'; ++it;
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x58(%rbp)
movq %rdi, %rax
movq %rax, -0x60(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x0, -0x11(%rbp)
callq 0x45f0
movq -0x58(%rbp), %rdi
callq 0x137a0
movq %rax, -0x50(%rbp)
jmp 0x77a6
movq -0x50(%rbp), %rax
movq %rax, -0x20(%rbp)
movb $0x22, -0x2d(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x137d0
movq %rax, -0x68(%rbp)
jmp 0x77c1
movq -0x68(%rbp), %rdi
leaq -0x2d(%rbp), %rsi
callq 0x137e0
jmp 0x77d0
leaq -0x20(%rbp), %rdi
callq 0x13820
jmp 0x77db
movq -0x10(%rbp), %rdi
callq 0x4450
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4770
movq %rax, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x13830
testb $0x1, %al
jne 0x780b
jmp 0x7900
leaq -0x38(%rbp), %rdi
callq 0x13870
movsbl (%rax), %eax
cmpl $0x5c, %eax
je 0x782d
leaq -0x38(%rbp), %rdi
callq 0x13870
movsbl (%rax), %eax
cmpl $0x22, %eax
jne 0x78ac
movb $0x5c, -0x41(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x137d0
movq %rax, -0x70(%rbp)
jmp 0x7840
movq -0x70(%rbp), %rdi
leaq -0x41(%rbp), %rsi
callq 0x137e0
jmp 0x784f
leaq -0x20(%rbp), %rdi
callq 0x13820
jmp 0x785a
leaq -0x38(%rbp), %rdi
callq 0x13870
movq %rax, -0x80(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x137d0
movq %rax, -0x78(%rbp)
jmp 0x7876
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdi
callq 0x13890
jmp 0x7885
leaq -0x20(%rbp), %rdi
callq 0x13820
jmp 0x7890
jmp 0x78f0
movq -0x58(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
callq 0x42f0
jmp 0x7953
leaq -0x38(%rbp), %rdi
callq 0x13870
movq %rax, -0x90(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x137d0
movq %rax, -0x88(%rbp)
jmp 0x78ce
movq -0x90(%rbp), %rsi
movq -0x88(%rbp), %rdi
callq 0x13890
jmp 0x78e3
leaq -0x20(%rbp), %rdi
callq 0x13820
jmp 0x78ee
jmp 0x78f0
jmp 0x78f2
leaq -0x38(%rbp), %rdi
callq 0x138d0
jmp 0x77e8
movb $0x22, -0x42(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x137d0
movq %rax, -0x98(%rbp)
jmp 0x7916
movq -0x98(%rbp), %rdi
leaq -0x42(%rbp), %rsi
callq 0x137e0
jmp 0x7928
leaq -0x20(%rbp), %rdi
callq 0x13820
jmp 0x7933
movb $0x1, -0x11(%rbp)
testb $0x1, -0x11(%rbp)
jne 0x7946
movq -0x58(%rbp), %rdi
callq 0x42f0
movq -0x60(%rbp), %rax
addq $0xa0, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x4710
nopl (%rax)
// File: ixchow[P]http-tweak/./http.hpp
// Function: http::case_insensitive_equals(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 bool case_insensitive_equals(std::string const &a, std::string const &b) {
	if (a.size() != b.size()) return false;
	for (uint32_t i = 0; i < a.size(); ++i) {
		char ca = a[i];
		char cb = b[i];
		if (ca >= 'A' && ca <= 'Z') ca |= 0x20;
		if (cb >= 'A' && cb <= 'Z') cb |= 0x20;
		if (ca != cb) return false;
	}
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4370
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
callq 0x4370
movq %rax, %rcx
movq -0x28(%rbp), %rax
cmpq %rcx, %rax
je 0x10b4b
movb $0x0, -0x1(%rbp)
jmp 0x10bf6
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4370
movq %rax, %rcx
movq -0x30(%rbp), %rax
cmpq %rcx, %rax
jae 0x10bf2
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0x4510
movb (%rax), %al
movb %al, -0x1d(%rbp)
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0x4510
movb (%rax), %al
movb %al, -0x1e(%rbp)
movsbl -0x1d(%rbp), %eax
cmpl $0x41, %eax
jl 0x10bb4
movsbl -0x1d(%rbp), %eax
cmpl $0x5a, %eax
jg 0x10bb4
movsbl -0x1d(%rbp), %eax
orl $0x20, %eax
movb %al, -0x1d(%rbp)
movsbl -0x1e(%rbp), %eax
cmpl $0x41, %eax
jl 0x10bd0
movsbl -0x1e(%rbp), %eax
cmpl $0x5a, %eax
jg 0x10bd0
movsbl -0x1e(%rbp), %eax
orl $0x20, %eax
movb %al, -0x1e(%rbp)
movsbl -0x1d(%rbp), %eax
movsbl -0x1e(%rbp), %ecx
cmpl %ecx, %eax
je 0x10be2
movb $0x0, -0x1(%rbp)
jmp 0x10bf6
jmp 0x10be4
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x10b52
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: Mirrvin[P]DragonsResurrectingInc/main.cpp
// Function: sendMessage(int, int)
packet_t sendMessage(int tag, int target) {
    packet_t packet;
    packet.lamport = Monitor::incrementLamportOnSend();
    MPI_Send(&packet, sizeof(packet_t), MPI_BYTE, target, tag, MPI_COMM_WORLD);
    return packet;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x18(%rbp)
movq %rdi, -0x10(%rbp)
movl %esi, -0x4(%rbp)
movl %edx, -0x8(%rbp)
callq 0x12db0
movq -0x18(%rbp), %rdi
movl %eax, 0x8(%rdi)
movl -0x8(%rbp), %ecx
movl -0x4(%rbp), %r8d
movl $0x28, %esi
movq 0x141c3(%rip), %rdx     # 0x1cfb8
movq 0x141cc(%rip), %r9      # 0x1cfc8
callq 0x81d0
movq -0x10(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: Mirrvin[P]DragonsResurrectingInc/main.cpp
// Function: handleResurrectionFinished(void*)
void *handleResurrectionFinished(void* x) {
    int t = rand()%2+1;
    sleep(t);
    pthread_mutex_lock(&Monitor::skeletonsMutex);
    Monitor::currentSkeletons+=1;
    pthread_mutex_unlock(&Monitor::skeletonsMutex);
    pthread_mutex_unlock(&Monitor::newOrderMutex);
    printf("%u: Dragon died after %ds\n",Monitor::getLamport(),t);
    pthread_exit(NULL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
callq 0x8150
movl $0x2, %ecx
cltd
idivl %ecx
addl $0x1, %edx
movl %edx, -0xc(%rbp)
movl -0xc(%rbp), %edi
callq 0x83f0
leaq 0x14852(%rip), %rdi     # 0x1d690
callq 0x88a0
leaq 0x147a6(%rip), %rax     # 0x1d5f0
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x1479a(%rip), %rax     # 0x1d5f0
movl %ecx, (%rax)
leaq 0x14831(%rip), %rdi     # 0x1d690
callq 0x8400
leaq 0x1484d(%rip), %rdi     # 0x1d6b8
callq 0x8400
callq 0x12e00
movl %eax, %esi
movl -0xc(%rbp), %edx
leaq 0xc277(%rip), %rdi      # 0x150f8
movb $0x0, %al
callq 0x8040
xorl %eax, %eax
movl %eax, %edi
callq 0x8a70
nopw %cs:(%rax,%rax)
// File: Mirrvin[P]DragonsResurrectingInc/main.cpp
// Function: issuerMonitor(void*)
void *issuerMonitor (void* x) {
    packet_t packet;
    pthread_t handleResurrection;
    bool end = false;
    while(!end) {
        packet = Monitor::receiveMessage();
        if(packet.status.MPI_TAG == RESURRECTION_FINISHED)
            pthread_create( &handleResurrection, NULL, &handleResurrectionFinished,NULL);
        else {
            end = true;
            printf("%u: issuer ends listining\n",Monitor::getLamport());
        }
    }
    pthread_exit(NULL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movb $0x0, -0x39(%rbp)
movb -0x39(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x8ebb
jmp 0x8f10
leaq -0x68(%rbp), %rdi
callq 0x12c80
leaq -0x30(%rbp), %rdi
leaq -0x68(%rbp), %rsi
movl $0x28, %edx
callq 0x84d0
cmpl $0x77, -0x1c(%rbp)
jne 0x8ef5
leaq -0x38(%rbp), %rdi
xorl %eax, %eax
movl %eax, %ecx
leaq -0xdb(%rip), %rdx       # 0x8e10
movq %rcx, %rsi
callq 0x8ac0
jmp 0x8f0e
movb $0x1, -0x39(%rbp)
callq 0x12e00
movl %eax, %esi
leaq 0xc20c(%rip), %rdi      # 0x15113
movb $0x0, %al
callq 0x8040
jmp 0x8eb0
xorl %eax, %eax
movl %eax, %edi
callq 0x8a70
nopl (%rax)
// File: Mirrvin[P]DragonsResurrectingInc/main.cpp
// Function: handleLoop(void*)
void *handleLoop (void* s ) {
    Specialist *specialist = (Specialist*) s;
    bool end = false;
    int count = 0;
    while(!end) {
        pthread_mutex_lock(&Monitor::handleMutex); // czeka, aż kolejka nie będzie pusta
        pthread_mutex_lock(&Monitor::messageQueueMutex); // dostęp do kolejki wiadomości
        if(!Monitor::messageQueue.empty()) {
            packet_t packet = Monitor::messageQueue.front();           
            Monitor::messageQueue.pop();
            pthread_mutex_unlock(&Monitor::messageQueueMutex);
            if(!specialist->handle(packet)) {
                end = true;
            }
        } else {
            pthread_mutex_unlock(&Monitor::messageQueueMutex);
        }

        pthread_mutex_lock(&Monitor::messageQueueMutex);
        if(!Monitor::messageQueue.empty()) {
            pthread_mutex_unlock(&Monitor::handleMutex); // kolejka nie jest pusta, lecimy dalej
        }
        pthread_mutex_unlock(&Monitor::messageQueueMutex);       
        count++;
    }
    Monitor::endListening();
    pthread_exit(NULL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movb $0x0, -0x11(%rbp)
movl $0x0, -0x18(%rbp)
movb -0x11(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x8f50
jmp 0x904a
leaq 0x146e9(%rip), %rdi     # 0x1d640
callq 0x88a0
leaq 0x14705(%rip), %rdi     # 0x1d668
callq 0x88a0
leaq 0x14771(%rip), %rdi     # 0x1d6e0
callq 0x9b30
testb $0x1, %al
jne 0x8ffc
leaq 0x1475d(%rip), %rdi     # 0x1d6e0
callq 0x9b50
movq %rax, %rsi
leaq -0x40(%rbp), %rdi
movl $0x28, %edx
callq 0x84d0
leaq 0x14740(%rip), %rdi     # 0x1d6e0
callq 0x9b70
leaq 0x146bc(%rip), %rdi     # 0x1d668
callq 0x8400
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movl $0x28, %edx
callq 0x84d0
movq -0x70(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
movq -0x48(%rbp), %rdx
movq %rsp, %rcx
movq %rdx, 0x20(%rcx)
movups -0x68(%rbp), %xmm0
movups -0x58(%rbp), %xmm1
movups %xmm1, 0x10(%rcx)
movups %xmm0, (%rcx)
callq *%rax
testb $0x1, %al
jne 0x8ffa
movb $0x1, -0x11(%rbp)
jmp 0x9008
leaq 0x14665(%rip), %rdi     # 0x1d668
callq 0x8400
leaq 0x14659(%rip), %rdi     # 0x1d668
callq 0x88a0
leaq 0x146c5(%rip), %rdi     # 0x1d6e0
callq 0x9b30
testb $0x1, %al
jne 0x9030
leaq 0x14615(%rip), %rdi     # 0x1d640
callq 0x8400
leaq 0x14631(%rip), %rdi     # 0x1d668
callq 0x8400
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x8f42
callq 0x12da0
xorl %eax, %eax
movl %eax, %edi
callq 0x8a70
nopl (%rax,%rax)
// File: Mirrvin[P]DragonsResurrectingInc/main.cpp
// Function: rootLoop(int)
void rootLoop(int size){
    printf("Heads: 3, 6, 9...\nBodies: 1, 4, 7...\nTails: 2, 5, 8...\nSKELETON_NUMBER %d\nDESK_NUMBER %d\nORDER_NUMBER %d\n",SKELETON_NUMBER,DESK_NUMBER,ORDER_NUMBER);
    pthread_t issuerMonitorThread;
    pthread_create( &issuerMonitorThread, NULL, &issuerMonitor,NULL);

    packet_t packet;
    packet.data = 0;
    int orderId = 1;
    sleep(12);

    // while(orderId <= ORDER_NUMBER) { 
    while(true) { 
        pthread_mutex_lock(&Monitor::newOrderMutex);

        pthread_mutex_lock(&Monitor::skeletonsMutex);
        Monitor::currentSkeletons-=1;
        pthread_mutex_unlock(&Monitor::skeletonsMutex);
        
        if(Monitor::currentSkeletons > 0)
            pthread_mutex_unlock(&Monitor::newOrderMutex);
        
        // sleep(2);
        packet.lamport = Monitor::getLamport();
        printf("%u: New order no. %d!\n",Monitor::getLamport() ,orderId);
        for(int i = 1;i < size; i++){ // broadcast NEW_ORDER
            if(i%3 + 1 == TAIL) {
                sendMessage(NEW_ORDER,i);
            }
        }
        orderId++;
    }

    // sleep(3);
    // for(int i = 1;i < size; i++){ // broadcast END
    //     MPI_Send(&packet, sizeof(packet_t), MPI_BYTE, i, END, MPI_COMM_WORLD);
    // }
    // sendMessage(END, ISSUER);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movl %edi, -0x4(%rbp)
leaq 0xc0bc(%rip), %rdi      # 0x1512e
movl $0x2, %esi
movl $0x1, %edx
movl $0x5, %ecx
movb $0x0, %al
callq 0x8040
leaq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %ecx
leaq -0x1f7(%rip), %rdx      # 0x8ea0
movq %rcx, %rsi
callq 0x8ac0
movl $0x0, -0x38(%rbp)
movl $0x1, -0x3c(%rbp)
movl $0xc, %edi
callq 0x83f0
leaq 0x145fa(%rip), %rdi     # 0x1d6b8
callq 0x88a0
leaq 0x145c6(%rip), %rdi     # 0x1d690
callq 0x88a0
leaq 0x1451a(%rip), %rax     # 0x1d5f0
movl (%rax), %ecx
subl $0x1, %ecx
leaq 0x1450e(%rip), %rax     # 0x1d5f0
movl %ecx, (%rax)
leaq 0x145a5(%rip), %rdi     # 0x1d690
callq 0x8400
leaq 0x144f9(%rip), %rax     # 0x1d5f0
cmpl $0x0, (%rax)
jle 0x9108
leaq 0x145b5(%rip), %rdi     # 0x1d6b8
callq 0x8400
callq 0x12e00
movl %eax, -0x30(%rbp)
callq 0x12e00
movl %eax, %esi
movl -0x3c(%rbp), %edx
leaq 0xc077(%rip), %rdi      # 0x15198
movb $0x0, %al
callq 0x8040
movl $0x1, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x9168
movl -0x40(%rbp), %eax
movl $0x3, %ecx
cltd
idivl %ecx
addl $0x1, %edx
cmpl $0x3, %edx
jne 0x915b
movl -0x40(%rbp), %edx
leaq -0x68(%rbp), %rdi
movl $0x64, %esi
callq 0x8dc0
jmp 0x915d
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x912f
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x90b7
nopw %cs:(%rax,%rax)
// File: Mirrvin[P]DragonsResurrectingInc/main.cpp
// Function: headLoop()
void headLoop(){
    Specialist *specialist = new HeadSpecialist(Monitor::rank, Monitor::size);
    pthread_t handleThread;
    pthread_create( &handleThread, NULL, &handleLoop, specialist);
    Monitor::listen();
    pthread_join(handleThread,NULL);
    delete specialist;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl $0x20, %edi
callq 0x85c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x28(%rbp)
leaq 0x14461(%rip), %rax     # 0x1d604
movl (%rax), %esi
leaq 0x1445c(%rip), %rax     # 0x1d608
movl (%rax), %edx
callq 0x9b90
jmp 0x91b5
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rcx
leaq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x2b0(%rip), %rdx      # 0x8f20
callq 0x8ac0
callq 0x12d20
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x8540
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0x91ff
movq -0x30(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
addq $0x30, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
movl $0x20, %esi
callq 0x85e0
movq -0x10(%rbp), %rdi
callq 0x8a60
nopl (%rax,%rax)
// File: Mirrvin[P]DragonsResurrectingInc/main.cpp
// Function: bodyLoop()
void bodyLoop(){
    Specialist *specialist = new BodySpecialist(Monitor::rank, Monitor::size);
    pthread_t handleThread;
    pthread_create( &handleThread, NULL, &handleLoop, specialist);
    Monitor::listen();
    pthread_join(handleThread,NULL);
    delete specialist;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl $0x70, %edi
callq 0x85c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x28(%rbp)
leaq 0x143b1(%rip), %rax     # 0x1d604
movl (%rax), %esi
leaq 0x143ac(%rip), %rax     # 0x1d608
movl (%rax), %edx
callq 0x9c10
jmp 0x9265
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rcx
leaq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x360(%rip), %rdx      # 0x8f20
callq 0x8ac0
callq 0x12d20
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x8540
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0x92af
movq -0x30(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
addq $0x30, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
movl $0x70, %esi
callq 0x85e0
movq -0x10(%rbp), %rdi
callq 0x8a60
nopl (%rax,%rax)
// File: Mirrvin[P]DragonsResurrectingInc/main.cpp
// Function: tailLoop()
void tailLoop(){   
    Specialist *specialist = new TailSpecialist(Monitor::rank,Monitor::size);
    pthread_t handleThread;
    pthread_create(&handleThread, NULL, &handleLoop, specialist);
    Monitor::listen();
    pthread_join(handleThread,NULL);
    delete specialist;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl $0x78, %edi
callq 0x85c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x28(%rbp)
leaq 0x14301(%rip), %rax     # 0x1d604
movl (%rax), %esi
leaq 0x142fc(%rip), %rax     # 0x1d608
movl (%rax), %edx
callq 0x9ca0
jmp 0x9315
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rcx
leaq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x410(%rip), %rdx      # 0x8f20
callq 0x8ac0
callq 0x12d20
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x8540
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0x935f
movq -0x30(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
addq $0x30, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
movl $0x78, %esi
callq 0x85e0
movq -0x10(%rbp), %rdi
callq 0x8a60
nopl (%rax,%rax)
// File: Mirrvin[P]DragonsResurrectingInc/main.cpp
// Function: main
int main(int argc, char **argv)
{
    int provided;
    MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);
    if(check_thread_support(provided)) {
        Monitor::initialize();

        int type = Monitor::rank%3 + 1;
        if (Monitor::rank == ISSUER){
            rootLoop(Monitor::size);
        } else if (type == HEAD) {
            headLoop();
        } else if (type == BODY) {
            bodyLoop();
        } else if (type == TAIL) {
            tailLoop();
        }
    } else {
        printf("Multiple threads are not supported by open mpi. Exiting application");
    }
    MPI_Finalize();
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
movl $0x3, %edx
leaq -0x14(%rbp), %rcx
callq 0x80d0
movl -0x14(%rbp), %edi
callq 0x8da0
testb $0x1, %al
jne 0x93ca
jmp 0x942f
callq 0x12c20
leaq 0x1422e(%rip), %rax     # 0x1d604
movl (%rax), %eax
movl $0x3, %ecx
cltd
idivl %ecx
addl $0x1, %edx
movl %edx, -0x18(%rbp)
leaq 0x14217(%rip), %rax     # 0x1d604
cmpl $0x0, (%rax)
jne 0x9402
leaq 0x1420f(%rip), %rax     # 0x1d608
movl (%rax), %edi
callq 0x9060
jmp 0x942d
cmpl $0x1, -0x18(%rbp)
jne 0x940f
callq 0x9180
jmp 0x942b
cmpl $0x2, -0x18(%rbp)
jne 0x941c
callq 0x9230
jmp 0x9429
cmpl $0x3, -0x18(%rbp)
jne 0x9427
callq 0x92e0
jmp 0x9429
jmp 0x942b
jmp 0x942d
jmp 0x943d
leaq 0xbd79(%rip), %rdi      # 0x151af
movb $0x0, %al
callq 0x8040
callq 0x8440
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: Mirrvin[P]DragonsResurrectingInc/./specialists/BodySpecialist.cpp
// Function: BodySpecialist::BodySpecialist(int, int)
BodySpecialist(int rank, int size):Specialist(rank, size) {
        this->headRank = 0;
        this->tailRank = 0;
        this->needDeskReplyCounter = 0;
        this->handlingNeedBody = false;
        this->gettingDesk = false;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
callq 0x13e10
movq -0x18(%rbp), %rdi
leaq 0x13088(%rip), %rax     # 0x1ccc8
addq $0x10, %rax
movq %rax, (%rdi)
addq $0x28, %rdi
callq 0xe0c0
movq -0x18(%rbp), %rdi
addq $0x40, %rdi
callq 0xe0c0
movq -0x18(%rbp), %rdi
addq $0x58, %rdi
callq 0xe0c0
movq -0x18(%rbp), %rax
movl $0x0, 0x18(%rax)
movl $0x0, 0x1c(%rax)
movl $0x0, 0x20(%rax)
movb $0x0, 0x24(%rax)
movb $0x0, 0x25(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: Mirrvin[P]DragonsResurrectingInc/./specialists/TailSpecialist.cpp
// Function: TailSpecialist::TailSpecialist(int, int)
TailSpecialist(int rank, int size):Specialist(rank, size) {
        this->headRank = 0;
        this->bodyRank = 0;
        this->handlingNeedTail = false;
        this->gettingResurrectionOrder = false;
        this->availableOrders = 0;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
callq 0x13e10
movq -0x18(%rbp), %rdi
leaq 0x13038(%rip), %rax     # 0x1cd08
addq $0x10, %rax
movq %rax, (%rdi)
addq $0x30, %rdi
callq 0xe0c0
movq -0x18(%rbp), %rdi
addq $0x48, %rdi
callq 0xe0c0
movq -0x18(%rbp), %rdi
addq $0x60, %rdi
callq 0xe0c0
movq -0x18(%rbp), %rax
movl $0x0, 0x18(%rax)
movl $0x0, 0x1c(%rax)
movb $0x0, 0x28(%rax)
movb $0x0, 0x29(%rax)
movl $0x0, 0x24(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: Mirrvin[P]DragonsResurrectingInc/./specialists/HeadSpecialist.cpp
// Function: HeadSpecialist::handleNeedBodyPositive(packet_t)
bool handleNeedBodyPositive(packet_t packet) {       
        if(!this->inTeam) {           
            this->bodyRank = packet.status.MPI_SOURCE;
            this->inTeam = true;
            this->sendMessage(NEED_BODY_POSITIVE, packet.status.MPI_SOURCE);
        } else {
            this->sendMessage(NEED_BODY_NEGATIVE, packet.status.MPI_SOURCE);
        }
        return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
leaq 0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
testb $0x1, 0x10(%rax)
jne 0xe007
movq -0x60(%rbp), %rsi
movq -0x68(%rbp), %rax
movl 0x10(%rax), %ecx
movl %ecx, 0x18(%rsi)
movb $0x1, 0x10(%rsi)
movl 0x10(%rax), %ecx
leaq -0x30(%rbp), %rdi
movl $0x6b, %edx
callq 0x13e90
jmp 0xe020
movq -0x60(%rbp), %rsi
movq -0x68(%rbp), %rax
movl 0x10(%rax), %ecx
leaq -0x58(%rbp), %rdi
movl $0x6c, %edx
callq 0x13e90
movb $0x1, %al
andb $0x1, %al
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: Mirrvin[P]DragonsResurrectingInc/./specialists/HeadSpecialist.cpp
// Function: HeadSpecialist::handleResurrectionFinished(packet_t)
bool handleResurrectionFinished(packet_t packet) {
        this->inTeam = false;
        this->tailRank = 0;
        this->bodyRank = 0;
        this->sendMessage(AVENGERS_ASSEMBLE,rank);
        return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rsi
movb $0x0, 0x10(%rsi)
movl $0x0, 0x1c(%rsi)
movl $0x0, 0x18(%rsi)
movl 0x8(%rsi), %ecx
leaq -0x30(%rbp), %rdi
movl $0x68, %edx
callq 0x13e90
movb $0x1, %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: Mirrvin[P]DragonsResurrectingInc/./specialists/BodySpecialist.cpp
// Function: BodySpecialist::handleNeedBody(packet_t)
bool handleNeedBody(packet_t packet) {    
        if(this->headRank == 0) {
            if(!handlingNeedBody) {
                this->handlingNeedBody = true;
                this->bodyList.clear();
                this->headList.clear();
                packet_t packet = this->createSelfPacket();
                packet_t sentPacket = this->broadcastMessage(packet, NEED_BODY_ACK, BODY);
                this->bodyList.push_back(sentPacket);
                this->sendMessage(FINISH_NEED_BODY, this->rank);
            }
            this->headList.push_back(packet);
        }
        return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
leaq 0x10(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xb0(%rbp)
cmpl $0x0, 0x18(%rax)
jne 0xea70
movq -0xb0(%rbp), %rax
testb $0x1, 0x24(%rax)
jne 0xea59
movq -0xb0(%rbp), %rdi
movb $0x1, 0x24(%rdi)
addq $0x40, %rdi
callq 0xef70
movq -0xb0(%rbp), %rdi
addq $0x28, %rdi
callq 0xef70
movq -0xb0(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x13f10
leaq -0x80(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movl $0x28, %edx
callq 0x84d0
movq -0xb0(%rbp), %rsi
movq -0x60(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x20(%rax)
movups -0x80(%rbp), %xmm0
movups -0x70(%rbp), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
leaq -0x58(%rbp), %rdi
movl $0x69, %edx
movl $0x2, %ecx
callq 0x14160
movq -0xb0(%rbp), %rdi
addq $0x40, %rdi
leaq -0x58(%rbp), %rsi
callq 0xef90
movq -0xb0(%rbp), %rsi
movl 0x8(%rsi), %ecx
leaq -0xa8(%rbp), %rdi
movl $0x6a, %edx
callq 0x13e90
movq -0xb8(%rbp), %rsi
movq -0xb0(%rbp), %rdi
addq $0x28, %rdi
callq 0xef90
movb $0x1, %al
andb $0x1, %al
addq $0xe0, %rsp
popq %rbp
retq
nopl (%rax)
// File: Mirrvin[P]DragonsResurrectingInc/./specialists/BodySpecialist.cpp
// Function: BodySpecialist::handleFinishNeedBody(packet_t)
bool handleFinishNeedBody(packet_t packet) {    
        if(this->headRank == 0) {
            this->handlingNeedBody = false;
            std::sort(this->bodyList.begin(), this->bodyList.end(), comparePackets);
            std::sort(this->headList.begin(), this->headList.end(), comparePackets);
            unsigned int me = this->getSelfIndexFromBodyList();
            bool haveMatchingHead = (this->headList.size() > me) && (me < this->bodyList.size());
            if(haveMatchingHead) {               
                this->inTeam = true;
                this->sendMessage(NEED_BODY_POSITIVE, this->headList[me].status.MPI_SOURCE);
                
                if(me == 0) {
                    this->notifyHeadsWithNoBodiesAssigned();
                }
            }
        }
        return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
cmpl $0x0, 0x18(%rax)
jne 0xebe9
movq -0x60(%rbp), %rdi
movb $0x0, 0x24(%rdi)
addq $0x40, %rdi
callq 0xf3c0
movq -0x60(%rbp), %rdi
movq %rax, -0x10(%rbp)
addq $0x40, %rdi
callq 0xf230
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq 0xd2d(%rip), %rdx       # 0xf840
callq 0xf7f0
movq -0x60(%rbp), %rdi
addq $0x28, %rdi
callq 0xf3c0
movq -0x60(%rbp), %rdi
movq %rax, -0x20(%rbp)
addq $0x28, %rdi
callq 0xf230
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
leaq 0xcf7(%rip), %rdx       # 0xf840
callq 0xf7f0
movq -0x60(%rbp), %rdi
callq 0xf8e0
movq -0x60(%rbp), %rdi
movl %eax, -0x2c(%rbp)
addq $0x28, %rdi
callq 0xf4c0
movq %rax, %rcx
movl -0x2c(%rbp), %eax
movl %eax, %edx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x61(%rbp)
jbe 0xeb9d
movq -0x60(%rbp), %rdi
movl -0x2c(%rbp), %eax
movq %rax, -0x70(%rbp)
addq $0x40, %rdi
callq 0xf4c0
movq %rax, %rcx
movq -0x70(%rbp), %rax
cmpq %rcx, %rax
setb %al
movb %al, -0x61(%rbp)
movb -0x61(%rbp), %al
andb $0x1, %al
movb %al, -0x2d(%rbp)
testb $0x1, -0x2d(%rbp)
je 0xebe7
movq -0x60(%rbp), %rdi
movb $0x1, 0x10(%rdi)
addq $0x28, %rdi
movl -0x2c(%rbp), %eax
movl %eax, %esi
callq 0xf970
movq -0x60(%rbp), %rsi
movl 0x10(%rax), %ecx
leaq -0x58(%rbp), %rdi
movl $0x6b, %edx
callq 0x13e90
cmpl $0x0, -0x2c(%rbp)
jne 0xebe5
movq -0x60(%rbp), %rdi
callq 0xf990
jmp 0xebe7
jmp 0xebe9
movb $0x1, %al
andb $0x1, %al
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: Mirrvin[P]DragonsResurrectingInc/./specialists/BodySpecialist.cpp
// Function: BodySpecialist::handleNeedTailPositive(packet_t)
bool handleNeedTailPositive(packet_t packet) {
        if(this->tailRank == 0) {           
            this->tailRank = packet.status.MPI_SOURCE;
            this->inTeam = true;
            this->sendMessage(NEED_TAIL_POSITIVE, packet.status.MPI_SOURCE);
        } else {
            this->sendMessage(NEED_TAIL_NEGATIVE, packet.status.MPI_SOURCE);
        }
        return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
leaq 0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
cmpl $0x0, 0x1c(%rax)
jne 0xec47
movq -0x60(%rbp), %rsi
movq -0x68(%rbp), %rax
movl 0x10(%rax), %ecx
movl %ecx, 0x1c(%rsi)
movb $0x1, 0x10(%rsi)
movl 0x10(%rax), %ecx
leaq -0x30(%rbp), %rdi
movl $0x6f, %edx
callq 0x13e90
jmp 0xec60
movq -0x60(%rbp), %rsi
movq -0x68(%rbp), %rax
movl 0x10(%rax), %ecx
leaq -0x58(%rbp), %rdi
movl $0x70, %edx
callq 0x13e90
movb $0x1, %al
andb $0x1, %al
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: Mirrvin[P]DragonsResurrectingInc/./specialists/BodySpecialist.cpp
// Function: BodySpecialist::handleAvengersAssemble(packet_t)
bool handleAvengersAssemble(packet_t packet) {
        if(this->inTeam) {
            packet_t packet = this->createSelfPacket();
            packet.data = this->headRank;
            this->broadcastMessage(packet, NEED_TAIL, TAIL);
        }
        return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x88(%rbp)
testb $0x1, 0x10(%rax)
je 0xed23
movq -0x88(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x13f10
movq -0x88(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x30(%rbp)
leaq -0x58(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movl $0x28, %edx
callq 0x84d0
movq -0x88(%rbp), %rsi
movq -0x38(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x20(%rax)
movups -0x58(%rbp), %xmm0
movups -0x48(%rbp), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
leaq -0x80(%rbp), %rdi
movl $0x67, %edx
movl $0x3, %ecx
callq 0x14160
movb $0x1, %al
andb $0x1, %al
addq $0xb0, %rsp
popq %rbp
retq
// File: Mirrvin[P]DragonsResurrectingInc/./specialists/BodySpecialist.cpp
// Function: BodySpecialist::handleNeedDeskReply(packet_t)
bool handleNeedDeskReply(packet_t packet) {
        this->needDeskReplyCounter -= 1;
        if(this->needDeskReplyCounter <= 0) {
            this->tryToOccupyDesk();
        }
        return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movl 0x20(%rax), %ecx
subl $0x1, %ecx
movl %ecx, 0x20(%rax)
cmpl $0x0, 0x20(%rax)
jg 0xedac
movq -0x10(%rbp), %rdi
callq 0x11050
movb $0x1, %al
andb $0x1, %al
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: Mirrvin[P]DragonsResurrectingInc/./specialists/BodySpecialist.cpp
// Function: BodySpecialist::handleFreeDesk(packet_t)
bool handleFreeDesk(packet_t packet) {       
        this->removeFromDeskPriority(packet.status.MPI_SOURCE);
        if(this->gettingDesk) {
            this->tryToOccupyDesk();
        }
        return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x10(%rbp)
movl 0x10(%rax), %esi
callq 0x11220
movq -0x10(%rbp), %rax
testb $0x1, 0x25(%rax)
je 0xedf3
movq -0x10(%rbp), %rdi
callq 0x11050
movb $0x1, %al
andb $0x1, %al
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: Mirrvin[P]DragonsResurrectingInc/./specialists/BodySpecialist.cpp
// Function: BodySpecialist::handleDoPaperwork(packet_t)
bool handleDoPaperwork(packet_t packet) {
        this->needDeskReplyCounter = 1/3*(this->size+1)-1;
        packet = this->broadcastMessage(NEED_DESK_REQUEST, BODY); // mowi innym BODY, zeby go dodali do kolejki
        deskPriority.push_back(packet); // dodaje siebie
        this->gettingDesk = true;
        return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
leaq 0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rsi
movq %rsi, -0x38(%rbp)
movl 0xc(%rsi), %eax
addl $0x1, %eax
imull $0x0, %eax, %eax
subl $0x1, %eax
movl %eax, 0x20(%rsi)
leaq -0x30(%rbp), %rdi
movl $0x78, %edx
movl $0x2, %ecx
callq 0x140e0
movq -0x40(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movl $0x28, %edx
callq 0x84d0
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdi
addq $0x58, %rdi
callq 0xef90
movq -0x38(%rbp), %rax
movb $0x1, 0x25(%rax)
movb $0x1, %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: Mirrvin[P]DragonsResurrectingInc/./specialists/BodySpecialist.cpp
// Function: BodySpecialist::handleResurrectionFinished(packet_t)
bool handleResurrectionFinished(packet_t packet) {        
        this->inTeam = false;
        this->headRank = 0;
        this->tailRank = 0;
        return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movb $0x0, 0x10(%rax)
movl $0x0, 0x18(%rax)
movl $0x0, 0x1c(%rax)
movb $0x1, %al
andb $0x1, %al
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: Mirrvin[P]DragonsResurrectingInc/./specialists/BodySpecialist.cpp
// Function: BodySpecialist::handleNeedBodyPositive(packet_t)
bool handleNeedBodyPositive(packet_t packet) {       
        this->headRank = packet.status.MPI_SOURCE;
        this->sendMessage(AVENGERS_ASSEMBLE, this->rank);
        this->handlingNeedBody = false;
        return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
leaq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rsi
movq %rsi, -0x38(%rbp)
movl 0x10(%rax), %eax
movl %eax, 0x18(%rsi)
movl 0x8(%rsi), %ecx
leaq -0x30(%rbp), %rdi
movl $0x68, %edx
callq 0x13e90
movq -0x38(%rbp), %rax
movb $0x0, 0x24(%rax)
movb $0x1, %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: Mirrvin[P]DragonsResurrectingInc/./specialists/BodySpecialist.cpp
// Function: BodySpecialist::handleNeedBodyNegative(packet_t)
bool handleNeedBodyNegative(packet_t packet) {
        this->headRank = 0;
        this->handlingNeedBody = false;
        this->broadcastMessage(AVENGERS_ASSEMBLE,HEAD);
        return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rsi
movl $0x0, 0x18(%rsi)
movb $0x0, 0x24(%rsi)
leaq -0x30(%rbp), %rdi
movl $0x68, %edx
movl $0x1, %ecx
callq 0x140e0
movb $0x1, %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: Mirrvin[P]DragonsResurrectingInc/./specialists/BodySpecialist.cpp
// Function: BodySpecialist::getSelfIndexFromBodyList()
unsigned int getSelfIndexFromBodyList() {
        for(unsigned int i=0; i<this->bodyList.size(); i++) {
            if(this->rank == this->bodyList[i].status.MPI_SOURCE)
                return i;
        }
        return this->bodyList.size();
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x20(%rbp), %rdi
movl -0x14(%rbp), %eax
movq %rax, -0x28(%rbp)
addq $0x40, %rdi
callq 0xf4c0
movq %rax, %rcx
movq -0x28(%rbp), %rax
cmpq %rcx, %rax
jae 0xf953
movq -0x20(%rbp), %rdi
movl 0x8(%rdi), %eax
movl %eax, -0x2c(%rbp)
addq $0x40, %rdi
movl -0x14(%rbp), %eax
movl %eax, %esi
callq 0xf970
movq %rax, %rcx
movl -0x2c(%rbp), %eax
cmpl 0x10(%rcx), %eax
jne 0xf946
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xf963
jmp 0xf948
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xf8fb
movq -0x20(%rbp), %rdi
addq $0x40, %rdi
callq 0xf4c0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: Mirrvin[P]DragonsResurrectingInc/./specialists/BodySpecialist.cpp
// Function: BodySpecialist::tryToOccupyDesk()
void tryToOccupyDesk() {
        std::sort(this->deskPriority.begin(), this->deskPriority.end(), comparePacketsLamport);
        unsigned int me = this->getSelfIndexFromDeskPriority();
        if(me < this->deskPriority.size() && me < DESK_NUMBER) {
            printf("%u: Got desk, doing Paper work, rank: %d\n",Monitor::getLamport(),this->rank);
            sleep(1);
            this->gettingDesk = false;
            this->removeFromDeskPriority(this->rank);
            this->broadcastMessage(FREE_DESK, BODY);
            this->sendMessage(DONE_PAPERWORK, this->rank);
            printf("%u: Freeing desk, doing Paper work, rank: %d\n",Monitor::getLamport(),this->rank);
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x80(%rbp)
addq $0x58, %rdi
callq 0xf3c0
movq -0x80(%rbp), %rdi
movq %rax, -0x10(%rbp)
addq $0x58, %rdi
callq 0xf230
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq 0xcc(%rip), %rdx        # 0x11160
callq 0xf7f0
movq -0x80(%rbp), %rdi
callq 0x11190
movq -0x80(%rbp), %rdi
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq %rax, -0x78(%rbp)
addq $0x58, %rdi
callq 0xf4c0
movq %rax, %rcx
movq -0x78(%rbp), %rax
cmpq %rcx, %rax
jae 0x1114d
cmpl $0x1, -0x1c(%rbp)
jae 0x1114d
callq 0x12e00
movl %eax, %esi
movq -0x80(%rbp), %rax
movl 0x8(%rax), %edx
leaq 0x4183(%rip), %rdi      # 0x15267
movb $0x0, %al
callq 0x8040
movl $0x1, %edi
callq 0x83f0
movq -0x80(%rbp), %rdi
movb $0x0, 0x25(%rdi)
movl 0x8(%rdi), %esi
callq 0x11220
movq -0x80(%rbp), %rsi
leaq -0x48(%rbp), %rdi
movl $0x7a, %edx
movl $0x2, %ecx
callq 0x140e0
movq -0x80(%rbp), %rsi
movl 0x8(%rsi), %ecx
leaq -0x70(%rbp), %rdi
movl $0x76, %edx
callq 0x13e90
callq 0x12e00
movl %eax, %esi
movq -0x80(%rbp), %rax
movl 0x8(%rax), %edx
leaq 0x414b(%rip), %rdi      # 0x15291
movb $0x0, %al
callq 0x8040
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: Mirrvin[P]DragonsResurrectingInc/./specialists/BodySpecialist.cpp
// Function: BodySpecialist::getSelfIndexFromDeskPriority()
unsigned int getSelfIndexFromDeskPriority() {
        for(unsigned int i=0; i<this->deskPriority.size(); i++) {
            if(this->rank == this->deskPriority[i].status.MPI_SOURCE){                
                return i;
            }
        }
        return this->deskPriority.size();
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x20(%rbp), %rdi
movl -0x14(%rbp), %eax
movq %rax, -0x28(%rbp)
addq $0x58, %rdi
callq 0xf4c0
movq %rax, %rcx
movq -0x28(%rbp), %rax
cmpq %rcx, %rax
jae 0x11203
movq -0x20(%rbp), %rdi
movl 0x8(%rdi), %eax
movl %eax, -0x2c(%rbp)
addq $0x58, %rdi
movl -0x14(%rbp), %eax
movl %eax, %esi
callq 0xf970
movq %rax, %rcx
movl -0x2c(%rbp), %eax
cmpl 0x10(%rcx), %eax
jne 0x111f6
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x11213
jmp 0x111f8
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x111ab
movq -0x20(%rbp), %rdi
addq $0x58, %rdi
callq 0xf4c0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: Mirrvin[P]DragonsResurrectingInc/./specialists/TailSpecialist.cpp
// Function: TailSpecialist::handleNeedTail(packet_t)
bool handleNeedTail(packet_t packet) {
        if(!this->inTeam) {
            if(!handlingNeedTail) {
                this->handlingNeedTail = true;
                this->tailList.clear();
                this->bodyList.clear();
                packet_t packet = this->createSelfPacket();
                packet_t sentPacket = this->broadcastMessage(packet, NEED_TAIL_ACK, TAIL);
                this->tailList.push_back(sentPacket);
                this->sendMessage(FINISH_NEED_TAIL, this->rank);
            }
            this->bodyList.push_back(packet);
        }
        return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
leaq 0x10(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xb0(%rbp)
testb $0x1, 0x10(%rax)
jne 0x11d10
movq -0xb0(%rbp), %rax
testb $0x1, 0x28(%rax)
jne 0x11cf9
movq -0xb0(%rbp), %rdi
movb $0x1, 0x28(%rdi)
addq $0x30, %rdi
callq 0xef70
movq -0xb0(%rbp), %rdi
addq $0x48, %rdi
callq 0xef70
movq -0xb0(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x13f10
leaq -0x80(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movl $0x28, %edx
callq 0x84d0
movq -0xb0(%rbp), %rsi
movq -0x60(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x20(%rax)
movups -0x80(%rbp), %xmm0
movups -0x70(%rbp), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
leaq -0x58(%rbp), %rdi
movl $0x6d, %edx
movl $0x3, %ecx
callq 0x14160
movq -0xb0(%rbp), %rdi
addq $0x30, %rdi
leaq -0x58(%rbp), %rsi
callq 0xef90
movq -0xb0(%rbp), %rsi
movl 0x8(%rsi), %ecx
leaq -0xa8(%rbp), %rdi
movl $0x6e, %edx
callq 0x13e90
movq -0xb8(%rbp), %rsi
movq -0xb0(%rbp), %rdi
addq $0x48, %rdi
callq 0xef90
movb $0x1, %al
andb $0x1, %al
addq $0xe0, %rsp
popq %rbp
retq
nopl (%rax)
// File: Mirrvin[P]DragonsResurrectingInc/./specialists/TailSpecialist.cpp
// Function: TailSpecialist::handleFinishNeedTail(packet_t)
bool handleFinishNeedTail(packet_t packet) {
        if(!this->inTeam) {
            this->handlingNeedTail = false;
            std::sort(this->tailList.begin(), this->tailList.end(), comparePackets);
            std::sort(this->bodyList.begin(), this->bodyList.end(), comparePackets);
            unsigned int me = this->getSelfIndexFromTailList();
            bool haveMatchingBody = (this->bodyList.size() > me) && (me < this->tailList.size());
            if(haveMatchingBody) {
                // this->inTeam = true;
                // this->bodyRank = this->bodyList[me].status.MPI_SOURCE;
                this->headRank = this->bodyList[me].data;
                this->sendMessage(NEED_TAIL_POSITIVE, this->bodyList[me].status.MPI_SOURCE);
                if(me == 0) {
                    this->notifyBodiesWithNoTailsAssigned();
                }
                // this->sendMessage(AVENGERS_ASSEMBLED, this->rank);
                // this->sendMessage(AVENGERS_ASSEMBLED, this->headRank);
            }
        }
        return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
testb $0x1, 0x10(%rax)
jne 0x11e9c
movq -0x60(%rbp), %rdi
movb $0x0, 0x28(%rdi)
addq $0x30, %rdi
callq 0xf3c0
movq -0x60(%rbp), %rdi
movq %rax, -0x10(%rbp)
addq $0x30, %rdi
callq 0xf230
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0x2573(%rip), %rdx     # 0xf840
callq 0xf7f0
movq -0x60(%rbp), %rdi
addq $0x48, %rdi
callq 0xf3c0
movq -0x60(%rbp), %rdi
movq %rax, -0x20(%rbp)
addq $0x48, %rdi
callq 0xf230
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
leaq -0x25a9(%rip), %rdx     # 0xf840
callq 0xf7f0
movq -0x60(%rbp), %rdi
callq 0x122b0
movq -0x60(%rbp), %rdi
movl %eax, -0x2c(%rbp)
addq $0x48, %rdi
callq 0xf4c0
movq %rax, %rcx
movl -0x2c(%rbp), %eax
movl %eax, %edx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x61(%rbp)
jbe 0x11e3d
movq -0x60(%rbp), %rdi
movl -0x2c(%rbp), %eax
movq %rax, -0x70(%rbp)
addq $0x30, %rdi
callq 0xf4c0
movq %rax, %rcx
movq -0x70(%rbp), %rax
cmpq %rcx, %rax
setb %al
movb %al, -0x61(%rbp)
movb -0x61(%rbp), %al
andb $0x1, %al
movb %al, -0x2d(%rbp)
testb $0x1, -0x2d(%rbp)
je 0x11e9a
movq -0x60(%rbp), %rdi
addq $0x48, %rdi
movl -0x2c(%rbp), %eax
movl %eax, %esi
callq 0xf970
movq -0x60(%rbp), %rdi
movl (%rax), %eax
movl %eax, 0x18(%rdi)
addq $0x48, %rdi
movl -0x2c(%rbp), %eax
movl %eax, %esi
callq 0xf970
movq -0x60(%rbp), %rsi
movl 0x10(%rax), %ecx
leaq -0x58(%rbp), %rdi
movl $0x6f, %edx
callq 0x13e90
cmpl $0x0, -0x2c(%rbp)
jne 0x11e98
movq -0x60(%rbp), %rdi
callq 0x12340
jmp 0x11e9a
jmp 0x11e9c
movb $0x1, %al
andb $0x1, %al
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: Mirrvin[P]DragonsResurrectingInc/./specialists/TailSpecialist.cpp
// Function: TailSpecialist::handleAvengersAssembled(packet_t)
bool handleAvengersAssembled(packet_t packet) {
        printf("%u: --- Team assembled. Squad members: head %d, body %d, tail %d ---\n",Monitor::getLamport(),this->headRank, this->bodyRank, this->rank);
        this->gettingResurrectionOrder = true;
        this->orderPriorityReplyCounter = (this->size)/3 - 1;
        if(this->orderPriorityReplyCounter > 0) {
            packet_t packet = this->broadcastMessage(REQUEST_ORDER_PRIORITY, TAIL);
            this->orderPriority.push_back(packet);
        } else {
            this->sendMessage(REPLY_ORDER_PRIORITY, this->rank);
        }
        return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
callq 0x12e00
movl %eax, %esi
movq -0x60(%rbp), %rax
movl 0x18(%rax), %edx
movl 0x1c(%rax), %ecx
movl 0x8(%rax), %r8d
leaq 0x33df(%rip), %rdi      # 0x152bf
movb $0x0, %al
callq 0x8040
movq -0x60(%rbp), %rax
movb $0x1, 0x29(%rax)
movl 0xc(%rax), %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x60(%rbp), %rax
subl $0x1, %ecx
movl %ecx, 0x20(%rax)
cmpl $0x0, 0x20(%rax)
jle 0x11f36
movq -0x60(%rbp), %rsi
leaq -0x30(%rbp), %rdi
movl $0x72, %edx
movl $0x3, %ecx
callq 0x140e0
movq -0x60(%rbp), %rdi
addq $0x60, %rdi
leaq -0x30(%rbp), %rsi
callq 0xef90
jmp 0x11f4b
movq -0x60(%rbp), %rsi
movl 0x8(%rsi), %ecx
leaq -0x58(%rbp), %rdi
movl $0x73, %edx
callq 0x13e90
movb $0x1, %al
andb $0x1, %al
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: Mirrvin[P]DragonsResurrectingInc/./specialists/TailSpecialist.cpp
// Function: TailSpecialist::handleReplyOrderPriority(packet_t)
bool handleReplyOrderPriority(packet_t packet) {
        this->orderPriorityReplyCounter -= 1;
        if(this->orderPriorityReplyCounter == 0) {
            this->tryToAcceptOrder();
        }
        return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movl 0x20(%rax), %ecx
subl $0x1, %ecx
movl %ecx, 0x20(%rax)
cmpl $0x0, 0x20(%rax)
jne 0x11fdc
movq -0x10(%rbp), %rdi
callq 0x123f0
movb $0x1, %al
andb $0x1, %al
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)