// File: pelrun[P]aft/optionParser.c
// Function: compareOptionString
int compareOptionString(char *argv, char shortName, const char *longName)
{
	unsigned int i;
	if (argv == NULL || longName == NULL)
		RET_ERROR(ERROR_UNKNOWN, "Internal error");

	if (argv[0] != '-')
		RET_ERROR( ERROR_UNKOPT, "Unknown option, not beginning with '-'");
	if (argv[1] != '-')
	{
		if (strlen(argv) != 2)
			RET_ERROR( ERROR_UNKOPT, "Unknown option, '-' with more than one caracter");
		if (toupper(argv[1]) == toupper(shortName))
			RET_ERROR( OPT_NO_ERROR, "No error");
		RET_ERROR( ERROR_UNKOPT, "Unknown option");
	}
	else
	{
		if ((strlen(argv)-2) != strlen(longName))
			RET_ERROR( ERROR_UNKOPT, "Unknown option");
		i = 0;
		while ((toupper(argv[i+2]) == toupper(longName[i])) && (i < strlen(longName)))
			i++;
		if (i == strlen(longName))
			RET_ERROR( OPT_NO_ERROR, "No error");
		RET_ERROR( ERROR_UNKOPT, "Unknown option");
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movb %sil, %al
movq %rdi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xd4d4
cmpq $0x0, -0x20(%rbp)
jne 0xd4fd
movl $0xffffffff, 0xe142(%rip) # imm = 0xFFFFFFFF
leaq 0xe14b(%rip), %rdi      # 0x1b630
leaq 0x8515(%rip), %rsi      # 0x15a01
callq 0x42c0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd715
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0xd532
movl $0xfffffffe, 0xe10d(%rip) # imm = 0xFFFFFFFE
leaq 0xe116(%rip), %rdi      # 0x1b630
leaq 0x84ef(%rip), %rsi      # 0x15a10
callq 0x42c0
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0xd715
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x2d, %eax
je 0xd5ef
movq -0x10(%rbp), %rdi
callq 0x4160
cmpq $0x2, %rax
je 0xd57b
movl $0xfffffffe, 0xe0c4(%rip) # imm = 0xFFFFFFFE
leaq 0xe0cd(%rip), %rdi      # 0x1b630
leaq 0x84cd(%rip), %rsi      # 0x15a37
callq 0x42c0
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0xd715
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %edi
callq 0x4650
movl %eax, -0x28(%rbp)
movsbl -0x11(%rbp), %edi
callq 0x4650
movl %eax, %ecx
movl -0x28(%rbp), %eax
cmpl %ecx, %eax
jne 0xd5c6
movl $0x0, 0xe079(%rip)      # 0x1b620
leaq 0xe082(%rip), %rdi      # 0x1b630
leaq 0x84b2(%rip), %rsi      # 0x15a67
callq 0x42c0
movl $0x0, -0x4(%rbp)
jmp 0xd715
movl $0xfffffffe, 0xe050(%rip) # imm = 0xFFFFFFFE
leaq 0xe059(%rip), %rdi      # 0x1b630
leaq 0x8492(%rip), %rsi      # 0x15a70
callq 0x42c0
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0xd715
movq -0x10(%rbp), %rdi
callq 0x4160
subq $0x2, %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rdi
callq 0x4160
movq %rax, %rcx
movq -0x30(%rbp), %rax
cmpq %rcx, %rax
je 0xd63e
movl $0xfffffffe, 0xe001(%rip) # imm = 0xFFFFFFFE
leaq 0xe00a(%rip), %rdi      # 0x1b630
leaq 0x8443(%rip), %rsi      # 0x15a70
callq 0x42c0
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0xd715
movl $0x0, -0x24(%rbp)
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
addl $0x2, %ecx
movl %ecx, %ecx
movsbl (%rax,%rcx), %edi
callq 0x4650
movl %eax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movl -0x24(%rbp), %ecx
movsbl (%rax,%rcx), %edi
callq 0x4650
movl -0x38(%rbp), %ecx
movl %eax, %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x31(%rbp)
jne 0xd69b
movl -0x24(%rbp), %eax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rdi
callq 0x4160
movq %rax, %rcx
movq -0x40(%rbp), %rax
cmpq %rcx, %rax
setb %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0xd6a4
jmp 0xd6af
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xd645
movl -0x24(%rbp), %eax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rdi
callq 0x4160
movq %rax, %rcx
movq -0x48(%rbp), %rax
cmpq %rcx, %rax
jne 0xd6f1
movl $0x0, 0xdf4b(%rip)      # 0x1b620
leaq 0xdf54(%rip), %rdi      # 0x1b630
leaq 0x8384(%rip), %rsi      # 0x15a67
callq 0x42c0
movl $0x0, -0x4(%rbp)
jmp 0xd715
movl $0xfffffffe, 0xdf25(%rip) # imm = 0xFFFFFFFE
leaq 0xdf2e(%rip), %rdi      # 0x1b630
leaq 0x8367(%rip), %rsi      # 0x15a70
callq 0x42c0
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nop