// File: /workspace/github_c_makefile_star2_O3/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 $0x38, %rsp
movq %rdx, 0x8(%rsp)
movq 0x548a6(%rip), %r13     # 0x662e8
movb (%r13), %bpl
testb %bpl, %bpl
je 0x11db1
leaq 0x3bb1c(%rip), %r15     # 0x4d572
leaq 0x10(%rsp), %r12
xorl %r14d, %r14d
xorl %ebx, %ebx
movzbl %bpl, %eax
testl %ebx, %ebx
je 0x11a7d
cmpb $0x6e, %bpl
je 0x11ab4
cmpl $0x72, %eax
je 0x11aaf
cmpl $0x74, %eax
jne 0x11ab7
movb $0x9, %bpl
jmp 0x11ab7
cmpb $0x5c, %bpl
je 0x11af4
cmpl $0x25, %eax
jne 0x11ab7
movzbl 0x1(%r13), %ebx
leal -0x63(%rbx), %eax
cmpl $0x10, %eax
ja 0x11afe
leaq 0x325bc(%rip), %rcx     # 0x44058
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x2, %ebx
jmp 0x11c7c
movb $0xd, %bpl
jmp 0x11ab7
movb $0xa, %bpl
cmpl $0x20, %r14d
jne 0x11ad2
xorl %r14d, %r14d
movq %r15, %rdi
movl $0x20, %esi
movq %r12, %rdx
xorl %eax, %eax
callq 0xf050
movslq %r14d, %rax
incl %r14d
movb %bpl, 0x10(%rsp,%rax)
incq %r13
xorl %ebx, %ebx
movb (%r13), %bpl
testb %bpl, %bpl
jne 0x11a60
jmp 0x11d96
incq %r13
movl $0x1, %ebx
jmp 0x11ae2
cmpl $0x43, %ebx
jne 0x11d54
movl $0x3, %ebx
jmp 0x11c7c
testl %r14d, %r14d
je 0x11b26
movq %r15, %rdi
movl %r14d, %esi
movq %r12, %rdx
xorl %eax, %eax
callq 0xf050
movq 0x8(%rsp), %rax
movq (%rax), %rbp
movq 0x8(%rax), %rdi
callq 0xf2f0
movl %eax, %r14d
movq 0x5b067(%rip), %rdi     # 0x6cba8
testq %rdi, %rdi
leaq 0x5b065(%rip), %rbx     # 0x6cbb0
je 0x11b59
movq %rbp, %rsi
callq 0xf3a0
testl %eax, %eax
je 0x11bb7
movq 0x5b040(%rip), %rdi     # 0x6cba0
testq %rdi, %rdi
je 0x11b76
callq 0xf430
movq 0x5b037(%rip), %rdi     # 0x6cba8
callq 0xf210
movq %rbp, %rdi
callq 0xf390
movq %rax, 0x5b023(%rip)     # 0x6cba8
testq %rax, %rax
je 0x11d7f
movq %rbp, %rdi
leaq 0x39f54(%rip), %rsi     # 0x4baec
callq 0xf1b0
movq %rax, 0x5affc(%rip)     # 0x6cba0
testq %rax, %rax
je 0x11d89
movl $0x0, 0x5b001(%rip)     # 0x6cbb8
movl 0x5affb(%rip), %eax     # 0x6cbb8
cmpl %r14d, %eax
je 0x11cb6
incl %eax
movl %eax, 0x5afea(%rip)     # 0x6cbb8
callq 0xf380
movq %rax, %rbp
movl $0x0, (%rax)
movq 0x5afbd(%rip), %rdx     # 0x6cba0
movq %rbx, %rdi
leaq 0x5afd3(%rip), %rsi     # 0x6cbc0
callq 0xf3b0
movl %eax, 0x5afc4(%rip)     # 0x6cbbc
cmpl $-0x1, %eax
jne 0x11bb7
jmp 0x11ce5
movl $0x1, %ebx
jmp 0x11c7c
testl %r14d, %r14d
je 0x11c1e
movq %r15, %rdi
movl %r14d, %esi
movq %r12, %rdx
xorl %eax, %eax
callq 0xf050
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rdi
callq 0xf2f0
cmpl $0x10000, %eax          # imm = 0x10000
jne 0x11d05
leaq 0x3500e(%rip), %rdi     # 0x46c4c
xorl %eax, %eax
callq 0xf050
jmp 0x11ca8
xorl %ebx, %ebx
jmp 0x11c7c
testl %r14d, %r14d
je 0x11c60
movq %r15, %rdi
movl %r14d, %esi
movq %r12, %rdx
xorl %eax, %eax
callq 0xf050
movq 0x8(%rsp), %rax
movq 0x30(%rax), %rdi
callq 0xf2f0
movl %eax, %edi
callq 0xf150
jmp 0x11ca8
movl $0x4, %ebx
testl %r14d, %r14d
je 0x11c91
movq %r15, %rdi
movl %r14d, %esi
movq %r12, %rdx
xorl %eax, %eax
callq 0xf050
movq 0x8(%rsp), %rax
movq (%rax,%rbx,8), %rsi
leaq 0x3ee6c(%rip), %rdi     # 0x50b0d
xorl %eax, %eax
callq 0xf050
addq $0x2, %r13
xorl %ebx, %ebx
xorl %r14d, %r14d
jmp 0x11ae2
movq 0x5aef3(%rip), %rdx     # 0x6cbb0
movslq 0x5aef8(%rip), %rsi     # 0x6cbbc
cmpb $0xa, -0x1(%rdx,%rsi)
jne 0x11cd3
decl %esi
movl %esi, 0x5aee9(%rip)     # 0x6cbbc
movq %r15, %rdi
xorl %eax, %eax
callq 0xf050
callq 0xf380
movq %rax, %rbp
movl (%rbp), %esi
leal 0x1(%rsi), %eax
cmpl $0x2, %eax
jb 0x11ca8
movl $0x1, %edi
leaq 0x330e9(%rip), %rdx     # 0x44de5
xorl %eax, %eax
callq 0xf570
jmp 0x11ca8
movl %eax, %ecx
andl $0x3, %ecx
leaq 0x330c0(%rip), %rsi     # 0x44dd1
movb (%rcx,%rsi), %cl
movb %cl, 0x5(%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, 0x6(%rsp)
shrl $0xa, %edx
andl $0x3, %edx
movb (%rdx,%rsi), %al
movb %al, 0x7(%rsp)
leaq 0x3308c(%rip), %rdi     # 0x44dd6
leaq 0x5(%rsp), %rsi
jmp 0x11ca1
testl %ebx, %ebx
jne 0x11d5d
callq 0xf9ab
incq %r13
movsbl %bl, %ecx
xorl %ebx, %ebx
movl $0x1, %edi
xorl %esi, %esi
leaq 0x3303b(%rip), %rdx     # 0x44dae
xorl %eax, %eax
callq 0xf570
jmp 0x11ae2
callq 0xf96c
jmp 0x11b8e
movq %rbp, %rdi
callq 0xf98a
jmp 0x11bad
testl %r14d, %r14d
je 0x11db1
leaq 0x3b7d0(%rip), %rdi     # 0x4d572
leaq 0x10(%rsp), %rdx
movl %r14d, %esi
xorl %eax, %eax
callq 0xf050
movl $0xa, %edi
callq 0xf150
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq