// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x4c0, %rsp            # imm = 0x4C0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
leaq -0x420(%rbp), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x10a0
leaq -0x4b0(%rbp), %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0x10a0
movq -0x8(%rbp), %rdi
callq 0x1900
cmpb $0x0, %al
je 0x3e00
movq -0x8(%rbp), %rdi
callq 0x1960
movq %rax, -0x428(%rbp)
leaq -0x420(%rbp), %rax
movq %rax, -0x4c0(%rbp)
movq -0x428(%rbp), %rax
movq %rax, -0x4b8(%rbp)
movq -0x428(%rbp), %rdi
callq 0x1070
movq -0x4c0(%rbp), %rdi
movq -0x4b8(%rbp), %rsi
movq %rax, %rdx
callq 0x10c0
leaq -0x420(%rbp), %rdi
leaq 0x6413(%rip), %rsi      # 0xa0f0
callq 0x1110
movq %rax, -0x428(%rbp)
cmpq $0x0, %rax
je 0x3df7
leaq -0x420(%rbp), %rdi
leaq -0x4b0(%rbp), %rcx
movl $0x2c, %edx
xorl %r8d, %r8d
movl %edx, %esi
callq 0x1d10
movq %rax, -0x428(%rbp)
leaq -0x4b0(%rbp), %rdi
callq 0x10e0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x4(%rax)
leaq -0x4b0(%rbp), %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0x10a0
movq -0x428(%rbp), %rdi
leaq -0x4b0(%rbp), %rcx
movl $0x2c, %edx
xorl %r8d, %r8d
movl %edx, %esi
callq 0x1d10
movq %rax, -0x428(%rbp)
leaq -0x4b0(%rbp), %rdi
callq 0x10e0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x428(%rbp), %rdi
movq -0x10(%rbp), %rcx
addq $0xc, %rcx
movl $0x22, %edx
xorl %r8d, %r8d
movl %edx, %esi
callq 0x1d10
movq %rax, -0x428(%rbp)
leaq -0x4b0(%rbp), %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0x10a0
movq -0x428(%rbp), %rdi
leaq -0x4b0(%rbp), %rcx
movl $0x2c, %esi
movl $0xd, %edx
xorl %r8d, %r8d
callq 0x1d10
movq %rax, -0x428(%rbp)
leaq -0x4b0(%rbp), %rdi
callq 0x10e0
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x1c(%rax)
movl $0x0, -0x14(%rbp)
jmp 0x3dfe
movl $0x3, -0x14(%rbp)
jmp 0x3e00
movl -0x14(%rbp), %eax
addq $0x4c0, %rsp            # imm = 0x4C0
popq %rbp
retq
nopl (%rax)