	.global	stat
	.type	stat, @function
stat:
	pushl	%ebp
	movl	%esp, %ebp
	push	%ebx
	movl	$106, %eax		# stat system call
	movl	8(%ebp), %ebx		# file
	addl	$1, %ebx		# Skip the count byte
	movl	12(%ebp), %ecx		# stat record
	int	$128
	cmpl	$0, %eax
	jne	end			# return value <> 0
	movl	12(%ebp), %eax		# Load stat record
	movzwl	8(%eax), %edx		# Load st.type from the stat record
	shrw	$12, %dx		# shift over 12 bits
	movw	%dx, 8(%eax)		# Save the result back to st.type
	movl	$0, %eax		# Return 0 for success
end:
	popl	%ebx
	popl	%ebp
	ret
