C++ keyword: asm

Declaration of an inline assembly block

# Example

#include <cstring>
 
int main() noexcept
{
    const char* const c_string = "Hello, world!\n";
    asm
    (R"(
        movq $1, %%rax                 # syscall number for sys_write
        movq $1, %%rdi                 # file descriptor 1 (stdout)
        movq %0, %%rsi                 # pointer to the cstring
        movq %1, %%rdx                 # length of the cstring
        syscall                        # invokes an OS system-call handler
    )"
    :                                  // no output operands
    :   "r"(c_string),                 // input: pointer to the c‐string
        "r"(std::strlen(c_string))     // input: size of the c‐string
    :   "%rax", "%rdi", "%rsi", "%rdx" // clobbered registers
    );
}