; Listing generated by Microsoft (R) Optimizing Compiler Version 14.00.50727.42 

	TITLE	c:\Documents and Settings\Tobi\My Documents\Visual Studio 2005\Projects\Scimark2-AMD\source\LU.c
	.686P
	.XMM
	include listing.inc
	.model	flat

INCLUDELIB OLDNAMES

PUBLIC	__mask@@AbsDouble@
PUBLIC	_LU_factor
;	COMDAT __mask@@AbsDouble@
; File c:\documents and settings\tobi\my documents\visual studio 2005\projects\scimark2-amd\source\lu.c
CONST	SEGMENT
__mask@@AbsDouble@ DB 0ffH, 0ffH, 0ffH, 0ffH, 0ffH, 0ffH, 0ffH, 07fH, 0ffH
	DB	0ffH, 0ffH, 0ffH, 0ffH, 0ffH, 0ffH, 07fH
; Function compile flags: /Ogtpy
CONST	ENDS
_TEXT	SEGMENT
tv2346 = -40						; size = 4
_minMN$ = -36						; size = 4
_Aj$971 = -32						; size = 4
tv2277 = -28						; size = 4
_ii$966 = -28						; size = 4
tv2264 = -24						; size = 4
tv2367 = -20						; size = 4
tv2364 = -16						; size = 4
tv2365 = -12						; size = 4
tv1780 = -8						; size = 4
tv857 = -4						; size = 4
_jj$973 = -4						; size = 4
_M$ = 8							; size = 4
_N$ = 12						; size = 4
_A$ = 16						; size = 4
_pivot$ = 20						; size = 4
_LU_factor PROC

