; 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\array.c
	.686P
	.XMM
	include listing.inc
	.model	flat

INCLUDELIB OLDNAMES

EXTRN	@__security_check_cookie@4:PROC
EXTRN	_malloc:PROC
EXTRN	_free:PROC
PUBLIC	_Array2D_double_copy
; Function compile flags: /Ogtpy
; File c:\documents and settings\tobi\my documents\visual studio 2005\projects\scimark2-amd\source\array.c
_TEXT	SEGMENT
_j$ = -20						; size = 4
tv1137 = -16						; size = 4
tv1101 = -12						; size = 4
tv1149 = -8						; size = 4
tv460 = -4						; size = 4
_N$ = 8							; size = 4
_B$ = 12						; size = 4
_Array2D_double_copy PROC
; _M$ = ecx
; _A$ = eax

; 57   :   {

	sub	esp, 20					; 00000014H
	push	edi

; 58   : 
; 59   :         int remainder = N & 3;       /* N mod 4; */

	mov	edi, DWORD PTR _N$[esp+20]
	and	edi, 3

; 60   :         int i=0;
; 61   :         int j=0;
; 62   : 
; 63   :         for (i=0; i<M; i++)

	test	ecx, ecx
	jle	$LN7@Array2D_do
	mov	edx, DWORD PTR _B$[esp+20]
	push	ebx
	push	ebp
	mov	ebp, eax
	sub	edx, eax
	push	esi
	mov	DWORD PTR tv1137[esp+36], ebp
	mov	DWORD PTR tv1149[esp+36], edx
	mov	DWORD PTR tv1101[esp+36], ecx
	jmp	SHORT $LN9@Array2D_do
	npad	4
$LL22@Array2D_do:

; 58   : 
; 59   :         int remainder = N & 3;       /* N mod 4; */

	mov	edx, DWORD PTR tv1149[esp+36]
$LN9@Array2D_do:

; 64   :         {
; 65   :             double *Bi = B[i];

	mov	esi, DWORD PTR [edx+ebp]

; 66   :             double *Ai = A[i];

	mov	ebx, DWORD PTR [ebp]

; 67   :             for (j=0; j<remainder; j++)

	xor	eax, eax
	cmp	edi, 4
	mov	DWORD PTR _j$[esp+36], eax
	jl	SHORT $LC19@Array2D_do

; 68   :                 Bi[j] = Ai[j];

	mov	edx, ebx
	sub	edx, esi
	mov	DWORD PTR tv460[esp+36], edx
	lea	edx, DWORD PTR [edi-4]
	shr	edx, 2
	add	edx, 1
	lea	ebp, DWORD PTR [edx*4]
	mov	DWORD PTR _j$[esp+36], ebp
	mov	ebp, DWORD PTR tv460[esp+36]
	lea	ecx, DWORD PTR [ebx+24]
	lea	eax, DWORD PTR [esi+8]
	npad	5
$LL20@Array2D_do:
	fld	QWORD PTR [ecx-24]
	add	eax, 32					; 00000020H
	fstp	QWORD PTR [eax-40]
	add	ecx, 32					; 00000020H
	sub	edx, 1
	fld	QWORD PTR [eax+ebp-32]
	fstp	QWORD PTR [eax-32]
	fld	QWORD PTR [ecx-40]
	fstp	QWORD PTR [eax-24]
	fld	QWORD PTR [ecx-32]
	fstp	QWORD PTR [eax-16]
	jne	SHORT $LL20@Array2D_do
	mov	eax, DWORD PTR _j$[esp+36]
	mov	ebp, DWORD PTR tv1137[esp+36]
$LC19@Array2D_do:

; 67   :             for (j=0; j<remainder; j++)

	cmp	eax, edi
	jge	SHORT $LN18@Array2D_do
	mov	edx, ebx
	mov	ecx, edi
	sub	edx, esi
	sub	ecx, DWORD PTR _j$[esp+36]
	lea	eax, DWORD PTR [esi+eax*8]
	npad	3
$LC6@Array2D_do:

; 68   :                 Bi[j] = Ai[j];

	fld	QWORD PTR [eax+edx]
	add	eax, 8
	sub	ecx, 1
	fstp	QWORD PTR [eax-8]
	jne	SHORT $LC6@Array2D_do
$LN18@Array2D_do:

; 69   :             for (j=remainder; j<N; j+=4)

	cmp	edi, DWORD PTR _N$[esp+32]
	jge	SHORT $LN8@Array2D_do
	mov	ecx, DWORD PTR _N$[esp+32]
	sub	ecx, edi
	sub	ecx, 1
	lea	edx, DWORD PTR [ebx+edi*8+24]
	shr	ecx, 2
	sub	ebx, esi
	lea	eax, DWORD PTR [esi+edi*8+8]
	add	ecx, 1
	npad	3
$LL3@Array2D_do:

; 70   :             {
; 71   :                 Bi[j] = Ai[j];

	fld	QWORD PTR [edx-24]
	add	eax, 32					; 00000020H
	fstp	QWORD PTR [eax-40]
	add	edx, 32					; 00000020H
	sub	ecx, 1

; 72   :                 Bi[j+1] = Ai[j+1];

	fld	QWORD PTR [eax+ebx-32]
	fstp	QWORD PTR [eax-32]

; 73   :                 Bi[j+2] = Ai[j+2];

	fld	QWORD PTR [edx-40]
	fstp	QWORD PTR [eax-24]

; 74   :                 Bi[j+3] = Ai[j+3];

	fld	QWORD PTR [edx-32]
	fstp	QWORD PTR [eax-16]
	jne	SHORT $LL3@Array2D_do
$LN8@Array2D_do:

; 60   :         int i=0;
; 61   :         int j=0;
; 62   : 
; 63   :         for (i=0; i<M; i++)

	add	ebp, 4
	sub	DWORD PTR tv1101[esp+36], 1
	mov	DWORD PTR tv1137[esp+36], ebp
	jne	$LL22@Array2D_do
	pop	esi
	pop	ebp
	pop	ebx
$LN7@Array2D_do:
	pop	edi

; 75   :             }
; 76   :         }
; 77   :   }

	add	esp, 20					; 00000014H
	ret	0
