// File: /workspace/github_c_makefile_star2_O1/chbarts[P]aa-tree/aa-tree.c
// Function: delete
static struct node *delete(struct node *t, void *data, ftype dup,
                           ftype comp, void (*del) (void *), jmp_buf env)
{
    void *l;

    if (t == NULL) {
        return NULL;
    } else if (comp(data, t->data) == -1) {
        t->left = delete(t->left, data, dup, comp, del, env);
    } else if (comp(data, t->data) == 1) {
        t->right = delete(t->right, data, dup, comp, del, env);
    } else if (dup != NULL) {
        if (dup(t->data, data) == 0) {
            return t;
        } else {
            longjmp(env, 4);
        }

    } else {
        if ((t->left == NULL) && (t->right == NULL)) {
            if (del)
                del(t->data);

            free(t);
            return NULL;
        } else if (t->left == NULL) {
            l = successor(t);
            t->right = delete(t->right, l, dup, comp, del, env);
            if (del)
                del(t->data);

            t->data = l;
        } else {
            l = predecessor(t);
            t->left = delete(t->left, l, dup, comp, del, env);
            if (del)
                del(t->data);

            t->data = l;
        }
    }

    t = decrease_level(t);
    t = skew(t);
    t->right = skew(t->right);
    t->right->right = skew(t->right->right);
    t = split(t);
    t->right = split(t->right);
    return t;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x1892
movq %r9, %r15
movq %r8, %r14
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, %rbp
movq %rdi, %rbx
movq 0x8(%rdi), %rsi
movq %rbp, %rdi
callq *%rcx
cmpl $-0x1, %eax
je 0x16fc
movq 0x8(%rbx), %rsi
movq %rbp, %rdi
callq *%r12
cmpl $0x1, %eax
jne 0x171a
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r12, %rcx
movq %r14, %r8
movq %r15, %r9
callq 0x1698
movq %rax, 0x18(%rbx)
jmp 0x1785
movq 0x10(%rbx), %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r12, %rcx
movq %r14, %r8
movq %r15, %r9
callq 0x1698
movq %rax, 0x10(%rbx)
jmp 0x1785
testq %r13, %r13
je 0x173e
movq 0x8(%rbx), %rdi
movq %rbp, %rsi
callq *%r13
testl %eax, %eax
je 0x1894
movq %r15, %rdi
movl $0x4, %esi
callq 0x1150
movq 0x10(%rbx), %rdi
movq %rdi, %rax
testq %rdi, %rdi
je 0x1838
movq %rax, %rcx
movq 0x18(%rax), %rax
testq %rax, %rax
jne 0x174e
movq 0x8(%rcx), %r13
movq %r13, %rsi
xorl %edx, %edx
movq %r12, %rcx
movq %r14, %r8
movq %r15, %r9
callq 0x1698
movq %rax, 0x10(%rbx)
testq %r14, %r14
je 0x1781
movq 0x8(%rbx), %rdi
callq *%r14
movq %r13, 0x8(%rbx)
movq 0x10(%rbx), %rdi
movq 0x18(%rbx), %rax
movl (%rdi), %edx
movl (%rax), %ecx
cmpl %ecx, %edx
cmovll %edx, %ecx
incl %ecx
cmpl (%rbx), %ecx
jge 0x17a4
movl %ecx, (%rbx)
cmpl (%rax), %ecx
jge 0x17a4
movl %ecx, (%rax)
movl (%rdi), %eax
cmpl (%rbx), %eax
jne 0x17b8
movq 0x18(%rdi), %rax
movq %rax, 0x10(%rbx)
movq %rbx, 0x18(%rdi)
jmp 0x17bb
movq %rbx, %rdi
movq 0x18(%rdi), %rcx
testq %rcx, %rcx
je 0x17e6
movq 0x10(%rcx), %rax
testq %rax, %rax
je 0x17e1
movl (%rax), %edx
cmpl (%rcx), %edx
jne 0x17e1
movq 0x18(%rax), %rdx
movq %rdx, 0x10(%rcx)
movq %rcx, 0x18(%rax)
jmp 0x17e8
movq %rcx, %rax
jmp 0x17e8
xorl %eax, %eax
movq %rax, 0x18(%rdi)
movq 0x18(%rax), %rcx
testq %rcx, %rcx
je 0x1817
movq 0x10(%rcx), %rax
testq %rax, %rax
je 0x1812
movl (%rax), %edx
cmpl (%rcx), %edx
jne 0x1812
movq 0x18(%rax), %rdx
movq %rdx, 0x10(%rcx)
movq %rcx, 0x18(%rax)
jmp 0x1819
movq %rcx, %rax
jmp 0x1819
xorl %eax, %eax
movq 0x18(%rdi), %rcx
movq %rax, 0x18(%rcx)
callq 0x1ce2
movq %rax, %rbx
movq 0x18(%rax), %rdi
callq 0x1ce2
movq %rax, 0x18(%rbx)
jmp 0x1894
cmpq $0x0, 0x18(%rbx)
je 0x187e
movq %rdi, %rax
testq %rdi, %rdi
jne 0x174e
movq 0x18(%rbx), %rdi
movq %rdi, %rcx
movq %rcx, %rax
movq 0x10(%rcx), %rcx
testq %rcx, %rcx
jne 0x1852
movq 0x8(%rax), %r13
movq %r13, %rsi
xorl %edx, %edx
movq %r12, %rcx
movq %r14, %r8
movq %r15, %r9
callq 0x1698
movq %rax, 0x18(%rbx)
jmp 0x1775
testq %r14, %r14
je 0x188a
movq 0x8(%rbx), %rdi
callq *%r14
movq %rbx, %rdi
callq 0x1030
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq