strcmpBat that's unsafe.
if(*(u16*)*argv == 45)
if (postnum/10%10 == postnum%10)
puts("check 'em");
; eax = postnum
push 10
pop ecx
cdq
idiv ecx
push edx
idiv ecx
pop eax
cmp eax, edx
jnz notdubs
This is not even considering the stupid way it makes function calls and saves and restores registers that don't even need to be touched, otherwise it'd be even worse.
; first arg: pointer to null terminated string to check for dubs
; return value: 0 if dubs, non 0 if not dubs
dubs:
push rax
lodsb
test al, al
jz .L1
pop rdx
jmp dubs
.L1: pop rax
xor al, dl
ret
xor ecx, ecx
salc
dec ecx
repnz scasb
mov eax, [edi-3]
sub al, ah
ret
Another way to say it is, the only calling convention I care about is the one I make up, the one that fits the situation the best.I can only imagine what kind of horrifying spaghetti code that leads to. It's no wonder you've never been able to write anything more sophisticated than a FizzBuzz.
Today we are releasing inline-c, a package for writing mixed C/Haskell source code that seamlessly invokes native and foreign functions in the same module. No FFI required.
prime get