// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/util.c
// Function: util_get_uint64_hex_val
uint64_t util_get_uint64_hex_val(const char *str, uint32_t len) {
	#define	_IS_HEX_DIGIT(chr)	(((chr) >= '0' && (chr) <= '9') || ((chr) >= 'a' && (chr) <= 'f') || ((chr) >= 'A' && (chr) <= 'F'))

	assert(str && len > 2 && str[0] == '0' && str[1] == 'x' && _IS_HEX_DIGIT(str[2]));

	const char *s = str + len - 1;
	str += 2;

	uint64_t v = 0;
	uint64_t base = 1;
	while (s >= str) {
		const char chr = *(s--);
		if (_IS_HEX_DIGIT(chr)) {
			if (chr >= '0' && chr <= '9') {
				v += (chr - '0') * base;
			} else if (chr >= 'a' && chr <= 'f') {
				v += (10 + (chr - 'a')) * base;
			} else {
				v += (10 + (chr - 'A')) * base;
			}
			base *= 16;
		} else if (chr == '_') {
			;
		} else if (chr == 'u') {
			continue;
		} else {
			assert(0);
		}
	}

	return v;

	#undef	_IS_HEX_DIGIT
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x141d5
cmpl $0x2, -0xc(%rbp)
jbe 0x141d5
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jne 0x141d5
movq -0x8(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x78, %eax
jne 0x141d5
movq -0x8(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x30, %eax
jl 0x1419f
movq -0x8(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x39, %eax
jle 0x141d3
movq -0x8(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x61, %eax
jl 0x141b9
movq -0x8(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x66, %eax
jle 0x141d3
movq -0x8(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x41, %eax
jl 0x141d5
movq -0x8(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x46, %eax
jg 0x141d5
jmp 0x141f4
leaq 0x34907(%rip), %rdi     # 0x48ae3
leaq 0x3435d(%rip), %rsi     # 0x48540
movl $0x25d, %edx            # imm = 0x25D
leaq 0x3493e(%rip), %rcx     # 0x48b2d
callq 0xa0b0
movq -0x8(%rbp), %rax
movl -0xc(%rbp), %ecx
addq %rcx, %rax
addq $-0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x8(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x1, -0x28(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x8(%rbp), %rax
jb 0x14341
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $-0x1, %rcx
movq %rcx, -0x18(%rbp)
movb (%rax), %al
movb %al, -0x29(%rbp)
movsbl -0x29(%rbp), %eax
cmpl $0x30, %eax
jl 0x14256
movsbl -0x29(%rbp), %eax
cmpl $0x39, %eax
jle 0x14282
movsbl -0x29(%rbp), %eax
cmpl $0x61, %eax
jl 0x14268
movsbl -0x29(%rbp), %eax
cmpl $0x66, %eax
jle 0x14282
movsbl -0x29(%rbp), %eax
cmpl $0x41, %eax
jl 0x14302
movsbl -0x29(%rbp), %eax
cmpl $0x46, %eax
jg 0x14302
movsbl -0x29(%rbp), %eax
cmpl $0x30, %eax
jl 0x142ac
movsbl -0x29(%rbp), %eax
cmpl $0x39, %eax
jg 0x142ac
movsbl -0x29(%rbp), %eax
subl $0x30, %eax
cltq
imulq -0x28(%rbp), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x142f4
movsbl -0x29(%rbp), %eax
cmpl $0x61, %eax
jl 0x142d9
movsbl -0x29(%rbp), %eax
cmpl $0x66, %eax
jg 0x142d9
movsbl -0x29(%rbp), %eax
subl $0x61, %eax
addl $0xa, %eax
cltq
imulq -0x28(%rbp), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x142f2
movsbl -0x29(%rbp), %eax
subl $0x41, %eax
addl $0xa, %eax
cltq
imulq -0x28(%rbp), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x142f4
movq -0x28(%rbp), %rax
shlq $0x4, %rax
movq %rax, -0x28(%rbp)
jmp 0x1433c
movsbl -0x29(%rbp), %eax
cmpl $0x5f, %eax
jne 0x1430d
jmp 0x1433a
movsbl -0x29(%rbp), %eax
cmpl $0x75, %eax
jne 0x1431b
jmp 0x14222
leaq 0x33143(%rip), %rdi     # 0x47465
leaq 0x34217(%rip), %rsi     # 0x48540
movl $0x274, %edx            # imm = 0x274
leaq 0x347f8(%rip), %rcx     # 0x48b2d
callq 0xa0b0
jmp 0x1433c
jmp 0x14222
movq -0x20(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)