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

INCLUDELIB OLDNAMES

PUBLIC	__real@3eb0c6f7a0b5ed8d
PUBLIC	_kernel_measureLU
;	COMDAT __real@3eb0c6f7a0b5ed8d
; File c:\documents and settings\tobi\my documents\visual studio 2005\projects\scimark2-amd\source\array.c
CONST	SEGMENT
__real@3eb0c6f7a0b5ed8d DQ 03eb0c6f7a0b5ed8dr	; 1e-006
; Function compile flags: /Ogtpy
; File c:\documents and settings\tobi\my documents\visual studio 2005\projects\scimark2-amd\source\kernel.c
CONST	ENDS
_TEXT	SEGMENT
_cycles$ = -28						; size = 4
_A$ = -24						; size = 4
_pivot$ = -20						; size = 4
tv388 = -16						; size = 4
tv385 = -16						; size = 4
tv377 = -16						; size = 4
_Nd$5347 = -12						; size = 8
_result$ = -12						; size = 8
_N$ = 8							; size = 4
_R$ = 12						; size = 4
_min_time$ = 16						; size = 8
_kernel_measureLU PROC

; 189  :     {

	sub	esp, 28					; 0000001cH
	push	ebx
	push	ebp
	push	esi
	push	edi
	mov	edi, DWORD PTR _N$[esp+40]

; 190  : 
; 191  :         double **A = NULL;
; 192  :         double **lu = NULL; 
; 193  :         int *pivot = NULL;
; 194  : 
; 195  :     
; 196  : 
; 197  :         Stopwatch Q = new_Stopwatch();

	push	24					; 00000018H
	call	_malloc
	fldz
	add	esp, 4
	test	eax, eax
	jne	SHORT $LN12@kernel_mea
	fstp	ST(0)
	xor	ebx, ebx
	jmp	SHORT $LN13@kernel_mea
$LN12@kernel_mea:
	fst	QWORD PTR [eax+8]
	mov	DWORD PTR [eax], 0
	fstp	QWORD PTR [eax+16]
	mov	ebx, eax
$LN13@kernel_mea:

; 198  :         double result = 0.0;
; 199  :         int i=0;
; 200  :         int cycles=1;
; 201  : 
; 202  :         if ((A = RandomMatrix(N, N,  R)) == NULL) exit(1);

	mov	esi, DWORD PTR _R$[esp+40]
	push	edi
	mov	ebp, 1
	push	edi
	mov	DWORD PTR _cycles$[esp+52], ebp
	call	_RandomMatrix
	add	esp, 8
	test	eax, eax
	mov	DWORD PTR _A$[esp+44], eax
	jne	SHORT $LN9@kernel_mea
	push	ebp
	call	_exit
$LN9@kernel_mea:

; 203  :         if ((lu = new_Array2D_double(N, N)) == NULL) exit(1);

	push	edi
	push	edi
	call	_new_Array2D_double
	mov	esi, eax
	add	esp, 8
	test	esi, esi
	jne	SHORT $LN8@kernel_mea
	push	1
	call	_exit
$LN8@kernel_mea:

; 204  :         if ((pivot = (int *) malloc(N * sizeof(int))) == NULL) exit(1);

	lea	eax, DWORD PTR [edi*4]
	push	eax
	call	_malloc
	add	esp, 4
	test	eax, eax
	mov	DWORD PTR _pivot$[esp+44], eax
	jne	SHORT $LL6@kernel_mea
	push	1
	call	_exit
	npad	6
$LL6@kernel_mea:

; 205  : 
; 206  : 
; 207  :         while(1)
; 208  :         {
; 209  :             Stopwatch_start(Q);

	cmp	DWORD PTR [ebx], 0
	jne	SHORT $LN17@kernel_mea
	fldz
	mov	DWORD PTR [ebx], 1
	fstp	QWORD PTR [ebx+16]
	call	_clock
	mov	DWORD PTR tv388[esp+44], eax
	fild	DWORD PTR tv388[esp+44]
	fdiv	QWORD PTR __real@408f400000000000
	fstp	QWORD PTR [ebx+8]
$LN17@kernel_mea:

; 210  :             for (i=0; i<cycles; i++)

	test	ebp, ebp
	jle	SHORT $LN2@kernel_mea
	npad	6
$LL4@kernel_mea:

; 211  :             {
; 212  :                 Array2D_double_copy(N, N, lu, A);

	mov	eax, DWORD PTR _A$[esp+44]
	push	edi
	mov	edx, esi
	mov	ecx, edi
	call	_Array2D_double_copy

; 213  :                 LU_factor(N, N, lu, pivot);

	mov	ecx, DWORD PTR _pivot$[esp+48]
	add	esp, 4
	push	ecx
	push	esi
	push	edi
	push	edi
	call	_LU_factor
	add	esp, 16					; 00000010H
	sub	ebp, 1
	jne	SHORT $LL4@kernel_mea

; 210  :             for (i=0; i<cycles; i++)

	mov	ebp, DWORD PTR _cycles$[esp+44]
$LN2@kernel_mea:

; 214  :             }
; 215  :             Stopwatch_stop(Q);

	cmp	DWORD PTR [ebx], 0
	je	SHORT $LN27@kernel_mea
	call	_clock
	mov	DWORD PTR tv385[esp+44], eax
	fild	DWORD PTR tv385[esp+44]
	mov	DWORD PTR [ebx], 0
	fdiv	QWORD PTR __real@408f400000000000
	fsub	QWORD PTR [ebx+8]
	fadd	QWORD PTR [ebx+16]
	fstp	QWORD PTR [ebx+16]

; 216  :             if (Stopwatch_read(Q) >= min_time) break;

$LN27@kernel_mea:
	fld	QWORD PTR _min_time$[esp+40]
	fcomp	QWORD PTR [ebx+16]
	fnstsw	ax
	test	ah, 65					; 00000041H
	jnp	SHORT $LN59@kernel_mea

; 217  : 
; 218  :             cycles *= 2;

	lea	edx, DWORD PTR [ebp+ebp]
	mov	DWORD PTR _cycles$[esp+44], edx

; 219  :         }

	mov	ebp, edx
	jmp	$LL6@kernel_mea
$LN59@kernel_mea:

; 220  :         /* approx Mflops */
; 221  :         result = LU_num_flops(N) * cycles / Stopwatch_read(Q) * 1.0e-6;

	cmp	DWORD PTR [ebx], 0
	fild	DWORD PTR _N$[esp+40]
	fst	QWORD PTR _Nd$5347[esp+44]
	je	SHORT $LN34@kernel_mea
	fstp	ST(0)
	call	_clock
	mov	DWORD PTR tv377[esp+44], eax
	fild	DWORD PTR tv377[esp+44]
	fdiv	QWORD PTR __real@408f400000000000
	fld	ST(0)
	fsub	QWORD PTR [ebx+8]
	fadd	QWORD PTR [ebx+16]
	fstp	QWORD PTR [ebx+16]
	fstp	QWORD PTR [ebx+8]
	fld	QWORD PTR _Nd$5347[esp+44]
$LN34@kernel_mea:
	fld	ST(0)

; 222  : 
; 223  :         Stopwatch_delete(Q);

	push	ebx
	fadd	ST(0), ST(1)
	fmul	ST(0), ST(1)
	fmulp	ST(1), ST(0)
	fdiv	QWORD PTR __real@4008000000000000
	fimul	DWORD PTR _cycles$[esp+48]
	fdiv	QWORD PTR [ebx+16]
	fmul	QWORD PTR __real@3eb0c6f7a0b5ed8d
	fstp	QWORD PTR _result$[esp+48]
	call	_free

; 224  :         free(pivot); 

	mov	eax, DWORD PTR _pivot$[esp+48]
	add	esp, 4
	push	eax
	call	_free
	add	esp, 4

; 225  :         Array2D_double_delete(N, N, lu); 

	xor	ebx, ebx
	test	edi, edi
	jle	SHORT $LN42@kernel_mea
	npad	3
$LL44@kernel_mea:
	mov	ecx, DWORD PTR [esi+ebx*4]
	push	ecx
	call	_free
	add	ebx, 1
	add	esp, 4
	cmp	ebx, edi
	jl	SHORT $LL44@kernel_mea
$LN42@kernel_mea:
	push	esi
	call	_free
	add	esp, 4

; 226  :         Array2D_double_delete(N, N, A);

	xor	esi, esi
	test	edi, edi
	jle	SHORT $LN48@kernel_mea
$LL50@kernel_mea:
	mov	edx, DWORD PTR _A$[esp+44]
	mov	eax, DWORD PTR [edx+esi*4]
	push	eax
	call	_free
	add	esi, 1
	add	esp, 4
	cmp	esi, edi
	jl	SHORT $LL50@kernel_mea
$LN48@kernel_mea:
	mov	ecx, DWORD PTR _A$[esp+44]
	push	ecx
	call	_free

; 227  : 
; 228  :         return result;

	fld	QWORD PTR _result$[esp+48]
	add	esp, 4

; 229  : 
; 230  :     }

	pop	edi
	pop	esi
	pop	ebp
	pop	ebx
	add	esp, 28					; 0000001cH
	ret	0
