// File: /workspace/github_c_makefile_star2_O0/yakushstanislav[P]EagleMQ/src/utils.c
// Function: check_input_buffer2
int check_input_buffer2(char *buffer, size_t size)
{
	char *ptr = buffer, *end_ptr = buffer + size;
	int length = 0;
	int extra = 0;

	while (ptr < end_ptr) {
		if (*++ptr == '\0') {
			length = ptr - buffer;
			break;
		}
	}

	if (!length) {
		return 0;
	}

	if (!IS_ALPHA(*buffer) && *buffer != '_' && *buffer != '.') {
		return 0;
	}

	if (*buffer == '_' || *buffer == '.') {
		extra = 1;
	}

	for (ptr = buffer + 1; ptr < (buffer + length - 1); ptr++)
	{
		if (IS_EXTRA1(*ptr) && extra) {
			return 0;
		}

		if (!IS_ALPHANUM(*ptr) && !IS_EXTRA1(*ptr)) {
			return 0;
		}

		extra = 0;
		if (IS_EXTRA1(*ptr)) {
			extra = 1;
		}
	}

	return length;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x6412
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movsbl 0x1(%rax), %eax
cmpl $0x0, %eax
jne 0x6410
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x2c(%rbp)
jmp 0x6412
jmp 0x63de
cmpl $0x0, -0x2c(%rbp)
jne 0x6424
movl $0x0, -0x4(%rbp)
jmp 0x659d
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
orl $0x20, %eax
movzbl %al, %eax
cmpl $0x61, %eax
jl 0x6448
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
orl $0x20, %eax
movzbl %al, %eax
cmpl $0x7a, %eax
jle 0x646c
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5f, %eax
je 0x646c
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
je 0x646c
movl $0x0, -0x4(%rbp)
jmp 0x659d
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5f, %eax
je 0x6484
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
jne 0x648b
movl $0x1, -0x30(%rbp)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
movslq -0x2c(%rbp), %rdx
addq %rdx, %rcx
addq $-0x1, %rcx
cmpq %rcx, %rax
jae 0x6597
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5f, %eax
je 0x64d7
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x64d7
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
jne 0x64e9
cmpl $0x0, -0x30(%rbp)
je 0x64e9
movl $0x0, -0x4(%rbp)
jmp 0x659d
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
orl $0x20, %eax
movzbl %al, %eax
cmpl $0x61, %eax
jl 0x650d
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
orl $0x20, %eax
movzbl %al, %eax
cmpl $0x7a, %eax
jle 0x6552
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jl 0x6525
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x39, %eax
jle 0x6552
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5f, %eax
je 0x6552
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x6552
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
je 0x6552
movl $0x0, -0x4(%rbp)
jmp 0x659d
movl $0x0, -0x30(%rbp)
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5f, %eax
je 0x657d
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x657d
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
jne 0x6584
movl $0x1, -0x30(%rbp)
jmp 0x6586
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x6497
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)