LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/device.c
// Function: mhidevice_detect
int mhidevice_detect(char *qmichannel, char *usbnet_adapter, PROFILE_T *profile) {
    if (!access("/sys/class/net/pcie_mhi0", F_OK))
        strcpy(usbnet_adapter, "pcie_mhi0");
    else if (!access("/sys/class/net/rmnet_mhi0", F_OK))
        strcpy(usbnet_adapter, "rmnet_mhi0");
    else {
        dbg_time("qmidevice_detect failed");
        goto error;
    }

    if (!access("/dev/mhi_MBIM", F_OK)) {
        strcpy(qmichannel, "/dev/mhi_MBIM");
        profile->software_interface = SOFTWARE_MBIM;
    }
    else if (!access("/dev/mhi_QMI0", F_OK)) {
        strcpy(qmichannel, "/dev/mhi_QMI0");
        profile->software_interface = SOFTWARE_QMI;
    }
    else {
        goto error;
    }

    return 1;
error:
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
leaq 0xe065(%rip), %rdi      # 0x2fc20
xorl %esi, %esi
callq 0x5460
cmpl $0x0, %eax
jne 0x21bdc
movq -0x18(%rbp), %rdi
leaq 0xe05d(%rip), %rsi      # 0x2fc2f
callq 0x50a0
jmp 0x21c66
leaq 0xe056(%rip), %rdi      # 0x2fc39
xorl %esi, %esi
callq 0x5460
cmpl $0x0, %eax
jne 0x21c01
movq -0x18(%rbp), %rdi
leaq 0xe04e(%rip), %rsi      # 0x2fc48
callq 0x50a0
jmp 0x21c64
jmp 0x21c03
movq 0x153d6(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x28(%rbp)
callq 0x13930
movq -0x28(%rbp), %rdi
movq %rax, %rdx
leaq 0xa00d(%rip), %rsi      # 0x2bc31
movb $0x0, %al
callq 0x52c0
leaq 0x16236(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x21c60
leaq 0x16229(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x30(%rbp)
callq 0x13930
movq -0x30(%rbp), %rdi
movq %rax, %rdx
leaq 0x9fd8(%rip), %rsi      # 0x2bc31
movb $0x0, %al
callq 0x52c0
jmp 0x21c62
jmp 0x21cd9
jmp 0x21c66
leaq 0xdfe6(%rip), %rdi      # 0x2fc53
xorl %esi, %esi
callq 0x5460
cmpl $0x0, %eax
jne 0x21c99
movq -0x10(%rbp), %rdi
leaq 0xdfcf(%rip), %rsi      # 0x2fc53
callq 0x50a0
movq -0x20(%rbp), %rax
movl $0x2, 0x1c1(%rax)
jmp 0x21cd0
leaq 0xdfc1(%rip), %rdi      # 0x2fc61
xorl %esi, %esi
callq 0x5460
cmpl $0x0, %eax
jne 0x21ccc
movq -0x10(%rbp), %rdi
leaq 0xdfaa(%rip), %rsi      # 0x2fc61
callq 0x50a0
movq -0x20(%rbp), %rax
movl $0x1, 0x1c1(%rax)
jmp 0x21cce
jmp 0x21cd9
jmp 0x21cd0
movl $0x1, -0x4(%rbp)
jmp 0x21ce0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/device.c
// Function: atdevice_detect
int atdevice_detect(char *atchannel, char *usbnet_adapter, PROFILE_T *profile) {
    if (!access("/sys/class/net/sipa_dummy0", F_OK)) {
		strcpy(usbnet_adapter, "sipa_dummy0");
		snprintf(profile->qmapnet_adapter, sizeof(profile->qmapnet_adapter), "%s%d", "pcie", profile->pdp - 1);
    }
	else {
        dbg_time("atdevice_detect failed");
        goto error;
    }

    if (!access("/dev/stty_nr31", F_OK)) {
        strcpy(atchannel, "/dev/stty_nr31");
        profile->software_interface = SOFTWARE_ECM_RNDIS_NCM;
    }
    else {
        goto error;
    }

    return 1;
error:
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
leaq 0xdf64(%rip), %rdi      # 0x2fc6f
xorl %esi, %esi
callq 0x5460
cmpl $0x0, %eax
jne 0x21d5a
movq -0x18(%rbp), %rdi
leaq 0xdf5c(%rip), %rsi      # 0x2fc7e
callq 0x50a0
movq -0x20(%rbp), %rdi
addq $0xca, %rdi
movq -0x20(%rbp), %rax
movl 0x48(%rax), %r8d
subl $0x1, %r8d
movl $0x20, %esi
leaq 0xe6fc(%rip), %rdx      # 0x30446
leaq 0xdf39(%rip), %rcx      # 0x2fc8a
movb $0x0, %al
callq 0x51c0
jmp 0x21dbd
jmp 0x21d5c
movq 0x1527d(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x28(%rbp)
callq 0x13930
movq -0x28(%rbp), %rdi
movq %rax, %rdx
leaq 0xdf12(%rip), %rsi      # 0x2fc8f
movb $0x0, %al
callq 0x52c0
leaq 0x160dd(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x21db9
leaq 0x160d0(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x30(%rbp)
callq 0x13930
movq -0x30(%rbp), %rdi
movq %rax, %rdx
leaq 0xdedd(%rip), %rsi      # 0x2fc8f
movb $0x0, %al
callq 0x52c0
jmp 0x21dbb
jmp 0x21dfb
leaq 0xdee8(%rip), %rdi      # 0x2fcac
xorl %esi, %esi
callq 0x5460
cmpl $0x0, %eax
jne 0x21df0
movq -0x10(%rbp), %rdi
leaq 0xded1(%rip), %rsi      # 0x2fcac
callq 0x50a0
movq -0x20(%rbp), %rax
movl $0x3, 0x1c1(%rax)
jmp 0x21df2
jmp 0x21dfb
movl $0x1, -0x4(%rbp)
jmp 0x21e02
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/device.c
// Function: usbfs_is_kernel_driver_alive
int usbfs_is_kernel_driver_alive(int fd, int ifnum)
{
    struct usbfs_getdriver getdrv;
    getdrv.interface = ifnum;
    if (ioctl(fd, USBDEVFS_GETDRIVER, &getdrv) < 0) {
        dbg_time("%s ioctl USBDEVFS_GETDRIVER failed, kernel driver may be inactive", __func__);
        return 0;
    }
    dbg_time("%s find interface %d has match the driver %s", __func__, ifnum, getdrv.driver);
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x110(%rbp)
movl -0x8(%rbp), %edi
movl $0x41045508, %esi       # imm = 0x41045508
leaq -0x110(%rbp), %rdx
movb $0x0, %al
callq 0x5210
cmpl $0x0, %eax
jge 0x21ed0
jmp 0x21e4b
movq 0x1518e(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x118(%rbp)
callq 0x13930
movq -0x118(%rbp), %rdi
movq %rax, %rdx
leaq 0xde93(%rip), %rsi      # 0x2fd05
leaq 0xded4(%rip), %rcx      # 0x2fd4d
movb $0x0, %al
callq 0x52c0
leaq 0x15fe1(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x21ec2
leaq 0x15fd4(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x120(%rbp)
callq 0x13930
movq -0x120(%rbp), %rdi
movq %rax, %rdx
leaq 0xde51(%rip), %rsi      # 0x2fd05
leaq 0xde92(%rip), %rcx      # 0x2fd4d
movb $0x0, %al
callq 0x52c0
jmp 0x21ec4
movl $0x0, -0x4(%rbp)
jmp 0x21f70
jmp 0x21ed2
movq 0x15107(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x128(%rbp)
callq 0x13930
movq -0x128(%rbp), %rdi
movq %rax, %rdx
movl -0xc(%rbp), %r8d
leaq -0x110(%rbp), %r9
addq $0x4, %r9
leaq 0xde62(%rip), %rsi      # 0x2fd6a
leaq 0xde3e(%rip), %rcx      # 0x2fd4d
movb $0x0, %al
callq 0x52c0
leaq 0x15f4b(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x21f67
leaq 0x15f3e(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x130(%rbp)
callq 0x13930
movq -0x130(%rbp), %rdi
movq %rax, %rdx
movl -0xc(%rbp), %r8d
leaq -0x110(%rbp), %r9
addq $0x4, %r9
leaq 0xde11(%rip), %rsi      # 0x2fd6a
leaq 0xdded(%rip), %rcx      # 0x2fd4d
movb $0x0, %al
callq 0x52c0
jmp 0x21f69
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/device.c
// Function: usbfs_detach_kernel_driver
void usbfs_detach_kernel_driver(int fd, int ifnum)
{
    struct usbfs_ioctl operate;
    operate.data = NULL;
    operate.ifno = ifnum;
    operate.ioctl_code = IOCTL_USBFS_DISCONNECT;
    if (ioctl(fd, USBDEVFS_IOCTL, &operate) < 0) {
        dbg_time("%s detach kernel driver failed", __func__);
    } else {
        dbg_time("%s detach kernel driver success", __func__);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
movl -0x8(%rbp), %eax
movl %eax, -0x18(%rbp)
movl $0x5516, -0x14(%rbp)    # imm = 0x5516
movl -0x4(%rbp), %edi
movl $0xc0105512, %esi       # imm = 0xC0105512
leaq -0x18(%rbp), %rdx
movb $0x0, %al
callq 0x5210
cmpl $0x0, %eax
jge 0x2202c
jmp 0x21fbd
movq 0x1501c(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x20(%rbp)
callq 0x13930
movq -0x20(%rbp), %rdi
movq %rax, %rdx
leaq 0xddbf(%rip), %rsi      # 0x2fd9d
leaq 0xdddd(%rip), %rcx      # 0x2fdc2
movb $0x0, %al
callq 0x52c0
leaq 0x15e75(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x22028
leaq 0x15e68(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x28(%rbp)
callq 0x13930
movq -0x28(%rbp), %rdi
movq %rax, %rdx
leaq 0xdd83(%rip), %rsi      # 0x2fd9d
leaq 0xdda1(%rip), %rcx      # 0x2fdc2
movb $0x0, %al
callq 0x52c0
jmp 0x2202a
jmp 0x2209d
jmp 0x2202e
movq 0x14fab(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x30(%rbp)
callq 0x13930
movq -0x30(%rbp), %rdi
movq %rax, %rdx
leaq 0xdd8e(%rip), %rsi      # 0x2fddd
leaq 0xdd6c(%rip), %rcx      # 0x2fdc2
movb $0x0, %al
callq 0x52c0
leaq 0x15e04(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x22099
leaq 0x15df7(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x38(%rbp)
callq 0x13930
movq -0x38(%rbp), %rdi
movq %rax, %rdx
leaq 0xdd52(%rip), %rsi      # 0x2fddd
leaq 0xdd30(%rip), %rcx      # 0x2fdc2
movb $0x0, %al
callq 0x52c0
jmp 0x2209b
jmp 0x2209d
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/device.c
// Function: usbfs_attach_kernel_driver
void usbfs_attach_kernel_driver(int fd, int ifnum)
{
    struct usbfs_ioctl operate;
    operate.data = NULL;
    operate.ifno = ifnum;
    operate.ioctl_code = IOCTL_USBFS_CONNECT;
    if (ioctl(fd, USBDEVFS_IOCTL, &operate) < 0) {
        dbg_time("%s detach kernel driver failed", __func__);
    } else {
        dbg_time("%s detach kernel driver success", __func__);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
movl -0x8(%rbp), %eax
movl %eax, -0x18(%rbp)
movl $0x5517, -0x14(%rbp)    # imm = 0x5517
movl -0x4(%rbp), %edi
movl $0xc0105512, %esi       # imm = 0xC0105512
leaq -0x18(%rbp), %rdx
movb $0x0, %al
callq 0x5210
cmpl $0x0, %eax
jge 0x2215c
jmp 0x220ed
movq 0x14eec(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x20(%rbp)
callq 0x13930
movq -0x20(%rbp), %rdi
movq %rax, %rdx
leaq 0xdc8f(%rip), %rsi      # 0x2fd9d
leaq 0xdcee(%rip), %rcx      # 0x2fe03
movb $0x0, %al
callq 0x52c0
leaq 0x15d45(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x22158
leaq 0x15d38(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x28(%rbp)
callq 0x13930
movq -0x28(%rbp), %rdi
movq %rax, %rdx
leaq 0xdc53(%rip), %rsi      # 0x2fd9d
leaq 0xdcb2(%rip), %rcx      # 0x2fe03
movb $0x0, %al
callq 0x52c0
jmp 0x2215a
jmp 0x221cd
jmp 0x2215e
movq 0x14e7b(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x30(%rbp)
callq 0x13930
movq -0x30(%rbp), %rdi
movq %rax, %rdx
leaq 0xdc5e(%rip), %rsi      # 0x2fddd
leaq 0xdc7d(%rip), %rcx      # 0x2fe03
movb $0x0, %al
callq 0x52c0
leaq 0x15cd4(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x221c9
leaq 0x15cc7(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x38(%rbp)
callq 0x13930
movq -0x38(%rbp), %rdi
movq %rax, %rdx
leaq 0xdc22(%rip), %rsi      # 0x2fddd
leaq 0xdc41(%rip), %rcx      # 0x2fe03
movb $0x0, %al
callq 0x52c0
jmp 0x221cb
jmp 0x221cd
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/device.c
// Function: reattach_driver
int reattach_driver(PROFILE_T *profile)
{
    int ifnum = 4;
    int fd;
    char devpath[128] = {'\0'};
    snprintf(devpath, sizeof(devpath), "/dev/bus/usb/%03d/%03d", profile->usb_dev.busnum, profile->usb_dev.devnum);
    fd = open(devpath, O_RDWR | O_NOCTTY);
    if (fd < 0)
    {
        dbg_time("%s fail to open %s", __func__, devpath);
        return -1;
    }
    usbfs_detach_kernel_driver(fd, ifnum);
    usbfs_attach_kernel_driver(fd, ifnum);
    close(fd);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movl $0x4, -0x14(%rbp)
leaq -0xa0(%rbp), %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0x5200
leaq -0xa0(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x1cd(%rax), %ecx
movq -0x10(%rbp), %rax
movl 0x1d1(%rax), %r8d
movl $0x80, %esi
leaq 0xdbed(%rip), %rdx      # 0x2fe1e
movb $0x0, %al
callq 0x51c0
leaq -0xa0(%rbp), %rdi
movl $0x102, %esi            # imm = 0x102
movb $0x0, %al
callq 0x5450
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jge 0x222ea
jmp 0x2225a
movq 0x14d7f(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0xa8(%rbp)
callq 0x13930
movq -0xa8(%rbp), %rdi
movq %rax, %rdx
leaq -0xa0(%rbp), %r8
leaq 0xdbad(%rip), %rsi      # 0x2fe35
leaq 0xdbbf(%rip), %rcx      # 0x2fe4e
movb $0x0, %al
callq 0x52c0
leaq 0x15bcb(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x222df
leaq 0x15bbe(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0xb0(%rbp)
callq 0x13930
movq -0xb0(%rbp), %rdi
movq %rax, %rdx
leaq -0xa0(%rbp), %r8
leaq 0xdb64(%rip), %rsi      # 0x2fe35
leaq 0xdb76(%rip), %rcx      # 0x2fe4e
movb $0x0, %al
callq 0x52c0
jmp 0x222e1
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2230f
movl -0x18(%rbp), %edi
movl -0x14(%rbp), %esi
callq 0x21f80
movl -0x18(%rbp), %edi
movl -0x14(%rbp), %esi
callq 0x220b0
movl -0x18(%rbp), %edi
callq 0x5230
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/device.c
// Function: catch_log
static void *catch_log(void *arg)
{
    PROFILE_T *profile = (PROFILE_T *)arg;
    int nreads = 0;
    char tbuff[256+32];
    char filter[32];
    size_t tsize = strlen(get_time()) + 1;

    snprintf(filter, sizeof(filter), ":%d:%03d:", profile->usb_dev.busnum, profile->usb_dev.devnum);

    while(1) {
        nreads = read(profile->usbmon_fd, tbuff + tsize, sizeof(tbuff) - tsize - 1);
        if (nreads <= 0) {
            if (nreads == -1 && errno == EINTR)
                continue;
            break;
        }

        tbuff[tsize+nreads] = '\0';   // printf("%s", buff);

        if (!strstr(tbuff+tsize, filter))
            continue;

        snprintf(tbuff, sizeof(tbuff), "%s", get_time());
        tbuff[tsize-1] = ' ';

        fwrite(tbuff, strlen(tbuff), 1, profile->usbmon_logfile_fp);
    }

    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
callq 0x13930
movq %rax, %rdi
callq 0x5160
addq $0x1, %rax
movq %rax, -0x168(%rbp)
leaq -0x160(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x1cd(%rax), %ecx
movq -0x10(%rbp), %rax
movl 0x1d1(%rax), %r8d
movl $0x20, %esi
leaq 0xd42d(%rip), %rdx      # 0x3019b
movb $0x0, %al
callq 0x51c0
movq -0x10(%rbp), %rax
movl 0x209(%rax), %edi
leaq -0x140(%rbp), %rsi
addq -0x168(%rbp), %rsi
movl $0x120, %edx            # imm = 0x120
subq -0x168(%rbp), %rdx
subq $0x1, %rdx
callq 0x5250
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jg 0x22dc2
cmpl $-0x1, -0x14(%rbp)
jne 0x22dbd
callq 0x5070
cmpl $0x4, (%rax)
jne 0x22dbd
jmp 0x22d75
jmp 0x22e7e
movq -0x168(%rbp), %rax
movslq -0x14(%rbp), %rcx
addq %rcx, %rax
movb $0x0, -0x140(%rbp,%rax)
leaq -0x140(%rbp), %rdi
addq -0x168(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x5560
cmpq $0x0, %rax
jne 0x22dfd
jmp 0x22d75
leaq -0x140(%rbp), %rax
movq %rax, -0x178(%rbp)
callq 0x13930
movq -0x178(%rbp), %rdi
movq %rax, %rcx
movl $0x120, %esi            # imm = 0x120
leaq 0xd234(%rip), %rdx      # 0x3005a
movb $0x0, %al
callq 0x51c0
movq -0x168(%rbp), %rax
subq $0x1, %rax
movb $0x20, -0x140(%rbp,%rax)
leaq -0x140(%rbp), %rax
movq %rax, -0x170(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x5160
movq -0x170(%rbp), %rdi
movq %rax, %rsi
movq -0x10(%rbp), %rax
movq 0x20d(%rax), %rcx
movl $0x1, %edx
callq 0x5510
jmp 0x22d75
xorl %eax, %eax
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/device.c
// Function: ql_stop_usbmon_log
void ql_stop_usbmon_log(PROFILE_T *profile) {
    if (profile->usbmon_fd > 0)
        close(profile->usbmon_fd);
    if (profile->usbmon_logfile_fp)
        fclose(profile->usbmon_logfile_fp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x209(%rax)
jle 0x22eb8
movq -0x8(%rbp), %rax
movl 0x209(%rax), %edi
callq 0x5230
movq -0x8(%rbp), %rax
cmpq $0x0, 0x20d(%rax)
je 0x22ed6
movq -0x8(%rbp), %rax
movq 0x20d(%rax), %rdi
callq 0x5130
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/device.c
// Function: file_get_value
static int file_get_value(const char *fname, int base)
{
    FILE *fp = NULL;
    long num;
    char buff[32 + 1] = {'\0'};
    char *endptr = NULL;

    fp = fopen(fname, "r");
    if (!fp) goto error;
    if (fgets(buff, sizeof(buff), fp) == NULL)
        goto error;
    fclose(fp);

    num = (int)strtol(buff, &endptr, base);
    if (errno == ERANGE && (num == LONG_MAX || num == LONG_MIN))
        goto error;
    /* if there is no digit in buff */
    if (endptr == buff)
        goto error;

    if (debug_qmi)
        dbg_time("(%s) = %lx", fname, num);
    return (int)num;

error:
    if (fp) fclose(fp);
    return CM_INVALID_VAL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq $0x0, -0x20(%rbp)
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
movl $0x21, %edx
callq 0x5200
movq $0x0, -0x58(%rbp)
movq -0x10(%rbp), %rdi
leaq 0xc4cd(%rip), %rsi      # 0x2f3e7
callq 0x5480
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x22f2f
jmp 0x23034
leaq -0x50(%rbp), %rdi
movq -0x20(%rbp), %rdx
movl $0x21, %esi
callq 0x5270
cmpq $0x0, %rax
jne 0x22f4c
jmp 0x23034
movq -0x20(%rbp), %rdi
callq 0x5130
leaq -0x50(%rbp), %rdi
movl -0x14(%rbp), %edx
leaq -0x58(%rbp), %rsi
callq 0x52e0
cltq
movq %rax, -0x28(%rbp)
callq 0x5070
cmpl $0x22, (%rax)
jne 0x22f9a
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
cmpq %rax, -0x28(%rbp)
je 0x22f95
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
cmpq %rax, -0x28(%rbp)
jne 0x22f9a
jmp 0x23034
movq -0x58(%rbp), %rax
leaq -0x50(%rbp), %rcx
cmpq %rcx, %rax
jne 0x22fac
jmp 0x23034
leaq 0x145d9(%rip), %rax     # 0x3758c
cmpl $0x0, (%rax)
je 0x2302b
jmp 0x22fba
movq 0x1401f(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x60(%rbp)
callq 0x13930
movq -0x60(%rbp), %rdi
movq %rax, %rdx
movq -0x10(%rbp), %rcx
movq -0x28(%rbp), %r8
leaq 0xd0b2(%rip), %rsi      # 0x30095
movb $0x0, %al
callq 0x52c0
leaq 0x14e77(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x23027
leaq 0x14e6a(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x68(%rbp)
callq 0x13930
movq -0x68(%rbp), %rdi
movq %rax, %rdx
movq -0x10(%rbp), %rcx
movq -0x28(%rbp), %r8
leaq 0xd075(%rip), %rsi      # 0x30095
movb $0x0, %al
callq 0x52c0
jmp 0x23029
jmp 0x2302b
movq -0x28(%rbp), %rax
movl %eax, -0x4(%rbp)
jmp 0x2304b
cmpq $0x0, -0x20(%rbp)
je 0x23044
movq -0x20(%rbp), %rdi
callq 0x5130
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/device.c
// Function: conf_get_val
static int conf_get_val(const char *fname, const char *key)
{
    char buff[128] = {'\0'};
    FILE *fp = fopen(fname, "r");
    if (!fp)
        return CM_INVALID_VAL;

    while (fgets(buff, sizeof(buff)-1, fp)) {
        char prefix[128] = {'\0'};
        char tail[128] = {'\0'};
        /* To eliminate cppcheck warnning: Assume string length is no more than 15 */
        sscanf(buff, "%15[^=]=%15s", prefix, tail);
        if (!strncasecmp(prefix, key, strlen(key))) {
            fclose(fp);
            return atoi(tail);
        }
    }

    fclose(fp);
    return CM_INVALID_VAL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1c0, %rsp            # imm = 0x1C0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
leaq -0xa0(%rbp), %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0x5200
movq -0x10(%rbp), %rdi
leaq 0xc356(%rip), %rsi      # 0x2f3e7
callq 0x5480
movq %rax, -0xa8(%rbp)
cmpq $0x0, -0xa8(%rbp)
jne 0x230b3
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x23192
jmp 0x230b5
leaq -0xa0(%rbp), %rdi
movq -0xa8(%rbp), %rdx
movl $0x7f, %esi
callq 0x5270
cmpq $0x0, %rax
je 0x2317f
leaq -0x130(%rbp), %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0x5200
leaq -0x1b0(%rbp), %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0x5200
leaq -0xa0(%rbp), %rdi
leaq -0x130(%rbp), %rdx
leaq -0x1b0(%rbp), %rcx
leaq 0xd075(%rip), %rsi      # 0x3018e
movb $0x0, %al
callq 0x53a0
leaq -0x130(%rbp), %rax
movq %rax, -0x1c0(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x1b8(%rbp)
movq -0x18(%rbp), %rdi
callq 0x5160
movq -0x1c0(%rbp), %rdi
movq -0x1b8(%rbp), %rsi
movq %rax, %rdx
callq 0x5380
cmpl $0x0, %eax
jne 0x2317a
movq -0xa8(%rbp), %rdi
callq 0x5130
leaq -0x1b0(%rbp), %rdi
callq 0x54c0
movl %eax, -0x4(%rbp)
jmp 0x23192
jmp 0x230b5
movq -0xa8(%rbp), %rdi
callq 0x5130
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/atc.c
// Function: requestBaseBandVersion
static int requestBaseBandVersion(PROFILE_T *profile) {
    int retVal = -1;
    int err;
    ATResponse *p_response = NULL;

    (void)profile;

    err = at_send_command_multiline("AT+CGMR", "\0", &p_response);
    if (at_response_error(err, p_response))
        goto exit;

    if (p_response->p_intermediates && p_response->p_intermediates->line) {
        strncpy(profile->BaseBandVersion, p_response->p_intermediates->line, sizeof(profile->BaseBandVersion));
        retVal = 0;
    }

exit:
    safe_at_response_free(p_response);
    return retVal;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
movq $0x0, -0x18(%rbp)
leaq 0xc8c2(%rip), %rdi      # 0x30314
leaq 0xc7a7(%rip), %rsi      # 0x30200
leaq -0x18(%rbp), %rdx
callq 0x27030
movl %eax, -0x10(%rbp)
cmpl $0x0, -0x10(%rbp)
jne 0x23a86
cmpq $0x0, -0x18(%rbp)
je 0x23a86
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x23a86
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x23a88
jmp 0x23acc
movq -0x18(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x23aca
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
cmpq $0x0, 0x8(%rax)
je 0x23aca
movq -0x8(%rbp), %rdi
addq $0x216, %rdi            # imm = 0x216
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rsi
movl $0x40, %edx
callq 0x5080
movl $0x0, -0xc(%rbp)
jmp 0x23acc
cmpq $0x0, -0x18(%rbp)
je 0x23ae4
movq -0x18(%rbp), %rdi
callq 0x26d20
movq $0x0, -0x18(%rbp)
movl -0xc(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/atc.c
// Function: requestEnterSimPin
static int requestEnterSimPin(const char *pPinCode) {
    int retVal = -1;
    int err;
    ATResponse *p_response = NULL;
    char *cmd = NULL;

    asprintf(&cmd, "AT+CPIN=%s", pPinCode);
    err = at_send_command(cmd, NULL);
    safe_free(cmd);

    if (!at_response_error(err, p_response)) {
        retVal = 0;
    }

    safe_at_response_free(p_response);
    return retVal;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rdx
leaq -0x20(%rbp), %rdi
leaq 0xc675(%rip), %rsi      # 0x30347
movb $0x0, %al
callq 0x53c0
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x26d90
movl %eax, -0x10(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x23d01
movq -0x20(%rbp), %rdi
callq 0x5040
movq $0x0, -0x20(%rbp)
jmp 0x23d03
cmpl $0x0, -0x10(%rbp)
jne 0x23d2b
cmpq $0x0, -0x18(%rbp)
je 0x23d2b
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x23d2b
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x23d2b
movl $0x0, -0xc(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x23d43
movq -0x18(%rbp), %rdi
callq 0x26d20
movq $0x0, -0x18(%rbp)
movl -0xc(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/atc.c
// Function: requestDeactivateDefaultPDP
static int requestDeactivateDefaultPDP(PROFILE_T *profile, int curIpFamily) {
    char *cmd = NULL;
    int pdp = profile->pdp;

    (void)curIpFamily;

    if (asr_style_atc)
        asprintf(&cmd, "AT+QNETDEVCTL=0,%d,%d", pdp, 0);
    else
        asprintf(&cmd, "AT+QNETDEVCTL=%d,0,%d", pdp, 0);
    at_send_command(cmd, NULL);
    safe_free(cmd);

    //dbg_time("%s err=%d", __func__, err);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rax
movl 0x48(%rax), %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, 0x14074(%rip)     # 0x3910c
je 0x250b3
movl -0x1c(%rbp), %edx
leaq -0x18(%rbp), %rdi
leaq 0xb4a5(%rip), %rsi      # 0x3054d
xorl %ecx, %ecx
movb $0x0, %al
callq 0x53c0
jmp 0x250ca
movl -0x1c(%rbp), %edx
leaq -0x18(%rbp), %rdi
leaq 0xb4a2(%rip), %rsi      # 0x30563
xorl %ecx, %ecx
movb $0x0, %al
callq 0x53c0
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x26d90
cmpq $0x0, -0x18(%rbp)
je 0x250ef
movq -0x18(%rbp), %rdi
callq 0x5040
movq $0x0, -0x18(%rbp)
jmp 0x250f1
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/atc.c
// Function: requestGetICCID
static int requestGetICCID(void) {
    int retVal = -1;
    int err;
    ATResponse *p_response = NULL;
    char *iccid;

    err = at_send_command_singleline("AT+QCCID", "+QCCID:", &p_response);
    if (at_response_error(err, p_response)) goto _error;
    if (!p_response->p_intermediates || !p_response->p_intermediates->line) goto _error;

    err = at_tok_scanf(p_response->p_intermediates->line, "%s", &iccid);
    if (err != 1) goto _error;

    if (iccid && iccid[0]) {
        dbg_time("%s %s", __func__, iccid);
        retVal = 0;
    }

_error:
    safe_at_response_free(p_response);
    return retVal;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movq $0x0, -0x10(%rbp)
leaq 0xa459(%rip), %rdi      # 0x307e7
leaq 0xa45b(%rip), %rsi      # 0x307f0
leaq -0x10(%rbp), %rdx
callq 0x26e80
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
jne 0x263c2
cmpq $0x0, -0x10(%rbp)
je 0x263c2
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x263c2
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x263c7
jmp 0x264a9
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x263e1
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
cmpq $0x0, 0x8(%rax)
jne 0x263e6
jmp 0x264a9
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0x9c61(%rip), %rsi      # 0x3005a
leaq -0x18(%rbp), %rdx
movb $0x0, %al
callq 0x28860
movl %eax, -0x8(%rbp)
cmpl $0x1, -0x8(%rbp)
je 0x26412
jmp 0x264a9
cmpq $0x0, -0x18(%rbp)
je 0x264a7
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x264a7
jmp 0x2642b
movq 0x10bae(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x20(%rbp)
callq 0x13930
movq -0x20(%rbp), %rdi
movq %rax, %rdx
movq -0x18(%rbp), %r8
leaq 0x7550(%rip), %rsi      # 0x2d9a0
leaq 0xa3a1(%rip), %rcx      # 0x307f8
movb $0x0, %al
callq 0x52c0
leaq 0x11a03(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x2649e
leaq 0x119f6(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x28(%rbp)
callq 0x13930
movq -0x28(%rbp), %rdi
movq %rax, %rdx
movq -0x18(%rbp), %r8
leaq 0x7510(%rip), %rsi      # 0x2d9a0
leaq 0xa361(%rip), %rcx      # 0x307f8
movb $0x0, %al
callq 0x52c0
jmp 0x264a0
movl $0x0, -0x4(%rbp)
jmp 0x264a9
cmpq $0x0, -0x10(%rbp)
je 0x264c1
movq -0x10(%rbp), %rdi
callq 0x26d20
movq $0x0, -0x10(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/atc.c
// Function: requestGetIMSI
static int requestGetIMSI(void) {
    int retVal = -1;
    int err;
    ATResponse *p_response = NULL;
    char *imsi;

    err = at_send_command_numeric("AT+CIMI", &p_response);
    if (at_response_error(err, p_response)) goto _error;
    if (!p_response->p_intermediates || !p_response->p_intermediates->line) goto _error;

    imsi = p_response->p_intermediates->line;
    if (imsi) {
        dbg_time("%s %s", __func__, imsi);
        retVal = 0;
    }

_error:
    safe_at_response_free(p_response);
    return retVal;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movq $0x0, -0x10(%rbp)
leaq 0xa31a(%rip), %rdi      # 0x30808
leaq -0x10(%rbp), %rsi
callq 0x26f10
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
jne 0x2651b
cmpq $0x0, -0x10(%rbp)
je 0x2651b
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x2651b
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x26520
jmp 0x265d6
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x2653a
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
cmpq $0x0, 0x8(%rax)
jne 0x2653f
jmp 0x265d6
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x265d4
jmp 0x26558
movq 0x10a81(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x20(%rbp)
callq 0x13930
movq -0x20(%rbp), %rdi
movq %rax, %rdx
movq -0x18(%rbp), %r8
leaq 0x7423(%rip), %rsi      # 0x2d9a0
leaq 0xa28c(%rip), %rcx      # 0x30810
movb $0x0, %al
callq 0x52c0
leaq 0x118d6(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x265cb
leaq 0x118c9(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x28(%rbp)
callq 0x13930
movq -0x28(%rbp), %rdi
movq %rax, %rdx
movq -0x18(%rbp), %r8
leaq 0x73e3(%rip), %rsi      # 0x2d9a0
leaq 0xa24c(%rip), %rcx      # 0x30810
movb $0x0, %al
callq 0x52c0
jmp 0x265cd
movl $0x0, -0x4(%rbp)
jmp 0x265d6
cmpq $0x0, -0x10(%rbp)
je 0x265ee
movq -0x10(%rbp), %rdi
callq 0x26d20
movq $0x0, -0x10(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/atc.c
// Function: onUnsolicited
static void onUnsolicited (const char *s, const char *sms_pdu)
{
    (void)sms_pdu;

    if (strStartsWith(s, "+QNETDEVSTATUS:")) {
        qmidevice_send_event_to_main(RIL_UNSOL_DATA_CALL_LIST_CHANGED);
    }
    else if (strStartsWith(s, "+CGREG:")
        || strStartsWith(s, "+CEREG:")
        || strStartsWith(s, "+C5GREG:")) {
        qmidevice_send_event_to_main(RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x9c71(%rip), %rsi      # 0x3028c
callq 0x26a30
cmpl $0x0, %eax
je 0x26631
movl $0x1005, %edi           # imm = 0x1005
callq 0x8240
jmp 0x2667c
movq -0x8(%rbp), %rdi
leaq 0x9cad(%rip), %rsi      # 0x302e9
callq 0x26a30
cmpl $0x0, %eax
jne 0x26670
movq -0x8(%rbp), %rdi
leaq 0x9ca0(%rip), %rsi      # 0x302f1
callq 0x26a30
cmpl $0x0, %eax
jne 0x26670
movq -0x8(%rbp), %rdi
leaq 0x9c93(%rip), %rsi      # 0x302f9
callq 0x26a30
cmpl $0x0, %eax
je 0x2667a
movl $0x1004, %edi           # imm = 0x1004
callq 0x8240
jmp 0x2667c
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/atchannel.c
// Function: strStartsWith
int strStartsWith(const char *line, const char *prefix)
{
    for ( ; *line != '\0' && *prefix != '\0' ; line++, prefix++) {
        if (*line != *prefix) {
            return 0;
        }
    }

    return *prefix == '\0';
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x19(%rbp)
je 0x26a5d
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x19(%rbp)
movb -0x19(%rbp), %al
testb $0x1, %al
jne 0x26a66
jmp 0x26a9d
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
movq -0x18(%rbp), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
je 0x26a81
movl $0x0, -0x4(%rbp)
jmp 0x26ab2
jmp 0x26a83
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x26a3c
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/atchannel.c
// Function: at_open
int at_open(int fd, ATUnsolHandler h)
{
    int ret;
    pthread_attr_t attr;

    s_fd = fd;
    s_unsolHandler = h;
    s_readerClosed = 0;

    s_responsePrefix = NULL;
    s_smsPDU = NULL;
    sp_response = NULL;
    
    pthread_attr_init (&attr);
    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);

    ret = pthread_create(&s_tid_reader, &attr, readerLoop, NULL);

    if (ret < 0) {
        LOGE("readerLoop create fail!");
        perror ("pthread_create\n");
        return -1;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl -0x8(%rbp), %eax
movl %eax, 0x10968(%rip)     # 0x37440
movq -0x10(%rbp), %rax
movq %rax, 0x1263d(%rip)     # 0x39120
movl $0x0, 0x1263b(%rip)     # 0x39128
movq $0x0, 0x12638(%rip) # 0x39130
movq $0x0, 0x12635(%rip) # 0x39138
movq $0x0, 0x12632(%rip) # 0x39140
leaq -0x50(%rbp), %rdi
callq 0x5260
leaq -0x50(%rbp), %rdi
movl $0x1, %esi
callq 0x5330
leaq 0x1261c(%rip), %rdi     # 0x39148
leaq -0x50(%rbp), %rsi
leaq 0x99(%rip), %rdx        # 0x26bd0
xorl %eax, %eax
movl %eax, %ecx
callq 0x53e0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0x26bbf
jmp 0x26b4b
movq 0x1048e(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x58(%rbp)
callq 0x13930
movq -0x58(%rbp), %rdi
movq %rax, %rdx
leaq 0x9cc4(%rip), %rsi      # 0x30830
movb $0x0, %al
callq 0x52c0
leaq 0x112ee(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x26ba8
leaq 0x112e1(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x60(%rbp)
callq 0x13930
movq -0x60(%rbp), %rdi
movq %rax, %rdx
leaq 0x9c8f(%rip), %rsi      # 0x30830
movb $0x0, %al
callq 0x52c0
jmp 0x26baa
leaq 0x9c9d(%rip), %rdi      # 0x3084e
callq 0x54a0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x26bc6
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
callq 0x27790
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x26bee
jmp 0x26c4c
movq -0x10(%rbp), %rdi
callq 0x27490
cmpl $0x0, %eax
je 0x26c41
movq -0x10(%rbp), %rdi
callq 0x5530
movq %rax, -0x18(%rbp)
callq 0x27790
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x26c1b
jmp 0x26c4c
cmpq $0x0, 0x124fd(%rip)     # 0x39120
je 0x26c36
movq 0x124f4(%rip), %rax     # 0x39120
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq *%rax
movq -0x18(%rbp), %rdi
callq 0x5040
jmp 0x26c4a
movq -0x10(%rbp), %rdi
callq 0x27500
jmp 0x26bdc
callq 0x28170
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/atchannel.c
// Function: at_close
void at_close()
{
    dbg_time("at_close");
    if (s_fd >= 0) {
        close(s_fd);
    }
    s_fd = -1;

    pthread_mutex_lock(&cm_command_mutex);

    s_readerClosed = 1;

    pthread_cond_signal(&cm_command_cond);

    pthread_mutex_unlock(&cm_command_mutex);

    /* the reader thread should eventually die */
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
jmp 0x26c6a
movq 0x1036f(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x8(%rbp)
callq 0x13930
movq -0x8(%rbp), %rdi
movq %rax, %rdx
leaq 0x9bd3(%rip), %rsi      # 0x3085e
movb $0x0, %al
callq 0x52c0
leaq 0x111cf(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x26cc7
leaq 0x111c2(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x10(%rbp)
callq 0x13930
movq -0x10(%rbp), %rdi
movq %rax, %rdx
leaq 0x9b9e(%rip), %rsi      # 0x3085e
movb $0x0, %al
callq 0x52c0
jmp 0x26cc9
cmpl $0x0, 0x10770(%rip)     # 0x37440
jl 0x26cdd
movl 0x10768(%rip), %edi     # 0x37440
callq 0x5230
movl $0xffffffff, 0x10759(%rip) # imm = 0xFFFFFFFF
leaq 0x11122(%rip), %rdi     # 0x37e10
callq 0x5570
movl $0x1, 0x1242b(%rip)     # 0x39128
leaq 0x11134(%rip), %rdi     # 0x37e38
callq 0x5280
leaq 0x11100(%rip), %rdi     # 0x37e10
callq 0x5350
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/atchannel.c
// Function: at_response_free
void at_response_free(ATResponse *p_response)
{
    ATLine *p_line;

    if (p_response == NULL) return;

    p_line = p_response->p_intermediates;

    while (p_line != NULL) {
        ATLine *p_toFree;

        p_toFree = p_line;
        p_line = p_line->p_next;

        free(p_toFree->line);
        free(p_toFree);
    }

    free (p_response->finalResponse);
    free (p_response);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x26d35
jmp 0x26d89
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x26d73
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x5040
movq -0x18(%rbp), %rdi
callq 0x5040
jmp 0x26d41
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x5040
movq -0x8(%rbp), %rdi
callq 0x5040
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/atchannel.c
// Function: at_send_command
int at_send_command (const char *command, ATResponse **pp_outResponse)
{
    int err;

    err = at_send_command_full (command, NO_RESULT, NULL,
                                    NULL, 0, pp_outResponse);

    return err;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %r9
xorl %esi, %esi
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rdx
movq %r8, %rcx
callq 0x26dd0
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/atchannel.c
// Function: at_send_command_full
static int at_send_command_full (const char *command, ATCommandType type,
                    const char *responsePrefix, const char *smspdu,
                    long long timeoutMsec, ATResponse **pp_outResponse)
{
    int err;

    if (0 != pthread_equal(s_tid_reader, pthread_self())) {
        /* cannot be called from reader thread */
        return AT_ERROR_INVALID_THREAD;
    }

    pthread_mutex_lock(&cm_command_mutex);

    err = at_send_command_full_nolock(command, type,
                    responsePrefix, smspdu,
                    timeoutMsec, pp_outResponse);

    pthread_mutex_unlock(&cm_command_mutex);

    if (err == AT_ERROR_TIMEOUT && s_onTimeout != NULL) {
        s_onTimeout();
    }

    return err;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq 0x12352(%rip), %rax     # 0x39148
movq %rax, -0x48(%rbp)
callq 0x5410
movq -0x48(%rbp), %rdi
movq %rax, %rsi
callq 0x5400
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x26e1c
movl $0xfffffffb, -0x4(%rbp) # imm = 0xFFFFFFFB
jmp 0x26e6f
leaq 0x10fed(%rip), %rdi     # 0x37e10
callq 0x5570
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %r8
movq -0x38(%rbp), %r9
callq 0x27190
movl %eax, -0x3c(%rbp)
leaq 0x10fc2(%rip), %rdi     # 0x37e10
callq 0x5350
cmpl $-0x4, -0x3c(%rbp)
jne 0x26e69
cmpq $0x0, 0x122ff(%rip)     # 0x39160
je 0x26e69
callq *0x122f7(%rip)          # 0x39160
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/atchannel.c
// Function: at_send_command_singleline
int at_send_command_singleline (const char *command,
                                const char *responsePrefix,
                                 ATResponse **pp_outResponse)
{
    int err;

    err = at_send_command_full (command, SINGLELINE, responsePrefix,
                                    NULL, 0, pp_outResponse);

    if (err == 0 && pp_outResponse != NULL
        && (*pp_outResponse)->success > 0
        && (*pp_outResponse)->p_intermediates == NULL
    ) {
        /* successful command must have an intermediate response */
        at_response_free(*pp_outResponse);
        *pp_outResponse = NULL;
        return AT_ERROR_INVALID_RESPONSE;
    }

    return err;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %r9
movl $0x2, %esi
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rcx
callq 0x26dd0
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x26efc
cmpq $0x0, -0x20(%rbp)
je 0x26efc
movq -0x20(%rbp), %rax
movq (%rax), %rax
cmpl $0x0, (%rax)
jle 0x26efc
movq -0x20(%rbp), %rax
movq (%rax), %rax
cmpq $0x0, 0x10(%rax)
jne 0x26efc
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x26d20
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
movl $0xfffffffa, -0x4(%rbp) # imm = 0xFFFFFFFA
jmp 0x26f02
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/atchannel.c
// Function: at_send_command_numeric
int at_send_command_numeric (const char *command,
                                 ATResponse **pp_outResponse)
{
    int err;

    err = at_send_command_full (command, NUMERIC, NULL,
                                    NULL, 0, pp_outResponse);

    if (err == 0 && pp_outResponse != NULL
        && (*pp_outResponse)->success > 0
        && (*pp_outResponse)->p_intermediates == NULL
    ) {
        /* successful command must have an intermediate response */
        at_response_free(*pp_outResponse);
        *pp_outResponse = NULL;
        return AT_ERROR_INVALID_RESPONSE;
    }

    return err;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %r9
movl $0x1, %esi
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rdx
movq %r8, %rcx
callq 0x26dd0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x26f87
cmpq $0x0, -0x18(%rbp)
je 0x26f87
movq -0x18(%rbp), %rax
movq (%rax), %rax
cmpl $0x0, (%rax)
jle 0x26f87
movq -0x18(%rbp), %rax
movq (%rax), %rax
cmpq $0x0, 0x10(%rax)
jne 0x26f87
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x26d20
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
movl $0xfffffffa, -0x4(%rbp) # imm = 0xFFFFFFFA
jmp 0x26f8d
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/atchannel.c
// Function: at_send_command_sms
int at_send_command_sms (const char *command,
                                const char *pdu,
                                const char *responsePrefix,
                                 ATResponse **pp_outResponse)
{
    int err;

    err = at_send_command_full (command, SINGLELINE, responsePrefix,
                                    pdu, 0, pp_outResponse);

    if (err == 0 && pp_outResponse != NULL
        && (*pp_outResponse)->success > 0
        && (*pp_outResponse)->p_intermediates == NULL
    ) {
        /* successful command must have an intermediate response */
        at_response_free(*pp_outResponse);
        *pp_outResponse = NULL;
        return AT_ERROR_INVALID_RESPONSE;
    }

    return err;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x28(%rbp), %r9
movl $0x2, %esi
xorl %eax, %eax
movl %eax, %r8d
callq 0x26dd0
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jne 0x27021
cmpq $0x0, -0x28(%rbp)
je 0x27021
movq -0x28(%rbp), %rax
movq (%rax), %rax
cmpl $0x0, (%rax)
jle 0x27021
movq -0x28(%rbp), %rax
movq (%rax), %rax
cmpq $0x0, 0x10(%rax)
jne 0x27021
movq -0x28(%rbp), %rax
movq (%rax), %rdi
callq 0x26d20
movq -0x28(%rbp), %rax
movq $0x0, (%rax)
movl $0xfffffffa, -0x4(%rbp) # imm = 0xFFFFFFFA
jmp 0x27027
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/atchannel.c
// Function: at_send_command_multiline
int at_send_command_multiline (const char *command,
                                const char *responsePrefix,
                                 ATResponse **pp_outResponse)
{
    int err;

    err = at_send_command_full (command, MULTILINE, responsePrefix,
                                    NULL, 0, pp_outResponse);

    return err;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %r9
movl $0x3, %esi
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rcx
callq 0x26dd0
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/Carton32[P]quectel-CM/atchannel.c
// Function: at_send_command_raw
int at_send_command_raw (const char *command,
                                const char *raw_data, unsigned int raw_len,
                                const char *responsePrefix,
                                 ATResponse **pp_outResponse)
{
    int err;

    s_raw_data = raw_data;
    s_raw_len = raw_len;
    err = at_send_command_full (command, SINGLELINE, responsePrefix,
                                    NULL, 0, pp_outResponse);

    return err;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, 0x120ba(%rip)     # 0x39150
movl -0x14(%rbp), %eax
movq %rax, 0x120b8(%rip)     # 0x39158
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %r9
movl $0x2, %esi
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rcx
callq 0x26dd0
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)