// File: /workspace/github_c_makefile_star2_O0/intel[P]pf-bb-config/bb_acc_vfio.c
// Function: vfio_uuid_parse
int vfio_uuid_parse(char *uuid_str, unsigned char *uuid)
{
	int i, inx;
	int high_n = 1;
	unsigned char tmp;

	if (strlen(uuid_str) != VFIO_VF_TOKEN_STR_LEN) {
		LOG(ERR, "uuid string len is wrong: %d", (int)strlen(uuid_str));
		return -1;
	}
	for (i = 0, inx = 0;
			((i < VFIO_VF_TOKEN_STR_LEN) && (inx < VFIO_VF_TOKEN_LEN));
			i++) {
		if (uuid_str[i] == '-') {
			if ((i ==  8) || (i == 13) || (i == 18) || (i == 23))
				continue;
		}
		if (!isxdigit(uuid_str[i])) {
			LOG(ERR, "Unknown char in uuid string");
			return -1;
		}
		tmp = isdigit(uuid_str[i]) ? uuid_str[i] - '0' :
				tolower(uuid_str[i]) - 'a' + 0xA;

		if (high_n) {
			uuid[inx] = (tmp & 0xF) << 4;
			high_n = 0;
		} else {
			uuid[inx++] |= (tmp & 0xF);
			high_n = 1;
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x1, -0x24(%rbp)
movq -0x10(%rbp), %rdi
callq 0xd0f0
cmpq $0x24, %rax
je 0x1f4bf
callq 0x20230
movq %rax, -0x38(%rbp)
leaq 0x1c44a(%rip), %rax     # 0x3b8d0
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0xd0f0
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %r8
movl %eax, %r9d
xorl %esi, %esi
leaq 0x66ea(%rip), %rdx      # 0x25b94
movl %esi, %edi
movb $0x0, %al
callq 0x216e0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1f632
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
xorl %eax, %eax
cmpl $0x24, -0x1c(%rbp)
movb %al, -0x39(%rbp)
jge 0x1f4e2
cmpl $0x10, -0x20(%rbp)
setl %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x1f4ee
jmp 0x1f62b
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x2d, %eax
jne 0x1f51e
cmpl $0x8, -0x1c(%rbp)
je 0x1f517
cmpl $0xd, -0x1c(%rbp)
je 0x1f517
cmpl $0x12, -0x1c(%rbp)
je 0x1f517
cmpl $0x17, -0x1c(%rbp)
jne 0x1f51c
jmp 0x1f61d
jmp 0x1f51e
callq 0xd440
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
jne 0x1f573
callq 0x20230
movq %rax, %rcx
leaq 0x1c37e(%rip), %rax     # 0x3b8d0
movq (%rax), %r8
xorl %esi, %esi
leaq 0x665a(%rip), %rdx      # 0x25bb8
movl %esi, %edi
movb $0x0, %al
callq 0x216e0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1f632
callq 0xd440
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0x1f5ac
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
subl $0x30, %eax
movl %eax, -0x40(%rbp)
jmp 0x1f5c6
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movsbl (%rax,%rcx), %edi
callq 0xd270
subl $0x61, %eax
addl $0xa, %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
movb %al, -0x25(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x1f5f2
movzbl -0x25(%rbp), %eax
andl $0xf, %eax
shll $0x4, %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl $0x0, -0x24(%rbp)
jmp 0x1f61b
movzbl -0x25(%rbp), %esi
andl $0xf, %esi
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movslq %ecx, %rcx
movzbl (%rax,%rcx), %edx
orl %esi, %edx
movb %dl, (%rax,%rcx)
movl $0x1, -0x24(%rbp)
jmp 0x1f61d
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1f4cd
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)