Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (declaim (optimize (speed 3) (space 0) (safety 0) (debug 0) (compilation-speed 0)))
- (defconstant data '(1 2 3))
- (defun solution ()
- (let ((acc '(0)))
- (loop
- (dolist (n data)
- (declare (type integer n))
- (let ((new-freq (+ n (the integer (car acc)))))
- (declare (type integer new-freq))
- (if (find new-freq acc)
- (return-from solution new-freq)
- (push new-freq acc)))))))
- ; disassembly for SOLUTION
- ; Size: 197 bytes. Origin: #x52D1C7B7
- ; 7B7: 4C8B0DB2FFFFFF MOV R9, [RIP-78] ; no-arg-parsing entry point
- ; '(0)
- ; 7BE: 6690 NOP
- ; 7C0: L0: 4C8B15B1FFFFFF MOV R10, [RIP-79] ; '(1 2 3)
- ; 7C7: E981000000 JMP L7
- ; 7CC: 0F1F4000 NOP
- ; 7D0: L1: 498B52F9 MOV RDX, [R10-7]
- ; 7D4: 498B4201 MOV RAX, [R10+1]
- ; 7D8: 4C8BD0 MOV R10, RAX
- ; 7DB: 4C894DF8 MOV [RBP-8], R9
- ; 7DF: 4C8955F0 MOV [RBP-16], R10
- ; 7E3: 498B79F9 MOV RDI, [R9-7]
- ; 7E7: FF1425A8001052 CALL QWORD PTR [#x521000A8] ; GENERIC-+
- ; 7EE: 488BF2 MOV RSI, RDX
- ; 7F1: 4C8B55F0 MOV R10, [RBP-16]
- ; 7F5: 4C8B4DF8 MOV R9, [RBP-8]
- ; 7F9: 498BD9 MOV RBX, R9
- ; 7FC: EB19 JMP L3
- ; 7FE: 6690 NOP
- ; 800: L2: 4C8B43F9 MOV R8, [RBX-7]
- ; 804: 488BD6 MOV RDX, RSI
- ; 807: 498BF8 MOV RDI, R8
- ; 80A: FF1425F0001052 CALL QWORD PTR [#x521000F0] ; %EQL/INTEGER
- ; 811: 744C JEQ L8
- ; 813: 488B5B01 MOV RBX, [RBX+1]
- ; 817: L3: 4881FB17001050 CMP RBX, #x50100017 ; NIL
- ; 81E: 75E0 JNE L2
- ; 820: L4: 49896D40 MOV [R13+64], RBP ; thread.pseudo-atomic-bits
- ; 824: 4D8B5D20 MOV R11, [R13+32] ; thread.alloc-region
- ; 828: 498D4310 LEA RAX, [R11+16]
- ; 82C: 493B4528 CMP RAX, [R13+40]
- ; 830: 773F JNBE L9
- ; 832: 49894520 MOV [R13+32], RAX ; thread.alloc-region
- ; 836: L5: 498D4307 LEA RAX, [R11+7]
- ; 83A: 49316D40 XOR [R13+64], RBP ; thread.pseudo-atomic-bits
- ; 83E: 7402 JEQ L6
- ; 840: CC09 BREAK 9 ; pending interrupt trap
- ; 842: L6: 488970F9 MOV [RAX-7], RSI
- ; 846: 4C894801 MOV [RAX+1], R9
- ; 84A: 4C8BC8 MOV R9, RAX
- ; 84D: L7: 4981FA17001050 CMP R10, #x50100017 ; NIL
- ; 854: 0F8466FFFFFF JEQ L0
- ; 85A: E971FFFFFF JMP L1
- ; 85F: L8: 4981F817001050 CMP R8, #x50100017 ; NIL
- ; 866: 74B8 JEQ L4
- ; 868: 488BD6 MOV RDX, RSI
- ; 86B: 488BE5 MOV RSP, RBP
- ; 86E: F8 CLC
- ; 86F: 5D POP RBP
- ; 870: C3 RET
- ; 871: L9: 6A10 PUSH 16
- ; 873: FF142528001052 CALL QWORD PTR [#x52100028] ; ALLOC-TRAMP-R11
- ; 87A: EBBA JMP L5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement