#include "../lib.h"

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

void quicksort_init(void);
void quicksort_main(void);
int quicksort_return(void);

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

  fail_start_trace();
  quicksort_main();
  fail_stop_trace();

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