.text .globl _start _start: cmpb $1,(rsp) je f push rsp pop r13 inc r14b movb r14b,bl shl $62,r14 dec (r13) call o1 push rax mov rbx,rdi push $04 pop rsi mov r9,rdx push $72 pop rax syscall pop rsi scat:mov rbx,rdi #simple cat call sf mov rax,rsi jmp scat csf:inc rdi # copy via sendfile can copy as many times the file as fd_set or add a close for infinity call o2 mov rax,rbx push $01101101 pop r8 call o1 push rax bcsf:pop rdi mov rbx,rsi call sf push rax mov rbx,rdi push $8 pop rax mov r9,rdx mov r12,rsi #lseek off_t switch r12 to r9 for 0 offset syscall jmp bcsf rcsf:inc rdi # reverse copy '=file' is created with following args files content push $01101101 pop r8 call o2 mov rax,rbx mov r9,r8 call o1 brcsf:mov rbx,rdi push rax pop rsi call sf jmp brcsf sf:push $40 pop rax mov r14,r10 mov r12,rdx # off_t of sendfile syscall cmp rbp,(r13) je f o1:inc rbp mov 8(r13,rbp,8),rdi movb (rdi),cl cmpb $'+',cl je a4 cmpb $'^',cl je a3 push $0777 pop rdx cmpb $61,cl je rcsf cmpb $58,cl je csf o2:push $2 pop rax mov r8,rsi syscall ret f:mov r12,rdi # exit with '^number' the offset push $231 pop rax syscall a4:inc rdi call toi mov rax,r14 jmp o1 a3:inc rdi call toi mov rax,r12 jmp o1 toi:#10d mov r9,rax mov r9,rcx push $10 pop rcx bai:mul rcx movb (rdi),dl sub $48,dl add rdx,rax inc rdi cmpb $0,(rdi) jne bai ret