// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xa0, %rsp
movl %edi, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
setne %dl
xorb $-0x1, %dl
xorb $-0x1, %dl
movl $0x1, %eax
xorl %ecx, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movb %al, -0x25(%rbp)
cmpl $0x0, -0x8(%rbp)
setne %dl
xorb $-0x1, %dl
xorb $-0x1, %dl
movl $0x30, %eax
movl $0x31, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movw %ax, -0x28(%rbp)
movb $0x1, -0x29(%rbp)
movq 0x262c9(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x38(%rbp)
callq 0x13930
movq -0x38(%rbp), %rdi
movq %rax, %rdx
movl -0x8(%rbp), %r8d
leaq 0x1d163(%rip), %rsi     # 0x2de98
leaq 0x1d169(%rip), %rcx     # 0x2dea5
movb $0x0, %al
callq 0x52c0
leaq 0x2711e(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x10d83
leaq 0x27111(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x40(%rbp)
callq 0x13930
movq -0x40(%rbp), %rdi
movq %rax, %rdx
movl -0x8(%rbp), %r8d
leaq 0x1d123(%rip), %rsi     # 0x2de98
leaq 0x1d129(%rip), %rcx     # 0x2dea5
movb $0x0, %al
callq 0x52c0
jmp 0x10d85
movl $0x2, %edi
movl $0x2e, %esi
leaq 0x293a(%rip), %rdx      # 0x136d0
leaq -0x25(%rbp), %rcx
callq 0x11170
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x18(%rbp), %rsi
movl $0x7530, %edx           # imm = 0x7530
leaq 0x1d0ee(%rip), %rcx     # 0x2dea5
callq 0xc670
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jl 0x10dd0
cmpq $0x0, -0x18(%rbp)
jne 0x10e52
jmp 0x10dd2
movq 0x26207(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x48(%rbp)
callq 0x13930
movq -0x48(%rbp), %rdi
movq %rax, %rdx
movl -0x24(%rbp), %r8d
leaq 0x1cb6a(%rip), %rsi     # 0x2d961
leaq 0x1d0a7(%rip), %rcx     # 0x2dea5
movb $0x0, %al
callq 0x52c0
leaq 0x2705c(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x10e45
leaq 0x2704f(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x50(%rbp)
callq 0x13930
movq -0x50(%rbp), %rdi
movq %rax, %rdx
movl -0x24(%rbp), %r8d
leaq 0x1cb2a(%rip), %rsi     # 0x2d961
leaq 0x1d067(%rip), %rcx     # 0x2dea5
movb $0x0, %al
callq 0x52c0
jmp 0x10e47
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x11156
movq -0x18(%rbp), %rax
addq $0x6, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movzwl 0xa(%rax), %edi
callq 0x13ed0
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0x10e8c
movq -0x20(%rbp), %rax
movzwl 0xc(%rax), %edi
callq 0x13ed0
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x10f55
movq -0x20(%rbp), %rax
movzwl 0xc(%rax), %edi
callq 0x13ed0
movw %ax, -0x2c(%rbp)
movq 0x2613c(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x60(%rbp)
callq 0x13930
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rax
movzwl 0xa(%rax), %edi
callq 0x13ed0
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rdx
movzwl %ax, %r8d
movzwl -0x2c(%rbp), %r9d
leaq 0x1ca9a(%rip), %rsi     # 0x2d973
leaq 0x1cfc5(%rip), %rcx     # 0x2dea5
movb $0x0, %al
callq 0x52c0
leaq 0x26f7a(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x10f3e
leaq 0x26f6d(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x70(%rbp)
callq 0x13930
movq %rax, -0x68(%rbp)
movq -0x20(%rbp), %rax
movzwl 0xa(%rax), %edi
callq 0x13ed0
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rdx
movzwl %ax, %r8d
movzwl -0x2c(%rbp), %r9d
leaq 0x1ca43(%rip), %rsi     # 0x2d973
leaq 0x1cf6e(%rip), %rcx     # 0x2dea5
movb $0x0, %al
callq 0x52c0
jmp 0x10f40
movq -0x18(%rbp), %rdi
callq 0x5040
movzwl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x11156
jmp 0x10f57
movq -0x18(%rbp), %rdi
callq 0x5040
movl $0xb, %edi
leaq 0x27b4(%rip), %rdx      # 0x13720
leaq -0x29(%rbp), %rcx
movzwl -0x28(%rbp), %esi
callq 0x11170
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x18(%rbp), %rsi
movl $0x7530, %edx           # imm = 0x7530
leaq 0x1cf14(%rip), %rcx     # 0x2dea5
callq 0xc670
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jl 0x10faa
cmpq $0x0, -0x18(%rbp)
jne 0x1102c
jmp 0x10fac
movq 0x2602d(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x78(%rbp)
callq 0x13930
movq -0x78(%rbp), %rdi
movq %rax, %rdx
movl -0x24(%rbp), %r8d
leaq 0x1c990(%rip), %rsi     # 0x2d961
leaq 0x1cecd(%rip), %rcx     # 0x2dea5
movb $0x0, %al
callq 0x52c0
leaq 0x26e82(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x1101f
leaq 0x26e75(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0x80(%rbp)
callq 0x13930
movq -0x80(%rbp), %rdi
movq %rax, %rdx
movl -0x24(%rbp), %r8d
leaq 0x1c950(%rip), %rsi     # 0x2d961
leaq 0x1ce8d(%rip), %rcx     # 0x2dea5
movb $0x0, %al
callq 0x52c0
jmp 0x11021
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x11156
movq -0x18(%rbp), %rax
addq $0x6, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movzwl 0xa(%rax), %edi
callq 0x13ed0
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0x11066
movq -0x20(%rbp), %rax
movzwl 0xc(%rax), %edi
callq 0x13ed0
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x11144
movq -0x20(%rbp), %rax
movzwl 0xc(%rax), %edi
callq 0x13ed0
movw %ax, -0x2e(%rbp)
movq 0x25f62(%rip), %rax     # 0x36fe0
movq (%rax), %rax
movq %rax, -0x90(%rbp)
callq 0x13930
movq %rax, -0x88(%rbp)
movq -0x20(%rbp), %rax
movzwl 0xa(%rax), %edi
callq 0x13ed0
movq -0x90(%rbp), %rdi
movq -0x88(%rbp), %rdx
movzwl %ax, %r8d
movzwl -0x2e(%rbp), %r9d
leaq 0x1c8b4(%rip), %rsi     # 0x2d973
leaq 0x1cddf(%rip), %rcx     # 0x2dea5
movb $0x0, %al
callq 0x52c0
leaq 0x26d94(%rip), %rax     # 0x37e68
cmpq $0x0, (%rax)
je 0x11130
leaq 0x26d87(%rip), %rax     # 0x37e68
movq (%rax), %rax
movq %rax, -0xa0(%rbp)
callq 0x13930
movq %rax, -0x98(%rbp)
movq -0x20(%rbp), %rax
movzwl 0xa(%rax), %edi
callq 0x13ed0
movq -0xa0(%rbp), %rdi
movq -0x98(%rbp), %rdx
movzwl %ax, %r8d
movzwl -0x2e(%rbp), %r9d
leaq 0x1c851(%rip), %rsi     # 0x2d973
leaq 0x1cd7c(%rip), %rcx     # 0x2dea5
movb $0x0, %al
callq 0x52c0
jmp 0x11132
movq -0x18(%rbp), %rdi
callq 0x5040
movzwl -0x2e(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x11156
jmp 0x11146
movq -0x18(%rbp), %rdi
callq 0x5040
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)