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


// TODO: Implement a helper named check_permissions that matches the prototype below.
int check_permissions(char *permission, char *file) {
    for (int i = 0; i < 9; i++) {
        if (permission[i] != file[i]) {
            return 1;
        }
    } return 0;
}





int main(int argc, char** argv) {
    if (!(argc == 2 || argc == 3)) {
        fprintf(stderr, "USAGE: count_large size [permissions]\n");
        return 1;
    }

    // TODO: Process command line arguments.
     int loop = (argc == 2);
                                  printf("loop:%d", loop);

    int check_size = strtol(argv[1], NULL, 10);
    char perm[10];
    int size, count;
    count = 0;
    int cycle = 0;
    scanf("%*s %*s");
    while (scanf("%s %*d %*s %*s %d %*s %*s %*s %*s", perm, &size) == 2){
        printf("cycle :%d", cycle); cycle++;
            if (perm[0] == '-') {
                    printf("cycle :%d", cycle); cycle++;
            if (size > check_size){
                if (loop ==0){
                    count++;
                } else {
                    if (check_permissions(&perm[1], argv[2])==0){
                        count++;
                    }
                }
            }
        }
    }
    printf("cycle :%d", cycle); cycle++;
    printf("%d\n", count);
    return 0;
}
return a count of ls -l file sizes larger than value parameter provided. If second parameter is 9 element permissions, the count is of files larger than first parameter that also match permissions.