use glulx_asm::concise::*;
use glulx_asm::*;
use std::{borrow::Cow, io::Write};
fn main() {
let main_label = 0;
let hello_sailor_label = 1;
let fail_label = 2;
let assembly: Assembly<i32> = Assembly {
rom_items: Cow::Owned(vec![
label(hello_sailor_label),
mystery_string(&"\n\n\nHello, sailor!\n"),
label(main_label),
fnhead_stack(0),
setiosys(imm(2), imm(0)),
copy(imm(0), push()),
copy(imm(3), push()),
copy(imm(0), push()),
copy(imm(0), push()),
copy(imm(0), push()),
glk(imm(0x23), imm(5), push()),
stkcopy(imm(1)),
jz(pop(), fail_label),
glk(imm(0x2f), imm(1), discard()),
streamstr(imml(hello_sailor_label)),
label(fail_label),
ret(imm(0)),
]),
ram_items: Cow::Owned(vec![]),
zero_items: Cow::Owned(vec![]),
stack_size: 256,
start_func: LabelRef(main_label, 0),
decoding_table: None,
};
let bytes = assembly.assemble().unwrap();
let mut stdout = std::io::stdout();
stdout.write_all(&bytes).unwrap();
}