Pls debug this code matched bracket question

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

int top = -1;

int isempty() {
    if (top == -1) {
        return 1;
    }
    return 0;
}

int isfull(int n) {
    if (top == n - 1) {
        return 1;
    }
    return 0;
}

void push(int arr[], int x, int n) {
    if (isfull(n) == 1) {
        printf("full\n");
        return;
    }
    top++;
    arr[top] = x;
    return;
}

int pop(int arr[]) {
    if (isempty() == 1) {
        printf("underflow\n");
        return -1;
    }
    int x = arr[top];
    top--;
    return x;
}

int main() {
    int n;
    scanf("%d", &n);
    int br[n];
    for (int i = 0; i < n; i++) {
        scanf("%d", &br[i]);
    }
    int arr[n];
    int c = 0;
    int max = 0;
    for (int i = 0; i < n; i++) {
        if (br[i] == 1) {
            c++;
        } else {
            if (max < c) {
                max = c;
            }
            c =0;
        }
    }
    int c1 = 0;
    int i = 0;
    while (c1 != max) {
        if (br[i] == 1) {
            c1++;
            i++;
        } else {
            c1--;
            i++;
        }
    }
    int c2 = 0;
    int m1 = 0;
    for (int i = 0; i < n; i++) {
        if (br[i] == 1) {
            push(arr, br[i], n);
            c2++;
        } else {
            int x = pop(arr);
            if (isempty() == 1) {
                if (m1 < c2) {
                    m1 = c2;
                }
                c2 = 0;
            } else {
                c2++;
            }
        }
    }
    int arr1[n];
    int l = 0;
    int j = 0;
    while (l != m1) {
        if (br[j] == 1) {
            push(arr1, br[j], n);
            l++;
            j++;
        } else {
            int x = pop(arr1);
            if (isempty() == 1) {
                l = 0;
                j++;
            } else {
                l++;
                j++;
            }
        }
    }
    printf("%d %d %d %d\n", max,i,m1+1,j-l+1);//, i, m1 + 1, j - l);
    return 0;
}