In x86/x86_64 iret instruction is used to return to user space. Here, the iret instruction is used to return from an interrupt or system call and switch back to user mode. The iret instruction restores the CPU state from the stack, including the instruction pointer(IP), code segment(CS), and flags register(EFLAGS).