// File: /workspace/github_c_makefile_star2_O2/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, %r15
movq %rdi, %rbx
callq 0x5160
movq %rax, %r14
xorps %xmm0, %xmm0
movups %xmm0, (%r15)
movups %xmm0, 0x10(%r15)
movups %xmm0, 0x20(%r15)
xorl %r12d, %r12d
movb %r12b, (%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)
pushq $0x10
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x170fb
movl %eax, 0x4(%r15)
movb %r12b, (%rbx,%r14)
movq %rbx, %rdi
callq 0x5160
movb %r12b, 0x10(%rbx,%rax)
movups 0xad27(%rip), %xmm0     # 0x20e98
movups %xmm0, (%rbx,%rax)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x170fb
movl %eax, 0x4(%r15)
movb %r12b, (%rbx,%r14)
movq %rbx, %rdi
callq 0x5160
movups 0xad13(%rip), %xmm0     # 0x20ea9
movups %xmm0, (%rbx,%rax)
movl $0x737361, 0x10(%rbx,%rax) # imm = 0x737361
movq %rbx, %rdi
movl %ebp, %esi
callq 0x170fb
movl %eax, 0x8(%r15)
movb %r12b, (%rbx,%r14)
movq %rbx, %rdi
callq 0x5160
movups 0xacfa(%rip), %xmm0     # 0x20ebd
movups %xmm0, (%rbx,%rax)
movl $0x6c6f63, 0x10(%rbx,%rax) # imm = 0x6C6F63
movq %rbx, %rdi
movl %ebp, %esi
callq 0x170fb
movl %eax, 0xc(%r15)
movb %r12b, (%rbx,%r14)
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 0x162b2
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movb $0x0, (%rsp,%rax)
leaq 0x131b1(%rip), %rax     # 0x293d0
cmpl $0x0, (%rax)
je 0x16275
movq 0x12d8d(%rip), %rax     # 0x28fb8
movq (%rax), %r12
callq 0xe343
leaq 0xac97(%rip), %rsi      # 0x20ed1
movq %rsp, %rcx
movq %r12, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
leaq 0x13a57(%rip), %rax     # 0x29ca8
movq (%rax), %r12
testq %r12, %r12
je 0x16275
callq 0xe343
leaq 0xac6c(%rip), %rsi      # 0x20ed1
movq %rsp, %rcx
movq %r12, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
movq %rsp, %r12
movq %r12, %rdi
callq 0x5160
movl %eax, %ecx
sarl $0x1f, %ecx
andl %eax, %ecx
testl %eax, %eax
jle 0x16299
movl %eax, %edx
cmpb $0x2f, (%rsp,%rdx)
je 0x16297
decl %eax
jmp 0x16287
movl %eax, %ecx
addq $0x10, %r15
movslq %ecx, %rax
leaq (%rax,%r12), %rsi
incq %rsi
pushq $0x20
popq %rdx
movq %r15, %rdi
callq 0x5080
movb $0x0, (%rbx,%r14)
addq $0x80, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq