// File: /workspace/github_c_makefile_star2_O3/Carton32[P]quectel-CM/device.c
// Function: query_usb_interface_info
static void query_usb_interface_info(char *path, struct usb_interface_info *p) {
    char driver[128];
    size_t offset = strlen(path);
    int n;

    memset(p, 0, sizeof(*p));

    path[offset] = '\0';
    strcat(path, "/bNumEndpoints");
    p->bInterfaceClass = file_get_value(path, 16);

    path[offset] = '\0';
    strcat(path, "/bInterfaceClass");
    p->bInterfaceClass = file_get_value(path, 16);

    path[offset] = '\0';
    strcat(path, "/bInterfaceSubClass");
    p->bInterfaceSubClass = file_get_value(path, 16);

    path[offset] = '\0';
    strcat(path, "/bInterfaceProtocol");
    p->bInterfaceProtocol = file_get_value(path, 16);

    path[offset] = '\0';
    strcat(path, "/driver");
    n = readlink(path, driver, sizeof(driver));
    if (n > 0) {
        driver[n] = 0;
        if (debug_qmi) dbg_time("driver -> %s", driver);
        n = strlen(driver);
        while (n > 0) {
            if (driver[n] == '/')
                break;
            n--;
        }
        strncpy(p->driver, &driver[n+1], sizeof(p->driver));
    }

    path[offset] = '\0';
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x80, %rsp
movq %rsi, %r14
movq %rdi, %rbx
callq 0x5160
movq %rax, %r15
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movups %xmm0, 0x10(%r14)
movups %xmm0, 0x20(%r14)
xorl %ebp, %ebp
movb %bpl, (%rbx,%rax)
movq %rbx, %rdi
callq 0x5160
movabsq $0x646e456d754e622f, %rcx # imm = 0x646E456D754E622F
movq %rcx, (%rbx,%rax)
movabsq $0x73746e696f7064, %rcx # imm = 0x73746E696F7064
movq %rcx, 0x7(%rbx,%rax)
movq %rbx, %rdi
movl $0x10, %esi
callq 0x181f3
movl %eax, 0x4(%r14)
movb %bpl, (%rbx,%r15)
movq %rbx, %rdi
callq 0x5160
movb %bpl, 0x10(%rbx,%rax)
movups 0xbc63(%rip), %xmm0     # 0x22e78
movups %xmm0, (%rbx,%rax)
movq %rbx, %rdi
movl $0x10, %esi
callq 0x181f3
movl %eax, 0x4(%r14)
movb %bpl, (%rbx,%r15)
movq %rbx, %rdi
callq 0x5160
movups 0xbc4c(%rip), %xmm0     # 0x22e89
movups %xmm0, (%rbx,%rax)
movl $0x737361, 0x10(%rbx,%rax) # imm = 0x737361
movq %rbx, %rdi
movl $0x10, %esi
callq 0x181f3
movl %eax, 0x8(%r14)
movb %bpl, (%rbx,%r15)
movq %rbx, %rdi
callq 0x5160
movups 0xbc30(%rip), %xmm0     # 0x22e9d
movups %xmm0, (%rbx,%rax)
movl $0x6c6f63, 0x10(%rbx,%rax) # imm = 0x6C6F63
movq %rbx, %rdi
movl $0x10, %esi
callq 0x181f3
movl %eax, 0xc(%r14)
movb %bpl, (%rbx,%r15)
movq %rbx, %rdi
callq 0x5160
movabsq $0x7265766972642f, %rcx # imm = 0x7265766972642F
movq %rcx, (%rbx,%rax)
movq %rsp, %rsi
movl $0x80, %edx
movq %rbx, %rdi
callq 0x50d0
testl %eax, %eax
jle 0x1735f
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movb $0x0, (%rsp,%rax)
leaq 0x13104(%rip), %rax     # 0x2a3d0
cmpl $0x0, (%rax)
je 0x17322
movq 0x12ce8(%rip), %rax     # 0x29fc0
movq (%rax), %r12
callq 0xea3b
leaq 0xbbca(%rip), %rsi      # 0x22eb1
movq %rsp, %rcx
movq %r12, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
leaq 0x139aa(%rip), %rax     # 0x2aca8
movq (%rax), %r12
testq %r12, %r12
je 0x17322
callq 0xea3b
leaq 0xbb9f(%rip), %rsi      # 0x22eb1
movq %rsp, %rcx
movq %r12, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
movq %rsp, %r12
movq %r12, %rdi
callq 0x5160
testl %eax, %eax
jle 0x17345
movl %eax, %ecx
cmpb $0x2f, (%rsp,%rcx)
je 0x17345
leal -0x1(%rax), %ecx
cmpl $0x1, %eax
movl %ecx, %eax
jg 0x17331
xorl %eax, %eax
addq $0x10, %r14
cltq
leaq (%rax,%r12), %rsi
incq %rsi
movl $0x20, %edx
movq %r14, %rdi
callq 0x5080
movb $0x0, (%rbx,%r15)
addq $0x80, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq