// Path: renovate/src/main/java/renovate/Call.java
// public interface Call<T> extends Cloneable {
//   Response<T> execute() throws IOException;
// 
//   void enqueue(Callback<T> callback);
// 
//   boolean isExecuted();
// 
//   void cancel();
// 
//   boolean isCanceled();
// 
//   Call<T> clone();
// 
//   Request request();
// }
// 
// Path: renovate/src/main/java/renovate/Response.java
// public final class Response<T> {
//   private final okhttp3.Response rawResponse;
//   private final T body;
//   private final ResponseBody errorBody;
// 
//   private Response(okhttp3.Response rawResponse, T body, ResponseBody errorBody) {
//     this.rawResponse = rawResponse;
//     this.body = body;
//     this.errorBody = errorBody;
//   }
// 
//   public static <T> Response<T> success(T body) {
//     return success(body, new okhttp3.Response.Builder() //
//         .code(200)
//         .message("OK")
//         .protocol(Protocol.HTTP_1_1)
//         .request(new Request.Builder().url("http://localhost/").build())
//         .build());
//   }
// 
//   public static <T> Response<T> success(T body, Headers headers) {
//     if (headers == null) throw new NullPointerException("headers == null");
//     return success(body, new okhttp3.Response.Builder() //
//         .code(200)
//         .message("OK")
//         .protocol(Protocol.HTTP_1_1)
//         .headers(headers)
//         .request(new Request.Builder().url("http://localhost/").build())
//         .build());
//   }
// 
//   public static <T> Response<T> success(T body, okhttp3.Response rawResponse) {
//     if (rawResponse == null) throw new NullPointerException("rawResponse == null");
//     if (!rawResponse.isSuccessful()) {
//       throw new IllegalArgumentException("rawResponse must be successful response");
//     }
//     return new Response<>(rawResponse, body, null);
//   }
// 
//   public static <T> Response<T> error(int code, ResponseBody body) {
//     if (code < 400) throw new IllegalArgumentException("code < 400: " + code);
//     return error(body, new okhttp3.Response.Builder() //
//         .code(code)
//         .protocol(Protocol.HTTP_1_1)
//         .request(new Request.Builder().url("http://localhost/").build())
//         .build());
//   }
// 
//   public static <T> Response<T> error(ResponseBody body, okhttp3.Response rawResponse) {
//     if (body == null) throw new NullPointerException("body == null");
//     if (rawResponse == null) throw new NullPointerException("rawResponse == null");
//     if (rawResponse.isSuccessful()) {
//       throw new IllegalArgumentException("rawResponse should not be successful response");
//     }
//     return new Response<>(rawResponse, null, body);
//   }
// 
//   public okhttp3.Response raw() {
//     return rawResponse;
//   }
// 
//   public int code() {
//     return rawResponse.code();
//   }
// 
//   public String message() {
//     return rawResponse.message();
//   }
// 
//   public Headers headers() {
//     return rawResponse.headers();
//   }
// 
//   public boolean isSuccessful() {
//     return rawResponse.isSuccessful();
//   }
// 
//   public T body() {
//     return body;
//   }
// 
//   public ResponseBody errorBody() {
//     return errorBody;
//   }
// 
//   @Override public String toString() {
//     return rawResponse.toString();
//   }
// }


import renovate.Call;
import renovate.Response;
import rx.Producer;
import rx.Subscriber;
import rx.Subscription;
import rx.exceptions.*;
import rx.plugins.RxJavaPlugins;
import java.util.concurrent.atomic.AtomicInteger;
package renovate.rxjava.subscribe;



final class CallArbiter<T> extends AtomicInteger implements Subscription, Producer {
  private static final int STATE_WAITING = 0;
  private static final int STATE_REQUESTED = 1;
  private static final int STATE_HAS_RESPONSE = 2;
  private static final int STATE_TERMINATED = 3;

  private final Call<T> call;
  private final Subscriber<? super Response<T>> subscriber;

  private volatile Response<T> response;

  CallArbiter(Call<T> call, Subscriber<? super Response<T>> subscriber) {
    super(STATE_WAITING);

    this.call = call;
    this.subscriber = subscriber;
  }

  @Override public void unsubscribe() {
    call.cancel();
  }

  @Override public boolean isUnsubscribed() {
    return call.isCanceled();
  }

