; 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
_Nd$5022 = -16						; size = 8
_cycles$ = -16						; size = 4
_result$ = -16						; size = 8
_A$ = -8						; size = 4
_pivot$ = -4						; size = 4
_R$ = 8							; size = 4
_min_time$ = 12						; size = 8
_kernel_measureLU PROC
; _N$ = edi

; 189  :     {

	sub	esp, 20					; 00000014H
	push	ebx
	push	ebp
	push	esi

; 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
	xorps	xmm0, xmm0
	add	esp, 4
	test	eax, eax
	jne	SHORT $LN12@kernel_mea
	xor	ebx, ebx
	jmp	SHORT $LN13@kernel_mea
$LN12@kernel_mea:
	mov	DWORD PTR [eax], 0
	movsd	QWORD PTR [eax+8], xmm0
	movsd	QWORD PTR [eax+16], xmm0
	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+28]
	push	edi
	mov	ebp, 1
	push	edi
	mov	DWORD PTR _cycles$[esp+40], ebp
	call	_RandomMatrix
	add	esp, 8
	test	eax, eax
	mov	DWORD PTR _A$[esp+32], 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+32], eax
	jne	SHORT $LL6@kernel_mea
	push	1
	call	_exit
$LL6@kernel_mea:

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

	cmp	DWORD PTR [ebx], 0
	jne	SHORT $LN17@kernel_mea
	xorps	xmm0, xmm0
	mov	DWORD PTR [ebx], 1
	movsd	QWORD PTR [ebx+16], xmm0
	call	_clock
	cvtsi2sd xmm0, eax
	divsd	xmm0, QWORD PTR __real@408f400000000000
	movsd	QWORD PTR [ebx+8], xmm0
$LN17@kernel_mea:

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

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

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

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

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

	mov	ecx, DWORD PTR _pivot$[esp+40]
	push	ecx
	push	esi
	push	edi
	push	edi
	call	_LU_factor
	add	esp, 24					; 00000018H
	sub	ebp, 1
	jne	SHORT $LL4@kernel_mea

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

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

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

	cmp	DWORD PTR [ebx], 0
	je	SHORT $LN27@kernel_mea
	call	_clock
	cvtsi2sd xmm0, eax
	divsd	xmm0, QWORD PTR __real@408f400000000000
	subsd	xmm0, QWORD PTR [ebx+8]
	addsd	xmm0, QWORD PTR [ebx+16]
	movsd	QWORD PTR [ebx+16], xmm0
	mov	DWORD PTR [ebx], 0

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

$LN27@kernel_mea:
	movsd	xmm0, QWORD PTR [ebx+16]
	comisd	xmm0, QWORD PTR _min_time$[esp+28]
	jae	SHORT $LN59@kernel_mea

; 217  : 
; 218  :             cycles *= 2;

	lea	edx, DWORD PTR [ebp+ebp]
	mov	DWORD PTR _cycles$[esp+32], 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
	cvtsi2sd xmm1, edi
	movsd	QWORD PTR _Nd$5022[esp+32], xmm1
	je	SHORT $LN34@kernel_mea
	call	_clock
	cvtsi2sd xmm0, eax
	divsd	xmm0, QWORD PTR __real@408f400000000000
	movapd	xmm1, xmm0
	subsd	xmm1, QWORD PTR [ebx+8]
	addsd	xmm1, QWORD PTR [ebx+16]
	movsd	QWORD PTR [ebx+16], xmm1
	movsd	xmm1, QWORD PTR _Nd$5022[esp+32]
	movsd	QWORD PTR [ebx+8], xmm0
$LN34@kernel_mea:
	movapd	xmm0, xmm1
	mulsd	xmm0, QWORD PTR _RESOLUTION_DEFAULT
	mulsd	xmm0, xmm1
	mulsd	xmm0, xmm1
	divsd	xmm0, QWORD PTR __real@4008000000000000
	cvtsi2sd xmm1, ebp
	mulsd	xmm0, xmm1
	divsd	xmm0, QWORD PTR [ebx+16]
	mulsd	xmm0, QWORD PTR __real@3eb0c6f7a0b5ed8d

; 222  : 
; 223  :         Stopwatch_delete(Q);

	push	ebx
	movsd	QWORD PTR _result$[esp+36], xmm0
	call	_free

; 224  :         free(pivot); 

	mov	eax, DWORD PTR _pivot$[esp+36]
	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
