// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/quectel-mbim-proxy.c
// Function: handle_device_response
static int handle_device_response(void *pdata, int len)
{
    int i;
    MBIM_MESSAGE_HEADER *pResponse = (MBIM_MESSAGE_HEADER *)pdata;
    unsigned int  TransactionId = le32toh(pResponse->TransactionId);

    /* unsocial/function error message */
    if (TransactionId == 0) {
        for (i = 0; i < CM_MAX_CLIENT; i++) {
            if (cm_clients[i].client_fd > 0) {
                non_block_write(cm_clients[i].client_fd, pResponse, len);
            }
        }
    }
    else {
        /* try to find the sender */
        int client_idx = (TransactionId >> TID_SHIFT);

        for (i = 0; i < CM_MAX_CLIENT; i++) {
            if (cm_clients[i].client_idx == client_idx && cm_clients[i].client_fd > 0) {
                TransactionId &= TID_MASK;
                pResponse->TransactionId = htole32(TransactionId);
                if (verbose) mbim_debug("RSP client_fd=%d, client_idx=%d, tid=%u\n",
                    cm_clients[i].client_fd, cm_clients[i].client_idx, TransactionId);
                non_block_write(cm_clients[i].client_fd, pResponse, len);
                break;
            }
        }

        if (i == CM_MAX_CLIENT) {
           mbim_debug("%s nobody care tid=%u\n", __func__, TransactionId);     
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %edi
callq 0x1c60
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x2366
movl $0x0, -0x10(%rbp)
cmpl $0x20, -0x10(%rbp)
jge 0x2361
movslq -0x10(%rbp), %rcx
leaq 0x2e4c(%rip), %rax      # 0x5180
cmpl $0x0, (%rax,%rcx,8)
jle 0x2354
movslq -0x10(%rbp), %rcx
leaq 0x2e3b(%rip), %rax      # 0x5180
movl (%rax,%rcx,8), %edi
movq -0x18(%rbp), %rsi
movl -0xc(%rbp), %edx
callq 0x1c70
jmp 0x2356
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x2323
jmp 0x248b
movl -0x1c(%rbp), %eax
shrl $0x18, %eax
movl %eax, -0x20(%rbp)
movl $0x0, -0x10(%rbp)
cmpl $0x20, -0x10(%rbp)
jge 0x244c
movslq -0x10(%rbp), %rcx
leaq 0x2df5(%rip), %rax      # 0x5180
movl 0x4(%rax,%rcx,8), %eax
cmpl -0x20(%rbp), %eax
jne 0x243c
movslq -0x10(%rbp), %rcx
leaq 0x2ddd(%rip), %rax      # 0x5180
cmpl $0x0, (%rax,%rcx,8)
jle 0x243c
movl -0x1c(%rbp), %eax
andl $0xffffff, %eax         # imm = 0xFFFFFF
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %edi
callq 0x1c60
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x8(%rax)
cmpl $0x0, 0x2da0(%rip)      # 0x5170
je 0x2420
jmp 0x23d4
movq 0x2bf5(%rip), %rax      # 0x4fd0
movq (%rax), %rax
movq %rax, -0x28(%rbp)
callq 0x12a0
movq -0x28(%rbp), %rdi
movq %rax, %rdx
movslq -0x10(%rbp), %rcx
leaq 0x2d87(%rip), %rax      # 0x5180
movl (%rax,%rcx,8), %ecx
movslq -0x10(%rbp), %rsi
leaq 0x2d79(%rip), %rax      # 0x5180
movl 0x4(%rax,%rsi,8), %r8d
movl -0x1c(%rbp), %r9d
leaq 0xf3e(%rip), %rsi       # 0x3355
movb $0x0, %al
callq 0x10f0
jmp 0x2420
movslq -0x10(%rbp), %rcx
leaq 0x2d55(%rip), %rax      # 0x5180
movl (%rax,%rcx,8), %edi
movq -0x18(%rbp), %rsi
movl -0xc(%rbp), %edx
callq 0x1c70
jmp 0x244c
jmp 0x243e
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x2376
cmpl $0x20, -0x10(%rbp)
jne 0x2489
jmp 0x2454
movq 0x2b75(%rip), %rax      # 0x4fd0
movq (%rax), %rax
movq %rax, -0x30(%rbp)
callq 0x12a0
movq -0x30(%rbp), %rdi
movq %rax, %rdx
movl -0x1c(%rbp), %r8d
leaq 0xf08(%rip), %rsi       # 0x3381
leaq 0xf1b(%rip), %rcx       # 0x339b
movb $0x0, %al
callq 0x10f0
jmp 0x2489
jmp 0x248b
xorl %eax, %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)