// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/expat-2.0.1/lib/xmlparse.c
// Function: XML_GetBuffer
void * XMLCALL
XML_GetBuffer(XML_Parser parser, int len)
{
  switch (ps_parsing) {
  case XML_SUSPENDED:
    errorCode = XML_ERROR_SUSPENDED;
    return NULL;
  case XML_FINISHED:
    errorCode = XML_ERROR_FINISHED;
    return NULL;
  default: ;
  }

  if (len > bufferLim - bufferEnd) {
    /* FIXME avoid integer overflow */
    int neededSize = len + (int)(bufferEnd - bufferPtr);
#ifdef XML_CONTEXT_BYTES
    int keep = (int)(bufferPtr - buffer);

    if (keep > XML_CONTEXT_BYTES)
      keep = XML_CONTEXT_BYTES;
    neededSize += keep;
#endif  /* defined XML_CONTEXT_BYTES */
    if (neededSize  <= bufferLim - buffer) {
#ifdef XML_CONTEXT_BYTES
      if (keep < bufferPtr - buffer) {
        int offset = (int)(bufferPtr - buffer) - keep;
        memmove(buffer, &buffer[offset], bufferEnd - bufferPtr + keep);
        bufferEnd -= offset;
        bufferPtr -= offset;
      }
#else
      memmove(buffer, bufferPtr, bufferEnd - bufferPtr);
      bufferEnd = buffer + (bufferEnd - bufferPtr);
      bufferPtr = buffer;
#endif  /* not defined XML_CONTEXT_BYTES */
    }
    else {
      char *newBuf;
      int bufferSize = (int)(bufferLim - bufferPtr);
      if (bufferSize == 0)
        bufferSize = INIT_BUFFER_SIZE;
      do {
        bufferSize *= 2;
      } while (bufferSize < neededSize);
      newBuf = (char *)MALLOC(bufferSize);
      if (newBuf == 0) {
        errorCode = XML_ERROR_NO_MEMORY;
        return NULL;
      }
      bufferLim = newBuf + bufferSize;
#ifdef XML_CONTEXT_BYTES
      if (bufferPtr) {
        int keep = (int)(bufferPtr - buffer);
        if (keep > XML_CONTEXT_BYTES)
          keep = XML_CONTEXT_BYTES;
        memcpy(newBuf, &bufferPtr[-keep], bufferEnd - bufferPtr + keep);
        FREE(buffer);
        buffer = newBuf;
        bufferEnd = buffer + (bufferEnd - bufferPtr) + keep;
        bufferPtr = buffer + keep;
      }
      else {
        bufferEnd = newBuf + (bufferEnd - bufferPtr);
        bufferPtr = buffer = newBuf;
      }
#else
      if (bufferPtr) {
        memcpy(newBuf, bufferPtr, bufferEnd - bufferPtr);
        FREE(buffer);
      }
      bufferEnd = newBuf + (bufferEnd - bufferPtr);
      bufferPtr = buffer = newBuf;
#endif  /* not defined XML_CONTEXT_BYTES */
    }
  }
  return bufferEnd;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movl %esi, 0x14(%rsp)
movq 0x18(%rsp), %rax
movl 0x378(%rax), %eax
movl %eax, (%rsp)
subl $0x2, %eax
je 0x375919
jmp 0x3758f2
movl (%rsp), %eax
subl $0x3, %eax
jne 0x375936
jmp 0x3758fc
movq 0x18(%rsp), %rax
movl $0x21, 0x208(%rax)
movq $0x0, 0x20(%rsp)
jmp 0x375b29
movq 0x18(%rsp), %rax
movl $0x24, 0x208(%rax)
movq $0x0, 0x20(%rsp)
jmp 0x375b29
jmp 0x375938
movslq 0x14(%rsp), %rax
movq 0x18(%rsp), %rcx
movq 0x40(%rcx), %rcx
movq 0x18(%rsp), %rdx
movq 0x38(%rdx), %rdx
subq %rdx, %rcx
cmpq %rcx, %rax
jle 0x375b1b
movl 0x14(%rsp), %eax
movq 0x18(%rsp), %rcx
movq 0x38(%rcx), %rcx
movq 0x18(%rsp), %rdx
movq 0x30(%rdx), %rdx
subq %rdx, %rcx
addl %ecx, %eax
movl %eax, 0x10(%rsp)
movslq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
movq 0x40(%rcx), %rcx
movq 0x18(%rsp), %rdx
movq 0x10(%rdx), %rdx
subq %rdx, %rcx
cmpq %rcx, %rax
jg 0x375a06
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x18(%rsp), %rax
movq 0x30(%rax), %rsi
movq 0x18(%rsp), %rax
movq 0x38(%rax), %rdx
movq 0x18(%rsp), %rax
movq 0x30(%rax), %rax
subq %rax, %rdx
callq 0x19bf0
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rcx
movq 0x18(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x18(%rsp), %rdx
movq 0x30(%rdx), %rdx
subq %rdx, %rax
addq %rax, %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x38(%rax)
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x30(%rax)
jmp 0x375b19
movq 0x18(%rsp), %rax
movq 0x40(%rax), %rax
movq 0x18(%rsp), %rcx
movq 0x30(%rcx), %rcx
subq %rcx, %rax
movl %eax, 0x4(%rsp)
cmpl $0x0, 0x4(%rsp)
jne 0x375a2e
movl $0x400, 0x4(%rsp)       # imm = 0x400
jmp 0x375a30
movl 0x4(%rsp), %eax
shll %eax
movl %eax, 0x4(%rsp)
movl 0x4(%rsp), %eax
cmpl 0x10(%rsp), %eax
jl 0x375a30
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rax
movslq 0x4(%rsp), %rdi
callq *%rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
jne 0x375a7e
movq 0x18(%rsp), %rax
movl $0x1, 0x208(%rax)
movq $0x0, 0x20(%rsp)
jmp 0x375b29
movq 0x8(%rsp), %rcx
movslq 0x4(%rsp), %rax
addq %rax, %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x40(%rax)
movq 0x18(%rsp), %rax
cmpq $0x0, 0x30(%rax)
je 0x375adc
movq 0x8(%rsp), %rdi
movq 0x18(%rsp), %rax
movq 0x30(%rax), %rsi
movq 0x18(%rsp), %rax
movq 0x38(%rax), %rdx
movq 0x18(%rsp), %rax
movq 0x30(%rax), %rax
subq %rax, %rdx
callq 0x19610
movq 0x18(%rsp), %rax
movq 0x28(%rax), %rax
movq 0x18(%rsp), %rcx
movq 0x10(%rcx), %rdi
callq *%rax
movq 0x8(%rsp), %rcx
movq 0x18(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x18(%rsp), %rdx
movq 0x30(%rdx), %rdx
subq %rdx, %rax
addq %rax, %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x38(%rax)
movq 0x8(%rsp), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x18(%rsp), %rax
movq %rcx, 0x30(%rax)
jmp 0x375b1b
movq 0x18(%rsp), %rax
movq 0x38(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)