// File: /workspace/github_c_makefile_star2_O0/lh3[P]bgt/kexpr.c
// Function: ke_eval
int ke_eval(const kexpr_t *ke, int64_t *_i, double *_r, const char **_p, int *ret_type)
{
	ke1_t *stack, *p, *q;
	int i, top = 0, err = 0;
	*_i = 0, *_r = 0., *ret_type = 0;
	for (i = 0; i < ke->n; ++i) {
		ke1_t *e = &ke->e[i];
		if ((e->ttype == KET_OP || e->ttype == KET_FUNC) && e->f.builtin == 0) err |= KEE_UNFUNC;
		else if (e->ttype == KET_VAL && e->name && e->assigned == 0) err |= KEE_UNVAR;
	}
	stack = (ke1_t*)malloc(ke->n * sizeof(ke1_t));
	for (i = 0; i < ke->n; ++i) {
		ke1_t *e = &ke->e[i];
		if (e->ttype == KET_OP || e->ttype == KET_FUNC) {
			if (e->n_args == 2 && e->f.builtin) {
				q = &stack[--top], p = &stack[top-1];
				if (e->user_func) {
					if (e->user_func == KEF_REAL)
						p->r = e->f.real_func2(p->r, q->r), p->i = (int64_t)(p->r + .5), p->vtype = KEV_REAL;
				} else e->f.builtin(p, q);
			} else if (e->n_args == 1 && e->f.builtin) {
				p = &stack[top-1];
				if (e->user_func) {
					if (e->user_func == KEF_REAL)
						p->r = e->f.real_func1(p->r), p->i = (int64_t)(p->r + .5), p->vtype = KEV_REAL;
				} else e->f.builtin(&stack[top-1], 0);
			} else top -= e->n_args - 1;
		} else stack[top++] = *e;
	}
	*ret_type = stack->vtype;
	*_i = stack->i, *_r = stack->r, *_p = stack->s;
	free(stack);
	return err;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl $0x0, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movq -0x10(%rbp), %rax
movq $0x0, (%rax)
movq -0x18(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movq -0x28(%rbp), %rax
movl $0x0, (%rax)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x2388f
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x44(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq (%rax), %rax
andq $0xffff, %rax           # imm = 0xFFFF
cmpl $0x2, %eax
je 0x2382b
movq -0x58(%rbp), %rax
movq (%rax), %rax
andq $0xffff, %rax           # imm = 0xFFFF
cmpl $0x3, %eax
jne 0x23841
movq -0x58(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x23841
movl -0x4c(%rbp), %eax
orl $0x40, %eax
movl %eax, -0x4c(%rbp)
jmp 0x2387f
movq -0x58(%rbp), %rax
movq (%rax), %rax
andq $0xffff, %rax           # imm = 0xFFFF
cmpl $0x1, %eax
jne 0x2387d
movq -0x58(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x2387d
movq -0x58(%rbp), %rax
movq (%rax), %rax
shrq $0x1a, %rax
andq $0x1, %rax
cmpl $0x0, %eax
jne 0x2387d
movl -0x4c(%rbp), %eax
orl $0x80, %eax
movl %eax, -0x4c(%rbp)
jmp 0x2387f
jmp 0x23881
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x237e1
movq -0x8(%rbp), %rax
movslq (%rax), %rax
imulq $0x30, %rax, %rdi
callq 0x22f0
movq %rax, -0x30(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x23b17
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x44(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq (%rax), %rax
andq $0xffff, %rax           # imm = 0xFFFF
cmpl $0x2, %eax
je 0x238f8
movq -0x60(%rbp), %rax
movq (%rax), %rax
andq $0xffff, %rax           # imm = 0xFFFF
cmpl $0x3, %eax
jne 0x23ae1
movq -0x60(%rbp), %rax
movq (%rax), %rax
sarq $0x28, %rax
cmpl $0x2, %eax
jne 0x239ea
movq -0x60(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x239ea
movq -0x30(%rbp), %rax
movl -0x48(%rbp), %ecx
addl $-0x1, %ecx
movl %ecx, -0x48(%rbp)
movslq %ecx, %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
movl -0x48(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x60(%rbp), %rax
movq (%rax), %rax
shrq $0x1b, %rax
andq $0x1f, %rax
cmpl $0x0, %eax
je 0x239d3
movq -0x60(%rbp), %rax
movq (%rax), %rax
shrq $0x1b, %rax
andq $0x1f, %rax
cmpl $0x1, %eax
jne 0x239d1
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x38(%rbp), %rcx
movsd 0x18(%rcx), %xmm0
movq -0x40(%rbp), %rcx
movsd 0x18(%rcx), %xmm1
callq *%rax
movq -0x38(%rbp), %rax
movsd %xmm0, 0x18(%rax)
movq -0x38(%rbp), %rax
movsd 0x4421(%rip), %xmm0     # 0x27dc8
addsd 0x18(%rax), %xmm0
cvttsd2si %xmm0, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x38(%rbp), %rax
movq (%rax), %rcx
andq $-0x3ff0001, %rcx       # imm = 0xFC00FFFF
orq $0x10000, %rcx          # imm = 0x10000
movq %rcx, (%rax)
jmp 0x239e5
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq *%rax
jmp 0x23adf
movq -0x60(%rbp), %rax
movq (%rax), %rax
sarq $0x28, %rax
cmpl $0x1, %eax
jne 0x23ac5
movq -0x60(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x23ac5
movq -0x30(%rbp), %rax
movl -0x48(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x60(%rbp), %rax
movq (%rax), %rax
shrq $0x1b, %rax
andq $0x1f, %rax
cmpl $0x0, %eax
je 0x23aa1
movq -0x60(%rbp), %rax
movq (%rax), %rax
shrq $0x1b, %rax
andq $0x1f, %rax
cmpl $0x1, %eax
jne 0x23a9f
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x38(%rbp), %rcx
movsd 0x18(%rcx), %xmm0
callq *%rax
movq -0x38(%rbp), %rax
movsd %xmm0, 0x18(%rax)
movq -0x38(%rbp), %rax
movsd 0x4353(%rip), %xmm0     # 0x27dc8
addsd 0x18(%rax), %xmm0
cvttsd2si %xmm0, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x38(%rbp), %rax
movq (%rax), %rcx
andq $-0x3ff0001, %rcx       # imm = 0xFC00FFFF
orq $0x10000, %rcx          # imm = 0x10000
movq %rcx, (%rax)
jmp 0x23ac3
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x30(%rbp), %rdi
movl -0x48(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rdi
xorl %ecx, %ecx
movl %ecx, %esi
callq *%rax
jmp 0x23add
movq -0x60(%rbp), %rax
movq (%rax), %rax
sarq $0x28, %rax
movl %eax, %ecx
subl $0x1, %ecx
movl -0x48(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x48(%rbp)
jmp 0x23adf
jmp 0x23b07
movq -0x30(%rbp), %rdi
movl -0x48(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x48(%rbp)
cltq
imulq $0x30, %rax, %rax
addq %rax, %rdi
movq -0x60(%rbp), %rsi
movl $0x30, %edx
callq 0x2290
jmp 0x23b09
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x238aa
movq -0x30(%rbp), %rax
movq (%rax), %rax
shrq $0x10, %rax
andq $0x3ff, %rax            # imm = 0x3FF
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
movsd 0x18(%rax), %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rdi
callq 0x2040
movl -0x4c(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)