$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+32]
	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+32]
	push	ecx
	call	_free

; 227  : 
; 228  :         return result;

	movsd	xmm0, QWORD PTR _result$[esp+36]
	add	esp, 4

; 229  : 
; 230  :     }

	pop	esi
	pop	ebp
	pop	ebx
	add	esp, 20					; 00000014H
	ret	0
$LN67@kernel_mea:
_kernel_measureLU ENDP
_TEXT	ENDS
PUBLIC	_kernel_measureSparseMatMult
; Function compile flags: /Ogtpy
_TEXT	SEGMENT
_row$ = -28						; size = 4
_col$ = -24						; size = 4
_rowr$4176 = -20					; size = 4
_r$ = -16						; size = 4
_val$ = -12						; size = 4
_y$ = -8						; size = 4
_x$ = -4						; size = 4
_cycles$ = 8						; size = 4
_N$ = 8							; size = 4
_result$ = 12						; size = 8
_min_time$ = 12						; size = 8
_kernel_measureSparseMatMult PROC
; _nz$ = ecx
; _R$ = eax

; 101  :     {

	sub	esp, 32					; 00000020H
	push	ebx
	mov	ebx, DWORD PTR _N$[esp+32]
	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+52], 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+52], 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+52], eax
	call	_malloc
	mov	DWORD PTR _col$[esp+52], 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+52], edi
	mov	DWORD PTR _cycles$[esp+48], 1
	call	_malloc
	xorps	xmm0, xmm0
	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:
	mov	DWORD PTR [eax], 0
	movsd	QWORD PTR [eax+8], xmm0
	movsd	QWORD PTR [eax+16], xmm0
	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+48], ecx
	jle	SHORT $LL3@kernel_mea@2
$LL10@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+48], 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+48]
	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+48]
	mov	ecx, DWORD PTR _col$[esp+48]
	lea	ecx, DWORD PTR [ecx+edi*4]
	xor	edx, edx
	mov	edi, ebp
$LL6@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 $LL6@kernel_mea@2
	mov	ecx, DWORD PTR _r$[esp+48]
	mov	edi, DWORD PTR _row$[esp+48]
$LN9@kernel_mea@2:
	add	ecx, 1
	cmp	ecx, ebx
	mov	DWORD PTR _r$[esp+48], ecx
	jl	SHORT $LL10@kernel_mea@2
$LL3@kernel_mea@2:

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

	cmp	DWORD PTR [esi], 0
	jne	SHORT $LN18@kernel_mea@2
	mov	DWORD PTR [esi], 1
	movsd	QWORD PTR [esi+16], xmm0
	call	_clock
	cvtsi2sd xmm0, eax
	divsd	xmm0, QWORD PTR __real@408f400000000000
	movsd	QWORD PTR [esi+8], xmm0
$LN18@kernel_mea@2:

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

	mov	edx, DWORD PTR _col$[esp+48]
	mov	eax, DWORD PTR _val$[esp+48]
	mov	ecx, DWORD PTR _y$[esp+48]
	push	edx
	push	edi
	mov	edi, DWORD PTR _x$[esp+56]
	push	eax
	mov	eax, DWORD PTR _cycles$[esp+56]
	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
	cvtsi2sd xmm0, eax
	divsd	xmm0, QWORD PTR __real@408f400000000000
	subsd	xmm0, QWORD PTR [esi+8]
	addsd	xmm0, QWORD PTR [esi+16]
	movsd	QWORD PTR [esi+16], xmm0
	mov	DWORD PTR [esi], 0

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

$LN28@kernel_mea@2:
	movsd	xmm0, QWORD PTR [esi+16]
	comisd	xmm0, QWORD PTR _min_time$[esp+44]
	jae	SHORT $LN47@kernel_mea@2

; 170  : 
; 171  :             cycles *= 2;

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

; 172  :         }

	xorps	xmm0, xmm0
	mov	edi, DWORD PTR _row$[esp+48]
	lea	eax, DWORD PTR [edx+edx]
	mov	DWORD PTR _cycles$[esp+44], eax
	jmp	$LL3@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
	je	SHORT $LN35@kernel_mea@2
	call	_clock
	cvtsi2sd xmm0, eax
	divsd	xmm0, QWORD PTR __real@408f400000000000
	movapd	xmm1, xmm0
	subsd	xmm1, QWORD PTR [esi+8]
	addsd	xmm1, QWORD PTR [esi+16]
	movsd	QWORD PTR [esi+16], xmm1
	movsd	QWORD PTR [esi+8], xmm0
