// File: /workspace/github_c_makefile_star2_O2/lucvoo[P]sparse-dev/builtin.c
// Function: eval_atomic_common
static int eval_atomic_common(struct expression *expr)
{
	struct symbol *fntype = expr->fn->ctype->ctype.base_type;
	struct symbol_list *types = NULL;
	struct symbol *ctype = NULL;
	struct symbol *t;
	struct expression *arg;
	int n = 0;

	// The number of arguments has already be verified.
	// The first arg must be a pointer to an integral type.
	PREPARE_PTR_LIST(fntype->arguments, t);
	FOR_EACH_PTR(expr->args, arg) {
		struct symbol *ptrtype = NULL;

		if (++n == 1) {
			t = arg->ctype;
			if (!t)
				return 0;
			if (t->type == SYM_NODE)
				t = t->ctype.base_type;
			if (!t)
				return 0;
			if (t->type != SYM_PTR)
				goto err;
			ptrtype = t;
			t = t->ctype.base_type;
			if (!t)
				return 0;
			if (t->type == SYM_NODE)
				t = t->ctype.base_type;
			if (!t)
				return 0;
			if (t->type != SYM_PTR && t->ctype.base_type != &int_type)
				goto err;
			ctype = t;
			t = ptrtype;
		} else if (is_dynamic_type(t)) {
			t = ctype;
		} else if (t == &ptr_ctype) {
			t = ptrtype;
		}
		add_ptr_list(&types, t);
		NEXT_PTR_LIST(t);
	} END_FOR_EACH_PTR(arg);
	FINISH_PTR_LIST(t);

	if (!expr->ctype)	// set the return type, if needed
		expr->ctype = ctype;
	return evaluate_arguments(types, expr->args);

err:
	sparse_error(arg->pos, "invalid type for argument %d:", n);
	info(arg->pos, "        %s", show_typename(arg->ctype));
	expr->ctype = &bad_ctype;
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq 0x20(%rdi), %rax
movq 0x10(%rax), %rax
movq 0x60(%rax), %rax
andq $0x0, 0x18(%rsp)
movq 0x88(%rax), %r12
testq %r12, %r12
je 0x2b351
movq %r12, %r13
cmpb $0x0, (%r13)
jg 0x2b35a
movq 0x10(%r13), %r13
cmpq %r12, %r13
jne 0x2b33d
xorl %eax, %eax
jmp 0x2b356
xorl %eax, %eax
xorl %r13d, %r13d
xorl %ebx, %ebx
jmp 0x2b365
movq 0x18(%r13), %rax
andq $-0x4, %rax
pushq $0x1
popq %rbx
movq %rdi, 0x8(%rsp)
movq 0x28(%rdi), %rcx
xorl %esi, %esi
testq %rcx, %rcx
je 0x2b4c7
movq %rcx, %rdi
movq $0x0, (%rsp)
movq %rcx, 0x20(%rsp)
xorl %ebp, %ebp
movq %rdi, 0x10(%rsp)
movl (%rdi), %ecx
movsbq %cl, %rdx
cmpq %rdx, %rbp
jge 0x2b4b3
movq 0x18(%rdi,%rbp,8), %r14
cmpw $0x100, %cx             # imm = 0x100
jb 0x2b3b4
testq %r14, %r14
je 0x2b4ab
testl %esi, %esi
je 0x2b3e4
cmpb $0x3, (%rax)
movq %rax, %rcx
jne 0x2b3c4
movq 0x60(%rax), %rcx
cmpq 0x2eb75(%rip), %rcx     # 0x59f40
je 0x2b456
cmpq 0x2eba0(%rip), %rax     # 0x59f78
movl $0x0, %r15d
cmovneq %rax, %r15
jmp 0x2b45a
movq 0x10(%r14), %r15
xorl %eax, %eax
testq %r15, %r15
je 0x2b538
movzbl (%r15), %ecx
cmpl $0x3, %ecx
jne 0x2b40d
movq 0x60(%r15), %r15
testq %r15, %r15
je 0x2b538
movzbl (%r15), %ecx
cmpl $0x4, %ecx
jne 0x2b4f3
movq 0x60(%r15), %rcx
testq %rcx, %rcx
je 0x2b538
movzbl (%rcx), %edx
cmpl $0x3, %edx
jne 0x2b43b
movq 0x60(%rcx), %rcx
testq %rcx, %rcx
je 0x2b538
movzbl (%rcx), %edx
cmpl $0x4, %edx
movq %rcx, (%rsp)
je 0x2b45a
leaq 0x39a2d(%rip), %rax     # 0x64e78
cmpq %rax, 0x60(%rcx)
je 0x2b45a
jmp 0x2b4f3
movq (%rsp), %r15
incl %esi
movq %rsi, %r14
leaq 0x18(%rsp), %rdi
movq %r15, %rsi
callq 0x1fae9
testq %r15, %r15
je 0x2b491
movq %r14, %rsi
movq 0x10(%rsp), %rdi
movsbl (%r13), %eax
cmpl %eax, %ebx
jl 0x2b49d
movq 0x10(%r13), %r13
xorl %ebx, %ebx
cmpq %r12, %r13
jne 0x2b479
xorl %eax, %eax
jmp 0x2b4ab
xorl %eax, %eax
movq %r14, %rsi
movq 0x10(%rsp), %rdi
jmp 0x2b4ab
movslq %ebx, %rax
movq 0x18(%r13,%rax,8), %rax
andq $-0x4, %rax
incl %ebx
incq %rbp
jmp 0x2b390
movq 0x10(%rdi), %rdi
movq 0x20(%rsp), %rcx
cmpq %rcx, %rdi
jne 0x2b389
jmp 0x2b4cf
movq $0x0, (%rsp)
movq 0x8(%rsp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x2b4e3
movq (%rsp), %rcx
movq %rcx, 0x10(%rax)
movq 0x18(%rsp), %rdi
movq 0x28(%rax), %rsi
callq 0x2ce31
jmp 0x2b538
movq 0x8(%r14), %rdi
leaq 0x173b2(%rip), %rsi     # 0x428b0
pushq $0x1
popq %rdx
xorl %eax, %eax
callq 0x1120e
movq 0x10(%r14), %rdi
callq 0x20b5a
movq 0x8(%r14), %rdi
leaq 0x16516(%rip), %rsi     # 0x41a32
movq %rax, %rdx
xorl %eax, %eax
callq 0x10ddc
xorl %eax, %eax
leaq 0x3b389(%rip), %rdx     # 0x668b8
movq 0x8(%rsp), %rcx
movq %rdx, 0x10(%rcx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq