view code/as/reg.s @ 3:a193b4ff3909

prepare graph outputs (but not implement)
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Tue, 29 Jun 2010 11:44:40 +0900
parents
children
line wrap: on
line source

	.const
LC0:
	.ascii "regexp: (A|B)*C\0"
LC1:
	.ascii "number of state: 4\0"
LC2:
	.ascii "string: %s\12\0"
	.text
.globl _main
_main:
	pushl	%ebp
	movl	%esp, %ebp
	pushl	%ebx
	subl	$36, %esp
	call	___i686.get_pc_thunk.bx
"L00000000001$pb":
	leal	LC0-"L00000000001$pb"(%ebx), %eax
	movl	%eax, (%esp)
	call	L_puts$stub
	leal	LC1-"L00000000001$pb"(%ebx), %eax
	movl	%eax, (%esp)
	call	L_puts$stub
	movl	12(%ebp), %eax
	addl	$4, %eax
	movl	(%eax), %eax
	movl	%eax, 4(%esp)
	leal	LC2-"L00000000001$pb"(%ebx), %eax
	movl	%eax, (%esp)
	call	L_printf$stub
	movl	12(%ebp), %edx
	addl	$4, %edx
	movl	(%edx), %edx
	movl	%edx, -12(%ebp)
	movl	-12(%ebp), %edx
	movl	%edx, %ecx
	addl	$36, %esp
	popl	%ebx
	popl	%ebp
	jmp	_state_1_3_5_6_7
.globl _state_8
_state_8:
	pushl	%ebp
	movl	%esp, %ebp
	subl	$40, %esp
	movl	%ecx, -28(%ebp)
	movl	-28(%ebp), %eax
	movzbl	(%eax), %eax
	movsbl	%al, %eax
	addl	$1, -28(%ebp)
	testl	%eax, %eax
	jne	L5
L4:
	movl	-28(%ebp), %eax
	movl	%eax, -12(%ebp)
	movl	-12(%ebp), %eax
	movl	%eax, %ecx
	leave
	jmp	_accept
L5:
	movl	-28(%ebp), %eax
	movl	%eax, -16(%ebp)
	movl	-16(%ebp), %eax
	movl	%eax, %ecx
	leave
	jmp	_reject
.globl _state_1_3_5_6_7
_state_1_3_5_6_7:
	pushl	%ebp
	movl	%esp, %ebp
	subl	$40, %esp
	movl	%ecx, -28(%ebp)
	movl	-28(%ebp), %eax
	movzbl	(%eax), %eax
	movsbl	%al, %eax
	addl	$1, -28(%ebp)
	cmpl	$66, %eax
	je	L9
	cmpl	$67, %eax
	je	L10
	cmpl	$65, %eax
	jne	L11
L8:
	movl	-28(%ebp), %eax
	movl	%eax, -12(%ebp)
	movl	-12(%ebp), %eax
	movl	%eax, %ecx
	leave
	jmp	_state_1_2_3_5_7
L10:
	movl	-28(%ebp), %eax
	movl	%eax, -16(%ebp)
	movl	-16(%ebp), %eax
	movl	%eax, %ecx
	leave
	jmp	_state_8
L9:
	movl	-28(%ebp), %eax
	movl	%eax, -20(%ebp)
	movl	-20(%ebp), %eax
	movl	%eax, %ecx
	leave
	jmp	_state_1_3_4_5_7
L11:
	movl	-28(%ebp), %eax
	movl	%eax, -24(%ebp)
	movl	-24(%ebp), %eax
	movl	%eax, %ecx
	leave
	jmp	_reject
.globl _state_1_3_4_5_7
_state_1_3_4_5_7:
	pushl	%ebp
	movl	%esp, %ebp
	subl	$40, %esp
	movl	%ecx, -28(%ebp)
	movl	-28(%ebp), %eax
	movzbl	(%eax), %eax
	movsbl	%al, %eax
	addl	$1, -28(%ebp)
	cmpl	$66, %eax
	je	L15
	cmpl	$67, %eax
	je	L16
	cmpl	$65, %eax
	jne	L17
L14:
	movl	-28(%ebp), %eax
	movl	%eax, -12(%ebp)
	movl	-12(%ebp), %eax
	movl	%eax, %ecx
	leave
	jmp	_state_1_2_3_5_7