$LN35@kernel_mea@2:
	cvtsi2sd xmm1, DWORD PTR _cycles$[esp+44]
	cvtsi2sd xmm0, ebp
	mulsd	xmm0, QWORD PTR _RESOLUTION_DEFAULT
	mulsd	xmm0, xmm1
	divsd	xmm0, QWORD PTR [esi+16]
	mulsd	xmm0, QWORD PTR __real@3eb0c6f7a0b5ed8d

; 176  : 
; 177  :         Stopwatch_delete(Q);

	push	esi
	movsd	QWORD PTR _result$[esp+48], xmm0
	call	_free

; 178  :         free(row);

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

; 179  :         free(col);

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

; 180  :         free(val);

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

; 181  :         free(y);

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

; 182  :         free(x);

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

; 183  : 
; 184  :         return result;

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

; 185  :     }

	pop	edi
	pop	esi
	pop	ebp
	pop	ebx
	add	esp, 32					; 00000020H
	ret	0
_kernel_measureSparseMatMult ENDP
_TEXT	ENDS
PUBLIC	_kernel_measureMonteCarlo
; Function compile flags: /Ogtpy
_TEXT	SEGMENT
_result$ = 8						; size = 8
_min_time$ = 8						; size = 8
_kernel_measureMonteCarlo PROC

; 78   :     {

	push	ecx
	push	esi
	push	edi

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

	push	24					; 00000018H
	call	_malloc
	xorps	xmm0, xmm0
	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:
	mov	DWORD PTR [eax], 0
	movsd	QWORD PTR [eax+8], xmm0
	movsd	QWORD PTR [eax+16], xmm0
	mov	esi, eax
$LN7@kernel_mea@3:

; 81   : 
; 82   :         int cycles=1;

	mov	edi, 1
	npad	1
$LL3@kernel_mea@3:

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

	cmp	DWORD PTR [esi], 0
	jne	SHORT $LN11@kernel_mea@3
	mov	DWORD PTR [esi], 1
	movsd	QWORD PTR [esi+16], xmm0
	call	_clock
	cvtsi2sd xmm0, eax
	divsd	xmm0, QWORD PTR __real@408f400000000000
	movsd	QWORD PTR [esi+8], xmm0
$LN11@kernel_mea@3:

; 86   :             MonteCarlo_integrate(cycles);

	push	edi
	call	_MonteCarlo_integrate
	add	esp, 4

; 87   :             Stopwatch_stop(Q);

	cmp	DWORD PTR [esi], 0
	je	SHORT $LN21@kernel_mea@3
	call	_clock
	cvtsi2sd xmm0, eax
	divsd	xmm0, QWORD PTR __real@408f400000000000
	subsd	xmm0, QWORD PTR [esi+8]
	addsd	xmm0, QWORD PTR [esi+16]
	movsd	QWORD PTR [esi+16], xmm0
	mov	DWORD PTR [esi], 0

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

$LN21@kernel_mea@3:
	movsd	xmm0, QWORD PTR [esi+16]
	comisd	xmm0, QWORD PTR _min_time$[esp+8]
	jae	SHORT $LN38@kernel_mea@3

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

	xorps	xmm0, xmm0
	add	edi, edi
	jmp	SHORT $LL3@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
	je	SHORT $LN28@kernel_mea@3
	call	_clock
	cvtsi2sd xmm0, eax
	divsd	xmm0, QWORD PTR __real@408f400000000000
	movapd	xmm1, xmm0
	subsd	xmm1, QWORD PTR [esi+8]
	addsd	xmm1, QWORD PTR [esi+16]
	movsd	QWORD PTR [esi+16], xmm1
	movsd	QWORD PTR [esi+8], xmm0
$LN28@kernel_mea@3:
	cvtsi2sd xmm0, edi
	mulsd	xmm0, QWORD PTR __real@4010000000000000
	divsd	xmm0, QWORD PTR [esi+16]
	mulsd	xmm0, QWORD PTR __real@3eb0c6f7a0b5ed8d

; 94   :         Stopwatch_delete(Q);

	push	esi
	movsd	QWORD PTR _result$[esp+12], xmm0
	call	_free

; 95   :         return result;

	movsd	xmm0, QWORD PTR _result$[esp+12]
	add	esp, 4

; 96   :     }

	pop	edi
	pop	esi
	pop	ecx
	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
