// File: /workspace/github_c_makefile_star2_O3/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 0x29b6
movq %rax, 0x8(%rsp)
leaq 0x7083(%rip), %r12      # 0xa29c
leaq 0x7075(%rip), %rbp      # 0xa295
xorl %r15d, %r15d
leaq (%r15,%r15,8), %rax
leaq 0x7062(%rip), %rcx      # 0xa290
cmpb $0x0, (%rcx,%rax,8)
je 0x3375
leaq 0x7051(%rip), %rcx      # 0xa290
leaq (%rcx,%rax,8), %rbx
cmpl $0x0, 0x4(%rsp)
js 0x3264
movl 0x4(%rsp), %eax
cmpl %eax, 0x3c(%rbx)
jb 0x3375
movl 0x4(%rsp), %eax
cmpl %eax, 0x38(%rbx)
jg 0x3375
cmpb $0x0, 0x4(%rbx)
jne 0x32a7
movl 0x6f9b(%rip), %r13d     # 0xa20c
testq %r13, %r13
je 0x32a7
xorl %r14d, %r14d
cmpb $0x0, (%r12,%r14)
jne 0x329f
movq 0x8(%rsp), %rax
movq (%rax,%r14,8), %rdi
movq 0x20(%rbx), %rax
movq (%rax,%r14,8), %rsi
callq 0x2290
testq %rax, %rax
jne 0x3375
incq %r14
cmpq %r14, %r13
jne 0x3279
cmpb $0x0, 0x3(%rbx)
jne 0x32eb
movl 0x6f58(%rip), %r13d     # 0xa20c
testq %r13, %r13
je 0x32eb
xorl %r14d, %r14d
cmpb $0x0, (%rbp,%r14)
jne 0x32e3
movq 0x8(%rsp), %rax
movq (%rax,%r14,8), %rdi
movq 0x18(%rbx), %rax
movq (%rax,%r14,8), %rsi
callq 0x2290
testq %rax, %rax
je 0x3375
incq %r14
cmpq %r14, %r13
jne 0x32bc
cmpb $0x1, 0x1(%rbx)
jne 0x32f4
incl 0x2c(%rbx)
cmpb $0x1, 0x2(%rbx)
jne 0x3375
movslq 0x28(%rbx), %r14
testq %r14, %r14
js 0x3375
movq 0x8(%rsp), %rax
movq (%rax,%r14,8), %rbx
movq %rbx, %rdi
callq 0x20e0
leaq 0x1(%rax), %rdi
callq 0x21f0
movq %rax, %r13
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2070
cmpl $0x2, %r14d
jne 0x336a
movq %r13, %rdi
leaq 0x3d55(%rip), %rsi      # 0x7090
callq 0x33ac
movl %r15d, %edi
movq %rax, %rsi
callq 0x2a30
xorl %edi, %edi
leaq 0x3d3c(%rip), %rsi      # 0x7090
callq 0x33ac
movl %r15d, %edi
movq %rax, %rsi
callq 0x2a30
testb %al, %al
jne 0x334b
jmp 0x3375
movl %r15d, %edi
movq %r13, %rsi
callq 0x2a30
incq %r15
addq $0x48, %r12
addq $0x48, %rbp
cmpq $0x64, %r15
jne 0x3223
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