; 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	_LU_factor
; Function compile flags: /Ogtpy
; File c:\documents and settings\tobi\my documents\visual studio 2005\projects\scimark2-amd\source\lu.c
_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 _N$[esp+36]
	push	ebx
	push	ebp
	push	esi
	mov	esi, DWORD PTR _M$[esp+48]
	cmp	esi, edx
	push	edi
	mov	DWORD PTR _minMN$[esp+56], esi
	jl	SHORT $LN24@LU_factor
	mov	DWORD PTR _minMN$[esp+56], edx
$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	ebp, DWORD PTR _A$[esp+52]
	fldz
	fld1
	lea	eax, DWORD PTR [esi-1]
	mov	DWORD PTR tv2346[esp+56], eax
	mov	eax, edx
	sub	eax, esi
	mov	DWORD PTR tv2364[esp+56], eax
	mov	eax, DWORD PTR _pivot$[esp+52]
	xor	ebx, ebx
	mov	ecx, ebp
	sub	eax, ebp
	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	eax, DWORD PTR [ecx]
	fld	QWORD PTR [eax+ebx]
	lea	esi, DWORD PTR [edi-1]
	mov	DWORD PTR tv2277[esp+56], eax
	fabs
	mov	edx, edi
	jl	SHORT $LC37@LU_factor

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

	lea	ebp, DWORD PTR [ecx+12]

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

$LN42@LU_factor:

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

	mov	eax, DWORD PTR [ebp-8]
	fld	QWORD PTR [eax+ebx]
	fabs

; 43   :             if ( ab > t)

	fcom	ST(1)
	fnstsw	ax
	test	ah, 65					; 00000041H
	jne	SHORT $LN59@LU_factor

