section .data
    ; Data section to store strings
    userAgent db 'User-agent: *', 0Dh, 0Ah, 0
    allow db 'Allow: /', 0Dh, 0Ah, 0
    sitemap db 'Sitemap: https://jord.in/sitemap-index.xml', 0Dh, 0Ah, 0

section .text
    global _start

_start:
    ; Print User-agent string
    mov edx, userAgent   ; Load address of userAgent string into EDX
    call PrintString     ; Call subroutine to print string

    ; Print Allow string
    mov edx, allow       ; Load address of allow string into EDX
    call PrintString     ; Call subroutine to print string

    ; Print Sitemap string
    mov edx, sitemap     ; Load address of sitemap string into EDX
    call PrintString     ; Call subroutine to print string

    ; Exit program
    mov eax, 1           ; Syscall number for exit
    xor ebx, ebx         ; Status 0
    int 0x80             ; Make syscall

; Subroutine to print a null-terminated string
PrintString:
    mov eax, 4           ; Syscall number for sys_write
    mov ebx, 1           ; File descriptor (stdout)
    mov ecx, edx         ; Pointer to string
    mov edx, lenString   ; Calculate string length
    int 0x80             ; Make syscall
    ret

; Function to calculate string length (null-terminated)
lenString:
    push eax
    push ecx
    mov eax, 0
lenLoop:
    cmp byte [ecx+eax], 0 ; Compare current byte with null terminator
    je endLen             ; If it's 0, end
    inc eax               ; Increment length
    jmp lenLoop           ; Continue loop
endLen:
    pop ecx
    pop eax
    ret
