Explanation of Asm code
My ASM is a bit fuzzy about the details, but I think I can give you a general idea.
ESP: Stack pointer, EBP: Base pointer.
movl $1f, (%0)
Move address of label 1 (defined on last line) into parameter 0 (from).
movl %%esp, 4(%0)
Move the content of register ESP into (from + 4).
movl %%ebp, 8(%0)
Move the content of register EBP into (from + 8).
movl 8(%1), %%ebp
Move the content of (to + 8) into register EBP.
movl 4(%1), %%esp
Move the content of (to + 4) into register ESP.
jmp *(%1)
Jump to address contained in (to).
The "1:" is a jump label.
"+S" declares a "source" (read) parameter, "+D" a destination (write) parameter. The list of registers at the end of the statement is the "clobber" list, a list of registers possibly modified by the ASM code, so the compiler can take steps to maintain consistency (i.e., not relying on e.g. ECX still containing the same value as before).
I guess that coco_ctx means "coco context". So: The function saves the current stack frame in the "from" structure, and sets the stack frame to what's saved in the "to" structure. Basically, it jumps from the current function into another function.
DevSolar has the right answer -- I'll just add that you can learn a little more about what EBP and ESP are for here.