// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of the License "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
// e32test\mmu\t_imb.cia
// 
//

#include <e32test.h>
#include <u32std.h>

#ifdef __CPU_ARM

__NAKED__ TInt BranchTest1()
	{
	asm("			movs  r0, #0 "); // return status KErrNone
	asm("			mov   r3, #1 "); // this is process 1
	asm("			mov   r1, lr "); // save return address
	asm("			mov   r2, #0xff00 "); // iterations
	asm("loop1:	");
	asm("			cmp   r1, r1 "); // reset cond flags
	asm("			moveq   lr, pc ");
	asm("			beq poison1 "); // start test!
	asm("			cmp   r3, #1 "); 
	asm("			moveq   lr, pc ");
	asm("			beq poison1 "); 
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 "); 
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			cmp   r3, #1 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison1 ");
	asm("			teq   r3, #1 ");		// did we fall through?
	asm("			movne r0, #-1 ");		// yes we did!
	__JUMP(ne,r1);							// return
	asm("			subs r2, r2, #1 ");	// no, decrement the counter and go again
	asm("			bne  loop1 ");			// if there are iters left and we didn't fall through

	__JUMP(,r1); // the end!
	asm("poison1: ");
	asm("			mov   r3, #1 ");  // we're ok
	__JUMP(,lr);
	asm("poison2: ");
	asm("			mov   r3, #2 ");  // woops!
	__JUMP(,lr);
	}

__NAKED__ void BranchTest1End()
{
	__JUMP(,lr);
}

__NAKED__ TInt BranchTest2()
	{
	asm("			movs  r0, #0 ");		// return status KErrNone
	asm("			mov   r3, #2 ");		// this is process 2
	asm("			mov   r1, lr");		// save return address
	asm("			mov   r2, #0xff00"); // iterations
	asm("loop2:	");
	asm("			cmp   r1, r1 ");	// reset flags
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");	// start test!
	asm("			cmp   r3, #2 "); 
	asm("			moveq   lr, pc ");
	asm("			beq poison3 "); 
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 "); 
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			cmp   r3, #2 ");
	asm("			moveq   lr, pc ");
	asm("			beq poison3 ");
	asm("			teq   r3, #2 ");		// did we fall through?
	asm("			movne r0, #-1 ");		// yes we did!
	__JUMP(ne,r1);							// return
	asm("			subs r2, r2, #1 ");	// no, decrement the counter and go again
	asm("			bne  loop2 ");			// if there are iters left and we didn't fall through
	__JUMP(,r1); // the end!
	asm("poison4: ");
	asm("			mov   r3, #1 ");  // woops!
	__JUMP(,lr);
	asm("poison3: ");
	asm("			mov   r3, #2 ");  // we're ok
	__JUMP(,lr);
	}
	
__NAKED__ void BranchTest2End()
{
	__JUMP(,lr);
}


__NAKED__ TInt BranchTest3()
	{
	asm("			b entrage ");		// skip the subroutine
	asm("nontoxic1: ");
	asm("			mov   r3, #3 ");  // we're ok
	__JUMP(,lr);
	asm("entrage: ");
	asm("			movs  r0, #0");		// return status KErrNone
	asm("			mov   r3, #3");		// this is test 3
	asm("			mov   r1, lr");		// save return address
	asm("			mov   r2, #0xff00"); // iterations
	asm("loop3:	");
	asm("			cmp   r1, r1 ");	// reset flags
	asm("			bleq nontoxic1 ");	// start test!
	asm("			cmp   r3, #3 "); 
	asm("			bleq nontoxic1 "); 
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 "); 
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			cmp   r3, #3 ");
	asm("			bleq nontoxic1 ");
	asm("			teq   r3, #3 ");		// did we fall through?
	asm("			movne r0, #-1 ");		// yes we did!
	__JUMP(ne,r1);							// return
	asm("			subs r2, r2, #1 ");		// no, decrement the counter and go again
	asm("			bne  loop3 ");			// if there are iters left and we didn't fall through
	__JUMP(,r1); // the end!
	asm("poison5: ");
	asm("			mov   r3, #1 ");  // woops!
	__JUMP(,lr);
	}

__NAKED__ void BranchTest3End()
{
	__JUMP(,lr);
}

__NAKED__ void BranchTest4(TInt)
{
	asm("		mov		r2, #0xff000 "); // big number
	asm("bloop: ");
	asm("		cmp		r0, #0 ");
	asm("		beq		skippy ");

	asm("		and		r4, r4, r4 ");
	asm("		and 	r5, r5, r5 ");
	asm("		and 	r6, r6, r6 ");
	asm("		and 	r7, r7, r7 ");
	asm("		and 	r8, r8, r8 ");

	asm("skippy: ");
	asm("		subs	r2, r2, #1 ");
	asm("		bne		bloop ");
	__JUMP(,lr);
}
__NAKED__ void BranchTest4End()
{
	__JUMP(,lr);
}
#endif
