Skip to content

Instantly share code, notes, and snippets.

@dabroz
Created May 16, 2011 14:41
Show Gist options
  • Save dabroz/974551 to your computer and use it in GitHub Desktop.
Save dabroz/974551 to your computer and use it in GitHub Desktop.
DOWN
.file "c.cpp"
.intel_syntax noprefix
.def ___main; .scl 2; .type 32; .endef
.text
.p2align 4,,15
.globl _main
.def _main; .scl 2; .type 32; .endef
_main:
push ebp
mov ebp, esp
and esp, -16
push edi
push esi
push ebx
sub esp, 52
call ___main
mov DWORD PTR [esp], 25165824
call __Znaj
mov DWORD PTR [esp], 25165824
mov ebx, eax
call __Znaj
mov esi, ebx
and esi, 15
shr esi, 2
neg esi
and esi, 3
je L11
xor edx, edx
mov edi, 6291456
.p2align 4,,10
L3:
mov DWORD PTR [ebx+edx*4], edx
mov ecx, edi
inc edx
sub ecx, edx
cmp esi, edx
ja L3
L2:
mov DWORD PTR [esp+44], 6291456
sub DWORD PTR [esp+44], esi
mov edi, DWORD PTR [esp+44]
shr edi, 2
mov DWORD PTR [esp+28], edi
sal edi, 2
mov DWORD PTR [esp+40], edi
test edi, edi
je L13
lea edi, [edx+1]
movd xmm3, edx
mov DWORD PTR [esp+36], edi
lea edi, [edx+2]
mov DWORD PTR [esp+32], edi
lea edi, [edx+3]
movd xmm0, DWORD PTR [esp+32]
movd xmm2, edi
mov DWORD PTR [esp+32], eax
punpckldq xmm0, xmm2
lea edi, [ebx+esi*4]
movd xmm2, DWORD PTR [esp+36]
movq xmm1, xmm0
punpckldq xmm3, xmm2
mov DWORD PTR [esp+36], ebx
movq xmm0, xmm3
movdqa xmm2, XMMWORD PTR LC0
punpcklqdq xmm0, xmm1
xor esi, esi
mov ebx, DWORD PTR [esp+28]
jmp L5
L12:
movdqa xmm0, xmm1
L5:
mov eax, esi
movdqa xmm1, xmm0
sal eax, 4
inc esi
paddd xmm1, xmm2
movdqa XMMWORD PTR [edi+eax], xmm0
cmp esi, ebx
jb L12
add edx, DWORD PTR [esp+40]
sub ecx, DWORD PTR [esp+40]
mov esi, DWORD PTR [esp+40]
mov ebx, DWORD PTR [esp+36]
mov eax, DWORD PTR [esp+32]
cmp DWORD PTR [esp+44], esi
je L6
.p2align 4,,10
L13:
mov DWORD PTR [ebx+edx*4], edx
inc edx
dec ecx
jne L13
L6:
mov esi, 512
.p2align 4,,10
L8:
mov edx, 6291455
.p2align 4,,10
L9:
mov ecx, DWORD PTR [ebx+edx*4]
mov DWORD PTR [eax+edx*4], ecx
dec edx
cmp edx, -1
jne L9
dec esi
jne L8
mov eax, DWORD PTR [eax]
add esp, 52
pop ebx
pop esi
pop edi
leave
ret
L11:
mov ecx, 6291456
xor edx, edx
jmp L2
.section .rdata,"dr"
.align 16
LC0:
.long 4
.long 4
.long 4
.long 4
.def __Znaj; .scl 2; .type 32; .endef
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment