// File: /workspace/github_c_makefile_star2_O2/DeforaOS[P]libSystem/src/variable.c
// Function: variable_get_as
VariableError variable_get_as(Variable const * variable, VariableType type,
		void * result, size_t * size)
{
	int ret;
	void const * p;
	size_t sz;
	Buffer ** b;
	String ** s;
	Array ** a;

	if(variable->type != type)
		return _get_as_convert(variable, type, result);
	switch(type)
	{
		case VT_NULL:
			return 0;
		case VT_BOOL:
		case VT_INT8:
		case VT_UINT8:
		case VT_INT16:
		case VT_UINT16:
		case VT_INT32:
		case VT_UINT32:
		case VT_INT64:
		case VT_UINT64:
		case VT_FLOAT:
		case VT_DOUBLE:
		case VT_POINTER:
			sz = (type < sizeof(_variable_sizes)
					/ sizeof(*_variable_sizes))
				? _variable_sizes[type] : 0;
			if(size != NULL)
			{
				if(sz > *size)
					return error_set_code(-ENOSPC, "%s",
							strerror(ENOSPC));
				*size = sz;
			}
			p = variable_get_pointer(variable);
			memcpy(result, p, sz);
			return 0;
		case VT_BUFFER:
			if((ret = _get_as_pointer(size)) != 0)
				return ret;
			b = (Buffer **)result;
			return (*b = buffer_new_copy(variable->u.buffer))
				!= NULL ? 0 : -1;
		case VT_STRING:
			if((ret = _get_as_pointer(size)) != 0)
				return ret;
			s = (String **)result;
			return (*s = string_new(variable->u.string)) != NULL
				? 0 : -1;
		case VT_ARRAY:
			if((ret = _get_as_pointer(size)) != 0)
				return ret;
			a = (Array **)result;
			return (*a = array_new_copy(variable->u.array.array))
				!= NULL ? 0 : -1;
		case VT_COMPOUND:
			return _get_as_compound(variable, result, size);
	}
	return error_set_code(-ENOTSUP, "%s", strerror(ENOTSUP));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rbx
movl %esi, %r14d
movq %rdi, %r15
movl (%rdi), %edx
cmpl %esi, %edx
jne 0x930c
cmpl $0x10, %r14d
ja 0x9571
movl %r14d, %eax
leaq 0x20fc(%rip), %rdx      # 0xb3d4
movslq (%rdx,%rax,4), %rsi
addq %rdx, %rsi
jmpq *%rsi
leaq 0x21f8(%rip), %rdx      # 0xb4e0
movq (%rdx,%rax,8), %r14
testq %rcx, %rcx
je 0x935c
cmpq (%rcx), %r14
jbe 0x9359
pushq $0x1c
popq %rdi
callq 0x47f0
leaq 0x1d59(%rip), %rsi      # 0xb05e
pushq $-0x1c
jmp 0x9582
leal -0x1(%r14), %eax
cmpl $0xc, %eax
ja 0x976b
leaq 0x1f80(%rip), %rcx      # 0xb2a0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leal -0x2(%rdx), %eax
cmpl $0x7, %eax
ja 0x976b
leaq 0x2018(%rip), %rcx      # 0xb354
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzwl 0x8(%r15), %eax
cmpw $0xff, %ax
jbe 0x96a2
jmp 0x976b
movq %r14, (%rcx)
movq %r15, %rdi
callq 0x4700
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
jmp 0x9753
cmpl $0xa, %edx
jne 0x976b
cvtss2sd 0x8(%r15), %xmm0
movsd %xmm0, (%rbx)
jmp 0x9758
leal -0x3(%rdx), %eax
cmpl $0x6, %eax
ja 0x976b
leaq 0x1fd7(%rip), %rcx      # 0xb374
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb 0x8(%r15), %al
testb %al, %al
js 0x976b
leaq 0x8(%rsp), %r15
movb %al, (%r15)
jmp 0x9700
leal -0x2(%rdx), %eax
cmpl $0x7, %eax
ja 0x976b
leaq 0x1f22(%rip), %rcx      # 0xb2f4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movsbl 0x8(%r15), %eax
jmp 0x9714
cmpl $0x10, %edx
ja 0x98d7
movl %edx, %eax
leaq 0x1f99(%rip), %rcx      # 0xb390
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
andq $0x0, (%rbx)
jmp 0x9758
leal -0x2(%rdx), %eax
cmpl $0x7, %eax
ja 0x976b
leaq 0x1eb8(%rip), %rcx      # 0xb2d4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x8(%r15), %rax
movq %rax, %rcx
shrq $0x20, %rcx
je 0x96bc
jmp 0x976b
cmpl $0x9, %edx
jne 0x976b
movq 0x8(%r15), %rax
jmp 0x94d1
leal -0x2(%rdx), %eax
cmpl $0x7, %eax
ja 0x976b
leaq 0x1ed4(%rip), %rcx      # 0xb334
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movsbl 0x8(%r15), %eax
jmp 0x9741
leal -0x2(%rdx), %eax
cmpl $0x7, %eax
ja 0x976b
leaq 0x1e8e(%rip), %rcx      # 0xb314
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x8(%r15), %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
jbe 0x9741
jmp 0x976b
cmpl $0xb, %edx
jne 0x976b
cvtsd2ss 0x8(%r15), %xmm0
movss %xmm0, (%rbx)
jmp 0x9758
cmpl $0x8, %edx
jne 0x976b
movq 0x8(%r15), %rax
testq %rax, %rax
js 0x976b
leaq 0x8(%rsp), %r15
movq %rax, (%r15)
pushq $0x8
jmp 0x974c
movq %rcx, %rdi
callq 0x9916
testl %eax, %eax
jne 0x95e0
movq 0x8(%r15), %rdi
callq 0x4790
jmp 0x9843
testq %rcx, %rcx
je 0x95c4
leaq 0x8(%rsp), %r14
movq %rcx, (%r14)
andq $0x0, 0x10(%r14)
movq %rbx, 0x8(%r14)
andl $0x0, 0x18(%r14)
movq 0x18(%r15), %rdi
leaq 0xa81(%rip), %rsi       # 0x9fa9
movq %r14, %rdx
callq 0x43a0
movl 0x18(%r14), %r14d
jmp 0x98c5
movq %rcx, %rdi
callq 0x9916
testl %eax, %eax
jne 0x95e0
movq 0x8(%r15), %rdi
callq 0x41f0
jmp 0x9843
movq %rcx, %rdi
callq 0x9916
testl %eax, %eax
jne 0x95e0
movq 0x10(%r15), %rdi
callq 0x4740
jmp 0x9843
pushq $0x5f
popq %rdi
callq 0x47f0
leaq 0x1ade(%rip), %rsi      # 0xb05e
pushq $-0x5f
popq %rdi
movq %rax, %rdx
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4610
movl 0x8(%r15), %eax
cmpl $0xff, %eax
jbe 0x9687
jmp 0x976b
movq 0x8(%r15), %rax
cmpq $0xff, %rax
jbe 0x96f8
jmp 0x976b
pushq $0x16
popq %rdi
callq 0x47f0
leaq 0x1a8b(%rip), %rsi      # 0xb05e
pushq $-0x16
popq %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x4610
movl %eax, %r14d
jmp 0x98c5
movzbl 0x8(%r15), %eax
jmp 0x9714
movzwl 0x8(%r15), %eax
jmp 0x9714
movl 0x8(%r15), %eax
jmp 0x9710
movzbl 0x8(%r15), %eax
jmp 0x9741
movzwl 0x8(%r15), %eax
testw %ax, %ax
js 0x976b
leaq 0x8(%rsp), %r15
movw %ax, (%r15)
jmp 0x974a
movq 0x8(%r15), %rax
cmpq $0xffff, %rax           # imm = 0xFFFF
jbe 0x972c
jmp 0x976b
addq $0x8, %r15
jmp 0x9700
movl 0x8(%r15), %eax
cmpl $0x7f, %eax
jbe 0x9687
jmp 0x976b
movq 0x8(%r15), %rax
movslq %eax, %rcx
cmpq %rax, %rcx
je 0x96bc
jmp 0x976b
movzwl 0x8(%r15), %eax
cmpw $0x7f, %ax
jbe 0x96a2
jmp 0x976b
movl 0x8(%r15), %eax
movsbl %al, %ecx
cmpl %eax, %ecx
jne 0x976b
leaq 0x8(%rsp), %r15
movb %al, (%r15)
jmp 0x9700
movzwl 0x8(%r15), %eax
movsbl %al, %ecx
cmpw %ax, %cx
jne 0x976b
leaq 0x8(%rsp), %r15
movb %al, (%r15)
jmp 0x9700
movq 0x8(%r15), %rax
cmpq $0x7fffffff, %rax       # imm = 0x7FFFFFFF
ja 0x976b
leaq 0x8(%rsp), %r15
movl %eax, (%r15)
jmp 0x971c
movswl 0x8(%r15), %eax
jmp 0x9714
movq 0x8(%r15), %rax
movsbq %al, %rcx
cmpq %rax, %rcx
je 0x96f8
jmp 0x976b
movq 0x8(%r15), %rax
movswq %ax, %rcx
cmpq %rax, %rcx
je 0x972c
jmp 0x976b
movq 0x8(%r15), %rax
cmpq $0x7f, %rax
ja 0x976b
leaq 0x8(%rsp), %r15
movb %al, (%r15)
pushq $0x1
jmp 0x974c
movsbl 0x8(%r15), %eax
jmp 0x9710
movswl 0x8(%r15), %eax
testl %eax, %eax
js 0x976b
leaq 0x8(%rsp), %r15
movl %eax, (%r15)
pushq $0x4
jmp 0x974c
movq 0x8(%r15), %rax
cmpq $0x7fff, %rax           # imm = 0x7FFF
ja 0x976b
leaq 0x8(%rsp), %r15
movw %ax, (%r15)
jmp 0x974a
movsbl 0x8(%r15), %eax
testw %ax, %ax
js 0x976b
leaq 0x8(%rsp), %r15
movw %ax, (%r15)
pushq $0x2
popq %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x44b0
xorl %r14d, %r14d
jmp 0x98c5
movl 0x8(%r15), %eax
movswl %ax, %ecx
cmpl %eax, %ecx
je 0x9741
leaq 0x1ed0(%rip), %rsi      # 0xb642
pushq $0x1
popq %rdi
movl %r14d, %ecx
xorl %eax, %eax
callq 0x4610
movl %eax, %r14d
negl %r14d
jmp 0x98c5
movl 0x8(%r15), %eax
cmpl $0x7fff, %eax           # imm = 0x7FFF
jbe 0x9741
jmp 0x976b
movq 0x8(%r15), %rsi
leaq 0x1ee3(%rip), %rdi      # 0xb685
jmp 0x98b1
cvtss2sd 0x8(%r15), %xmm0
jmp 0x9835
movswl 0x8(%r15), %esi
jmp 0x9879
leaq 0x18f6(%rip), %rdi      # 0xb0b9
callq 0x41f0
movq %rax, (%rbx)
pushq $-0x1
popq %r14
testq %rax, %rax
je 0x98c5
movq 0x8(%r15), %rdi
callq 0x4540
movq %rax, %r12
movq 0x8(%r15), %rdi
callq 0x4270
movq %rax, %r15
leaq 0x1e85(%rip), %r13      # 0xb67c
xorl %ebp, %ebp
cmpq %rbp, %r15
je 0x9758
movsbl (%r12,%rbp), %edx
movq %rbx, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x4560
incq %rbp
testl %eax, %eax
je 0x97f9
movq (%rbx), %rdi
callq 0x4260
jmp 0x98c5
movzwl 0x8(%r15), %esi
jmp 0x9886
movsd 0x8(%r15), %xmm0
leaq 0x1e3d(%rip), %rdi      # 0xb679
movb $0x1, %al
callq 0x4800
movq %rax, (%rbx)
xorl %r14d, %r14d
jmp 0x98be
movzbl 0x8(%r15), %esi
jmp 0x9886
movsbl 0x8(%r15), %esi
jmp 0x9879
leaq 0x1e07(%rip), %rax      # 0xb667
leaq 0x1e05(%rip), %rdi      # 0xb66c
cmpb $0x0, 0x8(%r15)
cmovneq %rax, %rdi
jmp 0x954d
movl 0x8(%r15), %esi
leaq 0x1df2(%rip), %rdi      # 0xb672
jmp 0x988d
movl 0x8(%r15), %esi
leaq 0x1db2(%rip), %rdi      # 0xb63f
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x4800
jmp 0x98bb
movq 0x8(%r15), %rsi
leaq 0x1dd1(%rip), %rdi      # 0xb675
jmp 0x98b1
movq 0x8(%r15), %rsi
leaq 0x17bd(%rip), %rdi      # 0xb06e
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x4800
movq %rax, (%rbx)
cmpq $0x1, %rax
sbbl %r14d, %r14d
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1d64(%rip), %rsi      # 0xb642
pushq $0x1
popq %rdi
pushq $0xd
popq %rcx
jmp 0x9778