Program: 46889
Project: 46889
Buggy source:
void processAnnotations(zipkin.Span source){
  for (int i=0, length=source.annotations.size(); i < length; i++) {
    Annotation a=source.annotations.get(i);
    Span.Builder currentSpan=forEndpoint(source,a.endpoint);
    if (a.value.length() == 2 && a.endpoint != null) {
      if (a.value.equals(Constants.CLIENT_SEND)) {
        currentSpan.kind(Kind.CLIENT);
        cs=a;
      }
 else       if (a.value.equals(Constants.SERVER_RECV)) {
        currentSpan.kind(Kind.SERVER);
        sr=a;
      }
 else       if (a.value.equals(Constants.SERVER_SEND)) {
        currentSpan.kind(Kind.SERVER);
        ss=a;
      }
 else       if (a.value.equals(Constants.CLIENT_RECV)) {
        currentSpan.kind(Kind.CLIENT);
        cr=a;
      }
 else       if (a.value.equals(Constants.MESSAGE_SEND)) {
        currentSpan.kind(Kind.PRODUCER);
        ms=a;
      }
 else       if (a.value.equals(Constants.MESSAGE_RECV)) {
        currentSpan.kind(Kind.CONSUMER);
        mr=a;
      }
 else       if (a.value.equals(Constants.WIRE_SEND)) {
        ws=a;
      }
 else       if (a.value.equals(Constants.WIRE_RECV)) {
        wr=a;
      }
 else {
        currentSpan.addAnnotation(a.timestamp,a.value);
      }
    }
 else {
      currentSpan.addAnnotation(a.timestamp,a.value);
    }
  }
  if (cs != null && sr != null) {
    maybeTimestampDuration(source,cs,cr);
    Span.Builder client=forEndpoint(source,cs.endpoint);
    Span.Builder server;
    if (closeEnough(cs.endpoint,sr.endpoint)) {
      client.kind(Kind.CLIENT);
      server=newSpanBuilder(source,sr.endpoint.toV2()).kind(Kind.SERVER);
    }
 else {
      server=forEndpoint(source,sr.endpoint);
    }
    server.shared(true).timestamp(sr.timestamp);
    if (ss != null)     server.duration(ss.timestamp - sr.timestamp);
    if (cr == null && source.duration == null)     client.duration(null);
  }
 else   if (cs != null && cr != null) {
    maybeTimestampDuration(source,cs,cr);
  }
 else   if (sr != null && ss != null) {
    maybeTimestampDuration(source,sr,ss);
  }
 else {
    for (    Span.Builder next : spans) {
      if (Kind.CLIENT.equals(next.kind())) {
        if (cs != null)         next.timestamp(cs.timestamp);
      }
 else       if (Kind.SERVER.equals(next.kind())) {
        if (sr != null)         next.timestamp(sr.timestamp);
      }
    }
    if (source.timestamp != null) {
      spans.get(0).timestamp(source.timestamp).duration(source.duration);
    }
  }
  if (cs == null && (sr != null && source.timestamp == null)) {
    forEndpoint(source,sr.endpoint).shared(true);
  }
  if (ms != null && mr != null) {
    Span.Builder producer=forEndpoint(source,ms.endpoint);
    Span.Builder consumer;
    if (closeEnough(ms.endpoint,mr.endpoint)) {
      producer.kind(Kind.PRODUCER);
      consumer=newSpanBuilder(source,mr.endpoint.toV2()).kind(Kind.CONSUMER);
    }
 else {
      consumer=forEndpoint(source,mr.endpoint);
    }
    consumer.shared(true);
    if (wr != null) {
      consumer.timestamp(wr.timestamp).duration(mr.timestamp - wr.timestamp);
    }
 else {
      consumer.timestamp(mr.timestamp);
    }
    producer.timestamp(ms.timestamp).duration(ws != null ? ws.timestamp - ms.timestamp : null);
  }
 else   if (ms != null) {
    maybeTimestampDuration(source,ms,ws);
  }
 else   if (mr != null) {
    if (wr != null) {
      maybeTimestampDuration(source,wr,mr);
    }
 else {
      maybeTimestampDuration(source,mr,null);
    }
  }
 else {
    if (ws != null)     forEndpoint(source,ws.endpoint).addAnnotation(ws.timestamp,ws.value);
    if (wr != null)     forEndpoint(source,wr.endpoint).addAnnotation(wr.timestamp,wr.value);
  }
}

