// File: /workspace/github_c_makefile_star2_O1/Carton32[P]quectel-CM/QMIThread.c
// Function: requestRadioPower
static int requestRadioPower(int state) {
    PQCQMIMSG pRequest;
    PQCQMIMSG pResponse;
    PQMUX_MSG pMUXMsg;
    int err;
    UCHAR OperatingMode = (!!state) ? DMS_OP_MODE_ONLINE : DMS_OP_MODE_LOW_POWER;
    USHORT SimOp = (!!state) ? QMIUIM_POWER_UP : QMIUIM_POWER_DOWN;
    UCHAR cardSlot = 0x01;

    dbg_time("%s(%d)", __func__, state);

    pRequest = ComposeQMUXMsg(QMUX_TYPE_DMS, QMIDMS_SET_OPERATING_MODE_REQ, DmsSetOperatingModeReq, &OperatingMode);
    err = QmiThreadSendQMI(pRequest, &pResponse);
    qmi_rsp_check_and_return();
    free(pResponse);

    pRequest = ComposeQMUXMsg(QMUX_TYPE_UIM, SimOp, UimSetCardSlotReq, &cardSlot);
    err = QmiThreadSendQMI(pRequest, &pResponse);
    qmi_rsp_check_and_return();
    free(pResponse);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edi, %ebx
xorl %ebp, %ebp
testl %edi, %edi
sete 0xf(%rsp)
sete %r13b
movb $0x1, 0xe(%rsp)
movq 0x1c7a3(%rip), %r15     # 0x29fc0
movq (%r15), %r14
callq 0xeb2f
leaq 0x1347a(%rip), %rsi     # 0x20ca6
leaq 0x13480(%rip), %rcx     # 0x20cb3
movq %r14, %rdi
movq %rax, %rdx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x52c0
leaq 0x1d45e(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0xd875
callq 0xeb2f
leaq 0x13448(%rip), %rsi     # 0x20ca6
leaq 0x1344e(%rip), %rcx     # 0x20cb3
movq %r14, %rdi
movq %rax, %rdx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x52c0
leaq 0x10f0(%rip), %rdx      # 0xe96c
leaq 0xf(%rsp), %rcx
movl $0x2, %edi
movl $0x2e, %esi
callq 0xda86
leaq 0x1341c(%rip), %rcx     # 0x20cb3
leaq 0x10(%rsp), %r14
movq %rax, %rdi
movq %r14, %rsi
movl $0x7530, %edx           # imm = 0x7530
callq 0xa317
movl %eax, %ebx
testl %eax, %eax
sets %al
movq (%r14), %r12
testq %r12, %r12
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0xd924
movq (%r15), %r14
callq 0xeb2f
leaq 0x12eb3(%rip), %rsi     # 0x20785
leaq 0x133da(%rip), %rcx     # 0x20cb3
movq %r14, %rdi
movq %rax, %rdx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x52c0
leaq 0x1d3b8(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0xd9de
callq 0xeb2f
leaq 0x12e7d(%rip), %rsi     # 0x20785
leaq 0x133a4(%rip), %rcx     # 0x20cb3
movq %r14, %rdi
movq %rax, %rdx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x52c0
jmp 0xd9de
movzwl 0x10(%r12), %edi
callq 0xef61
testw %ax, %ax
jne 0xd948
movzwl 0x12(%r12), %edi
callq 0xef61
testw %ax, %ax
je 0xd9ef
movzwl 0x12(%r12), %edi
callq 0xef61
movl %eax, %ebx
movq (%r15), %r14
callq 0xeb2f
movq %rax, %r15
movzwl 0x10(%r12), %edi
callq 0xef61
movzwl %ax, %r8d
movzwl %bx, %ebx
leaq 0x12e1e(%rip), %rsi     # 0x20797
leaq 0x13333(%rip), %rcx     # 0x20cb3
movq %r14, %rdi
movq %r15, %rdx
movl %ebx, %r9d
xorl %eax, %eax
callq 0x52c0
leaq 0x1d311(%rip), %rax     # 0x2aca8
movq (%rax), %r14
testq %r14, %r14
je 0xd9d4
callq 0xeb2f
movq %rax, %r15
movzwl 0x10(%r12), %edi
callq 0xef61
movzwl %ax, %r8d
leaq 0x12dda(%rip), %rsi     # 0x20797
leaq 0x132ef(%rip), %rcx     # 0x20cb3
movq %r14, %rdi
movq %r15, %rdx
movl %ebx, %r9d
xorl %eax, %eax
callq 0x52c0
movq 0x10(%rsp), %rdi
callq 0x5040
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb %r13b, %bpl
xorl $0x31, %ebp
leaq 0x10(%rsp), %r14
movq (%r14), %rdi
callq 0x5040
movzwl %bp, %esi
leaq 0xf8f(%rip), %rdx       # 0xe99b
leaq 0xe(%rsp), %rcx
movl $0xb, %edi
callq 0xda86
leaq 0x13291(%rip), %rcx     # 0x20cb3
movq %rax, %rdi
movq %r14, %rsi
movl $0x7530, %edx           # imm = 0x7530
callq 0xa317
movl %eax, %ebx
testl %eax, %eax
sets %al
movq (%r14), %r12
testq %r12, %r12
sete %cl
orb %al, %cl
cmpb $0x1, %cl
je 0xd8c3
movzwl 0x10(%r12), %edi
callq 0xef61
testw %ax, %ax
jne 0xd948
movzwl 0x12(%r12), %edi
callq 0xef61
testw %ax, %ax
jne 0xd948
movq 0x10(%rsp), %rdi
callq 0x5040
xorl %ebx, %ebx
jmp 0xd9de