  @Override public void request(long amount) {
// Path: renovate/src/main/java/renovate/Call.java
// public interface Call<T> extends Cloneable {
//   Response<T> execute() throws IOException;
// 
//   void enqueue(Callback<T> callback);
// 
//   boolean isExecuted();
// 
//   void cancel();
// 
//   boolean isCanceled();
// 
//   Call<T> clone();
// 
//   Request request();
// }
// 
// Path: renovate/src/main/java/renovate/Response.java
// public final class Response<T> {
//   private final okhttp3.Response rawResponse;
//   private final T body;
//   private final ResponseBody errorBody;
// 
//   private Response(okhttp3.Response rawResponse, T body, ResponseBody errorBody) {
//     this.rawResponse = rawResponse;
//     this.body = body;
//     this.errorBody = errorBody;
//   }
// 
//   public static <T> Response<T> success(T body) {
//     return success(body, new okhttp3.Response.Builder() //
//         .code(200)
//         .message("OK")
//         .protocol(Protocol.HTTP_1_1)
//         .request(new Request.Builder().url("http://localhost/").build())
//         .build());
//   }
// 
//   public static <T> Response<T> success(T body, Headers headers) {
//     if (headers == null) throw new NullPointerException("headers == null");
//     return success(body, new okhttp3.Response.Builder() //
//         .code(200)
//         .message("OK")
//         .protocol(Protocol.HTTP_1_1)
//         .headers(headers)
//         .request(new Request.Builder().url("http://localhost/").build())
//         .build());
//   }
// 
//   public static <T> Response<T> success(T body, okhttp3.Response rawResponse) {
//     if (rawResponse == null) throw new NullPointerException("rawResponse == null");
//     if (!rawResponse.isSuccessful()) {
//       throw new IllegalArgumentException("rawResponse must be successful response");
//     }
//     return new Response<>(rawResponse, body, null);
//   }
// 
//   public static <T> Response<T> error(int code, ResponseBody body) {
//     if (code < 400) throw new IllegalArgumentException("code < 400: " + code);
//     return error(body, new okhttp3.Response.Builder() //
//         .code(code)
//         .protocol(Protocol.HTTP_1_1)
//         .request(new Request.Builder().url("http://localhost/").build())
//         .build());
//   }
// 
//   public static <T> Response<T> error(ResponseBody body, okhttp3.Response rawResponse) {
//     if (body == null) throw new NullPointerException("body == null");
//     if (rawResponse == null) throw new NullPointerException("rawResponse == null");
//     if (rawResponse.isSuccessful()) {
//       throw new IllegalArgumentException("rawResponse should not be successful response");
//     }
//     return new Response<>(rawResponse, null, body);
//   }
// 
//   public okhttp3.Response raw() {
//     return rawResponse;
//   }
// 
//   public int code() {
//     return rawResponse.code();
//   }
// 
//   public String message() {
//     return rawResponse.message();
//   }
// 
//   public Headers headers() {
//     return rawResponse.headers();
//   }
// 
//   public boolean isSuccessful() {
//     return rawResponse.isSuccessful();
//   }
// 
//   public T body() {
//     return body;
//   }
// 
//   public ResponseBody errorBody() {
//     return errorBody;
//   }
// 
//   @Override public String toString() {
//     return rawResponse.toString();
//   }
// }


// Path: rx-renovate/src/main/java/renovate/rxjava/subscribe/CallArbiter.java
import renovate.Call;
import renovate.Response;
import rx.Producer;
import rx.Subscriber;
import rx.Subscription;
import rx.exceptions.*;
import rx.plugins.RxJavaPlugins;
import java.util.concurrent.atomic.AtomicInteger;

package renovate.rxjava.subscribe;



final class CallArbiter<T> extends AtomicInteger implements Subscription, Producer {
  private static final int STATE_WAITING = 0;
  private static final int STATE_REQUESTED = 1;
  private static final int STATE_HAS_RESPONSE = 2;
  private static final int STATE_TERMINATED = 3;

  private final Call<T> call;
  private final Subscriber<? super Response<T>> subscriber;

  private volatile Response<T> response;

  CallArbiter(Call<T> call, Subscriber<? super Response<T>> subscriber) {
    super(STATE_WAITING);

    this.call = call;
    this.subscriber = subscriber;
  }

  @Override public void unsubscribe() {
    call.cancel();
  }

  @Override public boolean isUnsubscribed() {
    return call.isCanceled();
  }

  @Override public void request(long amount) {
    if (amount == 0) {