LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/lolonet[P]Timer/Timer.cpp
// Function: TimerContraller::CheckExpire()
int TimerContraller::CheckExpire(void)
{
	const int64 now = TimerContraller::GetTimeStamp();

	while(!m_TimerQueue.empty())
	{
		const int64 minExpire = m_TimerQueue.top();
		if (minExpire > now)
			break;

		// time out 
		list<TimerObject*> &timeList = m_SameTimerList[minExpire];
		while(!timeList.empty())
		{
			TimerObject *pTimerObj = timeList.front();
			timeList.pop_front();
			pTimerObj->TimeOutNotify();
			delete pTimerObj;
		}

		m_SameTimerList.erase(minExpire);
		m_TimerQueue.pop();
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
callq 0x1afa
movq %rax, -0x38(%rbp)
leaq 0x30(%rbx), %rax
movq %rax, -0x30(%rbp)
leaq -0x40(%rbp), %r15
pushq $0x18
popq %r13
movq 0x30(%rbx), %rax
cmpq 0x38(%rbx), %rax
je 0x19be
movq (%rax), %rax
movq %rax, -0x40(%rbp)
cmpq -0x38(%rbp), %rax
jg 0x19be
movq %rbx, %rdi
movq %r15, %r14
movq %r15, %rsi
callq 0x1a80
movq %rax, %r12
movq (%r12), %rax
cmpq %r12, %rax
je 0x19a5
movq 0x10(%rax), %r15
movq %r12, %rdi
callq 0x1b3a
movq %r15, %rdi
callq 0x181c
movq %r15, %rdi
movq %r13, %rsi
callq 0x1110
jmp 0x197b
movq %rbx, %rdi
movq %r14, %r15
movq %r14, %rsi
callq 0x249c
movq -0x30(%rbp), %rdi
callq 0x1b48
jmp 0x1953
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/lolonet[P]Timer/Timer.cpp
// Function: TimerContraller::GetTimeStamp()
inline int64 TimerContraller::GetTimeStamp(void)
{
	struct timeval tv = {};
	gettimeofday(&tv, NULL);
	const int64 time = tv.tv_sec * TIMESTAMP_PRECISION + tv.tv_usec%TIMESTAMP_PRECISION;
	return time;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
xorps %xmm0, %xmm0
leaq -0x20(%rbp), %rbx
movaps %xmm0, (%rbx)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1160
imulq $0xf4240, (%rbx), %rcx  # imm = 0xF4240
movq 0x8(%rbx), %rax
movl $0xf4240, %esi          # imm = 0xF4240
cqto
idivq %rsi
addq %rdx, %rcx
movq %rcx, %rax
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/bitmat_t.c
// Function: main
int
main(void)
{
    plan_tests(5);
    setvbuf(stdout, 0, _IOLBF, 0);
    int pts[] = { 1,3, 2,5, 4,0, 8,9, 5,20, 6,23, 10,10, 10,11, 10,12, 15,22, 13,23, -1 };
    
    dotest( 8,  8, pts);
    dotest( 8, 24, pts);
    dotest(16, 16, pts);
    dotest(16, 24, pts);
    dotest(24, 24, pts);
 
    return exit_status();
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
pushq $0x5
popq %rdi
callq 0x53b3
movq 0x5b29(%rip), %rax      # 0x8fc8
movq (%rax), %rdi
pushq $0x1
popq %rdx
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x3030
leaq 0x2b5b(%rip), %rbx      # 0x6010
pushq $0x8
popq %rbp
movl %ebp, %edi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x3508
pushq $0x18
popq %r14
movl %ebp, %edi
movl %r14d, %esi
movq %rbx, %rdx
callq 0x3508
pushq $0x10
popq %rbp
movl %ebp, %edi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x3508
movl %ebp, %edi
movl %r14d, %esi
movq %rbx, %rdx
callq 0x3508
movl %r14d, %edi
movl %r14d, %esi
movq %rbx, %rdx
callq 0x3508
popq %rbx
popq %r14
popq %rbp
jmp 0x5651
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/bitmat_t.c
// Function: dotest
void
dotest(int nrows, int ncols, int *xys)
{
    BITMAT *inp = bitmat(nrows, ncols);
    BITMAT *exp = bitmat(ncols, nrows);

    for (; *xys >= 0; xys += 2) {
        bitmat_set(inp, xys[0] % nrows, xys[1] % ncols, 1);
        bitmat_set(exp, xys[1] % ncols, xys[0] % nrows, 1);
    }

    BITMAT *act = bitmat_trans(inp);
    int rc = refcmp(bitmat_ref(act), bitmat_ref(exp));
    ok(!rc, "trans %d x %d", nrows, ncols);
    if (rc) {
        puts("expected:"); prbm(exp);
        puts("actual:"); prbm(act);
    }

    bitmat_destroy(inp);
    bitmat_destroy(exp);
    bitmat_destroy(act);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r13
movl %esi, %r12d
movl %edi, %r15d
callq 0x3720
movq %rax, %rbx
movl %r12d, %edi
movl %r15d, %esi
callq 0x3720
movq %rax, %r14
pushq $0x1
popq %rbp
movl (%r13), %eax
testl %eax, %eax
js 0x3579
cltd
idivl %r15d
movl %edx, %esi
movl 0x4(%r13), %eax
cltd
idivl %r12d
movq %rbx, %rdi
movl %ebp, %ecx
callq 0x37ec
movl (%r13), %ecx
movl 0x4(%r13), %eax
cltd
idivl %r12d
movl %edx, %esi
movl %ecx, %eax
cltd
idivl %r15d
movq %r14, %rdi
movl %ebp, %ecx
callq 0x37ec
addq $0x8, %r13
jmp 0x3535
movq %rbx, %rdi
callq 0x388c
movq %rax, (%rsp)
movq %rax, %rdi
callq 0x387e
movq %rax, %rbp
movq %rdx, %r13
movq %r14, %rdi
callq 0x387e
movq %rdx, %rcx
movq %rbp, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x4663
subq $0x8, %rsp
testl %eax, %eax
je 0x3617
leaq 0x2ac3(%rip), %r10      # 0x607e
leaq 0x2ab1(%rip), %r11      # 0x6073
leaq 0x2aa3(%rip), %r9       # 0x606c
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
pushq %r12
pushq %r15
pushq %r10
pushq $0x38
pushq %r11
callq 0x4aa4
addq $0x30, %rsp
leaq 0x2a9c(%rip), %rdi      # 0x608c
callq 0x32e0
movq %r14, %rdi
callq 0x3677
leaq 0x2a92(%rip), %rdi      # 0x6096
callq 0x32e0
movq (%rsp), %r15
movq %r15, %rdi
callq 0x3677
jmp 0x3651
leaq 0x2a60(%rip), %r10      # 0x607e
leaq 0x2a4e(%rip), %r11      # 0x6073
leaq 0x2a40(%rip), %r9       # 0x606c
pushq $0x1
popq %rsi
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
pushq %r12
pushq %r15
pushq %r10
pushq $0x38
pushq %r11
callq 0x4aa4
addq $0x30, %rsp
movq (%rsp), %r15
movq %rbx, %rdi
callq 0x3787
movq %r14, %rdi
callq 0x3787
movq %r15, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3787
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/bitmat_t.c
// Function: prbm
void
prbm(BITMAT const*bmp)
{
    int r, c, nrows = bitmat_rows(bmp), ncols = bitmat_cols(bmp);

    for (r = 0; r < nrows; ++r) {
        printf("%3d ", r);
        for (c = 0; c < ncols; ++c) {
            if (!(c & 7)) putchar(' ');
            putchar("-#"[bitmat_get(bmp, r, c)]);
        }
        putchar('\n');
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x3876
movl %eax, %ebp
movq %rbx, %rdi
callq 0x387a
movl %eax, %r14d
xorl %r15d, %r15d
testl %eax, %eax
cmovlel %r15d, %r14d
testl %ebp, %ebp
cmovlel %r15d, %ebp
movl %ebp, 0x4(%rsp)
pushq $0x20
popq %r12
leaq 0x29ee(%rip), %rbp      # 0x60a3
cmpl 0x4(%rsp), %r15d
je 0x370e
xorl %r13d, %r13d
leaq 0x29d8(%rip), %rdi      # 0x609e
movl %r15d, %esi
xorl %eax, %eax
callq 0x3050
cmpl %r13d, %r14d
je 0x3701
testb $0x7, %r13b
jne 0x36e3
movl %r12d, %edi
callq 0x3280
movq %rbx, %rdi
movl %r15d, %esi
movl %r13d, %edx
callq 0x37a2
cltq
movsbl (%rax,%rbp), %edi
callq 0x3280
incl %r13d
jmp 0x36d0
pushq $0xa
popq %rdi
callq 0x3280
incl %r15d
jmp 0x36b5
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/bitmat.c
// Function: bitmat
BITMAT*
bitmat(int nrows, int ncols)
{
    assert (nrows % 8 == 0 && ncols % 8 == 0);
    BITMAT *bmp = (BITMAT *) malloc(sizeof*bmp);
    *bmp = (BITMAT) { (uint8_t *) calloc(nrows, ncols/8), nrows, ncols };
    return bmp;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %eax
orl %edi, %eax
testb $0x7, %al
jne 0x376a
movl %esi, %ebx
movl %edi, %ebp
pushq $0x10
popq %rdi
callq 0x3260
movq %rax, %r14
movslq %ebp, %r15
movl %ebx, %eax
sarl $0x3, %eax
movslq %eax, %rsi
movq %r15, %rdi
callq 0x3130
movq %rax, (%r14)
movl %r15d, 0x8(%r14)
movl %ebx, 0xc(%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2935(%rip), %rdi      # 0x60a6
leaq 0x294f(%rip), %rsi      # 0x60c7
leaq 0x2951(%rip), %rcx      # 0x60d0
pushq $0x1e
popq %rdx
callq 0x3120
// File: /workspace/github_cpp_makefile_star2_O2/ctSkennerton[P]fxtract/util/bitmat.c
// Function: bitmat_set
void
bitmat_set(BITMAT *bmp, int row, int col, int val)
{
    assert((unsigned)row < bmp->nrows && (unsigned)col < bmp->ncols);
    col += row * bmp->ncols;
    uint8_t bit = 1 << (col & 7), *at = &bmp->data[col >> 3];
    *at = val ? *at | bit : *at & ~bit;
}

// Assembly:
cmpl %esi, 0x8(%rdi)
jbe 0x3823
movl 0xc(%rdi), %eax
cmpl %edx, %eax
jbe 0x3823
imull %esi, %eax
addl %edx, %eax
movl %eax, %edx
andb $0x7, %dl
movq (%rdi), %rsi
sarl $0x3, %eax
cltq
movzbl (%rsi,%rax), %edi
movl %edi, %r8d
btsl %edx, %r8d
btrl %edx, %edi
testl %ecx, %ecx
cmovnel %r8d, %edi
movb %dil, (%rsi,%rax)
retq
pushq %rax
leaq 0x28be(%rip), %rdi      # 0x60e9
leaq 0x2895(%rip), %rsi      # 0x60c7
leaq 0x2912(%rip), %rcx      # 0x614b
pushq $0x35
popq %rdx
callq 0x3120
// File: /workspace/github_cpp_makefile_star2_O2/bonetblai[P]mdp-engine/rect/./rect.h
// Function: problem_t::next(state_t const&, int, std::vector<std::pair<state_t, float>, std::allocator<std::pair<state_t, float>>>&) const
virtual void next(const state_t &s, Problem::action_t a, std::vector<std::pair<state_t, float> > &outcomes) const {
        ++expansions_;
        outcomes.clear();
        if( a != fwd ) {
            outcomes.reserve(1);
            outcomes.push_back(std::make_pair(s, 1.0));
            if( a == ::left ) {
                outcomes.back().first.left(cols_);
            } else if( a == ::right ) {
                outcomes.back().first.right(cols_);
            }
        } else if( a == fwd ) {
            outcomes.reserve(3);
            if( p_ > 0 ) {
                outcomes.push_back(std::make_pair(s, p_));
                outcomes.back().first.fwd(rows_);
            }
            if( 1 - p_ > 0 ) {
                outcomes.push_back(std::make_pair(s, (1 - p_) / 2));
                outcomes.back().first.left(cols_);
                outcomes.push_back(std::make_pair(s, (1 - p_) / 2));
                outcomes.back().first.right(cols_);
            }
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rcx, %rbx
movl %edx, %ebp
movq %rdi, %r14
incq 0x10(%rdi)
movq %rsi, %r15
movq (%rcx), %rax
cmpq %rax, 0x8(%rcx)
je 0x754b
movq %rax, 0x8(%rbx)
testl %ebp, %ebp
je 0x759b
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x7678
movl (%r15), %eax
movq %rsp, %rsi
movl %eax, (%rsi)
movl $0x3f800000, 0x4(%rsi)  # imm = 0x3F800000
movq %rbx, %rdi
callq 0x77b6
cmpl $0x2, %ebp
je 0x7653
cmpl $0x1, %ebp
jne 0x766b
movq 0x8(%rbx), %rax
movzwl -0x6(%rax), %ecx
testw %cx, %cx
je 0x766b
decl %ecx
jmp 0x7667
pushq $0x3
popq %rsi
movq %rbx, %rdi
callq 0x7678
movss 0x20(%r14), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm0, %xmm1
jae 0x75e7
movl (%r15), %eax
movq %rsp, %rsi
movl %eax, (%rsi)
movss %xmm0, 0x4(%rsi)
movq %rbx, %rdi
callq 0x77b6
movq 0x8(%rbx), %rax
movl 0x18(%r14), %edx
movzwl -0x8(%rax), %ecx
decl %edx
cmpl %ecx, %edx
jbe 0x75e1
incl %ecx
movw %cx, -0x8(%rax)
movss 0x20(%r14), %xmm0
ucomiss 0x13a16(%rip), %xmm0    # 0x1b004
jae 0x766b
movss 0x13a14(%rip), %xmm1    # 0x1b00c
mulss %xmm1, %xmm0
subss %xmm0, %xmm1
movl (%r15), %eax
movq %rsp, %rsi
movl %eax, (%rsi)
movss %xmm1, 0x4(%rsi)
movq %rbx, %rdi
callq 0x77b6
movq 0x8(%rbx), %rax
movzwl -0x6(%rax), %ecx
testw %cx, %cx
je 0x7628
decl %ecx
movw %cx, -0x6(%rax)
movss 0x20(%r14), %xmm0
movss 0x139d6(%rip), %xmm1    # 0x1b00c
mulss %xmm1, %xmm0
subss %xmm0, %xmm1
movl (%r15), %eax
movq %rsp, %rsi
movl %eax, (%rsi)
movss %xmm1, 0x4(%rsi)
movq %rbx, %rdi
callq 0x77b6
movq 0x8(%rbx), %rax
movl 0x1c(%r14), %edx
movzwl -0x6(%rax), %ecx
decl %edx
cmpl %ecx, %edx
jbe 0x766b
incl %ecx
movw %cx, -0x6(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Tumelo4[P]-Single-Linked-List-In-CPP/LinkedList.cpp
// Function: LinkedList::~LinkedList()
LinkedList::~LinkedList()
{
	while(head)
	{
		Node* tmp = head;
		head = head->next;
		delete tmp;
		tmp = NULL;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
pushq $0x10
popq %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x4045c8
movq (%rdi), %rax
movq %rax, (%rbx)
movq %r14, %rsi
callq 0x404930
jmp 0x4045b0
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Tumelo4[P]-Single-Linked-List-In-CPP/LinkedList.cpp
// Function: LinkedList::prepend(int)
void LinkedList::prepend(int data)
{
	// check if link is empty
	if(!head)
	{
		head = new Node(data);
	}
	else
	{
		Node* node = new Node(data);
		node->next = head;
		head = node;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %r15d
movq %rdi, %r14
movq (%rdi), %r12
pushq $0x10
popq %rdi
callq 0x405630
movq %rax, %rbx
testq %r12, %r12
je 0x40461b
movq %rbx, %rdi
movl %r15d, %esi
callq 0x404914
movq (%r14), %rax
movq %rax, (%rbx)
jmp 0x404626
movq %rbx, %rdi
movl %r15d, %esi
callq 0x404914
movq %rbx, (%r14)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x404634
movq %rax, %r14
pushq $0x10
popq %rsi
movq %rbx, %rdi
callq 0x404930
movq %r14, %rdi
callq 0x4a5500
// File: /workspace/github_cpp_makefile_star2_O2/Tumelo4[P]-Single-Linked-List-In-CPP/LinkedList.cpp
// Function: LinkedList::indexInsertion(int, int)
void LinkedList::indexInsertion(int data, int index)
{
	if (index == 0)
	{
		this->prepend(data);
	}
	else if ( index == size())
	{
		this->append(data);
	}
	else
	{
		int count = 0;
		Node* curr = head;
		Node* prev = NULL;
		for(;count != index; count++, prev = curr, curr=curr->next);
		Node* newNode = new Node(data);
		newNode->next = curr;
		prev->next = newNode;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r15
testl %edx, %edx
je 0x404689
movl %edx, %r14d
movq %r15, %rdi
callq 0x4045ce
cmpl %r14d, %eax
jne 0x4046a1
movq %r15, %rdi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4046f6
movq %r15, %rdi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4045e4
incl %r14d
xorl %r12d, %r12d
movq %r12, %r13
movq (%r15), %r12
movq %r12, %r15
decl %r14d
jne 0x4046a7
pushq $0x10
popq %rdi
callq 0x405630
movq %rax, %r14
movq %rax, %rdi
movl %ebx, %esi
callq 0x404914
movq %r12, (%r14)
movq %r14, (%r13)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
pushq $0x10
popq %rsi
movq %r14, %rdi
callq 0x404930
movq %rbx, %rdi
callq 0x4a5500
// File: /workspace/github_cpp_makefile_star2_O2/Tumelo4[P]-Single-Linked-List-In-CPP/LinkedList.cpp
// Function: LinkedList::append(int)
void LinkedList::append(int data)
{
	// check if head is null
	if(!head)
	{
		head = new Node(data);
	}
	else
	{
		Node* curr = head;
		for(;curr->next != NULL; curr = curr->next);
		curr->next = new Node(data);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movq (%rdi), %rax
testq %rax, %rax
je 0x40472e
movq %rax, %r15
movq (%rax), %rax
testq %rax, %rax
jne 0x40470b
pushq $0x10
popq %rdi
callq 0x405630
movq %rax, %rbx
movq %rax, %rdi
movl %r14d, %esi
callq 0x404914
jmp 0x404747
movq %rdi, %r15
pushq $0x10
popq %rdi
callq 0x405630
movq %rax, %rbx
movq %rax, %rdi
movl %r14d, %esi
callq 0x404914
movq %rbx, (%r15)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x404757
movq %rax, %r14
pushq $0x10
popq %rsi
movq %rbx, %rdi
callq 0x404930
movq %r14, %rdi
callq 0x4a5500
// File: /workspace/github_cpp_makefile_star2_O2/Tumelo4[P]-Single-Linked-List-In-CPP/LinkedList.cpp
// Function: operator<<(std::ostream&, LinkedList&)
ostream& operator<<(ostream &os, LinkedList&obj)
{
	for(Node* curr = obj.head; curr != NULL; curr=curr->next)
	{

		if(curr->next == NULL)
		{
			os<<curr->getData();
		}
		else
		{
			os<<curr->getData()<<",";
		}
	}
	return os;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x17187f(%rip), %r15    # 0x576004
movq (%r14), %r14
testq %r14, %r14
je 0x4047b4
movq (%r14), %r12
movq %r14, %rdi
callq 0x404922
movq %rbx, %rdi
movl %eax, %esi
callq 0x46dcb0
testq %r12, %r12
je 0x404785
movq %rax, %rdi
movq %r15, %rsi
callq 0x46d910
jmp 0x404785
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Tumelo4[P]-Single-Linked-List-In-CPP/LinkedList.cpp
// Function: LinkedList::reverse()
void LinkedList::reverse()
{
	if( head != NULL && size()> 1)
	{
		Node* curr = head;
		Node* prev = NULL;
		Node* prevprev = NULL;
		bool flag = false;

		for(;curr != NULL;prevprev = prev,prev=curr,curr = curr->next)
		{
			if(flag == false)
			{
				if(prevprev != NULL)
				{
					prevprev->next = NULL;
					prev->next = prevprev;
					flag = true;
				}
			}
			else
			{
				prev->next = prevprev;
			}
		}
		if (size() == 2)
		{
			prevprev->next = NULL;
			prev->next = prevprev;
		}
		else
		{
			prev->next = prevprev;
		}
		head = prev;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq (%rdi), %r12
testq %r12, %r12
je 0x404824
movq %rdi, %rbx
callq 0x4045ce
cmpl $0x2, %eax
jl 0x404824
xorl %eax, %eax
xorl %r15d, %r15d
xorl %ecx, %ecx
movq %rax, %r14
testq %r12, %r12
je 0x40480d
movq %r12, %rax
testb $0x1, %cl
jne 0x404802
testq %r15, %r15
je 0x404805
andq $0x0, (%r15)
movb $0x1, %cl
movq %r15, (%r14)
movq (%rax), %r12
movq %r14, %r15
jmp 0x4047e7
movq %rbx, %rdi
callq 0x4045ce
cmpl $0x2, %eax
jne 0x40481e
andq $0x0, (%r15)
movq %r15, (%r14)
movq %r14, (%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/Tumelo4[P]-Single-Linked-List-In-CPP/Main.cpp
// Function: main
int main()
{
	LinkedList* linkedList = new LinkedList();

	linkedList->append(2);
	linkedList->append(4);
	linkedList->prepend(1);
	linkedList->indexInsertion(0,0);
	linkedList->indexInsertion(5,4);
	linkedList->indexInsertion(3,3);
	//cout<<linkedList<<"\n";  output memory
	cout<<*linkedList<<"\n";
	linkedList->reverse();
	cout<<*linkedList<<"\n";
	delete linkedList;
	linkedList = NULL;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
pushq $0x8
popq %rdi
callq 0x405630
movq %rax, %rbx
movq %rax, %rdi
callq 0x404598
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x4046f6
pushq $0x4
popq %r14
movq %rbx, %rdi
movl %r14d, %esi
callq 0x4046f6
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x4045e4
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x40464a
pushq $0x5
popq %rsi
movq %rbx, %rdi
movl %r14d, %edx
callq 0x40464a
pushq $0x3
popq %rdx
movq %rbx, %rdi
movl %edx, %esi
callq 0x40464a
movq $0x5e3440, %r14         # imm = 0x5E3440
movq %r14, %rdi
movq %rbx, %rsi
callq 0x40476d
leaq 0x1782f8(%rip), %r15    # 0x57cbaa
movq %rax, %rdi
movq %r15, %rsi
callq 0x46d910
movq %rbx, %rdi
callq 0x4047c0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x40476d
movq %rax, %rdi
movq %r15, %rsi
callq 0x46d910
movq %rbx, %rdi
callq 0x4045a2
pushq $0x8
popq %rsi
movq %rbx, %rdi
callq 0x404930
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
pushq $0x8
popq %rsi
movq %rbx, %rdi
callq 0x404930
movq %r14, %rdi
callq 0x4a5500
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/devanshdalal[P]cloud-computing-concepts-part-2/MP1Node.cpp
// Function: MP1Node::MP1Node(Member*, Params*, EmulNet*, Log*, Address*)
MP1Node::MP1Node(Member *member, Params *params, EmulNet *emul, Log *log, Address *address)
{
    for (int i = 0; i < 6; i++)
    {
        NULLADDR[i] = 0;
    }
    this->memberNode = member;
    this->this_node_ = *(int *)address;
    // std::cout << "this_node_: " << this_node_ << "\n";
    this->emulNet = emul;
    this->log = log;
    this->par = params;
    this->memberNode->addr = *address;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
leaq 0x17460(%rip), %rax     # 0x1ac38
movq %rax, (%rdi)
leaq 0x30(%rdi), %rbx
leaq 0x60(%rdi), %rax
movq %rax, 0x30(%rdi)
pushq $0x1
popq %rax
movq %rax, 0x38(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x40(%rdi)
movl $0x3f800000, %r10d      # imm = 0x3F800000
movl %r10d, 0x50(%rdi)
movups %xmm0, 0x58(%rdi)
leaq 0x68(%rdi), %r14
leaq 0x98(%rdi), %r11
movq %r11, 0x68(%rdi)
movq %rax, 0x70(%rdi)
movups %xmm0, 0x78(%rdi)
movl %r10d, 0x88(%rdi)
movups %xmm0, 0x90(%rdi)
andl $0x0, 0xa0(%rdi)
pushq $-0x6
popq %rax
testq %rax, %rax
je 0x3841
movb $0x0, 0x2e(%rdi,%rax)
incq %rax
jmp 0x3832
movq %rsi, 0x20(%rdi)
movl (%r9), %eax
movl %eax, 0xa4(%rdi)
movq %rcx, 0x8(%rdi)
movq %r8, 0x10(%rdi)
movq %rdx, 0x18(%rdi)
addq $0x8, %rsi
movq %rsi, %rdi
movq %r9, %rsi
callq 0xa4f2
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r15
movq %r14, %rdi
callq 0x4820
movq %rbx, %rdi
callq 0x48d4
movq %r15, %rdi
callq 0x3450
// File: /workspace/github_cpp_makefile_star2_O2/devanshdalal[P]cloud-computing-concepts-part-2/MP1Node.cpp
// Function: MP1Node::introduceSelfToGroup(Address*)
int MP1Node::introduceSelfToGroup(Address *joinaddr)
{
#ifdef DEBUGLOG
    static char s[1024];
#endif

    if (0 == memcmp((char *)&(memberNode->addr.addr), (char *)&(joinaddr->addr), sizeof(memberNode->addr.addr)))
    {
        // I am the group booter (first process to join the group). Boot up the group
#ifdef DEBUGLOG
        log->LOG(&memberNode->addr, "Starting up group...");
#endif
        memberNode->inGroup = true;
        AddNode(this_node_);
    }
    else
    {
        size_t msgsize = sizeof(MessageHdr) + sizeof(joinaddr->addr) + sizeof(long) + 1;
        // cout << "msgsize: " << sizeof(MessageHdr) << " " << sizeof(joinaddr->addr) << " " << sizeof(long) << " " << 1 << "\n";
        MessageHdr *msg = (MessageHdr *)malloc(msgsize * sizeof(char));

        // create JOINREQ message: format of data is {struct Address myaddr}
        msg->msgType = JOINREQ;
        memcpy((char *)(msg + 1), &memberNode->addr.addr, sizeof(memberNode->addr.addr));
        memcpy((char *)(msg + 1) + 1 + sizeof(memberNode->addr.addr), &memberNode->heartbeat, sizeof(long));

#ifdef DEBUGLOG
        sprintf(s, "Trying to join...");
        log->LOG(&memberNode->addr, s);
#endif

        // send JOINREQ message to introducer member
        emulNet->ENsend(&memberNode->addr, joinaddr, (char *)msg, msgsize);
        free(msg);
    }

    return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq 0x20(%rdi), %r13
leaq 0x8(%r13), %r15
pushq $0x6
popq %rdx
movq %r15, %rdi
callq 0x3290
testl %eax, %eax
je 0x3a27
pushq $0x13
popq %rdi
callq 0x3360
movq %rax, %r12
andl $0x0, (%rax)
movl (%r15), %eax
movl %eax, 0x4(%r12)
movzwl 0x4(%r15), %eax
movw %ax, 0x8(%r12)
movq 0x18(%r13), %rax
movq %rax, 0xb(%r12)
movups 0xe659(%rip), %xmm0     # 0x12036
movaps %xmm0, 0x178cc(%rip)    # 0x1b2b0
movw $0x2e, 0x178d3(%rip)    # 0x1b2c0
leaq 0x178bc(%rip), %rdx     # 0x1b2b0
movq 0x10(%rbx), %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x9a22
movq 0x8(%rbx), %rdi
movq 0x20(%rbx), %rsi
addq $0x8, %rsi
pushq $0x13
popq %r8
movq %r14, %rdx
movq %r12, %rcx
callq 0x5b9a
movq %r12, %rdi
callq 0x3300
jmp 0x3a52
movq 0x10(%rbx), %rdi
leaq 0xe5ef(%rip), %rdx      # 0x12021
movq %r15, %rsi
xorl %eax, %eax
callq 0x9a22
movq 0x20(%rbx), %rax
movb $0x1, 0xf(%rax)
movl 0xa4(%rbx), %esi
movq %rbx, %rdi
callq 0x3a74
pushq $0x1
popq %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/devanshdalal[P]cloud-computing-concepts-part-2/MP1Node.cpp
// Function: MP1Node::AddNode(int)
void MP1Node::AddNode(int node)
{
    if (m_.find(node) != m_.end())
        return;
    m_.insert(node);
    memberNode->memberList.emplace_back(node, 0);
    if (node == this_node_)
    {
        memberNode->inGroup = 1;
    }
    Address a(std::to_string(node) + ":0");
#ifdef DEBUGLOG
    log->logNodeAdd(&memberNode->addr, &a);
#endif
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x50, %rsp
movq %rdi, %rbx
leaq 0x4(%rsp), %rax
movl %esi, (%rax)
leaq 0x30(%rdi), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x4dca
testq %rax, %rax
jne 0x3b34
leaq 0x4(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x4e46
movq 0x20(%rbx), %rdi
addq $0x28, %rdi
leaq 0x10(%rsp), %rdx
andl $0x0, (%rdx)
movq %r15, %rsi
callq 0x4652
movl (%r15), %esi
cmpl 0xa4(%rbx), %esi
jne 0x3ada
movq 0x20(%rbx), %rax
movb $0x1, 0xf(%rax)
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x46ad
leaq 0xe55a(%rip), %rdx      # 0x12048
leaq 0x30(%rsp), %rdi
movq %r14, %rsi
callq 0x468e
leaq 0xa(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x4706
leaq 0x30(%rsp), %rdi
callq 0x3110
leaq 0x10(%rsp), %rdi
callq 0x3110
movq 0x10(%rbx), %rdi
movq 0x20(%rbx), %rsi
addq $0x8, %rsi
leaq 0xa(%rsp), %rdx
callq 0x9cc6
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x3110
jmp 0x3b50
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x3450
// File: /workspace/github_cpp_makefile_star2_O2/devanshdalal[P]cloud-computing-concepts-part-2/MP1Node.cpp
// Function: MP1Node::nodeLoopOps()
void MP1Node::nodeLoopOps()
{
    // std::cout << "Start nodeLoopOps " << this_node_ << " " << last_detection_ << "\n";
    if (!memberNode->memberList.size())
        return;
    const auto current_time = par->getcurrtime();
    if (last_detection_ + DETECTION_INTERVAL > current_time)
    {
        last_detection_ = current_time;
        int x = rand() % memberNode->memberList.size();
        auto &e = memberNode->memberList[x];
        const int &id = e.getid();
        const int &port = e.getport();

        MessageHdr *msg = CreateMessage(PING, this_node_, id);
        Address target_address = std::to_string(id) + ":" + std::to_string(port);

        if (!emulNet->ENsend(&memberNode->addr, &target_address, (char *)msg, MSGSIZE))
        {
            // local_state_[id] = {TIMEOUTWAITING, current_time, -1};
            // failed, so send.
        }
        else
        {
        }
        local_state_[id] = {TIMEOUTWAITING, current_time + WAITING_TIMEOUT, -1};
    }

    ModifyLocalState();

    // std::cout << "End nodeLoopOps\n";
    return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq 0x20(%rdi), %rax
movq 0x30(%rax), %rcx
cmpq 0x28(%rax), %rcx
je 0x3d2d
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
callq 0xa4d8
movl %eax, %ebp
movl 0xa0(%rbx), %eax
addl $0x1e, %eax
cmpl %ebp, %eax
jle 0x3d25
movl %ebp, 0xa0(%rbx)
callq 0x30a0
movslq %eax, %rcx
movq 0x20(%rbx), %rax
movq 0x28(%rax), %rdi
movq 0x30(%rax), %rax
subq %rdi, %rax
pushq $0x18
popq %rsi
cqto
idivq %rsi
movq %rax, %rsi
movq %rcx, %rax
xorl %edx, %edx
divq %rsi
movslq %edx, %rax
imulq $0x18, %rax, %r14
addq %rdi, %r14
movq %r14, %rdi
callq 0xa560
movl %eax, %r12d
movl %eax, 0xc(%rsp)
movq %r14, %rdi
callq 0xa564
movl %eax, %r15d
movl 0xa4(%rbx), %esi
pushq $0x3
popq %rdi
movl %r12d, %edx
callq 0x4370
movq %rax, %r14
leaq 0x78(%rsp), %r13
movq %r13, %rdi
movl %r12d, %esi
callq 0x46ad
leaq 0xf0fe(%rip), %rdx      # 0x12d81
leaq 0x38(%rsp), %rdi
movq %r13, %rsi
callq 0x468e
movswl %r15w, %esi
leaq 0x18(%rsp), %rdi
callq 0x46ad
leaq 0x58(%rsp), %rdi
leaq 0x38(%rsp), %rsi
leaq 0x18(%rsp), %rdx
callq 0x47b9
leaq 0x12(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x4706
leaq 0x58(%rsp), %rdi
callq 0x3110
leaq 0x18(%rsp), %rdi
callq 0x3110
leaq 0x38(%rsp), %rdi
callq 0x3110
leaq 0x78(%rsp), %rdi
callq 0x3110
movq 0x8(%rbx), %rdi
movq 0x20(%rbx), %rsi
addq $0x8, %rsi
leaq 0x12(%rsp), %rdx
pushq $0xc
popq %r8
movq %r14, %rcx
callq 0x5b9a
addl $0xa, %ebp
movslq %ebp, %r14
leaq 0x68(%rbx), %rdi
leaq 0xc(%rsp), %rsi
callq 0x53c0
andl $0x0, (%rax)
movq %r14, 0x8(%rax)
orl $-0x1, 0x10(%rax)
movq %rbx, %rdi
callq 0x4392
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x3110
jmp 0x3d51
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x3110
jmp 0x3d60
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x3110
jmp 0x3d6f
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x3450
nop
// File: /workspace/github_cpp_makefile_star2_O2/devanshdalal[P]cloud-computing-concepts-part-2/MP1Node.cpp
// Function: MP1Node::PublishToAll(MessageHdr const&, unsigned long)
void MP1Node::PublishToAll(const MessageHdr &msg, size_t size)
{
    // std::cout << "Start PublishToAll "
    // << " " << this_node_ << "," << msg.msgType << "\n";
    for (int i = 0; i < memberNode->memberList.size(); ++i)
    {
        auto &e = memberNode->memberList[i];
        if (e.getid() == this_node_)
            continue;
        Address a(std::to_string(e.getid()) + ":" + std::to_string(e.getport()));
        if (!emulNet->ENsend(&memberNode->addr, &a, (char *)&msg, size))
        {
            // failed to send to this node.
        }
    }
    // std::cout << "End PublishToAll\n";
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdx, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq %rdi, %r15
xorl %ebx, %ebx
leaq 0x68(%rsp), %r13
leaq 0x22(%rsp), %r12
xorl %ebp, %ebp
movq 0x20(%r15), %rax
movq 0x28(%rax), %r14
movq 0x30(%rax), %rax
subq %r14, %rax
cqto
pushq $0x18
popq %rcx
idivq %rcx
cmpq %rbp, %rax
jbe 0x4319
addq %rbx, %r14
movq %r14, %rdi
callq 0xa560
cmpl 0xa4(%r15), %eax
je 0x430d
movq %rbx, 0x18(%rsp)
movq %r13, %rbx
movq %r14, %rdi
callq 0xa560
leaq 0x48(%rsp), %r13
movq %r13, %rdi
movl %eax, %esi
callq 0x46ad
leaq 0x28(%rsp), %rdi
movq %r13, %rsi
leaq 0xeaf9(%rip), %rdx      # 0x12d81
callq 0x468e
movq %r14, %rdi
callq 0xa564
movq %rbx, %r13
movswl %ax, %esi
movq %rbx, %rdi
callq 0x46ad
leaq 0x88(%rsp), %rbx
movq %rbx, %rdi
leaq 0x28(%rsp), %rsi
movq %r13, %rdx
callq 0x47b9
movq %r12, %rdi
movq %rbx, %rsi
callq 0x4706
movq %rbx, %rdi
callq 0x3110
movq %r13, %rdi
callq 0x3110
leaq 0x28(%rsp), %rdi
callq 0x3110
leaq 0x48(%rsp), %rdi
callq 0x3110
movq 0x8(%r15), %rdi
movq 0x20(%r15), %rsi
addq $0x8, %rsi
movq %r12, %rdx
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %r8
callq 0x5b9a
movq 0x18(%rsp), %rbx
incq %rbp
addq $0x18, %rbx
jmp 0x4222
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x3110
jmp 0x4340
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x3110
jmp 0x4354
movq %rax, %rbx
jmp 0x435e
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x3110
leaq 0x48(%rsp), %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x3450
// File: /workspace/github_cpp_makefile_star2_O2/devanshdalal[P]cloud-computing-concepts-part-2/MP1Node.cpp
// Function: (anonymous namespace)::CreateMessage(MsgTypes, int, int)
MessageHdr *CreateMessage(MsgTypes type, int src, int target)
    {
        MessageHdr *msg = (MessageHdr *)malloc(MSGSIZE * sizeof(char));
        msg->msgType = type;
        memcpy((char *)(msg + 1), &src, sizeof(int));
        memcpy((char *)(msg + 1) + sizeof(int), &target, sizeof(int));
        return msg;
    }

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebx
movl %esi, %ebp
movl %edi, %r14d
pushq $0xc
popq %rdi
callq 0x3360
movl %r14d, (%rax)
movl %ebp, 0x4(%rax)
movl %ebx, 0x8(%rax)
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/devanshdalal[P]cloud-computing-concepts-part-2/MP1Node.cpp
// Function: MP1Node::ModifyLocalState()
void MP1Node::ModifyLocalState()
{
    // std::cout << "Start ModifyLocalState\n";
    const auto current_time = par->getcurrtime();
    for (auto it = local_state_.begin(); it != local_state_.end();)
    {
        const auto &node_status = it->second;
        // std::cout << "node_status.state: " << node_status.state << " " << this_node_ << " " << it->first << "\n";
        // std::cout << "node_status: " << node_status.timeout << " " << current_time << "\n";
        if (node_status.timeout <= current_time)
        {
            switch (node_status.state)
            {
            case FINALWAITING:
            {
                it = local_state_.erase(it);
            }
            break;
            case SWIMWAITING:
            {
                // remove
                auto *message = CreateMessage(FAILED, it->first, this_node_);
                PublishToAll(*message, MSGSIZE);
                free(message);
                it = local_state_.erase(it);
            }
            break;
            case TIMEOUTWAITING:
            {
                PingK(it->first);
                local_state_[it->first] = {SWIMWAITING, current_time + WAITING_TIMEOUT, -1};
            }
            break;
            default:
                break;
            }
            // it = local_state_.erase(it);
        }
        else
        {
            ++it;
        }
    }
    // std::cout << "End ModifyLocalState\n";
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
callq 0xa4d8
leaq 0x68(%rbx), %r14
movq 0x78(%rbx), %r15
movslq %eax, %rbp
leal 0xa(%rbp), %eax
movslq %eax, %r12
leaq 0x8(%r15), %r13
testq %r15, %r15
je 0x444b
cmpq %rbp, 0x18(%r15)
jg 0x4408
movl 0x10(%r15), %eax
testl %eax, %eax
je 0x43e1
cmpl $0x1, %eax
je 0x440d
cmpl $0x2, %eax
jne 0x43be
jmp 0x4438
movl (%r13), %esi
movq %rbx, %rdi
callq 0x445a
movq %r14, %rdi
movq %r13, %rsi
callq 0x53c0
movl $0x1, (%rax)
movq %r12, 0x8(%rax)
orl $-0x1, 0x10(%rax)
jmp 0x43be
movq (%r15), %r15
jmp 0x43ba
movl 0x8(%r15), %esi
movl 0xa4(%rbx), %edx
pushq $0x2
popq %rdi
callq 0x4370
movq %rax, %r13
movq %rbx, %rdi
movq %rax, %rsi
pushq $0xc
popq %rdx
callq 0x41f6
movq %r13, %rdi
callq 0x3300
movq %r14, %rdi
movq %r15, %rsi
callq 0x59ae
movq %rax, %r15
jmp 0x43ba
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/devanshdalal[P]cloud-computing-concepts-part-2/MP1Node.cpp
// Function: MP1Node::PingK(int)
void MP1Node::PingK(int node_id)
{
    // std::cout << "Start PingK " << this_node_ << " " << node_id << "\n";
    // const auto current_time = par->getcurrtime();
    for (int i = 0; i < SWIMK; ++i)
    {
        int new_x = rand() % memberNode->memberList.size();
        auto &e = memberNode->memberList[new_x];
        const int &new_id = e.getid();
        if (new_id == this_node_ || new_id == node_id)
        {
            --i;
            continue;
        }
        const int &port = e.getport();
        Address a(std::to_string(new_id) + ":" + std::to_string(port));
        MessageHdr *msg = CreateMessage(PING, this_node_, node_id);
        if (!emulNet->ENsend(&memberNode->addr, &a, (char *)msg, MSGSIZE))
        {
            // std::cout << "SWIMK ENsend failed\n";
            // failed to send to this node.
        }
        else
        {
            // std::cout << "SWIMK ENsend passed" << new_id << "\n";
        }
        free(msg);
    }
    // std::cout << "End PingK\n";
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %esi, %ebx
movq %rdi, %r14
xorl %ebp, %ebp
pushq $0x18
popq %r12
cmpl $0x2, %ebp
jae 0x458d
callq 0x30a0
movslq %eax, %rcx
movq 0x20(%r14), %rax
movq 0x28(%rax), %rdi
movq 0x30(%rax), %rax
subq %rdi, %rax
cqto
idivq %r12
movq %rax, %rsi
movq %rcx, %rax
xorl %edx, %edx
divq %rsi
movslq %edx, %rax
imulq $0x18, %rax, %r15
addq %rdi, %r15
movq %r15, %rdi
callq 0xa560
cmpl %ebx, %eax
je 0x4476
movl %eax, %r13d
cmpl 0xa4(%r14), %eax
je 0x4476
movq %r15, %rdi
callq 0xa564
movl %eax, %r15d
leaq 0x8(%rsp), %rdi
movl %r13d, %esi
callq 0x46ad
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
leaq 0xe890(%rip), %rdx      # 0x12d81
callq 0x468e
movswl %r15w, %esi
leaq 0x48(%rsp), %r15
movq %r15, %rdi
callq 0x46ad
leaq 0x68(%rsp), %r13
movq %r13, %rdi
leaq 0x28(%rsp), %rsi
movq %r15, %rdx
callq 0x47b9
leaq 0x2(%rsp), %rdi
movq %r13, %rsi
callq 0x4706
movq %r13, %rdi
callq 0x3110
movq %r15, %rdi
callq 0x3110
leaq 0x28(%rsp), %rdi
callq 0x3110
leaq 0x8(%rsp), %rdi
callq 0x3110
movl 0xa4(%r14), %esi
pushq $0x3
popq %rdi
movl %ebx, %edx
callq 0x4370
movq %rax, %r15
movq 0x8(%r14), %rdi
movq 0x20(%r14), %rsi
addq $0x8, %rsi
leaq 0x2(%rsp), %rdx
movq %rax, %rcx
pushq $0xc
popq %r8
callq 0x5b9a
movq %r15, %rdi
callq 0x3300
incl %ebp
jmp 0x4476
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x3110
jmp 0x45b1
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x3110
jmp 0x45c5
movq %rax, %rbx
jmp 0x45cf
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x3110
leaq 0x8(%rsp), %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x3450
nop
// File: /workspace/github_cpp_makefile_star2_O2/devanshdalal[P]cloud-computing-concepts-part-2/MP2Node.cpp
// Function: PrintRing(std::vector<Node, std::allocator<Node>>)
void PrintRing(std::vector<Node> ring)
{
	std::cout << "RING:";
	for (auto &node : ring)
	{
		std::cout << " " << node.getAddress()->getAddress();
	}
	std::cout << "\n";
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r15
movq 0xeab8(%rip), %rbx      # 0x1afc8
leaq 0x6745(%rip), %rsi      # 0x12c5c
movq %rbx, %rdi
callq 0x3250
movq (%r15), %r14
movq 0x8(%r15), %rbp
leaq 0x5d89(%rip), %r15      # 0x122b6
leaq 0x8(%rsp), %r12
cmpq %rbp, %r14
je 0xc571
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3250
movq %rax, %r13
movq %r14, %rdi
callq 0x107d2
movq %r12, %rdi
movq %rax, %rsi
callq 0x8da4
movq %r13, %rdi
movq %r12, %rsi
callq 0x3210
movq %r12, %rdi
callq 0x3110
addq $0x20, %r14
jmp 0xc532
movq 0xea50(%rip), %rdi      # 0x1afc8
leaq 0x5d76(%rip), %rsi      # 0x122f5
callq 0x3250
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x3450
// File: /workspace/github_cpp_makefile_star2_O2/devanshdalal[P]cloud-computing-concepts-part-2/MP2Node.cpp
// Function: MP2Node::MP2Node(Member*, Params*, EmulNet*, Log*, Address*)
MP2Node::MP2Node(Member *memberNode, Params *par, EmulNet *emulNet, Log *log, Address *address)
{
	this->memberNode = memberNode;
	this->par = par;
	this->emulNet = emulNet;
	this->log = log;
	ht = new HashTable();
	secondary = new HashTable();
	tertiary = new HashTable();
	this->memberNode->addr = *address;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r14
movq %rdi, %rbx
leaq 0x88(%rdi), %rax
andl $0x0, 0x88(%rdi)
andq $0x0, 0x90(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movups %xmm0, 0x10(%rdi)
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x30(%rdi)
andq $0x0, 0x40(%rdi)
movq %rax, 0x98(%rdi)
movq %rax, 0xa0(%rdi)
andq $0x0, 0xa8(%rdi)
andl $0x0, 0xb0(%rdi)
movq %rsi, 0x60(%rdi)
movq %rdx, 0x68(%rdi)
movq %rcx, 0x70(%rdi)
movq %r8, 0x78(%rdi)
pushq $0x38
popq %rdi
callq 0x3270
movq %rax, %r15
movq %rax, %rdi
callq 0x107e8
movq %r15, 0x48(%rbx)
pushq $0x38
popq %rdi
callq 0x3270
movq %rax, %r15
movq %rax, %rdi
callq 0x107e8
movq %r15, 0x50(%rbx)
pushq $0x38
popq %rdi
callq 0x3270
movq %rax, %r15
movq %rax, %rdi
callq 0x107e8
movq %r15, 0x58(%rbx)
movq 0x60(%rbx), %rdi
addq $0x8, %rdi
movq %r14, %rsi
callq 0xa4f2
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0xc675
jmp 0xc675
movq %rax, %r14
pushq $0x38
popq %rsi
movq %r15, %rdi
callq 0x3280
jmp 0xc688
movq %rax, %r14
leaq 0x30(%rbx), %r15
leaq 0x18(%rbx), %r12
leaq 0x80(%rbx), %rdi
callq 0xf5be
movq %r15, %rdi
callq 0x8f1a
movq %r12, %rdi
callq 0x8f1a
movq %rbx, %rdi
callq 0x8f1a
movq %r14, %rdi
callq 0x3450
// File: /workspace/github_cpp_makefile_star2_O2/devanshdalal[P]cloud-computing-concepts-part-2/MP2Node.cpp
// Function: MP2Node::~MP2Node()
MP2Node::~MP2Node()
{
	delete ht;
	delete secondary;
	delete tertiary;
	delete memberNode;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x48(%rdi), %rdi
testq %rdi, %rdi
je 0xc6cf
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x50(%rbx), %rdi
testq %rdi, %rdi
je 0xc6de
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x58(%rbx), %rdi
testq %rdi, %rdi
je 0xc6ed
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x60(%rbx), %rdi
testq %rdi, %rdi
je 0xc6fc
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x80(%rbx), %rdi
callq 0xf5be
leaq 0x30(%rbx), %rdi
callq 0x8f1a
leaq 0x18(%rbx), %rdi
callq 0x8f1a
movq %rbx, %rdi
popq %rbx
jmp 0x8f1a
nop
// File: /workspace/github_cpp_makefile_star2_O2/devanshdalal[P]cloud-computing-concepts-part-2/MP2Node.cpp
// Function: MP2Node::createKeyValue(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, ReplicaType)
bool MP2Node::createKeyValue(string key, string value, ReplicaType replica)
{
	/*
	 * Implement this
	 */
	// Insert key, value, replicaType into the hash table

	switch (replica)
	{
	case ReplicaType::PRIMARY:
	{
		ht->create(key, value);
		break;
	}
	case ReplicaType::SECONDARY:
	{
		secondary->create(key, value);
		break;
	}
	case ReplicaType::TERTIARY:
	{
		tertiary->create(key, value);
		break;
	}
	default:
		break;
	}
	return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdx, %r15
cmpl $0x2, %ecx
je 0xde4f
cmpl $0x1, %ecx
je 0xde16
testl %ecx, %ecx
jne 0xde93
movq 0x48(%rdi), %r12
leaq 0x48(%rsp), %rbx
movq %rbx, %rdi
callq 0x3370
leaq 0xa8(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x3370
leaq 0x48(%rsp), %rbx
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x10838
jmp 0xde83
movq 0x50(%rdi), %r12
leaq 0x28(%rsp), %rbx
movq %rbx, %rdi
callq 0x3370
leaq 0x88(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x3370
leaq 0x28(%rsp), %rbx
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x10838
jmp 0xde83
movq 0x58(%rdi), %r12
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x3370
leaq 0x68(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x3370
leaq 0x8(%rsp), %rbx
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x10838
movq %r14, %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x3110
movb $0x1, %al
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r14
leaq 0xa8(%rsp), %rdi
callq 0x3110
leaq 0x48(%rsp), %rbx
jmp 0xdeed
movq %rax, %r14
leaq 0x68(%rsp), %rdi
callq 0x3110
leaq 0x8(%rsp), %rbx
jmp 0xdeed
movq %rax, %r14
leaq 0x88(%rsp), %rdi
callq 0x3110
leaq 0x28(%rsp), %rbx
jmp 0xdeed
jmp 0xdeea
jmp 0xdeea
movq %rax, %r14
movq %rbx, %rdi
callq 0x3110
movq %r14, %rdi
callq 0x3450
nop
// File: /workspace/github_cpp_makefile_star2_O2/devanshdalal[P]cloud-computing-concepts-part-2/MP2Node.cpp
// Function: MP2Node::readKey(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string MP2Node::readKey(string key)
{
	/*
	 * Implement this
	 */
	// Read key from local hash table and return value
	if (ht->count(key))
	{
		return ht->read(key);
	}
	if (secondary->count(key))
	{
		return secondary->read(key);
	}
	return tertiary->read(key);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa0, %rsp
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbx
movq 0x48(%rsi), %r13
leaq 0x80(%rsp), %r15
movq %r15, %rdi
movq %rdx, %rsi
callq 0x3370
movq %r13, %rdi
movq %r15, %rsi
callq 0x109ba
movq %rax, %r13
leaq 0x80(%rsp), %rdi
callq 0x3110
testq %r13, %r13
je 0xdf73
movq 0x48(%r12), %r12
leaq 0x60(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x3370
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x10846
jmp 0xdfeb
movq 0x50(%r12), %r13
leaq 0x40(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x3370
movq %r13, %rdi
movq %r15, %rsi
callq 0x109ba
movq %rax, %r13
leaq 0x40(%rsp), %rdi
callq 0x3110
testq %r13, %r13
je 0xdfca
movq 0x50(%r12), %r12
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x3370
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x10846
jmp 0xdfeb
movq 0x58(%r12), %r12
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x3370
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x10846
movq %r15, %rdi
callq 0x3110
movq %rbx, %rax
addq $0xa0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %rsp, %r15
jmp 0xe028
movq %rax, %rbx
leaq 0x20(%rsp), %r15
jmp 0xe028
jmp 0xe025
movq %rax, %rbx
leaq 0x60(%rsp), %r15
jmp 0xe028
movq %rax, %rbx
movq %r15, %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x3450
// File: /workspace/github_cpp_makefile_star2_O2/devanshdalal[P]cloud-computing-concepts-part-2/MP2Node.cpp
// Function: MP2Node::updateKeyValue(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, ReplicaType)
bool MP2Node::updateKeyValue(string key, string value, ReplicaType replica)
{
	/*
	 * Implement this
	 */
	// Update key in local hash table and return true or false
	switch (replica)
	{
	case ReplicaType::PRIMARY:
	{
		return ht->update(key, value);
	}
	case ReplicaType::SECONDARY:
	{
		return secondary->update(key, value);
	}
	case ReplicaType::TERTIARY:
	{
		return tertiary->update(key, value);
	}
	default:
		break;
	}
	return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xc0, %rsp
movq %rdx, %r15
cmpl $0x2, %ecx
je 0xe0ce
cmpl $0x1, %ecx
je 0xe095
testl %ecx, %ecx
jne 0xe112
movq 0x48(%rdi), %r12
leaq 0x40(%rsp), %rbx
movq %rbx, %rdi
callq 0x3370
leaq 0xa0(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x3370
leaq 0x40(%rsp), %rbx
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x10896
jmp 0xe0fe
movq 0x50(%rdi), %r12
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x3370
leaq 0x80(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x3370
leaq 0x20(%rsp), %rbx
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x10896
jmp 0xe0fe
movq 0x58(%rdi), %r12
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x3370
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x3370
movq %rsp, %rbx
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x10896
movl %eax, %ebp
movq %r14, %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x3110
jmp 0xe114
xorl %ebp, %ebp
movl %ebp, %eax
addq $0xc0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq 0xa0(%rsp), %rdi
callq 0x3110
leaq 0x40(%rsp), %rbx
jmp 0xe16d
movq %rax, %r14
leaq 0x60(%rsp), %rdi
callq 0x3110
movq %rsp, %rbx
jmp 0xe16d
movq %rax, %r14
leaq 0x80(%rsp), %rdi
callq 0x3110
leaq 0x20(%rsp), %rbx
jmp 0xe16d
jmp 0xe16a
jmp 0xe16a
movq %rax, %r14
movq %rbx, %rdi
callq 0x3110
movq %r14, %rdi
callq 0x3450
nop
// File: /workspace/github_cpp_makefile_star2_O2/devanshdalal[P]cloud-computing-concepts-part-2/MP2Node.cpp
// Function: MP2Node::recvLoop()
bool MP2Node::recvLoop()
{
	deleteExpired();
	if (memberNode->bFailed)
	{
		return false;
	}
	else
	{
		return emulNet->ENrecv(&(memberNode->addr), this->enqueueWrapper, NULL, 1, &(memberNode->mp2q));
	}
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0xf0e2
movq 0x60(%rbx), %r9
cmpb $0x0, 0x10(%r9)
je 0xf0ba
xorl %eax, %eax
jmp 0xf0e0
movq 0x70(%rbx), %rdi
leaq 0x8(%r9), %rsi
addq $0x98, %r9
leaq 0x24a(%rip), %rdx       # 0xf31a
pushq $0x1
popq %r8
xorl %ecx, %ecx
callq 0x5d8c
testl %eax, %eax
setne %al
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/t0mm4rx[P]piscine_cpp/day06/ex00/main.cpp
// Function: main
int		main(int argc, char **argv)
{
	if (argc != 2)
	{
		std::cout << "Wrong usage: ./convert <number>" << std::endl;
		return (1);
	}
	go(argv[1]);
	return (0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpl $0x2, %edi
jne 0x16da
movq 0x8(%rsi), %rdi
callq 0x12ec
xorl %eax, %eax
jmp 0x16f8
movq 0x28f7(%rip), %rdi      # 0x3fd8
leaq 0x9eb(%rip), %rsi       # 0x20d3
callq 0x10f0
movq %rax, %rdi
callq 0x1090
pushq $0x1
popq %rax
popq %rbp
retq