// File: /workspace/github_c_makefile_star2_O0/ugobas[P]tnm/Profit_aux.c
// Function: GetWord
char *GetWord(char *buffer, char *word, int maxlen, int comma)
{
   int  i, j;
   int dic    = 0,
        escape = 0;
   char *chp;

   /* Decrement maxlen so we can terminate correctly                    */
   maxlen--;

   /* Check validity of passed pointers                                 */
   if(word==NULL)
      return(NULL);

   word[0] = '\0';
   if(buffer==NULL)
      return(NULL);

   KILLLEADSPACES(chp, buffer);

   /* Run through each character in the input buffer                    */
   for(i=0, j=0; chp[i]; i++)
   {
      switch(chp[i])
      {
      case '\\':
         /* Use backslash as an escape character. If we've just had an
            escape, then simply store it
         */
         if(escape)
         {
            escape = 0;
            if(j<maxlen)
               word[j++] = chp[i];
         }
         else
         {
            escape = 1;
         }
         break;
      case '\"':
         /* Double inverted commas enclose strings containing white space
            If we've just had an escape then handle as a normal character,
            otherwise, toggle the dic flag
         */
         if(escape)
         {
            if(j<maxlen)
               word[j++] = chp[i];
         }
         else
         {
            TOGGLE(dic);
         }
         escape = 0;
         break;
      case ',':
         /* A comma is handled as white space or a normal character,
            depending on the comma flag
         */
         if(!comma)   /* Treat as default                               */
         {
            if(j<maxlen)
               word[j++] = chp[i];
            escape = 0;
            break;
         }
         /* Otherwise, if comma is true, just fall through to treat it
            like whitespace
         */
      case ' ':
      case '\t':
         /* If we are in double inverted commas or last char was an escape
            just handle as a normal character
         */
         if(dic || escape)
         {
            if(j<maxlen)
               word[j++] = chp[i];
         }
         else
         {
            /* Otherwise, this terminates the word, so terminate, move
               the pointer on and return
            */
            word[j] = '\0';
            chp += i;
            KILLLEADSPACES(chp, chp);
            if(comma)
            {
               /* If we are handling commas as whitespace, then k
                  the comma if found
               */
               if(*chp == ',') chp++;
            }
            if(*chp == '\0') chp = NULL;
            return(chp);
         }
         escape = 0;
         break;
      default:
         /* A normal character, copy it across                          */
         if(j<maxlen)
            word[j++] = chp[i];
         escape = 0;
      }
   }

   word[j] = '\0';
   return(NULL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x6e12d
movq $0x0, -0x8(%rbp)
jmp 0x6e3fe
movq -0x18(%rbp), %rax
movb $0x0, (%rax)
cmpq $0x0, -0x10(%rbp)
jne 0x6e148
movq $0x0, -0x8(%rbp)
jmp 0x6e3fe
jmp 0x6e14a
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x20, %ecx
movb %al, -0x39(%rbp)
je 0x6e173
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x9, %eax
sete %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x6e17c
jmp 0x6e18c
jmp 0x6e17e
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x6e152
jmp 0x6e18e
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movq -0x38(%rbp), %rax
movslq -0x24(%rbp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0x6e3ea
movq -0x38(%rbp), %rax
movslq -0x24(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x40(%rbp)
subl $0x9, %eax
je 0x6e2ca
jmp 0x6e1c8
movl -0x40(%rbp), %eax
subl $0x20, %eax
je 0x6e2ca
jmp 0x6e1d6
movl -0x40(%rbp), %eax
subl $0x22, %eax
je 0x6e23f
jmp 0x6e1e0
movl -0x40(%rbp), %eax
subl $0x2c, %eax
je 0x6e28e
jmp 0x6e1ee
movl -0x40(%rbp), %eax
subl $0x5c, %eax
jne 0x6e3ab
jmp 0x6e1fc
cmpl $0x0, -0x30(%rbp)
je 0x6e233
movl $0x0, -0x30(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x6e231
movq -0x38(%rbp), %rax
movslq -0x24(%rbp), %rcx
movb (%rax,%rcx), %dl
movq -0x18(%rbp), %rax
movl -0x28(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x28(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
jmp 0x6e23a
movl $0x1, -0x30(%rbp)
jmp 0x6e3da
cmpl $0x0, -0x30(%rbp)
je 0x6e26f
movl -0x28(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x6e26d
movq -0x38(%rbp), %rax
movslq -0x24(%rbp), %rcx
movb (%rax,%rcx), %dl
movq -0x18(%rbp), %rax
movl -0x28(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x28(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
jmp 0x6e282
movl -0x2c(%rbp), %edx
movl $0x1, %eax
xorl %ecx, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
jmp 0x6e3da
cmpl $0x0, -0x20(%rbp)
jne 0x6e2c8
movl -0x28(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x6e2bc
movq -0x38(%rbp), %rax
movslq -0x24(%rbp), %rcx
movb (%rax,%rcx), %dl
movq -0x18(%rbp), %rax
movl -0x28(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x28(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl $0x0, -0x30(%rbp)
jmp 0x6e3da
jmp 0x6e2ca
cmpl $0x0, -0x2c(%rbp)
jne 0x6e2d6
cmpl $0x0, -0x30(%rbp)
je 0x6e303
movl -0x28(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x6e2fe
movq -0x38(%rbp), %rax
movslq -0x24(%rbp), %rcx
movb (%rax,%rcx), %dl
movq -0x18(%rbp), %rax
movl -0x28(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x28(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
jmp 0x6e3a2
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movl -0x24(%rbp), %ecx
movq -0x38(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x20, %ecx
movb %al, -0x41(%rbp)
je 0x6e349
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x9, %eax
sete %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0x6e352
jmp 0x6e362
jmp 0x6e354
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x6e328
jmp 0x6e364
cmpl $0x0, -0x20(%rbp)
je 0x6e384
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2c, %eax
jne 0x6e382
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x6e384
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x6e398
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6e3fe
movl $0x0, -0x30(%rbp)
jmp 0x6e3da
movl -0x28(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x6e3d3
movq -0x38(%rbp), %rax
movslq -0x24(%rbp), %rcx
movb (%rax,%rcx), %dl
movq -0x18(%rbp), %rax
movl -0x28(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x28(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl $0x0, -0x30(%rbp)
jmp 0x6e3dc
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x6e19c
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
popq %rbp
retq
nopw %cs:(%rax,%rax)