// File: /workspace/github_c_makefile_star2_O1/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
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %r14
leaq 0xda77(%rip), %rsi      # 0x1b004
movq %r14, %rdi
callq 0xd060
testl %eax, %eax
je 0xd677
leaq 0xda89(%rip), %rsi      # 0x1b02d
movq %r14, %rdi
callq 0xd060
testl %eax, %eax
je 0xd6d0
movl %eax, %ebp
leaq 0xda77(%rip), %rsi      # 0x1b034
movq %r14, %rdi
callq 0xd060
testl %eax, %eax
je 0xd6cc
leaq 0xdaa1(%rip), %rsi      # 0x1b075
movq %r14, %rdi
callq 0xd060
testl %eax, %eax
je 0xd801
leaq 0xdace(%rip), %rsi      # 0x1b0b9
movq %r14, %rdi
callq 0xd060
testl %eax, %eax
je 0xd8c7
leaq 0xdadd(%rip), %rsi      # 0x1b0df
movq %r14, %rdi
callq 0xd060
testl %eax, %eax
je 0xd90b
leaq 0xdaef(%rip), %rsi      # 0x1b108
movq %r14, %rdi
callq 0xd060
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0xd9d1
movabsq $0x579900008086, %rax   # imm = 0x579900008086
movq %rax, 0x18(%rbx)
leaq 0xa0e7(%rip), %rax      # 0x1772c
movq %rax, 0x38(%rbx)
movl $0x1000, 0xb8(%rbx)     # imm = 0x1000
cmpl $0x0, 0xbc(%rbx)
je 0xd9bd
leaq 0xb0e8(%rip), %rax      # 0x1874f
movq %rax, 0x30(%rbx)
leaq 0xb5d6(%rip), %rax      # 0x18c48
jmp 0xd9c4
movabsq $0xd5c00008086, %rax    # imm = 0xD5C00008086
movq %rax, 0x18(%rbx)
leaq 0xea6(%rip), %rax       # 0xe532
movq %rax, 0x38(%rbx)
leaq 0x1fb8(%rip), %rax      # 0xf64f
movq %rax, 0x88(%rbx)
movl $0x1000000, 0xb8(%rbx)  # imm = 0x1000000
cmpl $0x0, 0xbc(%rbx)
je 0xd7d9
leaq 0xb093(%rip), %rax      # 0x1874f
movq %rax, 0x30(%rbx)
leaq 0xb581(%rip), %rax      # 0x18c48
jmp 0xd7e0
testl %ebp, %ebp
jne 0xd6dc
leaq 0xde70(%rip), %rdi      # 0x1b547
callq 0xd0c0
movabsq $0x57c000008086, %rax   # imm = 0x57C000008086
movq %rax, 0x18(%rbx)
leaq 0x46c0(%rip), %rax      # 0x11db1
movq %rax, 0x38(%rbx)
leaq 0x51e4(%rip), %rax      # 0x128e0
movq %rax, 0x88(%rbx)
movl $0x1000000, 0xb8(%rbx)  # imm = 0x1000000
cmpl $0x0, 0xbc(%rbx)
je 0xd79f
leaq 0xb02e(%rip), %rax      # 0x1874f
movq %rax, 0x30(%rbx)
leaq 0xa6ff(%rip), %rax      # 0x17e2b
movq %rax, 0x68(%rbx)
leaq 0x4244(%rip), %rax      # 0x1197b
movq %rax, 0x70(%rbx)
leaq 0xa783(%rip), %rax      # 0x17ec5
movq %rax, 0x40(%rbx)
leaq 0xacba(%rip), %rax      # 0x18407
movq %rax, 0x48(%rbx)
leaq 0x438e(%rip), %rax      # 0x11ae6
movq %rax, 0x50(%rbx)
leaq 0x4529(%rip), %rax      # 0x11c8c
movq %rax, 0x58(%rbx)
leaq 0xb4da(%rip), %rax      # 0x18c48
movq %rax, 0x78(%rbx)
leaq 0x390b(%rip), %rax      # 0x11084
movq %rax, 0x60(%rbx)
movl $0x1, 0xc8(%rbx)
movq $0x1, 0x4f0(%rbx)
movq $0x1000, 0xa0(%rbx) # imm = 0x1000
jmp 0xd7aa
leaq 0x23c(%rip), %rax       # 0xd9e2
movq %rax, 0x78(%rbx)
cmpq $0x0, 0x8(%rbx)
jne 0xd7bc
leaq 0xd881(%rip), %rax      # 0x1b039
movq %rax, 0x8(%rbx)
xorl %eax, %eax
cmpq $0x0, 0x10(%rbx)
jne 0xd9d1
leaq 0xd87e(%rip), %rcx      # 0x1b04e
movq %rcx, 0x10(%rbx)
jmp 0xd9d1
leaq 0x202(%rip), %rax       # 0xd9e2
movq %rax, 0x78(%rbx)
xorl %eax, %eax
cmpq $0x0, 0x8(%rbx)
jne 0xd9d1
leaq 0xd813(%rip), %rcx      # 0x1b00b
movq %rcx, 0x8(%rbx)
jmp 0xd9d1
movabsq $0x57c200008086, %rax   # imm = 0x57C200008086
movq %rax, 0x18(%rbx)
leaq 0x78df(%rip), %rax      # 0x150f5
movq %rax, 0x38(%rbx)
leaq 0x89ea(%rip), %rax      # 0x1620b
movq %rax, 0x88(%rbx)
movl $0x1000000, 0xb8(%rbx)  # imm = 0x1000000
cmpl $0x0, 0xbc(%rbx)
je 0xd94b
leaq 0xaf09(%rip), %rax      # 0x1874f
movq %rax, 0x30(%rbx)
leaq 0xa5da(%rip), %rax      # 0x17e2b
movq %rax, 0x68(%rbx)
leaq 0x73b2(%rip), %rax      # 0x14c0e
movq %rax, 0x70(%rbx)
leaq 0xa65e(%rip), %rax      # 0x17ec5
movq %rax, 0x40(%rbx)
leaq 0xab95(%rip), %rax      # 0x18407
movq %rax, 0x48(%rbx)
leaq 0x7541(%rip), %rax      # 0x14dbe
movq %rax, 0x50(%rbx)
leaq 0x7778(%rip), %rax      # 0x15000
movq %rax, 0x58(%rbx)
leaq 0xb3b5(%rip), %rax      # 0x18c48
movq %rax, 0x78(%rbx)
leaq 0x63ca(%rip), %rax      # 0x13c68
movq %rax, 0x60(%rbx)
movl $0x1, 0xc8(%rbx)
movq $0x1, 0x4f0(%rbx)
movq $0x1000, 0xa0(%rbx) # imm = 0x1000
jmp 0xd956
movabsq $0x505200001172, %rax   # imm = 0x505200001172
movq %rax, 0x18(%rbx)
leaq 0x2a78(%rip), %rax      # 0x10354
movq %rax, 0x38(%rbx)
movl $0x1000, 0xb8(%rbx)     # imm = 0x1000
cmpl $0x0, 0xbc(%rbx)
je 0xd97d
leaq 0xae51(%rip), %rax      # 0x1874f
movq %rax, 0x30(%rbx)
leaq 0xb33f(%rip), %rax      # 0x18c48
jmp 0xd984
movabsq $0xd8f00008086, %rax    # imm = 0xD8F00008086
movq %rax, 0x18(%rbx)
leaq 0x3120(%rip), %rax      # 0x10a40
movq %rax, 0x38(%rbx)
movl $0x1000, 0xb8(%rbx)     # imm = 0x1000
cmpl $0x0, 0xbc(%rbx)
je 0xd99d
leaq 0xae11(%rip), %rax      # 0x1874f
movq %rax, 0x30(%rbx)
leaq 0xb2ff(%rip), %rax      # 0x18c48
jmp 0xd9a4
leaq 0x90(%rip), %rax        # 0xd9e2
movq %rax, 0x78(%rbx)
cmpq $0x0, 0x8(%rbx)
jne 0xd968
leaq 0xd716(%rip), %rax      # 0x1b07a
movq %rax, 0x8(%rbx)
xorl %eax, %eax
cmpq $0x0, 0x10(%rbx)
jne 0xd9d1
leaq 0xd71a(%rip), %rcx      # 0x1b092
jmp 0xd7d0
leaq 0x5e(%rip), %rax        # 0xd9e2
movq %rax, 0x78(%rbx)
xorl %eax, %eax
cmpq $0x0, 0x8(%rbx)
jne 0xd9d1
leaq 0xd72a(%rip), %rcx      # 0x1b0c2
jmp 0xd7f8
leaq 0x3e(%rip), %rax        # 0xd9e2
movq %rax, 0x78(%rbx)
xorl %eax, %eax
cmpq $0x0, 0x8(%rbx)
jne 0xd9d1
leaq 0xd731(%rip), %rcx      # 0x1b0e9
jmp 0xd7f8
leaq 0x1e(%rip), %rax        # 0xd9e2
movq %rax, 0x78(%rbx)
xorl %eax, %eax
cmpq $0x0, 0x8(%rbx)
je 0xd9d6
popq %rbx
popq %r14
popq %rbp
retq
leaq 0xd732(%rip), %rcx      # 0x1b10f
jmp 0xd7f8