// File: /workspace/github_c_makefile_star2_O1/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
movq %rsi, %r14
movq %rdi, %rbx
testq %r14, %r14
je 0x278a
movq 0x8(%rbx), %rcx
movq %r14, %rax
shrq %cl, %rax
movq 0x20(%rbx), %rdx
movq %rax, %r13
subq %rdx, %r13
cmpq %rcx, %r13
jb 0x2799
cmpq 0x28(%rbx), %r13
ja 0x27a2
movq 0x30(%rbx), %rsi
movq (%rsi,%r13,8), %r12
cmpq $0x3, %r12
jbe 0x27ab
movzwl 0x10(%r12), %eax
decq %rax
testq %r14, %rax
jne 0x27c0
andq 0x10(%rbx), %r14
movb 0x12(%r12), %cl
shrq %cl, %r14
movq %r14, %rbp
shrq $0x5, %rbp
movl 0x18(%r12,%rbp,4), %eax
movl %r14d, %ecx
andb $0x1f, %cl
movl $0x1, %r15d
shlq %cl, %r15
btl %r14d, %eax
jb 0x27c9
cmpb $0x1, 0x3da4(%rip)      # 0x6494
jne 0x26fe
leaq 0x1d31(%rip), %rdi      # 0x442a
callq 0x260f
orl %r15d, 0x18(%r12,%rbp,4)
movl 0x14(%r12), %edx
movl %edx, %ecx
incl %ecx
movw %cx, 0x14(%r12)
movzwl 0x12(%r12), %eax
shll $0x3, %eax
addq 0x30(%rbx), %rax
testw %dx, %dx
je 0x2778
cmpw 0x16(%r12), %cx
jne 0x278a
movq %rax, %rcx
movq (%rax), %rax
cmpq %r12, %rax
jne 0x272c
movq (%r12), %rax
movq %rax, (%rcx)
movq 0x30(%rbx), %rax
movq $0x2, (%rax,%r13,8)
movq 0x8(%r12), %r14
cmpq %r12, %r14
je 0x2664
movq %r12, %rdi
callq 0x1040
jmp 0x2664
movq (%rax), %rdx
testq %rdx, %rdx
je 0x2783
movq 0x8(%rdx), %rdx
cmpq 0x8(%r12), %rdx
jae 0x2783
movq %rax, %rcx
movq (%rax), %rax
testq %rax, %rax
jne 0x2765
movq %rax, (%r12)
movq %r12, (%rcx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1ba7(%rip), %rdi      # 0x4347
jmp 0x27e8
leaq 0x1bc4(%rip), %rdi      # 0x436d
jmp 0x27e8
cmpq $0x2, %r12
je 0x27d2
cmpq $0x1, %r12
jne 0x27e1
leaq 0x1bd6(%rip), %rdi      # 0x4394
jmp 0x27e8
leaq 0x1c2f(%rip), %rdi      # 0x43f6
jmp 0x27e8
leaq 0x1c42(%rip), %rdi      # 0x4412
jmp 0x27e8
testq %r14, 0x10(%rbx)
je 0x27fb
leaq 0x1be4(%rip), %rdi      # 0x43c3
jmp 0x27e8
leaq 0x1bc3(%rip), %rdi      # 0x43ab
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x260f
movq $0x1, (%rsi,%r13,8)
movq 0x30(%rbx), %rsi
movl $0x1, %r15d
cmpq $0x3, 0x8(%rsi,%r13,8)
jne 0x285a
leaq (%rsi,%r13,8), %rsi
addq $0x8, %rsi
shlq $0x3, %rax
shlq $0x3, %rdx
subq %rdx, %rax
addq $0x10, %rax
movl $0x1, %edx
movq $0x1, (%rsi)
leaq 0x1(%rdx), %r15
movq 0x30(%rbx), %rdi
leaq (%rdi,%rdx,8), %rsi
addq $0x8, %rsi
leaq (%rsi,%r13,8), %rsi
addq %rax, %rdi
cmpq $0x3, -0x8(%rdi,%rdx,8)
movq %r15, %rdx
je 0x2831
shlq %cl, %r15
cmpb $0x1, 0x3c30(%rip)      # 0x6494
jne 0x2876
movq %r14, %rdi
movl $0xd0, %esi
movq %r15, %rdx
callq 0x1130
cmpl $0x0, 0x6c(%rbx)
je 0x288c
movq %r14, %rdi
movq %r15, %rsi
movl $0x8, %edx
callq 0x11f0
leaq (%r14,%r15), %r12
cmpq $0x0, 0x78(%rbx)
jne 0x28a5
movl $0x28, %edi
callq 0x11b0
movq %rax, 0x78(%rbx)
movq 0x78(%rbx), %rax
movq %r14, 0x10(%rax)
movq %r12, 0x18(%rax)
movq %r15, 0x20(%rax)
movq 0x40(%rbx), %rsi
testq %rsi, %rsi
je 0x2900
movq %rsi, %rcx
movq 0x18(%rsi), %rdx
cmpq %r14, %rdx
jae 0x28d2
movq (%rcx), %rsi
testq %rsi, %rsi
jne 0x28be
movq 0x10(%rcx), %rsi
cmpq %r12, %rsi
jbe 0x2913
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)
xorl %edi, %edi
jmp 0x2984
leaq 0x40(%rbx), %rcx
xorl %edi, %edi
movq %rdi, (%rax)
movq %rcx, 0x8(%rax)
movq %rax, 0x40(%rbx)
jmp 0x2933
cmpq %r14, %rdx
je 0x2939
cmpq %r12, %rsi
je 0x2977
cmpq $0x0, (%rcx)
jne 0x2a49
xorl %edi, %edi
movq %rdi, (%rax)
movq %rcx, 0x8(%rax)
movq %rax, (%rcx)
movq %rdi, 0x78(%rbx)
jmp 0x2984
addq %r15, %rdx
movq %rdx, 0x18(%rcx)
addq 0x20(%rcx), %r15
movq %r15, 0x20(%rcx)
movq (%rcx), %rdi
testq %rdi, %rdi
je 0x297f
cmpq 0x10(%rdi), %rdx
jne 0x297f
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 0x2981
movq %rcx, 0x8(%rax)
jmp 0x2981
addq %r15, 0x20(%rcx)
movq %r14, 0x10(%rcx)
xorl %edi, %edi
movq %rcx, %rax
cmpq $0x0, (%rax)
jne 0x2a2d
movq 0x18(%rbx), %rcx
cmpq %rcx, 0x20(%rax)
jbe 0x2a2d
movq 0x70(%rbx), %rdx
cmpq %rdx, 0x18(%rax)
jne 0x2a2d
movq 0x80(%rbx), %rsi
movq 0x90(%rbx), %r9
movq $-0x1, %r8
cmpq %rsi, %r9
jb 0x29cf
cmpq 0x88(%rbx), %r9
cmovbeq %r9, %r8
cmpq %r8, %rdx
jne 0x2a2d
movq 0x10(%rax), %rdx
addq %rcx, %rdx
movq %rdx, 0x18(%rax)
movq %rcx, 0x20(%rax)
cmpq %rdx, %rsi
ja 0x29f8
cmpq %rdx, 0x88(%rbx)
jb 0x29f8
movq %rdx, 0x90(%rbx)
movq %rdx, 0x70(%rbx)
movb 0x8(%rbx), %cl
shrq %cl, %rdx
subq 0x20(%rbx), %rdx
movq 0x28(%rbx), %rax
cmpq %rax, %rdx
ja 0x2a26
movq %rdx, %rcx
movq 0x30(%rbx), %rsi
movq $0x0, (%rsi,%rcx,8)
incq %rcx
cmpq %rax, %rcx
jbe 0x2a12
decq %rdx
movq %rdx, 0x28(%rbx)
testq %rdi, %rdi
je 0x278a
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1040
movq 0x3a58(%rip), %rsi      # 0x64a8
leaq 0x185a(%rip), %rdi      # 0x42b1
leaq 0x18a1(%rip), %rdx      # 0x42ff
leaq 0x1979(%rip), %rcx      # 0x43de
callq *0x36dd(%rip)           # 0x6148
callq 0x1050