	.file	"ascii_golf.s"
	.text
.globl main
	.type	main, @function
        .equ skip, int80-main
        .equ retskip, hello-main+13
main:
        pusha
        // EAX = EBX = ECX = 0
        push $0x20
        pop %eax
        andb $0x40, %al
        push %eax
        pop %ebx
        push %eax
        pop %ecx
        // push 0 0 0
        push %eax
        push %eax
        push %eax
//        push %eax
        // EDX = 14
        push %eax
        pop %eax
        xorb $46, %al
        xorb $32, %al
        push %eax
        pop %edx
        // ECX
        push %ebp
        pop %eax
        // cheat!
        subb $32, %al
        // ESI = EAX
        push %eax
        pop %esi
        // EAX = -skip
        pop %eax
        dec %eax
        subb $skip-1, %al
        // EDI = EAX
        push %eax
        pop %edi
        // make \n
//        pop %eax
//        xorl 40(%esi), %eax
//        subl %edi, retskip(%eax)
//        subl %edi, retskip(%eax)
        // step ESI
        subl %edi, 40(%esi)
        // EAX = int80
        pop %eax
        xorl 40(%esi), %eax
mod:
        // modify
        subl %edi, (%eax)
        subl %edi, (%eax)
        inc %eax
        subl %edi, (%eax)
        inc %eax
        inc %eax
        subl %edi, (%eax)
        subl %edi, (%eax)
mode:
        // ECX = "Hello, world!"
        inc %eax
        push %eax
        pop %ecx
        // EAX = 4
        pop %eax
        inc %eax
        inc %eax
        inc %eax
        inc %eax
        // EBX = 1
        inc %ebx
int80:
        // write
//        int $0x80
        .byte 0xcd-skip*2, 0x80-skip
        popa
//        ret
        .byte 0xc3-skip*2
//        .byte 0xc3-skip
hello:  .byte 72, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 33
        .byte 10
//        .byte 10+256-skip*2
	.size	main, .-main
	.ident	"GCC: (GNU) 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)"
	.section	.note.GNU-stack,"",@progbits
