Skip to main content
1 of 4
user avatar
user avatar

x86 machine code, 39 bytes

00000000: 6a01 5e6a 055f 5251 31c0 39d1 0f44 c601  j.^j._RQ1.9..D..
00000010: d139 cf0f 44c6 595a 29d1 83f9 050f 44c6  .9..D.YZ).....D.
00000020: 83f9 fb0f 44c6 c3                        ....D..

Assembly

section .text
	global func
func:					;inputs int32_t ecx and edx
	push 0x1
	pop esi
	push 0x5
	pop edi
	push edx
	push ecx
	xor eax, eax

	;ecx==edx?
	cmp ecx, edx
	cmove eax, esi

	;ecx+edx==5?
	add ecx, edx
	cmp edi, ecx
	cmove eax, esi
	
	;ecx-edx==5?
	pop ecx
	pop edx
	sub ecx, edx
	cmp ecx, 5
	
	;ecx-edx==-5?
	cmove eax, esi
	cmp ecx, -5
	cmove eax, esi

	ret

Try it online!

user36046