// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/tests/../modules/UsingBTree/ADTSet.c
// Function: set_insert
void set_insert(Set set, Pointer value) {
	bool inserted;
	Pointer old_value;

	set->root = node_insert(set->root, set->compare, value, &inserted, &old_value);

	// Το size αλλάζει μόνο αν μπει νέος κόμβος. Στα updates κάνουμε destroy την παλιά τιμή
	if (inserted)
		set->size++;
	else if (set->destroy_value != NULL)
		set->destroy_value(old_value);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r13
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x50fd
movq 0x10(%rbx), %r15
leaq 0x14(%rsp), %rbp
movl $0x0, (%rbp)
movq %r15, %rsi
movq %r13, %rdx
movq %rbp, %rcx
movq %rdi, %r12
callq 0x5015
movq %rax, %r14
movslq (%rbp), %rax
cmpq $-0x1, %rax
je 0x5130
movq 0x40(%r14,%rax,8), %rax
movq (%rax), %rdi
movq %r13, (%rax)
movq %r12, (%rbx)
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x5364
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
movl $0x1, %edi
movl $0x68, %esi
callq 0x2160
movq %rax, %r15
movl $0x10, %edi
callq 0x21a0
movq %r13, (%rax)
movq %r15, 0x8(%rax)
movq %rax, 0x40(%r15)
movl $0x1, (%r15)
jmp 0x535e
movq %r12, 0x8(%rsp)
movl (%r14), %r12d
xorl %ebp, %ebp
testl %r12d, %r12d
jle 0x515f
movq 0x40(%r14,%rbp,8), %rax
movq (%rax), %rsi
movq %r13, %rdi
callq *%r15
movl (%r14), %r12d
testl %eax, %eax
jle 0x515f
movslq %r12d, %rax
incq %rbp
cmpq %rax, %rbp
jl 0x513f
movl $0x10, %edi
callq 0x21a0
movq %r13, (%rax)
movq %r14, 0x8(%rax)
movl %ebp, %ecx
cmpl %ebp, %r12d
jle 0x5190
movslq %r12d, %rdx
movq 0x38(%r14,%rdx,8), %rsi
movq %rsi, 0x40(%r14,%rdx,8)
leaq -0x1(%rdx), %rsi
movq %rsi, %rdx
cmpq %rcx, %rsi
jg 0x517a
movq %rax, 0x40(%r14,%rcx,8)
leal 0x1(%r12), %ebp
movl %ebp, (%r14)
cmpl $0x4, %r12d
jl 0x534e
movl $0x1, %edi
movl $0x68, %esi
callq 0x2160
movq %rax, %r13
movq 0x8(%r14), %rax
movq %rax, 0x8(%r13)
shrl %ebp
leal 0x1(%rbp), %eax
cmpq $0x0, 0x10(%r14)
movl %eax, %eax
je 0x520a
leaq (%r14,%rbp,8), %rcx
movq %rbp, %rdx
notq %rdx
movl $0x2, %esi
movq 0x8(%rcx,%rsi,8), %rdi
movq %r13, 0x8(%rdi)
cmpq $0x2, %rsi
jne 0x51f5
movq 0x10(%r13), %r8
movq %r8, 0x18(%r13)
movq %rdi, (%r13,%rsi,8)
leaq (%rdx,%rsi), %rdi
incq %rdi
incq %rsi
cmpq $0x2, %rdi
jne 0x51de
cmpl $0x1, %ebp
adcl $0x0, %ebp
xorl %ecx, %ecx
leaq (%rcx,%rax), %rdx
movq 0x40(%r14,%rdx,8), %rsi
movq %r13, 0x8(%rsi)
movslq (%r13), %rdx
cmpq %rdx, %rcx
jge 0x5241
movq %rdx, %rdi
movq 0x38(%r13,%rdi,8), %r8
movq %r8, 0x40(%r13,%rdi,8)
leaq -0x1(%rdi), %r8
movq %r8, %rdi
cmpq %rcx, %r8
jg 0x522b
movq %rsi, 0x40(%r13,%rcx,8)
incl %edx
movl %edx, (%r13)
movslq (%r14), %rdx
leal -0x1(%rdx), %esi
movl %esi, (%r14)
incq %rcx
cmpq %rbp, %rcx
jne 0x5212
leal -0x2(%rdx), %eax
movq 0x30(%r14,%rdx,8), %rbp
movl %eax, (%r14)
movq 0x8(%r14), %r12
testq %r12, %r12
je 0x5321
movl (%r12), %ecx
testl %ecx, %ecx
jle 0x52ed
xorl %r14d, %r14d
movq (%rbp), %rdi
movq 0x40(%r12,%r14,8), %rax
movq (%rax), %rsi
callq *%r15
movl (%r12), %ecx
movslq %ecx, %rdx
testl %eax, %eax
js 0x52a2
incq %r14
cmpq %rdx, %r14
jl 0x5280
leal 0x1(%r14), %eax
movq %r12, 0x8(%r13)
cmpl %r14d, %ecx
jle 0x52f9
movl %eax, %eax
movq %rdx, %rsi
incq %rsi
movq 0x8(%r12,%rsi,8), %rdi
movq %rdi, 0x10(%r12,%rsi,8)
decq %rsi
cmpq %rax, %rsi
jg 0x52b7
movq %r13, 0x10(%r12,%rax,8)
movq %r12, 0x8(%rbp)
movl %r14d, %eax
movq 0x38(%r12,%rdx,8), %rsi
movq %rsi, 0x40(%r12,%rdx,8)
leaq -0x1(%rdx), %rsi
movq %rsi, %rdx
cmpq %rax, %rsi
jg 0x52d5
jmp 0x5307
movq %r12, 0x8(%r13)
movl $0x1, %eax
xorl %r14d, %r14d
movl %eax, %eax
movq %r13, 0x10(%r12,%rax,8)
movq %r12, 0x8(%rbp)
movl %r14d, %eax
movq %rbp, 0x40(%r12,%rax,8)
leal 0x1(%rcx), %ebp
movl %ebp, (%r12)
movq %r12, %r14
cmpl $0x3, %ecx
jg 0x51a7
jmp 0x534e
movl $0x1, %edi
movl $0x68, %esi
callq 0x2160
movq %rax, 0x8(%rbp)
movq %rbp, 0x40(%rax)
movl $0x1, (%rax)
movq %rax, 0x8(%r14)
movq %rax, 0x8(%r13)
movq %r14, 0x10(%rax)
movq %r13, 0x18(%rax)
movq 0x8(%rsp), %rax
movq 0x8(%rax), %r15
testq %r15, %r15
cmoveq %rax, %r15
movq %r15, (%rbx)
incl 0x8(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq