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

int ends_with(char str[], char end[]) {
    size_t sl = strlen(str), el = strlen(end);

    if (sl < el) { return 0; }

    for (size_t i = 1; i < el; i++) {
        if (str[sl - i] != end[el - i]) { return 0; }
    }

    return 1;
}

int main(void) {
	printf("%d\n", ends_with("abba.bmp", ".bmp"));
	printf("%d\n", ends_with("abba.png", ".bmp"));
	printf("%d\n", ends_with("", ".bmp"));
	return 0;
}
