// File: mshabbirhasan[P]ups-indel/include/seqan/file/string_mmap.h
// Function: bool seqan::_remap<char, seqan::MMapConfig<seqan::File<seqan::Async<void>>, unsigned long>, unsigned long>(seqan::String<char, seqan::MMap<seqan::MMapConfig<seqan::File<seqan::Async<void>>, unsigned long>>>&, unsigned long)
inline bool 
    _remap(String<TValue, MMap<TConfig> > &me, TCapSize new_capacity) 
	{
		typedef typename Size<String<TValue, MMap<TConfig> > >::Type	TSize;
        typedef typename Size<typename TConfig::TFile>::Type			TFileSize;

        bool result = true;

#ifndef PLATFORM_WINDOWS
        // Windows doesn't allow to resize the file while having a mapped file segment
        // Thus, the following part is only supported on Linux/BSD/Mac OS
        TSize old_capacity = capacity(me);
        if (me.data_begin && new_capacity > 0)
        {
            // if file gets bigger, resize first
            if (old_capacity < new_capacity)
                resize(me.mapping, (TFileSize)new_capacity * (TFileSize)sizeof(TValue));

            me.data_begin = static_cast<TValue*>(remapFileSegment(
                me.mapping,
                me.data_begin,
                0,
                (TFileSize)old_capacity * (TFileSize)sizeof(TValue),
                (TFileSize)new_capacity * (TFileSize)sizeof(TValue)));

            // if file gets smaller, resize at last
            if (old_capacity > new_capacity)
                resize(me.mapping, (TFileSize)new_capacity * (TFileSize)sizeof(TValue));

            if (me.data_begin == NULL)
            {
                me.data_end = NULL;
                return false;
            }
            return true;
        }
#endif
        result &= _unmap(me);
        result &= _map(me, new_capacity);
        return result;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movb $0x1, -0x19(%rbp)
movq -0x10(%rbp), %rdi
callq 0xe9d0
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0xee0a
cmpq $0x0, -0x18(%rbp)
jbe 0xee0a
movq -0x28(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0xed99
movq -0x10(%rbp), %rdi
addq $0x10, %rdi
movq -0x18(%rbp), %rsi
shlq $0x0, %rsi
callq 0xee70
movq -0x10(%rbp), %rdi
addq $0x10, %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x28(%rbp), %rcx
shlq $0x0, %rcx
movq -0x18(%rbp), %r8
shlq $0x0, %r8
xorl %edx, %edx
callq 0xef00
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
cmpq -0x18(%rbp), %rax
jbe 0xede8
movq -0x10(%rbp), %rdi
addq $0x10, %rdi
movq -0x18(%rbp), %rsi
shlq $0x0, %rsi
callq 0xee70
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
jne 0xee04
movq -0x10(%rbp), %rax
movq $0x0, 0x8(%rax)
movb $0x0, -0x1(%rbp)
jmp 0xee5c
movb $0x1, -0x1(%rbp)
jmp 0xee5c
movq -0x10(%rbp), %rdi
callq 0xefb0
andb $0x1, %al
movzbl %al, %ecx
movb -0x19(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
andl %ecx, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x19(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xf030
andb $0x1, %al
movzbl %al, %ecx
movb -0x19(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
andl %ecx, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x19(%rbp)
movb -0x19(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)