// File: /workspace/github_c_makefile_star2_O2/intel[P]pf-bb-config/bb_acc_vfio.c
// Function: vfio_disable_intr
int vfio_disable_intr(void *dev)
{
	hw_device *hwd = (hw_device *)dev;

	LOG(DEBUG, "VFIO disable interrupts");

	if (!hwd->vfio_mode)
		return 0;

	switch (hwd->vfio_int_mode) {
	case VFIO_PCI_MSI_IRQ_INDEX:
		if ((hwd->ops.dev_disable_intr) && (hwd->ops.dev_disable_intr(hwd))) {
			LOG(ERR, "vfio enable %s device intr failed", hwd->device_name);
			return -1;
		}

		if (vfio_disable_msi(hwd))
			LOG(ERR, "vfio disable MSI intr failed");

		/* deregister isr callback for intr event */
		event_del_fd(hwd->irq_event_fd);
		close(hwd->irq_event_fd);
		hwd->irq_event_fd = 0;
		break;

	case VFIO_PCI_INTX_IRQ_INDEX:
	case VFIO_PCI_MSIX_IRQ_INDEX:
	case VFIO_PCI_ERR_IRQ_INDEX:
	default:
		LOG(INFO, "Not supported irq index (%d)", hwd->vfio_int_mode);
		break;
	}

	LOG(DEBUG, "Done");
	return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
callq 0x18754
leaq 0x1d27a(%rip), %r14     # 0x34ed0
movq 0x18(%r14), %r8
leaq 0x5ee6(%rip), %rdx      # 0x1db47
leaq 0x5f04(%rip), %r9       # 0x1db6c
xorl %ebp, %ebp
pushq $0x3
popq %rdi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
cmpl $0x0, 0xbc(%rbx)
je 0x17e26
cmpl $0x1, 0xc8(%rbx)
jne 0x17cc9
movq 0x58(%rbx), %rax
testq %rax, %rax
je 0x17cf4
movq %rbx, %rdi
callq *%rax
testl %eax, %eax
je 0x17cf4
callq 0x18754
movq (%r14), %r8
movq (%rbx), %r9
leaq 0x5e47(%rip), %rdx      # 0x1dafa
xorl %edi, %edi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
pushq $-0x1
popq %rbp
jmp 0x17e26
callq 0x18754
movq 0x10(%r14), %r8
movl 0xc8(%rbx), %r9d
leaq 0x5e43(%rip), %rdx      # 0x1db23
pushq $0x2
popq %rdi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
jmp 0x17dfe
callq 0x18754
movq 0x18(%r14), %r8
leaq 0x6446(%rip), %rdx      # 0x1e14a
leaq 0x6469(%rip), %r9       # 0x1e174
pushq $0x3
popq %rdi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
cmpl $0x0, 0xc4(%rbx)
je 0x17de1
callq 0x18754
movq 0x18(%r14), %r8
movl 0xc4(%rbx), %ecx
movl %ecx, (%rsp)
leaq 0x6314(%rip), %rdx      # 0x1e054
leaq 0x642d(%rip), %r9       # 0x1e174
pushq $0x3
popq %rdi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
movaps 0x5c73(%rip), %xmm0     # 0x1d9d0
leaq 0x10(%rsp), %rdx
movaps %xmm0, (%rdx)
movl $0x1, 0x10(%rdx)
movl 0xc0(%rbx), %edi
movl $0x3b6e, %esi           # imm = 0x3B6E
xorl %eax, %eax
callq 0xd1a0
movl %eax, %ebp
callq 0x18754
testl %ebp, %ebp
je 0x17dc0
movq (%r14), %r8
leaq 0x63f2(%rip), %rdx      # 0x1e185
xorl %edi, %edi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
callq 0x18754
movq (%r14), %r8
leaq 0x5dce(%rip), %rdx      # 0x1db7e
xorl %edi, %edi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
jmp 0x17de1
movq 0x18(%r14), %r8
leaq 0x63e2(%rip), %rdx      # 0x1e1ad
leaq 0x63a2(%rip), %r9       # 0x1e174
pushq $0x3
popq %rdi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
movl 0xc4(%rbx), %edi
callq 0x18da6
movl 0xc4(%rbx), %edi
callq 0xd1b0
andl $0x0, 0xc4(%rbx)
callq 0x18754
movq 0x18(%r14), %r8
leaq 0x3716(%rip), %rdx      # 0x1b524
leaq 0x5d57(%rip), %r9       # 0x1db6c
xorl %ebp, %ebp
pushq $0x3
popq %rdi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
callq 0x19400
movl %ebp, %eax
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
retq