;@ map CLA001

;@ ins k k k
;@ outs k

opcode LevMod, 0, kkkkkk
  kdpt, kbal,  kin,kmod,kdp,kout xin

  kModD 	zkr kdp
  kModIn 	zkr kmod
  kIn 	  zkr kin

  kBal table kbal, giCLA001
  kDpt table kdpt, giCLA001
  kOut = kIn * (1 + kBal * kModIn)
  kOut = kIn*(1 - kBal * (1 - kDpt * kMod)) + (1 - kDpt * kMod) * kBal * kIn * aModIn
  zkw kOut, kout
endop

;@ ins a a a
;@ outs a

opcode LevMod, 0, kkkkkk
  kdpt, kbal,  kin,kmod,kdp,kout xin

  aModD 	zar kdp
  aModIn 	zar kmod
  aIn 	  zar kin

  kBal table kbal, giCLA001
  kDpt table kdpt, giCLA001
  aOut = aIn*(1-kBal * (1 - kDpt * kMod)) + (1 - kDpt * kMod) * kBal * aIn * aModIn

  zaw aOut, kout
endop
