// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/atchannel.c
// Function: processLine
static void processLine(const char *line)
{
    pthread_mutex_lock(&cm_command_mutex);

    if (sp_response == NULL) {
        /* no command pending */
        handleUnsolicited(line);
    } else if (s_raw_data != NULL && 0 == strcmp(line, "CONNECT")) {
        usleep(500*1000); //for EC20
        writeraw(s_raw_data, s_raw_len);
        s_raw_data = NULL;
    } else if (isFinalResponseSuccess(line)) {
        sp_response->success = 1;
        handleFinalResponse(line);
    } else if (isFinalResponseError(line)) {
        sp_response->success = 0;
        handleFinalResponse(line);
    } else if (s_smsPDU != NULL && 0 == strcmp(line, "> ")) {
        // See eg. TS 27.005 4.3
        // Commands like AT+CMGS have a "> " prompt
        writeCtrlZ(s_smsPDU);
        s_smsPDU = NULL;
    } else switch (s_type) {
        case NO_RESULT:
            handleUnsolicited(line);
            break;
        case NUMERIC:
            if (sp_response->p_intermediates == NULL
                && isdigit(line[0])
            ) {
                addIntermediate(line);
            } else {
                /* either we already have an intermediate response or
                   the line doesn't begin with a digit */
                handleUnsolicited(line);
            }
            break;
        case SINGLELINE:
            if (sp_response->p_intermediates == NULL
                && strStartsWith (line, s_responsePrefix)
            ) {
                addIntermediate(line);
            } else {
                /* we already have an intermediate response */
                handleUnsolicited(line);
            }
            break;
        case MULTILINE:
            if (strStartsWith (line, s_responsePrefix)) {
                addIntermediate(line);
            } else {
                handleUnsolicited(line);
            }
        break;

        default: /* this should never be reached */
            LOGE("Unsupported AT command type %d\n", s_type);
            handleUnsolicited(line);
        break;
    }

    pthread_mutex_unlock(&cm_command_mutex);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
leaq 0x108fd(%rip), %rdi     # 0x37e10
callq 0x5570
cmpq $0x0, 0x11c20(%rip)     # 0x39140
jne 0x27530
movq -0x8(%rbp), %rdi
callq 0x27d40
jmp 0x27773
cmpq $0x0, 0x11c18(%rip)     # 0x39150
je 0x2757f
movq -0x8(%rbp), %rdi
leaq 0x7890(%rip), %rsi      # 0x2edd5
callq 0x52a0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x2757f
movl $0x7a120, %edi          # imm = 0x7A120
callq 0x5590
movq 0x11bed(%rip), %rdi     # 0x39150
movq 0x11bee(%rip), %rsi     # 0x39158
callq 0x27d70
movq $0x0, 0x11bd6(%rip) # 0x39150
jmp 0x27771
movq -0x8(%rbp), %rdi
callq 0x27e70
cmpl $0x0, %eax
je 0x275a8
movq 0x11bac(%rip), %rax     # 0x39140
movl $0x1, (%rax)
movq -0x8(%rbp), %rdi
callq 0x27ee0
jmp 0x2776f
movq -0x8(%rbp), %rdi
callq 0x27f20
cmpl $0x0, %eax
je 0x275d1
movq 0x11b83(%rip), %rax     # 0x39140
movl $0x0, (%rax)
movq -0x8(%rbp), %rdi
callq 0x27ee0
jmp 0x2776d
cmpq $0x0, 0x11b5f(%rip)     # 0x39138
je 0x2760f
movq -0x8(%rbp), %rdi
leaq 0x9327(%rip), %rsi      # 0x3090d
callq 0x52a0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x2760f
movq 0x11b3e(%rip), %rdi     # 0x39138
callq 0x27f90
movq $0x0, 0x11b2e(%rip) # 0x39138
jmp 0x2776b
movl 0x11b5f(%rip), %eax     # 0x39174
movq %rax, -0x10(%rbp)
subq $0x3, %rax
ja 0x276f3
movq -0x10(%rbp), %rax
leaq 0x91f2(%rip), %rcx      # 0x30820
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rdi
callq 0x27d40
jmp 0x27769
movq 0x11af4(%rip), %rax     # 0x39140
cmpq $0x0, 0x10(%rax)
jne 0x2767e
callq 0x5580
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0x2767e
movq -0x8(%rbp), %rdi
callq 0x28110
jmp 0x27687
movq -0x8(%rbp), %rdi
callq 0x27d40
jmp 0x27769
movq 0x11aad(%rip), %rax     # 0x39140
cmpq $0x0, 0x10(%rax)
jne 0x276ba
movq -0x8(%rbp), %rdi
movq 0x11a8b(%rip), %rsi     # 0x39130
callq 0x26a30
cmpl $0x0, %eax
je 0x276ba
movq -0x8(%rbp), %rdi
callq 0x28110
jmp 0x276c3
movq -0x8(%rbp), %rdi
callq 0x27d40
jmp 0x27769
movq -0x8(%rbp), %rdi
movq 0x11a5d(%rip), %rsi     # 0x39130
callq 0x26a30
cmpl $0x0, %eax
je 0x276e8
movq -0x8(%rbp), %rdi
callq 0x28110
jmp 0x276f1
movq -0x8(%rbp), %rdi
callq 0x27d40
jmp 0x27769
jmp 0x276f5
movq 0xf8e4(%rip), %rax      # 0x36fe0
movq (%rax), %rax
movq %rax, -0x18(%rbp)
callq 0x13930
movq -0x18(%rbp), %rdi
movq %rax, %rdx
movl 0x11a5f(%rip), %ecx     # 0x39174
leaq 0x91f4(%rip), %rsi      # 0x30910
movb $0x0, %al
callq 0x52c0
leaq 0x1073e(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x2775e
leaq 0x10731(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x20(%rbp)
callq 0x13930
movq -0x20(%rbp), %rdi
movq %rax, %rdx
movl 0x11a24(%rip), %ecx     # 0x39174
leaq 0x91b9(%rip), %rsi      # 0x30910
movb $0x0, %al
callq 0x52c0
jmp 0x27760
movq -0x8(%rbp), %rdi
callq 0x27d40
jmp 0x2776b
jmp 0x2776d
jmp 0x2776f
jmp 0x27771
jmp 0x27773
leaq 0x10696(%rip), %rdi     # 0x37e10
callq 0x5350
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)