// File: /workspace/github_c_makefile_star2_O0/meaning-matters[P]Except/Except.c
// Function: ExceptThrow
void ExceptThrow(
    Context *   pC,             /* pointer to thread exception context */
    void *      pExceptOrClass, /* rethrown exception OR class to be catched */
    void *      pData,          /* pointer to associated data or NULL */
    char *      file,           /* name of source file where invoked */
    int         line)           /* source file line number */
{
    ExceptPrintDebug(pC, "ExceptThrow");

    if (pC == NULL)
        pC = ExceptGetContext(NULL);

    if (pC == NULL || pC->exStack == NULL || LifoCount(pC->exStack) == 0)
    {
        fprintf(stderr, "%s lost: file \"%s\", line %d.\n",
                ((ClassRef)pExceptOrClass)->name, file, line);
    
        return;
    }
    
    if (((ClassRef)pExceptOrClass)->notRethrown)
    {
        pC->pEx->class         = (ClassRef)pExceptOrClass;
        pC->pEx->pData         = pData;
        pC->pEx->file          = file;
        pC->pEx->line          = line;
        pC->pEx->getMessage    = ExceptGetMessage;
        pC->pEx->getData       = ExceptGetData;
        pC->pEx->printTryTrace = ExceptPrintTryTrace;
    }
    pC->pEx->state = PENDING;   /* in case of throw() inside 'catch' */

    switch (pC->pEx->scope)
    {
    case TRY:
        ExceptPrintDebug(pC, "longjmp(throwBuf)");
        LONGJMP(pC->pEx->throwBuf, 1);

    case CATCH:
        ExceptPrintDebug(pC, "longjmp(finalBuf)");
        LONGJMP(pC->pEx->finalBuf, 1);

    case FINALLY:
        ExceptPrintDebug(pC, "longjmp(finalBuf)");
        LONGJMP(pC->pEx->finalBuf, 1);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x1e00
xorl %eax, %eax
movl %eax, %edi
callq 0x1810
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x1e24
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x1e24
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2cc0
cmpl $0x0, %eax
jne 0x1e51
movq 0x61cd(%rip), %rax      # 0x7ff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x20(%rbp), %rcx
movl -0x24(%rbp), %r8d
leaq 0x32da(%rip), %rsi      # 0x511f
movb $0x0, %al
callq 0x10a0
jmp 0x1f61
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x1ee3
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rcx, 0x198(%rax)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rcx, 0x1a0(%rax)
movq -0x20(%rbp), %rcx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rcx, 0x1a8(%rax)
movl -0x24(%rbp), %ecx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl %ecx, 0x1b0(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
leaq 0xbe(%rip), %rcx        # 0x1f70
movq %rcx, 0x1e0(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
leaq 0x119(%rip), %rcx       # 0x1fe0
movq %rcx, 0x1e8(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
leaq 0x134(%rip), %rcx       # 0x2010
movq %rcx, 0x1f0(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl $0x1, 0x4(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0x1b8(%rax), %eax
movl %eax, -0x28(%rbp)
subl $0x1, %eax
je 0x1f1c
jmp 0x1f08
movl -0x28(%rbp), %eax
subl $0x2, %eax
je 0x1f31
jmp 0x1f12
movl -0x28(%rbp), %eax
subl $0x3, %eax
je 0x1f49
jmp 0x1f61
movq -0x8(%rbp), %rax
movq (%rax), %rdi
addq $0x8, %rdi
movl $0x1, %esi
callq 0x1070
movq -0x8(%rbp), %rax
movq (%rax), %rdi
addq $0xd0, %rdi
movl $0x1, %esi
callq 0x1070
movq -0x8(%rbp), %rax
movq (%rax), %rdi
addq $0xd0, %rdi
movl $0x1, %esi
callq 0x1070
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)