// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: jx9Builtin_soundex
static int jx9Builtin_soundex(jx9_context *pCtx, int nArg, jx9_value **apArg)
{
	const unsigned char *zIn;
	char zResult[8];
	int i, j;
	static const unsigned char iCode[] = {
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
		0, 0, 1, 2, 3, 0, 1, 2, 0, 0, 2, 2, 4, 5, 5, 0, 
		1, 2, 6, 2, 3, 0, 1, 0, 2, 0, 2, 0, 0, 0, 0, 0, 
		0, 0, 1, 2, 3, 0, 1, 2, 0, 0, 2, 2, 4, 5, 5, 0, 
		1, 2, 6, 2, 3, 0, 1, 0, 2, 0, 2, 0, 0, 0, 0, 0, 
	};
	if( nArg < 1 ){
		/* Missing arguments, return the empty string */
		jx9_result_string(pCtx, "", 0);
		return JX9_OK;
	}
	zIn = (unsigned char *)jx9_value_to_string(apArg[0], 0);
	for(i=0; zIn[i] && zIn[i] < 0xc0 && !SyisAlpha(zIn[i]); i++){}
	if( zIn[i] ){
		unsigned char prevcode = iCode[zIn[i]&0x7f];
		zResult[0] = (char)SyToUpper(zIn[i]);
		for(j=1; j<4 && zIn[i]; i++){
			int code = iCode[zIn[i]&0x7f];
			if( code>0 ){
				if( code!=prevcode ){
					prevcode = (unsigned char)code;
					zResult[j++] = (char)code + '0';
				}
			}else{
				prevcode = 0;
			}
		}
		while( j<4 ){
			zResult[j++] = '0';
		}
		jx9_result_string(pCtx, zResult, 4);
	}else{
	  jx9_result_string(pCtx, "?000", 4);
	}
	return JX9_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
cmpl $0x1, -0x14(%rbp)
jge 0x95bc7
movq -0x10(%rbp), %rdi
leaq 0x2ff97(%rip), %rsi     # 0xc5b4b
xorl %edx, %edx
callq 0x57180
movl $0x0, -0x4(%rbp)
jmp 0x95d7c
movq -0x20(%rbp), %rax
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x56e20
movq %rax, -0x28(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x28(%rbp), %rax
movslq -0x34(%rbp), %rcx
movzbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x41(%rbp)
je 0x95c3c
movq -0x28(%rbp), %rax
movslq -0x34(%rbp), %rcx
movzbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0xc0, %ecx
movb %al, -0x41(%rbp)
jge 0x95c3c
callq 0xd1f0
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movslq -0x34(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0x95c45
jmp 0x95c52
jmp 0x95c47
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x95be2
movq -0x28(%rbp), %rax
movslq -0x34(%rbp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0x95d60
movq -0x28(%rbp), %rax
movslq -0x34(%rbp), %rcx
movzbl (%rax,%rcx), %eax
andl $0x7f, %eax
movslq %eax, %rcx
leaq 0x2b8c3(%rip), %rax     # 0xc1540
movb (%rax,%rcx), %al
movb %al, -0x39(%rbp)
movq -0x28(%rbp), %rax
movslq -0x34(%rbp), %rcx
movzbl (%rax,%rcx), %edi
callq 0xd2a0
movb %al, -0x30(%rbp)
movl $0x1, -0x38(%rbp)
xorl %eax, %eax
cmpl $0x4, -0x38(%rbp)
movb %al, -0x42(%rbp)
jge 0x95cbe
movq -0x28(%rbp), %rax
movslq -0x34(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x42(%rbp)
movb -0x42(%rbp), %al
testb $0x1, %al
jne 0x95cc7
jmp 0x95d30
movq -0x28(%rbp), %rax
movslq -0x34(%rbp), %rcx
movzbl (%rax,%rcx), %eax
andl $0x7f, %eax
movslq %eax, %rcx
leaq 0x2b860(%rip), %rax     # 0xc1540
movzbl (%rax,%rcx), %eax
movl %eax, -0x40(%rbp)
cmpl $0x0, -0x40(%rbp)
jle 0x95d1c
movl -0x40(%rbp), %eax
movzbl -0x39(%rbp), %ecx
cmpl %ecx, %eax
je 0x95d1a
movl -0x40(%rbp), %eax
movb %al, -0x39(%rbp)
movl -0x40(%rbp), %eax
movsbl %al, %eax
addl $0x30, %eax
movb %al, %cl
movl -0x38(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x38(%rbp)
cltq
movb %cl, -0x30(%rbp,%rax)
jmp 0x95d20
movb $0x0, -0x39(%rbp)
jmp 0x95d22
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x95c9e
jmp 0x95d32
cmpl $0x4, -0x38(%rbp)
jge 0x95d4c
movl -0x38(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x38(%rbp)
cltq
movb $0x30, -0x30(%rbp,%rax)
jmp 0x95d32
movq -0x10(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movl $0x4, %edx
callq 0x57180
jmp 0x95d75
movq -0x10(%rbp), %rdi
leaq 0x2f6f5(%rip), %rsi     # 0xc5460
movl $0x4, %edx
callq 0x57180
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)