/* システムコールを使用してstrを標準出力に書き出す(EINTRなどへの対応は省略) */
void print_using_write(const char *str) {
	asm volatile (
		"mov $4, %%eax\n\t" /* write */
		"mov $1, %%ebx\n\t" /* 標準出力 */
		"mov %0, %%ecx\n\t" /* 出力する内容へのポインタ */
		"xor %%edx, %%edx\n\t" /* 文字列の長さを計算する */
		"1:\n\t"
		"testb $0xff, (%%ecx, %%edx)\n\t"
		"jz 2f\n\t"
		"inc %%edx\n\t"
		"jmp 1b\n\t"
		"2:\n\t"
		"int $0x80\n\t" /* システムコール呼び出し */
	:: "m"(str) : "%eax", "%ebx", "%ecx", "%edx");
}

int
Main(int argc,char*argv[])
{
	(void)argc; /* 警告避け */
	(void)argv; /* 警告避け */
	print_using_write("hello, world");
	print_using_write("\n");
	return 0;
}

int main(int asumi_kana, char **sakura_ayane) {
	return Main(asumi_kana, sakura_ayane);
}
