// File: /workspace/github_c_makefile_star2_O0/System-Glitch[P]ESGILinter-C/src/rules/array_bracket_eol.c
// Function: array_bracket_eol_check
static unsigned int array_bracket_eol_check(line_t *line, arraylist_t *real_file) {
	char *tmp = str_remove_comments(line->line);
	int index_line_break = strlastindexof(tmp, '\n');
	int index_parenthesis = strlastindexof(tmp, ')'); // can be null in do{ case
	int index_bracket = strlastindexof(tmp, '{');
	int index_do;
	char *display = NULL;
	unsigned int breaks = 0;

	if(index_bracket != -1 && index_line_break != -1 && !check_quotes(tmp, tmp + index_bracket, strlen(tmp))){
		index_do = check_do(tmp, index_bracket);
		if(index_do != -1){
			for(int i = index_do + 1; i < index_bracket; i++){
				if(tmp[i] == '\n'){
					breaks = strcount_heading_line_breaks(line->line) + (line->start_real_line == 0 ? 1 : 0);
					display = trim(arraylist_get(real_file, line->start_real_line + breaks - 1));
					print_warning(line->source, line->start_real_line + breaks, display, "Bracket is not end of line");
					free(tmp);
					free(display);
					return 1;
				}
			}
		} else if(index_parenthesis != -1 && index_line_break > index_parenthesis && index_line_break < index_bracket){
			breaks = strcount_heading_line_breaks(line->line) + (line->start_real_line == 0 ? 1 : 0);
			display = trim(arraylist_get(real_file, line->start_real_line + breaks - 1));
			print_warning(line->source, line->start_real_line + breaks, display, "Bracket is not end of line");
			free(tmp);
			free(display);
			return 1;
		}
	}
	free(tmp);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0xa2b0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
movl $0xa, %esi
callq 0xa940
movl %eax, -0x24(%rbp)
movq -0x20(%rbp), %rdi
movl $0x29, %esi
callq 0xa940
movl %eax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
movl $0x7b, %esi
callq 0xa940
movl %eax, -0x2c(%rbp)
movq $0x0, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
cmpl $-0x1, -0x2c(%rbp)
je 0xc9de
cmpl $-0x1, -0x24(%rbp)
je 0xc9de
movq -0x20(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rdi
callq 0x2090
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
movl %eax, %edx
callq 0xae60
cmpb $0x0, %al
jne 0xc9de
movq -0x20(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0xca00
movl %eax, -0x30(%rbp)
cmpl $-0x1, -0x30(%rbp)
je 0xc930
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0xc92b
movq -0x20(%rbp), %rax
movslq -0x40(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
jne 0xc91b
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0xa840
movq -0x10(%rbp), %rcx
movl 0x10(%rcx), %esi
xorl %ecx, %ecx
movl $0x1, %edx
cmpl $0x0, %esi
cmovel %edx, %ecx
addl %ecx, %eax
movl %eax, -0x3c(%rbp)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
addl -0x3c(%rbp), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
callq 0x8890
movq %rax, %rdi
callq 0xad00
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movl 0x10(%rax), %esi
addl -0x3c(%rbp), %esi
movq -0x38(%rbp), %rdx
leaq 0x8072(%rip), %rcx      # 0x1496a
callq 0x6850
movq -0x20(%rbp), %rdi
callq 0x2030
movq -0x38(%rbp), %rdi
callq 0x2030
movl $0x1, -0x4(%rbp)
jmp 0xc9ee
jmp 0xc91d
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0xc86f
jmp 0xc9dc
cmpl $-0x1, -0x28(%rbp)
je 0xc9da
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jle 0xc9da
movl -0x24(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0xc9da
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0xa840
movq -0x10(%rbp), %rcx
movl 0x10(%rcx), %esi
xorl %ecx, %ecx
movl $0x1, %edx
cmpl $0x0, %esi
cmovel %edx, %ecx
addl %ecx, %eax
movl %eax, -0x3c(%rbp)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
addl -0x3c(%rbp), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
callq 0x8890
movq %rax, %rdi
callq 0xad00
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movl 0x10(%rax), %esi
addl -0x3c(%rbp), %esi
movq -0x38(%rbp), %rdx
leaq 0x7fb0(%rip), %rcx      # 0x1496a
callq 0x6850
movq -0x20(%rbp), %rdi
callq 0x2030
movq -0x38(%rbp), %rdi
callq 0x2030
movl $0x1, -0x4(%rbp)
jmp 0xc9ee
jmp 0xc9dc
jmp 0xc9de
movq -0x20(%rbp), %rdi
callq 0x2030
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)