// File: /workspace/github_c_makefile_star2_O3/USArmyResearchLab[P]ARL_OpenSHMEM/src/xmalloc.c
// Function: ifree
static void
ifree( struct __xmem_struct* xm, void *ptr)
{
    struct pginfo *info;
    size_t idx;

    /* This is legal */
    if (ptr == NULL)
	return;

    idx = ptr2idx(ptr);

    if (idx < xm->malloc_pageshift) {
	wrtwarning("junk pointer, too low to make sense.\n");
	return;
    }

    if (idx > xm->last_idx) {
	wrtwarning("junk pointer, too high to make sense.\n");
	return;
    }

    info = xm->page_dir[idx];

    if (info < MALLOC_MAGIC)
        free_pages(xm, ptr, idx, info);
    else
	free_bytes(xm, ptr, idx, info);

    return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0x2826
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rbx), %rcx
movq %r14, %rax
shrq %cl, %rax
movq 0x20(%rbx), %rsi
movq %rax, %r13
subq %rsi, %r13
cmpq %rcx, %r13
jb 0x27b9
cmpq 0x28(%rbx), %r13
ja 0x27c5
movq 0x30(%rbx), %rdx
movq (%rdx,%r13,8), %r15
cmpq $0x3, %r15
jbe 0x27ce
movzwl 0x10(%r15), %eax
decq %rax
testq %r14, %rax
jne 0x27e3
andq 0x10(%rbx), %r14
movzwl 0x12(%r15), %eax
movl %eax, %ecx
shrq %cl, %r14
movq %r14, %rbp
shrq $0x5, %rbp
movl 0x18(%r15,%rbp,4), %esi
movl %r14d, %ecx
andb $0x1f, %cl
movl $0x1, %r12d
shlq %cl, %r12
btl %r14d, %esi
jb 0x27ec
cmpb $0x1, 0x3d5d(%rip)      # 0x6494
jne 0x2753
leaq 0x1cea(%rip), %rdi      # 0x442a
callq 0x2655
movl 0x18(%r15,%rbp,4), %esi
movq 0x30(%rbx), %rdx
movzwl 0x12(%r15), %eax
orl %esi, %r12d
movl %r12d, 0x18(%r15,%rbp,4)
movl 0x14(%r15), %esi
movl %esi, %ecx
incl %ecx
movw %cx, 0x14(%r15)
leaq (%rdx,%rax,8), %rax
testw %si, %si
je 0x27f5
cmpw 0x16(%r15), %cx
jne 0x2826
movq %rax, %rcx
movq (%rax), %rax
cmpq %r15, %rax
jne 0x2780
movq (%r15), %rax
movq %rax, (%rcx)
movq 0x30(%rbx), %rax
movq $0x2, (%rax,%r13,8)
movq 0x8(%r15), %r14
cmpq %r15, %r14
je 0x27ae
movq %r15, %rdi
callq 0x1040
testq %r14, %r14
jne 0x26b3
jmp 0x2826
leaq 0x1b87(%rip), %rdi      # 0x4347
jmp 0x284b
leaq 0x1ba1(%rip), %rdi      # 0x436d
jmp 0x284b
cmpq $0x2, %r15
je 0x2835
cmpq $0x1, %r15
jne 0x2844
leaq 0x1bb3(%rip), %rdi      # 0x4394
jmp 0x284b
leaq 0x1c0c(%rip), %rdi      # 0x43f6
jmp 0x284b
leaq 0x1c1f(%rip), %rdi      # 0x4412
jmp 0x284b
movq (%rax), %rsi
testq %rsi, %rsi
je 0x281a
movq %rsi, %rcx
movq %rax, %rdx
movq (%rsi), %rsi
testq %rsi, %rsi
je 0x2820
movq 0x8(%rsi), %rdi
movq %rcx, %rax
cmpq 0x8(%r15), %rdi
jb 0x27fd
jmp 0x2820
movq %rsi, %rcx
movq %rax, %rdx
movq %rcx, (%r15)
movq %r15, (%rdx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %r14, 0x10(%rbx)
je 0x285e
leaq 0x1b81(%rip), %rdi      # 0x43c3
jmp 0x284b
leaq 0x1b60(%rip), %rdi      # 0x43ab
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2655
movq $0x1, (%rdx,%r13,8)
movq 0x30(%rbx), %rdx
movl $0x1, %r15d
cmpq $0x3, 0x8(%rdx,%r13,8)
jne 0x28bd
leaq (%rdx,%r13,8), %rdx
addq $0x8, %rdx
shlq $0x3, %rax
shlq $0x3, %rsi
subq %rsi, %rax
addq $0x10, %rax
movl $0x1, %esi
movq $0x1, (%rdx)
leaq 0x1(%rsi), %r15
movq 0x30(%rbx), %rdi
leaq (%rdi,%rsi,8), %rdx
addq $0x8, %rdx
leaq (%rdx,%r13,8), %rdx
addq %rax, %rdi
cmpq $0x3, -0x8(%rdi,%rsi,8)
movq %r15, %rsi
je 0x2894
shlq %cl, %r15
cmpb $0x1, 0x3bcd(%rip)      # 0x6494
jne 0x28d9
movq %r14, %rdi
movl $0xd0, %esi
movq %r15, %rdx
callq 0x1130
cmpl $0x0, 0x6c(%rbx)
je 0x28ef
movq %r14, %rdi
movq %r15, %rsi
movl $0x8, %edx
callq 0x11f0
leaq (%r14,%r15), %r12
movq 0x78(%rbx), %rax
testq %rax, %rax
jne 0x290a
movl $0x28, %edi
callq 0x11b0
movq %rax, 0x78(%rbx)
movq %r14, 0x10(%rax)
movq %r12, 0x18(%rax)
movq %r15, 0x20(%rax)
movq 0x40(%rbx), %rsi
testq %rsi, %rsi
je 0x295c
movq %rsi, %rcx
movq 0x18(%rsi), %rdx
cmpq %r14, %rdx
jae 0x2933
movq (%rcx), %rsi
testq %rsi, %rsi
jne 0x291f
movq 0x10(%rcx), %rsi
cmpq %r12, %rsi
jbe 0x296f
movq %rcx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq %rax, 0x8(%rcx)
movq 0x8(%rax), %rcx
movq %rax, (%rcx)
movq $0x0, 0x78(%rbx)
jmp 0x299b
leaq 0x40(%rbx), %rcx
xorl %edx, %edx
movq %rdx, (%rax)
movq %rcx, 0x8(%rax)
movq %rax, 0x40(%rbx)
jmp 0x2997
cmpq %r14, %rdx
je 0x2a64
cmpq %r12, %rsi
je 0x2aa6
cmpq $0x0, (%rcx)
jne 0x2ac1
xorl %edx, %edx
movq %rdx, (%rax)
movq %rcx, 0x8(%rax)
movq %rax, (%rcx)
movq %rdx, 0x78(%rbx)
cmpq $0x0, (%rax)
jne 0x2826
xorl %edi, %edi
movq %rax, %rcx
movq 0x18(%rbx), %rdx
cmpq %rdx, %r15
jbe 0x2a48
movq 0x18(%rcx), %rax
cmpq 0x70(%rbx), %rax
jne 0x2a48
movq 0x80(%rbx), %rsi
movq 0x90(%rbx), %r9
movq $-0x1, %r8
cmpq %rsi, %r9
jb 0x29ea
cmpq 0x88(%rbx), %r9
cmovbeq %r9, %r8
cmpq %r8, %rax
jne 0x2a48
movq 0x10(%rcx), %rax
addq %rdx, %rax
movq %rax, 0x18(%rcx)
movq %rdx, 0x20(%rcx)
cmpq %rax, %rsi
ja 0x2a13
cmpq %rax, 0x88(%rbx)
jb 0x2a13
movq %rax, 0x90(%rbx)
movq %rax, 0x70(%rbx)
movb 0x8(%rbx), %cl
shrq %cl, %rax
subq 0x20(%rbx), %rax
movq 0x28(%rbx), %rcx
cmpq %rcx, %rax
ja 0x2a41
movq %rax, %rdx
movq 0x30(%rbx), %rsi
movq $0x0, (%rsi,%rdx,8)
incq %rdx
cmpq %rcx, %rdx
jbe 0x2a2d
decq %rax
movq %rax, 0x28(%rbx)
testq %rdi, %rdi
je 0x2826
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1040
addq %r15, %rdx
movq %rdx, 0x18(%rcx)
addq 0x20(%rcx), %r15
movq %r15, 0x20(%rcx)
movq (%rcx), %rdi
testq %rdi, %rdi
je 0x2aba
cmpq 0x10(%rdi), %rdx
jne 0x2ab2
movq 0x18(%rdi), %rax
movq %rax, 0x18(%rcx)
addq 0x20(%rdi), %r15
movq %r15, 0x20(%rcx)
movq (%rdi), %rax
movq %rax, (%rcx)
testq %rax, %rax
je 0x29aa
movq %rcx, 0x8(%rax)
jmp 0x2a51
addq 0x20(%rcx), %r15
movq %r15, 0x20(%rcx)
movq %r14, 0x10(%rcx)
movq %rcx, %rax
jmp 0x299b
xorl %edi, %edi
jmp 0x29aa
movq 0x39e0(%rip), %rsi      # 0x64a8
leaq 0x17e2(%rip), %rdi      # 0x42b1
leaq 0x1829(%rip), %rdx      # 0x42ff
leaq 0x1901(%rip), %rcx      # 0x43de
callq *0x3665(%rip)           # 0x6148
callq 0x1050