I'm working on a program in ARM64 gcc 11.2 Assembly and am experiencing a bug that I do not know how to fix. The goal of this program is to recursively call a function on a double array of numbers, then print out the highest double. In C, this function is:
#include <stdio.h>
#define SIZE 10 
         
double arr[SIZE] = {6.221, 1.0,  14.1, 46.5, 62.1, 7.7, 4.4, 1.5, 500.023, 2.1}; // get the array
double max_value(double array[], int size) {
  
    if (size == 1) {
        return array[size - 1];
    } else {
        double max = max_value(array, size - 1);
        if (array[size - 1] > max)
            max = array[size - 1]; // iterate to the next index of the array
        return max;
    }
}
int main() {
    printf("%g\n", max_value(arr, SIZE)); // print`
    return 0;
}
With that in mind, I've written the following in ARM64 gcc 11.2:
.global _start // https://stackoverflow.com/questions/17898989/what-is-global-start-in-assembly-language
       // global_start adds _start to the object code, global is NASM specific
       // and it will start the file
.text 
.extern printf // start the file 
maxvalue:
        stp     x29, x30, [sp, -48]!
        mov     x29, sp
        str     x0, [sp, 24]
        str     w1, [sp, 20]
        ldr     w0, [sp, 20]
        cmp     w0, 1
        bne     .L2
        ldr   x0, [sp, 20]
        lsl     x0, x0, 3
        sub     x0, x0, #8
        ldr     x1, [sp, 24]
        add     x0, x1, x0
        ldr     d0, [x0]
        b       .L3
.L2:
        ldr     w0, [sp, 20]
        sub     w0, w0, #1
        mov     w1, w0
        ldr     x0, [sp, 24]
        bl      maxvalue
        str     d0, [sp, 40]
        ldr   x0, [sp, 20]
        lsl     x0, x0, 3
        sub     x0, x0, #8
        ldr     x1, [sp, 24]
        add     x0, x1, x0
        ldr     d0, [x0]
        ldr     d1, [sp, 40]
        fcmpe   d1, d0
        bmi     .L6
        b       .L4
.L6:
        ldr   x0, [sp, 20]
        lsl     x0, x0, 3
        sub     x0, x0, #8
        ldr     x1, [sp, 24]
        add     x0, x1, x0
        ldr     d0, [x0]
        str     d0, [sp, 40]
.L4:
        ldr     d0, [sp, 40]
.L3:
        ldp     x29, x30, [sp], 48
        
.LC0:
        .string "%g\n"
_start:
        stp     x29, x30, [sp, -16]!
        mov     x29, sp
        mov     w1, 10
        adrp    x0, arr
        add     x0, x0, :lo12:arr
        bl      maxvalue
        adrp    x0, .LC0
        add     x0, x0, :lo12:.LC0
        bl      printf
        // print a new line
        mov     w0, 10
        bl      putchar
        mov     w0, 0
        ldp     x29, x30, [sp], 16
         
.data
// declare an array - the one I'm using is below
//double arr[SIZE] = {6.221, 1.0,  14.1, 46.5, 62.1, 7.7, 4.4, 1.5, 500.023, 2.1}; // get the array
 
arr:
        .word   -755914244
        .word   1075372621
        .word   0
        .word   1072693248
        .word   858993459
        .word   1076638515
        .word   0
        .word   1078411264
        .word   -858993459
        .word   1078922444
        .word   -858993459
        .word   1075760332
        .word   -1717986918
        .word   1074895257
        .word   0
        .word   1073217536
        .word   893353198
        .word   1082081374
        .word   -858993459
        .word   1073794252
I'm getting these errors (screenshots with the terminal commands that I'm using & errors generated).


 
    