; 44   :             {
; 45   :                 jp = i;
; 46   :                 t = ab;

	fstp	ST(1)
	mov	esi, edx
	jmp	SHORT $LN38@LU_factor
$LN59@LU_factor:
	fstp	ST(0)
$LN38@LU_factor:

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

	mov	eax, DWORD PTR [ebp-4]
	fld	QWORD PTR [eax+ebx]
	fabs

; 43   :             if ( ab > t)

	fcom	ST(1)
	fnstsw	ax
	test	ah, 65					; 00000041H
	jne	SHORT $LN62@LU_factor

; 44   :             {
; 45   :                 jp = i;
; 46   :                 t = ab;

	fstp	ST(1)
	lea	esi, DWORD PTR [edx+1]
	jmp	SHORT $LN39@LU_factor
$LN62@LU_factor:
	fstp	ST(0)
$LN39@LU_factor:

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

	mov	eax, DWORD PTR [ebp]
	fld	QWORD PTR [eax+ebx]
	fabs

; 43   :             if ( ab > t)

	fcom	ST(1)
	fnstsw	ax
	test	ah, 65					; 00000041H
	jne	SHORT $LN65@LU_factor

; 44   :             {
; 45   :                 jp = i;
; 46   :                 t = ab;

	fstp	ST(1)
	lea	esi, DWORD PTR [edx+2]
	jmp	SHORT $LN40@LU_factor
$LN65@LU_factor:
	fstp	ST(0)
$LN40@LU_factor:

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

	mov	eax, DWORD PTR [ebp+4]
	fld	QWORD PTR [eax+ebx]
	fabs

; 43   :             if ( ab > t)

	fcom	ST(1)
	fnstsw	ax
	test	ah, 65					; 00000041H
	jne	SHORT $LN68@LU_factor

; 44   :             {
; 45   :                 jp = i;
; 46   :                 t = ab;

	fstp	ST(1)
	lea	esi, DWORD PTR [edx+3]
	jmp	SHORT $LN41@LU_factor
$LN68@LU_factor:
	fstp	ST(0)
$LN41@LU_factor:

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

	mov	eax, DWORD PTR _M$[esp+52]

; 44   :             {
; 45   :                 jp = i;
; 46   :                 t = ab;

	add	edx, 4
	add	eax, -3					; fffffffdH
	add	ebp, 16					; 00000010H
	cmp	edx, eax
	jl	SHORT $LN42@LU_factor

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

	mov	ebp, DWORD PTR _A$[esp+52]
$LC37@LU_factor:

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

	cmp	edx, DWORD PTR _M$[esp+52]
	jge	SHORT $LN77@LU_factor
$LC17@LU_factor:

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

	mov	eax, DWORD PTR [ebp+edx*4]
	fld	QWORD PTR [eax+ebx]
	fabs

; 43   :             if ( ab > t)

	fcom	ST(1)
	fnstsw	ax
	test	ah, 65					; 00000041H
	jne	SHORT $LN75@LU_factor

; 44   :             {
; 45   :                 jp = i;
; 46   :                 t = ab;

	fstp	ST(1)
	mov	esi, edx
	jmp	SHORT $LN16@LU_factor
$LN75@LU_factor:
	fstp	ST(0)
$LN16@LU_factor:

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

	add	edx, 1
	cmp	edx, DWORD PTR _M$[esp+52]
	jl	SHORT $LC17@LU_factor
$LN77@LU_factor:

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

	mov	edx, DWORD PTR tv2367[esp+56]
	fstp	ST(0)
	mov	DWORD PTR [edx+ecx], esi

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

	fld	ST(1)
	mov	edx, DWORD PTR [ebp+esi*4]
	fcomp	QWORD PTR [edx+ebx]
	fnstsw	ax
	test	ah, 68					; 00000044H
	jnp	$LN79@LU_factor

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

	lea	eax, DWORD PTR [edi-1]
	cmp	esi, 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], edx

; 64   :             A[jp] = tA;

	mov	edx, DWORD PTR tv2277[esp+56]
	mov	DWORD PTR [ebp+esi*4], edx
$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
	fld	ST(0)
	mov	eax, DWORD PTR [ecx]
	fdiv	QWORD PTR [ebx+eax]
	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]
$LN45@LU_factor:

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

	mov	esi, DWORD PTR [eax-8]
	fld	QWORD PTR [esi+ebx]
	add	esi, ebx
	fmul	ST(0), ST(1)
	add	eax, 16					; 00000010H
	fstp	QWORD PTR [esi]
	mov	esi, DWORD PTR [eax-20]
	fld	QWORD PTR [esi+ebx]
	add	esi, ebx
	fmul	ST(0), ST(1)
	fstp	QWORD PTR [esi]
	mov	esi, DWORD PTR [eax-16]
	fld	QWORD PTR [esi+ebx]
	add	esi, ebx
	fmul	ST(0), ST(1)
	fstp	QWORD PTR [esi]
	mov	esi, DWORD PTR [eax-12]
	add	esi, ebx
	sub	edx, 1
	fld	ST(0)
	fmul	QWORD PTR [esi]
	fstp	QWORD PTR [esi]
	jne	SHORT $LN45@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 $LN91@LU_factor
$LC10@LU_factor:

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

	mov	edx, DWORD PTR _A$[esp+52]
	mov	eax, DWORD PTR [edx+ebp*4]
	fld	QWORD PTR [eax+ebx]
	add	eax, ebx
	fmul	ST(0), ST(1)
	add	ebp, 1
	cmp	ebp, DWORD PTR _M$[esp+52]
	fstp	QWORD PTR [eax]
	jl	SHORT $LC10@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++)

	mov	ebp, edx
	jmp	SHORT $LN120@LU_factor
$LN91@LU_factor:
	mov	ebp, DWORD PTR _A$[esp+52]
$LN120@LU_factor:
	fstp	ST(0)
$LN43@LU_factor:

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

	mov	edx, DWORD PTR _minMN$[esp+56]
	add	edx, -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
$LN49@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]
	fld	QWORD PTR [ebx+esi]
	mov	ecx, edi
	jl	SHORT $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]
$LN48@LU_factor:
	fld	QWORD PTR [edx-24]
	add	eax, 32					; 00000020H
	fmul	ST(0), ST(1)
	add	edx, 32					; 00000020H
	sub	ecx, 1
	fsubr	QWORD PTR [eax-40]
	fstp	QWORD PTR [eax-40]
	fld	QWORD PTR [eax+ebp-32]
	fmul	ST(0), ST(1)
	fsubr	QWORD PTR [eax-32]
	fstp	QWORD PTR [eax-32]
	fld	QWORD PTR [edx-40]
	fmul	ST(0), ST(1)
	fsubr	QWORD PTR [eax-24]
	fstp	QWORD PTR [eax-24]
	fld	QWORD PTR [edx-32]
	fmul	ST(0), ST(1)
	fsubr	QWORD PTR [eax-16]
	fstp	QWORD PTR [eax-16]
	jne	SHORT $LN48@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 $LN109@LU_factor
	mov	edx, DWORD PTR _N$[esp+52]
	sub	ebp, esi
	lea	eax, DWORD PTR [esi+ecx*8]
	sub	edx, ecx
$LC3@LU_factor:

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

	fld	QWORD PTR [eax+ebp]
	add	eax, 8
	sub	edx, 1
	fmul	ST(0), ST(1)
	fsubr	QWORD PTR [eax-8]
	fstp	QWORD PTR [eax-8]
	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]
$LN109@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]

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

	fstp	ST(0)
	add	edx, 1
	cmp	edx, DWORD PTR _M$[esp+52]
	mov	DWORD PTR _ii$966[esp+56], edx
	jl	$LN49@LU_factor
	mov	ecx, DWORD PTR tv2264[esp+56]
	mov	ebp, DWORD PTR _A$[esp+52]
$LN19@LU_factor:
	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
	fstp	ST(0)
	fstp	ST(0)
$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
$LN79@LU_factor:
	pop	edi
	fstp	ST(0)
	pop	esi
	fstp	ST(0)
	pop	ebp
	mov	eax, 1
	pop	ebx
	add	esp, 40					; 00000028H
	ret	0
_LU_factor ENDP
_TEXT	ENDS
PUBLIC	__real@4008000000000000
PUBLIC	_LU_num_flops
;	COMDAT __real@4008000000000000
CONST	SEGMENT
__real@4008000000000000 DQ 04008000000000000r	; 3
; 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;

	fild	DWORD PTR _N$[esp-4]

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

	fld	ST(0)
	fadd	ST(0), ST(1)
	fmul	ST(0), ST(1)
	fmulp	ST(1), ST(0)
	fdiv	QWORD PTR __real@4008000000000000

; 11   : }

	ret	0
_LU_num_flops ENDP
END
