// File: /workspace/github_c_makefile_star2_O3/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 0x13a38
testb %al, %al
je 0x17493
leaq 0x4949(%rip), %rdi      # 0x1bdd0
movq %r14, %rsi
xorl %eax, %eax
callq 0xd150
jmp 0x174a4
leaq 0x15(%rsp), %rsi
movq %r14, %rdi
callq 0x177d0
testl %eax, %eax
je 0x174c4
leaq 0x4ab3(%rip), %rdi      # 0x1bf5e
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
jae 0x174de
cmpb $0x0, 0x15(%rsp)
je 0x17514
jmp 0x175d3
xorl %edx, %edx
movl $0xffffffff, 0x100(%rbx,%rdx,4) # imm = 0xFFFFFFFF
incq %rdx
cmpq %rdx, %rcx
jne 0x174e0
cmpb $0x1, 0x15(%rsp)
jne 0x17514
xorl %eax, %eax
movl $0x1, 0x100(%rbx,%rax,4)
incq %rax
cmpq %rax, %rcx
jne 0x174fc
jmp 0x175d3
shrl $0x19, %eax
movq 0x1e(%rsp), %xmm0
movq 0x16(%rsp), %xmm1
pxor %xmm2, %xmm2
psadbw %xmm2, %xmm0
movd %xmm0, %edx
psadbw %xmm2, %xmm1
movd %xmm1, %esi
cmpl %esi, %eax
jb 0x177b6
cmpl %edx, %eax
jb 0x177b6
leal (%rdx,%rsi), %edi
cmpl %edi, %ecx
jb 0x177b6
xorl %ecx, %ecx
xorl %edx, %edx
movzbl 0x16(%rsp,%rcx), %esi
testw %si, %si
je 0x17588
movl %ecx, %edi
shll $0x10, %edi
orl $0x800001, %edi         # imm = 0x800001
movzwl %si, %r8d
addl %edx, %r8d
movzwl %dx, %r9d
movl %edi, 0x100(%rbx,%r9,4)
incl %edx
decw %si
jne 0x17572
movl %r8d, %edx
incq %rcx
cmpq $0x8, %rcx
jne 0x17556
xorl %ecx, %ecx
xorl %edx, %edx
movzbl 0x1e(%rsp,%rcx), %esi
testw %si, %si
je 0x175ca
movl %ecx, %edi
shll $0x10, %edi
orl $0x800001, %edi         # imm = 0x800001
movzwl %si, %r8d
addl %edx, %r8d
movzwl %dx, %r9d
addl %eax, %r9d
movl %edi, 0x100(%rbx,%r9,4)
incl %edx
decw %si
jne 0x175b1
movl %r8d, %edx
incq %rcx
cmpq $0x8, %rcx
jne 0x17595
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 0x6384(%rip), %rdi      # 0x1d9a8
leaq 0x48ab(%rip), %rax      # 0x1bed6
leaq 0x48a8(%rip), %r8       # 0x1beda
cmoveq %rax, %r8
movq %r8, 0x8(%rsp)
xorl %eax, %eax
callq 0xd150
leaq 0x6375(%rip), %rdi      # 0x1d9be
movq %r13, 0x30(%rsp)
movl %r13d, %esi
xorl %eax, %eax
callq 0xd150
andl %r15d, %r12d
shrl $0x8, %r15d
leaq 0x4834(%rip), %rdi      # 0x1be9a
movl %r12d, %esi
movl %r15d, %edx
xorl %eax, %eax
callq 0xd150
leaq 0x483c(%rip), %rdi      # 0x1beb6
movq 0x8(%rsp), %rsi
xorl %eax, %eax
callq 0xd150
shll $0x6, %ebp
leaq 0x4850(%rip), %rdi      # 0x1bee0
movl %ebp, %esi
xorl %eax, %eax
callq 0xd150
leaq 0x48d9(%rip), %rdi      # 0x1bf79
callq 0xd0c0
leaq 0x490e(%rip), %rdi      # 0x1bfba
callq 0xd0c0
leaq 0x48c2(%rip), %rdi      # 0x1bf7a
callq 0xd0c0
movq %r14, 0x8(%rsp)
cmpq $0x1000000, %r14        # imm = 0x1000000
jb 0x1777e
movq 0x8(%rsp), %rax
shrl $0x19, %eax
movq %rax, 0x8(%rsp)
leaq 0x484e(%rip), %rbp      # 0x1bf31
leaq 0x4840(%rip), %r15      # 0x1bf2a
xorl %r12d, %r12d
movq %rbx, 0x28(%rsp)
cmpq 0x8(%rsp), %r12
leaq 0x4829(%rip), %rsi      # 0x1bf27
leaq 0x481f(%rip), %rax      # 0x1bf24
cmovbq %rax, %rsi
leaq 0x4808(%rip), %rdi      # 0x1bf18
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 0x17739
movl $0xa, %edi
callq 0xd050
incq %r12
cmpq 0x30(%rsp), %r12
movq 0x28(%rsp), %rbx
jne 0x176f2
leaq 0x4875(%rip), %rdi      # 0x1bffa
callq 0xd0c0
leaq 0x5cd8(%rip), %rax      # 0x1d469
leaq 0x46d3(%rip), %rsi      # 0x1be6b
cmpb $0x0, 0x15(%rsp)
cmovneq %rax, %rsi
leaq 0x46a6(%rip), %rdi      # 0x1be4e
xorl %eax, %eax
callq 0xd150
xorl %eax, %eax
jmp 0x174b5
leaq 0x6192(%rip), %rdi      # 0x1d94f
xorl %eax, %eax
callq 0xd150
leaq 0x620e(%rip), %rdi      # 0x1d9d9
jmp 0x174ab