// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq 0x90(%rdi), %rbp
movq 0xb0(%rdi), %r15
movzwl 0xa8(%rdi), %eax
andl $0x3ff, %eax            # imm = 0x3FF
leaq (,%rax,4), %r13
addq %rbp, %r13
callq 0x16674
leaq 0x203fe(%rip), %r12     # 0x33ed0
movq 0x18(%r12), %r8
movzwl 0xa8(%rbx), %r10d
subq $0x8, %rsp
leaq 0x8d57(%rip), %rdx      # 0x1c841
leaq 0x90bf(%rip), %r14      # 0x1cbb0
movl $0x3, %edi
xorl %esi, %esi
movq %rax, %rcx
movq %r14, %r9
xorl %eax, %eax
pushq %r10
callq 0x199b4
addq $0x10, %rsp
callq 0x16674
movq 0x18(%r12), %r8
subq $0x8, %rsp
leaq 0x90a1(%rip), %rdx      # 0x1cbc1
movl $0x3, %edi
xorl %esi, %esi
movq %rax, %rcx
movq %r14, %r9
xorl %eax, %eax
pushq %rbp
callq 0x199b4
addq $0x10, %rsp
callq 0x16674
movq 0x18(%r12), %r8
subq $0x8, %rsp
leaq 0x9096(%rip), %rdx      # 0x1cbe4
movl $0x3, %edi
xorl %esi, %esi
movq %rax, %rcx
movq %r14, %r9
movq %r13, %r14
xorl %eax, %eax
pushq %r13
callq 0x199b4
addq $0x10, %rsp
movl (%r13), %r12d
testl %r12d, %r12d
movq %r15, 0x20(%rsp)
js 0x13c0c
movq %r14, %r12
movl 0xc8401c(%r15), %r14d
shrl $0x2, %r14d
andl $0x3ff, %r14d           # imm = 0x3FF
cmpw 0xa8(%rbx), %r14w
je 0x13bb3
movw %r14w, 0xa8(%rbx)
movzwl %r14w, %eax
leaq (,%rax,4), %r12
addq %rbp, %r12
callq 0x16674
leaq 0x20311(%rip), %r15     # 0x33ed0
movq 0x18(%r15), %r8
movzwl 0xa8(%rbx), %r10d
leaq 0x9035(%rip), %rdx      # 0x1cc07
leaq 0x8fd7(%rip), %r9       # 0x1cbb0
movl $0x3, %edi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
pushq %r10
pushq %r14
callq 0x199b4
addq $0x10, %rsp
movq %rbx, %rdi
movl $0x1f, %esi
callq 0x1453a
testb %al, %al
jne 0x14110
movq %r12, %r14
jmp 0x13c15
leaq 0x202bd(%rip), %r15     # 0x33ed0
jmp 0x13c21
movl (%r14), %r12d
testl %r12d, %r12d
jns 0x14110
movl %r12d, %r13d
shrl $0x11, %r13d
andl $0x3f, %r13d
cmpl $0x20, %r13d
jb 0x13c81
callq 0x16674
movq 0x10(%r15), %r8
movl (%r14), %r10d
movl %r10d, %r11d
shrl $0x17, %r11d
andl $0x1, %r11d
shrl $0x1e, %r10d
andl $0x1, %r10d
movl $0x2, %edi
xorl %esi, %esi
leaq 0x8fda(%rip), %rdx      # 0x1cc39
movq %rax, %rcx
movl %r13d, %r9d
xorl %eax, %eax
pushq %r10
pushq %r11
callq 0x199b4
addq $0x10, %rsp
movq %rbx, %rdi
movl $0x1f, %esi
jmp 0x13d95
movq %r14, 0x8(%rsp)
movl %r13d, %eax
shll $0x4, %eax
leaq 0x1eb4d(%rip), %rcx     # 0x327e0
leaq (%rcx,%rax), %r14
cmpb $0x1, 0x8(%rax,%rcx)
jne 0x13d15
cmpl $0x1c, %r13d
ja 0x14121
movl %r13d, %eax
leaq 0x8dbe(%rip), %rcx      # 0x1ca70
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0x16674
movq 0x10(%r15), %r8
movq (%r14), %r9
movq 0x8(%rsp), %r12
movl (%r12), %r10d
movl %r10d, %r11d
andl $0x3f, %r11d
movl %r10d, %r14d
shrl $0x6, %r14d
andl $0x1f, %r14d
shrl $0xb, %r10d
andl $0x3f, %r10d
subq $0x8, %rsp
movl $0x2, %edi
xorl %esi, %esi
leaq 0x8f73(%rip), %rdx      # 0x1cc6f
movq %rax, %rcx
xorl %eax, %eax
pushq %r10
pushq %r14
movq %r12, %r14
pushq %r11
callq 0x199b4
addq $0x20, %rsp
jmp 0x13d8f
callq 0x16674
movq 0x10(%r15), %r8
movq %r14, 0x18(%rsp)
movq 0x8(%rsp), %r14
movl (%r14), %r11d
movl %r11d, %r10d
shrl $0x17, %r10d
andl $0x1, %r10d
movl %r11d, %r12d
shrl $0x1e, %r12d
andl $0x1, %r12d
shrl $0x18, %r11d
andl $0x3f, %r11d
movq %rbp, %r15
movzwl 0xa8(%rbx), %ebp
subq $0x8, %rsp
movl $0x2, %edi
xorl %esi, %esi
leaq 0x91bf(%rip), %rdx      # 0x1cf24
movq %rax, %rcx
movl %r13d, %r9d
xorl %eax, %eax
pushq %rbp
movq %r15, %rbp
leaq 0x20158(%rip), %r15     # 0x33ed0
pushq %r11
pushq %r12
pushq %r10
movq 0x40(%rsp), %r10
pushq (%r10)
callq 0x199b4
addq $0x30, %rsp
movq %rbx, %rdi
movl %r13d, %esi
callq 0x1453a
testb %al, %al
jne 0x14110
movl $0x0, (%r14)
movl 0xa8(%rbx), %eax
incl %eax
movw %ax, 0xa8(%rbx)
andl $0x3ff, %eax            # imm = 0x3FF
leaq (,%rax,4), %r14
addq %rbp, %r14
jmp 0x13c15
callq 0x16674
movq 0x10(%r15), %r8
movq (%r14), %r9
movq 0x8(%rsp), %r14
movl (%r14), %r10d
andl $0x7ff, %r10d           # imm = 0x7FF
subq $0x8, %rsp
movl $0x2, %edi
xorl %esi, %esi
leaq 0x8ff7(%rip), %rdx      # 0x1cdf1
movq %rax, %rcx
xorl %eax, %eax
pushq %r10
callq 0x199b4
jmp 0x1415c
movl %r12d, %r13d
shrl $0x18, %r13d
andl $0x3f, %r13d
movl %r12d, %r14d
andl $0x1ffff, %r14d         # imm = 0x1FFFF
callq 0x16674
movq 0x18(%r15), %r8
subq $0x8, %rsp
movl $0x3, %edi
xorl %esi, %esi
leaq 0x85f2(%rip), %rdx      # 0x1c42d
movq %rax, %rcx
leaq 0x9780(%rip), %r9       # 0x1d5c5
xorl %eax, %eax
pushq %r14
callq 0x199b4
addq $0x10, %rsp
cmpl $0x3, %r14d
je 0x14455
cmpl $0x1, %r14d
jne 0x1447e
movl %r13d, %r14d
movq 0xf0(%rbx,%r14,8), %rax
movq 0xb0(%rbx), %rcx
movl %r13d, %edx
shll $0x8, %edx
movl %eax, 0xc80008(%rcx,%rdx)
movl $0x0, 0xc84000(%rcx)
cmpq %rax, 0x2f0(%rbx,%r14,8)
je 0x13ef9
callq 0x16674
movq %rax, 0x18(%rsp)
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movq 0xf0(%rbx,%r14,8), %r12
movl %r12d, %edi
callq 0x19cac
movq %rax, %r10
movl $0x2, %edi
xorl %esi, %esi
leaq 0x8589(%rip), %rdx      # 0x1c456
movq 0x18(%rsp), %rcx
movq 0x10(%rsp), %r8
movl %r13d, %r9d
xorl %eax, %eax
pushq %r10
pushq %r12
callq 0x199b4
addq $0x10, %rsp
movq 0xf0(%rbx,%r14,8), %rax
movq %rax, 0x2f0(%rbx,%r14,8)
addq $-0x6, %rax
cmpq $0x2, %rax
ja 0x14508
movq $0x3, 0xf0(%rbx,%r14,8)
jmp 0x14508
movl %r12d, %r13d
shrl $0x18, %r13d
andl $0x3f, %r13d
andl $0x1ffff, %r12d         # imm = 0x1FFFF
callq 0x16674
movq 0x10(%r15), %r8
movq (%r14), %r9
movq 0x8(%rsp), %rcx
movl (%rcx), %r10d
movl $0x2, %edi
xorl %esi, %esi
leaq 0x8ed1(%rip), %rdx      # 0x1ce1d
movq %rax, %rcx
xorl %eax, %eax
pushq %r13
pushq %r10
callq 0x199b4
addq $0x10, %rsp
cmpl $0x4, %r13d
movl $0x0, %esi
adcl $0x1a, %esi
cmpl $0x4800, %r12d          # imm = 0x4800
movq 0x20(%rsp), %r14
jne 0x13f9e
callq 0x16674
movq (%r15), %r8
leal -0xa(%r13), %r9d
xorl %edi, %edi
xorl %esi, %esi
leaq 0x8eb9(%rip), %rdx      # 0x1ce48
movq %rax, %rcx
xorl %eax, %eax
callq 0x199b4
movl $0x1b, %esi
cmpl $0xa, %r13d
jb 0x13fd9
movl 0xb80890(%r14), %eax
leal -0xa(%r13), %ecx
movzbl %cl, %ecx
btl %ecx, %eax
jb 0x13fd9
callq 0x16674
movq (%r15), %r8
xorl %edi, %edi
xorl %esi, %esi
leaq 0x8ead(%rip), %rdx      # 0x1ce77
movq %rax, %rcx
xorl %eax, %eax
callq 0x199b4
movl $0x1b, %esi
movq %rbx, %rdi
callq 0x1453a
testb %al, %al
jne 0x14110
movq %r13, 0x10(%rsp)
movq 0xb0(%rbx), %r14
movl 0xb80040(%r14), %r12d
testl %r12d, %r12d
je 0x14021
callq 0x16674
movq (%r15), %r8
xorl %edi, %edi
xorl %esi, %esi
leaq 0x95bb(%rip), %rdx      # 0x1d5cf
movq %rax, %rcx
movl %r12d, %r9d
xorl %eax, %eax
callq 0x199b4
movq %r14, 0x18(%rsp)
addq $0xb80c0c, %r14         # imm = 0xB80C0C
xorl %r12d, %r12d
movl (%r14), %r13d
testl %r13d, %r13d
je 0x14062
callq 0x16674
movq (%r15), %r8
subq $0x8, %rsp
xorl %edi, %edi
xorl %esi, %esi
leaq 0x95ae(%rip), %rdx      # 0x1d5fd
movq %rax, %rcx
movl %r12d, %r9d
xorl %eax, %eax
pushq %r13
callq 0x199b4
addq $0x10, %rsp
incq %r12
addq $0x10, %r14
cmpq $0x20, %r12
jne 0x14030
movq 0x18(%rsp), %r14
movl 0xb80818(%r14), %r12d
testl %r12d, %r12d
je 0x140a0
callq 0x16674
movq (%r15), %r8
xorl %edi, %edi
xorl %esi, %esi
leaq 0x95a0(%rip), %rdx      # 0x1d633
movq %rax, %rcx
movl %r12d, %r9d
xorl %eax, %eax
callq 0x199b4
movl 0xb80890(%r14), %r12d
testl %r12d, %r12d
movq 0x8(%rsp), %r14
movq 0x10(%rsp), %r13
je 0x140d6
callq 0x16674
movq (%r15), %r8
xorl %edi, %edi
xorl %esi, %esi
leaq 0x958c(%rip), %rdx      # 0x1d655
movq %rax, %rcx
movl %r12d, %r9d
xorl %eax, %eax
callq 0x199b4
movq %rbx, %rdi
movl $0x8, %esi
callq 0x1a06b
cmpw $0x8, %r13w
jne 0x14310
callq 0x16674
movq (%r15), %r8
xorl %edi, %edi
xorl %esi, %esi
leaq 0x957f(%rip), %rdx      # 0x1d680
movq %rax, %rcx
xorl %eax, %eax
callq 0x199b4
jmp 0x13da2
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x16674
movq 0x10(%r15), %r8
movq %r14, %r11
movq 0x8(%rsp), %r14
movl (%r14), %r10d
andl $0x1ffff, %r10d         # imm = 0x1FFFF
movl $0x2, %edi
xorl %esi, %esi
leaq 0x8da4(%rip), %rdx      # 0x1ceee
movq %rax, %rcx
movl %r13d, %r9d
xorl %eax, %eax
pushq %r10
pushq (%r11)
callq 0x199b4
addq $0x10, %rsp
jmp 0x13d8f
callq 0x16674
movq 0x10(%r15), %r8
movq (%r14), %r9
movq 0x8(%rsp), %r13
movl (%r13), %r11d
movl %r11d, %r10d
shrl $0x18, %r10d
andl $0x3f, %r10d
movl %r11d, %r14d
andl $0x3f, %r14d
movl %r11d, %r12d
shrl $0x6, %r12d
andl $0x1f, %r12d
shrl $0xb, %r11d
andl $0x3f, %r11d
movl $0x2, %edi
xorl %esi, %esi
leaq 0x8b09(%rip), %rdx      # 0x1ccb6
movq %rax, %rcx
xorl %eax, %eax
pushq %r11
pushq %r12
pushq %r14
movq %r13, %r14
pushq %r10
callq 0x199b4
addq $0x20, %rsp
movq %rbx, %rdi
movl $0xb, %esi
jmp 0x13d95
callq 0x16674
movq 0x10(%r15), %r8
movq (%r14), %r9
movq 0x8(%rsp), %r13
movl (%r13), %r11d
movl %r11d, %r10d
andl $0x3, %r10d
movl %r11d, %r14d
shrl $0x2, %r14d
andl $0x3, %r14d
movl %r11d, %r12d
shrl $0x4, %r12d
andl $0x1, %r12d
shrl $0x5, %r11d
andl $0x1f, %r11d
movl $0x2, %edi
xorl %esi, %esi
leaq 0x8c8b(%rip), %rdx      # 0x1cea6
movq %rax, %rcx
xorl %eax, %eax
pushq %r11
pushq %r12
pushq %r14
movq %r13, %r14
pushq %r10
callq 0x199b4
addq $0x20, %rsp
movq %rbx, %rdi
movl $0x1c, %esi
jmp 0x13d95
callq 0x16674
movq 0x10(%r15), %r8
movq (%r14), %r9
movq 0x8(%rsp), %r14
movl (%r14), %r10d
movl %r10d, %r11d
shrl $0x18, %r11d
andl $0x3f, %r11d
andl $0x1ffff, %r10d         # imm = 0x1FFFF
movl $0x2, %edi
xorl %esi, %esi
leaq 0x8a8a(%rip), %rdx      # 0x1ccff
movq %rax, %rcx
xorl %eax, %eax
pushq %r10
pushq %r11
callq 0x199b4
addq $0x10, %rsp
movq %rbx, %rdi
movl $0xd, %esi
jmp 0x13d95
shrl $0x18, %r12d
andl $0x3f, %r12d
callq 0x16674
movq 0x10(%r15), %r8
movq %r14, %rsi
movq 0x8(%rsp), %r14
movl (%r14), %r10d
movl %r10d, %r11d
shrl $0x18, %r11d
andl $0x3f, %r11d
andl $0x1ffff, %r10d         # imm = 0x1FFFF
cmpl $0x5, %r12d
leaq 0x8ae1(%rip), %rdx      # 0x1cdae
leaq 0x8a9a(%rip), %rcx      # 0x1cd6e
cmoveq %rcx, %rdx
movq (%rsi), %r9
cmpl $0x4, %r12d
leaq 0x8a49(%rip), %rcx      # 0x1cd2f
cmoveq %rcx, %rdx
movl $0x2, %edi
xorl %esi, %esi
movq %rax, %rcx
xorl %eax, %eax
pushq %r10
pushq %r11
callq 0x199b4
addq $0x10, %rsp
movq %rbx, %rdi
movl $0xf, %esi
jmp 0x13d95
movzwl %r13w, %eax
leal -0xa(%rax), %r14d
movzwl %r14w, %r12d
addl $-0x1b, %eax
cmpw $0x2, %ax
movq %r12, 0x10(%rsp)
ja 0x143b3
callq 0x16674
movq (%r15), %r8
movq 0x10(%rsp), %rcx
leal -0x11(%rcx), %r12d
xorl %edi, %edi
xorl %esi, %esi
leaq 0x9366(%rip), %rdx      # 0x1d6b0
movq %rax, %rcx
movl %r12d, %r9d
xorl %eax, %eax
callq 0x199b4
shll $0xc, %r12d
leal 0xb58004(%r12), %eax
movzbl 0x265c7(%rip), %ecx     # 0x3a931
addl $0x2001, %ecx           # imm = 0x2001
movq 0x18(%rsp), %r13
movl %ecx, (%r13,%rax)
movl $0x1, %edi
callq 0xd450
addl $0xb5803c, %r12d        # imm = 0xB5803C
cmpb $0x0, 0x2659f(%rip)     # 0x3a931
movl $0x60, %eax
movl $0x180, %ecx            # imm = 0x180
cmovnel %ecx, %eax
movl %eax, (%r13,%r12)
movq 0x10(%rsp), %r12
movl $0x1, %edi
callq 0xd450
cmpw $0x15, %r14w
movq 0x8(%rsp), %r14
ja 0x13da2
movl %r12d, %eax
leaq 0x8733(%rip), %rcx      # 0x1cb00
movq %r12, %rdx
movzbl (%rax,%rcx), %r12d
movl $0x1, %eax
movl %edx, %ecx
shll %cl, %eax
movq 0x18(%rsp), %r13
movl %eax, 0xb80890(%r13)
movl $0x1, %edi
callq 0xd450
movl $0x1, %eax
movl %r12d, %ecx
shll %cl, %eax
movl %eax, 0xb80044(%r13)
movl $0x1, %edi
callq 0xd450
movl $0x0, 0xb80040(%r13)
movl $0x1, %edi
callq 0xd450
callq 0x16674
movq (%r15), %r8
subq $0x8, %rsp
xorl %edi, %edi
xorl %esi, %esi
leaq 0x9297(%rip), %rdx      # 0x1d6d2
movq %rax, %rcx
movq 0x18(%rsp), %r9
xorl %eax, %eax
pushq %r12
callq 0x199b4
addq $0x10, %rsp
jmp 0x13da2
movzwl 0x4fc(%rbx), %eax
movq 0xb0(%rbx), %rcx
shll $0x8, %r13d
movl %eax, 0xc80008(%rcx,%r13)
movl $0x0, 0xc84000(%rcx)
jmp 0x14508
cmpw $0x4, %r12w
je 0x14495
movzwl %r12w, %eax
cmpl $0x5, %eax
jne 0x144c4
movl $0x500, %eax            # imm = 0x500
jmp 0x1449a
movl $0x540, %eax            # imm = 0x540
addq %rbx, %rax
movl %r14d, %ecx
shrl $0x10, %ecx
movl (%rax,%rcx,4), %eax
movq 0xb0(%rbx), %rcx
movl %r13d, %edx
shll $0x8, %edx
movl %eax, 0xc80008(%rcx,%rdx)
movl $0x0, 0xc84000(%rcx)
cmpl $0x2, %r14d
jne 0x14508
movl %r13d, %eax
cmpq $0x3, 0xf0(%rbx,%rax,8)
jne 0x14508
movq $0x4, 0xf0(%rbx,%rax,8)
callq 0x16674
movq 0x10(%r15), %r8
movl $0x2, %edi
xorl %esi, %esi
leaq 0x7f8c(%rip), %rdx      # 0x1c487
movq %rax, %rcx
movl %r13d, %r9d
xorl %eax, %eax
callq 0x199b4
callq 0x16674
movq 0x18(%r15), %r8
movl $0x3, %edi
xorl %esi, %esi
leaq 0x7005(%rip), %rdx      # 0x1b524
movq %rax, %rcx
leaq 0x909c(%rip), %r9       # 0x1d5c5
xorl %eax, %eax
callq 0x199b4
movq 0x8(%rsp), %r14
jmp 0x13da2