// File: /workspace/github_c_makefile_star2_O0/connycommy[P]atCmdDevice/src/cellularModem/cellModem.c
// Function: cellModem_SocketGetRecv
cmError_t cellModem_SocketGetRecv(cmData_t *obj, socketData_t *config){  
    cmError_t retVal;
    char bufferRecv[1024]={0};
    char cmd[32]="AT+QIRD=";
    char *ptr = NULL;
    char  buffer[1024] ={0};
    config->msgLen = 0;

    sprintf(buffer,"%d,%d\r",config->connectId, (config->buffRcvLen <= 0 ? CM_BUFFER_LEN_DEF :config->buffRcvLen) );
    ptr  = strcat(cmd,buffer);
    
    retVal = cmSendCmd(obj,cmd , (0 == cellModem_GetatvFormat(obj) ) ? CELLMODEM_CMD_GENERAL_RESPONSE_ATV0 :CELLMODEM_CMD_GENERAL_RESPONSE  ,bufferRecv ,2000); //2 sg
    
    if(CM_OK == retVal){
        ptr = NULL;
        memset(buffer,0,sizeof(buffer));
        if(config->msgRecv != NULL){
            memset((void*)config->msgRecv,0,CM_BUFFER_LEN_DEF); 
        }
        if( (ptr = strstr(bufferRecv,"+QIRD:")) != NULL ){
            if(config != NULL){
                ptr = extractBetween(bufferRecv,' ','\r',buffer,0);
                config->msgLen = (size_t)atoi(buffer);

                if( (config->msgLen > 0) && (config->msgRecv != NULL)){
                    memcpy((void*) config->msgRecv,ptr+2 , config->msgLen);
                }
            }
        }else{
           // retVal = CM_ERR_INVALID_RESPONSE;
        }
    }
    return retVal;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x880, %rsp            # imm = 0x880
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x420(%rbp), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x10a0
movq 0x7093(%rip), %rax      # 0xa850
movq %rax, -0x440(%rbp)
movq 0x708d(%rip), %rax      # 0xa858
movq %rax, -0x438(%rbp)
movq 0x7087(%rip), %rax      # 0xa860
movq %rax, -0x430(%rbp)
movq 0x7081(%rip), %rax      # 0xa868
movq %rax, -0x428(%rbp)
movq $0x0, -0x448(%rbp)
leaq -0x850(%rbp), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x10a0
movq -0x10(%rbp), %rax
movq $0x0, 0x38(%rax)
leaq -0x850(%rbp), %rax
movq %rax, -0x860(%rbp)
movq -0x10(%rbp), %rax
movl 0x4c(%rax), %eax
movl %eax, -0x854(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x40(%rax)
ja 0x384c
movl $0x400, %eax            # imm = 0x400
movq %rax, -0x868(%rbp)
jmp 0x385b
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x868(%rbp)
movl -0x854(%rbp), %edx
movq -0x860(%rbp), %rdi
movq -0x868(%rbp), %rcx
leaq 0x6862(%rip), %rsi      # 0xa0d8
movb $0x0, %al
callq 0x1100
leaq -0x440(%rbp), %rdi
leaq -0x850(%rbp), %rsi
callq 0x10f0
movq %rax, -0x448(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x878(%rbp)
leaq -0x440(%rbp), %rax
movq %rax, -0x870(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1cf0
movq -0x878(%rbp), %rdi
movq -0x870(%rbp), %rsi
movl %eax, %r8d
xorl %ecx, %ecx
leaq 0x747f(%rip), %rdx      # 0xad52
leaq 0x72f8(%rip), %rax      # 0xabd2
cmpl %r8d, %ecx
cmoveq %rax, %rdx
leaq -0x420(%rbp), %rcx
movl $0x7d0, %r8d            # imm = 0x7D0
callq 0x1390
movl %eax, -0x14(%rbp)
xorl %eax, %eax
cmpl -0x14(%rbp), %eax
jne 0x39e1
movq $0x0, -0x448(%rbp)
leaq -0x850(%rbp), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x10a0
movq -0x10(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x393e
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x10a0
leaq -0x420(%rbp), %rdi
leaq 0x6793(%rip), %rsi      # 0xa0df
callq 0x1110
movq %rax, -0x448(%rbp)
cmpq $0x0, %rax
je 0x39dd
cmpq $0x0, -0x10(%rbp)
je 0x39db
leaq -0x420(%rbp), %rdi
leaq -0x850(%rbp), %rcx
movl $0x20, %esi
movl $0xd, %edx
xorl %r8d, %r8d
callq 0x1d10
movq %rax, -0x448(%rbp)
leaq -0x850(%rbp), %rdi
callq 0x10e0
movslq %eax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x38(%rax)
jbe 0x39d9
movq -0x10(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x39d9
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
movq -0x448(%rbp), %rsi
addq $0x2, %rsi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdx
callq 0x10c0
jmp 0x39db
jmp 0x39df
jmp 0x39df
jmp 0x39e1
movl -0x14(%rbp), %eax
addq $0x880, %rsp            # imm = 0x880
popq %rbp
retq
nopl (%rax)