getting 0xBAADF00D and not getting all data when assembling a file

I made 16 bit a computer in logisim and want to assemble some code for it but when that i don’t get all that data and i get BAAD FOOD BAAD FOOD BAAD
my assembly code is:
ADD 3 3 3
and i want to get:
1300 0003 0003 0003
but i get
1300 0003 0003 BAAD F00D BAAD F00D BAAD
my code is:

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>

typedef struct Node {
    int16_t value;
    struct Node* next;
} Node;

int linkedListSize(Node* start){
    int size = 0;
    Node* curr = start;
    while (curr!= NULL){
        size++;
        if (curr -> next == 0xbaadf00dbaadf00d) break;
        curr = curr->next;
    }
    return size;
}

int isDigit(char *string, int size){
    char *digits = "0123456789";
    for (int i = 0; i < size; i ++){
        int in = 0;
        for (int x = 0; x < 10; x ++){
            if (string[i] == digits[x]){
                in = 1;
                break;
            }
        }
        if (in == 0){
            return 0;
        }
    }
    return 1;
}

// Corrected to accept the length of the string as an argument
int toDigit(char *string, int len){
    char *digits = "0123456789";
    int value = 0;
    int neg = string[0] == '-';
    for (int i = neg; i < len; i++){
        for (int x = 0; x < 10; x++){
            if (string[i] == digits[x]){
                value *= 10;
                value += x;
                break;
            }
        }
    }
    if (neg) value = -value;
    return value;
}

// Corrected to return a dynamically allocated array
int16_t* makeLikedList(Node* start){
    int size = linkedListSize(start);
    int16_t *list = (int16_t *)malloc(size * 16);

    int idx = 0;
    Node* curr = start;
    while (curr != NULL){
        if (curr -> next == 0xbaadf00dbaadf00d) break;
        list[idx] = curr->value;
        idx ++;
        curr = curr->next;
    }
    return list;
}

// Corrected loop condition
char *stringToYFromX(char *string, int x, int y){
    char *newString = (char *)malloc(y-x+1); // Allocate space for the null terminator
    for (int i = x; i < y; i++){
        newString[i-x] = string[i];
    }
    newString[y-x] = ''; // Ensure the string is null-terminated
    return newString;
}

int main(int argc, char *argv[]){
    if (argc!= 3){
        printf("Error: invalid argsn");
        return 1;
    }
    FILE *assemblyFile;
    int assemblySize;
    char *assemblyCode;
    assemblyFile = fopen(argv[1],"rb");
    
    fseek(assemblyFile, 0, SEEK_END); 
    assemblySize = ftell(assemblyFile);
    fseek(assemblyFile, 0, SEEK_SET); 

    assemblyCode = (char*) malloc(assemblySize + 1);
    fread(assemblyCode, 1, assemblySize, assemblyFile);
    assemblyCode[assemblySize] = '';   

    FILE *binFile;
    Node* binListStart = (Node*)malloc(sizeof(Node));
    binFile = fopen(argv[2],"wb");

    char *curr;
    int currSize = 0;
    int currStart = 0;
    int count = 0;
    Node* opNode;
    Node* currNode = binListStart;
    for (int i = 0; i < assemblySize; i ++){
        if (assemblyCode[i] == ' '){
            count += 1;
            if ((count - 1) % 4 == 0){
                opNode = currNode;
            }
            curr = (char*) malloc(currSize + 1);
            for (int x = 0; x < currSize; x++){
                curr[x] = assemblyCode[currStart+x];
            }
            curr[currSize] = '';
            if (strcmp(curr,"ADD")==0){
                currNode -> value = 0x1000;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"SUB")==0){
                currNode -> value = 0x1001;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"MUL")==0){
                currNode -> value = 0x1002;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"DIV")==0){
                currNode -> value = 0x1003;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"MOD")==0){
                currNode -> value = 0x1004;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"SHL")==0){
                currNode -> value = 0x1005;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"SHR")==0){
                currNode -> value = 0x1006;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"ASHR")==0){
                currNode -> value = 0x1008;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"RSHL")==0){
                currNode -> value = 0x1009;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"RSHR")==0){
                currNode -> value = 0x100a;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"AND")==0){
                currNode -> value = 0x100b;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"OR")==0){
                currNode -> value = 0x100c;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"XOR")==0){
                currNode -> value = 0x100d;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"NOT")==0){
                currNode -> value = 0x100e;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"NAND")==0){
                currNode -> value = 0x100f;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"NOR")==0){
                currNode -> value = 0x1010;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"XNOR")==0){
                currNode -> value = 0x1011;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"JE")==0){
                currNode -> value = 0x2000;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"JNE")==0){
                currNode -> value = 0x2001;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"JL")==0){
                currNode -> value = 0x2002;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"JG")==0){
                currNode -> value = 0x2003;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"JLE")==0){
                currNode -> value = 0x2004;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"JGE")==0){
                currNode -> value = 0x2005;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"LOAD")==0){
                currNode -> value = 0x3000;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"MOV")==0){
                currNode -> value = 0x3001;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"RLD")==0){
                currNode -> value = 0x4000;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"RMV")==0){
                currNode -> value = 0x4001;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"RGT")==0){
                currNode -> value = 0x4002;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"PUSH")==0){
                currNode -> value = 0x5000;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (strcmp(curr,"POP")==0){
                currNode -> value = 0x5001;
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (isDigit(curr,currSize) == 1){
                if ((count - 1) % 4 == 0){
                    printf("Error: invalid tokenntoken number: %dntoken: %s",count,curr);
                    return 1;
                }
                switch ((count - 1) % 4)
                {
                case 1:
                    opNode->value += 0x0100;
                    break;
                case 2:
                    opNode->value += 0x0200;
                    break;
                }
                currNode -> value = toDigit(curr,currSize);
                currNode->next = (Node*)malloc(sizeof(Node));
            } else if (curr[0] == 'r'){
                curr = stringToYFromX(curr,1,currSize);
                if ((count - 1) % 4 == 3 && isDigit(curr,currSize) == 0){
                    printf("Error: invalid tokenntoken number: %dntoken: r%s",count,curr);
                    return 1;
                }
                currNode -> value = toDigit(curr,currSize);
                currNode->next = (Node*)malloc(sizeof(Node));
            } else {
                printf("Error: invalid tokenntoken number: %dntoken: %s",count,curr);
                return 1;
            }
            currNode = currNode -> next;
            curr = NULL;
            currSize = 0;
            currStart = i+1;
        }
        else{
            currSize ++;
        }
    }
    fwrite(makeLikedList(binListStart), sizeof(int), linkedListSize(binListStart), binFile);
    fclose(assemblyFile);
    fclose(binFile);
}

I tried adding buffers to stop baadfood in my linked list functions. Even if anyone could tell me why I’m getting BAADF00D in parts would help.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật