// File: /workspace/github_c_makefile_star2_O2/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 0x137d0
testb %al, %al
je 0x1086f
leaq 0xb56d(%rip), %rdi      # 0x1bdd0
movq %r14, %rsi
xorl %eax, %eax
callq 0xd160
jmp 0x10880
leaq 0xb(%rsp), %rsi
movq %r14, %rdi
callq 0x10b50
testl %eax, %eax
je 0x108a0
leaq 0xb6d7(%rip), %rdi      # 0x1bf5e
callq 0xd0c0
pushq $-0x1
popq %rbx
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)
pushq $0x10
popq %rax
cmpq $0x50, %rax
je 0x108be
movl $0xffffffff, (%rbx,%rax,4) # imm = 0xFFFFFFFF
incq %rax
jmp 0x108ac
cmpb $0x1, 0xb(%rsp)
jne 0x108de
xorl %eax, %eax
cmpq $0x40, %rax
je 0x109a8
movl $0x1, 0x40(%rbx,%rax,4)
incq %rax
jmp 0x108c7
pushq $-0x8
popq %rdx
xorl %eax, %eax
xorl %ecx, %ecx
testq %rdx, %rdx
je 0x108fd
movzbl 0x14(%rsp,%rdx), %esi
addl %esi, %eax
movzbl 0x1c(%rsp,%rdx), %esi
addl %esi, %ecx
incq %rdx
jmp 0x108e5
cmpw $0x20, %ax
ja 0x1094a
cmpw $0x20, %cx
ja 0x1094a
leal (%rcx,%rax), %edx
cmpw $0x40, %dx
ja 0x1094a
xorl %eax, %eax
xorl %ecx, %ecx
cmpq $0x8, %rax
je 0x1096d
movl %eax, %edx
shll $0x10, %edx
orl $0x800001, %edx         # imm = 0x800001
movzbl 0xc(%rsp,%rax), %edi
movl %edi, %esi
addl %ecx, %esi
subw $0x1, %di
jb 0x10943
movzwl %cx, %r8d
movl %edx, 0x40(%rbx,%r8,4)
incl %ecx
jmp 0x10930
incq %rax
movl %esi, %ecx
jmp 0x10916
movzwl %cx, %edx
movzwl %ax, %esi
leaq 0xb4a2(%rip), %rdi      # 0x1bdf9
pushq $0x40
popq %rcx
xorl %eax, %eax
callq 0xd160
leaq 0xb5d0(%rip), %rdi      # 0x1bf38
jmp 0x10887
xorl %eax, %eax
xorl %ecx, %ecx
cmpq $0x8, %rax
je 0x109a8
movl %eax, %edx
shll $0x10, %edx
orl $0x800001, %edx         # imm = 0x800001
movzbl 0x14(%rsp,%rax), %edi
movl %edi, %esi
addl %ecx, %esi
subw $0x1, %di
jb 0x109a1
movzwl %cx, %r8d
movl %edx, 0xc0(%rbx,%r8,4)
incl %ecx
jmp 0x1098b
incq %rax
movl %esi, %ecx
jmp 0x10971
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 0xb490(%rip), %rdi      # 0x1be6e
leaq 0xb4f1(%rip), %rax      # 0x1bed6
leaq 0xb4ee(%rip), %r14      # 0x1beda
cmoveq %rax, %r14
xorl %eax, %eax
callq 0xd160
movl $0xff, %r13d
movl %r15d, %esi
andl %r13d, %esi
shrl $0x8, %r15d
leaq 0xb475(%rip), %rdi      # 0x1be83
movl %r15d, %edx
xorl %eax, %eax
callq 0xd160
andl %r12d, %r13d
shrl $0x8, %r12d
leaq 0xb474(%rip), %rdi      # 0x1be9a
movl %r13d, %esi
movl %r12d, %edx
xorl %eax, %eax
callq 0xd160
leaq 0xb47c(%rip), %rdi      # 0x1beb6
movq %r14, %rsi
xorl %eax, %eax
callq 0xd160
shll $0x5, %ebp
leaq 0xb492(%rip), %rdi      # 0x1bee0
movl %ebp, %esi
xorl %eax, %eax
callq 0xd160
leaq 0xb51b(%rip), %rdi      # 0x1bf79
callq 0xd0c0
leaq 0xb550(%rip), %rdi      # 0x1bfba
callq 0xd0c0
leaq 0xb504(%rip), %rdi      # 0x1bf7a
callq 0xd0c0
leaq 0xb4af(%rip), %r12      # 0x1bf31
leaq 0xb4a1(%rip), %r13      # 0x1bf2a
xorl %r15d, %r15d
movq %rbx, 0x20(%rsp)
cmpq $0x40, %r15
je 0x10b16
cmpq $0x20, %r15
leaq 0xb485(%rip), %rsi      # 0x1bf27
leaq 0xb47b(%rip), %rax      # 0x1bf24
cmovbq %rax, %rsi
xorl %r14d, %r14d
leaq 0xb461(%rip), %rdi      # 0x1bf18
movl %r15d, %edx
xorl %eax, %eax
callq 0xd160
movl 0x40(%rbx,%r15,4), %ebx
movl %ebx, %ebp
andl $0x800000, %ebp         # imm = 0x800000
shrl $0x10, %ebx
andl $0x7f, %ebx
incl %ebx
cmpl $0x9, %r14d
je 0x10b01
cmpl %r14d, %ebx
movq %r13, %rdi
cmovneq %r12, %rdi
testl %ebp, %ebp
cmoveq %r12, %rdi
movl %r14d, %eax
orl %ebp, %eax
cmoveq %r13, %rdi
xorl %eax, %eax
callq 0xd160
incl %r14d
jmp 0x10ad6
pushq $0xa
popq %rdi
callq 0xd050
incq %r15
movq 0x20(%rsp), %rbx
jmp 0x10a91
leaq 0xb4dd(%rip), %rdi      # 0x1bffa
callq 0xd0c0
leaq 0xc8f0(%rip), %rax      # 0x1d419
leaq 0xb33b(%rip), %rsi      # 0x1be6b
cmpb $0x0, 0xb(%rsp)
cmovneq %rax, %rsi
leaq 0xb30e(%rip), %rdi      # 0x1be4e
xorl %ebx, %ebx
xorl %eax, %eax
callq 0xd160
jmp 0x1088f
nop