// File: /workspace/github_c_makefile_star2_O0/intel[P]pf-bb-config/config_app.c
// Function: configure_device
static int
configure_device(hw_device *device)
{

	if ((device->ops.open) && (device->ops.open(device))) {
		LOG(ERR, "device(%s) open failed", device->device_name);
		return -1;
	}

	/* Get BAR0 Mapping for device */
	if (device->ops.get_bar0_addr) {
		device->bar0Addr = device->ops.get_bar0_addr(device->pci_address,
				device->bar_size, device);
		if (device->bar0Addr == NULL)
			return -1;
	} else
		return -1;

	/* Call device specific configuration function */
	if (device->ops.conf(device, device->bar0Addr, device->config_file,
			BB_ACC_FIRST_CFG) == 0) {
		LOG(INFO, "%s PF [%s] configuration complete!",
				device->device_name, device->pci_address);
	} else {
		LOG(ERR, "%s PF [%s] configuration failed!",
				device->device_name, device->pci_address);
		return -1;
	}

	/* enable intr if supported, applicable only in case of vfio */
	if ((device->ops.enable_intr) && (device->ops.enable_intr(device))) {
		LOG(ERR, "Enable interrupts failed");
		return -1;
	}

	bb_acc_set_all_device_status(device, RTE_BBDEV_DEV_CONFIGURED);

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0xe421
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
cmpl $0x0, %eax
je 0xe421
callq 0xe9a0
movq %rax, %rcx
leaq 0x2d4d7(%rip), %rax     # 0x3b8d0
movq (%rax), %r8
movq -0x10(%rbp), %rax
movq (%rax), %r9
xorl %esi, %esi
leaq 0x15226(%rip), %rdx     # 0x23632
movl %esi, %edi
movb $0x0, %al
callq 0x216e0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xe5bc
movq -0x10(%rbp), %rax
cmpq $0x0, 0x78(%rax)
je 0xe476
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
movq -0x10(%rbp), %rdi
addq $0x20, %rdi
movq -0x10(%rbp), %rcx
movl 0xb8(%rcx), %esi
movq -0x10(%rbp), %rdx
callq *%rax
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0xb0(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0xb0(%rax)
jne 0xe474
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xe5bc
jmp 0xe482
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xe5bc
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rcx
movq 0xb0(%rcx), %rsi
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rdx
movl $0x1, %ecx
callq *%rax
cmpl $0x0, %eax
jne 0xe4ea
callq 0xe9a0
movq %rax, %rcx
leaq 0x2d414(%rip), %rax     # 0x3b8d0
movq 0x10(%rax), %r8
movq -0x10(%rbp), %rax
movq (%rax), %r9
movq -0x10(%rbp), %rax
addq $0x20, %rax
movl $0x2, %edi
xorl %esi, %esi
leaq 0x15173(%rip), %rdx     # 0x23650
movq %rax, (%rsp)
movb $0x0, %al
callq 0x216e0
jmp 0xe52d
callq 0xe9a0
movq %rax, %rcx
leaq 0x2d3d7(%rip), %rax     # 0x3b8d0
movq (%rax), %r8
movq -0x10(%rbp), %rax
movq (%rax), %r9
movq -0x10(%rbp), %rax
addq $0x20, %rax
xorl %esi, %esi
leaq 0x15166(%rip), %rdx     # 0x2367a
movl %esi, %edi
movq %rax, (%rsp)
movb $0x0, %al
callq 0x216e0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xe5bc
movq -0x10(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0xe578
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
cmpl $0x0, %eax
je 0xe578
callq 0xe9a0
movq %rax, %rcx
leaq 0x2d376(%rip), %rax     # 0x3b8d0
movq (%rax), %r8
xorl %esi, %esi
leaq 0x1513c(%rip), %rdx     # 0x236a2
movl %esi, %edi
movb $0x0, %al
callq 0x216e0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xe5bc
movq -0x10(%rbp), %rdi
movl $0x3, %esi
callq 0x21ff0
callq 0xe9a0
movq %rax, %rcx
leaq 0x2d33b(%rip), %rax     # 0x3b8d0
movq 0x18(%rax), %r8
movl $0x3, %edi
xorl %esi, %esi
leaq 0x1511b(%rip), %rdx     # 0x236c2
leaq 0x15126(%rip), %r9      # 0x236d4
movb $0x0, %al
callq 0x216e0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)