// File: /workspace/github_c_makefile_star2_O3/darwin-on-arm[P]darwin-sdk/developer_cmds/unifdef/unifdef.c
// Function: eval_unary
static Linetype
eval_unary(const struct ops *ops, int *valp, const char **cpp)
{
	const char *cp;
	char *ep;
	int sym;
	bool defparen;
	Linetype lt;

	cp = skipcomment(*cpp);
	if (*cp == '!') {
		debug("eval%d !", ops - eval_ops);
		cp++;
		lt = eval_unary(ops, valp, &cp);
		if (lt == LT_ERROR)
			return (LT_ERROR);
		if (lt != LT_IF) {
			*valp = !*valp;
			lt = *valp ? LT_TRUE : LT_FALSE;
		}
	} else if (*cp == '(') {
		cp++;
		debug("eval%d (", ops - eval_ops);
		lt = eval_table(eval_ops, valp, &cp);
		if (lt == LT_ERROR)
			return (LT_ERROR);
		cp = skipcomment(cp);
		if (*cp++ != ')')
			return (LT_ERROR);
	} else if (isdigit((unsigned char)*cp)) {
		debug("eval%d number", ops - eval_ops);
		*valp = strtol(cp, &ep, 0);
		if (ep == cp)
			return (LT_ERROR);
		lt = *valp ? LT_TRUE : LT_FALSE;
		cp = skipsym(cp);
	} else if (strncmp(cp, "defined", 7) == 0 && endsym(cp[7])) {
		cp = skipcomment(cp+7);
		debug("eval%d defined", ops - eval_ops);
		if (*cp == '(') {
			cp = skipcomment(cp+1);
			defparen = true;
		} else {
			defparen = false;
		}
		sym = findsym(cp);
		if (sym < 0) {
			lt = LT_IF;
		} else {
			*valp = (value[sym] != NULL);
			lt = *valp ? LT_TRUE : LT_FALSE;
		}
		cp = skipsym(cp);
		cp = skipcomment(cp);
		if (defparen && *cp++ != ')')
			return (LT_ERROR);
		constexpr = false;
	} else if (!endsym(*cp)) {
		debug("eval%d symbol", ops - eval_ops);
		sym = findsym(cp);
		cp = skipsym(cp);
		if (sym < 0) {
			lt = LT_IF;
			cp = skipargs(cp);
		} else if (value[sym] == NULL) {
			*valp = 0;
			lt = LT_FALSE;
		} else {
			*valp = strtol(value[sym], &ep, 0);
			if (*ep != '\0' || ep == value[sym])
				return (LT_ERROR);
			lt = *valp ? LT_TRUE : LT_FALSE;
			cp = skipargs(cp);
		}
		constexpr = false;
	} else {
		debug("eval%d bad expr", ops - eval_ops);
		return (LT_ERROR);
	}

	*cpp = cp;
	debug("eval%d = %d", ops - eval_ops, *valp);
	return (lt);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %rbp
movq (%rdx), %rdi
callq 0x3fff
movq %rax, %r12
movzbl (%rax), %r13d
cmpl $0x28, %r13d
je 0x4971
cmpl $0x21, %r13d
jne 0x49ea
leaq 0x436a(%rip), %rax      # 0x8c70
movq %rbp, %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movabsq $0x2e8ba2e8ba2e8ba3, %r15 # imm = 0x2E8BA2E8BA2E8BA3
imulq %rcx, %r15
leaq 0x1ba5(%rip), %rdi      # 0x64ca
movq %r15, %rsi
xorl %eax, %eax
callq 0x3f0b
incq %r12
leaq 0x8(%rsp), %rdx
movq %r12, (%rdx)
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x48c9
movl %eax, %r13d
cmpl $0x2, %eax
je 0x4af5
cmpl $0x16, %r13d
je 0x4ce6
xorl %eax, %eax
cmpl $0x0, (%rbx)
sete %al
movl %eax, (%rbx)
movl $0x4, %ebp
subl %eax, %ebp
jmp 0x4cc8
incq %r12
leaq 0x8(%rsp), %r13
movq %r12, (%r13)
leaq 0x42ec(%rip), %r12      # 0x8c70
subq %r12, %rbp
sarq $0x3, %rbp
movabsq $0x2e8ba2e8ba2e8ba3, %r15 # imm = 0x2E8BA2E8BA2E8BA3
imulq %rbp, %r15
leaq 0x1b33(%rip), %rdi      # 0x64d3
movq %r15, %rsi
xorl %eax, %eax
callq 0x3f0b
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x4625
movl $0x16, %r13d
cmpl $0x16, %eax
je 0x4ce6
movl %eax, %ebp
movq 0x8(%rsp), %rdi
callq 0x3fff
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rsp)
cmpb $0x29, (%rax)
je 0x4cc8
jmp 0x4ce6
movq %r14, 0x10(%rsp)
callq 0x3280
movq %rax, 0x18(%rsp)
movq (%rax), %r15
movzwl (%r15,%r13,2), %r14d
btl $0xb, %r14d
jb 0x4a6a
leaq 0x1ae2(%rip), %rsi      # 0x64f1
movl $0x7, %edx
movq %r12, %rdi
callq 0x3070
testl %eax, %eax
je 0x4bab
leaq 0x4245(%rip), %rax      # 0x8c70
subq %rax, %rbp
sarq $0x3, %rbp
movabsq $0x2e8ba2e8ba2e8ba3, %r15 # imm = 0x2E8BA2E8BA2E8BA3
imulq %rbp, %r15
cmpl $0x5f, %r13d
je 0x4afd
andl $0x8, %r14d
jne 0x4afd
leaq 0x1aac(%rip), %rdi      # 0x6507
movq %r15, %rsi
xorl %eax, %eax
callq 0x3f0b
jmp 0x4aea
leaq 0x41ff(%rip), %rax      # 0x8c70
subq %rax, %rbp
sarq $0x3, %rbp
movabsq $0x2e8ba2e8ba2e8ba3, %r15 # imm = 0x2E8BA2E8BA2E8BA3
imulq %rbp, %r15
leaq 0x1a4f(%rip), %rdi      # 0x64dc
movq %r15, %rsi
xorl %eax, %eax
callq 0x3f0b
leaq 0x20(%rsp), %rbp
movq %r12, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x31a0
movl %eax, (%rbx)
cmpq %r12, (%rbp)
je 0x4aea
movq 0x18(%rsp), %rcx
movq (%rcx), %rcx
decq %r12
movzbl 0x1(%r12), %edx
incq %r12
cmpl $0x5f, %edx
je 0x4abc
movzwl (%rcx,%rdx,2), %edx
andl $0x8, %edx
jne 0x4abc
xorl %ebp, %ebp
cmpl $0x1, %eax
adcl $0x3, %ebp
movq %r12, 0x8(%rsp)
movq 0x10(%rsp), %r14
jmp 0x4cc8
movl $0x16, %r13d
jmp 0x4ce6
movl %r13d, %ebp
jmp 0x4cc8
leaq 0x19f5(%rip), %rdi      # 0x64f9
movq %r15, %rsi
xorl %eax, %eax
callq 0x3f0b
movq %r12, %rdi
callq 0x4370
movq 0x18(%rsp), %rcx
movq (%rcx), %rcx
decq %r12
movzbl 0x1(%r12), %edx
incq %r12
cmpl $0x5f, %edx
je 0x4b21
movzwl (%rcx,%rdx,2), %edx
andl $0x8, %edx
jne 0x4b21
movq %r12, 0x8(%rsp)
testl %eax, %eax
js 0x4c4b
movl %eax, %r14d
leaq 0x67b1(%rip), %rbp      # 0xb300
movq (%rbp,%r14,8), %rdi
testq %rdi, %rdi
je 0x4c5f
leaq 0x20(%rsp), %r13
movq %r13, %rsi
xorl %edx, %edx
callq 0x31a0
movl %eax, (%rbx)
movq (%r13), %rcx
movl $0x16, %r13d
cmpb $0x0, (%rcx)
jne 0x4ce6
cmpq (%rbp,%r14,8), %rcx
movq 0x10(%rsp), %r14
je 0x4ce6
xorl %ebp, %ebp
cmpl $0x1, %eax
adcl $0x3, %ebp
movq %r12, %rdi
callq 0x4d94
movq %rax, 0x8(%rsp)
jmp 0x4cc1
movzbl 0x7(%r12), %eax
cmpl $0x5f, %eax
je 0x4a24
movzwl (%r15,%rax,2), %eax
andl $0x8, %eax
jne 0x4a24
addq $0x7, %r12
movq %r12, %rdi
callq 0x3fff
movq %rax, %r12
leaq 0x4092(%rip), %rax      # 0x8c70
subq %rax, %rbp
sarq $0x3, %rbp
movabsq $0x2e8ba2e8ba2e8ba3, %r15 # imm = 0x2E8BA2E8BA2E8BA3
imulq %rbp, %r15
leaq 0x18f0(%rip), %rdi      # 0x64ea
movq %r15, %rsi
xorl %eax, %eax
callq 0x3f0b
movb (%r12), %r13b
cmpb $0x28, %r13b
movq 0x10(%rsp), %r14
jne 0x4c21
incq %r12
movq %r12, %rdi
callq 0x3fff
movq %rax, %r12
movq %r12, %rdi
callq 0x4370
testl %eax, %eax
js 0x4c71
movl %eax, %eax
leaq 0x66ca(%rip), %rcx      # 0xb300
xorl %edx, %edx
cmpq $0x0, (%rcx,%rax,8)
setne %dl
movl %edx, (%rbx)
movl $0x4, %ebp
subl %edx, %ebp
jmp 0x4c76
movq %r12, %rdi
callq 0x4d94
movq %rax, 0x8(%rsp)
movl $0x2, %ebp
jmp 0x4c6a
movl $0x0, (%rbx)
movl $0x4, %ebp
movq 0x10(%rsp), %r14
jmp 0x4cc1
movl $0x2, %ebp
movq 0x18(%rsp), %rax
movq (%rax), %rax
decq %r12
movzbl 0x1(%r12), %ecx
incq %r12
cmpl $0x5f, %ecx
je 0x4c81
movzwl (%rax,%rcx,2), %ecx
andl $0x8, %ecx
jne 0x4c81
movq %r12, %rdi
callq 0x3fff
movq %rax, 0x8(%rsp)
cmpb $0x28, %r13b
jne 0x4cc1
movq %rax, %rcx
incq %rcx
movq %rcx, 0x8(%rsp)
movl $0x16, %r13d
cmpb $0x29, (%rax)
jne 0x4ce6
movb $0x0, 0x17798(%rip)     # 0x1c460
movq 0x8(%rsp), %rax
movq %rax, (%r14)
movl (%rbx), %edx
leaq 0x17c0(%rip), %rdi      # 0x6499
movq %r15, %rsi
xorl %eax, %eax
callq 0x3f0b
movl %ebp, %r13d
movl %r13d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq