// File: janthonyo[P]Redes-Practicas/./domino.cc
// Function: domino::startPlayer()
int startPlayer()
	{
		ficha aux;

		// Comprobamos quien tiene el doble mayor
		for (int i = 6; i >= 0; i--)
		{
			aux.left = i;
			aux.right = i;

			if(hasFicha(aux, player1.hand))
			{
				if(putInBoard(aux))
				{
					quitPieceJ1(aux);
					return 2;
				}
			}

			else if(hasFicha(aux, player2.hand))
			{
				if(putInBoard(aux))
				{
					quitPieceJ2(aux);
					return 1;
				}
			}

		}

		// Comprobamos quien tiene la ficha mas alta
		for (int i = 6; i >= 0; i--)
		{
			for (int j = i - 1; j >= 0; j--)
			{
				aux.left = i;
				aux.right = j;

				if(hasFicha(aux, player1.hand))
				{
					if(putInBoard(aux))
					{
						quitPieceJ1(aux);
						return 2;
					}
				}

				else if(hasFicha(aux, player2.hand))
				{
					if(putInBoard(aux))
					{
						quitPieceJ2(aux);
						return 1;
					}
				}
			}
		}
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x100(%rbp)
movl $0x6, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jl 0x78f8
movq -0x100(%rbp), %rsi
movl -0x1c(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x14(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
addq $0x98, %rsi
leaq -0x40(%rbp), %rdi
movq %rdi, -0x110(%rbp)
callq 0xa1e0
movq -0x100(%rbp), %rdi
movq -0x110(%rbp), %rdx
movq -0x28(%rbp), %rsi
callq 0x7c20
movb %al, -0x101(%rbp)
jmp 0x77ac
leaq -0x40(%rbp), %rdi
callq 0x76a0
movb -0x101(%rbp), %al
testb $0x1, %al
jne 0x77c1
jmp 0x7822
movq -0x100(%rbp), %rdi
movq -0x18(%rbp), %rax
movq %rax, -0x54(%rbp)
movq -0x54(%rbp), %rsi
callq 0xa2d0
testb $0x1, %al
jne 0x77df
jmp 0x781d
movq -0x100(%rbp), %rdi
movq -0x18(%rbp), %rax
movq %rax, -0x5c(%rbp)
movq -0x5c(%rbp), %rsi
callq 0xa460
movl $0x2, -0x4(%rbp)
jmp 0x7b10
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x76a0
jmp 0x7b1c
jmp 0x78e8
movq -0x100(%rbp), %rsi
movq -0x18(%rbp), %rax
movq %rax, -0x68(%rbp)
addq $0x118, %rsi            # imm = 0x118
leaq -0x80(%rbp), %rdi
movq %rdi, -0x120(%rbp)
callq 0xa1e0
movq -0x100(%rbp), %rdi
movq -0x120(%rbp), %rdx
movq -0x68(%rbp), %rsi
callq 0x7c20
movb %al, -0x111(%rbp)
jmp 0x7867
leaq -0x80(%rbp), %rdi
callq 0x76a0
movb -0x111(%rbp), %al
testb $0x1, %al
jne 0x787c
jmp 0x78e6
movq -0x100(%rbp), %rdi
movq -0x18(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rsi
callq 0xa2d0
testb $0x1, %al
jne 0x78a0
jmp 0x78e4
movq -0x100(%rbp), %rdi
movq -0x18(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rsi
callq 0xa600
movl $0x1, -0x4(%rbp)
jmp 0x7b10
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x76a0
jmp 0x7b1c
jmp 0x78e6
jmp 0x78e8
jmp 0x78ea
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x7751
movl $0x6, -0x94(%rbp)
cmpl $0x0, -0x94(%rbp)
jl 0x7b0e
movl -0x94(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x98(%rbp)
cmpl $0x0, -0x98(%rbp)
jl 0x7af8
movq -0x100(%rbp), %rsi
movl -0x94(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x98(%rbp), %eax
movl %eax, -0x14(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xa0(%rbp)
addq $0x98, %rsi
leaq -0xb8(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0xa1e0
movq -0x100(%rbp), %rdi
movq -0x130(%rbp), %rdx
movq -0xa0(%rbp), %rsi
callq 0x7c20
movb %al, -0x121(%rbp)
jmp 0x798b
leaq -0xb8(%rbp), %rdi
callq 0x76a0
movb -0x121(%rbp), %al
testb $0x1, %al
jne 0x79a3
jmp 0x7a13
movq -0x100(%rbp), %rdi
movq -0x18(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rsi
callq 0xa2d0
testb $0x1, %al
jne 0x79c7
jmp 0x7a0e
movq -0x100(%rbp), %rdi
movq -0x18(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rsi
callq 0xa460
movl $0x2, -0x4(%rbp)
jmp 0x7b10
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x76a0
jmp 0x7b1c
jmp 0x7ae2
movq -0x100(%rbp), %rsi
movq -0x18(%rbp), %rax
movq %rax, -0xd0(%rbp)
addq $0x118, %rsi            # imm = 0x118
leaq -0xe8(%rbp), %rdi
movq %rdi, -0x140(%rbp)
callq 0xa1e0
movq -0x100(%rbp), %rdi
movq -0x140(%rbp), %rdx
movq -0xd0(%rbp), %rsi
callq 0x7c20
movb %al, -0x131(%rbp)
jmp 0x7a61
leaq -0xe8(%rbp), %rdi
callq 0x76a0
movb -0x131(%rbp), %al
testb $0x1, %al
jne 0x7a79
jmp 0x7ae0
movq -0x100(%rbp), %rdi
movq -0x18(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0xf0(%rbp), %rsi
callq 0xa2d0
testb $0x1, %al
jne 0x7a9d
jmp 0x7ade
movq -0x100(%rbp), %rdi
movq -0x18(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0xf8(%rbp), %rsi
callq 0xa600
movl $0x1, -0x4(%rbp)
jmp 0x7b10
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x76a0
jmp 0x7b1c
jmp 0x7ae0
jmp 0x7ae2
jmp 0x7ae4
movl -0x98(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x98(%rbp)
jmp 0x791e
jmp 0x7afa
movl -0x94(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x7902
ud2
movl -0x4(%rbp), %eax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x3420
nopw %cs:(%rax,%rax)
nop