// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: JX9StreamData_Open
static int JX9StreamData_Open(const char *zName, int iMode, jx9_value *pResource, void ** ppHandle)
{
	jx9_stream_data *pData;
	SyString sStream;
	SyStringInitFromBuf(&sStream, zName, SyStrlen(zName));
	/* Trim leading and trailing white spaces */
	SyStringFullTrim(&sStream);
	/* Stream to open */
	if( SyStrnicmp(sStream.zString, "stdin", sizeof("stdin")-1) == 0 ){
		iMode = JX9_IO_STREAM_STDIN;
	}else if( SyStrnicmp(sStream.zString, "output", sizeof("output")-1) == 0 ){
		iMode = JX9_IO_STREAM_OUTPUT;
	}else if( SyStrnicmp(sStream.zString, "stdout", sizeof("stdout")-1) == 0 ){
		iMode = JX9_IO_STREAM_STDOUT;
	}else if( SyStrnicmp(sStream.zString, "stderr", sizeof("stderr")-1) == 0 ){
		iMode = JX9_IO_STREAM_STDERR;
	}else{
		/* unknown stream name */
		return -1;
	}
	/* Create our handle */
	pData = JX9StreamDataInit(pResource?pResource->pVm:0, iMode);
	if( pData == 0 ){
		return -1;
	}
	/* Make the handle public */
	*ppHandle = (void *)pData;
	return JX9_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
callq 0x55d10
movl %eax, -0x38(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x38(%rbp)
movb %al, -0x41(%rbp)
jbe 0x908ee
movq -0x40(%rbp), %rax
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl $0xc0, %ecx
movb %al, -0x41(%rbp)
jge 0x908ee
callq 0xd1f0
movq (%rax), %rax
movq -0x40(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
setne %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0x908f7
jmp 0x9090e
movl -0x38(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x38(%rbp)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x908ab
jmp 0x90910
xorl %eax, %eax
cmpl $0x0, -0x38(%rbp)
movb %al, -0x42(%rbp)
jbe 0x90965
movq -0x40(%rbp), %rax
movl -0x38(%rbp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movzbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0xc0, %ecx
movb %al, -0x42(%rbp)
jge 0x90965
callq 0xd1f0
movq (%rax), %rax
movq -0x40(%rbp), %rcx
movl -0x38(%rbp), %edx
subl $0x1, %edx
movl %edx, %edx
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
setne %al
movb %al, -0x42(%rbp)
movb -0x42(%rbp), %al
testb $0x1, %al
jne 0x9096e
jmp 0x90979
movl -0x38(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x90910
movq -0x40(%rbp), %rdi
leaq 0x344c8(%rip), %rsi     # 0xc4e4c
movl $0x5, %edx
callq 0x67830
cmpl $0x0, %eax
jne 0x9099c
movl $0x1, -0x14(%rbp)
jmp 0x90a14
movq -0x40(%rbp), %rdi
leaq 0x345c8(%rip), %rsi     # 0xc4f6f
movl $0x6, %edx
callq 0x67830
cmpl $0x0, %eax
jne 0x909bf
movl $0x4, -0x14(%rbp)
jmp 0x90a12
movq -0x40(%rbp), %rdi
leaq 0x3448f(%rip), %rsi     # 0xc4e59
movl $0x6, %edx
callq 0x67830
cmpl $0x0, %eax
jne 0x909e2
movl $0x2, -0x14(%rbp)
jmp 0x90a10
movq -0x40(%rbp), %rdi
leaq 0x3447a(%rip), %rsi     # 0xc4e67
movl $0x6, %edx
callq 0x67830
cmpl $0x0, %eax
jne 0x90a05
movl $0x3, -0x14(%rbp)
jmp 0x90a0e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x90a63
jmp 0x90a10
jmp 0x90a12
jmp 0x90a14
cmpq $0x0, -0x20(%rbp)
je 0x90a29
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x50(%rbp)
jmp 0x90a31
xorl %eax, %eax
movq %rax, -0x50(%rbp)
jmp 0x90a31
movq -0x50(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x90780
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x90a51
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x90a63
movq -0x30(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)