// File: /workspace/github_c_makefile_star2_O1/lucvoo[P]sparse-dev/semind.c
// Function: search_query_callback
static int search_query_callback(void *data, int argc, char **argv, char **colname)
{
	char *fmt = (char *) semind_search_format;
	char buf[32];
	int quote = 0;
	int n = 0;

	while (*fmt != '\0') {
		char c = *fmt;

		if (quote) {
			quote = 0;
			switch (c) {
				case 't': c = '\t'; break;
				case 'r': c = '\r'; break;
				case 'n': c = '\n'; break;
			}
		} else if (c == '%') {
			int colnum = 0;
			char *pos = ++fmt;

			c = *fmt;

			if (c == '\0')
				semind_error(1, 0, "unexpected end of format string");

			switch (c) {
				case 'f': colnum = 0; goto print_string;
				case 'l': colnum = 1; goto print_string;
				case 'c': colnum = 2; goto print_string;
				case 'C': colnum = 3; goto print_string;
				case 'n': colnum = 4; goto print_string;
				case 'm':
					if (n) {
						printf("%.*s", n, buf);
						n = 0;
					}
					print_mode(argv[5]);
					fmt++;
					break;
				case 'k':
					if (n) {
						printf("%.*s", n, buf);
						n = 0;
					}
					printf("%c", atoi(argv[6]));
					fmt++;
					break;
				case 's':
					if (n) {
						printf("%.*s", n, buf);
						n = 0;
					}
					print_file_line(argv[0], atoi(argv[1]));
					fmt++;
					break;

				print_string:
					if (n) {
						printf("%.*s", n, buf);
						n = 0;
					}
					printf("%s", argv[colnum]);
					fmt++;
					break;
				default:
					break;

			}

			if (pos == fmt)
				semind_error(1, 0, "invalid format specification: %%%c", c);

			continue;
		} else if (c == '\\') {
			quote = 1;
			fmt++;
			continue;
		}

		if (n == sizeof(buf)) {
			printf("%.*s", n, buf);
			n = 0;
		}

		buf[n++] = c;
		fmt++;
	}

	if (n)
		printf("%.*s", n, buf);
	printf("\n");

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, 0x18(%rsp)
movq 0x568ab(%rip), %r13     # 0x682e8
movb (%r13), %bl
testb %bl, %bl
je 0x11df2
leaq 0x3cb72(%rip), %r12     # 0x4e5c2
leaq 0x20(%rsp), %r15
xorl %r14d, %r14d
xorl %ebp, %ebp
movzbl %bl, %eax
testl %ebp, %ebp
je 0x11a74
cmpb $0x6e, %bl
je 0x11ab2
cmpl $0x72, %eax
je 0x11aae
cmpl $0x74, %eax
jne 0x11ab4
movb $0x9, %bl
jmp 0x11ab4
cmpb $0x5c, %bl
je 0x11aed
cmpl $0x25, %eax
jne 0x11ab4
movzbl 0x1(%r13), %ebx
movl $0x1, %ebp
movb $0x1, %r12b
leal -0x63(%rbx), %eax
cmpl $0x10, %eax
ja 0x11af7
leaq 0x335be(%rip), %rcx     # 0x45058
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x2, %r12d
jmp 0x11cac
movb $0xd, %bl
jmp 0x11ab4
movb $0xa, %bl
cmpl $0x20, %r14d
jne 0x11acd
movq %r12, %rdi
movl %r14d, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0xf050
xorl %r14d, %r14d
movslq %r14d, %rax
incl %r14d
movb %bl, 0x20(%rsp,%rax)
incq %r13
xorl %ebp, %ebp
movb (%r13), %bl
testb %bl, %bl
jne 0x11a5a
jmp 0x11df5
incq %r13
movl $0x1, %ebp
jmp 0x11adc
cmpl $0x43, %ebx
je 0x11ca6
testl %ebx, %ebx
jne 0x11da9
callq 0xf9ab
jmp 0x11da9
movl $0x4, %r12d
jmp 0x11cac
movq %rbx, 0x10(%rsp)
testl %r14d, %r14d
je 0x11b3b
leaq 0x3ca94(%rip), %rdi     # 0x4e5c2
movl %r14d, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0xf050
movq 0x18(%rsp), %rax
movq 0x30(%rax), %rdi
callq 0xf2f0
movl %eax, %edi
callq 0xf150
jmp 0x11d99
xorl %r12d, %r12d
jmp 0x11cac
movq %rbx, 0x10(%rsp)
testl %r14d, %r14d
leaq 0x3ca56(%rip), %rdi     # 0x4e5c2
je 0x11b7b
movq %r15, %rdx
movl %r14d, %esi
xorl %eax, %eax
callq 0xf050
movq 0x18(%rsp), %rax
movq 0x28(%rax), %rdi
callq 0xf2f0
cmpl $0x10000, %eax          # imm = 0x10000
jne 0x11d48
leaq 0x360c1(%rip), %rdi     # 0x47c5c
xorl %eax, %eax
callq 0xf050
jmp 0x11d99
movq %rbx, 0x10(%rsp)
testl %r14d, %r14d
leaq 0x3ca0c(%rip), %r12     # 0x4e5c2
je 0x11bc8
movq %r15, %rdx
movq %r12, %rdi
movl %r14d, %esi
xorl %eax, %eax
callq 0xf050
movq 0x18(%rsp), %rax
movq (%rax), %rbp
movq 0x8(%rax), %rdi
callq 0xf2f0
movl %eax, %r14d
movq 0x5cfc5(%rip), %rdi     # 0x6eba8
testq %rdi, %rdi
je 0x11bf4
movq %rbp, %rsi
callq 0xf3a0
testl %eax, %eax
je 0x11c52
movq 0x5cfa5(%rip), %rdi     # 0x6eba0
testq %rdi, %rdi
je 0x11c11
callq 0xf430
movq 0x5cf9c(%rip), %rdi     # 0x6eba8
callq 0xf210
movq %rbp, %rdi
callq 0xf390
movq %rax, 0x5cf88(%rip)     # 0x6eba8
testq %rax, %rax
je 0x11ddb
movq %rbp, %rdi
leaq 0x3af09(%rip), %rsi     # 0x4cb3c
callq 0xf1b0
movq %rax, 0x5cf61(%rip)     # 0x6eba0
testq %rax, %rax
je 0x11de5
movl $0x0, 0x5cf66(%rip)     # 0x6ebb8
leaq 0x5cf57(%rip), %rbp     # 0x6ebb0
movl 0x5cf59(%rip), %eax     # 0x6ebb8
cmpl %r14d, %eax
je 0x11cec
incl %eax
movl %eax, 0x5cf48(%rip)     # 0x6ebb8
callq 0xf380
movl $0x0, (%rax)
movq 0x5cf1e(%rip), %rdx     # 0x6eba0
movq %rbp, %rdi
leaq 0x5cf34(%rip), %rsi     # 0x6ebc0
callq 0xf3b0
movl %eax, 0x5cf25(%rip)     # 0x6ebbc
cmpl $-0x1, %eax
jne 0x11c59
jmp 0x11d19
movl $0x1, %r12d
jmp 0x11cac
movl $0x3, %r12d
testl %r14d, %r14d
je 0x11cc5
leaq 0x3c90a(%rip), %rdi     # 0x4e5c2
movl %r14d, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0xf050
movq 0x18(%rsp), %rax
movq (%rax,%r12,8), %rsi
xorl %r14d, %r14d
leaq 0x3feb5(%rip), %rdi     # 0x51b8d
xorl %eax, %eax
callq 0xf050
movl $0x2, %ebp
xorl %r12d, %r12d
jmp 0x11da9
movq 0x5cebd(%rip), %rdx     # 0x6ebb0
movslq 0x5cec2(%rip), %rax     # 0x6ebbc
cmpb $0xa, -0x1(%rdx,%rax)
jne 0x11d09
decl %eax
movl %eax, 0x5ceb3(%rip)     # 0x6ebbc
movl 0x5cead(%rip), %esi     # 0x6ebbc
movq %r12, %rdi
xorl %eax, %eax
callq 0xf050
callq 0xf380
movl (%rax), %esi
movl $0x2, %ebp
xorl %r14d, %r14d
leal 0x1(%rsi), %eax
cmpl $0x2, %eax
jb 0x11da1
xorl %r14d, %r14d
movl $0x1, %edi
leaq 0x340a6(%rip), %rdx     # 0x45de5
xorl %eax, %eax
callq 0xf570
jmp 0x11da1
movl %eax, %ecx
andl $0x3, %ecx
leaq 0x3407d(%rip), %rsi     # 0x45dd1
movb (%rcx,%rsi), %cl
movb %cl, 0xd(%rsp)
leal 0x3(%rax), %ecx
leal 0x3ff(%rax), %edx
testl %eax, %eax
cmovnsl %eax, %ecx
cmovnsl %eax, %edx
shrl $0x2, %ecx
andl $0x3, %ecx
movb (%rcx,%rsi), %al
movb %al, 0xe(%rsp)
shrl $0xa, %edx
andl $0x3, %edx
movb (%rdx,%rsi), %al
movb %al, 0xf(%rsp)
leaq 0x34049(%rip), %rdi     # 0x45dd6
leaq 0xd(%rsp), %rsi
xorl %eax, %eax
callq 0xf050
movl $0x2, %ebp
xorl %r14d, %r14d
xorl %r12d, %r12d
movq 0x10(%rsp), %rbx
addq %rbp, %r13
xorl %ebp, %ebp
testb %r12b, %r12b
jne 0x11dbf
leaq 0x3c808(%rip), %r12     # 0x4e5c2
jmp 0x11adc
movsbl %bl, %ecx
xorl %ebp, %ebp
movl $0x1, %edi
xorl %esi, %esi
leaq 0x33fdc(%rip), %rdx     # 0x45dae
xorl %eax, %eax
callq 0xf570
jmp 0x11db3
callq 0xf96c
jmp 0x11c29
movq %rbp, %rdi
callq 0xf98a
jmp 0x11c48
xorl %r14d, %r14d
testl %r14d, %r14d
je 0x11e10
leaq 0x3c7c1(%rip), %rdi     # 0x4e5c2
leaq 0x20(%rsp), %rdx
movl %r14d, %esi
xorl %eax, %eax
callq 0xf050
movl $0xa, %edi
callq 0xf150
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop