/* 
 * File:        hello.s
 * Description: Prints a warm, friendly greeting.
 */

        .arch   armv8-a                 // The CPU type
        .global main                    // Make main available to the linker

        .text                           // Start of the text (code) segment
        .align  2                       // Align code on an address divisible by 4

main:                                   // The main function
        stp     fp, lr, [sp,-16]!       // Push the frame pointer and link register
        mov     fp, sp                  // Copy the stack pointer to the frame pointer
        
        adr     x0, fmt                 // Pass the format string in x0
        bl      printf                  // Call printf

        mov     x0, #0                  // Put the return value for main into x0
        ldp     fp, lr, [sp], 16        // Pop the frame pointer and link register
        ret                             // Return from main
        
        .section .rodata                // Start of the readonly data section

fmt:    .string "Hello, world!\n"       // The format string for printf
