// File: /workspace/github_c_makefile_star2_O1/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, %r9d
movq %rdi, %r14
movl (%rdi), %r8d
cmpl %esi, %r8d
jne 0x9863
cmpl $0x10, %r9d
ja 0x9c81
movl %r9d, %eax
leaq 0x1cc4(%rip), %rdx      # 0xb504
movslq (%rdx,%rax,4), %rsi
addq %rdx, %rsi
jmpq *%rsi
cmpl $0x10, %r9d
ja 0x99a7
leaq 0x1d86(%rip), %rdx      # 0xb5e0
movq (%rdx,%rax,8), %r15
jmp 0x99aa
xorl %edx, %edx
xorl %eax, %eax
xorl %r15d, %r15d
leal -0x1(%r9), %ecx
cmpl $0xc, %ecx
ja 0xa177
leaq 0x1a22(%rip), %rsi      # 0xb2a0
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
movl $0x1, %edx
movb $0x1, %al
leal -0x2(%r8), %ecx
cmpl $0x7, %ecx
ja 0xa174
leaq 0x1b6a(%rip), %rsi      # 0xb40c
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
movb 0x8(%r14), %cl
testb %cl, %cl
jns 0x9a3c
leal -0x4(%r8), %ecx
cmpl $0x5, %ecx
ja 0xa174
leaq 0x1b61(%rip), %rsi      # 0xb42c
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
movzwl 0x8(%r14), %ecx
cmpl $0xff, %ecx
jbe 0xa00d
leal -0x5(%r8), %ecx
cmpl $0x4, %ecx
ja 0xa174
leaq 0x1b4b(%rip), %rsi      # 0xb444
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
movzwl 0x8(%r14), %ecx
cmpl $0xff, %ecx
jbe 0xa00d
leal -0x6(%r8), %ecx
cmpl $0x3, %ecx
ja 0xa174
leaq 0x1b31(%rip), %rsi      # 0xb458
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
movl 0x8(%r14), %ecx
cmpl $0xff, %ecx
jbe 0xa00d
cmpl $0x9, %r8d
je 0x9991
cmpl $0x8, %r8d
je 0x9976
cmpl $0x7, %r8d
jne 0xa174
movl 0x8(%r14), %ecx
cmpl $0xff, %ecx
jbe 0xa00d
cmpl $0x9, %r8d
je 0x9991
cmpl $0x8, %r8d
jne 0xa174
movq 0x8(%r14), %rcx
cmpq $0xff, %rcx
jbe 0xa04f
cmpl $0x9, %r8d
jne 0xa174
movq 0x8(%r14), %rcx
cmpq $0xff, %rcx
jbe 0xa04f
jmp 0xa174
xorl %r15d, %r15d
testq %rcx, %rcx
je 0x99d2
cmpq (%rcx), %r15
jbe 0x99cf
movl $0x1c, %edi
callq 0x4790
leaq 0x1699(%rip), %rsi      # 0xb05e
movl $0xffffffe4, %edi       # imm = 0xFFFFFFE4
jmp 0x9c97
movq %r15, (%rcx)
movq %r14, %rdi
callq 0x46a0
movq %rbx, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x4470
xorl %r9d, %r9d
jmp 0xa1b6
xorl %r15d, %r15d
cmpl $0xa, %r8d
jne 0x9baf
cvtss2sd 0x8(%r14), %xmm0
movsd %xmm0, (%rbx)
jmp 0xa1b3
movl $0x1, %edx
movb $0x1, %al
leal -0x3(%r8), %ecx
cmpl $0x6, %ecx
ja 0xa174
leaq 0x1a41(%rip), %rsi      # 0xb468
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
movb 0x8(%r14), %cl
testb %cl, %cl
js 0x9f67
leaq 0x8(%rsp), %r15
movb %cl, (%r15)
jmp 0xa177
movl $0x4, %edx
movb $0x1, %al
xorl %r15d, %r15d
leal -0x2(%r8), %ecx
cmpl $0x7, %ecx
ja 0xa177
leaq 0x18c9(%rip), %rsi      # 0xb330
movslq (%rsi,%rcx,4), %rdi
addq %rsi, %rdi
jmpq *%rdi
movsbl 0x8(%r14), %ecx
jmp 0xa0a3
cmpl $0x10, %r8d
ja 0x9f4e
movl %r8d, %eax
leaq 0x1a32(%rip), %rcx      # 0xb4c0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq $0x0, (%rbx)
jmp 0xa18f
movl $0x4, %edx
movb $0x1, %al
xorl %r15d, %r15d
leal -0x2(%r8), %ecx
cmpl $0x7, %ecx
ja 0xa177
leaq 0x1813(%rip), %rsi      # 0xb2d4
movslq (%rsi,%rcx,4), %rdi
addq %rsi, %rdi
jmpq *%rdi
movsbl 0x8(%r14), %ecx
testl %ecx, %ecx
jns 0xa0a3
xorl %r15d, %r15d
leal -0x3(%r8), %ecx
cmpl $0x6, %ecx
ja 0xa177
leaq 0x1826(%rip), %rsi      # 0xb314
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
movl $0x8, %edx
movb $0x1, %al
cmpl $0x9, %r8d
jne 0xa174
movq 0x8(%r14), %rcx
jmp 0x9bd6
movl $0x2, %edx
movb $0x1, %al
xorl %r15d, %r15d
leal -0x2(%r8), %ecx
cmpl $0x7, %ecx
ja 0xa177
leaq 0x189d(%rip), %rsi      # 0xb3cc
movslq (%rsi,%rcx,4), %rdi
addq %rsi, %rdi
jmpq *%rdi
movsbl 0x8(%r14), %ecx
jmp 0xa132
movl $0x2, %edx
movb $0x1, %al
xorl %r15d, %r15d
leal -0x2(%r8), %ecx
cmpl $0x7, %ecx
ja 0xa177
leaq 0x1810(%rip), %rsi      # 0xb370
movslq (%rsi,%rcx,4), %rdi
addq %rsi, %rdi
jmpq *%rdi
movsbl 0x8(%r14), %ecx
testw %cx, %cx
jns 0xa132
xorl %r15d, %r15d
leal -0x3(%r8), %ecx
cmpl $0x6, %ecx
ja 0xa177
leaq 0x1822(%rip), %rsi      # 0xb3b0
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
xorl %r15d, %r15d
cmpl $0xb, %r8d
jne 0x9baf
cvtsd2ss 0x8(%r14), %xmm0
movss %xmm0, (%rbx)
jmp 0xa1b3
xorl %eax, %eax
xorl %edx, %edx
jmp 0xa177
movl $0x8, %edx
movb $0x1, %al
cmpl $0x8, %r8d
jne 0xa174
movq 0x8(%r14), %rcx
testq %rcx, %rcx
js 0xa174
leaq 0x8(%rsp), %r15
movq %rcx, (%r15)
jmp 0xa177
movq %rcx, %rdi
callq 0xa205
testl %eax, %eax
jne 0x9ccf
movq 0x8(%r14), %rdi
callq 0x4730
jmp 0x9c6f
testq %rcx, %rcx
je 0x9caf
leaq 0x8(%rsp), %r15
movq %rcx, (%r15)
movq $0x0, 0x10(%r15)
movq %rbx, 0x8(%r15)
movl $0x0, 0x18(%r15)
movq 0x18(%r14), %rdi
leaq 0xc69(%rip), %rsi       # 0xa897
movq %r15, %rdx
callq 0x4380
movl 0x18(%r15), %r9d
jmp 0xa1b6
movq %rcx, %rdi
callq 0xa205
testl %eax, %eax
jne 0x9ccf
movq 0x8(%r14), %rdi
callq 0x41f0
jmp 0x9c6f
movq %rcx, %rdi
callq 0xa205
testl %eax, %eax
jne 0x9ccf
movq 0x10(%r14), %rdi
callq 0x46e0
movq %rax, (%rbx)
xorl %r9d, %r9d
cmpq $0x1, %rax
sbbl %r9d, %r9d
jmp 0xa1b6
movl $0x5f, %edi
callq 0x4790
leaq 0x13cc(%rip), %rsi      # 0xb05e
movl $0xffffffa1, %edi       # imm = 0xFFFFFFA1
movq %rax, %rdx
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x45d0
movl $0x16, %edi
callq 0x4790
leaq 0x139e(%rip), %rsi      # 0xb05e
movl $0xffffffea, %edi       # imm = 0xFFFFFFEA
movq %rax, %rdx
xorl %eax, %eax
callq 0x45d0
movl %eax, %r9d
jmp 0xa1b6
leaq 0x8(%r14), %r15
jmp 0xa177
movl 0x8(%r14), %esi
testl %esi, %esi
jns 0x9d4a
xorl %r15d, %r15d
cmpl $0x7, %ecx
ja 0xa177
leaq 0x1655(%rip), %rsi      # 0xb350
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
movswl 0x8(%r14), %ecx
jmp 0xa0a3
movq 0x8(%r14), %rcx
movslq %ecx, %rsi
cmpq %rcx, %rsi
je 0xa0d8
cmpl $0x9, %r8d
jne 0xa174
movq 0x8(%r14), %rcx
cmpq $0x7fffffff, %rcx       # imm = 0x7FFFFFFF
jbe 0xa0d8
jmp 0xa174
movl 0x8(%r14), %esi
testl %esi, %esi
js 0xa05c
leaq 0x8(%rsp), %r15
movl %esi, (%r15)
jmp 0xa177
movzwl 0x8(%r14), %esi
testw %si, %si
jns 0x9e05
xorl %r15d, %r15d
cmpl $0x7, %ecx
ja 0xa177
leaq 0x1674(%rip), %rsi      # 0xb3ec
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
movl 0x8(%r14), %ecx
movswl %cx, %esi
cmpl %ecx, %esi
je 0xa132
cmpl $0x9, %r8d
je 0x9de1
cmpl $0x8, %r8d
je 0x9dc6
cmpl $0x7, %r8d
jne 0xa174
movl 0x8(%r14), %ecx
cmpl $0x7fff, %ecx           # imm = 0x7FFF
jbe 0xa132
cmpl $0x9, %r8d
je 0x9de1
cmpl $0x8, %r8d
jne 0xa174
movq 0x8(%r14), %rcx
movswq %cx, %rsi
cmpq %rcx, %rsi
je 0xa169
cmpl $0x9, %r8d
jne 0xa174
movq 0x8(%r14), %rcx
cmpq $0x7fff, %rcx           # imm = 0x7FFF
jbe 0xa169
jmp 0xa174
movzwl 0x8(%r14), %esi
testw %si, %si
js 0xa0e5
leaq 0x8(%rsp), %r15
movw %si, (%r15)
jmp 0xa177
movq 0x8(%r14), %rsi
leaq 0x1967(%rip), %rdi      # 0xb785
jmp 0x9f35
cvtss2sd 0x8(%r14), %xmm0
jmp 0x9eb7
movswl 0x8(%r14), %esi
jmp 0x9efd
leaq 0x127a(%rip), %rdi      # 0xb0b9
callq 0x41f0
movq %rax, (%rbx)
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
testq %rax, %rax
je 0xa1b3
movq 0x8(%r14), %rdi
callq 0x4500
movq %rax, %r12
movq 0x8(%r14), %rdi
callq 0x4270
testq %rax, %rax
je 0xa18f
movq %rax, %r14
leaq 0x18fe(%rip), %r13      # 0xb77c
xorl %ebp, %ebp
movsbl (%r12,%rbp), %edx
movq %rbx, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x4520
testl %eax, %eax
jne 0xa1c8
incq %rbp
xorl %r15d, %r15d
cmpq %rbp, %r14
jne 0x9e80
jmp 0xa1b3
movzwl 0x8(%r14), %esi
jmp 0x9f0a
movsd 0x8(%r14), %xmm0
leaq 0x18bb(%rip), %rdi      # 0xb779
movb $0x1, %al
callq 0x47a0
jmp 0x9ef1
movzbl 0x8(%r14), %esi
jmp 0x9f0a
movsbl 0x8(%r14), %esi
jmp 0x9efd
leaq 0x188b(%rip), %rax      # 0xb767
leaq 0x1889(%rip), %rdi      # 0xb76c
cmpb $0x0, 0x8(%r14)
cmovneq %rax, %rdi
callq 0x41f0
movq %rax, (%rbx)
xorl %r15d, %r15d
jmp 0x9f42
movl 0x8(%r14), %esi
leaq 0x186e(%rip), %rdi      # 0xb772
jmp 0x9f11
movl 0x8(%r14), %esi
leaq 0x182e(%rip), %rdi      # 0xb73f
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x47a0
jmp 0x9f3f
movq 0x8(%r14), %rsi
leaq 0x184d(%rip), %rdi      # 0xb775
jmp 0x9f35
movq 0x8(%r14), %rsi
leaq 0x1139(%rip), %rdi      # 0xb06e
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x47a0
movq %rax, (%rbx)
cmpq $0x1, %rax
sbbl %r15d, %r15d
jmp 0xa1b3
leaq 0x17ed(%rip), %rsi      # 0xb742
movl $0x1, %edi
movl %r8d, %edx
movl $0xd, %ecx
jmp 0xa1a6
leal -0x4(%r8), %ecx
cmpl $0x5, %ecx
ja 0xa174
leaq 0x1509(%rip), %rsi      # 0xb484
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
movzwl 0x8(%r14), %ecx
movsbl %cl, %esi
cmpw %cx, %si
je 0x9fb9
leal -0x5(%r8), %ecx
cmpl $0x4, %ecx
ja 0xa174
leaq 0x14f7(%rip), %rsi      # 0xb49c
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
movzwl 0x8(%r14), %ecx
cmpw $0x7f, %cx
ja 0x9fc6
leaq 0x8(%rsp), %r15
movb %cl, (%r15)
jmp 0xa177
leal -0x6(%r8), %ecx
cmpl $0x3, %ecx
ja 0xa174
leaq 0x14d6(%rip), %rsi      # 0xb4b0
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
movl 0x8(%r14), %ecx
movsbl %cl, %esi
cmpl %ecx, %esi
je 0xa00d
cmpl $0x9, %r8d
je 0xa041
cmpl $0x8, %r8d
je 0xa02a
cmpl $0x7, %r8d
jne 0xa174
movl 0x8(%r14), %ecx
cmpl $0x7f, %ecx
ja 0xa01a
leaq 0x8(%rsp), %r15
movb %cl, (%r15)
jmp 0xa177
cmpl $0x9, %r8d
je 0xa041
cmpl $0x8, %r8d
jne 0xa174
movq 0x8(%r14), %rcx
movsbq %cl, %rsi
cmpq %rcx, %rsi
je 0xa04f
cmpl $0x9, %r8d
jne 0xa174
movq 0x8(%r14), %rcx
cmpq $0x7f, %rcx
ja 0xa174
leaq 0x8(%rsp), %r15
movb %cl, (%r15)
jmp 0xa177
xorl %r15d, %r15d
cmpl $0x7, %ecx
ja 0xa177
leaq 0x1285(%rip), %rsi      # 0xb2f4
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
movzbl 0x8(%r14), %ecx
jmp 0xa0a3
movswl 0x8(%r14), %ecx
testl %ecx, %ecx
jns 0xa0a3
cmpl $0x9, %r8d
je 0xa0c7
cmpl $0x8, %r8d
je 0xa0b0
cmpl $0x5, %r8d
jne 0xa174
movzwl 0x8(%r14), %ecx
leaq 0x8(%rsp), %r15
movl %ecx, (%r15)
jmp 0xa177
movq 0x8(%r14), %rcx
movq %rcx, %rsi
shrq $0x20, %rsi
je 0xa0d8
cmpl $0x9, %r8d
jne 0xa174
movq 0x8(%r14), %rcx
movq %rcx, %rsi
shrq $0x20, %rsi
jne 0xa174
leaq 0x8(%rsp), %r15
movl %ecx, (%r15)
jmp 0xa177
xorl %r15d, %r15d
cmpl $0x7, %ecx
ja 0xa177
leaq 0x1298(%rip), %rsi      # 0xb390
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
movzbl 0x8(%r14), %ecx
jmp 0xa132
movl 0x8(%r14), %ecx
cmpl $0xffff, %ecx           # imm = 0xFFFF
jbe 0xa132
cmpl $0x9, %r8d
je 0xa15c
cmpl $0x8, %r8d
je 0xa149
cmpl $0x7, %r8d
jne 0xa174
movl 0x8(%r14), %ecx
cmpl $0xffff, %ecx           # imm = 0xFFFF
ja 0xa13d
leaq 0x8(%rsp), %r15
movw %cx, (%r15)
jmp 0xa177
cmpl $0x9, %r8d
je 0xa15c
cmpl $0x8, %r8d
jne 0xa174
movq 0x8(%r14), %rcx
cmpq $0xffff, %rcx           # imm = 0xFFFF
jbe 0xa169
cmpl $0x9, %r8d
jne 0xa174
movq 0x8(%r14), %rcx
cmpq $0xffff, %rcx           # imm = 0xFFFF
ja 0xa174
leaq 0x8(%rsp), %r15
movw %cx, (%r15)
jmp 0xa177
xorl %r15d, %r15d
testq %r15, %r15
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xa194
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4470
xorl %r15d, %r15d
jmp 0xa1b3
movl (%r14), %edx
leaq 0x15a4(%rip), %rsi      # 0xb742
movl $0x1, %edi
movl %r9d, %ecx
xorl %eax, %eax
callq 0x45d0
movl %eax, %r15d
negl %r15d
movl %r15d, %r9d
movl %r9d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %rdi
callq 0x4260
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
jmp 0xa1b3