// File: /workspace/github_c_makefile_star2_O0/intel[P]pf-bb-config/vrb2/vrb2_cfg_app.c
// Function: vrb2_check_error_reg
static bool
vrb2_check_error_reg(uint8_t *bar0addr)
{
	uint32_t err_status, i;
	bool fatal_error = false;

	err_status = vrb2_reg_read(bar0addr, HWPfHiErrStatusReg);
	for (i = 0; i < 32; i++) {
		if (((err_status >> i) & 0x1) == 0x1) {
			if (histatus[i].fatal)
				fatal_error = true;
			LOG(ERR, "HI Device Error: %d %s", i, histatus[i].name);
		}
	}
	err_status = vrb2_reg_read(bar0addr, HWPfHiIosf2axiErrLogReg);
	for (i = 0; i < 32; i++)
		if (((err_status >> i) & 0x1) == 0x1)
			LOG(ERR, "Ext Device Error: %d %s", i, extError[i].name);
	/* Removing the CHR flag */
	vrb2_reg_write(bar0addr, HWPfHiIosf2axiErrLogReg, 1 << VRB2_DMA_ERROR_OR_CHR);
	err_status = vrb2_reg_read(bar0addr, HWPfDmaAxiStatus);
	if ((err_status & 0x1) == 0x1) {
		fatal_error = true;
		LOG(ERR, "Stop AXI asserted");
	}
	err_status = vrb2_reg_read(bar0addr, HWPfDmaClusterHangStatus);
	if ((err_status & 0x1) == 0x1) {
		fatal_error = true;
		LOG(ERR, "DMA Cluster Timer expired");
	}

	return fatal_error;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movb $0x0, -0x11(%rbp)
movq -0x8(%rbp), %rdi
movl $0xc84208, %esi         # imm = 0xC84208
callq 0x18b70
movl %eax, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
cmpl $0x20, -0x10(%rbp)
jae 0x1bead
movl -0xc(%rbp), %eax
movl -0x10(%rbp), %ecx
shrl %cl, %eax
andl $0x1, %eax
cmpl $0x1, %eax
jne 0x1be9d
movl -0x10(%rbp), %eax
movl %eax, %ecx
leaq 0x1f206(%rip), %rax     # 0x3b050
shlq $0x4, %rcx
addq %rcx, %rax
testb $0x1, 0x9(%rax)
je 0x1be5b
movb $0x1, -0x11(%rbp)
callq 0x1bd70
movq %rax, %rcx
leaq 0x1fa66(%rip), %rax     # 0x3b8d0
movq (%rax), %r8
movl -0x10(%rbp), %r9d
movl -0x10(%rbp), %eax
movl %eax, %edx
leaq 0x1f1d3(%rip), %rax     # 0x3b050
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rax), %rax
xorl %esi, %esi
leaq 0x8639(%rip), %rdx      # 0x244c9
movl %esi, %edi
movq %rax, (%rsp)
movb $0x0, %al
callq 0x216e0
jmp 0x1be9f
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x1be28
movq -0x8(%rbp), %rdi
movl $0xc84004, %esi         # imm = 0xC84004
callq 0x18b70
movl %eax, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
cmpl $0x20, -0x10(%rbp)
jae 0x1bf2a
movl -0xc(%rbp), %eax
movl -0x10(%rbp), %ecx
shrl %cl, %eax
andl $0x1, %eax
cmpl $0x1, %eax
jne 0x1bf1d
callq 0x1bd70
movq %rax, %rcx
leaq 0x1f9e6(%rip), %rax     # 0x3b8d0
movq (%rax), %r8
movl -0x10(%rbp), %r9d
movl -0x10(%rbp), %eax
movl %eax, %edx
leaq 0x1f353(%rip), %rax     # 0x3b250
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rax), %rax
xorl %esi, %esi
leaq 0x85f0(%rip), %rdx      # 0x24500
movl %esi, %edi
movq %rax, (%rsp)
movb $0x0, %al
callq 0x216e0
jmp 0x1bf1f
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x1bec5
movq -0x8(%rbp), %rdi
movl $0xc84004, %esi         # imm = 0xC84004
movl $0x40000, %edx          # imm = 0x40000
callq 0x197e0
movq -0x8(%rbp), %rdi
movl $0xb80028, %esi         # imm = 0xB80028
callq 0x18b70
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
andl $0x1, %eax
cmpl $0x1, %eax
jne 0x1bf81
movb $0x1, -0x11(%rbp)
callq 0x1bd70
movq %rax, %rcx
leaq 0x1f964(%rip), %rax     # 0x3b8d0
movq (%rax), %r8
xorl %esi, %esi
leaq 0x856f(%rip), %rdx      # 0x244e7
movl %esi, %edi
movb $0x0, %al
callq 0x216e0
movq -0x8(%rbp), %rdi
movl $0xb80e08, %esi         # imm = 0xB80E08
callq 0x18b70
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
andl $0x1, %eax
cmpl $0x1, %eax
jne 0x1bfc5
movb $0x1, -0x11(%rbp)
callq 0x1bd70
movq %rax, %rcx
leaq 0x1f920(%rip), %rax     # 0x3b8d0
movq (%rax), %r8
xorl %esi, %esi
leaq 0x920b(%rip), %rdx      # 0x251c7
movl %esi, %edi
movb $0x0, %al
callq 0x216e0
movb -0x11(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq