// File: /workspace/github_c_makefile_star2_O2/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 $0x18, %rsp
movl %esi, 0x4(%rsp)
movq %rdi, 0x10(%rsp)
callq 0x2968
movq %rax, 0x8(%rsp)
leaq 0x60a9(%rip), %r12      # 0x929c
leaq 0x609b(%rip), %r13      # 0x9295
xorl %r15d, %r15d
cmpq $0x64, %r15
je 0x3374
imulq $0x48, %r15, %rbx
leaq 0x607e(%rip), %rax      # 0x9290
cmpb $0x0, (%rbx,%rax)
je 0x3364
leaq 0x606d(%rip), %rax      # 0x9290
addq %rax, %rbx
cmpl $0x0, 0x4(%rsp)
js 0x3247
movl 0x4(%rsp), %eax
cmpl %eax, 0x3c(%rbx)
jb 0x3364
movl 0x4(%rsp), %eax
cmpl %eax, 0x38(%rbx)
jg 0x3364
cmpb $0x0, 0x4(%rbx)
je 0x32e6
cmpb $0x0, 0x3(%rbx)
je 0x331f
cmpb $0x1, 0x1(%rbx)
jne 0x3264
incl 0x2c(%rbx)
cmpb $0x1, 0x2(%rbx)
jne 0x3364
movslq 0x28(%rbx), %r14
testq %r14, %r14
js 0x3364
movq 0x8(%rsp), %rax
movq (%rax,%r14,8), %rbx
movq %rbx, %rdi
callq 0x20e0
leaq 0x1(%rax), %rdi
callq 0x21f0
movq %rax, %rbp
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2070
cmpl $0x2, %r14d
jne 0x3359
movq %rbp, %rdi
leaq 0x2dd9(%rip), %rsi      # 0x6090
callq 0x3396
movl %r15d, %edi
movq %rax, %rsi
callq 0x29e6
xorl %edi, %edi
leaq 0x2dc0(%rip), %rsi      # 0x6090
callq 0x3396
movl %r15d, %edi
movq %rax, %rsi
callq 0x29e6
testb %al, %al
jne 0x32c7
jmp 0x3364
movl 0x5f20(%rip), %ebp      # 0x920c
xorl %r14d, %r14d
cmpq %r14, %rbp
je 0x3251
cmpb $0x0, (%r12,%r14)
jne 0x331a
movq 0x8(%rsp), %rax
movq (%rax,%r14,8), %rdi
movq 0x20(%rbx), %rax
movq (%rax,%r14,8), %rsi
callq 0x2290
testq %rax, %rax
jne 0x3364
incq %r14
jmp 0x32ef
movl 0x5ee7(%rip), %ebp      # 0x920c
xorl %r14d, %r14d
cmpq %r14, %rbp
je 0x325b
cmpb $0x0, (%r13,%r14)
jne 0x3354
movq 0x8(%rsp), %rax
movq (%rax,%r14,8), %rdi
movq 0x18(%rbx), %rax
movq (%rax,%r14,8), %rsi
callq 0x2290
testq %rax, %rax
je 0x3364
incq %r14
jmp 0x3328
movl %r15d, %edi
movq %rbp, %rsi
callq 0x29e6
incq %r15
addq $0x48, %r12
addq $0x48, %r13
jmp 0x31fd
movq 0x8(%rsp), %rdi
callq 0x2040
movq 0x10(%rsp), %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2040