// File: /workspace/github_c_makefile_star2_O0/lucvoo[P]sparse-dev/builtin.c
// Function: evaluate_overflow_gen
static int evaluate_overflow_gen(struct expression *expr, int ptr)
{
	struct expression *arg;
	int n = 0;

	/* there will be exactly 3; we'd already verified that */
	FOR_EACH_PTR(expr->args, arg) {
		struct symbol *type;

		n++;
		if (!arg || !(type = arg->ctype))
			return 0;
		// 1st & 2nd args must be a basic integer type
		// 3rd arg must be a pointer to such a type.
		if (n == 3 && ptr) {
			if (type->type == SYM_NODE)
				type = type->ctype.base_type;
			if (!type)
				return 0;
			if (type->type != SYM_PTR)
				goto err;
			type = type->ctype.base_type;
			if (!type)
				return 0;
		}
		if (type->type == SYM_NODE)
			type = type->ctype.base_type;
		if (!type)
			return 0;
		if (type->ctype.base_type != &int_type || type == &bool_ctype)
			goto err;
	} END_FOR_EACH_PTR(arg);

	// the builtin returns a bool
	expr->ctype = &bool_ctype;
	return 1;

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
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x4861e
jmp 0x48788
jmp 0x48620
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x38(%rbp), %rcx
movw (%rcx), %cx
shlw $0x8, %cx
sarw $0x8, %cx
movswl %cx, %ecx
cmpl %ecx, %eax
jge 0x48770
movq -0x38(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq 0x18(%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
movq -0x38(%rbp), %rax
movw (%rax), %ax
sarw $0x8, %ax
cwtl
cmpl $0x0, %eax
je 0x48672
cmpq $0x0, -0x20(%rbp)
jne 0x48672
jmp 0x48762
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x48694
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, %rax
jne 0x486a0
movl $0x0, -0x4(%rbp)
jmp 0x487fd
cmpl $0x3, -0x24(%rbp)
jne 0x48711
cmpl $0x0, -0x14(%rbp)
je 0x48711
movq -0x50(%rbp), %rax
movl (%rax), %eax
andl $0xff, %eax
cmpl $0x3, %eax
jne 0x486c8
movq -0x50(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x486db
movl $0x0, -0x4(%rbp)
jmp 0x487fd
movq -0x50(%rbp), %rax
movl (%rax), %eax
andl $0xff, %eax
cmpl $0x4, %eax
je 0x486f0
jmp 0x487a0
movq -0x50(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x4870f
movl $0x0, -0x4(%rbp)
jmp 0x487fd
jmp 0x48711
movq -0x50(%rbp), %rax
movl (%rax), %eax
andl $0xff, %eax
cmpl $0x3, %eax
jne 0x4872d
movq -0x50(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x48740
movl $0x0, -0x4(%rbp)
jmp 0x487fd
movq -0x50(%rbp), %rax
leaq 0x48b0d(%rip), %rcx     # 0x91258
cmpq %rcx, 0x60(%rax)
jne 0x4875e
leaq 0x48cc0(%rip), %rax     # 0x91418
cmpq %rax, -0x50(%rbp)
jne 0x48760
jmp 0x487a0
jmp 0x48762
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x48627
jmp 0x48772
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq -0x30(%rbp), %rax
jne 0x48620
movq -0x10(%rbp), %rax
leaq 0x48c85(%rip), %rcx     # 0x91418
movq %rcx, 0x10(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x487fd
movq -0x20(%rbp), %rax
movl -0x24(%rbp), %edx
movq 0x8(%rax), %rdi
leaq 0x22b2a(%rip), %rsi     # 0x6b2dc
movb $0x0, %al
callq 0x16f90
movq -0x20(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x33340
movq %rax, %rdx
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x21c7e(%rip), %rsi     # 0x6a45e
movb $0x0, %al
callq 0x16c10
movq -0x10(%rbp), %rax
leaq 0x4a4a6(%rip), %rcx     # 0x92c98
movq %rcx, 0x10(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)