// File: /workspace/github_c_makefile_star2_O3/Carton32[P]quectel-CM/atchannel.c
// Function: readerLoop
static void *readerLoop(void *arg)
{
    (void)arg;

    for (;;) {
        const char * line;

        line = readline();

        if (line == NULL) {
            break;
        }

        if(isSMSUnsolicited(line)) {
            char *line1;
            const char *line2;

            // The scope of string returned by 'readline()' is valid only
            // till next call to 'readline()' hence making a copy of line
            // before calling readline again.
            line1 = strdup(line);
            line2 = readline();

            if (line2 == NULL) {
                break;
            }

            if (s_unsolHandler != NULL) {
                s_unsolHandler (line1, line2);
            }
            free(line1);
        } else {
            processLine(line);
        }
    }

    onReaderClosed();

    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
callq 0x1b4e4
testq %rax, %rax
je 0x1ad78
movq %rax, %r13
leaq 0xf30e(%rip), %r12      # 0x29d50
leaq 0x10207(%rip), %rbx     # 0x2ac50
movb (%r13), %al
leaq 0x1(%r13), %rbp
xorl %ecx, %ecx
movq (%r12,%rcx,8), %rdx
testb %al, %al
je 0x1aa7f
movq %rbp, %rsi
movl %eax, %edi
movb (%rdx), %r8b
testb %r8b, %r8b
je 0x1abc2
cmpb %r8b, %dil
jne 0x1aa88
incq %rdx
movb (%rsi), %dil
incq %rsi
testb %dil, %dil
jne 0x1aa60
cmpb $0x0, (%rdx)
je 0x1abc2
incq %rcx
cmpq $0x4, %rcx
jne 0x1aa53
movq %rbx, %rdi
callq 0x5560
movq 0x114d0(%rip), %r14     # 0x2bf70
testq %r14, %r14
je 0x1ad3c
cmpq $0x0, 0x114cf(%rip)     # 0x2bf80
je 0x1aaca
movq %r13, %rdi
leaq 0x70b0(%rip), %rsi      # 0x21b6d
callq 0x52a0
testl %eax, %eax
je 0x1ac31
movb (%r13), %al
movsbq %al, %r15
xorl %ecx, %ecx
leaq 0xf295(%rip), %rdx      # 0x29d70
movq (%rdx,%rcx,8), %rdx
testb %al, %al
je 0x1ab07
movq %rbp, %rsi
movl %eax, %edi
movb (%rdx), %r8b
testb %r8b, %r8b
je 0x1ac0d
cmpb %r8b, %dil
jne 0x1ab10
incq %rdx
movb (%rsi), %dil
incq %rsi
testb %dil, %dil
jne 0x1aae8
cmpb $0x0, (%rdx)
je 0x1ac0d
incq %rcx
cmpq $0x3, %rcx
jne 0x1aad4
xorl %ecx, %ecx
leaq 0xf26e(%rip), %rdx      # 0x29d90
movq (%rdx,%rcx,8), %rdx
testb %al, %al
je 0x1ab4e
movq %rbp, %rsi
movl %eax, %edi
movb (%rdx), %r8b
testb %r8b, %r8b
je 0x1ace4
cmpb %r8b, %dil
jne 0x1ab57
incq %rdx
movb (%rsi), %dil
incq %rsi
testb %dil, %dil
jne 0x1ab2f
cmpb $0x0, (%rdx)
je 0x1ace4
incq %rcx
cmpq $0x7, %rcx
jne 0x1ab1b
movq 0x11401(%rip), %rdi     # 0x2bf68
testq %rdi, %rdi
sete %cl
cmpb $0x3e, %al
setne %dl
orb %cl, %dl
jne 0x1ab88
cmpb $0x20, 0x1(%r13)
jne 0x1ab88
cmpb $0x0, 0x2(%r13)
je 0x1ad66
movl 0x11416(%rip), %ecx     # 0x2bfa4
leaq 0x889b(%rip), %rdx      # 0x23430
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpq $0x0, 0x10(%r14)
jne 0x1ad3c
callq 0x5580
movq (%rax), %rax
testb $0x8, 0x1(%rax,%r15,2)
je 0x1ad3c
jmp 0x1ad5c
movq %r13, %rdi
callq 0x5520
movq %rax, %r13
callq 0x1b4e4
testq %rax, %rax
je 0x1ad78
movq 0x1136e(%rip), %rcx     # 0x2bf50
testq %rcx, %rcx
je 0x1abef
movq %r13, %rdi
movq %rax, %rsi
callq *%rcx
movq %r13, %rdi
callq 0x5040
callq 0x1b4e4
movq %rax, %r13
testq %rax, %rax
jne 0x1aa49
jmp 0x1ad78
movl $0x1, (%r14)
movq %r13, %rdi
callq 0x5520
movq %rax, 0x8(%r14)
leaq 0x10051(%rip), %rdi     # 0x2ac78
callq 0x5280
jmp 0x1ad4f
movl $0x7a120, %edi          # imm = 0x7A120
callq 0x5590
cmpl $0x0, 0xf6ce(%rip)      # 0x2a310
movq 0x1133f(%rip), %r14     # 0x2bf88
sets %al
orb 0x11306(%rip), %al      # 0x2bf58
testq %r14, %r14
sete %cl
orb %al, %cl
testb $0x1, %cl
je 0x1ac76
movq $0x0, 0x11316(%rip) # 0x2bf80
leaq 0xffdf(%rip), %rbx      # 0x2ac50
jmp 0x1ad4f
movq 0x11303(%rip), %r13     # 0x2bf80
xorl %ebx, %ebx
movl 0xf68b(%rip), %eax      # 0x2a310
movl %eax, (%rsp)
movl $0x4, 0x4(%rsp)
movl $0x1, %esi
movq %rsp, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x53c0
testl %eax, %eax
jle 0x1ac5f
movq %r13, %r15
addq %rbx, %r13
movq %r14, %rbp
subq %rbx, %rbp
movl 0xf658(%rip), %edi      # 0x2a310
movq %r13, %rsi
movq %rbp, %rdx
callq 0x5100
testq %rax, %rax
jns 0x1acd4
callq 0x5070
cmpl $0x4, (%rax)
je 0x1acb2
jmp 0x1ac5f
addq %rax, %rbx
cmpq %r14, %rbx
movq %r15, %r13
jb 0x1ac7f
jmp 0x1ac5f
movl $0x0, (%r14)
jmp 0x1ac14
cmpq $0x0, 0x10(%r14)
jne 0x1ad3c
movq 0x11262(%rip), %rcx     # 0x2bf60
testb %al, %al
je 0x1ad37
movb (%rcx), %dl
testb %dl, %dl
je 0x1ad5c
cmpb %dl, %al
jne 0x1ad3c
incq %rcx
movb (%rbp), %al
incq %rbp
jmp 0x1acfe
movq 0x11242(%rip), %rcx     # 0x2bf60
testb %al, %al
je 0x1ad37
movb (%rcx), %dl
testb %dl, %dl
je 0x1ad5c
cmpb %dl, %al
jne 0x1ad3c
incq %rcx
movb (%rbp), %al
incq %rbp
jmp 0x1ad1e
cmpb $0x0, (%rcx)
je 0x1ad5c
movq 0x1120d(%rip), %rax     # 0x2bf50
testq %rax, %rax
je 0x1ad4f
movq %r13, %rdi
xorl %esi, %esi
callq *%rax
movq %rbx, %rdi
callq 0x5340
jmp 0x1abf7
movq %r13, %rdi
callq 0x1b930
jmp 0x1ad4f
callq 0x1b83e
movq $0x0, 0x111f2(%rip) # 0x2bf68
jmp 0x1ad4f
movq 0xf241(%rip), %rax      # 0x29fc0
movq (%rax), %rbx
callq 0xea3b
leaq 0x41b8(%rip), %rsi      # 0x1ef46
leaq 0x87f6(%rip), %rcx      # 0x2358b
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
leaq 0xfeff(%rip), %rax      # 0x2aca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0x1add1
callq 0xea3b
leaq 0x4189(%rip), %rsi      # 0x1ef46
leaq 0x87c7(%rip), %rcx      # 0x2358b
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x52c0
cmpq $0x0, 0x111bf(%rip)     # 0x2bf98
je 0x1ae14
testb $0x1, 0x11176(%rip)     # 0x2bf58
jne 0x1ae14
leaq 0xfe65(%rip), %rbx      # 0x2ac50
movq %rbx, %rdi
callq 0x5560
movb $0x1, 0x1115e(%rip)     # 0x2bf58
leaq 0xfe77(%rip), %rdi      # 0x2ac78
callq 0x5280
movq %rbx, %rdi
callq 0x5340
callq *0x11184(%rip)          # 0x2bf98
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq