	.386p
	model flat
	ifndef	??version
	?debug	macro
	endm
	endif
	?debug	S "prime.c"
	?debug	T "prime.c"
_TEXT	segment dword public use32 'CODE'
_TEXT	ends
_DATA	segment dword public use32 'DATA'
_DATA	ends
_BSS	segment dword public use32 'BSS'
_BSS	ends
DGROUP	group	_BSS,_DATA
_TEXT	segment dword public use32 'CODE'
_main	proc	near
?live1@0:
   ;	
   ;	void main()
   ;	
	push      ebp
	mov       ebp,esp
	add       esp,-8
	push      ebx
	push      esi
	push      edi
   ;	
   ;	{
   ;	  int test_val;
   ;	  int prime_flag;
   ;	  int prime_count;
   ;	  int i, j;
   ;	
   ;	  prime_count = 1;  // init to 1 because 2 is prime
   ;	
@1:
	mov       dword ptr [ebp-4],1
   ;	
   ;	  for (i=3; i<MAX; i=i+2)
   ;	
	mov       ebx,3
   ;	
   ;	  {
   ;	    test_val = (int) sqrt((double) i);
   ;	
?live1@48: ; EBX = i
@2:
	mov       dword ptr [ebp-8],ebx
	fild      dword ptr [ebp-8]
	add       esp,-8
	fstp      qword ptr [esp]
	call      _sqrt
	add       esp,8
	call      __ftol
	mov       esi,eax
   ;	
   ;	    prime_flag = 1;
   ;	
?live1@64: ; EBX = i, ESI = test_val
	mov       edi,1
   ;	
   ;	    for (j=3; j<=test_val; j=j+2)
   ;	
?live1@80: ; EBX = i, ESI = test_val, EDI = prime_flag
	mov       ecx,3
	cmp       esi,ecx
	jl        short @5
   ;	
   ;	      if ((i % j) == 0) prime_flag = 0;
   ;	
?live1@96: ; ECX = j, EBX = i, ESI = test_val, EDI = prime_flag
@4:
	mov       eax,ebx
	cdq
	idiv      ecx
	test      edx,edx
	jne       short @6
	xor       edi,edi
@6:
	add       ecx,2
	cmp       esi,ecx
	jge       short @4
   ;	
   ;	    if (prime_flag == 1) prime_count++;
   ;	
?live1@112: ; EBX = i, EDI = prime_flag
@5:
	dec       edi
	jne       short @8
	inc       dword ptr [ebp-4]
@8:
	add       ebx,2
	cmp       ebx,2000000
	jl        short @2
   ;	
   ;	  }
   ;	
   ;	  printf("prime_count = %d \n", prime_count);
   ;	
?live1@128: ; 
	push      dword ptr [ebp-4]
	push      offset s@
	call      _printf
	add       esp,8
   ;	
   ;	}
   ;	
@10:
	pop       edi
	pop       esi
	pop       ebx
	pop       ecx
	pop       ecx
	pop       ebp
	ret 
_main	endp
_TEXT	ends
_DATA	segment dword public use32 'DATA'
s@	label	byte
	;	s@+0:
	db	"prime_count = %d ",10,0
	align	4
_DATA	ends
_TEXT	segment dword public use32 'CODE'
_TEXT	ends
	public	_main
	extrn	_sqrt:near
	extrn	_printf:near
	extrn	__ftol:near
	extrn	__turboFloat:word
	?debug	D "C:\BC5\INCLUDE\stddef.h" 8825 12352
	?debug	D "C:\BC5\INCLUDE\math.h" 8825 12352
	?debug	D "C:\BC5\INCLUDE\_null.h" 8825 12352
	?debug	D "C:\BC5\INCLUDE\_nfile.h" 8825 12352
	?debug	D "C:\BC5\INCLUDE\_defs.h" 8825 12352
	?debug	D "C:\BC5\INCLUDE\stdio.h" 8825 12352
	?debug	D "prime.c" 12583 35307
	end