$LN73@kernel_mea:
_kernel_measureLU ENDP
_TEXT	ENDS
PUBLIC	_kernel_measureSparseMatMult
; Function compile flags: /Ogtpy
_TEXT	SEGMENT
_cycles$ = -36						; size = 4
_row$ = -32						; size = 4
_col$ = -28						; size = 4
_rowr$4176 = -24					; size = 4
tv432 = -20						; size = 4
tv429 = -20						; size = 4
_actual_nz$5445 = -20					; size = 4
_r$ = -20						; size = 4
_val$ = -16						; size = 4
_y$ = -12						; size = 4
_x$ = -8						; size = 4
tv420 = 8						; size = 4
_result$ = 8						; size = 8
_min_time$ = 8						; size = 8
_kernel_measureSparseMatMult PROC
; _N$ = ebx
; _nz$ = ecx
; _R$ = eax

; 101  :     {

	sub	esp, 40					; 00000028H
	push	ebp
	push	esi
	push	edi
	mov	esi, eax

; 102  :         /* initialize vector multipliers and storage for result */
; 103  :         /* y = A*y;  */
; 104  : 
; 105  :         double *x = RandomVector(N, R);

	push	ebx
	mov	edi, ecx
	call	_RandomVector
	mov	DWORD PTR _x$[esp+56], eax

; 106  :         double *y = (double*) malloc(sizeof(double)*N);

	lea	eax, DWORD PTR [ebx*8]
	add	esp, 4
	push	eax
	call	_malloc
	mov	DWORD PTR _y$[esp+56], eax

; 107  : 
; 108  :         double result = 0.0;
; 109  : 
; 110  : #if 0
; 111  :         // initialize square sparse matrix
; 112  :         //
; 113  :         // for this test, we create a sparse matrix with M/nz nonzeros
; 114  :         // per row, with spaced-out evenly between the begining of the
; 115  :         // row to the main diagonal.  Thus, the resulting pattern looks
; 116  :         // like
; 117  :         //             +-----------------+
; 118  :         //             +*                +
; 119  :         //             +***              +
; 120  :         //             +* * *            +
; 121  :         //             +** *  *          +
; 122  :         //             +**  *   *        +
; 123  :         //             +* *   *   *      +
; 124  :         //             +*  *   *    *    +
; 125  :         //             +*   *    *    *  + 
; 126  :         //             +-----------------+
; 127  :         //
; 128  :         // (as best reproducible with integer artihmetic)
; 129  :         // Note that the first nr rows will have elements past
; 130  :         // the diagonal.
; 131  : #endif
; 132  : 
; 133  :         int nr = nz/N;      /* average number of nonzeros per row  */

	mov	eax, edi
	cdq
	idiv	ebx
	add	esp, 4
	mov	ebp, eax

; 134  :         int anz = nr *N;    /* _actual_ number of nonzeros         */

	mov	ecx, eax
	imul	ecx, ebx

; 135  : 
; 136  :             
; 137  :         double *val = RandomVector(anz, R);

	push	ecx
	call	_RandomVector

; 138  :         int *col = (int*) malloc(sizeof(int)*nz);

	lea	edx, DWORD PTR [edi*4]
	add	esp, 4
	push	edx
	mov	DWORD PTR _val$[esp+56], eax
	call	_malloc
	mov	DWORD PTR _col$[esp+56], eax

; 139  :         int *row = (int*) malloc(sizeof(int)*(N+1));

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

; 140  :         int r=0;
; 141  :         int cycles=1;
; 142  : 
; 143  :         Stopwatch Q = new_Stopwatch();

	push	24					; 00000018H
	mov	DWORD PTR _row$[esp+56], edi
	mov	DWORD PTR _cycles$[esp+56], 1
	call	_malloc
	fldz
	add	esp, 4
	test	eax, eax
	jne	SHORT $LN13@kernel_mea@2
	xor	esi, esi
	jmp	SHORT $LN14@kernel_mea@2
$LN13@kernel_mea@2:
	fst	QWORD PTR [eax+8]
	mov	DWORD PTR [eax], 0
	fst	QWORD PTR [eax+16]
	mov	esi, eax
$LN14@kernel_mea@2:

; 144  : 
; 145  :         row[0] = 0; 
; 146  :         for (r=0; r<N; r++)

	xor	ecx, ecx
	test	ebx, ebx
	mov	DWORD PTR [edi], 0
	mov	DWORD PTR _r$[esp+52], ecx
	jle	SHORT $LN3@kernel_mea@2
$LN10@kernel_mea@2:

; 147  :         {
; 148  :             /* initialize elements for row r */
; 149  : 
; 150  :             int rowr = row[r];

	mov	edx, DWORD PTR [edi+ecx*4]
	mov	DWORD PTR _rowr$4176[esp+52], edx

; 151  :             int step = r/ nr;

	mov	eax, ecx
	cdq
	idiv	ebp

; 152  :             int i=0;
; 153  : 
; 154  :             row[r+1] = rowr + nr;

	mov	edx, DWORD PTR _rowr$4176[esp+52]
	add	edx, ebp
	mov	DWORD PTR [edi+ecx*4+4], edx

; 155  :             if (step < 1) step = 1;   /* take at least unit steps */

	cmp	eax, 1
	jge	SHORT $LN7@kernel_mea@2
	mov	eax, 1
$LN7@kernel_mea@2:

; 156  : 
; 157  : 
; 158  :             for (i=0; i<nr; i++)

	test	ebp, ebp
	jle	SHORT $LN9@kernel_mea@2
	mov	edi, DWORD PTR _rowr$4176[esp+52]
	mov	ecx, DWORD PTR _col$[esp+52]
	lea	ecx, DWORD PTR [ecx+edi*4]
	xor	edx, edx
	mov	edi, ebp
$LN6@kernel_mea@2:

; 159  :                 col[rowr+i] = i*step;

	mov	DWORD PTR [ecx], edx
	add	ecx, 4
	add	edx, eax
	sub	edi, 1
	jne	SHORT $LN6@kernel_mea@2
	mov	ecx, DWORD PTR _r$[esp+52]
	mov	edi, DWORD PTR _row$[esp+52]
$LN9@kernel_mea@2:
	add	ecx, 1
	cmp	ecx, ebx
	mov	DWORD PTR _r$[esp+52], ecx
	jl	SHORT $LN10@kernel_mea@2
$LN3@kernel_mea@2:

; 160  :                 
; 161  :         }
; 162  : 
; 163  : 
; 164  :         while(1)
; 165  :         {
; 166  :             Stopwatch_start(Q);

	cmp	DWORD PTR [esi], 0
	jne	SHORT $LN67@kernel_mea@2
	fstp	QWORD PTR [esi+16]
	mov	DWORD PTR [esi], 1
	call	_clock
	mov	DWORD PTR tv432[esp+52], eax
	fild	DWORD PTR tv432[esp+52]
	fdiv	QWORD PTR __real@408f400000000000
	fstp	QWORD PTR [esi+8]
	jmp	SHORT $LN18@kernel_mea@2
$LN67@kernel_mea@2:
	fstp	ST(0)
$LN18@kernel_mea@2:

; 167  :             SparseCompRow_matmult(N, y, val, row, col, x, cycles);

	mov	edx, DWORD PTR _col$[esp+52]
	mov	eax, DWORD PTR _val$[esp+52]
	mov	ecx, DWORD PTR _y$[esp+52]
	push	edx
	push	edi
	mov	edi, DWORD PTR _x$[esp+60]
	push	eax
	mov	eax, DWORD PTR _cycles$[esp+64]
	push	ecx
	push	ebx
	call	_SparseCompRow_matmult
	add	esp, 20					; 00000014H

; 168  :             Stopwatch_stop(Q);

	cmp	DWORD PTR [esi], 0
	je	SHORT $LN28@kernel_mea@2
	call	_clock
	mov	DWORD PTR tv429[esp+52], eax
	fild	DWORD PTR tv429[esp+52]
	mov	DWORD PTR [esi], 0
	fdiv	QWORD PTR __real@408f400000000000
	fsub	QWORD PTR [esi+8]
	fadd	QWORD PTR [esi+16]
	fstp	QWORD PTR [esi+16]

; 169  :             if (Stopwatch_read(Q) >= min_time) break;

$LN28@kernel_mea@2:
	fld	QWORD PTR _min_time$[esp+48]
	fcomp	QWORD PTR [esi+16]
	fnstsw	ax
	test	ah, 65					; 00000041H
	jnp	SHORT $LN47@kernel_mea@2

; 170  : 
; 171  :             cycles *= 2;

	mov	edx, DWORD PTR _cycles$[esp+52]

; 172  :         }

	fldz
	mov	edi, DWORD PTR _row$[esp+52]
	lea	eax, DWORD PTR [edx+edx]
	mov	DWORD PTR _cycles$[esp+52], eax
	jmp	$LN3@kernel_mea@2
$LN47@kernel_mea@2:

; 173  :         /* approx Mflops */
; 174  :         result = SparseCompRow_num_flops(N, nz, cycles) / 
; 175  :                         Stopwatch_read(Q) * 1.0e-6;

	imul	ebp, ebx
	cmp	DWORD PTR [esi], 0
	mov	DWORD PTR _actual_nz$5445[esp+52], ebp
	je	SHORT $LN35@kernel_mea@2
	call	_clock
	mov	DWORD PTR tv420[esp+48], eax
	fild	DWORD PTR tv420[esp+48]
	fdiv	QWORD PTR __real@408f400000000000
	fld	ST(0)
	fsub	QWORD PTR [esi+8]
	fadd	QWORD PTR [esi+16]
	fstp	QWORD PTR [esi+16]
	fstp	QWORD PTR [esi+8]
$LN35@kernel_mea@2:
	fild	DWORD PTR _actual_nz$5445[esp+52]

; 176  : 
; 177  :         Stopwatch_delete(Q);

	push	esi
	fadd	ST(0), ST(0)
	fimul	DWORD PTR _cycles$[esp+56]
	fdiv	QWORD PTR [esi+16]
	fmul	QWORD PTR __real@3eb0c6f7a0b5ed8d
	fstp	QWORD PTR _result$[esp+52]
	call	_free

; 178  :         free(row);

	mov	ecx, DWORD PTR _row$[esp+56]
	add	esp, 4
	push	ecx
	call	_free

; 179  :         free(col);

	mov	edx, DWORD PTR _col$[esp+56]
	add	esp, 4
	push	edx
	call	_free

; 180  :         free(val);

	mov	eax, DWORD PTR _val$[esp+56]
	add	esp, 4
	push	eax
	call	_free

; 181  :         free(y);

	mov	ecx, DWORD PTR _y$[esp+56]
	add	esp, 4
	push	ecx
	call	_free

; 182  :         free(x);

	mov	edx, edi
	add	esp, 4
	push	edx
	call	_free

; 183  : 
; 184  :         return result;

	fld	QWORD PTR _result$[esp+52]
	add	esp, 4

; 185  :     }

	pop	edi
	pop	esi
	pop	ebp
	add	esp, 40					; 00000028H
	ret	0
