; pushad/pushfq emulation for x64, lazily copied from enigma protector stub out 
;entrypoint equ 140001260h
milk_offset equ offset szMilk - offset self
.code 
org 0001260h
entrypoint:
org 000b140h
start proc
push rax                  
push rcx                  
push rdx                  
push rbx                  
push rbp                  
push rsi                  
push rdi                  
push r8                   
push r9                   
push r10                  
push r11                  
push r12                  
push r13                  
push r14                  
push r15                  
pushfq                    
sub rsp,8                 
;stmxcsr dword ptr ss:[rsp]
stmxcsr dword ptr [rsp]
xor r8, r8
xor rdx, rdx
call self
self:
pop rcx
add rcx, milk_offset
sub rsp, 20h; need the shadow stack or else it corrupts last 4 values on stack
call [LoadLibraryExW]
add rsp, 20h
;db 0ffh, 015h, 0, 0, 0, 0
;ldmxcsr dword ptr ss:[rsp]
ldmxcsr dword ptr [rsp]
add rsp,8
popfq
pop r15
pop r14
pop r13
pop r12
pop r11
pop r10
pop r9
pop r8
pop rdi
pop rsi
pop rbp
pop rbx
pop rdx
pop rcx
pop rax
jmp entrypoint
align 16
szMilk  dw 'm','i','l','k','y','.','d','l','l',0
start endp

org 0c0e8h
LoadLibraryExW dq 0

end
