// File: /workspace/github_c_makefile_star2_O0/intel[P]pf-bb-config/vrb2/vrb2_cfg_app.c
// Function: vrb2_irq_handler
int
vrb2_irq_handler(void *dev)
{
	hw_device *accel_pci_dev = (hw_device *)dev;
	uint32_t *info_ring = (uint32_t *) (accel_pci_dev->info_ring);
	uint32_t *ring_data = info_ring +
				(accel_pci_dev->info_ring_head & VRB2_INFO_RING_MASK);
	uint8_t *bar0addr = accel_pci_dev->bar0Addr;
	uint16_t curr_head, error_type, engine_idx;
	uint32_t int_nb, detailed_info, status;

	LOG(DEBUG, "info_ring_head: %d", accel_pci_dev->info_ring_head);
	LOG(DEBUG, "dev info ring virt:%p", info_ring);
	LOG(DEBUG, "dev ring data virt:%p", ring_data);

	if (!FIELD_GET(INFO_RING_VALID, *ring_data)) {
		/* read the info_ring_head from HW */
		curr_head = (vrb2_reg_read(bar0addr, HWPfHiInfoRingPointerRegPf)
				& VRB2_INFO_RING_PTR_MASK) / sizeof(uint32_t);
		if (curr_head != accel_pci_dev->info_ring_head) {
			accel_pci_dev->info_ring_head = curr_head;
			ring_data = info_ring + (accel_pci_dev->info_ring_head &
				VRB2_INFO_RING_MASK);
		}
		LOG(DEBUG, "No Information Ring available %d %d\n",
			curr_head, accel_pci_dev->info_ring_head);

		if (vrb2_device_error(dev, VRB2_ITR_UNDEFINED))
			return 0;

	}
	while (FIELD_GET(INFO_RING_VALID, *ring_data)) {
		int_nb = FIELD_GET(INFO_RING_INT_NB, *ring_data);
		if (int_nb >= 32) {
			LOG(INFO, "MSI: unexpected Event: %d  msi_0=%ld loop=%ld ",
				int_nb,
				FIELD_GET(INFO_RING_MSI_0, *ring_data),
				FIELD_GET(INFO_RING_LOOP, *ring_data));
			if (vrb2_device_error(dev, VRB2_ITR_UNDEFINED))
				return 0;
		} else if (irdata[int_nb].use_det_info) {
			switch (int_nb) {
			case VRB2_DOORBELL_VFTOPF:
				vrb2_pfvf(dev, FIELD_GET(INFO_RING_VF2PF, *ring_data),
						FIELD_GET(INFO_RING_DET_INFO, *ring_data));
				break;

			case VRB2_QMGR_AQ_OVERFLOW:
			case VRB2_QMGR_DISABLED_ACCESS:
			case VRB2_QMGR_AQ_OVER_THRESHOLD:
			case VRB2_4G_DMA_DL_DESC_IRQ:
			case VRB2_4G_DMA_UL_DESC_IRQ:
			case VRB2_FFT_DESC_IRQ:
			case VRB2_5G_DMA_DL_DESC_IRQ:
			case VRB2_5G_DMA_UL_DESC_IRQ:
			case VRB2_MLD_DESCRIPTOR_IRQ:
				/* These should not happen*/
				LOG(INFO,
					"Unexpected MSI: Event: %s aq_id = 0x%lx qg_id=0x%lx vf_id=0x%lx",
					irdata[int_nb].name,
					FIELD_GET(INFO_RING_DET_INFO_AQ_ID, *ring_data),
					FIELD_GET(INFO_RING_DET_INFO_QG_ID, *ring_data),
					FIELD_GET(INFO_RING_DET_INFO_VF_ID, *ring_data));
				if (vrb2_device_error(dev, int_nb))
					return 0;
				break;

			case VRB2_PAGE_FAULT_ATS_ERROR:
				LOG(INFO, "MSI: Event: %s err_type=%ld aq_id = 0x%lx "
					"qg_id=0x%lx vf_id=0x%lx",
					irdata[int_nb].name,
					FIELD_GET(INFO_RING_ERR_TYPE, *ring_data),
					FIELD_GET(INFO_RING_DET_INFO_AQ_ID, *ring_data),
					FIELD_GET(INFO_RING_DET_INFO_QG_ID, *ring_data),
					FIELD_GET(INFO_RING_DET_INFO_VF_ID, *ring_data));
				if (vrb2_device_error(dev, int_nb))
					return 0;
				break;

			case VRB2_PARITY_ERR:
				LOG(INFO, "MSI: Event: %s err_type=%ld Info = 0x%lx",
					irdata[int_nb].name,
					FIELD_GET(INFO_RING_ERR_TYPE, *ring_data),
					FIELD_GET(INFO_RING_DET_INFO, *ring_data));
				if (vrb2_device_error(dev, int_nb))
					return 0;
				break;

			case VRB2_QMGR_ERROR_DETECTED:
				error_type = FIELD_GET(INFO_RING_ERR_TYPE, *ring_data);
				if (error_type == 4)
					LOG(INFO,
						"MSI: Event: %s err_type =0x%lx AXI Time Out Info= 0x%lx",
						irdata[int_nb].name,
						FIELD_GET(INFO_RING_ERR_TYPE, *ring_data),
						FIELD_GET(INFO_RING_DET_INFO, *ring_data));
				else if (error_type == 5)
					LOG(INFO,
						"MSI: Event: %s err_type =0x%lx ARAM Time Out Info= 0x%lx",
						irdata[int_nb].name,
						FIELD_GET(INFO_RING_ERR_TYPE, *ring_data),
						FIELD_GET(INFO_RING_DET_INFO, *ring_data));
				else
					LOG(INFO,
						"MSI: Event: %s err_type =0x%lx Process Time Out Info= 0x%lx",
						irdata[int_nb].name,
						FIELD_GET(INFO_RING_ERR_TYPE, *ring_data),
						FIELD_GET(INFO_RING_DET_INFO, *ring_data));
				if (vrb2_device_error(dev, int_nb))
					return 0;
				break;

			case VRB2_5G_EXTRA_COMPLETION_RECVD:
			case VRB2_5G_COMPLETION_READ_TIMEOUT:
				LOG(INFO, "MSI: Event: %s fec slice num = 0x%lx",
					irdata[int_nb].name,
					FIELD_GET(INFO_RING_DET_INFO_FEC_SLICE, *ring_data));
				if (vrb2_device_error(dev, int_nb))
					return 0;
				break;

			case VRB2_CORE_HANG_DETECTED:
				error_type = FIELD_GET(INFO_RING_ERR_TYPE, *ring_data);
				detailed_info = FIELD_GET(INFO_RING_DET_INFO, *ring_data);
				LOG(INFO, "MSI: Event: %s Raw %x err_type=0x%x",
					irdata[int_nb].name, *ring_data,
					error_type);
				/* Such error types are actually DMA Fatal errors. */
				if (error_type <= VRB2_CORE_DMA_ERROR)
					int_nb = VRB2_DMA_CLUSTER_HANG_DETECTED;
				/* Core hang recovery failure handled as fatal error. */
				if (detailed_info == VRB2_CORE_RECOVERY_FAILURE) {
					int_nb = VRB2_DMA_CLUSTER_HANG_DETECTED;
					LOG(ERR, "Core hang recovery failure on engine %d",
							error_type - VRB2_ERR_TYPE_OFFSET);
				}

				/* Special handling to catch data corruption after CHR */
				if (error_type >= VRB2_ERR_TYPE_OFFSET) {
					engine_idx = error_type - VRB2_ERR_TYPE_OFFSET;
					status = vrb2_reg_read(bar0addr, HWPfDmaStatusToutProcess);
					/* Core hang reported without processing time out . */
					if ((status & (1 << engine_idx)) == 0) {
						LOG(ERR, "CHR report is due to parity fatal error");
						int_nb = VRB2_DMA_CLUSTER_HANG_DETECTED;
					}
				}

				if (vrb2_device_error(dev, int_nb))
					return 0;
				vrb2_core_hang_recovery(dev, error_type);
				break;

			case VRB2_DOWN_STREAM_HANG_DETECTED:
				LOG(INFO, "MSI: Event: %s slave_id=%ld master_id=%ld "
					"write=%ld trans_id=%ld",
					irdata[int_nb].name,
					FIELD_GET(INFO_RING_DET_INFO_SLAVE_ID, *ring_data),
					FIELD_GET(INFO_RING_DET_INFO_MASTER_ID, *ring_data),
					FIELD_GET(INFO_RING_DET_INFO_WRITE, *ring_data),
					FIELD_GET(INFO_RING_DET_INFO_TRANS_ID, *ring_data));
				if (vrb2_device_error(dev, int_nb))
					return 0;
				break;

			default:
				/* Other cases */
				LOG(INFO, "MSI: Event: int_nb=%d %s detailed_info = 0x%lx",
					int_nb, irdata[int_nb].name,
					FIELD_GET(INFO_RING_DET_INFO, *ring_data));
				if (vrb2_device_error(dev, int_nb))
					return 0;
				break;
			}
		} else {
			/* No additional information */
			LOG(INFO, "MSI: Event: %d  %s msi_0=%ld loop=%ld vf2pf = %ld Ptr %d",
				int_nb, irdata[int_nb].name,
				FIELD_GET(INFO_RING_MSI_0, (uint32_t) *ring_data),
				FIELD_GET(INFO_RING_LOOP, (uint32_t) *ring_data),
				FIELD_GET(INFO_RING_VF2PF, (uint32_t) *ring_data),
				accel_pci_dev->info_ring_head);
			if (vrb2_device_error(dev, int_nb))
				return 0;
		}

		/* Initialize Info Ring entry and move forward */
		*ring_data = 0;
		++accel_pci_dev->info_ring_head;
		ring_data = info_ring + (accel_pci_dev->info_ring_head &
			 VRB2_INFO_RING_MASK);
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x80, %rsp
movq %rdi, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq 0x90(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x28(%rbp), %rcx
movzwl 0xa8(%rcx), %ecx
andl $0x3ff, %ecx            # imm = 0x3FF
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq 0xb0(%rax), %rax
movq %rax, -0x40(%rbp)
callq 0x1bd70
movq %rax, %rcx
leaq 0x237c6(%rip), %rax     # 0x3b8d0
movq 0x18(%rax), %r8
movq -0x28(%rbp), %rax
movzwl 0xa8(%rax), %eax
movl $0x3, %edi
xorl %esi, %esi
leaq 0xc739(%rip), %rdx      # 0x24860
leaq 0xca62(%rip), %r9       # 0x24b90
movl %eax, (%rsp)
movb $0x0, %al
callq 0x216e0
callq 0x1bd70
movq %rax, %rcx
leaq 0x23789(%rip), %rax     # 0x3b8d0
movq 0x18(%rax), %r8
movq -0x30(%rbp), %rax
movl $0x3, %edi
xorl %esi, %esi
leaq 0xca44(%rip), %rdx      # 0x24ba1
leaq 0xca2c(%rip), %r9       # 0x24b90
movq %rax, (%rsp)
movb $0x0, %al
callq 0x216e0
callq 0x1bd70
movq %rax, %rcx
leaq 0x23752(%rip), %rax     # 0x3b8d0
movq 0x18(%rax), %r8
movq -0x38(%rbp), %rax
movl $0x3, %edi
xorl %esi, %esi
leaq 0xca30(%rip), %rdx      # 0x24bc4
leaq 0xc9f5(%rip), %r9       # 0x24b90
movq %rax, (%rsp)
movb $0x0, %al
callq 0x216e0
movq -0x38(%rbp), %rax
movl (%rax), %eax
movabsq $0x80000000, %rcx       # imm = 0x80000000
andq %rcx, %rax
shrq $0x1f, %rax
cmpq $0x0, %rax
jne 0x18292
movq -0x40(%rbp), %rdi
movl $0xc8401c, %esi         # imm = 0xC8401C
callq 0x18b70
andl $0xfff, %eax            # imm = 0xFFF
movl %eax, %eax
shrq $0x2, %rax
movw %ax, -0x42(%rbp)
movzwl -0x42(%rbp), %eax
movq -0x28(%rbp), %rcx
movzwl 0xa8(%rcx), %ecx
cmpl %ecx, %eax
je 0x18229
movw -0x42(%rbp), %cx
movq -0x28(%rbp), %rax
movw %cx, 0xa8(%rax)
movq -0x30(%rbp), %rax
movq -0x28(%rbp), %rcx
movzwl 0xa8(%rcx), %ecx
andl $0x3ff, %ecx            # imm = 0x3FF
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
callq 0x1bd70
movq %rax, %rcx
leaq 0x23698(%rip), %rax     # 0x3b8d0
movq 0x18(%rax), %r8
movzwl -0x42(%rbp), %r10d
movq -0x28(%rbp), %rax
movzwl 0xa8(%rax), %eax
movl $0x3, %edi
xorl %esi, %esi
leaq 0xc98d(%rip), %rdx      # 0x24be7
leaq 0xc92f(%rip), %r9       # 0x24b90
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x216e0
movq -0x20(%rbp), %rdi
movl $0x1f, %esi
callq 0x18ba0
testb $0x1, %al
jne 0x18284
jmp 0x18290
movl $0x0, -0x14(%rbp)
jmp 0x18b54
jmp 0x18292
jmp 0x18294
movq -0x38(%rbp), %rax
movl (%rax), %eax
movabsq $0x80000000, %rcx       # imm = 0x80000000
andq %rcx, %rax
shrq $0x1f, %rax
cmpq $0x0, %rax
je 0x18b4d
movq -0x38(%rbp), %rax
movl (%rax), %eax
andq $0x7e0000, %rax         # imm = 0x7E0000
shrq $0x11, %rax
movl %eax, -0x4c(%rbp)
cmpl $0x20, -0x4c(%rbp)
jb 0x1834c
callq 0x1bd70
movq %rax, %rcx
leaq 0x235f3(%rip), %rax     # 0x3b8d0
movq 0x10(%rax), %r8
movl -0x4c(%rbp), %r9d
movq -0x38(%rbp), %rax
movl (%rax), %eax
movl %eax, %r10d
andq $0x800000, %r10         # imm = 0x800000
shrq $0x17, %r10
movq -0x38(%rbp), %rax
movl (%rax), %eax
andq $0x40000000, %rax       # imm = 0x40000000
shrq $0x1e, %rax
movl $0x2, %edi
xorl %esi, %esi
leaq 0xc902(%rip), %rdx      # 0x24c19
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x216e0
movq -0x20(%rbp), %rdi
movl $0x1f, %esi
callq 0x18ba0
testb $0x1, %al
jne 0x1833b
jmp 0x18347
movl $0x0, -0x14(%rbp)
jmp 0x18b54
jmp 0x18b05
movl -0x4c(%rbp), %eax
movl %eax, %ecx
leaq 0x22af8(%rip), %rax     # 0x3ae50
shlq $0x4, %rcx
addq %rcx, %rax
testb $0x1, 0x8(%rax)
je 0x18a47
movl -0x4c(%rbp), %eax
movq %rax, -0x60(%rbp)
subq $0x1c, %rax
ja 0x189c7
movq -0x60(%rbp), %rax
leaq 0xc6db(%rip), %rcx      # 0x24a60
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x20(%rbp), %rdi
movq -0x38(%rbp), %rax
movl (%rax), %eax
andq $0x3f000000, %rax       # imm = 0x3F000000
shrq $0x18, %rax
movl %eax, %esi
movq -0x38(%rbp), %rax
movl (%rax), %eax
andq $0x1ffff, %rax          # imm = 0x1FFFF
shrq $0x0, %rax
movl %eax, %edx
callq 0x18e80
jmp 0x18a42
callq 0x1bd70
movq %rax, %rcx
leaq 0x23501(%rip), %rax     # 0x3b8d0
movq 0x10(%rax), %r8
movl -0x4c(%rbp), %eax
movl %eax, %edx
leaq 0x22a71(%rip), %rax     # 0x3ae50
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rax), %r9
movq -0x38(%rbp), %rax
movl (%rax), %eax
movl %eax, %r11d
andq $0x3f, %r11
shrq $0x0, %r11
movq -0x38(%rbp), %rax
movl (%rax), %eax
movl %eax, %r10d
andq $0x7c0, %r10            # imm = 0x7C0
shrq $0x6, %r10
movq -0x38(%rbp), %rax
movl (%rax), %eax
andq $0x1f800, %rax          # imm = 0x1F800
shrq $0xb, %rax
movl $0x2, %edi
xorl %esi, %esi
leaq 0xc823(%rip), %rdx      # 0x24c4f
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movb $0x0, %al
callq 0x216e0
movq -0x20(%rbp), %rdi
movl -0x4c(%rbp), %esi
callq 0x18ba0
testb $0x1, %al
jne 0x18453
jmp 0x1845f
movl $0x0, -0x14(%rbp)
jmp 0x18b54
jmp 0x18a42
callq 0x1bd70
movq %rax, %rcx
leaq 0x2345d(%rip), %rax     # 0x3b8d0
movq 0x10(%rax), %r8
movl -0x4c(%rbp), %eax
movl %eax, %edx
leaq 0x229cd(%rip), %rax     # 0x3ae50
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rax), %r9
movq -0x38(%rbp), %rax
movl (%rax), %eax
movl %eax, %ebx
andq $0x3f000000, %rbx       # imm = 0x3F000000
shrq $0x18, %rbx
movq -0x38(%rbp), %rax
movl (%rax), %eax
movl %eax, %r11d
andq $0x3f, %r11
shrq $0x0, %r11
movq -0x38(%rbp), %rax
movl (%rax), %eax
movl %eax, %r10d
andq $0x7c0, %r10            # imm = 0x7C0
shrq $0x6, %r10
movq -0x38(%rbp), %rax
movl (%rax), %eax
andq $0x1f800, %rax          # imm = 0x1F800
shrq $0xb, %rax
movl $0x2, %edi
xorl %esi, %esi
leaq 0xc7b3(%rip), %rdx      # 0x24c96
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movb $0x0, %al
callq 0x216e0
movq -0x20(%rbp), %rdi
movl -0x4c(%rbp), %esi
callq 0x18ba0
testb $0x1, %al
jne 0x1850f
jmp 0x1851b
movl $0x0, -0x14(%rbp)
jmp 0x18b54
jmp 0x18a42
callq 0x1bd70
movq %rax, %rcx
leaq 0x233a1(%rip), %rax     # 0x3b8d0
movq 0x10(%rax), %r8
movl -0x4c(%rbp), %eax
movl %eax, %edx
leaq 0x22911(%rip), %rax     # 0x3ae50
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rax), %r9
movq -0x38(%rbp), %rax
movl (%rax), %eax
movl %eax, %r10d
andq $0x3f000000, %r10       # imm = 0x3F000000
shrq $0x18, %r10
movq -0x38(%rbp), %rax
movl (%rax), %eax
andq $0x1ffff, %rax          # imm = 0x1FFFF
shrq $0x0, %rax
movl $0x2, %edi
xorl %esi, %esi
leaq 0xc764(%rip), %rdx      # 0x24cdf
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x216e0
movq -0x20(%rbp), %rdi
movl -0x4c(%rbp), %esi
callq 0x18ba0
testb $0x1, %al
jne 0x1859d
jmp 0x185a9
movl $0x0, -0x14(%rbp)
jmp 0x18b54
jmp 0x18a42
movq -0x38(%rbp), %rax
movl (%rax), %eax
andq $0x3f000000, %rax       # imm = 0x3F000000
shrq $0x18, %rax
movw %ax, -0x44(%rbp)
movzwl -0x44(%rbp), %eax
cmpl $0x4, %eax
jne 0x1863b
callq 0x1bd70
movq %rax, %rcx
leaq 0x232f6(%rip), %rax     # 0x3b8d0
movq 0x10(%rax), %r8
movl -0x4c(%rbp), %eax
movl %eax, %edx
leaq 0x22866(%rip), %rax     # 0x3ae50
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rax), %r9
movq -0x38(%rbp), %rax
movl (%rax), %eax
movl %eax, %r10d
andq $0x3f000000, %r10       # imm = 0x3F000000
shrq $0x18, %r10
movq -0x38(%rbp), %rax
movl (%rax), %eax
andq $0x1ffff, %rax          # imm = 0x1FFFF
shrq $0x0, %rax
movl $0x2, %edi
xorl %esi, %esi
leaq 0xc6e9(%rip), %rdx      # 0x24d0f
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x216e0
jmp 0x1871e
movzwl -0x44(%rbp), %eax
cmpl $0x5, %eax
jne 0x186b1
callq 0x1bd70
movq %rax, %rcx
leaq 0x2327d(%rip), %rax     # 0x3b8d0
movq 0x10(%rax), %r8
movl -0x4c(%rbp), %eax
movl %eax, %edx
leaq 0x227ed(%rip), %rax     # 0x3ae50
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rax), %r9
movq -0x38(%rbp), %rax
movl (%rax), %eax
movl %eax, %r10d
andq $0x3f000000, %r10       # imm = 0x3F000000
shrq $0x18, %r10
movq -0x38(%rbp), %rax
movl (%rax), %eax
andq $0x1ffff, %rax          # imm = 0x1FFFF
shrq $0x0, %rax
movl $0x2, %edi
xorl %esi, %esi
leaq 0xc6af(%rip), %rdx      # 0x24d4e
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x216e0
jmp 0x1871c
callq 0x1bd70
movq %rax, %rcx
leaq 0x23210(%rip), %rax     # 0x3b8d0
movq 0x10(%rax), %r8
movl -0x4c(%rbp), %eax
movl %eax, %edx
leaq 0x22780(%rip), %rax     # 0x3ae50
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rax), %r9
movq -0x38(%rbp), %rax
movl (%rax), %eax
movl %eax, %r10d
andq $0x3f000000, %r10       # imm = 0x3F000000
shrq $0x18, %r10
movq -0x38(%rbp), %rax
movl (%rax), %eax
andq $0x1ffff, %rax          # imm = 0x1FFFF
shrq $0x0, %rax
movl $0x2, %edi
xorl %esi, %esi
leaq 0xc682(%rip), %rdx      # 0x24d8e
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x216e0
jmp 0x1871e
movq -0x20(%rbp), %rdi
movl -0x4c(%rbp), %esi
callq 0x18ba0
testb $0x1, %al
jne 0x18730
jmp 0x1873c
movl $0x0, -0x14(%rbp)
jmp 0x18b54
jmp 0x18a42
callq 0x1bd70
movq %rax, %rcx
leaq 0x23180(%rip), %rax     # 0x3b8d0
movq 0x10(%rax), %r8
movl -0x4c(%rbp), %eax
movl %eax, %edx
leaq 0x226f0(%rip), %rax     # 0x3ae50
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rax), %r9
movq -0x38(%rbp), %rax
movl (%rax), %eax
andq $0x7ff, %rax            # imm = 0x7FF
shrq $0x0, %rax
movl $0x2, %edi
xorl %esi, %esi
leaq 0xc649(%rip), %rdx      # 0x24dd1
movq %rax, (%rsp)
movb $0x0, %al
callq 0x216e0
movq -0x20(%rbp), %rdi
movl -0x4c(%rbp), %esi
callq 0x18ba0
testb $0x1, %al
jne 0x187a5
jmp 0x187b1
movl $0x0, -0x14(%rbp)
jmp 0x18b54
jmp 0x18a42
movq -0x38(%rbp), %rax
movl (%rax), %eax
andq $0x3f000000, %rax       # imm = 0x3F000000
shrq $0x18, %rax
movw %ax, -0x44(%rbp)
movq -0x38(%rbp), %rax
movl (%rax), %eax
andq $0x1ffff, %rax          # imm = 0x1FFFF
shrq $0x0, %rax
movl %eax, -0x50(%rbp)
callq 0x1bd70
movq %rax, %rcx
leaq 0x230e4(%rip), %rax     # 0x3b8d0
movq 0x10(%rax), %r8
movl -0x4c(%rbp), %eax
movl %eax, %edx
leaq 0x22654(%rip), %rax     # 0x3ae50
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rax), %r9
movq -0x38(%rbp), %rax
movl (%rax), %r10d
movzwl -0x44(%rbp), %eax
movl $0x2, %edi
xorl %esi, %esi
leaq 0xc5de(%rip), %rdx      # 0x24dfd
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x216e0
movzwl -0x44(%rbp), %eax
cmpl $0x3, %eax
jg 0x1883e
movl $0x1b, -0x4c(%rbp)
cmpl $0x4800, -0x50(%rbp)    # imm = 0x4800
jne 0x1887b
movl $0x1b, -0x4c(%rbp)
callq 0x1bd70
movq %rax, %rcx
leaq 0x23073(%rip), %rax     # 0x3b8d0
movq (%rax), %r8
movzwl -0x44(%rbp), %r9d
subl $0xa, %r9d
xorl %esi, %esi
leaq 0xc5b6(%rip), %rdx      # 0x24e28
movl %esi, %edi
movb $0x0, %al
callq 0x216e0
movzwl -0x44(%rbp), %eax
cmpl $0xa, %eax
jl 0x188e4
movzwl -0x44(%rbp), %eax
subl $0xa, %eax
movw %ax, -0x46(%rbp)
movq -0x40(%rbp), %rdi
movl $0xb80890, %esi         # imm = 0xB80890
callq 0x18b70
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
movzwl -0x46(%rbp), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
andl %ecx, %eax
cmpl $0x0, %eax
jne 0x188e2
callq 0x1bd70
movq %rax, %rcx
leaq 0x2300a(%rip), %rax     # 0x3b8d0
movq (%rax), %r8
xorl %esi, %esi
leaq 0xc585(%rip), %rdx      # 0x24e57
movl %esi, %edi
movb $0x0, %al
callq 0x216e0
movl $0x1b, -0x4c(%rbp)
jmp 0x188e4
movq -0x20(%rbp), %rdi
movl -0x4c(%rbp), %esi
callq 0x18ba0
testb $0x1, %al
jne 0x188f6
jmp 0x18902
movl $0x0, -0x14(%rbp)
jmp 0x18b54
movq -0x20(%rbp), %rdi
movzwl -0x44(%rbp), %esi
callq 0x19110
jmp 0x18a42
callq 0x1bd70
movq %rax, %rcx
leaq 0x22fad(%rip), %rax     # 0x3b8d0
movq 0x10(%rax), %r8
movl -0x4c(%rbp), %eax
movl %eax, %edx
leaq 0x2251d(%rip), %rax     # 0x3ae50
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rax), %r9
movq -0x38(%rbp), %rax
movl (%rax), %eax
movl %eax, %ebx
andq $0x3, %rbx
shrq $0x0, %rbx
movq -0x38(%rbp), %rax
movl (%rax), %eax
movl %eax, %r11d
andq $0xc, %r11
shrq $0x2, %r11
movq -0x38(%rbp), %rax
movl (%rax), %eax
movl %eax, %r10d
andq $0x10, %r10
shrq $0x4, %r10
movq -0x38(%rbp), %rax
movl (%rax), %eax
andq $0x3e0, %rax            # imm = 0x3E0
shrq $0x5, %rax
movl $0x2, %edi
xorl %esi, %esi
leaq 0xc4f9(%rip), %rdx      # 0x24e86
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movb $0x0, %al
callq 0x216e0
movq -0x20(%rbp), %rdi
movl -0x4c(%rbp), %esi
callq 0x18ba0
testb $0x1, %al
jne 0x189b9
jmp 0x189c5
movl $0x0, -0x14(%rbp)
jmp 0x18b54
jmp 0x18a42
callq 0x1bd70
movq %rax, %rcx
leaq 0x22efa(%rip), %rax     # 0x3b8d0
movq 0x10(%rax), %r8
movl -0x4c(%rbp), %r9d
movl -0x4c(%rbp), %eax
movl %eax, %edx
leaq 0x22466(%rip), %rax     # 0x3ae50
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rax), %r10
movq -0x38(%rbp), %rax
movl (%rax), %eax
andq $0x1ffff, %rax          # imm = 0x1FFFF
shrq $0x0, %rax
movl $0x2, %edi
xorl %esi, %esi
leaq 0xc4bc(%rip), %rdx      # 0x24ece
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x216e0
movq -0x20(%rbp), %rdi
movl -0x4c(%rbp), %esi
callq 0x18ba0
testb $0x1, %al
jne 0x18a34
jmp 0x18a40
movl $0x0, -0x14(%rbp)
jmp 0x18b54
jmp 0x18a42
jmp 0x18b03
callq 0x1bd70
movq %rax, %rcx
leaq 0x22e7a(%rip), %rax     # 0x3b8d0
movq 0x10(%rax), %r8
movl -0x4c(%rbp), %r9d
movl -0x4c(%rbp), %eax
movl %eax, %edx
leaq 0x223e6(%rip), %rax     # 0x3ae50
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rax), %r14
movq -0x38(%rbp), %rax
movl (%rax), %eax
movl %eax, %ebx
andq $0x800000, %rbx         # imm = 0x800000
shrq $0x17, %rbx
movq -0x38(%rbp), %rax
movl (%rax), %eax
movl %eax, %r11d
andq $0x40000000, %r11       # imm = 0x40000000
shrq $0x1e, %r11
movq -0x38(%rbp), %rax
movl (%rax), %eax
movl %eax, %r10d
andq $0x3f000000, %r10       # imm = 0x3F000000
shrq $0x18, %r10
movq -0x28(%rbp), %rax
movzwl 0xa8(%rax), %eax
movl $0x2, %edi
xorl %esi, %esi
leaq 0xc43c(%rip), %rdx      # 0x24f04
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movq %r11, 0x10(%rsp)
movq %r10, 0x18(%rsp)
movl %eax, 0x20(%rsp)
movb $0x0, %al
callq 0x216e0
movq -0x20(%rbp), %rdi
movl -0x4c(%rbp), %esi
callq 0x18ba0
testb $0x1, %al
jne 0x18af8
jmp 0x18b01
movl $0x0, -0x14(%rbp)
jmp 0x18b54
jmp 0x18b03
jmp 0x18b05
movq -0x38(%rbp), %rax
movl $0x0, (%rax)
movq -0x28(%rbp), %rax
movw 0xa8(%rax), %cx
addw $0x1, %cx
movw %cx, 0xa8(%rax)
movq -0x30(%rbp), %rax
movq -0x28(%rbp), %rcx
movzwl 0xa8(%rcx), %ecx
andl $0x3ff, %ecx            # imm = 0x3FF
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
jmp 0x18294
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
addq $0x80, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nopw %cs:(%rax,%rax)