// File: /workspace/github_c_makefile_star2_O1/intel[P]pf-bb-config/agx100/agx100_cfg_app.c
// Function: agx100_configure
int
agx100_configure(void *dev, void *bar0addr, const char *cfg_filename, const bool first_cfg)
{
	struct agx100_conf agx100_conf;
	int ret;

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

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

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movq %rdx, %rdi
callq 0x13c09
testb %al, %al
je 0x1775f
leaq 0x466d(%rip), %rdi      # 0x1bdc0
movq %r14, %rsi
xorl %eax, %eax
callq 0xd150
jmp 0x17770
leaq 0x15(%rsp), %rsi
movq %r14, %rdi
callq 0x17a94
testl %eax, %eax
je 0x17790
leaq 0x47d7(%rip), %rdi      # 0x1bf4e
callq 0xd0c0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl (%rbx), %eax
movl %eax, %ecx
shrl $0x18, %ecx
cmpl $0x1000000, %eax        # imm = 0x1000000
jb 0x177b3
xorl %edx, %edx
movl $0xffffffff, 0x100(%rbx,%rdx,4) # imm = 0xFFFFFFFF
incq %rdx
cmpq %rdx, %rcx
jne 0x177a0
cmpb $0x0, 0x15(%rsp)
je 0x177e1
cmpl $0x1000000, %eax        # imm = 0x1000000
jb 0x17897
movl %ecx, %eax
xorl %ecx, %ecx
movl $0x1, 0x100(%rbx,%rcx,4)
incq %rcx
cmpq %rcx, %rax
jne 0x177c9
jmp 0x17897
shrl $0x19, %eax
movq $-0x8, %rdx
xorl %edi, %edi
xorl %r8d, %r8d
movzbl 0x1e(%rsp,%rdx), %esi
addl %esi, %r8d
movzbl 0x26(%rsp,%rdx), %esi
addl %esi, %edi
incq %rdx
jne 0x177f0
movzwl %di, %edx
movzwl %r8w, %esi
cmpl %esi, %eax
jb 0x17a7a
cmpl %edx, %eax
jb 0x17a7a
addl %edi, %r8d
movzwl %r8w, %edi
cmpl %edi, %ecx
jb 0x17a7a
xorl %ecx, %ecx
xorl %edx, %edx
movzbl 0x16(%rsp,%rcx), %esi
testw %si, %si
je 0x17856
movl %ecx, %edi
shll $0x10, %edi
orl $0x800001, %edi         # imm = 0x800001
movzwl %dx, %r8d
movl %edi, 0x100(%rbx,%r8,4)
incl %edx
decw %si
jne 0x17843
incq %rcx
cmpq $0x8, %rcx
jne 0x1782e
xorl %ecx, %ecx
xorl %edx, %edx
movzbl 0x1e(%rsp,%rcx), %esi
testw %si, %si
je 0x1788e
movl %ecx, %edi
shll $0x10, %edi
orl $0x800001, %edi         # imm = 0x800001
movzwl %dx, %r8d
addl %eax, %r8d
movl %edi, 0x100(%rbx,%r8,4)
incl %edx
decw %si
jne 0x17878
incq %rcx
cmpq $0x8, %rcx
jne 0x17863
movzwl 0x26(%rsp), %eax
movw %ax, 0xa(%rbx)
movw $0x8, 0xc(%rbx)
movw $0x1, 0x8(%rbx)
movl (%rbx), %r14d
movl %r14d, %esi
shrl $0x10, %esi
movl %r14d, %edx
shrl $0x8, %edx
movl %r14d, %r13d
shrl $0x18, %r13d
movl $0xff, %r12d
andl %r12d, %esi
andl %r12d, %edx
movl %r14d, %ecx
andl %r12d, %ecx
cmpb $0x0, 0x8(%rbx)
movzwl 0xa(%rbx), %r15d
movzwl 0xc(%rbx), %ebp
leaq 0x6090(%rip), %rdi      # 0x1d978
leaq 0x45d7(%rip), %rax      # 0x1bec6
leaq 0x45d4(%rip), %r8       # 0x1beca
cmoveq %rax, %r8
movq %r8, 0x8(%rsp)
xorl %eax, %eax
callq 0xd150
leaq 0x6081(%rip), %rdi      # 0x1d98e
movq %r13, 0x30(%rsp)
movl %r13d, %esi
xorl %eax, %eax
callq 0xd150
andl %r15d, %r12d
shrl $0x8, %r15d
leaq 0x4560(%rip), %rdi      # 0x1be8a
movl %r12d, %esi
movl %r15d, %edx
xorl %eax, %eax
callq 0xd150
leaq 0x4568(%rip), %rdi      # 0x1bea6
movq 0x8(%rsp), %rsi
xorl %eax, %eax
callq 0xd150
shll $0x6, %ebp
leaq 0x457c(%rip), %rdi      # 0x1bed0
movl %ebp, %esi
xorl %eax, %eax
callq 0xd150
leaq 0x4605(%rip), %rdi      # 0x1bf69
callq 0xd0c0
leaq 0x463a(%rip), %rdi      # 0x1bfaa
callq 0xd0c0
leaq 0x45ee(%rip), %rdi      # 0x1bf6a
callq 0xd0c0
movq %r14, 0x8(%rsp)
cmpq $0x1000000, %r14        # imm = 0x1000000
jb 0x17a42
movq 0x8(%rsp), %rax
shrl $0x19, %eax
movq %rax, 0x8(%rsp)
leaq 0x457a(%rip), %rbp      # 0x1bf21
leaq 0x456c(%rip), %r15      # 0x1bf1a
xorl %r12d, %r12d
movq %rbx, 0x28(%rsp)
cmpq 0x8(%rsp), %r12
leaq 0x4555(%rip), %rsi      # 0x1bf17
leaq 0x454b(%rip), %rax      # 0x1bf14
cmovbq %rax, %rsi
leaq 0x4534(%rip), %rdi      # 0x1bf08
movl %r12d, %edx
xorl %eax, %eax
callq 0xd150
movl 0x100(%rbx,%r12,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 %r15, %rdi
cmovneq %rbp, %rdi
testl %r13d, %r13d
cmoveq %rbp, %rdi
movl %ebx, %eax
orl %r13d, %eax
cmoveq %r15, %rdi
xorl %eax, %eax
callq 0xd150
incl %ebx
cmpl $0x9, %ebx
jne 0x179fd
movl $0xa, %edi
callq 0xd050
incq %r12
cmpq 0x30(%rsp), %r12
movq 0x28(%rsp), %rbx
jne 0x179b6
leaq 0x45a1(%rip), %rdi      # 0x1bfea
callq 0xd0c0
leaq 0x59f4(%rip), %rax      # 0x1d449
leaq 0x43ff(%rip), %rsi      # 0x1be5b
cmpb $0x0, 0x15(%rsp)
cmovneq %rax, %rsi
leaq 0x43d2(%rip), %rdi      # 0x1be3e
xorl %eax, %eax
callq 0xd150
xorl %eax, %eax
jmp 0x17781
leaq 0x5e9e(%rip), %rdi      # 0x1d91f
xorl %eax, %eax
callq 0xd150
leaq 0x5f1a(%rip), %rdi      # 0x1d9a9
jmp 0x17777