// File: /workspace/github_c_makefile_star2_O2/upcrob[P]garry/moves.c
// Function: receiveMoveSet()
MoveSet* receiveMoveSet()
{
	//Get set size
	int i;
	int size;
	COMM_WORLD.Recv(&size, 1, MPI_INT, HEAD, 0);
	
	//Allocate MoveSet structure
	MoveSet* set = (MoveSet*) malloc(sizeof(MoveSet));
	set->size = size;
	set->cap = size;
	set->moves  = (Move**) malloc(sizeof(Move*) * size);
	
	//Receive move data
	for (i = 0; i < size; i++)
	{
		Move* m = (Move*) malloc(sizeof(Move));
		COMM_WORLD.Recv(&m->pieceId, 1, MPI_CHAR, HEAD, 0);
		COMM_WORLD.Recv(&m->startRow, 1, MPI_CHAR, HEAD, 0);
		COMM_WORLD.Recv(&m->startCol, 1, MPI_CHAR, HEAD, 0);
		COMM_WORLD.Recv(&m->endRow, 1, MPI_CHAR, HEAD, 0);
		COMM_WORLD.Recv(&m->endCol, 1, MPI_CHAR, HEAD, 0);
		COMM_WORLD.Recv(&m->boardScore, 1, MPI_INT, HEAD, 0);
		set->moves[i] = m;
	}
	
	//Return MoveSet
	return set;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
leaq 0x333e(%rip), %rax      # 0xcc28
leaq -0x38(%rbp), %rcx
movq %rax, (%rcx)
movq 0x36e0(%rip), %rax      # 0xcfd8
movq %rax, 0x8(%rcx)
movq 0x36cd(%rip), %rdi      # 0xcfd0
leaq -0x3c(%rbp), %r12
pushq $0x1
popq %rdx
xorl %ebx, %ebx
movq %r12, %rsi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x2fa4
pushq $0x10
popq %rdi
callq 0x2250
movq %rax, %r14
movslq (%r12), %r12
movl %r12d, 0x4(%rax)
movl %r12d, (%rax)
movq %r12, %rdi
shlq $0x3, %rdi
callq 0x2250
movq %r14, -0x48(%rbp)
movq %rax, -0x50(%rbp)
movq %rax, 0x8(%r14)
movslq %r12d, %rax
cmpq %rax, %rbx
jge 0x9a95
pushq $0xc
popq %rdi
callq 0x2250
movq %rax, %r12
leaq 0x32c2(%rip), %r14      # 0xcc28
movq %r14, -0x38(%rbp)
movq 0x363f(%rip), %rax      # 0xcfb0
movq %rax, -0x30(%rbp)
movq %rbx, -0x58(%rbp)
movq 0x3650(%rip), %rdi      # 0xcfd0
movq %r12, %rsi
pushq $0x1
popq %rdx
leaq -0x38(%rbp), %r13
movq %r13, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x2fa4
leaq 0x1(%r12), %rsi
movq %r14, -0x38(%rbp)
movq 0x3608(%rip), %rbx      # 0xcfb0
movq %rbx, -0x30(%rbp)
movq 0x361d(%rip), %r14      # 0xcfd0
movq %r14, %rdi
pushq $0x1
popq %r15
movl %r15d, %edx
movq %r13, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x2fa4
leaq 0x2(%r12), %rsi
leaq 0x3251(%rip), %rax      # 0xcc28
movq %rax, -0x38(%rbp)
movq %rbx, -0x30(%rbp)
movq %r14, %rdi
movl %r15d, %edx
movl %r15d, %ebx
movq %r13, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x2fa4
leaq 0x3(%r12), %rsi
leaq 0x3226(%rip), %r15      # 0xcc28
movq %r15, -0x38(%rbp)
movq 0x35a3(%rip), %rax      # 0xcfb0
movq %rax, -0x30(%rbp)
movq %r14, %rdi
movl %ebx, %edx
movq %r13, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x2fa4
leaq 0x4(%r12), %rsi
movq %r15, -0x38(%rbp)
movq 0x357c(%rip), %rax      # 0xcfb0
movq %rax, -0x30(%rbp)
movq %r14, %rdi
movl %ebx, %edx
movl %ebx, %r15d
movq %r13, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x2fa4
leaq 0x8(%r12), %rsi
leaq 0x31ce(%rip), %rax      # 0xcc28
movq %rax, -0x38(%rbp)
movq 0x3573(%rip), %rax      # 0xcfd8
movq %rax, -0x30(%rbp)
movq %r14, %rdi
movq -0x58(%rbp), %rbx
movl %r15d, %edx
movq %r13, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x2fa4
movq -0x50(%rbp), %rax
movq %r12, (%rax,%rbx,8)
incq %rbx
movl -0x3c(%rbp), %r12d
jmp 0x9948
movq -0x48(%rbp), %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq