.file "reed_solomon.c"
.text
.type gf_mul, @function
gf_mul:
testb %dl, %dl
je .L3
testb %al, %al
je .L3
movzbl %dl, %edx
movzbl %al, %eax
movzbl 1049088(%edx), %edx
movzbl 1049088(%eax), %eax
movb 1048576(%edx,%eax), %al
ret
.L3:
xorl %eax, %eax
ret
.size gf_mul, .-gf_mul
.type pol_evaluate, @function
pol_evaluate:
pushl %ebp
testb %cl, %cl
pushl %edi
pushl %esi
pushl %ebx
jne .L5
movb (%eax), %bl
jmp .L6
.L5:
movzbl %cl, %ecx
movl %edx, %ebp
xorl %ebx, %ebx
movzbl 1049088(%ecx), %edi
xorl %ecx, %ecx
jmp .L7
.L10:
movzbl (%eax,%ebp), %esi
movl %esi, %edx
testb %dl, %dl
je .L8
andl $255, %esi
movzbl 1049088(%esi), %esi
xorb 1048576(%ecx,%esi), %bl
.L8:
addl %edi, %ecx
cmpl $254, %ecx
jle .L9
subl $255, %ecx
.L9:
decl %ebp
.L7:
testl %ebp, %ebp
jns .L10
.L6:
movb %bl, %al
popl %ebx
popl %esi
popl %edi
popl %ebp
ret
.size pol_evaluate, .-pol_evaluate
.type gauss_solve, @function
gauss_solve:
pushl %ebp
movl %esp, %ebp
pushl %edi
pushl %esi
pushl %ebx
subl $60, %esp
movl %eax, -52(%ebp)
movl %edx, -28(%ebp)
movl scratch, %eax
sall $2, %edx
movl %eax, -36(%ebp)
addl %edx, %eax
movl %ecx, %ebx
movl %eax, -60(%ebp)
movl %eax, scratch
movl %edx, -56(%ebp)
xorl %eax, %eax
jmp .L12
.L13:
movl -36(%ebp), %edx
movl $-1, (%edx,%eax,4)
incl %eax
.L12:
cmpl -28(%ebp), %eax
jl .L13
xorl %eax, %eax
jmp .L14
.L15:
movl 8(%ebp), %esi
movb $0, (%esi,%eax)
incl %eax
.L14:
cmpl %ebx, %eax
jl .L15
leal 1(%ebx), %eax
movl -52(%ebp), %ecx
movl %eax, -24(%ebp)
movl $0, -40(%ebp)
movl $0, -16(%ebp)
movl %eax, -68(%ebp)
movl %ecx, %edi
jmp .L16
.L18:
incl %esi
jmp .L26
.L32:
movl %edi, %eax
xorl %esi, %esi
.L26:
cmpl %ebx, %esi
jge .L17
movb (%eax), %dl
incl %eax
testb %dl, %dl
je .L18
.L17:
cmpl %ebx, %esi
je .L19
movl -16(%ebp), %edx
movl -36(%ebp), %eax
movl %edi, %ecx
movl %esi, (%eax,%edx,4)
movl -52(%ebp), %eax
movl -40(%ebp), %edx
addl %esi, %eax
movzbl (%eax,%edx), %eax
movl $255, %edx
movzbl 1049088(%eax), %eax
subl %eax, %edx
movl $0, -20(%ebp)
movzbl 1048576(%edx), %eax
movl %eax, -32(%ebp)
jmp .L20
.L21:
movzbl (%ecx), %eax
movl -32(%ebp), %edx
movl %ecx, -72(%ebp)
call gf_mul
movl -72(%ebp), %ecx
movb %al, (%ecx)
incl %ecx
incl -20(%ebp)
.L20:
cmpl -20(%ebp), %ebx
jge .L21
movl -16(%ebp), %eax
movl -68(%ebp), %edx
incl %eax
addl %edi, %edx
movl %eax, -44(%ebp)
movl %edx, -20(%ebp)
jmp .L22
.L25:
movl -20(%ebp), %ecx
movl %edi, -32(%ebp)
movl $0, -48(%ebp)
movzbl (%ecx,%esi), %eax
movl %eax, -64(%ebp)
jmp .L23
.L24:
movl -32(%ebp), %edx
movzbl (%edx), %eax
movl -64(%ebp), %edx
movl %ecx, -72(%ebp)
call gf_mul
movl -72(%ebp), %ecx
xorb %al, (%ecx)
incl %ecx
incl -48(%ebp)
incl -32(%ebp)
.L23:
cmpl -48(%ebp), %ebx
jge .L24
movl -24(%ebp), %eax
incl -44(%ebp)
addl %eax, -20(%ebp)
.L22:
movl -28(%ebp), %edx
cmpl %edx, -44(%ebp)
jl .L25
.L19:
movl -24(%ebp), %esi
incl -16(%ebp)
addl %esi, -40(%ebp)
addl %esi, %edi
.L16:
movl -28(%ebp), %eax
cmpl %eax, -16(%ebp)
jl .L32
movl %eax, %esi
movl -24(%ebp), %eax
decl %esi
movl %ebx, %edx
imull %esi, %eax
addl -52(%ebp), %eax
notl %edx
movl %edx, -20(%ebp)
movl %eax, -16(%ebp)
jmp .L27
.L31:
movl -36(%ebp), %eax
movl (%eax,%esi,4), %eax
movl %eax, -28(%ebp)
incl %eax
je .L28
movl -16(%ebp), %edx
xorl %ecx, %ecx
movl %edx, -24(%ebp)
xorl %edi, %edi
movl %esi, -32(%ebp)
jmp .L29
.L30:
movl 8(%ebp), %esi
movzbl (%esi,%edi), %edx
movl -24(%ebp), %esi
incl %edi
movzbl (%esi), %eax
movb %cl, -72(%ebp)
call gf_mul
incl %esi
movb -72(%ebp), %cl
xorl %eax, %ecx
movl %esi, -24(%ebp)
.L29:
cmpl %ebx, %edi
jl .L30
movl -16(%ebp), %eax
movl -28(%ebp), %edx
movl -32(%ebp), %esi
xorb (%eax,%ebx), %cl
movl 8(%ebp), %eax
movb %cl, (%eax,%edx)
.L28:
movl -20(%ebp), %edx
decl %esi
addl %edx, -16(%ebp)
.L27:
testl %esi, %esi
jns .L31
movl -60(%ebp), %eax
subl -56(%ebp), %eax
movl %eax, scratch
addl $60, %esp
popl %ebx
popl %esi
popl %edi
popl %ebp
ret
.size gauss_solve, .-gauss_solve
.globl grub_reed_solomon_recover
.type grub_reed_solomon_recover, @function
grub_reed_solomon_recover:
pushl %ebp
movl %esp, %ebp
pushl %edi
pushl %esi
pushl %ebx
subl $104, %esp
movl %edx, -52(%ebp)
movl %ecx, -64(%ebp)
testl %ecx, %ecx
je .L33
movb $0, 1049088
movl $1048576, %ecx
movb $1, %dl
.L37:
movzbl %dl, %ebx
movb %dl, (%ecx)
movb %dl, 255(%ecx)
testb %dl, %dl
movb %cl, 1049088(%ebx)
jns .L35
leal (%ebx,%ebx), %edx
xorl $29, %edx
jmp .L36
.L35:
addl %edx, %edx
.L36:
incl %ecx
cmpl $1048831, %ecx
jne .L37
movl %eax, -72(%ebp)
addl -52(%ebp), %eax
movl %eax, -88(%ebp)
jmp .L38
.L71:
movl -64(%ebp), %ecx
addl -52(%ebp), %ecx
cmpl $102400, %ecx
jbe .L72
imull $200, -52(%ebp), %eax
xorl %edx, %edx
divl %ecx
sall $9, %eax
xorl %edx, %edx
movl %eax, -56(%ebp)
imull $200, -64(%ebp), %eax
divl %ecx
sall $9, %eax
movl %eax, -60(%ebp)
jmp .L39
.L72:
movl -64(%ebp), %eax
movl -52(%ebp), %edx
movl %eax, -60(%ebp)
movl %edx, -56(%ebp)
.L39:
movl -72(%ebp), %ecx
movl -88(%ebp), %ebx
movl %ecx, -80(%ebp)
movl %ebx, -92(%ebp)
movl $511, -68(%ebp)
.L70:
movl -68(%ebp), %eax
addl -56(%ebp), %eax
shrl $9, %eax
movl %eax, -44(%ebp)
movl -68(%ebp), %eax
addl -60(%ebp), %eax
shrl $9, %eax
movl %eax, -24(%ebp)
je .L40
cmpl $0, -44(%ebp)
je .L40
addl -44(%ebp), %eax
movl scratch, %edx
movl %edx, -48(%ebp)
addl %eax, %edx
movl %eax, -76(%ebp)
movl %edx, -28(%ebp)
movl %edx, scratch
xorl %eax, %eax
movl -80(%ebp), %edx
jmp .L41
.L42:
movl -48(%ebp), %ebx
movb (%edx), %cl
addl $512, %edx
movb %cl, (%ebx,%eax)
incl %eax
.L41:
cmpl -44(%ebp), %eax
jl .L42
movl -48(%ebp), %ecx
movl -92(%ebp), %edx
xorl %eax, %eax
addl -44(%ebp), %ecx
jmp .L43
.L44:
movb (%edx), %bl
addl $512, %edx
movb %bl, (%ecx,%eax)
incl %eax
.L43:
cmpl -24(%ebp), %eax
jl .L44
movl -24(%ebp), %edi
movl -28(%ebp), %eax
shrl %edi
movl -24(%ebp), %ecx
addl %edi, %eax
movl $1, %esi
movl %eax, -96(%ebp)
addl %edi, %eax
leal 0(,%edi,4), %edx
movl %eax, %ebx
addl %edx, %ebx
movl %eax, -100(%ebp)
movl -76(%ebp), %eax
addl %ebx, %ecx
decl %eax
movl %edx, -104(%ebp)
movl %ecx, -20(%ebp)
movl %ecx, scratch
movl %eax, -40(%ebp)
movl %eax, %edx
movl $1, %ecx
movl -48(%ebp), %eax
call pol_evaluate
movb %al, (%ebx)
movl %esi, %eax
movl $1, -16(%ebp)
movl %ebx, %esi
movb %al, %bl
jmp .L45
.L48:
testb %bl, %bl
jns .L46
addl %ebx, %ebx
xorl $29, %ebx
jmp .L47
.L46:
addl %ebx, %ebx
.L47:
movl -40(%ebp), %edx
movl -48(%ebp), %eax
movzbl %bl, %ecx
call pol_evaluate
movl -16(%ebp), %edx
movb %al, (%esi,%edx)
incl %edx
movl %edx, -16(%ebp)
.L45:
movl -24(%ebp), %ecx
cmpl %ecx, -16(%ebp)
jb .L48
movl %esi, %ebx
xorl %eax, %eax
.L50:
cmpb $0, (%ebx,%eax)
jne .L49
incl %eax
cmpl -24(%ebp), %eax
jl .L50
.L49:
cmpl -24(%ebp), %eax
jne .L51
negl %edi
movl -20(%ebp), %ebx
leal (%ebx,%edi,2), %edx
subl -104(%ebp), %edx
subl %eax, %edx
movl %edx, scratch
.L69:
movl -80(%ebp), %edx
xorl %eax, %eax
movl -48(%ebp), %ebx
jmp .L52
.L51:
leal 1(%edi), %eax
movl -20(%ebp), %ecx
movl %eax, -32(%ebp)
xorl %edx, %edx
imull %edi, %eax
movl %eax, -16(%ebp)
movl -20(%ebp), %eax
addl -16(%ebp), %eax
movl %eax, scratch
jmp .L53
.L55:
xorl %eax, %eax
leal (%ebx,%edx), %esi
movl %edx, -36(%ebp)
.L54:
movb (%esi,%eax), %dl
movb %dl, (%ecx,%eax)
incl %eax
cmpl %eax, %edi
jge .L54
movl -36(%ebp), %edx
addl -32(%ebp), %ecx
incl %edx
.L53:
cmpl %edi, %edx
jl .L55
xorl %eax, %eax
jmp .L56
.L57:
movl -28(%ebp), %ecx
movb $0, (%ecx,%eax)
incl %eax
.L56:
cmpl %edi, %eax
jl .L57
pushl -28(%ebp)
movl %edi, %ecx
movl %edi, %edx
movl -20(%ebp), %eax
xorl %esi, %esi
call gauss_solve
movl -16(%ebp), %eax
movl scratch, %edx
leal -1(%edi), %ecx
negl %eax
addl %edx, %eax
movb $1, -36(%ebp)
movl %eax, -16(%ebp)
movl %eax, scratch
popl %edx
movb $1, %al
movl $0, -20(%ebp)
movl %ecx, -84(%ebp)
jmp .L58
.L60:
movzbl %al, %eax
movl %eax, %ecx
movl %eax, -32(%ebp)
movl -84(%ebp), %edx
movl -28(%ebp), %eax
call pol_evaluate
movl -32(%ebp), %edx
movzbl %al, %eax
call gf_mul
decb %al
jne .L59
movl -96(%ebp), %edx
movb -36(%ebp), %al
movb %al, (%edx,%esi)
movl -40(%ebp), %eax
movl -100(%ebp), %ecx
subl -20(%ebp), %eax
movl %eax, (%ecx,%esi,4)
incl %esi
.L59:
movzbl -36(%ebp), %eax
movl $2, %edx
call gf_mul
movl $142, %edx
movb %al, -36(%ebp)
movl -32(%ebp), %eax
call gf_mul
incl -20(%ebp)
.L58:
movl -76(%ebp), %edx
cmpl %edx, -20(%ebp)
jl .L60
leal 1(%esi), %ecx
movl -16(%ebp), %eax
movl %ecx, -28(%ebp)
leal 0(,%esi,4), %edx
imull -24(%ebp), %ecx
addl %ecx, %eax
movl %ecx, -84(%ebp)
movl %eax, -32(%ebp)
addl %edx, %eax
movl %eax, scratch
movl %edx, -108(%ebp)
xorl %eax, %eax
jmp .L61
.L62:
movl -16(%ebp), %ecx
movb $1, (%ecx,%eax)
incl %eax
.L61:
cmpl %esi, %eax
jl .L62
movl -16(%ebp), %edx
movb (%ebx), %al
movb %al, (%edx,%esi)
movl %edx, -36(%ebp)
movl -16(%ebp), %ecx
movl $1, -20(%ebp)
addl -28(%ebp), %ecx
movl %ecx, -40(%ebp)
movl %edi, %ecx
movl %esi, %edi
jmp .L63
.L64:
movl -36(%ebp), %eax
movl -96(%ebp), %ecx
movzbl (%eax,%esi), %edx
movzbl (%ecx,%esi), %eax
call gf_mul
movl -40(%ebp), %edx
movb %al, (%edx,%esi)
incl %esi
.L66:
cmpl %edi, %esi
jl .L64
movl -20(%ebp), %edx
movl -116(%ebp), %ecx
movb (%ebx,%edx), %al
movl -40(%ebp), %edx
movb %al, (%edx,%edi)
movl -28(%ebp), %eax
incl -20(%ebp)
addl %eax, -36(%ebp)
addl %eax, %edx
movl %edx, -40(%ebp)
.L63:
movl -24(%ebp), %edx
cmpl %edx, -20(%ebp)
jge .L65
xorl %esi, %esi
movl %ecx, -116(%ebp)
jmp .L66
.L65:
pushl -32(%ebp)
movl %edi, %esi
movl -16(%ebp), %eax
movl %ecx, %edi
movl -24(%ebp), %edx
movl %esi, %ecx
call gauss_solve
popl %eax
movl -32(%ebp), %ebx
xorl %eax, %eax
jmp .L67
.L68:
movl -100(%ebp), %ecx
movl -48(%ebp), %edx
addl (%ecx,%eax,4), %edx
movb (%ebx,%eax), %cl
incl %eax
xorb %cl, (%edx)
.L67:
cmpl %esi, %eax
jl .L68
movl -84(%ebp), %eax
negl %eax
addl scratch, %eax
subl -108(%ebp), %eax
negl %edi
leal (%eax,%edi,2), %eax
subl -104(%ebp), %eax
subl -24(%ebp), %eax
movl %eax, scratch
jmp .L69
.L52:
movb (%ebx,%eax), %cl
incl %eax
movb %cl, (%edx)
addl $512, %edx
cmpl -44(%ebp), %eax
jl .L52
movl -76(%ebp), %ebx
subl %ebx, scratch
.L40:
decl -68(%ebp)
incl -80(%ebp)
incl -92(%ebp)
cmpl $-1, -68(%ebp)
jne .L70
movl -56(%ebp), %eax
movl -60(%ebp), %edx
addl %eax, -72(%ebp)
addl %edx, -88(%ebp)
subl %eax, -52(%ebp)
subl %edx, -64(%ebp)
.L38:
cmpl $0, -52(%ebp)
jne .L71
.L33:
leal -12(%ebp), %esp
popl %ebx
popl %esi
popl %edi
popl %ebp
ret
.size grub_reed_solomon_recover, .-grub_reed_solomon_recover
.section .text
.align 4
.type scratch, @object
.size scratch, 4
scratch:
.long 1049344
.ident "GCC: (GNU) 4.5.2"