// File: /workspace/github_c_makefile_star2_O2/Carton32[P]quectel-CM/util.c
// Function: ql_get_driver_rmnet_info
void ql_get_driver_rmnet_info(PROFILE_T *profile, RMNET_INFO *rmnet_info) {
    int ifc_ctl_sock;
    struct ifreq ifr;
    int rc;
    int request = 0x89F3;
    unsigned char data[512];

    memset(rmnet_info, 0x00, sizeof(*rmnet_info));

    ifc_ctl_sock = socket(AF_INET, SOCK_DGRAM, 0);
    if (ifc_ctl_sock <= 0) {
        dbg_time("socket() failed: %s\n", strerror(errno));
        return;
    }
    
    memset(&ifr, 0, sizeof(struct ifreq));
    strncpy(ifr.ifr_name, profile->usbnet_adapter, IFNAMSIZ);
    ifr.ifr_name[IFNAMSIZ - 1] = 0;    
    ifr.ifr_ifru.ifru_data = (void *)data;
        
    rc = ioctl(ifc_ctl_sock, request, &ifr);
    if (rc < 0) {
        if (errno != ENOTSUP)
            dbg_time("ioctl(0x%x, qmap_settings) errno:%d (%s), rc=%d", request, errno, strerror(errno), rc);
    }
    else {
        memcpy(rmnet_info, data, sizeof(*rmnet_info));
    }

    close(ifc_ctl_sock);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x230, %rsp            # imm = 0x230
movq %rsi, %r14
movq %rdi, %r15
movl $0xa4, %edx
movq %rsi, %rdi
xorl %esi, %esi
callq 0x5200
pushq $0x2
popq %rdi
movl %edi, %esi
xorl %edx, %edx
callq 0x55b0
testl %eax, %eax
jle 0xeddc
movl %eax, %ebx
xorps %xmm0, %xmm0
leaq 0x8(%rsp), %r12
movups %xmm0, 0x18(%r12)
addq $0xaa, %r15
pushq $0x10
popq %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0x5080
movb $0x0, 0xf(%r12)
leaq 0x30(%rsp), %rax
movq %rax, 0x10(%r12)
movl $0x89f3, %esi           # imm = 0x89F3
movl %ebx, %edi
movq %r12, %rdx
xorl %eax, %eax
callq 0x5210
testl %eax, %eax
js 0xee5b
leaq 0x30(%rsp), %rsi
movl $0xa4, %edx
movq %r14, %rdi
callq 0x52f0
jmp 0xeef0
movq 0x1a1d5(%rip), %rax     # 0x28fb8
movq (%rax), %r14
callq 0xe343
callq 0x5070
movq %rax, %rbx
movl (%rax), %edi
callq 0x5540
leaq 0x1003c(%rip), %rsi     # 0x1ee3d
leaq 0x1aea8(%rip), %rdx     # 0x29cb0
movq %r14, %rdi
movq %rax, %rcx
xorl %eax, %eax
callq 0x52c0
movq 0x1ae8c(%rip), %r14     # 0x29ca8
testq %r14, %r14
je 0xeef7
callq 0xe343
movl (%rbx), %edi
callq 0x5540
leaq 0x10005(%rip), %rsi     # 0x1ee3d
leaq 0x1ae71(%rip), %rdx     # 0x29cb0
movq %r14, %rdi
movq %rax, %rcx
xorl %eax, %eax
addq $0x230, %rsp            # imm = 0x230
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x52c0
movl %eax, %ebp
callq 0x5070
cmpl $0x5f, (%rax)
je 0xeef0
movq %rax, %r14
movq 0x1a143(%rip), %rax     # 0x28fb8
movq (%rax), %r15
callq 0xe343
movl (%r14), %r12d
movl %r12d, %edi
callq 0x5540
movl %ebp, (%rsp)
leaq 0xffc6(%rip), %rsi      # 0x1ee58
leaq 0x1ae17(%rip), %rdx     # 0x29cb0
movq %r15, %rdi
movl $0x89f3, %ecx           # imm = 0x89F3
movl %r12d, %r8d
movq %rax, %r9
xorl %eax, %eax
callq 0x52c0
movq 0x1adf3(%rip), %r15     # 0x29ca8
testq %r15, %r15
je 0xeef0
callq 0xe343
movl (%r14), %r14d
movl %r14d, %edi
callq 0x5540
movl %ebp, (%rsp)
leaq 0xff84(%rip), %rsi      # 0x1ee58
leaq 0x1add5(%rip), %rdx     # 0x29cb0
movq %r15, %rdi
movl $0x89f3, %ecx           # imm = 0x89F3
movl %r14d, %r8d
movq %rax, %r9
xorl %eax, %eax
callq 0x52c0
movl %ebx, %edi
callq 0x5230
addq $0x230, %rsp            # imm = 0x230
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq