// File: /workspace/github_cpp_makefile_star2_O3/yinqiwen[P]coroxx/libcoro.cpp
// Function: coroxx::LibCoroCoroutine::Resume(bool)
void LibCoroCoroutine::Resume(bool release_current)
    {
        CoroEnv& coro_env = getCoroEnv();
        CoroutineStack& coro_stack = getCoroEnv().coro_stack;
        LibCoroCoroutine* current = coro_env.current;
        coro_context* current_ctx = NULL;
        if (NULL == current)
        {
            if (NULL == coro_env.main)
            {
                CoroOptions opt;
                coro_env.main = new LibCoroCoroutine(opt, true);
            }
            current_ctx = &(coro_env.main->ctx);
        }
        else
        {
            current_ctx = &(current->ctx);
        }
        if (NULL != current && !current->waiting && !release_current)
        {
            coro_stack.push(current);
        }
        coro_env.current = this;
        waiting = false;
        if (NULL == stack && !ctx_inited)
        {
            stack = coro_env.GetCoroStack();
            //stack = new CoroStack(coro_env.stack_size, false);
        }

        LibCoroCoroutine* save_coro = NULL;
        if (NULL != stack && stack->coro && stack->coro != this)
        {
            save_coro = stack->coro;
            if (save_coro == current && release_current)
            {
                save_coro = NULL;
            }
        }
        if (NULL != stack)
        {
            stack->coro = this;
        }
//        if(NULL != save_coro)
//        {
//            //save_coro->MarkStackResumePoint();
//        }
        if (!ctx_inited)
        {
            g_create_mutex.Lock();
            coro_create(&ctx, LibCoroFunc, &data_ctx, stack->stack.sptr, stack->stack.ssze);
            g_create_mutex.Unlock();
            ctx_inited = true;
        }

        if (NULL != save_coro && current != save_coro)
        {
            save_coro->SaveStackBuffer();
        }
        if (NULL != current)
        {
            current->MarkStackResumePoint();
            if (current->stack == stack)
            {
                //printf("####WARN change current stack buffer for %d->%d\n", current->id, id);
                coro_env.swap_ctx.Init();
                coro_env.swap_ctx.from = current;
                coro_env.swap_ctx.to = this;
                coro_transfer(&(current->ctx), &(coro_env.swap_ctx.swap_coro));
                return;
            }
            ResumeStackBuffer();
        }
        coro_transfer(current_ctx, &ctx);

    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x76c0(%rip), %r15      # 0xa1d8
movq %r15, %rdi
callq 0x2f3e
movq %rax, %r14
movq %r15, %rdi
callq 0x2f3e
movq (%r14), %r15
movq %r15, 0x10(%rsp)
testq %r15, %r15
je 0x2b5c
movb 0x49(%r15), %cl
orb %bpl, %cl
jne 0x2b96
movq 0x40(%rax), %rcx
movq 0x50(%rax), %rdx
addq $-0x8, %rdx
cmpq %rdx, %rcx
je 0x2b85
movq %r15, (%rcx)
addq $0x8, 0x40(%rax)
jmp 0x2b96
movq 0x8(%r14), %r15
testq %r15, %r15
jne 0x2b96
movl $0x68, %edi
callq 0x21d0
movq %rax, %r15
movq %rax, %rdi
movl $0x1, %edx
callq 0x2890
movq %r15, 0x8(%r14)
jmp 0x2b96
addq $0x10, %rax
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x337e
movq %rbx, (%r14)
movb $0x0, 0x49(%rbx)
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x2bd5
movq 0x10(%rax), %rcx
cmpq 0x10(%rsp), %rcx
sete %dl
andb %bpl, %dl
xorl %esi, %esi
testb $0x1, %dl
movq %rcx, %r12
cmovneq %rsi, %r12
cmpq %rbx, %rcx
cmoveq %rsi, %r12
testq %rcx, %rcx
cmoveq %rcx, %r12
movq %rbx, 0x10(%rax)
jmp 0x2bef
cmpb $0x0, 0x48(%rbx)
jne 0x2bec
movq %r14, %rdi
callq 0x2df6
movq %rax, 0x8(%rbx)
testq %rax, %rax
jne 0x2ba6
xorl %r12d, %r12d
cmpb $0x0, 0x48(%rbx)
jne 0x2c2e
leaq 0x75ec(%rip), %r13      # 0xa1e8
movq %r13, %rdi
callq 0x2270
leaq 0x18(%rbx), %rdx
movq 0x8(%rbx), %rax
movq (%rax), %rcx
movq 0x8(%rax), %r8
leaq 0xcc(%rip), %rsi        # 0x2ce6
movq %rbx, %rdi
callq 0x5c8d
movq %r13, %rdi
callq 0x2180
movb $0x1, 0x48(%rbx)
testq %r12, %r12
sete %cl
movq 0x10(%rsp), %rax
cmpq %r12, %rax
sete %dl
orb %cl, %dl
jne 0x2c50
movq %r12, %rdi
callq 0x2944
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x2c89
movq 0x8(%rax), %rcx
testq %rcx, %rcx
je 0x2c7b
cmpb $0x1, 0x18(%rcx)
jne 0x2c7b
leaq 0xf(%rsp), %rdx
movq %rdx, 0x60(%rax)
movq (%rcx), %rsi
addq 0x8(%rcx), %rsi
subq %rdx, %rsi
movq %rsi, 0x58(%rax)
cmpq 0x8(%rbx), %rcx
je 0x2c91
movq %rbx, %rdi
callq 0x29a0
movq %r15, %rdi
movq %rbx, %rsi
jmp 0x2cba
leaq 0x80(%r14), %rdi
callq 0x2ee2
movq 0x10(%rsp), %rdi
movq %rdi, 0x80(%r14)
movq %rbx, 0x88(%r14)
addq $0x90, %r14
movq %r14, %rsi
callq 0x5c70
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x68, %esi
movq %r15, %rdi
callq 0x21e0
movq %rbx, %rdi
callq 0x2330