_kernel_measureSparseMatMult ENDP
_TEXT	ENDS
PUBLIC	_kernel_measureMonteCarlo
; Function compile flags: /Ogtpy
_TEXT	SEGMENT
tv252 = -8						; size = 4
tv249 = -8						; size = 4
_cycles$ = -8						; size = 4
tv241 = 8						; size = 4
_result$ = 8						; size = 8
_min_time$ = 8						; size = 8
_kernel_measureMonteCarlo PROC

; 78   :     {

	sub	esp, 12					; 0000000cH
	push	esi
	push	edi

; 79   :         double result = 0.0;
; 80   :         Stopwatch Q = new_Stopwatch();

	push	24					; 00000018H
	call	_malloc
	fldz
	add	esp, 4
	test	eax, eax
	jne	SHORT $LN6@kernel_mea@3
	xor	esi, esi
	jmp	SHORT $LN7@kernel_mea@3
$LN6@kernel_mea@3:
	fst	QWORD PTR [eax+8]
	mov	DWORD PTR [eax], 0
	fst	QWORD PTR [eax+16]
	mov	esi, eax
$LN7@kernel_mea@3:

; 81   : 
; 82   :         int cycles=1;

	mov	edi, 1
$LN3@kernel_mea@3:

; 83   :         while(1)
; 84   :         {
; 85   :             Stopwatch_start(Q);

	cmp	DWORD PTR [esi], 0
	jne	SHORT $LN45@kernel_mea@3
	fstp	QWORD PTR [esi+16]
	mov	DWORD PTR [esi], 1
	call	_clock
	mov	DWORD PTR tv252[esp+20], eax
	fild	DWORD PTR tv252[esp+20]
	fdiv	QWORD PTR __real@408f400000000000
	fstp	QWORD PTR [esi+8]
	jmp	SHORT $LN11@kernel_mea@3
$LN45@kernel_mea@3:
	fstp	ST(0)
$LN11@kernel_mea@3:

; 86   :             MonteCarlo_integrate(cycles);

	push	edi
	call	_MonteCarlo_integrate
	fstp	ST(0)
	add	esp, 4

; 87   :             Stopwatch_stop(Q);

	cmp	DWORD PTR [esi], 0
	je	SHORT $LN21@kernel_mea@3
	call	_clock
	mov	DWORD PTR tv249[esp+20], eax
	fild	DWORD PTR tv249[esp+20]
	mov	DWORD PTR [esi], 0
	fdiv	QWORD PTR __real@408f400000000000
	fsub	QWORD PTR [esi+8]
	fadd	QWORD PTR [esi+16]
	fstp	QWORD PTR [esi+16]

; 88   :             if (Stopwatch_read(Q) >= min_time) break;

$LN21@kernel_mea@3:
	fld	QWORD PTR _min_time$[esp+16]
	fcomp	QWORD PTR [esi+16]
	fnstsw	ax
	test	ah, 65					; 00000041H
	jnp	SHORT $LN38@kernel_mea@3

; 89   : 
; 90   :             cycles *= 2;
; 91   :         }

	fldz
	add	edi, edi
	jmp	SHORT $LN3@kernel_mea@3
$LN38@kernel_mea@3:

; 92   :         /* approx Mflops */
; 93   :         result = MonteCarlo_num_flops(cycles) / Stopwatch_read(Q) * 1.0e-6;

	cmp	DWORD PTR [esi], 0
	mov	DWORD PTR _cycles$[esp+20], edi
	je	SHORT $LN28@kernel_mea@3
	call	_clock
	mov	DWORD PTR tv241[esp+16], eax
	fild	DWORD PTR tv241[esp+16]
	fdiv	QWORD PTR __real@408f400000000000
	fld	ST(0)
	fsub	QWORD PTR [esi+8]
	fadd	QWORD PTR [esi+16]
	fstp	QWORD PTR [esi+16]
	fstp	QWORD PTR [esi+8]
$LN28@kernel_mea@3:
	fild	DWORD PTR _cycles$[esp+20]

; 94   :         Stopwatch_delete(Q);

	push	esi
	fmul	QWORD PTR __real@4010000000000000
	fdiv	QWORD PTR [esi+16]
	fmul	QWORD PTR __real@3eb0c6f7a0b5ed8d
	fstp	QWORD PTR _result$[esp+20]
	call	_free

; 95   :         return result;

	fld	QWORD PTR _result$[esp+20]
	add	esp, 4

; 96   :     }

	pop	edi
	pop	esi
	add	esp, 12					; 0000000cH
	ret	0
