public void compile(ApplyExp applyexp, Compilation compilation, Target target) {
    Expression aexpression[] = applyexp.getArgs();
    CodeAttr codeattr = compilation.getCode();
    codeattr.pushScope();
    gnu.bytecode.Variable variable = codeattr.addLocal(Type.pointer_type);
    aexpression[0].compile(compilation, Target.pushObject);
    codeattr.emitStore(variable);
    for (int i = 1; i < aexpression.length; ) {
      if (i > 1) {
        codeattr.emitElse();
      }
      int k = i + 1;
      applyexp = aexpression[i];
      if (applyexp instanceof LambdaExp) {
        LambdaExp lambdaexp = (LambdaExp) applyexp;
        applyexp = lambdaexp.firstDecl();
        Type type = applyexp.getType();
        if (!applyexp.getCanRead()) {
          applyexp = null;
        } else {
          applyexp.allocateVariable(codeattr);
        }
        if (type instanceof TypeValue) {
          ((TypeValue) type).emitTestIf(variable, applyexp, compilation);
        } else {
          if (k < aexpression.length) {
            codeattr.emitLoad(variable);
            type.emitIsInstance(codeattr);
            codeattr.emitIfIntNotZero();
          }
          if (applyexp != null) {
            codeattr.emitLoad(variable);
            applyexp.compileStore(compilation);
          }
        }
        lambdaexp.allocChildClasses(compilation);
        lambdaexp.body.compileWithPosition(compilation, target);
        i = k;
      } else {
        throw new Error("not implemented: typeswitch arg not LambdaExp");
      }
    }

    int j = aexpression.length - 2;
    do {
      j--;
      if (j >= 0) {
        codeattr.emitFi();
      } else {
        codeattr.popScope();
        return;
      }
    } while (true);
  }