#!/bin/bash

fullname=$1
namelength=${#fullname}
offset=$((${#fullname} - 2))
filename=${fullname:0:$offset}
"clang" -emit-llvm --target=wasm32 -Oz "$1" -c
"llc" -asm-verbose=false -o $filename.s $filename.bc
"s2wasm" $filename.s > $filename.wast
"wast2wasm" $filename.wast -o $filename.wasm