_kernel_measureMonteCarlo ENDP
_TEXT	ENDS
PUBLIC	__real@3ff4000000000000
PUBLIC	_kernel_measureSOR
;	COMDAT __real@3ff4000000000000
; File c:\documents and settings\tobi\my documents\visual studio 2005\projects\scimark2-amd\source\array.c
CONST	SEGMENT
__real@3ff4000000000000 DQ 03ff4000000000000r	; 1.25
; Function compile flags: /Ogtpy
; File c:\documents and settings\tobi\my documents\visual studio 2005\projects\scimark2-amd\source\kernel.c
CONST	ENDS
_TEXT	SEGMENT
tv318 = -16						; size = 4
tv313 = -16						; size = 4
_num_iterD$5603 = -16					; size = 8
_cycles$ = -16						; size = 4
_Md$5601 = -8						; size = 8
tv301 = 8						; size = 4
_N$ = 8							; size = 4
_Nd$5602 = 12						; size = 8
_result$ = 12						; size = 8
_min_time$ = 12						; size = 8
_kernel_measureSOR PROC
; _R$ = eax

; 50   :     {

	sub	esp, 16					; 00000010H
	push	ebx
	push	ebp
	push	esi
	push	edi
	mov	edi, DWORD PTR _N$[esp+28]

; 51   :         double **G = RandomMatrix(N, N, R);

	push	edi
	push	edi
	mov	esi, eax
	call	_RandomMatrix

; 52   :         double result = 0.0;
; 53   : 
; 54   :         Stopwatch Q = new_Stopwatch();

	push	24					; 00000018H
	mov	ebx, eax
	call	_malloc
	fldz
	add	esp, 12					; 0000000cH
	test	eax, eax
	jne	SHORT $LN6@kernel_mea@4
	xor	esi, esi
	jmp	SHORT $LN7@kernel_mea@4
$LN6@kernel_mea@4:
	fst	QWORD PTR [eax+8]
	mov	DWORD PTR [eax], 0
	fst	QWORD PTR [eax+16]
	mov	esi, eax
$LN7@kernel_mea@4:

; 55   :         int cycles=1;

	mov	ebp, 1
$LN3@kernel_mea@4:

; 56   :         while(1)
; 57   :         {
; 58   :             Stopwatch_start(Q);

	cmp	DWORD PTR [esi], 0
	jne	SHORT $LN54@kernel_mea@4
	fstp	QWORD PTR [esi+16]
	mov	DWORD PTR [esi], 1
	call	_clock
	mov	DWORD PTR tv318[esp+32], eax
	fild	DWORD PTR tv318[esp+32]
	fdiv	QWORD PTR __real@408f400000000000
	fstp	QWORD PTR [esi+8]
	jmp	SHORT $LN11@kernel_mea@4
$LN54@kernel_mea@4:
	fstp	ST(0)
$LN11@kernel_mea@4:

; 59   :             SOR_execute(N, N, 1.25, G, cycles);

	fld	QWORD PTR __real@3ff4000000000000
	sub	esp, 8
	fstp	QWORD PTR [esp]
	push	ebx
	mov	eax, ebp
	mov	edx, edi
	mov	ecx, edi
	call	_SOR_execute
	add	esp, 12					; 0000000cH

; 60   :             Stopwatch_stop(Q);

	cmp	DWORD PTR [esi], 0
	je	SHORT $LN21@kernel_mea@4
	call	_clock
	mov	DWORD PTR tv313[esp+32], eax
	fild	DWORD PTR tv313[esp+32]
	mov	DWORD PTR [esi], 0
	fdiv	QWORD PTR __real@408f400000000000
	fsub	QWORD PTR [esi+8]
	fadd	QWORD PTR [esi+16]
	fstp	QWORD PTR [esi+16]

; 61   : 
; 62   :             if (Stopwatch_read(Q) >= min_time) break;

$LN21@kernel_mea@4:
	fld	QWORD PTR _min_time$[esp+28]
	fcomp	QWORD PTR [esi+16]
	fnstsw	ax
	test	ah, 65					; 00000041H
	jnp	SHORT $LN45@kernel_mea@4

; 63   : 
; 64   :             cycles *= 2;
; 65   :         }

	fldz
	add	ebp, ebp
	jmp	SHORT $LN3@kernel_mea@4
$LN45@kernel_mea@4:

; 66   :         /* approx Mflops */
; 67   : 
; 68   :         result = SOR_num_flops(N, N, cycles) / Stopwatch_read(Q) * 1.0e-6;

	cmp	DWORD PTR [esi], 0
	fild	DWORD PTR _N$[esp+28]
	mov	DWORD PTR _cycles$[esp+32], ebp
	fst	QWORD PTR _Md$5601[esp+32]
	fstp	QWORD PTR _Nd$5602[esp+28]
	fild	DWORD PTR _cycles$[esp+32]
	fstp	QWORD PTR _num_iterD$5603[esp+32]
	je	SHORT $LN28@kernel_mea@4
	call	_clock
	mov	DWORD PTR tv301[esp+28], eax
	fild	DWORD PTR tv301[esp+28]
	fdiv	QWORD PTR __real@408f400000000000
	fld	ST(0)
	fsub	QWORD PTR [esi+8]
	fadd	QWORD PTR [esi+16]
	fstp	QWORD PTR [esi+16]
	fstp	QWORD PTR [esi+8]
$LN28@kernel_mea@4:
	fld	QWORD PTR _Nd$5602[esp+28]

; 69   :         Stopwatch_delete(Q);

	push	esi
	fld1
	fsub	ST(1), ST(0)
	fsubr	QWORD PTR _Md$5601[esp+36]
	fmulp	ST(1), ST(0)
	fmul	QWORD PTR _num_iterD$5603[esp+36]
	fmul	QWORD PTR __real@4018000000000000
	fdiv	QWORD PTR [esi+16]
	fmul	QWORD PTR __real@3eb0c6f7a0b5ed8d
	fstp	QWORD PTR _result$[esp+32]
	call	_free
	add	esp, 4

; 70   :         Array2D_double_delete(N, N, G);

	test	ebx, ebx
	je	SHORT $LN47@kernel_mea@4
	xor	esi, esi
	test	edi, edi
	jle	SHORT $LN36@kernel_mea@4
$LL38@kernel_mea@4:
	mov	eax, DWORD PTR [ebx+esi*4]
	push	eax
	call	_free
	add	esi, 1
	add	esp, 4
	cmp	esi, edi
	jl	SHORT $LL38@kernel_mea@4
$LN36@kernel_mea@4:
	push	ebx
	call	_free
	add	esp, 4
$LN47@kernel_mea@4:

; 71   :         return result;

	fld	QWORD PTR _result$[esp+28]

; 72   : 
; 73   :     }

	pop	edi
	pop	esi
	pop	ebp
	pop	ebx
	add	esp, 16					; 00000010H
	ret	0