L16:
	movl	-28(%ebp), %eax
	movl	%eax, -16(%ebp)
	movl	-16(%ebp), %eax
	movl	%eax, %ecx
	leave
	jmp	_state_8
L15:
	movl	-28(%ebp), %eax
	movl	%eax, -20(%ebp)
	movl	-20(%ebp), %eax
	movl	%eax, %ecx
	leave
	jmp	_state_1_3_4_5_7
L17:
	movl	-28(%ebp), %eax
	movl	%eax, -24(%ebp)
	movl	-24(%ebp), %eax
	movl	%eax, %ecx
	leave
	jmp	_reject
.globl _state_1_2_3_5_7
_state_1_2_3_5_7:
	pushl	%ebp
	movl	%esp, %ebp
	subl	$40, %esp
	movl	%ecx, -28(%ebp)
	movl	-28(%ebp), %eax
	movzbl	(%eax), %eax
	movsbl	%al, %eax
	addl	$1, -28(%ebp)
	cmpl	$66, %eax
	je	L21
	cmpl	$67, %eax
	je	L22
	cmpl	$65, %eax
	jne	L23
L20:
	movl	-28(%ebp), %eax
	movl	%eax, -12(%ebp)
	movl	-12(%ebp), %eax
	movl	%eax, %ecx
	leave
	jmp	_state_1_2_3_5_7
L22:
	movl	-28(%ebp), %eax
	movl	%eax, -16(%ebp)
	movl	-16(%ebp), %eax
	movl	%eax, %ecx
	leave
	jmp	_state_8
L21:
	movl	-28(%ebp), %eax
	movl	%eax, -20(%ebp)
	movl	-20(%ebp), %eax
	movl	%eax, %ecx
	leave
	jmp	_state_1_3_4_5_7
L23:
	movl	-28(%ebp), %eax
	movl	%eax, -24(%ebp)
	movl	-24(%ebp), %eax
	movl	%eax, %ecx
	leave
	jmp	_reject
	.const
LC3:
	.ascii "\12string matches regexp. \12\0"
	.text
.globl _accept
_accept:
	pushl	%ebp
	movl	%esp, %ebp
	pushl	%ebx
	subl	$36, %esp
	call	___i686.get_pc_thunk.bx
"L00000000002$pb":
	movl	%ecx, -12(%ebp)
	leal	LC3-"L00000000002$pb"(%ebx), %eax
	movl	%eax, (%esp)
	call	L_puts$stub
	addl	$36, %esp
	popl	%ebx
	popl	%ebp
	ret
	.const
	.align 2
LC4:
	.ascii "\12string does not match regexp. \12\0"
	.text
.globl _reject
_reject:
	pushl	%ebp
	movl	%esp, %ebp
	pushl	%ebx
	subl	$36, %esp
	call	___i686.get_pc_thunk.bx
"L00000000003$pb":
	movl	%ecx, -12(%ebp)
	leal	LC4-"L00000000003$pb"(%ebx), %eax
	movl	%eax, (%esp)
	call	L_puts$stub
	addl	$36, %esp
	popl	%ebx
	popl	%ebp
	ret
	.picsymbol_stub
L_printf$stub:
	.indirect_symbol _printf
	call	LPC$1
LPC$1:	popl	%eax
	movl	L1$lz-LPC$1(%eax),%edx
	jmp	*%edx
L_printf$stub_binder:
	lea	L1$lz-LPC$1(%eax),%eax
	pushl	%eax
	jmp	dyld_stub_binding_helper
	.lazy_symbol_pointer
L1$lz:
	.indirect_symbol _printf
	.long	L_printf$stub_binder
	.picsymbol_stub
L_puts$stub:
	.indirect_symbol _puts
	call	LPC$2
LPC$2:	popl	%eax
	movl	L2$lz-LPC$2(%eax),%edx
	jmp	*%edx
L_puts$stub_binder:
	lea	L2$lz-LPC$2(%eax),%eax
	pushl	%eax
	jmp	dyld_stub_binding_helper
	.lazy_symbol_pointer
L2$lz:
	.indirect_symbol _puts
	.long	L_puts$stub_binder
	.subsections_via_symbols
	.section __TEXT,__textcoal_nt,coalesced,pure_instructions
	.weak_definition	___i686.get_pc_thunk.bx
	.private_extern	___i686.get_pc_thunk.bx
___i686.get_pc_thunk.bx:
	movl	(%esp), %ebx
	ret