// File: /workspace/github_c_makefile_star2_O0/System-Glitch[P]ESGILinter-C/src/parsing_functions.c
// Function: parse_function_name
static char *parse_function_name(char *line, unsigned int *star_count_name, unsigned int *params_start_index) {
	unsigned int index      = 0;
	unsigned int length     = strlen(line);
	unsigned int star_count = 0;
	unsigned int sub_index  = 0;
	match_t *match          = NULL;
	unsigned char c;
	char *name = NULL;
	char *tmp  = NULL;

	SKIP_WHITESPACES

	match = match_init();
	if(match == NULL) return NULL;
	else if(line[index] == ';' || line[index] == '{') {
		free(match);
		return NULL;
	}

	match->index_start = index;

	//Until not alphanumeric
	while((is_alphanumeric(c = line[index]) || c == '*') && index < length) {
		index++;
	}

	match->index_end = index;

	SKIP_WHITESPACES

	if(line[index] != '(') { //No parenthesis found, this is not a function delaration
		free(match);
		return NULL;
	}

	//No array modifier in name

	tmp = substr_match(line, *match);
	free(match);

	star_count = strcount(tmp, '*');
	sub_index  = strcountuntil(tmp, '*', 0, 1);

	//Remove stars
	name = strsubstr(tmp, sub_index, strlen(tmp) - star_count);
	free(tmp);

	*star_count_name = star_count;
	*params_start_index = index + 1;
	return name;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2090
movl %eax, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x39(%rbp)
movsbl %al, %edi
callq 0xa7d0
movsbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x51(%rbp)
je 0xf2fb
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
setb %al
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %al
testb $0x1, %al
jne 0xf304
jmp 0xf30f
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xf2cd
movb $0x0, %al
callq 0xae40
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0xf32e
movq $0x0, -0x8(%rbp)
jmp 0xf4c7
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x3b, %eax
je 0xf34e
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x7b, %eax
jne 0xf364
movq -0x38(%rbp), %rdi
callq 0x2030
movq $0x0, -0x8(%rbp)
jmp 0xf4c7
jmp 0xf366
movl -0x24(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x39(%rbp)
movsbl %al, %edi
callq 0xada0
movsbl %al, %eax
cmpl $0x0, %eax
jne 0xf39a
movzbl -0x39(%rbp), %ecx
xorl %eax, %eax
cmpl $0x2a, %ecx
movb %al, -0x52(%rbp)
jne 0xf3a6
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
setb %al
movb %al, -0x52(%rbp)
movb -0x52(%rbp), %al
testb $0x1, %al
jne 0xf3af
jmp 0xf3ba
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xf36f
movl -0x24(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x39(%rbp)
movsbl %al, %edi
callq 0xa7d0
movsbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x53(%rbp)
je 0xf3f2
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
setb %al
movb %al, -0x53(%rbp)
movb -0x53(%rbp), %al
testb $0x1, %al
jne 0xf3fb
jmp 0xf406
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xf3c4
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x28, %eax
je 0xf42c
movq -0x38(%rbp), %rdi
callq 0x2030
movq $0x0, -0x8(%rbp)
jmp 0xf4c7
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rax
movq (%rax), %rsi
callq 0xac10
movq %rax, -0x50(%rbp)
movq -0x38(%rbp), %rdi
callq 0x2030
movq -0x50(%rbp), %rdi
movl $0x2a, %esi
callq 0xa660
movl %eax, -0x2c(%rbp)
movq -0x50(%rbp), %rdi
movl $0x2a, %esi
xorl %edx, %edx
movl $0x1, %ecx
callq 0xa6d0
movl %eax, -0x30(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x60(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x58(%rbp)
movq -0x50(%rbp), %rdi
callq 0x2090
movq -0x60(%rbp), %rdi
movl -0x58(%rbp), %esi
movl -0x2c(%rbp), %ecx
subq %rcx, %rax
movl %eax, %edx
callq 0xa5e0
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rdi
callq 0x2030
movl -0x2c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x48(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)