// File: /workspace/github_c_makefile_star2_O1/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 0x18425
movl %eax, 0x4(%r14)
movb %bpl, (%rbx,%r15)
movq %rbx, %rdi
callq 0x5160
movb %bpl, 0x10(%rbx,%rax)
movups 0xba11(%rip), %xmm0     # 0x22e58
movups %xmm0, (%rbx,%rax)
movq %rbx, %rdi
movl $0x10, %esi
callq 0x18425
movl %eax, 0x4(%r14)
movb %bpl, (%rbx,%r15)
movq %rbx, %rdi
callq 0x5160
movups 0xb9fa(%rip), %xmm0     # 0x22e69
movups %xmm0, (%rbx,%rax)
movl $0x737361, 0x10(%rbx,%rax) # imm = 0x737361
movq %rbx, %rdi
movl $0x10, %esi
callq 0x18425
movl %eax, 0x8(%r14)
movb %bpl, (%rbx,%r15)
movq %rbx, %rdi
callq 0x5160
movups 0xb9de(%rip), %xmm0     # 0x22e7d
movups %xmm0, (%rbx,%rax)
movl $0x6c6f63, 0x10(%rbx,%rax) # imm = 0x6C6F63
movq %rbx, %rdi
movl $0x10, %esi
callq 0x18425
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 0x17591
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movb $0x0, (%rsp,%rax)
leaq 0x12ed2(%rip), %rax     # 0x2a3d0
cmpl $0x0, (%rax)
je 0x17554
movq 0x12ab6(%rip), %rax     # 0x29fc0
movq (%rax), %r12
callq 0xeb2f
leaq 0xb978(%rip), %rsi      # 0x22e91
movq %rsp, %rcx
movq %r12, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
leaq 0x13778(%rip), %rax     # 0x2aca8
movq (%rax), %r12
testq %r12, %r12
je 0x17554
callq 0xeb2f
leaq 0xb94d(%rip), %rsi      # 0x22e91
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 0x17577
movl %eax, %ecx
cmpb $0x2f, (%rsp,%rcx)
je 0x17577
leal -0x1(%rax), %ecx
cmpl $0x1, %eax
movl %ecx, %eax
jg 0x17563
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