// File: /workspace/github_c_makefile_star2_O3/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 0x8e53
movq %rdx, %r15
movl %esi, %ebx
movq %rdi, %r14
movl %esi, %eax
leaq 0x256a(%rip), %rcx      # 0xb1d0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r14, %rdi
callq 0x97f5
movl (%r15), %ecx
cmpq $0x28, %rcx
ja 0x8d0b
movq %rcx, %rax
addq 0x10(%r15), %rax
addl $0x8, %ecx
movl %ecx, (%r15)
jmp 0x8d17
movq %r14, %rdi
callq 0x97f5
movl (%r15), %ecx
cmpq $0x28, %rcx
ja 0x8d9a
movq %rcx, %rax
addq 0x10(%r15), %rax
addl $0x8, %ecx
movl %ecx, (%r15)
jmp 0x8da6
movq %r14, %rdi
callq 0x97f5
movl (%r15), %ecx
cmpq $0x28, %rcx
ja 0x8de5
movq %rcx, %rax
addq 0x10(%r15), %rax
addl $0x8, %ecx
movl %ecx, (%r15)
jmp 0x8df1
movq %r14, %rdi
callq 0x97f5
movl (%r15), %ecx
cmpq $0x28, %rcx
ja 0x8e3a
movq %rcx, %rax
addq 0x10(%r15), %rax
addl $0x8, %ecx
movl %ecx, (%r15)
jmp 0x8e46
movq 0x8(%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%r15)
movq (%rax), %rax
movq %rax, 0x8(%r14)
jmp 0x8f73
movl (%r15), %ecx
cmpq $0x28, %rcx
ja 0x8e7e
movq %rcx, %rax
addq 0x10(%r15), %rax
addl $0x8, %ecx
movl %ecx, (%r15)
jmp 0x8e8a
movq %r14, %rdi
callq 0x97f5
movl 0x4(%r15), %ecx
cmpq $0xa0, %rcx
ja 0x8ea0
movq %rcx, %rax
addq 0x10(%r15), %rax
addl $0x10, %ecx
movl %ecx, 0x4(%r15)
jmp 0x8eac
movq %r14, %rdi
callq 0x97f5
movl 0x4(%r15), %ecx
cmpq $0xa0, %rcx
ja 0x8ebb
movq %rcx, %rax
addq 0x10(%r15), %rax
addl $0x10, %ecx
movl %ecx, 0x4(%r15)
jmp 0x8ec7
movq 0x8(%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%r15)
movb (%rax), %al
movb %al, 0x8(%r14)
jmp 0x8f73
movq %r14, %rdi
callq 0x97f5
jmp 0x8f73
movq %r14, %rdi
callq 0x97f5
movl (%r15), %ecx
cmpq $0x28, %rcx
ja 0x8ed6
movq %rcx, %rax
addq 0x10(%r15), %rax
addl $0x8, %ecx
movl %ecx, (%r15)
jmp 0x8ee2
movq 0x8(%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%r15)
movl (%rax), %eax
movl %eax, 0x8(%r14)
jmp 0x8f73
movl (%r15), %ecx
cmpq $0x28, %rcx
ja 0x8eef
movq %rcx, %rax
addq 0x10(%r15), %rax
addl $0x8, %ecx
movl %ecx, (%r15)
jmp 0x8efb
movl (%r15), %ecx
cmpq $0x28, %rcx
ja 0x8f11
movq %rcx, %rax
addq 0x10(%r15), %rax
addl $0x8, %ecx
movl %ecx, (%r15)
jmp 0x8f1d
movq 0x8(%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%r15)
movzwl (%rax), %eax
movw %ax, 0x8(%r14)
jmp 0x8f73
movl $0x26, %edi
callq 0x47a0
leaq 0x21fa(%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 0x8f34
callq 0x4740
jmp 0x8f3d
movq 0x8(%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%r15)
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%r14)
jmp 0x8f73
movq 0x8(%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%r15)
cvtsd2ss (%rax), %xmm0
movss %xmm0, 0x8(%r14)
jmp 0x8f73
movq 0x8(%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%r15)
cmpl $0x0, (%rax)
setne 0x8(%r14)
jmp 0x8f73
movq 0x8(%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%r15)
movq (%rax), %rdi
callq 0x41f0
testq %rax, %rax
je 0x8f8c
movq %rax, %r15
jmp 0x8f45
movq 0x8(%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%r15)
movq (%rax), %rdi
testq %rdi, %rdi
je 0x8f53
callq 0x41f0
movq %rax, %r15
testq %rax, %rax
jne 0x8f56
jmp 0x8f8c
xorl %edi, %edi
xorl %esi, %esi
callq 0x4110
movq %rax, %r15
testq %rax, %rax
je 0x8f8c
movq %r14, %rdi
callq 0x97f5
movq %r15, 0x8(%r14)
jmp 0x8f73
xorl %r15d, %r15d
callq 0x4370
testq %rax, %rax
je 0x8f84
movq %rax, %r12
movq %r14, %rdi
callq 0x97f5
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 0x8f78