; Check if year is leap.

; Input: X = year.

; Output: X = 0 if not leap or X = 1 if leap.

; Formula in Pascal:
;   Result := ((Year mod 4) = 0) and ((Year mod 100 <> 0) or (Year mod 400 = 0));

; written by Eugene Troitskiy

#C3 2

#reg 0 year

=year

@year $4 / FRAC
if(x=0)then
  @year $100 / FRAC
  if(x<>0)then
    $1
  else
    @year $400 / FRAC
    if(x=0)then
      $1
    else
      $0
    endif
  endif
else
  $0
endif

stop
goto 0
