/* Generated by Frama-C */
#include "ctype.h"
#include "stddef.h"
#include "stdio.h"
extern int __e_acsl_sound_verdict;

/*@ requires c_uchar_or_eof: (0 ≤ c ≤ 255) ∨ c ≡ -1;
    assigns \result;
    assigns \result \from c;
    
    behavior definitely_match:
      assumes c_upper: 'A' ≤ c ≤ 'Z';
      ensures nonzero_result: \result < 0 ∨ \result > 0;
    
    behavior definitely_not_match:
      assumes
        c_non_upper: c ≡ -1 ∨ (0 ≤ c < 'A') ∨ ('Z' < c ≤ 127);
      ensures zero_result: \result ≡ 0;
    
    disjoint behaviors definitely_not_match, definitely_match;
 */
int __gen_e_acsl_isupper(int c);

int main(int argc, char const **argv)
{
  int __retres;
  int tmp;
  __e_acsl_memory_init(& argc,(char ***)(& argv),(size_t)8);
  tmp = __gen_e_acsl_isupper(argc);
  char c = (char)tmp;
  __e_acsl_store_block((void *)(& c),(size_t)1);
  __e_acsl_full_init((void *)(& c));
  char *d = & c;
  __e_acsl_store_block((void *)(& d),(size_t)8);
  __e_acsl_full_init((void *)(& d));
  {
    int __gen_e_acsl_initialized;
    int __gen_e_acsl_and;
    __gen_e_acsl_initialized = __e_acsl_initialized((void *)(& d),
                                                    sizeof(char *));
    if (__gen_e_acsl_initialized) {
      int __gen_e_acsl_valid;
      __gen_e_acsl_valid = __e_acsl_valid((void *)d,sizeof(char),(void *)d,
                                          (void *)(& d));
      __gen_e_acsl_and = __gen_e_acsl_valid;
    }
    else __gen_e_acsl_and = 0;
    __e_acsl_assert(__gen_e_acsl_and,"Assertion","main","\\valid(d)",
                    "tests/memory/ctype_macros.c",39);
  }
  /*@ assert \valid(d); */ ;
  __retres = 0;
  __e_acsl_delete_block((void *)(& d));
  __e_acsl_delete_block((void *)(& c));
  __e_acsl_memory_clean();
  return __retres;
}

/*@ requires c_uchar_or_eof: (0 ≤ c ≤ 255) ∨ c ≡ -1;
    assigns \result;
    assigns \result \from c;
    
    behavior definitely_match:
      assumes c_upper: 'A' ≤ c ≤ 'Z';
      ensures nonzero_result: \result < 0 ∨ \result > 0;
    
    behavior definitely_not_match:
      assumes
        c_non_upper: c ≡ -1 ∨ (0 ≤ c < 'A') ∨ ('Z' < c ≤ 127);
      ensures zero_result: \result ≡ 0;
    
    disjoint behaviors definitely_not_match, definitely_match;
 */
int __gen_e_acsl_isupper(int c)
{
  __e_acsl_contract_t *__gen_e_acsl_contract;
  int __retres;
  {
    int __gen_e_acsl_and;
    int __gen_e_acsl_or;
    int __gen_e_acsl_or_2;
    int __gen_e_acsl_and_4;
    int __gen_e_acsl_or_3;
    int __gen_e_acsl_active_bhvrs;
    __gen_e_acsl_contract = __e_acsl_contract_init((size_t)2);
    if (65 <= c) __gen_e_acsl_and = c <= 90; else __gen_e_acsl_and = 0;
    __e_acsl_contract_set_behavior_assumes(__gen_e_acsl_contract,(size_t)0,
                                           __gen_e_acsl_and);
    if (c == -1) __gen_e_acsl_or = 1;
    else {
      int __gen_e_acsl_and_2;
      if (0 <= c) __gen_e_acsl_and_2 = c < 65; else __gen_e_acsl_and_2 = 0;
      __gen_e_acsl_or = __gen_e_acsl_and_2;
    }
    if (__gen_e_acsl_or) __gen_e_acsl_or_2 = 1;
    else {
      int __gen_e_acsl_and_3;
      if (90 < c) __gen_e_acsl_and_3 = c <= 127; else __gen_e_acsl_and_3 = 0;
      __gen_e_acsl_or_2 = __gen_e_acsl_and_3;
    }
    __e_acsl_contract_set_behavior_assumes(__gen_e_acsl_contract,(size_t)1,
                                           __gen_e_acsl_or_2);
    if (0 <= c) __gen_e_acsl_and_4 = c <= 255; else __gen_e_acsl_and_4 = 0;
    if (__gen_e_acsl_and_4) __gen_e_acsl_or_3 = 1;
    else __gen_e_acsl_or_3 = c == -1;
    __e_acsl_assert(__gen_e_acsl_or_3,"Precondition","isupper",
                    "(0 <= c <= 255) || c == -1","FRAMAC_SHARE/libc/ctype.h",
                    174);
    __gen_e_acsl_active_bhvrs = __e_acsl_contract_partial_count_all_behaviors
    ((__e_acsl_contract_t const *)__gen_e_acsl_contract);
    __e_acsl_assert(__gen_e_acsl_active_bhvrs <= 1,"Precondition","isupper",
                    "all behaviors disjoint","FRAMAC_SHARE/libc/ctype.h",173);
  }
  __retres = isupper(c);
  {
    int __gen_e_acsl_assumes_value;
    __gen_e_acsl_assumes_value = __e_acsl_contract_get_behavior_assumes
    ((__e_acsl_contract_t const *)__gen_e_acsl_contract,(size_t)0);
    if (__gen_e_acsl_assumes_value) {
      int __gen_e_acsl_or_4;
      if (__retres < 0) __gen_e_acsl_or_4 = 1;
      else __gen_e_acsl_or_4 = __retres > 0;
      __e_acsl_assert(__gen_e_acsl_or_4,"Postcondition","isupper",
                      "definitely_match: \\result < 0 || \\result > 0",
                      "FRAMAC_SHARE/libc/ctype.h",178);
    }
    __gen_e_acsl_assumes_value = __e_acsl_contract_get_behavior_assumes
    ((__e_acsl_contract_t const *)__gen_e_acsl_contract,(size_t)1);
    if (__gen_e_acsl_assumes_value) __e_acsl_assert(__retres == 0,
                                                    "Postcondition",
                                                    "isupper",
                                                    "definitely_not_match: \\result == 0",
                                                    "FRAMAC_SHARE/libc/ctype.h",
                                                    181);
    __e_acsl_contract_clean(__gen_e_acsl_contract);
    return __retres;
  }
}