_Array2D_double_copy ENDP
_TEXT	ENDS
PUBLIC	_Array2D_double_delete
; Function compile flags: /Ogtpy
_TEXT	SEGMENT
_A$ = 8							; size = 4
_Array2D_double_delete PROC
; _M$ = edi

; 45   : {

	push	ebx
	mov	ebx, DWORD PTR _A$[esp]
	push	esi

; 46   :     int i;
; 47   :     if (A == NULL) return;
; 48   : 
; 49   :     for (i=0; i<M; i++)

	xor	esi, esi
	test	edi, edi
	jle	SHORT $LN1@Array2D_do@2
	npad	4
$LL3@Array2D_do@2:

; 50   :         free(A[i]);

	mov	eax, DWORD PTR [ebx+esi*4]
	push	eax
	call	_free
	add	esi, 1
	add	esp, 4
	cmp	esi, edi
	jl	SHORT $LL3@Array2D_do@2
$LN1@Array2D_do@2:

; 51   : 
; 52   :     free(A);

	push	ebx
	call	_free
	add	esp, 4
	pop	esi
	pop	ebx

; 53   : }

	ret	0
_Array2D_double_delete ENDP
_TEXT	ENDS
PUBLIC	_new_Array2D_double
; Function compile flags: /Ogtpy
_TEXT	SEGMENT
_M$ = 8							; size = 4
_N$ = 12						; size = 4
_new_Array2D_double PROC

; 11   : {

	push	ebp
	mov	ebp, DWORD PTR _M$[esp]

; 12   :     int i=0;
; 13   :     int failed = 0;
; 14   : 
; 15   :     double **A = (double**) malloc(sizeof(double*)*M);

	lea	eax, DWORD PTR [ebp*4]
	push	edi
	push	eax
	call	_malloc
	mov	edi, eax
	add	esp, 4

; 16   :     if (A == NULL)

	test	edi, edi
	jne	SHORT $LN10@new_Array2
	pop	edi
	pop	ebp

; 43   : }

	ret	0
$LN10@new_Array2:
	push	ebx
	push	esi

; 17   :         return NULL;
; 18   : 
; 19   :     for (i=0; i<M; i++)

	xor	esi, esi
	test	ebp, ebp
	jle	SHORT $LN5@new_Array2
	mov	ebx, DWORD PTR _N$[esp+12]
	add	ebx, ebx
	add	ebx, ebx
	add	ebx, ebx
$LL9@new_Array2:

; 20   :     {
; 21   :         A[i] = (double*) malloc(N * sizeof(double));

	push	ebx
	call	_malloc
	add	esp, 4

; 22   :         if (A[i] == NULL)

	test	eax, eax
	mov	DWORD PTR [edi+esi*4], eax
	je	SHORT $LN15@new_Array2
	add	esi, 1
	cmp	esi, ebp
	jl	SHORT $LL9@new_Array2
$LN5@new_Array2:
	pop	esi
	pop	ebx

; 40   :     }
; 41   :     else
; 42   :         return A;

	mov	eax, edi
	pop	edi
	pop	ebp

; 43   : }

	ret	0
$LN15@new_Array2:

; 23   :         {
; 24   :             failed = 1;
; 25   :             break;
; 26   :         }
; 27   :     }
; 28   : 
; 29   :     /* if we didn't successfully allocate all rows of A      */
; 30   :     /* clean up any allocated memory (i.e. go back and free  */
; 31   :     /* previous rows) and return NULL                        */
; 32   : 
; 33   :     if (failed)
; 34   :     {
; 35   :         i--;

	sub	esi, 1

; 36   :         for (; i<=0; i--)

	test	esi, esi
	jg	SHORT $LN2@new_Array2
$LL4@new_Array2:

; 37   :             free(A[i]);

	mov	ecx, DWORD PTR [edi+esi*4]
	push	ecx
	call	_free
	sub	esi, 1
	add	esp, 4
	test	esi, esi
	jle	SHORT $LL4@new_Array2
$LN2@new_Array2:

; 38   :         free(A);

	push	edi
	call	_free
	add	esp, 4
	pop	esi
	pop	ebx
	pop	edi

; 39   :         return NULL;

	xor	eax, eax
	pop	ebp

; 43   : }

	ret	0
_new_Array2D_double ENDP
END