_kernel_measureSOR ENDP
PUBLIC	_kernel_measureFFT
; Function compile flags: /Ogtpy
_TEXT	SEGMENT
_cycles$ = -8						; size = 4
tv319 = -4						; size = 4
tv316 = -4						; size = 4
tv186 = -4						; size = 4
tv300 = 8						; size = 4
_N$ = 8							; size = 4
_log$5761 = 12						; size = 4
$T5769 = 12						; size = 8
_result$ = 12						; size = 8
_mintime$ = 12						; size = 8
_kernel_measureFFT PROC
; _R$ = eax

; 16   :     {

	sub	esp, 8
	push	ebx

; 17   :         /* initialize FFT data as complex (N real/img pairs) */
; 18   : 
; 19   :         int twoN = 2*N;

	mov	ebx, DWORD PTR _N$[esp+8]
	push	ebp
	push	esi
	push	edi
	add	ebx, ebx

; 20   :         double *x = RandomVector(twoN, R);

	push	ebx
	mov	esi, eax
	call	_RandomVector
	add	esp, 4

; 21   :         long cycles = 1;

	mov	esi, 1

; 22   :         Stopwatch Q = new_Stopwatch();

	push	24					; 00000018H
	mov	edi, eax
	mov	DWORD PTR _cycles$[esp+28], esi
	call	_malloc
	fldz
	add	esp, 4
	test	eax, eax
	jne	SHORT $LN9@kernel_mea@5
	xor	ebp, ebp
	jmp	SHORT $LN6@kernel_mea@5
$LN9@kernel_mea@5:
	fst	QWORD PTR [eax+8]
	mov	DWORD PTR [eax], 0
	fst	QWORD PTR [eax+16]
	mov	ebp, eax
$LN6@kernel_mea@5:

; 23   :         int i=0;
; 24   :         double result = 0.0;
; 25   : 
; 26   :         while(1)
; 27   :         {
; 28   :             Stopwatch_start(Q);

	cmp	DWORD PTR [ebp], 0
	jne	SHORT $LN70@kernel_mea@5
	fstp	QWORD PTR [ebp+16]
	mov	DWORD PTR [ebp], 1
	call	_clock
	mov	DWORD PTR tv319[esp+24], eax
	fild	DWORD PTR tv319[esp+24]
	fdiv	QWORD PTR __real@408f400000000000
	fstp	QWORD PTR [ebp+8]
	jmp	SHORT $LN14@kernel_mea@5
$LN70@kernel_mea@5:
	fstp	ST(0)
$LN14@kernel_mea@5:

; 29   :             for (i=0; i<cycles; i++)

	test	esi, esi
	jle	SHORT $LN2@kernel_mea@5
	mov	DWORD PTR tv186[esp+24], esi
$LL4@kernel_mea@5:

; 30   :             {
; 31   :                 FFT_transform(twoN, x);     /* forward transform */

	push	-1
	push	edi
	push	ebx
	call	_FFT_transform_internal
	add	esp, 12					; 0000000cH

; 32   :                 FFT_inverse(twoN, x);       /* backward transform */

	mov	esi, ebx
	call	_FFT_inverse
	sub	DWORD PTR tv186[esp+24], 1
	jne	SHORT $LL4@kernel_mea@5

; 29   :             for (i=0; i<cycles; i++)

	mov	esi, DWORD PTR _cycles$[esp+24]
$LN2@kernel_mea@5:

; 33   :             }
; 34   :             Stopwatch_stop(Q);

	cmp	DWORD PTR [ebp], 0
	je	SHORT $LN26@kernel_mea@5
	call	_clock
	mov	DWORD PTR tv316[esp+24], eax
	fild	DWORD PTR tv316[esp+24]
	mov	DWORD PTR [ebp], 0
	fdiv	QWORD PTR __real@408f400000000000
	fsub	QWORD PTR [ebp+8]
	fadd	QWORD PTR [ebp+16]
	fstp	QWORD PTR [ebp+16]

; 35   :             if (Stopwatch_read(Q) >= mintime)

$LN26@kernel_mea@5:
	fld	QWORD PTR _mintime$[esp+20]
	fcomp	QWORD PTR [ebp+16]
	fnstsw	ax
	test	ah, 65					; 00000041H
	jnp	SHORT $LN53@kernel_mea@5

; 36   :                 break;
; 37   : 
; 38   :             cycles *= 2;
; 39   : 
; 40   :         }

	fldz
	lea	eax, DWORD PTR [esi+esi]
	mov	DWORD PTR _cycles$[esp+24], eax
	mov	esi, eax
	jmp	$LN6@kernel_mea@5
$LN53@kernel_mea@5:

; 41   :         /* approx Mflops */
; 42   : 
; 43   :         result = FFT_num_flops(N)*cycles/ Stopwatch_read(Q) * 1.0e-6;

	mov	edx, DWORD PTR _N$[esp+20]
	fild	DWORD PTR _N$[esp+20]
	mov	eax, 1
	xor	ecx, ecx
	cmp	edx, eax
	mov	DWORD PTR _log$5761[esp+20], ecx
	jle	SHORT $LN34@kernel_mea@5
$LN36@kernel_mea@5:
	add	eax, eax
	add	ecx, 1
	cmp	eax, edx
	jl	SHORT $LN36@kernel_mea@5
	mov	DWORD PTR _log$5761[esp+20], ecx
$LN34@kernel_mea@5:
	mov	eax, 1
	shl	eax, cl
	cmp	edx, eax
	je	SHORT $LN33@kernel_mea@5
	push	edx
	fstp	ST(0)
	push	OFFSET $SG-13
	call	_printf
	add	esp, 8
	push	1
	call	_exit
$LN33@kernel_mea@5:
	cmp	DWORD PTR [ebp], 0
	fld	QWORD PTR __real@4014000000000000
	fmul	ST(0), ST(1)
	fld	QWORD PTR _RESOLUTION_DEFAULT
	fsub	ST(1), ST(0)
	fild	DWORD PTR _log$5761[esp+20]
	fmulp	ST(2), ST(0)
	fxch	ST(2)
	fadd	QWORD PTR __real@3ff0000000000000
	fmulp	ST(2), ST(0)
	faddp	ST(1), ST(0)
	fstp	QWORD PTR $T5769[esp+20]
	je	SHORT $LN41@kernel_mea@5
	call	_clock
	mov	DWORD PTR tv300[esp+20], eax
	fild	DWORD PTR tv300[esp+20]
	fdiv	QWORD PTR __real@408f400000000000
	fld	ST(0)
	fsub	QWORD PTR [ebp+8]
	fadd	QWORD PTR [ebp+16]
	fstp	QWORD PTR [ebp+16]
	fstp	QWORD PTR [ebp+8]
$LN41@kernel_mea@5:
	fild	DWORD PTR _cycles$[esp+24]

; 44   :         Stopwatch_delete(Q);

	push	ebp
	fmul	QWORD PTR $T5769[esp+24]
	fdiv	QWORD PTR [ebp+16]
	fmul	QWORD PTR __real@3eb0c6f7a0b5ed8d
	fstp	QWORD PTR _result$[esp+24]
	call	_free
	add	esp, 4

; 45   :         free(x);

	push	edi
	call	_free

; 46   :         return result;

	fld	QWORD PTR _result$[esp+24]
	add	esp, 4

; 47   :     }

	pop	edi
	pop	esi
	pop	ebp
	pop	ebx
	add	esp, 8
	ret	0
$LN79@kernel_mea@5:
_kernel_measureFFT ENDP
END
