// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/atchannel.c
// Function: at_send_command_full_nolock
static int at_send_command_full_nolock (const char *command, ATCommandType type,
                    const char *responsePrefix, const char *smspdu,
                    long long timeoutMsec, ATResponse **pp_outResponse)
{
    int err = 0;

    if (!timeoutMsec)
        timeoutMsec = 15000;

    if(sp_response != NULL) {
        err = AT_ERROR_COMMAND_PENDING;
        goto error;
    }

    if (command != NULL)
        err = writeline (command);

    if (err < 0) {
        printf("%s errno: %d (%s)\n", __func__, errno, strerror(errno));
        goto error;
    }

    s_type = type;
    s_responsePrefix = responsePrefix;
    s_smsPDU = smspdu;
    sp_response = at_response_new();

    while (sp_response->finalResponse == NULL && s_readerClosed == 0) {
        err = pthread_cond_timeout_np(&cm_command_cond, &cm_command_mutex, timeoutMsec);

        if (err == ETIMEDOUT) {
            err = AT_ERROR_TIMEOUT;
            goto error;
        }
    }

    if (pp_outResponse == NULL) {
        at_response_free(sp_response);
    } else {
        /* line reader stores intermediate responses in reverse order */
        reverseIntermediates(sp_response);
        *pp_outResponse = sp_response;
    }

    sp_response = NULL;

    if(s_readerClosed > 0) {
        err = AT_ERROR_CHANNEL_CLOSED;
        goto error;
    }

    err = 0;
error:
    clearPendingCommand();

    return err;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x271c5
movq $0x3a98, -0x28(%rbp)    # imm = 0x3A98
cmpq $0x0, 0x11f73(%rip)     # 0x39140
je 0x271db
movl $0xfffffffe, -0x34(%rbp) # imm = 0xFFFFFFFE
jmp 0x272fe
cmpq $0x0, -0x8(%rbp)
je 0x271ee
movq -0x8(%rbp), %rdi
callq 0x28240
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jge 0x2722a
callq 0x5070
movl (%rax), %eax
movl %eax, -0x38(%rbp)
callq 0x5070
movl (%rax), %edi
callq 0x5540
movl -0x38(%rbp), %edx
movq %rax, %rcx
leaq 0x6cde(%rip), %rdi      # 0x2def5
leaq 0x9795(%rip), %rsi      # 0x309b3
movb $0x0, %al
callq 0x51a0
jmp 0x272fe
movl -0xc(%rbp), %eax
movl %eax, 0x11f41(%rip)     # 0x39174
movq -0x18(%rbp), %rax
movq %rax, 0x11ef2(%rip)     # 0x39130
movq -0x20(%rbp), %rax
movq %rax, 0x11eef(%rip)     # 0x39138
callq 0x28480
movq %rax, 0x11eeb(%rip)     # 0x39140
movq 0x11ee4(%rip), %rcx     # 0x39140
xorl %eax, %eax
cmpq $0x0, 0x8(%rcx)
movb %al, -0x39(%rbp)
jne 0x27275
cmpl $0x0, 0x11eb9(%rip)     # 0x39128
sete %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x2727e
jmp 0x272ab
movq -0x28(%rbp), %rax
movl %eax, %edx
leaq 0x10bad(%rip), %rdi     # 0x37e38
leaq 0x10b7e(%rip), %rsi     # 0x37e10
callq 0x13cb0
movl %eax, -0x34(%rbp)
cmpl $0x6e, -0x34(%rbp)
jne 0x272a9
movl $0xfffffffc, -0x34(%rbp) # imm = 0xFFFFFFFC
jmp 0x272fe
jmp 0x27255
cmpq $0x0, -0x30(%rbp)
jne 0x272c0
movq 0x11e87(%rip), %rdi     # 0x39140
callq 0x26d20
jmp 0x272da
movq 0x11e79(%rip), %rdi     # 0x39140
callq 0x28420
movq 0x11e6d(%rip), %rcx     # 0x39140
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq $0x0, 0x11e5b(%rip) # 0x39140
cmpl $0x0, 0x11e3c(%rip)     # 0x39128
jle 0x272f7
movl $0xfffffffd, -0x34(%rbp) # imm = 0xFFFFFFFD
jmp 0x272fe
movl $0x0, -0x34(%rbp)
callq 0x284a0
movl -0x34(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)