LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/5hubh4m[P]snake-ncurses/snake.cpp
// Function: Snake::movesnake()
void Snake::movesnake(void) {
		Point f, b;
		Cell temp;
		f=cells.front().p;
		b=cells.back().p;
		cells.front().c='@';
		switch(fdir) {
			case UP:
				f.row=getrow(f.row-1);
				break;
			case DOWN:
				f.row=getrow(f.row+1);
				break;
			case RIGHT:
				f.col=getcol(f.col+1);
				break;
			case LEFT:
				f.col=getcol(f.col-1);
				break;
		}
		temp.p=f;
		temp.c='O';
		cells.push_front(temp);
		if(!nodes.empty()) {
			if(b.row==nodes.front().p.row && b.col==nodes.front().p.col) {
				nodes.pop_front();
			}
		}
		cells.pop_back();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x18(%rdi), %rax
movq 0x38(%rdi), %rcx
cmpq 0x40(%rdi), %rcx
jne 0x2776
movq 0x50(%rbx), %rdx
movl $0x1f8, %ecx            # imm = 0x1F8
addq -0x8(%rdx), %rcx
movl (%rax), %ebp
movl 0x4(%rax), %r14d
movl -0xc(%rcx), %r13d
movl -0x8(%rcx), %r12d
movb $0x40, 0x8(%rax)
movl 0xa8(%rbx), %eax
cmpq $0x3, %rax
ja 0x27c8
leaq 0x2879(%rip), %rcx      # 0x5014
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
decl %ebp
jmp 0x27aa
incl %ebp
movl %ebp, %edi
callq 0x453f
movl %eax, %ebp
jmp 0x27c8
decl %r14d
jmp 0x27bd
incl %r14d
movl %r14d, %edi
callq 0x4552
movl %eax, %r14d
leaq 0x8(%rbx), %r15
movl %ebp, 0xc(%rsp)
movl %r14d, 0x10(%rsp)
movb $0x4f, 0x14(%rsp)
movq 0x18(%rbx), %rax
cmpq 0x20(%rbx), %rax
je 0x27fb
movl 0x14(%rsp), %ecx
movl %ecx, -0x4(%rax)
movq 0xc(%rsp), %rcx
movq %rcx, -0xc(%rax)
addq $-0xc, 0x18(%rbx)
jmp 0x2808
leaq 0xc(%rsp), %rsi
movq %r15, %rdi
callq 0x30ba
movq 0x68(%rbx), %rax
cmpq %rax, 0x88(%rbx)
je 0x282c
cmpl (%rax), %r13d
jne 0x282c
cmpl 0x4(%rax), %r12d
jne 0x282c
addq $0x58, %rbx
movq %rbx, %rdi
callq 0x2b60
movq %r15, %rdi
callq 0x2bae
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/5hubh4m[P]snake-ncurses/snake.cpp
// Function: Classic_Snake::Classic_Snake()
Classic_Snake::Classic_Snake():Snake(2) {
	T.p.row=12;
	T.p.col=39;
	T.points=1;
	T.c='&';
	score=0;
	coll=0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl $0x2, %esi
callq 0x2530
leaq 0x54ef(%rip), %rax      # 0x7d58
movq %rax, (%rbx)
movabsq $0x270000000c, %rax     # imm = 0x270000000C
movq %rax, 0xb4(%rbx)
movl $0x1, 0xbc(%rbx)
movb $0x26, 0xc0(%rbx)
movq $0x0, 0xac(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/5hubh4m[P]snake-ncurses/snake.cpp
// Function: Classic_Snake::movesnake()
void Classic_Snake::movesnake(void) {
	Point f, b;
	Cell temp;
	f=cells.front().p;
	b=cells.back().p;
	cells.front().c='@';
	switch(fdir) {
		case UP:
			f.row=getrow(f.row-1);
			break;
		case DOWN:
			f.row=getrow(f.row+1);
			break;
		case RIGHT:
			f.col=getcol(f.col+1);
			break;
		case LEFT:
			f.col=getcol(f.col-1);
			break;
	}
	temp.p=f;
	temp.c='O';
	cells.push_front(temp);
	if(collide()) {
		coll=1;
		return;
	}
	if(cells.front().p.row!=T.p.row || cells.front().p.col!=T.p.col) {
		if(!nodes.empty()) {
			if(b.row==nodes.front().p.row && b.col==nodes.front().p.col) {
				nodes.pop_front();
			}
		}
		cells.pop_back();
	}
	else {
		score+=T.points;
		addtreat();
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x18(%rdi), %rax
movq 0x38(%rdi), %rcx
cmpq 0x40(%rdi), %rcx
jne 0x2930
movq 0x50(%rbx), %rdx
movl $0x1f8, %ecx            # imm = 0x1F8
addq -0x8(%rdx), %rcx
movl (%rax), %ebp
movl 0x4(%rax), %r15d
movl -0xc(%rcx), %r13d
movl -0x8(%rcx), %r12d
movb $0x40, 0x8(%rax)
movl 0xa8(%rbx), %eax
cmpq $0x3, %rax
ja 0x2982
leaq 0x26cf(%rip), %rcx      # 0x5024
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
decl %ebp
jmp 0x2964
incl %ebp
movl %ebp, %edi
callq 0x453f
movl %eax, %ebp
jmp 0x2982
decl %r15d
jmp 0x2977
incl %r15d
movl %r15d, %edi
callq 0x4552
movl %eax, %r15d
leaq 0x8(%rbx), %r14
movl %ebp, 0xc(%rsp)
movl %r15d, 0x10(%rsp)
movb $0x4f, 0x14(%rsp)
movq 0x18(%rbx), %rax
cmpq 0x20(%rbx), %rax
je 0x29b5
movl 0x14(%rsp), %ecx
movl %ecx, -0x4(%rax)
movq 0xc(%rsp), %rcx
movq %rcx, -0xc(%rax)
addq $-0xc, 0x18(%rbx)
jmp 0x29c2
leaq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x30ba
movq %rbx, %rdi
callq 0x2a44
testl %eax, %eax
je 0x29da
movl $0x1, 0xb0(%rbx)
jmp 0x2a35
movq 0x18(%rbx), %rax
movl (%rax), %ecx
cmpl 0xb4(%rbx), %ecx
jne 0x2a09
movl 0x4(%rax), %eax
cmpl 0xb8(%rbx), %eax
jne 0x2a09
movl 0xbc(%rbx), %eax
addl %eax, 0xac(%rbx)
movq %rbx, %rdi
callq 0x289c
jmp 0x2a35
movq 0x68(%rbx), %rax
cmpq %rax, 0x88(%rbx)
je 0x2a2d
cmpl (%rax), %r13d
jne 0x2a2d
cmpl 0x4(%rax), %r12d
jne 0x2a2d
addq $0x58, %rbx
movq %rbx, %rdi
callq 0x2b60
movq %r14, %rdi
callq 0x2bae
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/5hubh4m[P]snake-ncurses/snake.cpp
// Function: Classic_Snake::render()
void Classic_Snake::render(void) {
	erase();
	for(std::deque<Cell>::iterator it=cells.begin(); it!=cells.end(); ++it){
		mvaddch(it->p.row, it->p.col, it->c);
	}
	mvaddch(T.p.row, T.p.col, T.c);
	refresh();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
callq 0x21d0
movq 0x18(%rbx), %r14
cmpq 0x38(%rbx), %r14
je 0x2b13
movq 0x28(%rbx), %r13
movq 0x30(%rbx), %r15
movq 0x5506(%rip), %r12      # 0x7fd8
movq (%r12), %rdi
movl (%r14), %esi
movl 0x4(%r14), %edx
callq 0x21c0
cmpl $-0x1, %eax
je 0x2af5
movq (%r12), %rdi
movsbl 0x8(%r14), %esi
callq 0x2090
addq $0xc, %r14
cmpq %r13, %r14
jne 0x2b0d
movq 0x8(%r15), %r14
addq $0x8, %r15
leaq 0x1f8(%r14), %r13
cmpq 0x38(%rbx), %r14
jne 0x2ad2
movq 0x54be(%rip), %r14      # 0x7fd8
movq (%r14), %rdi
movl 0xb4(%rbx), %esi
movl 0xb8(%rbx), %edx
callq 0x21c0
cmpl $-0x1, %eax
je 0x2b42
movq (%r14), %rdi
movsbl 0xc0(%rbx), %esi
callq 0x2090
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x22e0
// File: /workspace/github_cpp_makefile_star2_O1/5hubh4m[P]snake-ncurses/score.cpp
// Function: Score::filewrite()
void Score::filewrite() {
  std::ofstream file;
  if(head>-1) {
    if(file.is_open()) {
      file.close();
    }
    file.open(FILE_NAME, std::ios::trunc | std::ios::binary);
    file.write((char *)this, sizeof(Score));
    file.close();
  }
}

// Assembly:
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
movq %rdi, %rbx
movq %rsp, %rdi
callq 0x22d0
cmpl $0x0, 0x38(%rbx)
js 0x3927
leaq 0x70(%rsp), %rdi
callq 0x2050
testb %al, %al
je 0x38fb
movq %rsp, %rdi
callq 0x2260
leaq 0x1779(%rip), %rsi      # 0x507b
movq %rsp, %rdi
movl $0x24, %edx
callq 0x2030
movq %rsp, %rdi
movl $0x3c, %edx
movq %rbx, %rsi
callq 0x2250
movq %rsp, %rdi
callq 0x2260
movq 0x46a2(%rip), %rax      # 0x7fd0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x8(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, (%rsp,%rcx)
callq 0x2150
leaq 0xf8(%rsp), %rdi
callq 0x20b0
addq $0x200, %rsp            # imm = 0x200
popq %rbx
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x2280
movq %rbx, %rdi
callq 0x22f0
// File: /workspace/github_cpp_makefile_star2_O1/5hubh4m[P]snake-ncurses/score.cpp
// Function: Score::fileread()
void Score::fileread() {
  std::ifstream file;
  file.open(FILE_NAME, std::ios::in | std::ios::binary);
  if(file.is_open()) {
    file.read((char *)this, sizeof(Score));
  }
  file.close();
  sortscore();
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rdi, %rbx
movq %rsp, %r14
movq %r14, %rdi
callq 0x21e0
leaq 0x16e8(%rip), %rsi      # 0x507b
movq %r14, %rdi
movl $0xc, %edx
callq 0x2120
leaq 0x78(%rsp), %rdi
callq 0x2050
testb %al, %al
je 0x39be
movq %rsp, %rdi
movl $0x3c, %edx
movq %rbx, %rsi
callq 0x2220
movq %rsp, %rdi
callq 0x2040
movq %rbx, %rdi
callq 0x39f4
movq %rsp, %rdi
callq 0x2060
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x2060
movq %rbx, %rdi
callq 0x22f0
// File: /workspace/github_cpp_makefile_star2_O1/5hubh4m[P]snake-ncurses/score.cpp
// Function: Score::sortscore()
void Score::sortscore(void) {
  int temp;
  if(head>0) {
    for(int i=0; i<=head; i++) {
      for(int j=0; j<=head-1; j++) {
        if(scores[j]>scores[j+1]) {
          temp=scores[j+1];
          scores[j+1]=scores[j];
          scores[j]=temp;
        }
      }
    }
  }
}

// Assembly:
cmpl $0x0, 0x38(%rdi)
jle 0x3a2c
xorl %eax, %eax
cmpl $0x0, 0x38(%rdi)
jle 0x3a22
xorl %ecx, %ecx
movl (%rdi,%rcx,4), %edx
movl 0x4(%rdi,%rcx,4), %esi
cmpl %esi, %edx
jle 0x3a16
movl %edx, 0x4(%rdi,%rcx,4)
movl %esi, (%rdi,%rcx,4)
incq %rcx
movslq 0x38(%rdi), %rdx
cmpq %rdx, %rcx
jl 0x3a04
leal 0x1(%rax), %ecx
cmpl 0x38(%rdi), %eax
movl %ecx, %eax
jl 0x39fc
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/5hubh4m[P]snake-ncurses/score.cpp
// Function: Score::addscore(int)
void Score::addscore(int s) {
  sortscore();
  if(head<13) {
    scores[++head]=s;
    sortscore();
  }
  else {
    if(s>scores[0]) {
      scores[0]=s;
      sortscore();
    }
  }
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
callq 0x39f4
movslq 0x38(%rbx), %rax
cmpq $0xc, %rax
jg 0x3a56
leaq 0x1(%rax), %rcx
movl %ecx, 0x38(%rbx)
leaq (%rbx,%rax,4), %rax
addq $0x4, %rax
jmp 0x3a5d
movq %rbx, %rax
cmpl %ebp, (%rbx)
jge 0x3a6d
movl %ebp, (%rax)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x39f4
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/5hubh4m[P]snake-ncurses/score.cpp
// Function: Score::showscores()
void Score::showscores(void) {
  sortscore();
  erase();
  int ch;
  int t=(23-head-1)/2;
  if(head>-1) {
    for(int i=head, j=0; i>=0; i--,  j++) {
      mvprintw(t+j, 36, "%2d. %2u", j+1, scores[i]);
    }
  }
  attron(A_STANDOUT);
  mvprintw(23, 25, "PRESS 'Q' to EXIT BACK TO MENU.");
  attroff(A_STANDOUT);
  refresh();
  while((ch=getch())!='q');
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
callq 0x39f4
callq 0x21d0
movslq 0x38(%rbx), %rax
testq %rax, %rax
js 0x3add
movl $0x16, %ecx
subl %eax, %ecx
movl %ecx, %r15d
shrl $0x1f, %r15d
addl %ecx, %r15d
sarl %r15d
leaq (%rbx,%rax,4), %r12
leal 0x1(%rax), %ebp
leaq 0x15d0(%rip), %rbx      # 0x5084
xorl %r14d, %r14d
leal (%r15,%r14), %edi
incl %r14d
movl (%r12), %r8d
movl $0x24, %esi
movq %rbx, %rdx
movl %r14d, %ecx
xorl %eax, %eax
callq 0x2240
addq $-0x4, %r12
cmpl %r14d, %ebp
jne 0x3ab7
movq 0x44f4(%rip), %rbx      # 0x7fd8
movq (%rbx), %rdi
movl $0x10000, %esi          # imm = 0x10000
xorl %edx, %edx
callq 0x2100
leaq 0x1593(%rip), %rdx      # 0x508d
movl $0x17, %edi
movl $0x19, %esi
xorl %eax, %eax
callq 0x2240
movq (%rbx), %rdi
movl $0x10000, %esi          # imm = 0x10000
xorl %edx, %edx
callq 0x2230
callq 0x22e0
movq (%rbx), %rdi
callq 0x20d0
cmpl $0x71, %eax
jne 0x3b1f
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/5hubh4m[P]snake-ncurses/snake_ncurses.cpp
// Function: print_snake()
void print_snake(void) {
	mvprintw(0, 14, " $$$$$$\\  $$\\   $$\\  $$$$$$\\  $$\\   $$\\ $$$$$$$$\\\n");
	mvprintw(1, 14, "$$  __$$\\ $$$\\  $$ |$$  __$$\\ $$ | $$  |$$  _____|\n");
	mvprintw(2, 14, "$$ /  \\__|$$$$\\ $$ |$$ /  $$ |$$ |$$  / $$ |\n");
	mvprintw(3, 14, "\\$$$$$$\\  $$ $$\\$$ |$$$$$$$$ |$$$$$  /  $$$$$\\\n");
	mvprintw(4, 14, " \\____$$\\ $$ \\$$$$ |$$  __$$ |$$  $$<   $$  __|\n");
	mvprintw(5, 14, "$$\\   $$ |$$ |\\$$$ |$$ |  $$ |$$ |\\$$\\  $$ |\n");
	mvprintw(6, 14, "\\$$$$$$  |$$ | \\$$ |$$ |  $$ |$$ | \\$$\\ $$$$$$$$\\\n");
	mvprintw(7, 14, " \\______/ \\__|  \\__|\\__|  \\__|\\__|  \\__|\\________|\n");
}

// Assembly:
pushq %rax
leaq 0x15a3(%rip), %rdx      # 0x50e7
xorl %edi, %edi
movl $0xe, %esi
xorl %eax, %eax
callq 0x2240
leaq 0x15c1(%rip), %rdx      # 0x511a
movl $0x1, %edi
movl $0xe, %esi
xorl %eax, %eax
callq 0x2240
leaq 0x15dd(%rip), %rdx      # 0x514e
movl $0x2, %edi
movl $0xe, %esi
xorl %eax, %eax
callq 0x2240
leaq 0x15f3(%rip), %rdx      # 0x517c
movl $0x3, %edi
movl $0xe, %esi
xorl %eax, %eax
callq 0x2240
leaq 0x160b(%rip), %rdx      # 0x51ac
movl $0x4, %edi
movl $0xe, %esi
xorl %eax, %eax
callq 0x2240
leaq 0x1624(%rip), %rdx      # 0x51dd
movl $0x5, %edi
movl $0xe, %esi
xorl %eax, %eax
callq 0x2240
leaq 0x163a(%rip), %rdx      # 0x520b
movl $0x6, %edi
movl $0xe, %esi
xorl %eax, %eax
callq 0x2240
leaq 0x1655(%rip), %rdx      # 0x523e
movl $0x7, %edi
movl $0xe, %esi
xorl %eax, %eax
popq %rcx
jmp 0x2240
// File: /workspace/github_cpp_makefile_star2_O1/5hubh4m[P]snake-ncurses/snake_ncurses.cpp
// Function: classic_game()
int classic_game(void) {
	Classic_Snake S;
	int ch, d;
	initscr();
	keypad(stdscr, TRUE);
	noecho();
	timeout(TIMEOUT);
	curs_set(0);
	while(1) {
		ch=getch();
		if(ch=='q') {
			return S.getscore();
		}
		else if(ch==KEY_UP || ch==KEY_DOWN || ch==KEY_RIGHT || ch==KEY_LEFT) {
			switch(ch) {
				case KEY_UP:
					d=UP;
					break;
				case KEY_DOWN:
					d=DOWN;
					break;
				case KEY_RIGHT:
					d=RIGHT;
					break;
				case KEY_LEFT:
					d=LEFT;
					break;
			}
			if(diff(S.getfdir(), d)!=2 && d!=S.getfdir()) {
				S.createNode(d);
			}
		}
		S.movesnake();
		S.render();
		if(S.getcoll()) {
			timeout(TIMEOUT_LONG);
			getch();
			show_gameover(S.getscore());
			return S.getscore();
		}
		attron(A_STANDOUT);
		mvprintw(23, 25, "PRESS 'Q' to EXIT BACK TO MENU.");
		attroff(A_STANDOUT);
		refresh();
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xd0, %rsp
leaq 0x8(%rsp), %rdi
callq 0x2854
callq 0x2290
movq 0x3ed7(%rip), %r15      # 0x7fd8
movq (%r15), %rdi
movl $0x1, %esi
callq 0x20e0
callq 0x21f0
movq (%r15), %rdi
movl $0x64, %esi
callq 0x2200
xorl %edi, %edi
callq 0x2140
leaq 0x8(%rsp), %rbx
leaq 0xf5a(%rip), %r14       # 0x508d
leaq 0xf86(%rip), %r12       # 0x50c0
movq (%r15), %rdi
callq 0x20d0
leal -0x102(%rax), %ecx
cmpl $0x3, %ecx
ja 0x415d
movslq (%r12,%rcx,4), %rax
addq %r12, %rax
jmpq *%rax
movl $0x2, %ebp
jmp 0x4177
cmpl $0x71, %eax
jne 0x41a1
jmp 0x421c
movl $0x3, %ebp
jmp 0x4177
movl $0x1, %ebp
jmp 0x4177
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x2844
subl %ebp, %eax
addl $0x2, %eax
testl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
je 0x41a1
movq %rbx, %rdi
callq 0x2844
cmpl %eax, %ebp
je 0x41a1
movq %rbx, %rdi
movl %ebp, %esi
callq 0x266e
movq %rbx, %rdi
callq 0x2904
movq %rbx, %rdi
callq 0x2aa8
movq %rbx, %rdi
callq 0x2b50
movq (%r15), %rdi
testl %eax, %eax
jne 0x41f9
movl $0x10000, %esi          # imm = 0x10000
xorl %edx, %edx
callq 0x2100
movl $0x17, %edi
movl $0x19, %esi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2240
movq (%r15), %rdi
movl $0x10000, %esi          # imm = 0x10000
xorl %edx, %edx
callq 0x2230
callq 0x22e0
jmp 0x413a
movl $0x2710, %esi           # imm = 0x2710
callq 0x2200
movq (%r15), %rdi
callq 0x20d0
leaq 0x8(%rsp), %rdi
callq 0x2b58
movl %eax, %edi
callq 0x3ee8
leaq 0x8(%rsp), %rdi
callq 0x2b58
movl %eax, %ebx
leaq 0x3af9(%rip), %rax      # 0x7d28
addq $0x10, %rax
leaq 0x60(%rsp), %rdi
movq %rax, -0x58(%rdi)
callq 0x306a
leaq 0x10(%rsp), %rdi
callq 0x301a
movl %ebx, %eax
addq $0xd0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x425f
movq %rax, %rbx
leaq 0x3abf(%rip), %rax      # 0x7d28
addq $0x10, %rax
leaq 0x60(%rsp), %rdi
movq %rax, -0x58(%rdi)
callq 0x306a
leaq 0x10(%rsp), %rdi
callq 0x301a
movq %rbx, %rdi
callq 0x22f0
// File: /workspace/github_cpp_makefile_star2_O1/5hubh4m[P]snake-ncurses/snake_ncurses.cpp
// Function: fun_snake_game()
void fun_snake_game(void) {
	Snake S;
	int ch, d;
	initscr();
	keypad(stdscr, TRUE);
	noecho();
	timeout(TIMEOUT);
	curs_set(0);
	while(1) {
		ch=getch();
		if(ch=='q') {
			return;
		}
		else if(ch==KEY_UP || ch==KEY_DOWN || ch==KEY_RIGHT || ch==KEY_LEFT) {
			switch(ch) {
				case KEY_UP:
					d=UP;
					break;
				case KEY_DOWN:
					d=DOWN;
					break;
				case KEY_RIGHT:
					d=RIGHT;
					break;
				case KEY_LEFT:
					d=LEFT;
					break;
			}
			if(diff(S.getfdir(), d)!=2 && d!=S.getfdir()) {
				S.createNode(d);
			}
		}
		S.movesnake();
		S.render();
		attron(A_STANDOUT);
		mvprintw(23, 25, "PRESS 'Q' to EXIT BACK TO MENU.");
		attroff(A_STANDOUT);
		refresh();
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xb0, %rsp
movq %rsp, %rdi
movl $0x19, %esi
callq 0x2530
callq 0x2290
movq 0x3d19(%rip), %r15      # 0x7fd8
movq (%r15), %rdi
movl $0x1, %esi
callq 0x20e0
callq 0x21f0
movq (%r15), %rdi
movl $0x64, %esi
callq 0x2200
xorl %edi, %edi
callq 0x2140
movq %rsp, %rbx
leaq 0xd9e(%rip), %r14       # 0x508d
leaq 0xdda(%rip), %r12       # 0x50d0
movq (%r15), %rdi
callq 0x20d0
leal -0x102(%rax), %ecx
cmpl $0x3, %ecx
ja 0x4319
movslq (%r12,%rcx,4), %rax
addq %r12, %rax
jmpq *%rax
movl $0x2, %ebp
jmp 0x4333
cmpl $0x71, %eax
jne 0x435d
jmp 0x43a9
movl $0x3, %ebp
jmp 0x4333
movl $0x1, %ebp
jmp 0x4333
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x2844
subl %ebp, %eax
addl $0x2, %eax
testl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
je 0x435d
movq %rbx, %rdi
callq 0x2844
cmpl %eax, %ebp
je 0x435d
movq %rbx, %rdi
movl %ebp, %esi
callq 0x266e
movq %rbx, %rdi
callq 0x274a
movq %rbx, %rdi
callq 0x26d0
movq (%r15), %rdi
movl $0x10000, %esi          # imm = 0x10000
xorl %edx, %edx
callq 0x2100
movl $0x17, %edi
movl $0x19, %esi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2240
movq (%r15), %rdi
movl $0x10000, %esi          # imm = 0x10000
xorl %edx, %edx
callq 0x2230
callq 0x22e0
jmp 0x42f6
leaq 0x3978(%rip), %rax      # 0x7d28
addq $0x10, %rax
leaq 0x58(%rsp), %rdi
movq %rax, -0x58(%rdi)
callq 0x306a
leaq 0x8(%rsp), %rdi
callq 0x301a
addq $0xb0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x43de
movq %rax, %rbx
leaq 0x3940(%rip), %rax      # 0x7d28
addq $0x10, %rax
leaq 0x58(%rsp), %rdi
movq %rax, -0x58(%rdi)
callq 0x306a
leaq 0x8(%rsp), %rdi
callq 0x301a
movq %rbx, %rdi
callq 0x22f0
// File: /workspace/github_cpp_makefile_star2_O1/5hubh4m[P]snake-ncurses/snake_ncurses.cpp
// Function: rand_point(std::deque<Cell, std::allocator<Cell>>)
Point rand_point(std::deque<Cell> cells) {
	Point p;
	int flag;
	srand(time(NULL));
	do {
		flag=0;
		p.row=rand()%(MAX_ROW+1);
		p.col=rand()%(MAX_COL+1);
		for(std::deque<Cell>::iterator it=cells.begin(); it!=cells.end(); ++it){
			if(p.row==it->p.row && p.col==it->p.col) {
				flag=1;
			}
		}
	}while(flag);
	return p;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %edi, %edi
callq 0x2170
movl %eax, %edi
callq 0x2180
movl $0x1, %ebp
callq 0x2070
movslq %eax, %r14
imulq $0x6bca1af3, %r14, %rax # imm = 0x6BCA1AF3
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x23, %rax
addl %ecx, %eax
leal (%rax,%rax,8), %ecx
leal (%rax,%rcx,2), %eax
subl %eax, %r14d
callq 0x2070
movslq %eax, %rcx
imulq $0x66666667, %rcx, %rax # imm = 0x66666667
movq %rax, %rdx
shrq $0x3f, %rdx
sarq $0x25, %rax
addl %edx, %eax
shll $0x4, %eax
leal (%rax,%rax,4), %eax
subl %eax, %ecx
movq 0x10(%rbx), %rdx
movq 0x30(%rbx), %rax
cmpq %rax, %rdx
je 0x44b6
movq 0x20(%rbx), %r8
movq 0x28(%rbx), %rdi
xorl %esi, %esi
cmpl (%rdx), %r14d
jne 0x4491
cmpl 0x4(%rdx), %ecx
cmovel %ebp, %esi
addq $0xc, %rdx
cmpq %r8, %rdx
jne 0x44a9
movq 0x8(%rdi), %rdx
addq $0x8, %rdi
leaq 0x1f8(%rdx), %r8
cmpq %rax, %rdx
jne 0x4486
testl %esi, %esi
jne 0x4426
shlq $0x20, %rcx
movl %r14d, %eax
orq %rcx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/attractivechaos[P]udb2/unordered_dense/./unordered_dense.h
// Function: ankerl::unordered_dense::v4_1_2::detail::table<unsigned int, unsigned int, Hash32, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int, unsigned int>>, ankerl::unordered_dense::v4_1_2::bucket_type::standard, false>::erase(__gnu_cxx::__normal_iterator<std::pair<unsigned int, unsigned int>*, std::vector<std::pair<unsigned int, unsigned int>, std::allocator<std::pair<unsigned int, unsigned int>>>>)
auto erase(iterator it) -> iterator {
        auto hash = mixed_hash(get_key(*it));
        auto bucket_idx = bucket_idx_from_hash(hash);

        auto const value_idx_to_remove = static_cast<value_idx_type>(it - cbegin());
        while (at(m_buckets, bucket_idx).m_value_idx != value_idx_to_remove) {
            bucket_idx = next(bucket_idx);
        }

        do_erase(bucket_idx);
        return begin() + static_cast<difference_type>(value_idx_to_remove);
    }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl (%rsi), %eax
movabsq $-0x61c8864680b583eb, %rcx # imm = 0x9E3779B97F4A7C15
mulq %rcx
xorq %rax, %rdx
movb 0x36(%rdi), %cl
shrq %cl, %rdx
subq (%rdi), %r14
sarq $0x3, %r14
movq 0x18(%rdi), %rax
movl %edx, %ecx
cmpl %r14d, 0x4(%rax,%rcx,8)
je 0x1783
movq 0x20(%rbx), %rcx
xorl %esi, %esi
incl %edx
cmpq %rdx, %rcx
cmovel %esi, %edx
cmpl %r14d, 0x4(%rax,%rdx,8)
jne 0x1774
movq %rbx, %rdi
movl %edx, %esi
callq 0x1d02
movl %r14d, %eax
shlq $0x3, %rax
addq (%rbx), %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/attractivechaos[P]udb2/unordered_dense/./unordered_dense.h
// Function: ankerl::unordered_dense::v4_1_2::detail::table<unsigned int, unsigned int, Hash32, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int, unsigned int>>, ankerl::unordered_dense::v4_1_2::bucket_type::standard, false>::do_erase(unsigned int)
void do_erase(value_idx_type bucket_idx) {
        auto const value_idx_to_remove = at(m_buckets, bucket_idx).m_value_idx;

        // shift down until either empty or an element with correct spot is found
        auto next_bucket_idx = next(bucket_idx);
        while (at(m_buckets, next_bucket_idx).m_dist_and_fingerprint >= Bucket::dist_inc * 2) {
            at(m_buckets, bucket_idx) = {dist_dec(at(m_buckets, next_bucket_idx).m_dist_and_fingerprint),
                                         at(m_buckets, next_bucket_idx).m_value_idx};
            bucket_idx = std::exchange(next_bucket_idx, next(next_bucket_idx));
        }
        at(m_buckets, bucket_idx) = {};

        // update m_values
        if (value_idx_to_remove != m_values.size() - 1) {
            // no luck, we'll have to replace the value with the last one and update the index accordingly
            auto& val = m_values[value_idx_to_remove];
            val = std::move(m_values.back());

            // update the values_idx of the moved entry. No need to play the info game, just look until we find the values_idx
            auto mh = mixed_hash(get_key(val));
            bucket_idx = bucket_idx_from_hash(mh);

            auto const values_idx_back = static_cast<value_idx_type>(m_values.size() - 1);
            while (values_idx_back != at(m_buckets, bucket_idx).m_value_idx) {
                bucket_idx = next(bucket_idx);
            }
            at(m_buckets, bucket_idx).m_value_idx = value_idx_to_remove;
        }
        m_values.pop_back();
    }

// Assembly:
pushq %rbx
movq 0x18(%rdi), %r8
movq 0x20(%rdi), %r9
movl %esi, %eax
movl 0x4(%r8,%rax,8), %r10d
leal 0x1(%rsi), %ecx
xorl %eax, %eax
cmpq %rcx, %r9
cmovel %eax, %ecx
movl (%r8,%rcx,8), %r11d
cmpl $0x200, %r11d           # imm = 0x200
jb 0x1d5d
movl %ecx, %edx
addl $0xffffff00, %r11d      # imm = 0xFFFFFF00
movl 0x4(%r8,%rcx,8), %ebx
movl %esi, %esi
movl %r11d, (%r8,%rsi,8)
leal 0x1(%rdx), %ecx
cmpq %rcx, %r9
cmovel %eax, %ecx
movl %ebx, 0x4(%r8,%rsi,8)
movl (%r8,%rcx,8), %r11d
movl %edx, %esi
cmpl $0x1ff, %r11d           # imm = 0x1FF
ja 0x1d2a
jmp 0x1d5f
movl %esi, %edx
movl %edx, %eax
movq $0x0, (%r8,%rax,8)
movq (%rdi), %rcx
movq 0x8(%rdi), %rsi
movq %rsi, %r11
subq %rcx, %r11
sarq $0x3, %r11
leaq -0x1(%r11), %rax
cmpq %r10, %rax
je 0x1dcc
movl -0x8(%rsi), %eax
movl %eax, (%rcx,%r10,8)
movl -0x4(%rsi), %edx
movl %edx, 0x4(%rcx,%r10,8)
movabsq $-0x61c8864680b583eb, %rcx # imm = 0x9E3779B97F4A7C15
mulq %rcx
xorq %rax, %rdx
movb 0x36(%rdi), %cl
shrq %cl, %rdx
decl %r11d
movl %edx, %eax
cmpl 0x4(%r8,%rax,8), %r11d
je 0x1dc7
xorl %ecx, %ecx
movl %edx, %eax
incl %eax
cmpq %rax, %r9
cmovel %ecx, %eax
cmpl 0x4(%r8,%rax,8), %r11d
jne 0x1db8
movl %r10d, 0x4(%r8,%rax,8)
addq $-0x8, %rsi
movq %rsi, 0x8(%rdi)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/zkl94[P]distributed-key-value-store/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->emulNet = emul;
    this->log = log;
    this->par = params;
    this->memberNode->addr = *address;
    this->broadcast = 0;
    this->tobedeleted = new std::map<int, int>;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1b186(%rip), %rax     # 0x1ec40
movq %rax, (%rdi)
xorl %r14d, %r14d
movl %r14d, 0x28(%rdi)
movw $0x0, 0x2c(%rdi)
movq %rsi, 0x20(%rdi)
movq %rcx, 0x8(%rdi)
movq %r8, 0x10(%rdi)
movq %rdx, 0x18(%rdi)
leaq 0x8(%rsi), %rdi
movq %r9, %rsi
callq 0xd17e
movl %r14d, 0x30(%rbx)
movl $0x30, %edi
callq 0x3270
leaq 0x8(%rax), %rcx
movl %r14d, 0x8(%rax)
movq %r14, 0x10(%rax)
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq %r14, 0x28(%rax)
movq %rax, 0x38(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/zkl94[P]distributed-key-value-store/MP1Node.cpp
// Function: MP1Node::nodeStart(char*, short)
void MP1Node::nodeStart(char *servaddrstr, short servport) {
    // join address is the address of the introducer
    Address joinaddr;
    joinaddr = getJoinAddress();

    Address *my_addr = &this->memberNode->addr;

    // Self booting routines
    if( initThisNode(my_addr) == -1 ) {
#ifdef DEBUGLOG
        log->LOG(&memberNode->addr, "init_thisnode failed. Exit.");
#endif
        exit(1);
    }

    if( !introduceSelfToGroup(&joinaddr) ) {
        finishUpThisNode();
#ifdef DEBUGLOG
        log->LOG(&memberNode->addr, "Unable to join self to group. Exiting.");
#endif
        exit(1);
    }

    return;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %rsi
movw $0x0, 0x4(%rsi)
movl $0x1, (%rsi)
leaq 0x2(%rsp), %rdi
callq 0xd17e
movq 0x20(%rbx), %rax
movb $0x0, 0x10(%rax)
movw $0x1, 0xe(%rax)
movl $0x0, 0x14(%rax)
movq $0x0, 0x18(%rax)
movabsq $-0xfffffffb, %rcx      # imm = 0xFFFFFFFF00000005
movq %rcx, 0x20(%rax)
movq 0x28(%rax), %rcx
cmpq %rcx, 0x30(%rax)
je 0x3bde
movq %rcx, 0x30(%rax)
leaq 0x2(%rsp), %rsi
movq %rbx, %rdi
callq 0x3c3e
addq $0x10, %rsp
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/zkl94[P]distributed-key-value-store/MP1Node.cpp
// Function: MP1Node::initThisNode(Address*)
int MP1Node::initThisNode(Address *my_addr) {
    memberNode->bFailed = false;
    memberNode->inited = true;
    memberNode->inGroup = false;
    // node is up!
    memberNode->nnb = 0;
    memberNode->heartbeat = 0;
    memberNode->pingCounter = TFAIL;
    memberNode->timeOutCounter = -1;
    initMemberListTable(memberNode);

    return 0;
}

// Assembly:
movq 0x20(%rdi), %rax
movb $0x0, 0x10(%rax)
movw $0x1, 0xe(%rax)
movl $0x0, 0x14(%rax)
movq $0x0, 0x18(%rax)
movabsq $-0xfffffffb, %rcx      # imm = 0xFFFFFFFF00000005
movq %rcx, 0x20(%rax)
movq 0x28(%rax), %rcx
cmpq %rcx, 0x30(%rax)
je 0x3c3b
movq %rcx, 0x30(%rax)
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/zkl94[P]distributed-key-value-store/MP1Node.cpp
// Function: MP1Node::introduceSelfToGroup(Address*)
int MP1Node::introduceSelfToGroup(Address *joinaddr) {
    MessageHdr *msg;
#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;
    }
    else {

        // member node in group only after receiving JOINREP

        size_t msgsize = sizeof(MessageHdr) + sizeof(joinaddr->addr) + sizeof(long);
        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) + 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);
    }

    // add self to memberlist; self is ALWAYS the first member
    int id = 0;
    short port;
    memcpy(&id, &(memberNode->addr.addr[0]), sizeof(int));
    memcpy(&port, &(memberNode->addr.addr[4]), sizeof(short));
    MemberListEntry *newEntry = new MemberListEntry(id, port, 0, par->getcurrtime());
    memberNode->memberList.push_back(*newEntry);

    return 1;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x20(%rdi), %r13
movl 0x8(%r13), %eax
xorl (%rsi), %eax
movzwl 0xc(%r13), %ecx
xorw 0x4(%rsi), %cx
movzwl %cx, %ecx
orl %eax, %ecx
je 0x3cbe
movq %rsi, %r14
leaq 0x8(%r13), %r15
movl $0x12, %edi
callq 0x3350
movq %rax, %r12
movl $0x0, (%rax)
movl (%r15), %eax
movl %eax, 0x4(%r12)
movzwl 0x4(%r15), %eax
movw %ax, 0x8(%r12)
movq 0x18(%r13), %rax
movq %rax, 0xa(%r12)
movq 0x8(%rbx), %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %r12, %rcx
movl $0x12, %r8d
callq 0x6ed0
movq %r12, %rdi
callq 0x3320
jmp 0x3cc3
movb $0x1, 0xf(%r13)
movq 0x20(%rbx), %rax
movl 0x8(%rax), %ebp
movzwl 0xc(%rax), %r15d
movl $0x18, %edi
callq 0x3270
movq %rax, %r14
movq 0x18(%rbx), %rdi
callq 0xd162
movslq %eax, %r8
movswl %r15w, %edx
movq %r14, %rdi
movl %ebp, %esi
xorl %ecx, %ecx
callq 0xd1a4
movq 0x20(%rbx), %rdi
addq $0x28, %rdi
movq %r14, %rsi
callq 0x6320
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x18, %esi
movq %r14, %rdi
callq 0x3280
movq %rbx, %rdi
callq 0x3450
// File: /workspace/github_cpp_makefile_star2_O1/zkl94[P]distributed-key-value-store/MP1Node.cpp
// Function: MP1Node::recvCallBack(void*, char*, int)
bool MP1Node::recvCallBack(void *env, char *data, int size) {

    // for introduction:
    // two message types: JOINREQ, JOINREP
    // 1. when introducer receives JOINREQ, add the node to member list, and return JOINREP with cluster member list
    // 2. when cluster member receives JOINREP, add the cluster member list

    // for membership:
    // one message type: MEMBERLIST
    // 1. when receive MEMBERLIST, update you own member list accordingly

    MsgTypes msgType = ((MessageHdr *)data)->msgType;

    switch (msgType) {
        case JOINREQ:
            handleJOINREQ(env, data, size);
            break;
        case JOINREP:
            handleJOINREP(env, data, size);
            break;
        case MEMBERLIST:
            handleMEMBERLIST(env, data, size);
            break;
        default:
            cout << "unknown message type" <<endl;
            break;
    }

    return false;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl (%rdx), %eax
cmpl $0x2, %eax
je 0x4eee
cmpl $0x1, %eax
je 0x4edc
testl %eax, %eax
jne 0x4ef8
movq %rbx, %rdi
callq 0x52fc
jmp 0x4f3a
movq %rbx, %rdi
callq 0x5bde
movq 0x20(%rbx), %rax
movb $0x1, 0xf(%rax)
jmp 0x4f3a
movq %rbx, %rdi
callq 0x5bde
jmp 0x4f3a
movq 0x1a0d1(%rip), %rbx     # 0x1efd0
leaq 0x120fe(%rip), %rsi     # 0x17004
movl $0x14, %edx
movq %rbx, %rdi
callq 0x32d0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31a0
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/zkl94[P]distributed-key-value-store/MP1Node.cpp
// Function: MP1Node::handleMEMBERLIST(void*, char*, int)
void MP1Node::handleMEMBERLIST(void *env, char *data, int size) {
    #ifdef DEBUG_MEMBERLIST
        cout << "just got a member list" << endl;
    #endif

    int entry_num = (size - 4)/ (6+8);
    int currentOffset = 4;
    char addr[6];
    int id = 0;
    short port;
    long heartbeat = 0;

    MessageHdr *msg = (MessageHdr *)data;

    // if, during the process of to be deleted, a heartbeat from that node is received,
    // the node entry should be removed from to be deleted map and member list entry
    // should be re-activated
    // how to tell: the first entry in message is the node's source
    memcpy(&addr, (char *)(msg)+currentOffset, 6);
    memcpy(&id, &addr[0], sizeof(int));
    if (this->tobedeleted->count(id) != 0) {
        std::map<int, int>::iterator it = this->tobedeleted->begin();
    
        while(it != this->tobedeleted->end()) {
            if (it->first == id) {
                this->tobedeleted->erase(it);
                break;
            }
            ++it;
        }
    } // then updateEntry will do the normal update

    // for every addr and heartbeat in the incoming member list
    for (int i = 0; i < entry_num; ++i)
    {
        // extract id and port
        memcpy(&addr, (char *)(msg)+currentOffset, 6);
        currentOffset += 6;
        memcpy(&id, &addr[0], sizeof(int));
        memcpy(&port, &addr[4], sizeof(short));
        
        // heartbeat
        memcpy(&heartbeat, (char *)(msg)+currentOffset, 8);
        currentOffset += 8;

        updateEntry(memberNode, id, port, heartbeat);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r15d
movq %rdx, %rbx
movq %rdi, %r14
movl 0x4(%rdx), %ebp
movq 0x38(%rdi), %r12
movq 0x10(%r12), %rcx
leaq 0x8(%r12), %r13
movq %r13, %rax
testq %rcx, %rcx
je 0x5c24
movq %r13, %rax
xorl %edx, %edx
cmpl %ebp, 0x20(%rcx)
setl %dl
cmovgeq %rcx, %rax
movq 0x10(%rcx,%rdx,8), %rcx
testq %rcx, %rcx
jne 0x5c0e
movq %r13, %rcx
cmpq %r13, %rax
je 0x5c36
cmpl 0x20(%rax), %ebp
cmovlq %r13, %rax
movq %rax, %rcx
cmpq %r13, %rcx
je 0x5c5f
movq 0x18(%r12), %rax
cmpq %r13, %rax
je 0x5c5f
cmpl %ebp, 0x20(%rax)
je 0x5c54
movq %rax, %rdi
callq 0x31b0
jmp 0x5c40
movq %r12, %rdi
movq %rax, %rsi
callq 0x6ada
cmpl $0x12, %r15d
jl 0x5cb3
leal -0x4(%r15), %eax
cltq
imulq $-0x6db6db6d, %rax, %rax # imm = 0x92492493
shrq $0x20, %rax
addl %r15d, %eax
addl $-0x4, %eax
movl %eax, %ecx
shrl $0x1f, %ecx
sarl $0x3, %eax
addl %ecx, %eax
cmpl $0x2, %eax
movl $0x1, %ebp
cmovgel %eax, %ebp
addq $0xa, %rbx
movl -0x6(%rbx), %edx
movswl -0x2(%rbx), %ecx
movq (%rbx), %r8
movq 0x20(%r14), %rsi
movq %r14, %rdi
callq 0x5cc2
addq $0xe, %rbx
decl %ebp
jne 0x5c95
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/zkl94[P]distributed-key-value-store/MP1Node.cpp
// Function: isEntryInvalid(Member*, MemberListEntry&)
bool isEntryInvalid(Member *memberNode, MemberListEntry& memberListEntry) {
    long entry_timestamp = memberListEntry.gettimestamp();
    long node_timestamp = memberNode->memberList[0].gettimestamp();

    if (node_timestamp - entry_timestamp > TFAIL) {
        return true;
    }
    return false;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rsi, %rdi
callq 0xd202
movq %rax, %r14
movq 0x28(%rbx), %rdi
callq 0xd202
subq %r14, %rax
cmpq $0x6, %rax
setge %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/zkl94[P]distributed-key-value-store/Application.cpp
// Function: Application::run()
int Application::run()
{
	int i;
	int timeWhenAllNodesHaveJoined = 0;
	// boolean indicating if all nodes have joined
	bool allNodesJoined = false;
	srand(time(NULL));

	// As time runs along
	for( par->globaltime = 0; par->globaltime < TOTAL_RUNNING_TIME; ++par->globaltime ) {
		// Run the membership protocol
		mp1Run();

		// Wait for all nodes to join
		if ( par->allNodesJoined == nodeCount && !allNodesJoined ) {
			timeWhenAllNodesHaveJoined = par->getcurrtime();
			allNodesJoined = true;
		}
		if ( par->getcurrtime() > timeWhenAllNodesHaveJoined + 50 ) {
			// Call the KV store functionalities
			mp2Run();
		}
		// Fail some nodes
		//fail();
	}

	// Clean up
	en->ENcleanup();
	en1->ENcleanup();

	for(i=0;i<=par->EN_GPSZ-1;i++) {
		 mp1[i]->finishUpThisNode();
	}

	return SUCCESS;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r15d, %r15d
xorl %edi, %edi
callq 0x3210
movl %eax, %edi
callq 0x3230
movq 0x50(%rbx), %rax
movl $0x0, 0x28(%rax)
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x78ea
movq 0x50(%rbx), %rdi
movl 0x2c(%rdi), %eax
cmpl 0x17da0(%rip), %eax     # 0x1f278
jne 0x74eb
testb $0x1, %r15b
jne 0x74eb
callq 0xd162
movl %eax, %r14d
movb $0x1, %r15b
movq 0x50(%rbx), %rdi
callq 0xd162
leal 0x32(%r14), %ecx
cmpl %ecx, %eax
jle 0x7504
movq %rbx, %rdi
callq 0x7ad2
movq 0x50(%rbx), %rax
movl 0x28(%rax), %ecx
leal 0x1(%rcx), %edx
movl %edx, 0x28(%rax)
cmpl $0x2bb, %ecx            # imm = 0x2BB
jl 0x74c3
movq 0x28(%rbx), %rdi
callq 0x71c6
movq 0x30(%rbx), %rdi
callq 0x71c6
movq 0x50(%rbx), %rax
cmpl $0x0, 0x18(%rax)
jle 0x7555
xorl %r14d, %r14d
movq 0x40(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x3d34
incq %r14
movq 0x50(%rbx), %rax
movslq 0x18(%rax), %rax
cmpq %rax, %r14
jl 0x7538
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/zkl94[P]distributed-key-value-store/Application.cpp
// Function: Application::~Application()
Application::~Application() {
	delete log;
	delete en;
	delete en1;
	for ( int i = 0; i < par->EN_GPSZ; i++ ) {
		delete mp1[i];
		delete mp2[i];
	}
	free(mp1);
	free(mp2);
	delete par;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x174b7(%rip), %rax     # 0x1ecd0
movq %rax, (%rdi)
movq 0x38(%rdi), %rdi
testq %rdi, %rdi
je 0x782b
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x783a
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x7849
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x50(%rbx), %rax
cmpl $0x0, 0x18(%rax)
jle 0x789b
xorl %r15d, %r15d
movq 0x40(%rbx), %rax
movq (%rax,%r15,8), %rdi
testq %rdi, %rdi
je 0x7869
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x48(%rbx), %rax
movq (%rax,%r15,8), %r14
testq %r14, %r14
je 0x788b
movq %r14, %rdi
callq 0xefce
movl $0xc0, %esi
movq %r14, %rdi
callq 0x3280
incq %r15
movq 0x50(%rbx), %rax
movslq 0x18(%rax), %rax
cmpq %rax, %r15
jl 0x7856
movq 0x40(%rbx), %rdi
callq 0x3320
movq 0x48(%rbx), %rdi
callq 0x3320
movq 0x50(%rbx), %rdi
testq %rdi, %rdi
je 0x78c0
movl $0x38, %esi
callq 0x3280
addq $0x58, %rbx
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0xbe52
nop
// File: /workspace/github_cpp_makefile_star2_O1/zkl94[P]distributed-key-value-store/Application.cpp
// Function: Application::findARandomNodeThatIsAlive()
int Application::findARandomNodeThatIsAlive() {
	int number;
	do {
		number = (rand()%par->EN_GPSZ);
	}while (mp2[number]->getMemberNode()->bFailed);
	return number;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x30a0
movq 0x48(%rbx), %rcx
movq 0x50(%rbx), %rsi
cltd
idivl 0x18(%rsi)
movslq %edx, %rax
movq (%rcx,%rax,8), %rax
movq 0x50(%rax), %rax
cmpb $0x0, 0x10(%rax)
jne 0xb58a
movl %edx, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/zkl94[P]distributed-key-value-store/Log.cpp
// Function: Log::logCreateSuccess(Address*, bool, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Log::logCreateSuccess(Address * address, bool isCoordinator, int transID, string key, string value){
	static char stdstring[100];
	string str;
	if (isCoordinator)
		str = "coordinator";
	else
		str = "server";
	sprintf(stdstring, "%s: create success at time %d, transID=%d, key=%s, value=%s", str.c_str(), par->getcurrtime(), transID, key.c_str(), value.c_str());
    LOG(address, stdstring);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, %r15
movq %r8, %r12
movl %ecx, %ebp
movq %rsi, 0x10(%rsp)
movq %rdi, %r14
leaq 0x28(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq $0x0, -0x8(%rbx)
movb $0x0, (%rbx)
leaq 0xb05e(%rip), %rax      # 0x1793f
leaq 0xb063(%rip), %rcx      # 0x1794b
testl %edx, %edx
cmovneq %rax, %rcx
movl %edx, %eax
leaq (%rax,%rax,4), %r8
addq $0x6, %r8
leaq 0x18(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x33f0
movq 0x18(%rsp), %r13
movq 0x8(%r14), %rdi
callq 0xd162
movq (%r12), %r9
movq (%r15), %rcx
movq %rcx, (%rsp)
leaq 0x19fca(%rip), %r15     # 0x268f0
leaq 0xb025(%rip), %rsi      # 0x17952
movq %r15, %rdi
movq %r13, %rdx
movl %eax, %ecx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x3080
movq %r14, %rdi
movq 0x10(%rsp), %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0xc4a8
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0xc968
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3280
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0xc991
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3280
movq %r14, %rdi
callq 0x3450
nop
// File: /workspace/github_cpp_makefile_star2_O1/zkl94[P]distributed-key-value-store/Log.cpp
// Function: Log::logReadSuccess(Address*, bool, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Log::logReadSuccess(Address * address, bool isCoordinator, int transID, string key, string value){
    static char stdstring[100];
	string str;
	if (isCoordinator)
		str = "coordinator";
	else
		str = "server";
	sprintf(stdstring, "%s: read success at time %d, transID=%d, key=%s, value=%s", str.c_str(), par->getcurrtime(), transID, key.c_str(), value.c_str());
    LOG(address, stdstring);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, %r15
movq %r8, %r12
movl %ecx, %ebp
movq %rsi, 0x10(%rsp)
movq %rdi, %r14
leaq 0x28(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq $0x0, -0x8(%rbx)
movb $0x0, (%rbx)
leaq 0xaf6c(%rip), %rax      # 0x1793f
leaq 0xaf71(%rip), %rcx      # 0x1794b
testl %edx, %edx
cmovneq %rax, %rcx
movl %edx, %eax
leaq (%rax,%rax,4), %r8
addq $0x6, %r8
leaq 0x18(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x33f0
movq 0x18(%rsp), %r13
movq 0x8(%r14), %rdi
callq 0xd162
movq (%r12), %r9
movq (%r15), %rcx
movq %rcx, (%rsp)
leaq 0x19f48(%rip), %r15     # 0x26960
leaq 0xaf6f(%rip), %rsi      # 0x1798e
movq %r15, %rdi
movq %r13, %rdx
movl %eax, %ecx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x3080
movq %r14, %rdi
movq 0x10(%rsp), %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0xc4a8
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0xca5a
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3280
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0xca83
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3280
movq %r14, %rdi
callq 0x3450
nop
// File: /workspace/github_cpp_makefile_star2_O1/zkl94[P]distributed-key-value-store/Log.cpp
// Function: Log::logUpdateSuccess(Address*, bool, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Log::logUpdateSuccess(Address * address, bool isCoordinator, int transID, string key, string newValue){
    static char stdstring[100];
	string str;
	if (isCoordinator)
		str = "coordinator";
	else
		str = "server";
	sprintf(stdstring, "%s: update success at time %d, transID=%d, key=%s, value=%s", str.c_str(), par->getcurrtime(), transID, key.c_str(), newValue.c_str());
    LOG(address, stdstring);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, %r15
movq %r8, %r12
movl %ecx, %ebp
movq %rsi, 0x10(%rsp)
movq %rdi, %r14
leaq 0x28(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq $0x0, -0x8(%rbx)
movb $0x0, (%rbx)
leaq 0xae7a(%rip), %rax      # 0x1793f
leaq 0xae7f(%rip), %rcx      # 0x1794b
testl %edx, %edx
cmovneq %rax, %rcx
movl %edx, %eax
leaq (%rax,%rax,4), %r8
addq $0x6, %r8
leaq 0x18(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x33f0
movq 0x18(%rsp), %r13
movq 0x8(%r14), %rdi
callq 0xd162
movq (%r12), %r9
movq (%r15), %rcx
movq %rcx, (%rsp)
leaq 0x19ec6(%rip), %r15     # 0x269d0
leaq 0xaeb7(%rip), %rsi      # 0x179c8
movq %r15, %rdi
movq %r13, %rdx
movl %eax, %ecx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x3080
movq %r14, %rdi
movq 0x10(%rsp), %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0xc4a8
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0xcb4c
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3280
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0xcb75
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3280
movq %r14, %rdi
callq 0x3450
nop
// File: /workspace/github_cpp_makefile_star2_O1/zkl94[P]distributed-key-value-store/Log.cpp
// Function: Log::logDeleteSuccess(Address*, bool, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Log::logDeleteSuccess(Address * address, bool isCoordinator, int transID, string key){
    static char stdstring[100];
	string str;
	if (isCoordinator)
		str = "coordinator";
	else
		str = "server";
	sprintf(stdstring, "%s: delete success at time %d, transID=%d, key=%s", str.c_str(), par->getcurrtime(), transID, key.c_str());
    LOG(address, stdstring);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %r15
movl %ecx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
movq $0x0, -0x8(%r13)
movb $0x0, (%r13)
leaq 0xad8b(%rip), %rax      # 0x1793f
leaq 0xad90(%rip), %rcx      # 0x1794b
testl %edx, %edx
cmovneq %rax, %rcx
movl %edx, %eax
leaq (%rax,%rax,4), %r8
addq $0x6, %r8
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x33f0
movq 0x8(%rsp), %r12
movq 0x8(%r14), %rdi
callq 0xd162
movq (%r15), %r9
leaq 0x19e4f(%rip), %r15     # 0x26a40
leaq 0xae0c(%rip), %rsi      # 0x17a04
movq %r15, %rdi
movq %r12, %rdx
movl %eax, %ecx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x3080
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0xc4a8
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0xcc31
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0xcc5a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
movq %rbx, %rdi
callq 0x3450
// File: /workspace/github_cpp_makefile_star2_O1/zkl94[P]distributed-key-value-store/Log.cpp
// Function: Log::logCreateFail(Address*, bool, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Log::logCreateFail(Address * address, bool isCoordinator, int transID, string key, string value){
	static char stdstring[100];
	string str;
	if (isCoordinator)
		str = "coordinator";
	else
		str = "server";
	sprintf(stdstring, "%s: create fail at time %d, transID=%d, key=%s, value=%s", str.c_str(), par->getcurrtime(), transID, key.c_str(), value.c_str());
    LOG(address, stdstring);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, %r15
movq %r8, %r12
movl %ecx, %ebp
movq %rsi, 0x10(%rsp)
movq %rdi, %r14
leaq 0x28(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq $0x0, -0x8(%rbx)
movb $0x0, (%rbx)
leaq 0xaca4(%rip), %rax      # 0x1793f
leaq 0xaca9(%rip), %rcx      # 0x1794b
testl %edx, %edx
cmovneq %rax, %rcx
movl %edx, %eax
leaq (%rax,%rax,4), %r8
addq $0x6, %r8
leaq 0x18(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x33f0
movq 0x18(%rsp), %r13
movq 0x8(%r14), %rdi
callq 0xd162
movq (%r12), %r9
movq (%r15), %rcx
movq %rcx, (%rsp)
leaq 0x19dd0(%rip), %r15     # 0x26ab0
leaq 0xad4f(%rip), %rsi      # 0x17a36
movq %r15, %rdi
movq %r13, %rdx
movl %eax, %ecx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x3080
movq %r14, %rdi
movq 0x10(%rsp), %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0xc4a8
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0xcd22
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3280
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0xcd4b
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x3280
movq %r14, %rdi
callq 0x3450
nop