#include "../lib.h"

extern "C" {
void __pragma_loopbound(unsigned, unsigned) {}

void binarysearch_init(void);
void binarysearch_main(void);
int binarysearch_return(void);

EXPORT("wasm_module") int wasm_module(void) {
  binarysearch_init();

  fail_start_trace();
  binarysearch_main();
  fail_stop_trace();

  int ret = binarysearch_return() - (-1);
  if (ret == 0) {
    PRINT("result correct.\n");
    fail_marker_positive();
  } else {
    PRINT("result incorrect.\n");
    fail_marker_negative();
  }
  return ret;
}
}