; 26   : {

	sub	esp, 40					; 00000028H

; 27   :  
; 28   : 
; 29   :     int minMN =  M < N ? M : N;

	mov	edx, DWORD PTR _M$[esp+36]
	push	ebx
	push	ebp
	push	esi
	mov	esi, DWORD PTR _N$[esp+48]
	cmp	edx, esi
	push	edi
	mov	DWORD PTR _minMN$[esp+56], edx
	jl	SHORT $LN24@LU_factor
	mov	DWORD PTR _minMN$[esp+56], esi
$LN24@LU_factor:

; 30   :     int j=0;
; 31   : 
; 32   :     for (j=0; j<minMN; j++)

	cmp	DWORD PTR _minMN$[esp+56], 0
	jle	$LN18@LU_factor
	mov	ecx, DWORD PTR _A$[esp+52]
	movsd	xmm2, QWORD PTR __mask@@AbsDouble@
	xorps	xmm4, xmm4
	movsd	xmm3, QWORD PTR __real@3ff0000000000000
	lea	eax, DWORD PTR [edx-1]
	mov	DWORD PTR tv2346[esp+56], eax
	mov	eax, esi
	sub	eax, edx
	mov	DWORD PTR tv2364[esp+56], eax
	mov	eax, DWORD PTR _pivot$[esp+52]
	xor	ebx, ebx
	sub	eax, ecx
	mov	edi, 1
	mov	DWORD PTR tv2264[esp+56], ecx
	mov	DWORD PTR tv2367[esp+56], eax
$LN20@LU_factor:

; 37   :         int i;
; 38   :         
; 39   :         double t = fabs(A[j][j]);
; 40   :         for (i=j+1; i<M; i++)

	cmp	DWORD PTR tv2346[esp+56], 4
	mov	ebp, DWORD PTR [ecx]
	movsd	xmm0, QWORD PTR [ebx+ebp]
	lea	edx, DWORD PTR [edi-1]
	andpd	xmm0, xmm2
	mov	eax, edi
	jl	$LC37@LU_factor

; 33   :     {
; 34   :         /* find pivot in column j and  test for singularity. */
; 35   : 
; 36   :         int jp=j;

	lea	esi, DWORD PTR [ecx+12]
	npad	1

; 37   :         int i;
; 38   :         
; 39   :         double t = fabs(A[j][j]);
; 40   :         for (i=j+1; i<M; i++)

$LL42@LU_factor:

; 41   :         {
; 42   :             double ab = fabs(A[i][j]);

	mov	ebp, DWORD PTR [esi-8]
	movsd	xmm1, QWORD PTR [ebx+ebp]
	andpd	xmm1, xmm2

; 43   :             if ( ab > t)

	comisd	xmm1, xmm0
	jbe	SHORT $LN38@LU_factor

; 44   :             {
; 45   :                 jp = i;

	mov	edx, eax

; 46   :                 t = ab;

	movapd	xmm0, xmm1
$LN38@LU_factor:
	mov	ebp, DWORD PTR [esi-4]
	movsd	xmm1, QWORD PTR [ebx+ebp]
	andpd	xmm1, xmm2
	comisd	xmm1, xmm0
	jbe	SHORT $LN39@LU_factor
	lea	edx, DWORD PTR [eax+1]
	movapd	xmm0, xmm1
$LN39@LU_factor:
	mov	ebp, DWORD PTR [esi]
	movsd	xmm1, QWORD PTR [ebx+ebp]
	andpd	xmm1, xmm2
	comisd	xmm1, xmm0
	jbe	SHORT $LN40@LU_factor
	lea	edx, DWORD PTR [eax+2]
	movapd	xmm0, xmm1
$LN40@LU_factor:
	mov	ebp, DWORD PTR [esi+4]
	movsd	xmm1, QWORD PTR [ebx+ebp]
	andpd	xmm1, xmm2
	comisd	xmm1, xmm0
	jbe	SHORT $LN41@LU_factor
	lea	edx, DWORD PTR [eax+3]
	movapd	xmm0, xmm1
$LN41@LU_factor:
	mov	ebp, DWORD PTR _M$[esp+52]
	add	eax, 4
	add	ebp, -3					; fffffffdH
	add	esi, 16					; 00000010H
	cmp	eax, ebp
	jl	SHORT $LL42@LU_factor

; 33   :     {
; 34   :         /* find pivot in column j and  test for singularity. */
; 35   : 
; 36   :         int jp=j;

	mov	ebp, DWORD PTR [ecx]
$LC37@LU_factor:

; 37   :         int i;
; 38   :         
; 39   :         double t = fabs(A[j][j]);
; 40   :         for (i=j+1; i<M; i++)

	cmp	eax, DWORD PTR _M$[esp+52]
	jge	SHORT $LN36@LU_factor
	npad	5
$LC17@LU_factor:

; 41   :         {
; 42   :             double ab = fabs(A[i][j]);

	mov	esi, DWORD PTR _A$[esp+52]
	mov	esi, DWORD PTR [esi+eax*4]
	movsd	xmm1, QWORD PTR [esi+ebx]
	andpd	xmm1, xmm2

; 43   :             if ( ab > t)

	comisd	xmm1, xmm0
	jbe	SHORT $LN16@LU_factor

; 44   :             {
; 45   :                 jp = i;

	mov	edx, eax

; 46   :                 t = ab;

	movapd	xmm0, xmm1
$LN16@LU_factor:
	add	eax, 1
	cmp	eax, DWORD PTR _M$[esp+52]
	jl	SHORT $LC17@LU_factor
$LN36@LU_factor:

; 47   :             }
; 48   :         }
; 49   :         
; 50   :         pivot[j] = jp;

	mov	eax, DWORD PTR tv2367[esp+56]
	mov	DWORD PTR [eax+ecx], edx

; 51   : 
; 52   :         /* jp now has the index of maximum element  */
; 53   :         /* of column j, below the diagonal          */
; 54   : 
; 55   :         if ( A[jp][j] == 0 )                 

	mov	eax, DWORD PTR _A$[esp+52]
	mov	esi, DWORD PTR [eax+edx*4]
	movsd	xmm0, QWORD PTR [esi+ebx]
	ucomisd	xmm0, xmm4
	lahf
	test	ah, 68					; 00000044H
	jnp	$LN30@LU_factor

; 56   :             return 1;       /* factorization failed because of zero pivot */
; 57   : 
; 58   : 
; 59   :         if (jp != j)

	lea	eax, DWORD PTR [edi-1]
	cmp	edx, eax
	je	SHORT $LN12@LU_factor

; 60   :         {
; 61   :             /* swap rows j and jp */
; 62   :             double *tA = A[j];
; 63   :             A[j] = A[jp];

	mov	DWORD PTR [ecx], esi

; 64   :             A[jp] = tA;

	mov	esi, DWORD PTR _A$[esp+52]
	mov	DWORD PTR [esi+edx*4], ebp
$LN12@LU_factor:

; 65   :         }
; 66   : 
; 67   :         if (j<M-1)                /* compute elements j+1:M of jth column  */

	mov	edx, DWORD PTR _M$[esp+52]
	add	edx, -1
	cmp	eax, edx
	jge	$LN43@LU_factor

; 68   :         {
; 69   :             /* note A(j,j), was A(jp,p) previously which was */
; 70   :             /* guarranteed not to be zero (Label #1)         */
; 71   : 
; 72   :             double recp =  1.0 / A[j][j];
; 73   :             int k;
; 74   :             for (k=j+1; k<M; k++)

	cmp	DWORD PTR tv2346[esp+56], 4
	mov	edx, DWORD PTR [ecx]
	movapd	xmm0, xmm3
	divsd	xmm0, QWORD PTR [ebx+edx]
	mov	ebp, edi
	jl	SHORT $LC44@LU_factor
	mov	edx, DWORD PTR _M$[esp+52]
	sub	edx, edi
	sub	edx, 4
	shr	edx, 2
	add	edx, 1
	lea	eax, DWORD PTR [ecx+12]
	lea	ebp, DWORD PTR [edi+edx*4]
	npad	2
$LL45@LU_factor:

; 75   :                 A[k][j] *= recp;

	mov	esi, DWORD PTR [eax-8]
	add	esi, ebx
	movapd	xmm1, xmm0
	mulsd	xmm1, QWORD PTR [esi]
	movsd	QWORD PTR [esi], xmm1
	mov	esi, DWORD PTR [eax-4]
	add	esi, ebx
	movapd	xmm1, xmm0
	mulsd	xmm1, QWORD PTR [esi]
	movsd	QWORD PTR [esi], xmm1
	mov	esi, DWORD PTR [eax]
	movsd	xmm1, QWORD PTR [esi+ebx]
	add	esi, ebx
	mulsd	xmm1, xmm0
	movsd	QWORD PTR [esi], xmm1
	mov	esi, DWORD PTR [eax+4]
	movsd	xmm1, QWORD PTR [esi+ebx]
	add	esi, ebx
	add	eax, 16					; 00000010H
	sub	edx, 1
	mulsd	xmm1, xmm0
	movsd	QWORD PTR [esi], xmm1
	jne	SHORT $LL45@LU_factor
$LC44@LU_factor:

; 68   :         {
; 69   :             /* note A(j,j), was A(jp,p) previously which was */
; 70   :             /* guarranteed not to be zero (Label #1)         */
; 71   : 
; 72   :             double recp =  1.0 / A[j][j];
; 73   :             int k;
; 74   :             for (k=j+1; k<M; k++)

	cmp	ebp, DWORD PTR _M$[esp+52]
	jge	SHORT $LN43@LU_factor
$LC10@LU_factor:

; 75   :                 A[k][j] *= recp;

	mov	eax, DWORD PTR _A$[esp+52]
	mov	edx, DWORD PTR [eax+ebp*4]
	movsd	xmm1, QWORD PTR [edx+ebx]
	lea	eax, DWORD PTR [edx+ebx]
	add	ebp, 1
	cmp	ebp, DWORD PTR _M$[esp+52]
	mulsd	xmm1, xmm0
	movsd	QWORD PTR [eax], xmm1
	jl	SHORT $LC10@LU_factor
$LN43@LU_factor:

; 76   :         }
; 77   : 
; 78   : 
; 79   :         if (j < minMN-1)

	mov	eax, DWORD PTR _minMN$[esp+56]
	lea	edx, DWORD PTR [eax-1]
	lea	eax, DWORD PTR [edi-1]
	cmp	eax, edx
	jge	$LN19@LU_factor

; 80   :         {
; 81   :             /* rank-1 update to trailing submatrix:   E = E - x*y; */
; 82   :             /* E is the region A(j+1:M, j+1:N) */
; 83   :             /* x is the column vector A(j+1:M,j) */
; 84   :             /* y is row vector A(j,j+1:N)        */
; 85   : 
; 86   :             int ii;
; 87   :             for (ii=j+1; ii<M; ii++)

	cmp	edi, DWORD PTR _M$[esp+52]
	mov	edx, edi
	mov	DWORD PTR _ii$966[esp+56], edi
	jge	$LN19@LU_factor

; 88   :             {
; 89   :                 double *Aii = A[ii];
; 90   :                 double *Aj = A[j];

	mov	ebp, DWORD PTR [ecx]
	mov	eax, DWORD PTR tv2364[esp+56]
	mov	ecx, DWORD PTR tv2346[esp+56]
	add	eax, ecx
	mov	DWORD PTR _Aj$971[esp+56], ebp
	mov	DWORD PTR tv2365[esp+56], eax
	jmp	SHORT $LN6@LU_factor
	npad	5
$LL49@LU_factor:

; 80   :         {
; 81   :             /* rank-1 update to trailing submatrix:   E = E - x*y; */
; 82   :             /* E is the region A(j+1:M, j+1:N) */
; 83   :             /* x is the column vector A(j+1:M,j) */
; 84   :             /* y is row vector A(j,j+1:N)        */
; 85   : 
; 86   :             int ii;
; 87   :             for (ii=j+1; ii<M; ii++)

	mov	eax, DWORD PTR tv2365[esp+56]
$LN6@LU_factor:

; 91   :                 double AiiJ = Aii[j];
; 92   :                 int jj;
; 93   :                 for (jj=j+1; jj<N; jj++)

	cmp	eax, 4
	mov	ecx, DWORD PTR _A$[esp+52]
	mov	esi, DWORD PTR [ecx+edx*4]
	movsd	xmm0, QWORD PTR [ebx+esi]
	mov	ecx, edi
	jl	$LC47@LU_factor
	mov	ecx, DWORD PTR _N$[esp+52]
	sub	ecx, edi
	sub	ecx, 4
	lea	edx, DWORD PTR [ebp+edi*8+24]

; 94   :                   Aii[jj] -= AiiJ * Aj[jj];

	sub	ebp, esi
	shr	ecx, 2
	mov	DWORD PTR tv1780[esp+56], ebp
	add	ecx, 1
	lea	ebp, DWORD PTR [edi+ecx*4]
	mov	DWORD PTR _jj$973[esp+56], ebp
	mov	ebp, DWORD PTR tv1780[esp+56]
	lea	eax, DWORD PTR [esi+edi*8+8]
	npad	13
$LL48@LU_factor:
	movsd	xmm1, QWORD PTR [edx-24]
	movsd	xmm5, QWORD PTR [eax-8]
	mulsd	xmm1, xmm0
	subsd	xmm5, xmm1
	movsd	QWORD PTR [eax-8], xmm5
	movsd	xmm1, QWORD PTR [eax+ebp]
	movsd	xmm5, QWORD PTR [eax]
	mulsd	xmm1, xmm0
	subsd	xmm5, xmm1
	movsd	QWORD PTR [eax], xmm5
	movsd	xmm1, QWORD PTR [edx-8]
	movsd	xmm5, QWORD PTR [eax+8]
	mulsd	xmm1, xmm0
	subsd	xmm5, xmm1
	movsd	QWORD PTR [eax+8], xmm5
	movsd	xmm1, QWORD PTR [edx]
	movsd	xmm5, QWORD PTR [eax+16]
	mulsd	xmm1, xmm0
	subsd	xmm5, xmm1
	movsd	QWORD PTR [eax+16], xmm5
	add	eax, 32					; 00000020H
	add	edx, 32					; 00000020H
	sub	ecx, 1
	jne	SHORT $LL48@LU_factor
	mov	ecx, DWORD PTR _jj$973[esp+56]
	mov	ebp, DWORD PTR _Aj$971[esp+56]
$LC47@LU_factor:

; 91   :                 double AiiJ = Aii[j];
; 92   :                 int jj;
; 93   :                 for (jj=j+1; jj<N; jj++)

	cmp	ecx, DWORD PTR _N$[esp+52]
	jge	SHORT $LN5@LU_factor
	mov	edx, DWORD PTR _N$[esp+52]
	sub	ebp, esi
	lea	eax, DWORD PTR [esi+ecx*8]
	sub	edx, ecx
	npad	3
$LC3@LU_factor:

; 94   :                   Aii[jj] -= AiiJ * Aj[jj];

	movsd	xmm1, QWORD PTR [eax+ebp]
	movsd	xmm5, QWORD PTR [eax]
	mulsd	xmm1, xmm0
	subsd	xmm5, xmm1
	movsd	QWORD PTR [eax], xmm5
	add	eax, 8
	sub	edx, 1
	jne	SHORT $LC3@LU_factor

; 91   :                 double AiiJ = Aii[j];
; 92   :                 int jj;
; 93   :                 for (jj=j+1; jj<N; jj++)

	mov	ebp, DWORD PTR _Aj$971[esp+56]
$LN5@LU_factor:

; 80   :         {
; 81   :             /* rank-1 update to trailing submatrix:   E = E - x*y; */
; 82   :             /* E is the region A(j+1:M, j+1:N) */
; 83   :             /* x is the column vector A(j+1:M,j) */
; 84   :             /* y is row vector A(j,j+1:N)        */
; 85   : 
; 86   :             int ii;
; 87   :             for (ii=j+1; ii<M; ii++)

	mov	edx, DWORD PTR _ii$966[esp+56]
	add	edx, 1
	cmp	edx, DWORD PTR _M$[esp+52]
	mov	DWORD PTR _ii$966[esp+56], edx
	jl	$LL49@LU_factor
	mov	ecx, DWORD PTR tv2264[esp+56]
$LN19@LU_factor:

; 30   :     int j=0;
; 31   : 
; 32   :     for (j=0; j<minMN; j++)

	sub	DWORD PTR tv2346[esp+56], 1
	add	edi, 1
	add	ecx, 4
	lea	edx, DWORD PTR [edi-1]
	add	ebx, 8
	cmp	edx, DWORD PTR _minMN$[esp+56]
	mov	DWORD PTR tv2264[esp+56], ecx
	jl	$LN20@LU_factor
$LN18@LU_factor:

; 95   : 
; 96   :             }
; 97   :         }
; 98   :     }
; 99   : 
; 100  :     return 0;

	xor	eax, eax

; 101  : }

	pop	edi
	pop	esi
	pop	ebp
	pop	ebx
	add	esp, 40					; 00000028H
	ret	0
$LN30@LU_factor:
	pop	edi
	pop	esi
	pop	ebp
	mov	eax, 1
	pop	ebx
	add	esp, 40					; 00000028H
	ret	0
_LU_factor ENDP
_TEXT	ENDS
PUBLIC	__real@3fe5555555555555
PUBLIC	_LU_num_flops
;	COMDAT __real@3fe5555555555555
CONST	SEGMENT
__real@3fe5555555555555 DQ 03fe5555555555555r	; 0.666667
; Function compile flags: /Ogtpy
CONST	ENDS
_TEXT	SEGMENT
_N$ = 8							; size = 4
_LU_num_flops PROC

; 6    :         /* rougly 2/3*N^3 */
; 7    : 
; 8    :     double Nd = (double) N;

	cvtsi2sd xmm1, DWORD PTR _N$[esp-4]

; 9    : 
; 10   :     return (2.0 * Nd *Nd *Nd/ 3.0);

	movapd	xmm0, xmm1
	mulsd	xmm0, xmm1
	mulsd	xmm0, xmm1
	mulsd	xmm0, QWORD PTR __real@3fe5555555555555

; 11   : }

	ret	0
_LU_num_flops ENDP
END
