// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/device.c
// Function: ql_get_netcard_driver_info
int ql_get_netcard_driver_info(const char *devname)
{
    int fd = -1;
    struct ethtool_drvinfo drvinfo;
    struct ifreq ifr;	/* ifreq suitable for ethtool ioctl */

    memset(&ifr, 0, sizeof(ifr));
    strcpy(ifr.ifr_name, devname);

    fd = socket(AF_INET, SOCK_DGRAM, 0);
    if (fd < 0) {
        dbg_time("Cannot get control socket: errno(%d)(%s)", errno, strerror(errno));
        return -1;
    }

    drvinfo.cmd = ETHTOOL_GDRVINFO;
    ifr.ifr_data = (void *)&drvinfo;

    if (ioctl(fd, SIOCETHTOOL, &ifr) < 0) {
        dbg_time("ioctl() error: errno(%d)(%s)", errno, strerror(errno));
        close(fd);
        return -1;
    }

    dbg_time("netcard driver = %s, driver version = %s", drvinfo.driver, drvinfo.version);

    close(fd);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rdi, -0x10(%rbp)
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
leaq -0x100(%rbp), %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x5200
leaq -0x100(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x50a0
movl $0x2, %esi
xorl %edx, %edx
movl %esi, %edi
callq 0x55a0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0x22447
jmp 0x22376
movq 0x14c63(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x118(%rbp)
callq 0x13930
movq %rax, -0x110(%rbp)
callq 0x5070
movl (%rax), %eax
movl %eax, -0x104(%rbp)
callq 0x5070
movl (%rax), %edi
callq 0x5540
movq -0x118(%rbp), %rdi
movq -0x110(%rbp), %rdx
movl -0x104(%rbp), %ecx
movq %rax, %r8
leaq 0xda94(%rip), %rsi      # 0x2fe5e
movb $0x0, %al
callq 0x52c0
leaq 0x15a90(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x22439
leaq 0x15a83(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x130(%rbp)
callq 0x13930
movq %rax, -0x128(%rbp)
callq 0x5070
movl (%rax), %eax
movl %eax, -0x11c(%rbp)
callq 0x5070
movl (%rax), %edi
callq 0x5540
movq -0x130(%rbp), %rdi
movq -0x128(%rbp), %rdx
movl -0x11c(%rbp), %ecx
movq %rax, %r8
leaq 0xda2c(%rip), %rsi      # 0x2fe5e
movb $0x0, %al
callq 0x52c0
jmp 0x2243b
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x22601
movl $0x3, -0xd8(%rbp)
leaq -0xd8(%rbp), %rax
movq %rax, -0xf0(%rbp)
movl -0x14(%rbp), %edi
movl $0x8946, %esi           # imm = 0x8946
leaq -0x100(%rbp), %rdx
movb $0x0, %al
callq 0x5210
cmpl $0x0, %eax
jge 0x22559
jmp 0x22480
movq 0x14b59(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x148(%rbp)
callq 0x13930
movq %rax, -0x140(%rbp)
callq 0x5070
movl (%rax), %eax
movl %eax, -0x134(%rbp)
callq 0x5070
movl (%rax), %edi
callq 0x5540
movq -0x148(%rbp), %rdi
movq -0x140(%rbp), %rdx
movl -0x134(%rbp), %ecx
movq %rax, %r8
leaq 0xd9b9(%rip), %rsi      # 0x2fe8d
movb $0x0, %al
callq 0x52c0
leaq 0x15986(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x22543
leaq 0x15979(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x160(%rbp)
callq 0x13930
movq %rax, -0x158(%rbp)
callq 0x5070
movl (%rax), %eax
movl %eax, -0x14c(%rbp)
callq 0x5070
movl (%rax), %edi
callq 0x5540
movq -0x160(%rbp), %rdi
movq -0x158(%rbp), %rdx
movl -0x14c(%rbp), %ecx
movq %rax, %r8
leaq 0xd951(%rip), %rsi      # 0x2fe8d
movb $0x0, %al
callq 0x52c0
jmp 0x22545
movl -0x14(%rbp), %edi
callq 0x5230
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x22601
jmp 0x2255b
movq 0x14a7e(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x168(%rbp)
callq 0x13930
movq -0x168(%rbp), %rdi
movq %rax, %rdx
leaq -0xd8(%rbp), %rcx
addq $0x4, %rcx
leaq -0xd8(%rbp), %r8
addq $0x24, %r8
leaq 0xd918(%rip), %rsi      # 0x2feb0
movb $0x0, %al
callq 0x52c0
leaq 0x158c2(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x225f0
leaq 0x158b5(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x170(%rbp)
callq 0x13930
movq -0x170(%rbp), %rdi
movq %rax, %rdx
leaq -0xd8(%rbp), %rcx
addq $0x4, %rcx
leaq -0xd8(%rbp), %r8
addq $0x24, %r8
leaq 0xd8c7(%rip), %rsi      # 0x2feb0
movb $0x0, %al
callq 0x52c0
jmp 0x225f2
movl -0x14(%rbp), %edi
callq 0x5230
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
nopl (%rax)