// File: /workspace/github_cpp_makefile_star2_O1/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 0x86c2(%rip), %r15      # 0xb1d8
movq %r15, %rdi
callq 0x2f46
movq %rax, %r14
movq %r15, %rdi
callq 0x2f46
movq %rax, %r12
movq (%r14), %r15
movq %r15, 0x10(%rsp)
testq %r15, %r15
jne 0x2b62
cmpq $0x0, 0x8(%r14)
jne 0x2b5e
movl $0x68, %edi
callq 0x21d0
movq %rax, %r15
movq %rax, %rdi
movl $0x1, %edx
callq 0x2890
movq %r15, 0x8(%r14)
movq 0x8(%r14), %r15
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x2ba3
movb 0x49(%rax), %cl
orb %bpl, %cl
jne 0x2ba3
movq 0x40(%r12), %rcx
movq 0x50(%r12), %rdx
addq $-0x8, %rdx
cmpq %rdx, %rcx
je 0x2b92
movq %rax, (%rcx)
addq $0x8, 0x40(%r12)
jmp 0x2ba3
addq $0x10, %r12
leaq 0x10(%rsp), %rsi
movq %r12, %rdi
callq 0x337e
movq %rbx, (%r14)
movb $0x0, 0x49(%rbx)
cmpq $0x0, 0x8(%rbx)
jne 0x2bc3
cmpb $0x0, 0x48(%rbx)
jne 0x2bc3
movq %r14, %rdi
callq 0x2e04
movq %rax, 0x8(%rbx)
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x2be2
movq 0x10(%rax), %rcx
testq %rcx, %rcx
sete %dl
cmpq %rbx, %rcx
sete %sil
orb %dl, %sil
je 0x2be7
xorl %r12d, %r12d
jmp 0x2bfa
xorl %r12d, %r12d
testb %bpl, %bpl
cmoveq %rcx, %r12
cmpq 0x10(%rsp), %rcx
cmovneq %rcx, %r12
testq %rax, %rax
je 0x2c03
movq %rbx, 0x10(%rax)
cmpb $0x0, 0x48(%rbx)
jne 0x2c42
leaq 0x85d8(%rip), %r13      # 0xb1e8
movq %r13, %rdi
callq 0x2270
leaq 0x18(%rbx), %rdx
movq 0x8(%rbx), %rax
movq (%rax), %rcx
movq 0x8(%rax), %r8
leaq 0xc7(%rip), %rsi        # 0x2cf5
movq %rbx, %rdi
callq 0x5e79
movq %r13, %rdi
callq 0x2180
movb $0x1, 0x48(%rbx)
testq %r12, %r12
je 0x2c56
cmpq %r12, 0x10(%rsp)
je 0x2c56
movq %r12, %rdi
callq 0x2944
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x2c98
movq 0x8(%rax), %rcx
testq %rcx, %rcx
je 0x2c86
cmpb $0x1, 0x18(%rcx)
jne 0x2c86
leaq 0xf(%rsp), %rdx
movq %rdx, 0x60(%rax)
movq (%rcx), %rsi
addq 0x8(%rcx), %rsi
subq %rdx, %rsi
movq %rsi, 0x58(%rax)
movq 0x8(%rax), %rax
cmpq 0x8(%rbx), %rax
je 0x2ca0
movq %rbx, %rdi
callq 0x299e
movq %r15, %rdi
movq %rbx, %rsi
jmp 0x2cc9
leaq 0x80(%r14), %rdi
callq 0x2eea
movq 0x10(%rsp), %rdi
movq %rdi, 0x80(%r14)
movq %rbx, 0x88(%r14)
addq $0x90, %r14
movq %r14, %rsi
callq 0x5e5c
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