// File: /workspace/github_c_makefile_star2_O3/intel[P]pf-bb-config/fpga_5gnr/fpga_5gnr_cfg_app.c
// Function: fpga_5gnr_configure
int
fpga_5gnr_configure(void *dev, void *bar0addr, const char *cfg_filename, const bool first_cfg)
{
	struct fpga_5gnr_fec_conf fpga_conf;
	int ret;

	ret = fpga_read_config_file(cfg_filename, &fpga_conf);
	if (ret != 0) {
		printf("Error reading config file.\n");
		return -1;
	}

	ret = fpga_write_config(dev, bar0addr, &fpga_conf);
	if (ret != 0) {
		printf("Error writing configuration for FPGA.\n");
		return -1;
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movq %rdx, %rdi
callq 0x13a38
testb %al, %al
je 0x109df
leaq 0xb3fd(%rip), %rdi      # 0x1bdd0
movq %r14, %rsi
xorl %eax, %eax
callq 0xd150
jmp 0x109f0
leaq 0xb(%rsp), %rsi
movq %r14, %rdi
callq 0x10cd4
testl %eax, %eax
je 0x10a12
leaq 0xb567(%rip), %rdi      # 0x1bf5e
callq 0xd0c0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movzwl 0x1c(%rsp), %eax
movw %ax, 0x4(%rbx)
movl $0x10, %eax
movl $0xffffffff, (%rbx,%rax,4) # imm = 0xFFFFFFFF
incq %rax
cmpq $0x50, %rax
jne 0x10a20
cmpb $0x1, 0xb(%rsp)
jne 0x10a4f
xorl %eax, %eax
movl $0x1, 0x40(%rbx,%rax,4)
incq %rax
cmpq $0x40, %rax
jne 0x10a39
jmp 0x10b06
movq 0x14(%rsp), %xmm0
movq 0xc(%rsp), %xmm1
pxor %xmm2, %xmm2
psadbw %xmm2, %xmm0
movd %xmm0, %eax
psadbw %xmm2, %xmm1
movd %xmm1, %ecx
cmpw $0x20, %cx
ja 0x10cae
cmpw $0x20, %ax
ja 0x10cae
movl %eax, %edx
addl %ecx, %edx
cmpw $0x40, %dx
ja 0x10cae
xorl %eax, %eax
xorl %ecx, %ecx
movzbl 0xc(%rsp,%rax), %edx
testw %dx, %dx
je 0x10ac1
movl %eax, %esi
shll $0x10, %esi
orl $0x800001, %esi         # imm = 0x800001
movzwl %dx, %edi
addl %ecx, %edi
movzwl %cx, %r8d
movl %esi, 0x40(%rbx,%r8,4)
incl %ecx
decw %dx
jne 0x10aaf
movl %edi, %ecx
incq %rax
cmpq $0x8, %rax
jne 0x10a95
xorl %eax, %eax
xorl %ecx, %ecx
movzbl 0x14(%rsp,%rax), %edx
testw %dx, %dx
je 0x10afd
movl %eax, %esi
shll $0x10, %esi
orl $0x800001, %esi         # imm = 0x800001
movzwl %dx, %edi
addl %ecx, %edi
movzwl %cx, %r8d
movl %esi, 0xc0(%rbx,%r8,4)
incl %ecx
decw %dx
jne 0x10ae8
movl %edi, %ecx
incq %rax
cmpq $0x8, %rax
jne 0x10ace
movzwl 0x1e(%rsp), %eax
movw %ax, 0xa(%rbx)
movw $0x8, 0xc(%rbx)
movw $0x1, 0x8(%rbx)
movl (%rbx), %esi
movzwl 0x4(%rbx), %r15d
movzwl %si, %edx
shrl $0x10, %esi
cmpb $0x0, 0x8(%rbx)
movzwl 0xa(%rbx), %r12d
movzwl 0xc(%rbx), %ebp
leaq 0xb332(%rip), %rdi      # 0x1be6e
leaq 0xb393(%rip), %rax      # 0x1bed6
leaq 0xb390(%rip), %r14      # 0x1beda
cmoveq %rax, %r14
xorl %eax, %eax
callq 0xd150
movl $0xff, %r13d
movl %r15d, %esi
andl %r13d, %esi
shrl $0x8, %r15d
leaq 0xb317(%rip), %rdi      # 0x1be83
movl %r15d, %edx
xorl %eax, %eax
callq 0xd150
andl %r12d, %r13d
shrl $0x8, %r12d
leaq 0xb316(%rip), %rdi      # 0x1be9a
movl %r13d, %esi
movl %r12d, %edx
xorl %eax, %eax
callq 0xd150
leaq 0xb31e(%rip), %rdi      # 0x1beb6
movq %r14, %rsi
xorl %eax, %eax
callq 0xd150
shll $0x5, %ebp
leaq 0xb334(%rip), %rdi      # 0x1bee0
movl %ebp, %esi
xorl %eax, %eax
callq 0xd150
leaq 0xb3bd(%rip), %rdi      # 0x1bf79
callq 0xd0c0
leaq 0xb3f2(%rip), %rdi      # 0x1bfba
callq 0xd0c0
leaq 0xb3a6(%rip), %rdi      # 0x1bf7a
callq 0xd0c0
leaq 0xb351(%rip), %rbp      # 0x1bf31
leaq 0xb343(%rip), %r12      # 0x1bf2a
xorl %r15d, %r15d
movq %rbx, 0x20(%rsp)
cmpq $0x20, %r15
leaq 0xb32d(%rip), %rsi      # 0x1bf27
leaq 0xb323(%rip), %rax      # 0x1bf24
cmovbq %rax, %rsi
leaq 0xb30c(%rip), %rdi      # 0x1bf18
movl %r15d, %edx
xorl %eax, %eax
callq 0xd150
movl 0x40(%rbx,%r15,4), %r14d
movl %r14d, %r13d
andl $0x800000, %r13d        # imm = 0x800000
shrl $0x10, %r14d
andl $0x7f, %r14d
incl %r14d
xorl %ebx, %ebx
cmpl %ebx, %r14d
movq %r12, %rdi
cmovneq %rbp, %rdi
testl %r13d, %r13d
cmoveq %rbp, %rdi
movl %ebx, %eax
orl %r13d, %eax
cmoveq %r12, %rdi
xorl %eax, %eax
callq 0xd150
incl %ebx
cmpl $0x9, %ebx
jne 0x10c32
movl $0xa, %edi
callq 0xd050
incq %r15
cmpq $0x40, %r15
movq 0x20(%rsp), %rbx
jne 0x10bef
leaq 0xb37d(%rip), %rdi      # 0x1bffa
callq 0xd0c0
leaq 0xc7e0(%rip), %rax      # 0x1d469
leaq 0xb1db(%rip), %rsi      # 0x1be6b
cmpb $0x0, 0xb(%rsp)
cmovneq %rax, %rsi
leaq 0xb1ae(%rip), %rdi      # 0x1be4e
xorl %ebx, %ebx
xorl %eax, %eax
callq 0xd150
jmp 0x10a01
movzwl %ax, %edx
movzwl %cx, %esi
leaq 0xb13e(%rip), %rdi      # 0x1bdf9
movl $0x40, %ecx
xorl %eax, %eax
callq 0xd150
leaq 0xb26a(%rip), %rdi      # 0x1bf38
jmp 0x109f7
nop