// File: /workspace/github_c_makefile_star2_O2/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 0x137d0
testb %al, %al
je 0x1704f
leaq 0x4d8d(%rip), %rdi      # 0x1bdd0
movq %r14, %rsi
xorl %eax, %eax
callq 0xd160
jmp 0x17060
leaq 0xd(%rsp), %rsi
movq %r14, %rdi
callq 0x17360
testl %eax, %eax
je 0x17080
leaq 0x4ef7(%rip), %rdi      # 0x1bf5e
callq 0xd0c0
pushq $-0x1
popq %rbx
movl %ebx, %eax
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
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x1709e
movl $0xffffffff, 0x100(%rbx,%rdx,4) # imm = 0xFFFFFFFF
incq %rdx
jmp 0x17089
cmpb $0x1, 0xd(%rsp)
jne 0x170c0
xorl %eax, %eax
cmpq %rax, %rcx
je 0x17196
movl $0x1, 0x100(%rbx,%rax,4)
incq %rax
jmp 0x170a7
shrl $0x19, %eax
pushq $-0x8
popq %rdx
xorl %edi, %edi
xorl %r8d, %r8d
testq %rdx, %rdx
je 0x170e4
movzbl 0x16(%rsp,%rdx), %esi
addl %esi, %edi
movzbl 0x1e(%rsp,%rdx), %esi
addl %esi, %r8d
incq %rdx
jmp 0x170cb
movzwl %r8w, %edx
movzwl %di, %esi
cmpl %esi, %eax
jb 0x1713b
cmpl %edx, %eax
jb 0x1713b
addl %r8d, %edi
movzwl %di, %edi
cmpl %edi, %ecx
jb 0x1713b
xorl %ecx, %ecx
xorl %edx, %edx
cmpq $0x8, %rcx
je 0x17155
movl %ecx, %esi
shll $0x10, %esi
orl $0x800001, %esi         # imm = 0x800001
movzbl 0xe(%rsp,%rcx), %r8d
movl %r8d, %edi
addl %edx, %edi
subw $0x1, %r8w
jb 0x17134
movzwl %dx, %r9d
movl %esi, 0x100(%rbx,%r9,4)
incl %edx
jmp 0x1711d
incq %rcx
movl %edi, %edx
jmp 0x17101
leaq 0x67bd(%rip), %rdi      # 0x1d8ff
xorl %eax, %eax
callq 0xd160
leaq 0x6839(%rip), %rdi      # 0x1d989
jmp 0x17067
xorl %ecx, %ecx
xorl %edx, %edx
cmpq $0x8, %rcx
je 0x17196
movl %ecx, %esi
shll $0x10, %esi
orl $0x800001, %esi         # imm = 0x800001
movzbl 0x16(%rsp,%rcx), %r8d
movl %r8d, %edi
addl %edx, %edi
subw $0x1, %r8w
jb 0x1718f
movzwl %dx, %r9d
addl %eax, %r9d
movl %esi, 0x100(%rbx,%r9,4)
incl %edx
jmp 0x17175
incq %rcx
movl %edi, %edx
jmp 0x17159
movzwl 0x1e(%rsp), %eax
movw %ax, 0xa(%rbx)
movw $0x8, 0xc(%rbx)
movw $0x1, 0x8(%rbx)
movl (%rbx), %ecx
movl %ecx, %esi
shrl $0x10, %esi
movl %ecx, %edx
shrl $0x8, %edx
movl %ecx, %r14d
shrl $0x18, %r14d
movl %ecx, %eax
shrl $0x19, %eax
movq %rax, 0x20(%rsp)
movl $0xff, %r15d
andl %r15d, %esi
andl %r15d, %edx
andl %r15d, %ecx
cmpb $0x0, 0x8(%rbx)
movzwl 0xa(%rbx), %r12d
movzwl 0xc(%rbx), %r13d
leaq 0x676c(%rip), %rdi      # 0x1d958
leaq 0x4ce3(%rip), %rax      # 0x1bed6
leaq 0x4ce0(%rip), %rbp      # 0x1beda
cmoveq %rax, %rbp
xorl %eax, %eax
callq 0xd160
leaq 0x6762(%rip), %rdi      # 0x1d96e
movq %r14, 0x30(%rsp)
movl %r14d, %esi
xorl %eax, %eax
callq 0xd160
andl %r12d, %r15d
shrl $0x8, %r12d
leaq 0x4c71(%rip), %rdi      # 0x1be9a
movl %r15d, %esi
movl %r12d, %edx
xorl %eax, %eax
callq 0xd160
leaq 0x4c79(%rip), %rdi      # 0x1beb6
movq %rbp, %rsi
xorl %eax, %eax
callq 0xd160
shll $0x6, %r13d
leaq 0x4c8e(%rip), %rdi      # 0x1bee0
movl %r13d, %esi
xorl %eax, %eax
callq 0xd160
leaq 0x4d16(%rip), %rdi      # 0x1bf79
callq 0xd0c0
leaq 0x4d4b(%rip), %rdi      # 0x1bfba
callq 0xd0c0
leaq 0x4cff(%rip), %rdi      # 0x1bf7a
callq 0xd0c0
leaq 0x4caa(%rip), %r15      # 0x1bf31
leaq 0x4c9c(%rip), %rbp      # 0x1bf2a
xorl %r12d, %r12d
movq %rbx, 0x28(%rsp)
cmpq 0x30(%rsp), %r12
je 0x17328
cmpq 0x20(%rsp), %r12
leaq 0x4c7a(%rip), %rsi      # 0x1bf27
leaq 0x4c70(%rip), %rax      # 0x1bf24
cmovbq %rax, %rsi
xorl %r13d, %r13d
leaq 0x4c56(%rip), %rdi      # 0x1bf18
movl %r12d, %edx
xorl %eax, %eax
callq 0xd160
movl 0x100(%rbx,%r12,4), %ebx
movl %ebx, %r14d
andl $0x800000, %r14d        # imm = 0x800000
shrl $0x10, %ebx
andl $0x7f, %ebx
incl %ebx
cmpl $0x9, %r13d
je 0x17313
cmpl %r13d, %ebx
movq %rbp, %rdi
cmovneq %r15, %rdi
testl %r14d, %r14d
cmoveq %r15, %rdi
movl %r13d, %eax
orl %r14d, %eax
cmoveq %rbp, %rdi
xorl %eax, %eax
callq 0xd160
incl %r13d
jmp 0x172e6
pushq $0xa
popq %rdi
callq 0xd050
incq %r12
movq 0x28(%rsp), %rbx
jmp 0x17296
leaq 0x4ccb(%rip), %rdi      # 0x1bffa
callq 0xd0c0
leaq 0x60de(%rip), %rax      # 0x1d419
leaq 0x4b29(%rip), %rsi      # 0x1be6b
cmpb $0x0, 0xd(%rsp)
cmovneq %rax, %rsi
leaq 0x4afc(%rip), %rdi      # 0x1be4e
xorl %ebx, %ebx
xorl %eax, %eax
callq 0xd160
jmp 0x1706f