Code:

.text
.align 2
.thumb
.thumb_func
.global newroutine
main:
PUSH {R0-R7,LR}
LDR R5, var_8004
LDRH R5, [R5, #0x0]
LDR R4, party_addr
MOV R6, #0x64
LDR R7, New_poke_addr
MUL R5, R6
ADD R4, R4, R5
B decrypt
.hword 0x0000
var_8004: .word 0x0202E8CC
party_addr: .word 0x03004360
New_poke_addr: .word 0x0203F400

decrypt:
LDR R0, [R4, #0x0]
PUSH {R0}
LDR R1, [R4,#0x4]
EOR R1, R0
STR R1, [R7, #0x0]
LDRH R1, [R4, #0x1C]
STRH R1, [R7, #0x6]
MOV R2, #0x20
ADD R0, R2, R4
MOV R2, #0x18
ADD R1, R2, R7
MOV R2, #0xC
LDR R5, [R7, #0x0]

decrypt_loop:
LDR R3, [R0, #0x0]
EOR R3, R5
STR R3, [R1, #0x0]
ADD R1, #0x4
ADD R0, #0x4
SUB R2, #0x1
CMP R2, #0x0
BNE decrypt_loop
POP {R0}
MOV R1, #0x18
MOV R2, #0xC0
LSL R2, R2, #0x18
CMP R2, R0
BHI lower_than_c
SUB R0, R0, R2

lower_than_c:
LSR R2, R2, #0x1
CMP R2, R0
BCS lower_than_6
SUB R0, R0, R2
LSL R0, R0, #0x0

lower_than_6:
SWI #0x6
ADD R0, R1, #0x0
MOV R1, #6
SWI #0x6

g_in_first:
CMP R0, #0x0
BNE g_in_second
MOV R2, #0x18
B g_final

g_in_second:
CMP r1, #0x1
BGT g_in_third
MOV R2, #0x24
B g_final

g_in_third:
MOV R2, #1
AND R2, R1
CMP R2, #1
BEQ g_in_fourth
MOV R2, #0x30
B g_final

g_in_fourth:
MOV R2, #0x3C

g_final:
ADD R2, R7, R2
STR R2, [R7, #0x8]

m_in_first:
CMP R0, #0x3
BNE m_in_second
MOV R2, #0x18
B m_final

m_in_second:
CMP R1, #0x4
BLT m_in_third
MOV R2, #0x24
B m_final

m_in_third:
MOV R2, #0x1
AND R2, R1
CMP R2, #0x1
BNE m_in_fourth
MOV R2, #0x30
B m_final

m_in_fourth:
MOV R2, #0x3C

m_final:
ADD R2, R7, R2
STR R2, [R7,#0x14]
a_first: CMP R0, #0x1
BGT a_second
CMP R0, #0x0
BEQ a_lesser_second
MOV R2, #0x18
B a_final

a_second:
MOV R3, #0x2
BEQ a_greater_second
CMP R1, #0x3
BEQ a_greater_second
CMP R1, #0x0
BEQ a_greater_third
CMP R1, #0x5
BEQ a_greater_third
MOV R2, #0x3C
B a_final

a_greater_second:
MOV R2, #0x24
B a_final

a_greater_third:
MOV R2, #0x30
B a_final

a_lesser_second:
CMP R1, #0x1
BGT a_lesser_third
MOV R2, #0x24
B a_final

a_lesser_third:
MOV R2, #0x1
AND R2, R1
CMP R2, #0x2
BNE a_lesser_fourth
MOV R2, #0x30
B a_final

a_lesser_fourth:
MOV R2, #0x3C

a_final:
ADD R2, R7, R2
STR R2, [R7,#0xC]

e_first:
CMP R0, #0x2
BLT e_second
CMP R0, #0x2
BGT e_greater_second
MOV R2, #0x18
B e_final

e_second:
CMP R1, #0x2
BEQ e_lesser_second
CMP R1, #0x3
BEQ e_lesser_second
CMP R1, #0x0
BEQ e_lesser_third
CMP R1, #0x5
BEQ e_lesser_third
MOV R2, #0x3C
B e_final

e_lesser_second:
MOV R2, #0x24
B e_final

e_lesser_third:
MOV R2, #0x30
B e_final

e_greater_second:
CMP R1, #0x5
BLT e_greater_third
MOV R2, #0x24
B e_final

e_greater_third:
MOV R2, #1
AND R2, R1
CMP R2, #0
BEQ e_greater_fourth
MOV R2, #0x30
B e_final

e_greater_fourth:
MOV R2, #0x3C

e_final:
ADD R2, R7, R2
STR R2, [R7,#0x10]
POP {R0-R7,PC}