// File: /workspace/github_c_makefile_star2_O1/winton[P]redis_parse/redis_parse.c
// Function: process_record
void process_record(char *record, int score) {
	bool exclude, match;
	char *field;
	char **fields;
	fields = to_fields(record);

	// For each query
	int q, x;
	for (q = 0; q < 100; q++) {
		// Skip unused query structs
		if (queries[q].used != true)
			continue;
		
		// Skip if score not within range
		if (score >= 0) {
			if (queries[q].finish >= 0 && score > queries[q].finish)
				continue;
			if (queries[q].start >= 0 && score < queries[q].start)
				continue;
		}

		match = true;
		if (!queries[q].exclude_empty)
			// For each column
			for (x = 0; x < columns_count; x++) {
				// Exclude matches
				if (!queries[q].exclude_empty_at[x] && strstr(fields[x], queries[q].exclude[x])) {
					match = false;
					break;
				}
			}

		if (match && !queries[q].query_empty)
			// For each column
			for (x = 0; x < columns_count; x++) {
				// Include matches
				if (!queries[q].query_empty_at[x] && !strstr(fields[x], queries[q].query[x])) {
					match = false;
					break;
				}
			}

		if (match) {
			if (queries[q].display_count)
				queries[q].count++;
			if (queries[q].display_group && queries[q].column > -1) {
				field = malloc(strlen(fields[queries[q].column]) + 1);
				strcpy(field, fields[queries[q].column]);
				if (queries[q].column == 2) { // tag
					hash_add_or_update(q, xstrtok(field, ","));
					while (hash_add_or_update(q, xstrtok(NULL, ",")));
				} else
					hash_add_or_update(q, field);
			}
		}
	}

	free(fields);
	free(record);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, %ebp
movq %rdi, 0x20(%rsp)
callq 0x2a19
movq %rax, 0x10(%rsp)
testl %ebp, %ebp
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovnsl %ebp, %eax
movl %eax, 0x1c(%rsp)
leaq 0x6fcb(%rip), %rbx      # 0xa29c
leaq 0x6fbd(%rip), %r12      # 0xa295
xorl %r15d, %r15d
movl %ebp, 0x8(%rsp)
leaq (%r15,%r15,8), %rax
leaq 0x6fa6(%rip), %rcx      # 0xa290
cmpb $0x0, (%rcx,%rax,8)
je 0x3455
leaq 0x6f95(%rip), %rcx      # 0xa290
leaq (%rcx,%rax,8), %r13
testl %ebp, %ebp
js 0x331b
cmpl %ebp, 0x3c(%r13)
jb 0x3455
movl 0x1c(%rsp), %eax
cmpl %eax, 0x38(%r13)
jg 0x3455
movb $0x1, %al
cmpb $0x0, 0x4(%r13)
jne 0x3369
movl 0x6ee1(%rip), %r14d     # 0xa20c
testq %r14, %r14
je 0x335f
xorl %ebp, %ebp
cmpb $0x0, (%rbx,%rbp)
jne 0x3353
movq 0x10(%rsp), %rax
movq (%rax,%rbp,8), %rdi
movq 0x20(%r13), %rax
movq (%rax,%rbp,8), %rsi
callq 0x2290
testq %rax, %rax
jne 0x3363
incq %rbp
cmpq %rbp, %r14
jne 0x3332
movl 0x8(%rsp), %ebp
movb $0x1, %al
jmp 0x3369
xorl %eax, %eax
movl 0x8(%rsp), %ebp
testb %al, %al
je 0x33c0
cmpb $0x0, 0x3(%r13)
jne 0x33c0
movl %eax, 0xc(%rsp)
movl 0x6e8d(%rip), %r14d     # 0xa20c
testq %r14, %r14
je 0x33b4
xorl %ebp, %ebp
cmpb $0x0, (%r12,%rbp)
jne 0x33a8
movq 0x10(%rsp), %rax
movq (%rax,%rbp,8), %rdi
movq 0x18(%r13), %rax
movq (%rax,%rbp,8), %rsi
callq 0x2290
testq %rax, %rax
je 0x33ba
incq %rbp
cmpq %rbp, %r14
jne 0x3386
movl 0x8(%rsp), %ebp
movl 0xc(%rsp), %eax
jmp 0x33c0
xorl %eax, %eax
movl 0x8(%rsp), %ebp
testb %al, %al
je 0x3455
cmpb $0x1, 0x1(%r13)
jne 0x33d3
incl 0x2c(%r13)
cmpb $0x1, 0x2(%r13)
jne 0x3455
movslq 0x28(%r13), %r14
testq %r14, %r14
js 0x3455
movq 0x10(%rsp), %r13
movq (%r13,%r14,8), %rdi
callq 0x20e0
leaq 0x1(%rax), %rdi
callq 0x21f0
movq (%r13,%r14,8), %rsi
movq %rax, %r13
movq %rax, %rdi
callq 0x2070
cmpl $0x2, %r14d
jne 0x344a
movq %r13, %rdi
leaq 0x3c75(%rip), %rsi      # 0x7090
callq 0x348c
movl %r15d, %edi
movq %rax, %rsi
callq 0x2a93
xorl %edi, %edi
leaq 0x3c5c(%rip), %rsi      # 0x7090
callq 0x348c
movl %r15d, %edi
movq %rax, %rsi
callq 0x2a93
testb %al, %al
jne 0x342b
jmp 0x3455
movl %r15d, %edi
movq %r13, %rsi
callq 0x2a93
incq %r15
addq $0x48, %rbx
addq $0x48, %r12
cmpq $0x64, %r15
jne 0x32df
movq 0x10(%rsp), %rdi
callq 0x2040
movq 0x20(%rsp), %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2040