// File: /workspace/github_c_makefile_star2_O0/sheneman[P]clearcut/dmat.c
// Function: NJ_is_distance
static inline
int
NJ_is_distance(char *token) {
  
  int i;
  char c;
  int exponent_state;
  int expsign_state;
  int dpoint_state;

  /* if token is NULL return failure */
  if(!token) {
    return(0);
  }
  
  exponent_state = 0;
  expsign_state  = 0;
  dpoint_state   = 0;
  
  /* The first character must be a number, a decimal point or a sign */
  c = token[0];
  if(!NJ_is_number(c) &&
     c != '.'         &&
     c != '-'         &&
     c != '+' )  {
    
    goto BAD;
  } 
  
  /* 
   * if the first character is not a number, and string is only one 
   * character long, then we return failure.
   */
  if(strlen(token) == 1) {
    if(!NJ_is_number(c)) {
      goto BAD;
    }
  }
  
  for(i=0;i<strlen(token);i++) {

    c = token[i];
    
    /* make sure that all chars in dist string are in list of valid chars */
    if(!NJ_is_number(c) &&
       c != '.'         &&
       c != '-'         &&
       c != '+'         &&
       c != 'e'         &&
       c != 'E'         ) {

      goto BAD;
    }

    /* not the first char and we are not in exponent state but read (+,-) */
    if(i>0 && !exponent_state) {
      if(c == '-' || 
	 c == '+') {
	goto BAD;
      }
    }

    /* if we are in the exponent state, and we've already seen a sign */
    if(exponent_state && expsign_state) {
      if(c == '-' ||
	 c == '+') {
	goto BAD;
      }
    }
    
    /* if we are in the exponent state and we see a decimal point */
    if(exponent_state) {
      if(c == '.') {
	goto BAD;
      }
    }
    
    /* if we are in the exponent state and see another e or E */
    if(exponent_state) {
      if(c == 'e' ||
	 c == 'E') {
	goto BAD;
      }
    }
    
    /* if we are dpoint_state and see another decimal point */
    if(dpoint_state) {
      if(c == '.') {
	goto BAD;
      }
    }
    
    
    /* enter the exponent state if we need to */
    if(!exponent_state) {
      if(c == 'e' ||
	 c == 'E') {
	exponent_state = 1;
      }
    }

    /* enter the expsign_state if we need to */
    if(exponent_state && !expsign_state) {
      if(c == '-' ||
	 c == '+') {
	expsign_state = 1;
      }
    }

    /* if not in dpoint state and we see a dpoint */
    if(!dpoint_state) {
      if(c == '.') {
	dpoint_state = 1;
      }
    }

  }
  
  /* the token must end in a number char */
  if(!NJ_is_number(token[strlen(token)-1])) {
    goto BAD;
  }
  
  /* token is a valid numerical distance */
  return(1);
  
 BAD:

  /* token is invalid distance format */
  return(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x730f
movl $0x0, -0x4(%rbp)
jmp 0x7536
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x10(%rbp), %rax
movb (%rax), %al
movb %al, -0x15(%rbp)
movsbl -0x15(%rbp), %edi
callq 0x7540
cmpl $0x0, %eax
jne 0x735b
movsbl -0x15(%rbp), %eax
cmpl $0x2e, %eax
je 0x735b
movsbl -0x15(%rbp), %eax
cmpl $0x2d, %eax
je 0x735b
movsbl -0x15(%rbp), %eax
cmpl $0x2b, %eax
je 0x735b
jmp 0x752f
movq -0x10(%rbp), %rdi
callq 0x20c0
cmpq $0x1, %rax
jne 0x737f
movsbl -0x15(%rbp), %edi
callq 0x7540
cmpl $0x0, %eax
jne 0x737d
jmp 0x752f
jmp 0x737f
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0x20c0
movq %rax, %rcx
movq -0x30(%rbp), %rax
cmpq %rcx, %rax
jae 0x74fa
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x15(%rbp)
movsbl -0x15(%rbp), %edi
callq 0x7540
cmpl $0x0, %eax
jne 0x73f5
movsbl -0x15(%rbp), %eax
cmpl $0x2e, %eax
je 0x73f5
movsbl -0x15(%rbp), %eax
cmpl $0x2d, %eax
je 0x73f5
movsbl -0x15(%rbp), %eax
cmpl $0x2b, %eax
je 0x73f5
movsbl -0x15(%rbp), %eax
cmpl $0x65, %eax
je 0x73f5
movsbl -0x15(%rbp), %eax
cmpl $0x45, %eax
je 0x73f5
jmp 0x752f
cmpl $0x0, -0x14(%rbp)
jle 0x741a
cmpl $0x0, -0x1c(%rbp)
jne 0x741a
movsbl -0x15(%rbp), %eax
cmpl $0x2d, %eax
je 0x7413
movsbl -0x15(%rbp), %eax
cmpl $0x2b, %eax
jne 0x7418
jmp 0x752f
jmp 0x741a
cmpl $0x0, -0x1c(%rbp)
je 0x743f
cmpl $0x0, -0x20(%rbp)
je 0x743f
movsbl -0x15(%rbp), %eax
cmpl $0x2d, %eax
je 0x7438
movsbl -0x15(%rbp), %eax
cmpl $0x2b, %eax
jne 0x743d
jmp 0x752f
jmp 0x743f
cmpl $0x0, -0x1c(%rbp)
je 0x7455
movsbl -0x15(%rbp), %eax
cmpl $0x2e, %eax
jne 0x7453
jmp 0x752f
jmp 0x7455
cmpl $0x0, -0x1c(%rbp)
je 0x7474
movsbl -0x15(%rbp), %eax
cmpl $0x65, %eax
je 0x746d
movsbl -0x15(%rbp), %eax
cmpl $0x45, %eax
jne 0x7472
jmp 0x752f
jmp 0x7474
cmpl $0x0, -0x24(%rbp)
je 0x748a
movsbl -0x15(%rbp), %eax
cmpl $0x2e, %eax
jne 0x7488
jmp 0x752f
jmp 0x748a
cmpl $0x0, -0x1c(%rbp)
jne 0x74ab
movsbl -0x15(%rbp), %eax
cmpl $0x65, %eax
je 0x74a2
movsbl -0x15(%rbp), %eax
cmpl $0x45, %eax
jne 0x74a9
movl $0x1, -0x1c(%rbp)
jmp 0x74ab
cmpl $0x0, -0x1c(%rbp)
je 0x74d2
cmpl $0x0, -0x20(%rbp)
jne 0x74d2
movsbl -0x15(%rbp), %eax
cmpl $0x2d, %eax
je 0x74c9
movsbl -0x15(%rbp), %eax
cmpl $0x2b, %eax
jne 0x74d0
movl $0x1, -0x20(%rbp)
jmp 0x74d2
cmpl $0x0, -0x24(%rbp)
jne 0x74ea
movsbl -0x15(%rbp), %eax
cmpl $0x2e, %eax
jne 0x74e8
movl $0x1, -0x24(%rbp)
jmp 0x74ea
jmp 0x74ec
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x7386
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x20c0
movq %rax, %rcx
movq -0x38(%rbp), %rax
subq $0x1, %rcx
movsbl (%rax,%rcx), %edi
callq 0x7540
cmpl $0x0, %eax
jne 0x7526
jmp 0x752f
movl $0x1, -0x4(%rbp)
jmp 0x7536
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop