// File: /workspace/github_c_makefile_star2_O1/connycommy[P]atCmdDevice/src/cellularModem/cellModem.c
// Function: cellModem_UrcGetDataIncomingConnection
cmError_t cellModem_UrcGetDataIncomingConnection(cmData_t *obj, asynEventIncomingConn_t *getDataIncomingConn){
    cmError_t retVal= CM_FAIL;
    char bufferRecv[CM_BUFFER_LEN_DEF] = {0};
    char *ptr;
    char bufferAux[128] = {0};

    if(cmIsAsyncEvent(obj)){
        ptr = cmGetBufferAsyncEvent(obj);
        memcpy(bufferRecv, ptr, strlen(ptr));        
        
        if( (ptr = strstr(bufferRecv,": \"incoming\"")) != NULL ){
            ptr = extractBetween(bufferRecv,',',',', bufferAux, 0);
            getDataIncomingConn->info.connectId = atoi(bufferAux);

            memset((void*)bufferAux,0,sizeof(bufferAux));
            ptr = extractBetween(ptr,',',',', bufferAux, 0);
            getDataIncomingConn->serverId = atoi(bufferAux);


            ptr = extractBetween(ptr,'"','"', getDataIncomingConn->remoteIp, 0);
            
            memset((void*)bufferAux,0,sizeof(bufferAux));
            ptr = extractBetween(ptr,',','\r', bufferAux, 0);
            getDataIncomingConn->remotePort = (uint16_t)atoi(bufferAux);
            
            retVal = CM_OK;
        }else{
            retVal = CM_ERR_INVALID_RESPONSE;
        }
    }
    return retVal;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x488, %rsp            # imm = 0x488
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x80(%rsp), %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x10a0
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, (%rsp)
movq %r14, %rdi
callq 0x1584
testb %al, %al
je 0x2a78
movq %r14, %rdi
callq 0x15b9
movq %rax, %r14
movq %rax, %rdi
callq 0x1070
leaq 0x80(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x10c0
leaq 0x47b9(%rip), %rsi      # 0x7137
movq %r15, %rdi
callq 0x1110
testq %rax, %rax
je 0x2a7f
leaq 0x80(%rsp), %rdi
movq %rsp, %r14
xorl %ebp, %ebp
movl $0x2c, %esi
movl $0x2c, %edx
movq %r14, %rcx
xorl %r8d, %r8d
callq 0x16ec
movq %rax, %r15
movq %r14, %rdi
callq 0x10e0
movl %eax, 0x4(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
movaps %xmm0, 0x10(%r14)
movaps %xmm0, 0x20(%r14)
movaps %xmm0, 0x30(%r14)
movaps %xmm0, 0x40(%r14)
movaps %xmm0, 0x50(%r14)
movaps %xmm0, 0x60(%r14)
movaps %xmm0, 0x70(%r14)
movq %r15, %rdi
movl $0x2c, %esi
movl $0x2c, %edx
movq %r14, %rcx
xorl %r8d, %r8d
callq 0x16ec
movq %rax, %r15
movq %r14, %rdi
callq 0x10e0
movl %eax, 0x8(%rbx)
leaq 0xc(%rbx), %rcx
movq %r15, %rdi
movl $0x22, %esi
movl $0x22, %edx
xorl %r8d, %r8d
callq 0x16ec
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
movaps %xmm0, 0x10(%r14)
movaps %xmm0, 0x20(%r14)
movaps %xmm0, 0x30(%r14)
movaps %xmm0, 0x40(%r14)
movaps %xmm0, 0x50(%r14)
movaps %xmm0, 0x60(%r14)
movaps %xmm0, 0x70(%r14)
movq %rax, %rdi
movl $0x2c, %esi
movl $0xd, %edx
movq %r14, %rcx
xorl %r8d, %r8d
callq 0x16ec
movq %r14, %rdi
callq 0x10e0
movw %ax, 0x1c(%rbx)
jmp 0x2a84
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x2a84
movl $0x3, %ebp
movl %ebp, %eax
addq $0x488, %rsp            # imm = 0x488
popq %rbx
popq %r14
popq %r15
popq %rbp
retq