_Nd$5247 = -20						; size = 8
_num_iterD$5248 = -12					; size = 8
_Md$5246 = 8						; size = 8
_result$ = 8						; size = 8
_min_time$ = 8						; size = 8
_kernel_measureSOR PROC
; _N$ = edi
; _R$ = eax

; 50   :     {

	sub	esp, 24					; 00000018H
	push	ebx
	push	ebp
	push	esi

; 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	ebp, eax
	call	_malloc
	xorps	xmm0, xmm0
	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:
	mov	DWORD PTR [eax], 0
	movsd	QWORD PTR [eax+8], xmm0
	movsd	QWORD PTR [eax+16], xmm0
	mov	esi, eax
$LN7@kernel_mea@4:

; 55   :         int cycles=1;

	mov	ebx, 1
	npad	3
$LL3@kernel_mea@4:

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

	cmp	DWORD PTR [esi], 0
	jne	SHORT $LN11@kernel_mea@4
	mov	DWORD PTR [esi], 1
	movsd	QWORD PTR [esi+16], xmm0
	call	_clock
	cvtsi2sd xmm0, eax
	divsd	xmm0, QWORD PTR __real@408f400000000000
	movsd	QWORD PTR [esi+8], xmm0
$LN11@kernel_mea@4:

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

	movsd	xmm0, QWORD PTR __real@3ff4000000000000
	push	ebp
	push	edi
	mov	eax, ebx
	mov	ecx, edi
	call	_SOR_execute
	add	esp, 8

; 60   :             Stopwatch_stop(Q);

	cmp	DWORD PTR [esi], 0
	je	SHORT $LN21@kernel_mea@4
	call	_clock
	cvtsi2sd xmm0, eax
	divsd	xmm0, QWORD PTR __real@408f400000000000
	subsd	xmm0, QWORD PTR [esi+8]
	addsd	xmm0, QWORD PTR [esi+16]
	movsd	QWORD PTR [esi+16], xmm0
	mov	DWORD PTR [esi], 0

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

$LN21@kernel_mea@4:
	movsd	xmm0, QWORD PTR [esi+16]
	comisd	xmm0, QWORD PTR _min_time$[esp+32]
	jae	SHORT $LN45@kernel_mea@4

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

	xorps	xmm0, xmm0
	add	ebx, ebx
	jmp	SHORT $LL3@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
	cvtsi2sd xmm0, edi
	movapd	xmm1, xmm0
	cvtsi2sd xmm2, ebx
	movsd	QWORD PTR _Md$5246[esp+32], xmm1
	movsd	QWORD PTR _Nd$5247[esp+36], xmm0
	movsd	QWORD PTR _num_iterD$5248[esp+36], xmm2
	je	SHORT $LN28@kernel_mea@4
	call	_clock
	cvtsi2sd xmm0, eax
	divsd	xmm0, QWORD PTR __real@408f400000000000
	movapd	xmm1, xmm0
	subsd	xmm1, QWORD PTR [esi+8]
	addsd	xmm1, QWORD PTR [esi+16]
	movsd	QWORD PTR [esi+16], xmm1
	movsd	xmm1, QWORD PTR _Md$5246[esp+32]
	movsd	QWORD PTR [esi+8], xmm0
	movsd	xmm0, QWORD PTR _Nd$5247[esp+36]
$LN28@kernel_mea@4:
	movsd	xmm2, QWORD PTR __real@3ff0000000000000
	subsd	xmm0, xmm2
	subsd	xmm1, xmm2
	mulsd	xmm0, xmm1
	mulsd	xmm0, QWORD PTR _num_iterD$5248[esp+36]
	mulsd	xmm0, QWORD PTR __real@4018000000000000
	divsd	xmm0, QWORD PTR [esi+16]
	mulsd	xmm0, QWORD PTR __real@3eb0c6f7a0b5ed8d

; 69   :         Stopwatch_delete(Q);

	push	esi
	movsd	QWORD PTR _result$[esp+36], xmm0
	call	_free
	add	esp, 4

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

	test	ebp, ebp
	je	SHORT $LN47@kernel_mea@4
	xor	esi, esi
	test	edi, edi
	jle	SHORT $LN36@kernel_mea@4
	npad	5
$LL38@kernel_mea@4:
	mov	eax, DWORD PTR [ebp+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	ebp
	call	_free
	add	esp, 4
$LN47@kernel_mea@4:

; 71   :         return result;

	movsd	xmm0, QWORD PTR _result$[esp+32]

; 72   : 
; 73   :     }

	pop	esi
	pop	ebp
	pop	ebx
	add	esp, 24					; 00000018H
	ret	0
_kernel_measureSOR ENDP
PUBLIC	_kernel_measureFFT
; Function compile flags: /Ogtpy
_TEXT	SEGMENT
_cycles$ = -12						; size = 4
_norm$5359 = -8						; size = 8
_N$ = 8							; size = 4
$T5409 = 12						; size = 8
_result$ = 12						; size = 8
_mintime$ = 12						; size = 8
_kernel_measureFFT PROC
; _R$ = eax

; 16   :     {

	sub	esp, 16					; 00000010H
	push	ebx
	push	ebp

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

	mov	ebp, DWORD PTR _N$[esp+20]
	push	esi
	push	edi
	lea	edi, DWORD PTR [ebp+ebp]

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

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

; 21   :         long cycles = 1;
; 22   :         Stopwatch Q = new_Stopwatch();

	push	24					; 00000018H
	mov	esi, eax
	mov	DWORD PTR _cycles$[esp+36], 1
	call	_malloc
	xorps	xmm0, xmm0
	add	esp, 4
	test	eax, eax
	jne	SHORT $LN9@kernel_mea@5
	xor	ebx, ebx
	jmp	SHORT $LL6@kernel_mea@5
$LN9@kernel_mea@5:
	mov	DWORD PTR [eax], 0
	movsd	QWORD PTR [eax+8], xmm0
	movsd	QWORD PTR [eax+16], xmm0
	mov	ebx, eax
	npad	5
$LL6@kernel_mea@5:

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

	cmp	DWORD PTR [ebx], 0
	jne	SHORT $LN14@kernel_mea@5
	mov	DWORD PTR [ebx], 1
	movsd	QWORD PTR [ebx+16], xmm0
	call	_clock
	cvtsi2sd xmm0, eax
	divsd	xmm0, QWORD PTR __real@408f400000000000
	movsd	QWORD PTR [ebx+8], xmm0
$LN14@kernel_mea@5:

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

	mov	ecx, DWORD PTR _cycles$[esp+32]
	test	ecx, ecx
	jle	$LN2@kernel_mea@5

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

	movsd	xmm0, QWORD PTR __real@3ff0000000000000
	mov	eax, edi
	cdq
	sub	eax, edx
	sar	eax, 1
	cvtsi2sd xmm1, eax
	divsd	xmm0, xmm1
	movsd	QWORD PTR _norm$5359[esp+32], xmm0
	mov	ebp, ecx
$LL4@kernel_mea@5:
	push	-1
	push	esi
	push	edi
	call	_FFT_transform_internal
	add	esp, 12					; 0000000cH
	push	1
	push	esi
	push	edi
	call	_FFT_transform_internal
	movsd	xmm0, QWORD PTR _norm$5359[esp+44]
	add	esp, 12					; 0000000cH
	xor	ecx, ecx
	cmp	edi, 4
	jl	SHORT $LC64@kernel_mea@5
	lea	edx, DWORD PTR [edi-4]
	shr	edx, 2
	add	edx, 1
	lea	eax, DWORD PTR [esi+16]
	lea	ecx, DWORD PTR [edx*4]
	npad	7
$LL65@kernel_mea@5:
	movsd	xmm1, QWORD PTR [eax-16]
	mulsd	xmm1, xmm0
	movsd	QWORD PTR [eax-16], xmm1
	movsd	xmm1, QWORD PTR [eax-8]
	mulsd	xmm1, xmm0
	movsd	QWORD PTR [eax-8], xmm1
	movsd	xmm1, QWORD PTR [eax]
	mulsd	xmm1, xmm0
	movsd	QWORD PTR [eax], xmm1
	movsd	xmm1, QWORD PTR [eax+8]
	mulsd	xmm1, xmm0
	movsd	QWORD PTR [eax+8], xmm1
	add	eax, 32					; 00000020H
	sub	edx, 1
	jne	SHORT $LL65@kernel_mea@5
$LC64@kernel_mea@5:
	cmp	ecx, edi
	jge	SHORT $LN3@kernel_mea@5
$LC23@kernel_mea@5:
	movapd	xmm1, xmm0
	mulsd	xmm1, QWORD PTR [esi+ecx*8]
	movsd	QWORD PTR [esi+ecx*8], xmm1
	add	ecx, 1
	cmp	ecx, edi
	jl	SHORT $LC23@kernel_mea@5
$LN3@kernel_mea@5:

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

	sub	ebp, 1
	jne	$LL4@kernel_mea@5
	mov	ebp, DWORD PTR _N$[esp+28]
$LN2@kernel_mea@5:

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

	cmp	DWORD PTR [ebx], 0
	je	SHORT $LN31@kernel_mea@5
	call	_clock
	cvtsi2sd xmm0, eax
	divsd	xmm0, QWORD PTR __real@408f400000000000
	subsd	xmm0, QWORD PTR [ebx+8]
	addsd	xmm0, QWORD PTR [ebx+16]
	movsd	QWORD PTR [ebx+16], xmm0
	mov	DWORD PTR [ebx], 0

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

$LN31@kernel_mea@5:
	movsd	xmm0, QWORD PTR [ebx+16]
	comisd	xmm0, QWORD PTR _mintime$[esp+28]
	jae	SHORT $LN59@kernel_mea@5

; 36   :                 break;
; 37   : 
; 38   :             cycles *= 2;

	mov	eax, DWORD PTR _cycles$[esp+32]

; 39   : 
; 40   :         }

	xorps	xmm0, xmm0
	lea	ecx, DWORD PTR [eax+eax]
	mov	DWORD PTR _cycles$[esp+32], ecx
	jmp	$LL6@kernel_mea@5
$LN59@kernel_mea@5:

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

	mov	eax, 1
	xor	ecx, ecx
	cmp	ebp, eax
	cvtsi2sd xmm1, ebp
	jle	SHORT $LN39@kernel_mea@5
	npad	2
$LL41@kernel_mea@5:
	add	eax, eax
	add	ecx, 1
	cmp	eax, ebp
	jl	SHORT $LL41@kernel_mea@5
$LN39@kernel_mea@5:
	mov	edx, 1
	shl	edx, cl
	cmp	ebp, edx
	je	SHORT $LN38@kernel_mea@5
	push	ebp
	push	OFFSET $SG-13
	call	_printf
	add	esp, 8
	push	1
	call	_exit
$LN38@kernel_mea@5:
	cmp	DWORD PTR [ebx], 0
	movsd	xmm2, QWORD PTR _RESOLUTION_DEFAULT
	movapd	xmm0, xmm1
	mulsd	xmm0, QWORD PTR __real@4014000000000000
	addsd	xmm1, QWORD PTR __real@3ff0000000000000
	subsd	xmm0, xmm2
	cvtsi2sd xmm3, ecx
	mulsd	xmm0, xmm3
	mulsd	xmm1, xmm2
	addsd	xmm0, xmm1
	movsd	QWORD PTR $T5409[esp+28], xmm0
	je	SHORT $LN46@kernel_mea@5
	call	_clock
	cvtsi2sd xmm0, eax
	divsd	xmm0, QWORD PTR __real@408f400000000000
	movapd	xmm1, xmm0
	subsd	xmm1, QWORD PTR [ebx+8]
	addsd	xmm1, QWORD PTR [ebx+16]
	movsd	QWORD PTR [ebx+8], xmm0
	movsd	xmm0, QWORD PTR $T5409[esp+28]
	movsd	QWORD PTR [ebx+16], xmm1
$LN46@kernel_mea@5:
	cvtsi2sd xmm1, DWORD PTR _cycles$[esp+32]
	mulsd	xmm1, xmm0
	divsd	xmm1, QWORD PTR [ebx+16]
	mulsd	xmm1, QWORD PTR __real@3eb0c6f7a0b5ed8d

; 44   :         Stopwatch_delete(Q);

	push	ebx
	movsd	QWORD PTR _result$[esp+32], xmm1
	call	_free
	add	esp, 4

; 45   :         free(x);

	push	esi
	call	_free

; 46   :         return result;

	movsd	xmm0, QWORD PTR _result$[esp+32]
	add	esp, 4

; 47   :     }

	pop	edi
	pop	esi
	pop	ebp
	pop	ebx
	add	esp, 16					; 00000010H
	ret	0
$LN82@kernel_mea@5:
_kernel_measureFFT ENDP
END
