    sw   0x200(r0),r0
    sw   0x300(r0),r0
    sw   0x304(r0),r1
    sw   0x308(r0),r2
    sw   0x30c(r0),r3
    addi r2,r0,0
    movs2i r1,s2
    beqz r1, exit
    sw   0x408(r0),r1

compute_cause:
    andi r3,r1,0x1
    bnez r3,handler 
    srli r1,r1,#1
    beqz r0,compute_cause
    addi r2,r2,#1

handler:
    beqz r2,start
    sw 0x430(r0),r2

    movs2i r1,s0
    sw   0x400(r0),r1
    movs2i r1,s1
    sw   0x404(r0),r1
    movs2i r1,s3
    sw   0x40c(r0),r1
    movs2i r1,s4
    sw   0x410(r0),r1
    movs2i r1,s5
    sw   0x414(r0),r1
    movs2i r1,s6
    sw   0x418(r0),r1
    movs2i r1,s7
    sw   0x41c(r0),r1
    movs2i r1,s8
    sw   0x420(r0),r1

    sw   0x310(r0),r4
    sw   0x314(r0),r5
    sw   0x318(r0),r6
    sw   0x31c(r0),r7
    sw   0x320(r0),r8
    sw   0x324(r0),r9
    sw   0x328(r0),r10
    sw   0x32c(r0),r11
    sw   0x330(r0),r12
    sw   0x334(r0),r13
    sw   0x338(r0),r14
    sw   0x33c(r0),r15
    sw   0x340(r0),r16
    sw   0x344(r0),r17
    sw   0x348(r0),r18
    sw   0x34c(r0),r19
    sw   0x350(r0),r20
    sw   0x354(r0),r21
    sw   0x358(r0),r22
    sw   0x35c(r0),r23
    sw   0x360(r0),r24
    sw   0x364(r0),r25
    sw   0x368(r0),r26
    sw   0x36c(r0),r27
    sw   0x370(r0),r28
    sw   0x374(r0),r29
    sw   0x378(r0),r30
    sw   0x37c(r0),r31

    stored 0x380(r0),f0
    stored 0x388(r0),f2
    stored 0x390(r0),f4
    stored 0x398(r0),f6
    stored 0x3a0(r0),f8
    stored 0x3a8(r0),f10
    stored 0x3b0(r0),f12
    stored 0x3b8(r0),f14
    stored 0x3c0(r0),f16
    stored 0x3c8(r0),f18
    stored 0x3d0(r0),f20
    stored 0x3d8(r0),f22
    stored 0x3e0(r0),f24
    stored 0x3e8(r0),f26
    stored 0x3f0(r0),f28
    stored 0x3f8(r0),f30
exit:
    addi r1,r0,#5
    sw 0x204(r0),r1
    sw 0x208(r0),r2
    addi r1,r0,#1
    sw 0x200(r0),r1
loop:
    lw r1,0x200(r0)
    bnez r1,loop
    nop
    nop
    lw r1,0x304(r0)
    lw r2,0x308(r0)
    lw r3,0x30c(r0)
    rfe
start:
    nop
