// File: /workspace/github_c_makefile_star2_O1/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 $0x240, %rsp            # imm = 0x240
movq %rsi, %r14
movq %rdi, %r15
movl $0xa4, %edx
movq %rsi, %rdi
xorl %esi, %esi
callq 0x5200
movl $0x2, %edi
movl $0x2, %esi
xorl %edx, %edx
callq 0x55a0
testl %eax, %eax
jle 0xf667
movl %eax, %ebx
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r12
movaps %xmm0, 0x10(%r12)
movaps %xmm0, (%r12)
movq $0x0, 0x20(%r12)
addq $0xaa, %r15
movl $0x10, %edx
movq %r12, %rdi
movq %r15, %rsi
callq 0x5080
movb $0x0, 0xf(%r12)
leaq 0x40(%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 0xf6e6
leaq 0x40(%rsp), %rsi
movl $0xa4, %edx
movq %r14, %rdi
callq 0x52f0
jmp 0xf77b
movq 0x1a952(%rip), %rax     # 0x29fc0
movq (%rax), %r14
callq 0xeb2f
callq 0x5070
movq %rax, %rbx
movl (%rax), %edi
callq 0x5530
leaq 0x1179f(%rip), %rsi     # 0x20e2b
leaq 0x1b61d(%rip), %rdx     # 0x2acb0
movq %r14, %rdi
movq %rax, %rcx
xorl %eax, %eax
callq 0x52c0
movq 0x1b601(%rip), %r14     # 0x2aca8
testq %r14, %r14
je 0xf782
callq 0xeb2f
movl (%rbx), %edi
callq 0x5530
leaq 0x11768(%rip), %rsi     # 0x20e2b
leaq 0x1b5e6(%rip), %rdx     # 0x2acb0
movq %r14, %rdi
movq %rax, %rcx
xorl %eax, %eax
addq $0x240, %rsp            # imm = 0x240
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x52c0
movl %eax, %ebp
callq 0x5070
cmpl $0x5f, (%rax)
je 0xf77b
movq %rax, %r14
movq 0x1a8c0(%rip), %rax     # 0x29fc0
movq (%rax), %r15
callq 0xeb2f
movl (%r14), %r12d
movl %r12d, %edi
callq 0x5530
movl %ebp, (%rsp)
leaq 0x11729(%rip), %rsi     # 0x20e46
leaq 0x1b58c(%rip), %rdx     # 0x2acb0
movq %r15, %rdi
movl $0x89f3, %ecx           # imm = 0x89F3
movl %r12d, %r8d
movq %rax, %r9
xorl %eax, %eax
callq 0x52c0
movq 0x1b568(%rip), %r15     # 0x2aca8
testq %r15, %r15
je 0xf77b
callq 0xeb2f
movl (%r14), %r14d
movl %r14d, %edi
callq 0x5530
movl %ebp, (%rsp)
leaq 0x116e7(%rip), %rsi     # 0x20e46
leaq 0x1b54a(%rip), %rdx     # 0x2acb0
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 $0x240, %rsp            # imm = 0x240
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq