// File: /workspace/github_c_makefile_star2_O0/intel[P]pf-bb-config/config_app.c
// Function: set_device
int set_device(hw_device *device)
{
	if (strcasecmp(device->device_name, "acc100") == 0) {
		device->vendor_id = ACC100_VENDOR_ID;
		device->device_id = ACC100_DEVICE_ID;
		device->ops.conf  = acc100_configure;
		device->ops.device_data  = acc100_device_data;
		device->bar_size = 0x1000000;

		if (device->vfio_mode) {
			device->ops.open = vfio_device_open;
			device->ops.get_bar0_addr = vfio_get_bar0_mapping;
		} else {
			device->ops.get_bar0_addr = uio_get_bar0_mapping;
		}

		if (device->config_file == NULL) {
			device->config_file =
					"acc100/acc100_config_2vf_4g5g.cfg";
		}
		return 0;
	}

	if ((strcasecmp(device->device_name, "acc200") == 0) ||
			(strcasecmp(device->device_name, "vrb1") == 0)) {
		if (strcasecmp(device->device_name, "acc200") == 0)
			printf("Warning: ACC200 was renamed as VRB1, please use VRB1 instead.\n");
		device->vendor_id = VRB1_VENDOR_ID;
		device->device_id = VRB1_DEVICE_ID;
		device->ops.conf = vrb1_configure;
		device->ops.device_data  = vrb1_device_data;
		device->bar_size = 0x1000000;
		if (device->vfio_mode) {
			device->ops.open = vfio_device_open;
			device->ops.flr = vfio_device_reset;
			device->ops.cluster_reset = vrb1_cluster_reset;
			device->ops.enable_intr = vfio_enable_intr;
			device->ops.disable_intr = vfio_disable_intr;
			device->ops.dev_enable_intr = vrb1_enable_intr;
			device->ops.dev_disable_intr = vrb1_disable_intr;
			device->ops.get_bar0_addr = vfio_get_bar0_mapping;
			device->ops.dev_isr = vrb1_irq_handler;
			device->vfio_int_mode = VFIO_PCI_MSI_IRQ_INDEX;
			device->auto_reconfig_on_fatal_error = DEVICE_RESET_AUTO_RECONFIG;
			device->device_reset_using_flr = DEVICE_RESET_USING_CLUSTER;
			device->info_ring_total_size = BB_ACC_INFO_RING_SIZE;
		} else {
			device->ops.get_bar0_addr = uio_get_bar0_mapping;
		}
		if (device->config_file == NULL)
			device->config_file = "vrb1/vrb1_config.cfg";
		if (device->fft_lut_filename == NULL)
			device->fft_lut_filename = "./vrb1/srs_fft_windows_coefficient.bin";
		return 0;
	}

	if (strcasecmp(device->device_name, "vrb2") == 0) {
		device->vendor_id = VRB2_VENDOR_ID;
		device->device_id = VRB2_DEVICE_ID;
		device->ops.conf = vrb2_configure;
		device->ops.device_data  = vrb2_device_data;
		device->bar_size = 0x1000000;

		if (device->vfio_mode) {
			device->ops.open = vfio_device_open;
			device->ops.flr = vfio_device_reset;
			device->ops.cluster_reset = vrb2_cluster_reset;
			device->ops.enable_intr = vfio_enable_intr;
			device->ops.disable_intr = vfio_disable_intr;
			device->ops.dev_enable_intr = vrb2_enable_intr;
			device->ops.dev_disable_intr = vrb2_disable_intr;
			device->ops.get_bar0_addr = vfio_get_bar0_mapping;
			device->ops.dev_isr = vrb2_irq_handler;
			device->vfio_int_mode = VFIO_PCI_MSI_IRQ_INDEX;
			device->auto_reconfig_on_fatal_error = DEVICE_RESET_AUTO_RECONFIG;
			device->device_reset_using_flr = DEVICE_RESET_USING_CLUSTER;
			device->info_ring_total_size = BB_ACC_INFO_RING_SIZE;
		} else {
			device->ops.get_bar0_addr = uio_get_bar0_mapping;
		}

		if (device->config_file == NULL)
			device->config_file = "vrb2/vrb2_config_vf.cfg";
		if (device->fft_lut_filename == NULL)
			device->fft_lut_filename = "./vrb2/srs_fft_windows_coefficient.bin";
		return 0;
	}

	if (strcasecmp(device->device_name, "fpga_lte") == 0) {
		device->vendor_id = FPGA_LTE_FEC_VENDOR_ID;
		device->device_id = FPGA_LTE_FEC_DEVICE_ID;
		device->ops.conf = fpga_lte_configure;
		device->bar_size = 0x1000;

		if (device->vfio_mode) {
			device->ops.open = vfio_device_open;
			device->ops.get_bar0_addr = vfio_get_bar0_mapping;
		} else {
			device->ops.get_bar0_addr = uio_get_bar0_mapping;
		}

		if (device->config_file == NULL) {
			device->config_file = "fpga_lte/fpga_lte_config.cfg";
		}
		return 0;
	}

	if (strcasecmp(device->device_name, "fpga_5gnr") == 0) {
		device->vendor_id = FPGA_5GNR_FEC_VENDOR_ID;
		device->device_id = FPGA_5GNR_FEC_DEVICE_ID;
		device->ops.conf = fpga_5gnr_configure;
		device->bar_size = 0x1000;

		if (device->vfio_mode) {
			device->ops.open = vfio_device_open;
			device->ops.get_bar0_addr = vfio_get_bar0_mapping;
		} else {
			device->ops.get_bar0_addr = uio_get_bar0_mapping;
		}

		if (device->config_file == NULL) {
			device->config_file =
					"fpga_5gnr/fpga_5gnr_config.cfg";
		}
		return 0;
	}

	if (strcasecmp(device->device_name, "agx100") == 0) {
		device->vendor_id = AGX100_VENDOR_ID;
		device->device_id = AGX100_DEVICE_ID;
		device->ops.conf = agx100_configure;
		device->bar_size = 0x1000;

		if (device->vfio_mode) {
			device->ops.open = vfio_device_open;
			device->ops.get_bar0_addr = vfio_get_bar0_mapping;
		} else {
			device->ops.get_bar0_addr = uio_get_bar0_mapping;
		}

		if (device->config_file == NULL) {
			device->config_file =
					"agx100/agx100_config_1vf.cfg";
		}
		return 0;
	}
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x15aca(%rip), %rsi     # 0x23054
callq 0xd050
cmpl $0x0, %eax
jne 0xd63f
movq -0x10(%rbp), %rax
movl $0x8086, 0x18(%rax)     # imm = 0x8086
movq -0x10(%rbp), %rax
movl $0xd5c, 0x1c(%rax)      # imm = 0xD5C
movq -0x10(%rbp), %rax
leaq 0x16c7(%rip), %rcx      # 0xec80
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rax
leaq 0x2fe8(%rip), %rcx      # 0x105b0
movq %rcx, 0x88(%rax)
movq -0x10(%rbp), %rax
movl $0x1000000, 0xb8(%rax)  # imm = 0x1000000
movq -0x10(%rbp), %rax
cmpl $0x0, 0xbc(%rax)
je 0xd60a
movq -0x10(%rbp), %rax
leaq 0x1204b(%rip), %rcx     # 0x1f640
movq %rcx, 0x30(%rax)
movq -0x10(%rbp), %rax
leaq 0x127dc(%rip), %rcx     # 0x1fde0
movq %rcx, 0x78(%rax)
jmp 0xd619
movq -0x10(%rbp), %rax
leaq 0x59b(%rip), %rcx       # 0xdbb0
movq %rcx, 0x78(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0xd633
movq -0x10(%rbp), %rax
leaq 0x15a2c(%rip), %rcx     # 0x2305b
movq %rcx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
jmp 0xdb9a
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x15a30(%rip), %rsi     # 0x2307d
callq 0xd050
cmpl $0x0, %eax
je 0xd673
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x15a1f(%rip), %rsi     # 0x23084
callq 0xd050
cmpl $0x0, %eax
jne 0xd800
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x159fc(%rip), %rsi     # 0x2307d
callq 0xd050
cmpl $0x0, %eax
jne 0xd699
leaq 0x159f7(%rip), %rdi     # 0x23089
movb $0x0, %al
callq 0xd140
movq -0x10(%rbp), %rax
movl $0x8086, 0x18(%rax)     # imm = 0x8086
movq -0x10(%rbp), %rax
movl $0x57c0, 0x1c(%rax)     # imm = 0x57C0
movq -0x10(%rbp), %rax
leaq 0x7286(%rip), %rcx      # 0x14940
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rax
leaq 0x8637(%rip), %rcx      # 0x15d00
movq %rcx, 0x88(%rax)
movq -0x10(%rbp), %rax
movl $0x1000000, 0xb8(%rax)  # imm = 0x1000000
movq -0x10(%rbp), %rax
cmpl $0x0, 0xbc(%rax)
je 0xd7b1
movq -0x10(%rbp), %rax
leaq 0x11f46(%rip), %rcx     # 0x1f640
movq %rcx, 0x30(%rax)
movq -0x10(%rbp), %rax
leaq 0x11217(%rip), %rcx     # 0x1e920
movq %rcx, 0x68(%rax)
movq -0x10(%rbp), %rax
leaq 0x6b28(%rip), %rcx      # 0x14240
movq %rcx, 0x70(%rax)
movq -0x10(%rbp), %rax
leaq 0x112d9(%rip), %rcx     # 0x1ea00
movq %rcx, 0x40(%rax)
movq -0x10(%rbp), %rax
leaq 0x119fa(%rip), %rcx     # 0x1f130
movq %rcx, 0x48(%rax)
movq -0x10(%rbp), %rax
leaq 0x6dbb(%rip), %rcx      # 0x14500
movq %rcx, 0x50(%rax)
movq -0x10(%rbp), %rax
leaq 0x707c(%rip), %rcx      # 0x147d0
movq %rcx, 0x58(%rax)
movq -0x10(%rbp), %rax
leaq 0x1267d(%rip), %rcx     # 0x1fde0
movq %rcx, 0x78(%rax)
movq -0x10(%rbp), %rax
leaq 0x5d0e(%rip), %rcx      # 0x13480
movq %rcx, 0x60(%rax)
movq -0x10(%rbp), %rax
movl $0x1, 0xc8(%rax)
movq -0x10(%rbp), %rax
movl $0x1, 0x4f0(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x4f4(%rax)
movq -0x10(%rbp), %rax
movq $0x1000, 0xa0(%rax) # imm = 0x1000
jmp 0xd7c0
movq -0x10(%rbp), %rax
leaq 0x3f4(%rip), %rcx       # 0xdbb0
movq %rcx, 0x78(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0xd7da
movq -0x10(%rbp), %rax
leaq 0x158f2(%rip), %rcx     # 0x230c8
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0xd7f4
movq -0x10(%rbp), %rax
leaq 0x158ed(%rip), %rcx     # 0x230dd
movq %rcx, 0x10(%rax)
movl $0x0, -0x4(%rbp)
jmp 0xdb9a
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x158f6(%rip), %rsi     # 0x23104
callq 0xd050
cmpl $0x0, %eax
jne 0xd983
movq -0x10(%rbp), %rax
movl $0x8086, 0x18(%rax)     # imm = 0x8086
movq -0x10(%rbp), %rax
movl $0x57c2, 0x1c(%rax)     # imm = 0x57C2
movq -0x10(%rbp), %rax
leaq 0xc573(%rip), %rcx      # 0x19db0
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rax
leaq 0xdd54(%rip), %rcx      # 0x1b5a0
movq %rcx, 0x88(%rax)
movq -0x10(%rbp), %rax
movl $0x1000000, 0xb8(%rax)  # imm = 0x1000000
movq -0x10(%rbp), %rax
cmpl $0x0, 0xbc(%rax)
je 0xd934
movq -0x10(%rbp), %rax
leaq 0x11dc3(%rip), %rcx     # 0x1f640
movq %rcx, 0x30(%rax)
movq -0x10(%rbp), %rax
leaq 0x11094(%rip), %rcx     # 0x1e920
movq %rcx, 0x68(%rax)
movq -0x10(%rbp), %rax
leaq 0xbdb5(%rip), %rcx      # 0x19650
movq %rcx, 0x70(%rax)
movq -0x10(%rbp), %rax
leaq 0x11156(%rip), %rcx     # 0x1ea00
movq %rcx, 0x40(%rax)
movq -0x10(%rbp), %rax
leaq 0x11877(%rip), %rcx     # 0x1f130
movq %rcx, 0x48(%rax)
movq -0x10(%rbp), %rax
leaq 0xc008(%rip), %rcx      # 0x198d0
movq %rcx, 0x50(%rax)
movq -0x10(%rbp), %rax
leaq 0xc369(%rip), %rcx      # 0x19c40
movq %rcx, 0x58(%rax)
movq -0x10(%rbp), %rax
leaq 0x124fa(%rip), %rcx     # 0x1fde0
movq %rcx, 0x78(%rax)
movq -0x10(%rbp), %rax
leaq 0xa7ab(%rip), %rcx      # 0x180a0
movq %rcx, 0x60(%rax)
movq -0x10(%rbp), %rax
movl $0x1, 0xc8(%rax)
movq -0x10(%rbp), %rax
movl $0x1, 0x4f0(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x4f4(%rax)
movq -0x10(%rbp), %rax
movq $0x1000, 0xa0(%rax) # imm = 0x1000
jmp 0xd943
movq -0x10(%rbp), %rax
leaq 0x271(%rip), %rcx       # 0xdbb0
movq %rcx, 0x78(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0xd95d
movq -0x10(%rbp), %rax
leaq 0x157b0(%rip), %rcx     # 0x23109
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0xd977
movq -0x10(%rbp), %rax
leaq 0x157ae(%rip), %rcx     # 0x23121
movq %rcx, 0x10(%rax)
movl $0x0, -0x4(%rbp)
jmp 0xdb9a
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x157b7(%rip), %rsi     # 0x23148
callq 0xd050
cmpl $0x0, %eax
jne 0xda34
movq -0x10(%rbp), %rax
movl $0x1172, 0x18(%rax)     # imm = 0x1172
movq -0x10(%rbp), %rax
movl $0x5052, 0x1c(%rax)     # imm = 0x5052
movq -0x10(%rbp), %rax
leaq 0x40c0(%rip), %rcx      # 0x11a80
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rax
movl $0x1000, 0xb8(%rax)     # imm = 0x1000
movq -0x10(%rbp), %rax
cmpl $0x0, 0xbc(%rax)
je 0xd9ff
movq -0x10(%rbp), %rax
leaq 0x11c56(%rip), %rcx     # 0x1f640
movq %rcx, 0x30(%rax)
movq -0x10(%rbp), %rax
leaq 0x123e7(%rip), %rcx     # 0x1fde0
movq %rcx, 0x78(%rax)
jmp 0xda0e
movq -0x10(%rbp), %rax
leaq 0x1a6(%rip), %rcx       # 0xdbb0
movq %rcx, 0x78(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0xda28
movq -0x10(%rbp), %rax
leaq 0x1572d(%rip), %rcx     # 0x23151
movq %rcx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
jmp 0xdb9a
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x1572c(%rip), %rsi     # 0x2316e
callq 0xd050
cmpl $0x0, %eax
jne 0xdae5
movq -0x10(%rbp), %rax
movl $0x8086, 0x18(%rax)     # imm = 0x8086
movq -0x10(%rbp), %rax
movl $0xd8f, 0x1c(%rax)      # imm = 0xD8F
movq -0x10(%rbp), %rax
leaq 0x4d9f(%rip), %rcx      # 0x12810
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rax
movl $0x1000, 0xb8(%rax)     # imm = 0x1000
movq -0x10(%rbp), %rax
cmpl $0x0, 0xbc(%rax)
je 0xdab0
movq -0x10(%rbp), %rax
leaq 0x11ba5(%rip), %rcx     # 0x1f640
movq %rcx, 0x30(%rax)
movq -0x10(%rbp), %rax
leaq 0x12336(%rip), %rcx     # 0x1fde0
movq %rcx, 0x78(%rax)
jmp 0xdabf
movq -0x10(%rbp), %rax
leaq 0xf5(%rip), %rcx        # 0xdbb0
movq %rcx, 0x78(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0xdad9
movq -0x10(%rbp), %rax
leaq 0x156a3(%rip), %rcx     # 0x23178
movq %rcx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
jmp 0xdb9a
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x156a4(%rip), %rsi     # 0x23197
callq 0xd050
cmpl $0x0, %eax
jne 0xdb93
movq -0x10(%rbp), %rax
movl $0x8086, 0x18(%rax)     # imm = 0x8086
movq -0x10(%rbp), %rax
movl $0x5799, 0x1c(%rax)     # imm = 0x5799
movq -0x10(%rbp), %rax
leaq 0x100de(%rip), %rcx     # 0x1dc00
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rax
movl $0x1000, 0xb8(%rax)     # imm = 0x1000
movq -0x10(%rbp), %rax
cmpl $0x0, 0xbc(%rax)
je 0xdb61
movq -0x10(%rbp), %rax
leaq 0x11af4(%rip), %rcx     # 0x1f640
movq %rcx, 0x30(%rax)
movq -0x10(%rbp), %rax
leaq 0x12285(%rip), %rcx     # 0x1fde0
movq %rcx, 0x78(%rax)
jmp 0xdb70
movq -0x10(%rbp), %rax
leaq 0x44(%rip), %rcx        # 0xdbb0
movq %rcx, 0x78(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0xdb8a
movq -0x10(%rbp), %rax
leaq 0x15618(%rip), %rcx     # 0x2319e
movq %rcx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
jmp 0xdb9a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)