Fixed version (ground truth):
void processAnnotations(zipkin.Span source){
  for (int i=0, length=source.annotations.size(); i < length; i++) {
    Annotation a=source.annotations.get(i);
    Span.Builder currentSpan=forEndpoint(source,a.endpoint);
    if (a.value.length() == 2 && a.endpoint != null) {
      if (a.value.equals(Constants.CLIENT_SEND)) {
        currentSpan.kind(Kind.CLIENT);
        cs=a;
      }
 else       if (a.value.equals(Constants.SERVER_RECV)) {
        currentSpan.kind(Kind.SERVER);
        sr=a;
      }
 else       if (a.value.equals(Constants.SERVER_SEND)) {
        currentSpan.kind(Kind.SERVER);
        ss=a;
      }
 else       if (a.value.equals(Constants.CLIENT_RECV)) {
        currentSpan.kind(Kind.CLIENT);
        cr=a;
      }
 else       if (a.value.equals(Constants.MESSAGE_SEND)) {
        currentSpan.kind(Kind.PRODUCER);
        ms=a;
      }
 else       if (a.value.equals(Constants.MESSAGE_RECV)) {
        currentSpan.kind(Kind.CONSUMER);
        mr=a;
      }
 else       if (a.value.equals(Constants.WIRE_SEND)) {
        ws=a;
      }
 else       if (a.value.equals(Constants.WIRE_RECV)) {
        wr=a;
      }
 else {
        currentSpan.addAnnotation(a.timestamp,a.value);
      }
    }
 else {
      currentSpan.addAnnotation(a.timestamp,a.value);
    }
  }
  if (cs != null && sr != null) {
    maybeTimestampDuration(source,cs,cr);
    Span.Builder client=forEndpoint(source,cs.endpoint);
    Span.Builder server;
    if (closeEnough(cs.endpoint,sr.endpoint)) {
      client.kind(Kind.CLIENT);
      server=newSpanBuilder(source,sr.endpoint.toV2()).kind(Kind.SERVER);
    }
 else {
      server=forEndpoint(source,sr.endpoint);
    }
    server.shared(true).timestamp(sr.timestamp);
    if (ss != null)     server.duration(ss.timestamp - sr.timestamp);
    if (cr == null && source.duration == null)     client.duration(null);
  }
 else   if (cs != null && cr != null) {
    maybeTimestampDuration(source,cs,cr);
  }
 else   if (sr != null && ss != null) {
    maybeTimestampDuration(source,sr,ss);
  }
 else {
    for (    Span.Builder next : spans) {
      if (Kind.CLIENT.equals(next.kind())) {
        if (cs != null)         next.timestamp(cs.timestamp);
        if (cr != null)         next.addAnnotation(cr.timestamp,cr.value);
      }
 else       if (Kind.SERVER.equals(next.kind())) {
        if (sr != null)         next.timestamp(sr.timestamp);
        if (ss != null)         next.addAnnotation(ss.timestamp,ss.value);
      }
    }
    if (source.timestamp != null) {
      spans.get(0).timestamp(source.timestamp).duration(source.duration);
    }
  }
  if (cs == null && (sr != null && source.timestamp == null)) {
    forEndpoint(source,sr.endpoint).shared(true);
  }
  if (ms != null && mr != null) {
    Span.Builder producer=forEndpoint(source,ms.endpoint);
    Span.Builder consumer;
    if (closeEnough(ms.endpoint,mr.endpoint)) {
      producer.kind(Kind.PRODUCER);
      consumer=newSpanBuilder(source,mr.endpoint.toV2()).kind(Kind.CONSUMER);
    }
 else {
      consumer=forEndpoint(source,mr.endpoint);
    }
    consumer.shared(true);
    if (wr != null) {
      consumer.timestamp(wr.timestamp).duration(mr.timestamp - wr.timestamp);
    }
 else {
      consumer.timestamp(mr.timestamp);
    }
    producer.timestamp(ms.timestamp).duration(ws != null ? ws.timestamp - ms.timestamp : null);
  }
 else   if (ms != null) {
    maybeTimestampDuration(source,ms,ws);
  }
 else   if (mr != null) {
    if (wr != null) {
      maybeTimestampDuration(source,wr,mr);
    }
 else {
      maybeTimestampDuration(source,mr,null);
    }
  }
 else {
    if (ws != null)     forEndpoint(source,ws.endpoint).addAnnotation(ws.timestamp,ws.value);
    if (wr != null)     forEndpoint(source,wr.endpoint).addAnnotation(wr.timestamp,wr.value);
  }
}