// File: dekanfrus[P]pThreads/osproj2c.cpp
// Function: vow(void*)
void *vow(void*)
{
	// Initial yield to allow the other thread to begin operations first
	sched_yield();

	// Stores the length of the phrase vector as an integer.
	int end = (int)phrase.size();

	// Iterate through the phrase vector and look for vowels.
	// If the word begins with a vowel, print that word.
	// Otherwise, yield the CPU to the other thread.
	for (int i = 0; i != end; i++)
	{
		if (phrase[i][0] == 'A' || phrase[i][0] == 'a' || phrase[i][0] == 'E' || phrase[i][0] == 'e' || phrase[i][0] == 'I' || phrase[i][0] == 'i' || phrase[i][0] == 'O' || phrase[i][0] == 'o' || phrase[i][0] == 'U' || phrase[i][0] == 'u')
			cout << "Vow: " << phrase[i] << endl;
		else sched_yield();
	}
	// Exit the thread upon function completion.
	pthread_exit(NULL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
callq 0x2180
leaq 0x3b80(%rip), %rdi      # 0x6128
callq 0x29e0
movl %eax, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
je 0x279c
movslq -0x10(%rbp), %rsi
leaq 0x3b5a(%rip), %rdi      # 0x6128
callq 0x2a00
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21f0
movsbl (%rax), %eax
cmpl $0x41, %eax
je 0x2743
movslq -0x10(%rbp), %rsi
leaq 0x3b32(%rip), %rdi      # 0x6128
callq 0x2a00
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21f0
movsbl (%rax), %eax
cmpl $0x61, %eax
je 0x2743
movslq -0x10(%rbp), %rsi
leaq 0x3b0a(%rip), %rdi      # 0x6128
callq 0x2a00
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21f0
movsbl (%rax), %eax
cmpl $0x45, %eax
je 0x2743
movslq -0x10(%rbp), %rsi
leaq 0x3ae2(%rip), %rdi      # 0x6128
callq 0x2a00
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21f0
movsbl (%rax), %eax
cmpl $0x65, %eax
je 0x2743
movslq -0x10(%rbp), %rsi
leaq 0x3aba(%rip), %rdi      # 0x6128
callq 0x2a00
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21f0
movsbl (%rax), %eax
cmpl $0x49, %eax
je 0x2743
movslq -0x10(%rbp), %rsi
leaq 0x3a92(%rip), %rdi      # 0x6128
callq 0x2a00
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21f0
movsbl (%rax), %eax
cmpl $0x69, %eax
je 0x2743
movslq -0x10(%rbp), %rsi
leaq 0x3a6a(%rip), %rdi      # 0x6128
callq 0x2a00
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21f0
movsbl (%rax), %eax
cmpl $0x4f, %eax
je 0x2743
movslq -0x10(%rbp), %rsi
leaq 0x3a46(%rip), %rdi      # 0x6128
callq 0x2a00
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21f0
movsbl (%rax), %eax
cmpl $0x6f, %eax
je 0x2743
movslq -0x10(%rbp), %rsi
leaq 0x3a22(%rip), %rdi      # 0x6128
callq 0x2a00
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21f0
movsbl (%rax), %eax
cmpl $0x55, %eax
je 0x2743
movslq -0x10(%rbp), %rsi
leaq 0x39fe(%rip), %rdi      # 0x6128
callq 0x2a00
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x21f0
movsbl (%rax), %eax
cmpl $0x75, %eax
jne 0x2787
movq 0x3886(%rip), %rdi      # 0x5fd0
leaq 0x18b9(%rip), %rsi      # 0x400a
callq 0x2100
movq %rax, -0x18(%rbp)
movslq -0x10(%rbp), %rsi
leaq 0x39c3(%rip), %rdi      # 0x6128
callq 0x2a00
movq -0x18(%rbp), %rdi
movq %rax, %rsi
callq 0x20e0
movq %rax, %rdi
movq 0x3840(%rip), %rsi      # 0x5fc0
callq 0x2130
jmp 0x278c
callq 0x2180
jmp 0x278e
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x25b7
xorl %eax, %eax
movl %eax, %edi
callq 0x21d0
nopw %cs:(%rax,%rax)