
#include "base/base_inc.h"

#include "wave/riff_format.h"
#include "wave/wave_format.h"
#include "wave/wave_parser.h"

#include "os/os_inc.h"

#include "base/base_inc.c"
#include "base/base_big_functions.c"

#include "wave/wave_parser.c"

#include "os/os_inc.c"

Arena *arena = 0;

c_linkage int
LLVMFuzzerTestOneInput(U8 *raw_data, U64 size){
  if (arena == 0){
    arena = arena_alloc();
  }
  
  ArenaTemp temp = arena_begin_temp(arena);
  
  String8 data = str8(raw_data, size);
  WAVE_SubChunkList chunks = wave_sub_chunks_from_data(arena, data);
  WAVE_SubChunkNode *fmt_node = wave_chunk_from_id(&chunks, WAVE_ID_fmt);
  WAVE_FormatData fmt_data = wave_format_data_from_fmt_chunk(fmt_node, data);
  WAVE_SubChunkNode *sample_data = wave_chunk_from_id(&chunks, WAVE_ID_data);
  
  arena_end_temp(&temp);
  
  return 0;
}

//$ fuzzer //