// File: /workspace/github_c_makefile_star2_O3/intel[P]pf-bb-config/fpga_lte/fpga_lte_cfg_app.c
// Function: fpga_lte_configure
int
fpga_lte_configure(void *dev, void *bar0addr, const char *cfg_filename, const bool first_cfg)
{
	struct fpga_lte_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 0x102df
leaq 0xbafd(%rip), %rdi      # 0x1bdd0
movq %r14, %rsi
xorl %eax, %eax
callq 0xd150
jmp 0x102f0
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x10600
testl %eax, %eax
je 0x10312
leaq 0xbc67(%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 0x19(%rsp), %eax
movw %ax, 0x4(%rbx)
movl $0x10, %eax
movl $0xffffffff, (%rbx,%rax,4) # imm = 0xFFFFFFFF
incq %rax
cmpq $0x50, %rax
jne 0x10320
cmpb $0x1, 0x8(%rsp)
jne 0x1034f
xorl %eax, %eax
movl $0x1, 0x40(%rbx,%rax,4)
incq %rax
cmpq $0x40, %rax
jne 0x10339
jmp 0x10406
movq 0x11(%rsp), %xmm0
movq 0x9(%rsp), %xmm1
pxor %xmm2, %xmm2
psadbw %xmm2, %xmm0
movd %xmm0, %eax
psadbw %xmm2, %xmm1
movd %xmm1, %ecx
cmpw $0x20, %cx
ja 0x105db
cmpw $0x20, %ax
ja 0x105db
movl %eax, %edx
addl %ecx, %edx
cmpw $0x40, %dx
ja 0x105db
xorl %eax, %eax
xorl %ecx, %ecx
movzbl 0x9(%rsp,%rax), %edx
testw %dx, %dx
je 0x103c1
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 0x103af
movl %edi, %ecx
incq %rax
cmpq $0x8, %rax
jne 0x10395
xorl %eax, %eax
xorl %ecx, %ecx
movzbl 0x11(%rsp,%rax), %edx
testw %dx, %dx
je 0x103fd
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 0x103e8
movl %edi, %ecx
incq %rax
cmpq $0x8, %rax
jne 0x103ce
movzwl 0x1b(%rsp), %eax
movw %ax, 0xa(%rbx)
movw $0x8, 0xc(%rbx)
movzwl 0x1e(%rsp), %eax
movw %ax, 0xe(%rbx)
movw $0x1, 0x8(%rbx)
movl (%rbx), %esi
movzwl 0x4(%rbx), %r14d
movzwl %si, %edx
shrl $0x10, %esi
cmpb $0x0, 0x8(%rbx)
movzwl 0xa(%rbx), %r12d
movzwl 0xc(%rbx), %ebp
movzwl 0xe(%rbx), %eax
movl %eax, 0x4(%rsp)
leaq 0xba21(%rip), %rdi      # 0x1be6e
leaq 0xba82(%rip), %rax      # 0x1bed6
leaq 0xba7f(%rip), %r15      # 0x1beda
cmoveq %rax, %r15
xorl %eax, %eax
callq 0xd150
movl $0xff, %r13d
movl %r14d, %esi
andl %r13d, %esi
shrl $0x8, %r14d
leaq 0xba06(%rip), %rdi      # 0x1be83
movl %r14d, %edx
xorl %eax, %eax
callq 0xd150
andl %r12d, %r13d
shrl $0x8, %r12d
leaq 0xba05(%rip), %rdi      # 0x1be9a
movl %r13d, %esi
movl %r12d, %edx
xorl %eax, %eax
callq 0xd150
leaq 0xba0d(%rip), %rdi      # 0x1beb6
movq %r15, %rsi
xorl %eax, %eax
callq 0xd150
shll $0x5, %ebp
leaq 0xba23(%rip), %rdi      # 0x1bee0
movl %ebp, %esi
xorl %eax, %eax
callq 0xd150
cvtsi2sdl 0x4(%rsp), %xmm0
mulsd 0xb8f4(%rip), %xmm0     # 0x1bdc8
leaq 0xba26(%rip), %rdi      # 0x1bf01
movb $0x1, %al
callq 0xd150
leaq 0xba90(%rip), %rdi      # 0x1bf79
callq 0xd0c0
leaq 0xbac5(%rip), %rdi      # 0x1bfba
callq 0xd0c0
leaq 0xba79(%rip), %rdi      # 0x1bf7a
callq 0xd0c0
leaq 0xba24(%rip), %rbp      # 0x1bf31
leaq 0xba16(%rip), %r12      # 0x1bf2a
xorl %r15d, %r15d
movq %rbx, 0x20(%rsp)
cmpq $0x20, %r15
leaq 0xba00(%rip), %rsi      # 0x1bf27
leaq 0xb9f6(%rip), %rax      # 0x1bf24
cmovbq %rax, %rsi
leaq 0xb9df(%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 0x1055f
movl $0xa, %edi
callq 0xd050
incq %r15
cmpq $0x40, %r15
movq 0x20(%rsp), %rbx
jne 0x1051c
leaq 0xba50(%rip), %rdi      # 0x1bffa
callq 0xd0c0
leaq 0xceb3(%rip), %rax      # 0x1d469
leaq 0xb8ae(%rip), %rsi      # 0x1be6b
cmpb $0x0, 0x8(%rsp)
cmovneq %rax, %rsi
leaq 0xb881(%rip), %rdi      # 0x1be4e
xorl %ebx, %ebx
xorl %eax, %eax
callq 0xd150
jmp 0x10301
movzwl %ax, %edx
movzwl %cx, %esi
leaq 0xb811(%rip), %rdi      # 0x1bdf9
movl $0x40, %ecx
xorl %eax, %eax
callq 0xd150
leaq 0xb93d(%rip), %rdi      # 0x1bf38
jmp 0x102f7