// File: /workspace/github_c_makefile_star2_O1/DeforaOS[P]libSystem/src/variable.c
// Function: variable_set_typev
VariableError variable_set_typev(Variable * variable, VariableType type,
		va_list ap)
{
	int32_t i32;
	uint32_t u32;
	int64_t i64;
	uint64_t u64;
	double d;
	Buffer * b;
	String * s;
	Mutator * m;

	switch(type)
	{
		case VT_NULL:
			_variable_destroy(variable);
			break;
		case VT_BOOL:
			_variable_destroy(variable);
			u32 = va_arg(ap, uint32_t);
#ifdef DEBUG
			fprintf(stderr, "DEBUG: %s(%s)\n", __func__,
					u32 ? "true" : "false");
#endif
			variable->u.b = u32 ? true : false;
			break;
		case VT_INT8:
			_variable_destroy(variable);
			i32 = va_arg(ap, int32_t);
#ifdef DEBUG
			fprintf(stderr, "DEBUG: %s(%d)\n", __func__, i32);
#endif
			variable->u.int8 = i32;
			break;
		case VT_UINT8:
			_variable_destroy(variable);
			u32 = va_arg(ap, uint32_t);
#ifdef DEBUG
			fprintf(stderr, "DEBUG: %s(%u)\n", __func__, u32);
#endif
			variable->u.uint8 = u32;
			break;
		case VT_INT16:
			_variable_destroy(variable);
			i32 = va_arg(ap, int32_t);
#ifdef DEBUG
			fprintf(stderr, "DEBUG: %s(%d)\n", __func__, i32);
#endif
			variable->u.int16 = i32;
			break;
		case VT_UINT16:
			_variable_destroy(variable);
			u32 = va_arg(ap, uint32_t);
#ifdef DEBUG
			fprintf(stderr, "DEBUG: %s(%u)\n", __func__, u32);
#endif
			variable->u.uint16 = u32;
			break;
		case VT_INT32:
			_variable_destroy(variable);
			i32 = va_arg(ap, int32_t);
#ifdef DEBUG
			fprintf(stderr, "DEBUG: %s(%d)\n", __func__, i32);
#endif
			variable->u.int32 = i32;
			break;
		case VT_UINT32:
			_variable_destroy(variable);
			u32 = va_arg(ap, uint32_t);
#ifdef DEBUG
			fprintf(stderr, "DEBUG: %s(%u)\n", __func__, u32);
#endif
			variable->u.uint32 = u32;
			break;
		case VT_INT64:
			_variable_destroy(variable);
			i64 = va_arg(ap, int64_t);
#ifdef DEBUG
			fprintf(stderr, "DEBUG: %s(%ld)\n", __func__, i64);
#endif
			variable->u.int64 = i64;
			break;
		case VT_UINT64:
			_variable_destroy(variable);
			u64 = va_arg(ap, uint64_t);
#ifdef DEBUG
			fprintf(stderr, "DEBUG: %s(%lu)\n", __func__, u64);
#endif
			variable->u.uint64 = u64;
			break;
		case VT_FLOAT:
			_variable_destroy(variable);
			d = va_arg(ap, double);
#ifdef DEBUG
			fprintf(stderr, "DEBUG: %s(%f)\n", __func__, d);
#endif
			variable->u.f = d;
			break;
		case VT_DOUBLE:
			_variable_destroy(variable);
			d = va_arg(ap, double);
#ifdef DEBUG
			fprintf(stderr, "DEBUG: %s(%lf)\n", __func__, d);
#endif
			variable->u.d = d;
			break;
		case VT_BUFFER:
			b = va_arg(ap, Buffer *);
#ifdef DEBUG
			fprintf(stderr, "DEBUG: %s(%p)\n", __func__, (void *)b);
#endif
			b = (b != NULL)
				? buffer_new_copy(b) : buffer_new(0, NULL);
			if(b  == NULL)
				return -1;
			_variable_destroy(variable);
			variable->u.buffer = b;
			break;
		case VT_STRING:
			s = va_arg(ap, String *);
#ifdef DEBUG
			fprintf(stderr, "DEBUG: %s(\"%s\")\n", __func__, s);
#endif
			if((s = string_new(s)) == NULL)
				return -1;
			_variable_destroy(variable);
			variable->u.string = s;
			break;
		case VT_COMPOUND:
			s = va_arg(ap, String *);
			if(s != NULL && (s = string_new(s)) == NULL)
				return -1;
			if((m = mutator_new()) == NULL)
			{
				string_delete(s);
				return -1;
			}
			_variable_destroy(variable);
			variable->u.compound.name = s;
			variable->u.compound.members = m;
			break;
		case VT_POINTER:
			_variable_destroy(variable);
			variable->u.pointer = va_arg(ap, void *);
			break;
		default:
			return error_set_code(-ENOSYS, "%s", strerror(ENOSYS));
	}
	variable->type = type;
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x10, %esi
ja 0x8df7
movq %rdx, %r15
movl %esi, %ebx
movq %rdi, %r14
movl %esi, %eax
leaq 0x25c6(%rip), %rcx      # 0xb1d0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r14, %rdi
callq 0x97a8
movl (%r15), %ecx
cmpq $0x28, %rcx
ja 0x8caf
movq %rcx, %rax
addq 0x10(%r15), %rax
addl $0x8, %ecx
movl %ecx, (%r15)
jmp 0x8cbb
movq %r14, %rdi
callq 0x97a8
movl (%r15), %ecx
cmpq $0x28, %rcx
ja 0x8d3e
movq %rcx, %rax
addq 0x10(%r15), %rax
addl $0x8, %ecx
movl %ecx, (%r15)
jmp 0x8d4a
movq %r14, %rdi
callq 0x97a8
movl (%r15), %ecx
cmpq $0x28, %rcx
ja 0x8d89
movq %rcx, %rax
addq 0x10(%r15), %rax
addl $0x8, %ecx
movl %ecx, (%r15)
jmp 0x8d95
movq %r14, %rdi
callq 0x97a8
movl (%r15), %ecx
cmpq $0x28, %rcx
ja 0x8dde
movq %rcx, %rax
addq 0x10(%r15), %rax
addl $0x8, %ecx
movl %ecx, (%r15)
jmp 0x8dea
movq 0x8(%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%r15)
movq (%rax), %rax
movq %rax, 0x8(%r14)
jmp 0x8f17
movl (%r15), %ecx
cmpq $0x28, %rcx
ja 0x8e22
movq %rcx, %rax
addq 0x10(%r15), %rax
addl $0x8, %ecx
movl %ecx, (%r15)
jmp 0x8e2e
movq %r14, %rdi
callq 0x97a8
movl 0x4(%r15), %ecx
cmpq $0xa0, %rcx
ja 0x8e44
movq %rcx, %rax
addq 0x10(%r15), %rax
addl $0x10, %ecx
movl %ecx, 0x4(%r15)
jmp 0x8e50
movq %r14, %rdi
callq 0x97a8
movl 0x4(%r15), %ecx
cmpq $0xa0, %rcx
ja 0x8e5f
movq %rcx, %rax
addq 0x10(%r15), %rax
addl $0x10, %ecx
movl %ecx, 0x4(%r15)
jmp 0x8e6b
movq 0x8(%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%r15)
movb (%rax), %al
movb %al, 0x8(%r14)
jmp 0x8f17
movq %r14, %rdi
callq 0x97a8
jmp 0x8f17
movq %r14, %rdi
callq 0x97a8
movl (%r15), %ecx
cmpq $0x28, %rcx
ja 0x8e7a
movq %rcx, %rax
addq 0x10(%r15), %rax
addl $0x8, %ecx
movl %ecx, (%r15)
jmp 0x8e86
movq 0x8(%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%r15)
movl (%rax), %eax
movl %eax, 0x8(%r14)
jmp 0x8f17
movl (%r15), %ecx
cmpq $0x28, %rcx
ja 0x8e93
movq %rcx, %rax
addq 0x10(%r15), %rax
addl $0x8, %ecx
movl %ecx, (%r15)
jmp 0x8e9f
movl (%r15), %ecx
cmpq $0x28, %rcx
ja 0x8eb5
movq %rcx, %rax
addq 0x10(%r15), %rax
addl $0x8, %ecx
movl %ecx, (%r15)
jmp 0x8ec1
movq 0x8(%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%r15)
movzwl (%rax), %eax
movw %ax, 0x8(%r14)
jmp 0x8f17
movl $0x26, %edi
callq 0x4790
leaq 0x2256(%rip), %rsi      # 0xb05e
movl $0xffffffda, %edi       # imm = 0xFFFFFFDA
movq %rax, %rdx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x45d0
movq 0x8(%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%r15)
movq (%rax), %rdi
testq %rdi, %rdi
je 0x8ed8
callq 0x4730
jmp 0x8ee1
movq 0x8(%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%r15)
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%r14)
jmp 0x8f17
movq 0x8(%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%r15)
cvtsd2ss (%rax), %xmm0
movss %xmm0, 0x8(%r14)
jmp 0x8f17
movq 0x8(%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%r15)
cmpl $0x0, (%rax)
setne 0x8(%r14)
jmp 0x8f17
movq 0x8(%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%r15)
movq (%rax), %rdi
callq 0x41f0
testq %rax, %rax
je 0x8f30
movq %rax, %r15
jmp 0x8ee9
movq 0x8(%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%r15)
movq (%rax), %rdi
testq %rdi, %rdi
je 0x8ef7
callq 0x41f0
movq %rax, %r15
testq %rax, %rax
jne 0x8efa
jmp 0x8f30
xorl %edi, %edi
xorl %esi, %esi
callq 0x4110
movq %rax, %r15
testq %rax, %rax
je 0x8f30
movq %r14, %rdi
callq 0x97a8
movq %r15, 0x8(%r14)
jmp 0x8f17
xorl %r15d, %r15d
callq 0x4370
testq %rax, %rax
je 0x8f28
movq %rax, %r12
movq %r14, %rdi
callq 0x97a8
movq %r15, 0x10(%r14)
movq %r12, 0x18(%r14)
movl %ebx, (%r14)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %r15, %rdi
callq 0x4260
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x8f1c