// File: /workspace/github_c_makefile_star2_O0/mkubecek[P]nperf/common.c
// Function: parse_ulong_delim
int parse_ulong_delim(const char *name, const char *str, unsigned long *val,
		      char delimiter, const char **next)
{
	unsigned long factor = 1;
	char *eptr;
	char c;

	if (!*str)
		goto invalid;
	*val = strtoul(str, &eptr, 10);

	c = *eptr++;
	switch(c) {
	case '\0':
		eptr--;
		break;
	case 'k':
		factor = 1000UL;
		break;
	case 'K':
		factor = 1UL << 10;
		break;
	case 'm':
		factor = 1000000UL;
		break;
	case 'M':
		factor = 1UL << 20;
		break;
	case 'g':
		factor = 1000000000UL;
		break;
	case 'G':
		factor = 1UL << 30;
		break;
	case 't':
		factor = 1000000000000UL;
		break;
	case 'T':
		factor = 1UL << 40;
		break;
	default:
		eptr--;
		break;
	}
	if (*eptr) {
	       if (*eptr != delimiter)
		       goto invalid;
	}

	if (*val > ULONG_MAX / factor) {
		fprintf(stderr, "value '%s' of %s too large\n", str, name);
		return -EINVAL;
	}
	*val *= factor;
	if (next)
		*next = eptr;
	return 0;

invalid:
	fprintf(stderr, "invalid value '%s' of %s\n", str, name);
	return -EINVAL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movb %cl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movb %al, -0x21(%rbp)
movq %r8, -0x30(%rbp)
movq $0x1, -0x38(%rbp)
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
jne 0x2683
jmp 0x2822
movq -0x18(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movl $0xa, %edx
callq 0x11e0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rax
movq %rax, %rcx
incq %rcx
movq %rcx, -0x40(%rbp)
movb (%rax), %al
movb %al, -0x41(%rbp)
movsbl -0x41(%rbp), %eax
movl %eax, -0x48(%rbp)
testl %eax, %eax
je 0x2717
jmp 0x26bf
movl -0x48(%rbp), %eax
subl $0x47, %eax
je 0x2757
jmp 0x26cd
movl -0x48(%rbp), %eax
subl $0x4b, %eax
je 0x272f
jmp 0x26d7
movl -0x48(%rbp), %eax
subl $0x4d, %eax
je 0x2743
jmp 0x26e1
movl -0x48(%rbp), %eax
subl $0x54, %eax
je 0x2771
jmp 0x26ef
movl -0x48(%rbp), %eax
subl $0x67, %eax
je 0x274d
jmp 0x26f9
movl -0x48(%rbp), %eax
subl $0x6b, %eax
je 0x2725
jmp 0x2703
movl -0x48(%rbp), %eax
subl $0x6d, %eax
je 0x2739
jmp 0x270d
movl -0x48(%rbp), %eax
subl $0x74, %eax
je 0x2761
jmp 0x2781
movq -0x40(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x278d
movq $0x3e8, -0x38(%rbp)     # imm = 0x3E8
jmp 0x278d
movq $0x400, -0x38(%rbp)     # imm = 0x400
jmp 0x278d
movq $0xf4240, -0x38(%rbp)   # imm = 0xF4240
jmp 0x278d
movq $0x100000, -0x38(%rbp)  # imm = 0x100000
jmp 0x278d
movq $0x3b9aca00, -0x38(%rbp) # imm = 0x3B9ACA00
jmp 0x278d
movq $0x40000000, -0x38(%rbp) # imm = 0x40000000
jmp 0x278d
movabsq $0xe8d4a51000, %rax     # imm = 0xE8D4A51000
movq %rax, -0x38(%rbp)
jmp 0x278d
movabsq $0x10000000000, %rax    # imm = 0x10000000000
movq %rax, -0x38(%rbp)
jmp 0x278d
movq -0x40(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpb $0x0, (%rax)
je 0x27a9
movq -0x40(%rbp), %rax
movsbl (%rax), %eax
movsbl -0x21(%rbp), %ecx
cmpl %ecx, %eax
je 0x27a7
jmp 0x2822
jmp 0x27a9
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movq $-0x1, %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0x38(%rbp)
movq %rax, %rcx
movq -0x50(%rbp), %rax
cmpq %rcx, %rax
jbe 0x27f8
movq 0x2822(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
movq -0x18(%rbp), %rdx
movq -0x10(%rbp), %rcx
leaq 0xbba(%rip), %rsi       # 0x33a2
movb $0x0, %al
callq 0x1130
movl $0xffffffea, -0x4(%rbp) # imm = 0xFFFFFFEA
jmp 0x2849
movq -0x38(%rbp), %rcx
movq -0x20(%rbp), %rax
imulq (%rax), %rcx
movq %rcx, (%rax)
cmpq $0x0, -0x30(%rbp)
je 0x2819
movq -0x40(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x2849
movq 0x27cf(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
movq -0x18(%rbp), %rdx
movq -0x10(%rbp), %rcx
leaq 0xb83(%rip), %rsi       # 0x33be
movb $0x0, %al
callq 0x1130
movl $0xffffffea, -0x4(%rbp) # imm = 0xFFFFFFEA
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)