#define RANGE_START 1 #define RANGE_END 100 #define FIZZ_SPAN 6 #define BUZZ_SPAN 7 asm { _BUZZ_FIZZ:: PUSH RBP MOV RBP,RSP //Always set-up stk frame. (Stack Gets Traced) PUSH RSI //See REGG_LOCAL_VARS & REGG_LOCAL_NON_PTR_VARS PUSH RDI MOV RSI,FIZZ_SPAN-RANGE_START%FIZZ_SPAN+1 MOV RDI,BUZZ_SPAN-RANGE_START%BUZZ_SPAN+1 MOV RAX,RANGE_START @@05: CALL PUT_HEX_U64 PUSH RAX MOV RAX,CH_SPACE CALL PUT_CHARS DEC RSI JNZ @@10 MOV RAX,'FIZZ ' CALL PUT_CHARS MOV RSI,FIZZ_SPAN @@10: DEC RDI JNZ @@15 MOV RAX,'BUZZ ' CALL PUT_CHARS MOV RDI,BUZZ_SPAN @@15: MOV RAX,'\n' CALL PUT_CHARS POP RAX INC RAX CMP RAX,RANGE_END //Actually only a 32-bit inst. JBE @@05 POP RDI POP RSI POP RBP RET } Call(_BUZZ_FIZZ); /* _BUZZ_FIZZ+0x0000 55 PUSH U64 RBP _BUZZ_FIZZ+0x0001 488BEC MOV U64 RBP,U64 RSP _BUZZ_FIZZ+0x0004 56 PUSH U64 RSI _BUZZ_FIZZ+0x0005 57 PUSH U64 RDI _BUZZ_FIZZ+0x0006 BE06000000 MOV U32 ESI,U32 00000006 _BUZZ_FIZZ+0x000B BF07000000 MOV U32 EDI,U32 00000007 _BUZZ_FIZZ+0x0010 B801000000 MOV U32 EAX,U32 00000001 _BUZZ_FIZZ+0x0015 E8C51F2BC0 CALL I32 PUT_HEX_U64+0x0000 _BUZZ_FIZZ+0x001A 50 PUSH U64 RAX _BUZZ_FIZZ+0x001B B820000000 MOV U32 EAX,U32 00000020 _BUZZ_FIZZ+0x0020 E81E202BC0 CALL I32 PUT_CHARS+0x0000 _BUZZ_FIZZ+0x0025 48FFCE DEC U64 RSI _BUZZ_FIZZ+0x0028 7514 JNZ I8 _BUZZ_FIZZ+0x003E _BUZZ_FIZZ+0x002A 48B846495A5A MOV U64 RAX,I64 000000205A5A4946 _BUZZ_FIZZ+0x0030 20000000 _BUZZ_FIZZ+0x0034 E80A202BC0 CALL I32 PUT_CHARS+0x0000 _BUZZ_FIZZ+0x0039 BE06000000 MOV U32 ESI,U32 00000006 _BUZZ_FIZZ+0x003E 48FFCF DEC U64 RDI _BUZZ_FIZZ+0x0041 7514 JNZ I8 _BUZZ_FIZZ+0x0057 _BUZZ_FIZZ+0x0043 48B842555A5A MOV U64 RAX,I64 000000205A5A5542 _BUZZ_FIZZ+0x0049 20000000 _BUZZ_FIZZ+0x004D E8F11F2BC0 CALL I32 PUT_CHARS+0x0000 _BUZZ_FIZZ+0x0052 BF07000000 MOV U32 EDI,U32 00000007 _BUZZ_FIZZ+0x0057 B80A000000 MOV U32 EAX,U32 0000000A _BUZZ_FIZZ+0x005C E8E21F2BC0 CALL I32 PUT_CHARS+0x0000 _BUZZ_FIZZ+0x0061 58 POP U64 RAX _BUZZ_FIZZ+0x0062 48FFC0 INC U64 RAX _BUZZ_FIZZ+0x0065 4883F864 CMP U64 RAX,I8 64 _BUZZ_FIZZ+0x0069 76AA JNA I8 _BUZZ_FIZZ+0x0015 _BUZZ_FIZZ+0x006B 5F POP U64 RDI _BUZZ_FIZZ+0x006C 5E POP U64 RSI _BUZZ_FIZZ+0x006D 5D POP U64 RBP _BUZZ_FIZZ+0x006E C3 RET 0000000000000001 0000000000000002 0000000000000003 0000000000000004 0000000000000005 0000000000000006 FIZZ 0000000000000007 BUZZ 0000000000000008 0000000000000009 000000000000000A 000000000000000B 000000000000000C FIZZ 000000000000000D 000000000000000E BUZZ 000000000000000F 0000000000000010 0000000000000011 0000000000000012 FIZZ 0000000000000013 0000000000000014 0000000000000015 BUZZ 0000000000000016 0000000000000017 0000000000000018 FIZZ 0000000000000019 000000000000001A 000000000000001B 000000000000001C BUZZ 000000000000001D 000000000000001E FIZZ 000000000000001F 0000000000000020 0000000000000021 0000000000000022 0000000000000023 BUZZ 0000000000000024 FIZZ 0000000000000025 0000000000000026 0000000000000027 0000000000000028 0000000000000029 000000000000002A FIZZ BUZZ 000000000000002B 000000000000002C 000000000000002D 000000000000002E 000000000000002F 0000000000000030 FIZZ 0000000000000031 BUZZ 0000000000000032 0000000000000033 0000000000000034 0000000000000035 0000000000000036 FIZZ 0000000000000037 0000000000000038 BUZZ 0000000000000039 000000000000003A 000000000000003B 000000000000003C FIZZ 000000000000003D 000000000000003E 000000000000003F BUZZ 0000000000000040 0000000000000041 0000000000000042 FIZZ 0000000000000043 0000000000000044 0000000000000045 0000000000000046 BUZZ 0000000000000047 0000000000000048 FIZZ 0000000000000049 000000000000004A 000000000000004B 000000000000004C 000000000000004D BUZZ 000000000000004E FIZZ 000000000000004F 0000000000000050 0000000000000051 0000000000000052 0000000000000053 0000000000000054 FIZZ BUZZ 0000000000000055 0000000000000056 0000000000000057 0000000000000058 0000000000000059 000000000000005A FIZZ 000000000000005B BUZZ 000000000000005C 000000000000005D 000000000000005E 000000000000005F 0000000000000060 FIZZ 0000000000000061 0000000000000062 BUZZ 0000000000000063 0000000000000064 */