.include "macros.inc"

.section .text, "ax"

.global adler32
adler32:
/* 80341120 0033E080  94 21 FF E0 */	stwu r1, -0x20(r1)
/* 80341124 0033E084  54 60 04 3E */	clrlwi r0, r3, 0x10
/* 80341128 0033E088  28 04 00 00 */	cmplwi r4, 0
/* 8034112C 0033E08C  54 63 84 3E */	srwi r3, r3, 0x10
/* 80341130 0033E090  BF 61 00 0C */	stmw r27, 0xc(r1)
/* 80341134 0033E094  40 82 00 0C */	bne lbl_80341140
/* 80341138 0033E098  38 60 00 01 */	li r3, 1
/* 8034113C 0033E09C  48 00 01 5C */	b lbl_80341298
lbl_80341140:
/* 80341140 0033E0A0  3C E0 80 08 */	lis r7, 0x80078071@ha
/* 80341144 0033E0A4  3C C0 00 01 */	lis r6, 0x0000FFF1@ha
/* 80341148 0033E0A8  39 27 80 71 */	addi r9, r7, 0x80078071@l
/* 8034114C 0033E0AC  38 E6 FF F1 */	addi r7, r6, 0x0000FFF1@l
/* 80341150 0033E0B0  48 00 01 38 */	b lbl_80341288
lbl_80341154:
/* 80341154 0033E0B4  28 05 15 B0 */	cmplwi r5, 0x15b0
/* 80341158 0033E0B8  39 00 15 B0 */	li r8, 0x15b0
/* 8034115C 0033E0BC  40 80 00 08 */	bge lbl_80341164
/* 80341160 0033E0C0  7C A8 2B 78 */	mr r8, r5
lbl_80341164:
/* 80341164 0033E0C4  55 06 E1 3E */	srwi r6, r8, 4
/* 80341168 0033E0C8  7D 1B 43 78 */	mr r27, r8
/* 8034116C 0033E0CC  7C A8 28 50 */	subf r5, r8, r5
/* 80341170 0033E0D0  7C C9 03 A6 */	mtctr r6
/* 80341174 0033E0D4  2C 08 00 10 */	cmpwi r8, 0x10
/* 80341178 0033E0D8  41 80 00 D0 */	blt lbl_80341248
lbl_8034117C:
/* 8034117C 0033E0DC  88 C4 00 00 */	lbz r6, 0(r4)
/* 80341180 0033E0E0  3B 7B FF F0 */	addi r27, r27, -16
/* 80341184 0033E0E4  89 04 00 01 */	lbz r8, 1(r4)
/* 80341188 0033E0E8  7C 00 32 14 */	add r0, r0, r6
/* 8034118C 0033E0EC  88 C4 00 02 */	lbz r6, 2(r4)
/* 80341190 0033E0F0  7C 63 02 14 */	add r3, r3, r0
/* 80341194 0033E0F4  89 64 00 03 */	lbz r11, 3(r4)
/* 80341198 0033E0F8  7C 00 42 14 */	add r0, r0, r8
/* 8034119C 0033E0FC  89 44 00 04 */	lbz r10, 4(r4)
/* 803411A0 0033E100  7C 63 02 14 */	add r3, r3, r0
/* 803411A4 0033E104  89 04 00 05 */	lbz r8, 5(r4)
/* 803411A8 0033E108  7C 00 32 14 */	add r0, r0, r6
/* 803411AC 0033E10C  88 C4 00 06 */	lbz r6, 6(r4)
/* 803411B0 0033E110  7C 63 02 14 */	add r3, r3, r0
/* 803411B4 0033E114  8B 84 00 07 */	lbz r28, 7(r4)
/* 803411B8 0033E118  7C 00 5A 14 */	add r0, r0, r11
/* 803411BC 0033E11C  8B A4 00 08 */	lbz r29, 8(r4)
/* 803411C0 0033E120  7C 63 02 14 */	add r3, r3, r0
/* 803411C4 0033E124  8B C4 00 09 */	lbz r30, 9(r4)
/* 803411C8 0033E128  7C 00 52 14 */	add r0, r0, r10
/* 803411CC 0033E12C  8B E4 00 0A */	lbz r31, 0xa(r4)
/* 803411D0 0033E130  7C 63 02 14 */	add r3, r3, r0
/* 803411D4 0033E134  89 84 00 0B */	lbz r12, 0xb(r4)
/* 803411D8 0033E138  7C 00 42 14 */	add r0, r0, r8
/* 803411DC 0033E13C  89 64 00 0C */	lbz r11, 0xc(r4)
/* 803411E0 0033E140  7C 63 02 14 */	add r3, r3, r0
/* 803411E4 0033E144  89 44 00 0D */	lbz r10, 0xd(r4)
/* 803411E8 0033E148  7C 00 32 14 */	add r0, r0, r6
/* 803411EC 0033E14C  89 04 00 0E */	lbz r8, 0xe(r4)
/* 803411F0 0033E150  7C 63 02 14 */	add r3, r3, r0
/* 803411F4 0033E154  88 C4 00 0F */	lbz r6, 0xf(r4)
/* 803411F8 0033E158  7C 00 E2 14 */	add r0, r0, r28
/* 803411FC 0033E15C  38 84 00 10 */	addi r4, r4, 0x10
/* 80341200 0033E160  7C 63 02 14 */	add r3, r3, r0
/* 80341204 0033E164  7C 00 EA 14 */	add r0, r0, r29
/* 80341208 0033E168  7C 63 02 14 */	add r3, r3, r0
/* 8034120C 0033E16C  7C 00 F2 14 */	add r0, r0, r30
/* 80341210 0033E170  7C 63 02 14 */	add r3, r3, r0
/* 80341214 0033E174  7C 00 FA 14 */	add r0, r0, r31
/* 80341218 0033E178  7C 63 02 14 */	add r3, r3, r0
/* 8034121C 0033E17C  7C 00 62 14 */	add r0, r0, r12
/* 80341220 0033E180  7C 63 02 14 */	add r3, r3, r0
/* 80341224 0033E184  7C 00 5A 14 */	add r0, r0, r11
/* 80341228 0033E188  7C 63 02 14 */	add r3, r3, r0
/* 8034122C 0033E18C  7C 00 52 14 */	add r0, r0, r10
/* 80341230 0033E190  7C 63 02 14 */	add r3, r3, r0
/* 80341234 0033E194  7C 00 42 14 */	add r0, r0, r8
/* 80341238 0033E198  7C 63 02 14 */	add r3, r3, r0
/* 8034123C 0033E19C  7C 00 32 14 */	add r0, r0, r6
/* 80341240 0033E1A0  7C 63 02 14 */	add r3, r3, r0
/* 80341244 0033E1A4  42 00 FF 38 */	bdnz lbl_8034117C
lbl_80341248:
/* 80341248 0033E1A8  2C 1B 00 00 */	cmpwi r27, 0
/* 8034124C 0033E1AC  41 82 00 1C */	beq lbl_80341268
lbl_80341250:
/* 80341250 0033E1B0  88 C4 00 00 */	lbz r6, 0(r4)
/* 80341254 0033E1B4  37 7B FF FF */	addic. r27, r27, -1
/* 80341258 0033E1B8  38 84 00 01 */	addi r4, r4, 1
/* 8034125C 0033E1BC  7C 00 32 14 */	add r0, r0, r6
/* 80341260 0033E1C0  7C 63 02 14 */	add r3, r3, r0
/* 80341264 0033E1C4  40 82 FF EC */	bne lbl_80341250
lbl_80341268:
/* 80341268 0033E1C8  7D 09 00 16 */	mulhwu r8, r9, r0
/* 8034126C 0033E1CC  7C C9 18 16 */	mulhwu r6, r9, r3
/* 80341270 0033E1D0  55 08 8B FE */	srwi r8, r8, 0xf
/* 80341274 0033E1D4  7D 08 39 D6 */	mullw r8, r8, r7
/* 80341278 0033E1D8  54 C6 8B FE */	srwi r6, r6, 0xf
/* 8034127C 0033E1DC  7C C6 39 D6 */	mullw r6, r6, r7
/* 80341280 0033E1E0  7C 08 00 50 */	subf r0, r8, r0
/* 80341284 0033E1E4  7C 66 18 50 */	subf r3, r6, r3
lbl_80341288:
/* 80341288 0033E1E8  28 05 00 00 */	cmplwi r5, 0
/* 8034128C 0033E1EC  40 82 FE C8 */	bne lbl_80341154
/* 80341290 0033E1F0  54 63 80 1E */	slwi r3, r3, 0x10
/* 80341294 0033E1F4  7C 63 03 78 */	or r3, r3, r0
lbl_80341298:
/* 80341298 0033E1F8  BB 61 00 0C */	lmw r27, 0xc(r1)
/* 8034129C 0033E1FC  38 21 00 20 */	addi r1, r1, 0x20
/* 803412A0 0033E200  4E 80 00 20 */	blr