int dontcare(fn)
char *fn;
{
  char *cp;
  if (fn[strlen(fn) - 1] == '~')
    return 1;
  cp = strrchr(fn, '.');
  return cp && (!strcmp(cp + 1, "Z") || !strcmp(cp + 1, "PS"));
}


x86 assembly (clang, -O0):
<dontcare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7e,%eax
jne    1171 <dontcare+0x41>
movl   $0x1,-0x4(%rbp)
jmp    11e7 <dontcare+0xb7>
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1040 <strrchr@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x18(%rbp)
mov    %al,-0x21(%rbp)
je     11dc <dontcare+0xac>
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
lea    0xe5e(%rip),%rsi
call   1050 <strcmp@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x22(%rbp)
je     11d6 <dontcare+0xa6>
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
lea    0xe3c(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x22(%rbp)
mov    -0x22(%rbp),%al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dontcare>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    $0x1,%ebp
cmpb   $0x7e,-0x1(%rax,%rbx,1)
je     118e <dontcare+0x5e>
mov    %rbx,%rdi
mov    $0x2e,%esi
call   1040 <strrchr@plt>
test   %rax,%rax
je     118c <dontcare+0x5c>
mov    %rax,%rbx
add    $0x1,%rbx
lea    0xe99(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     118e <dontcare+0x5e>
lea    0xe88(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
xor    %ebp,%ebp
test   %eax,%eax
sete   %bpl
jmp    118e <dontcare+0x5e>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"Z\00"
@.str.1 = [3 x i8] c"PS\00"
define i32 @dontcare(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = load i8*, i8** %3
%7 = call i64 @strlen(i8* %6)
%8 = sub i64 %7, 1
%9 = getelementptr inbounds i8, i8* %5, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 126
br i1 %12, label %13, label %14
13: ; preds = %1
store i32 1, i32* %2
br label %35
14: ; preds = %1
%15 = load i8*, i8** %3
%16 = call i8* @strrchr(i8* %15, i32 46)
store i8* %16, i8** %4
%17 = load i8*, i8** %4
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %32
19: ; preds = %14
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i64 1
%22 = call i32 @strcmp(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %30
24: ; preds = %19
%25 = load i8*, i8** %4
%26 = getelementptr inbounds i8, i8* %25, i64 1
%27 = call i32 @strcmp(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%28 = icmp ne i32 %27, 0
%29 = xor i1 %28, true
br label %30
30: ; preds = %24, %19
%31 = phi i1 [ true, %19 ], [ %29, %24 ]
br label %32
32: ; preds = %30, %14
%33 = phi i1 [ false, %14 ], [ %31, %30 ]
%34 = zext i1 %33 to i32
store i32 %34, i32* %2
br label %35
35: ; preds = %32, %13
%36 = load i32, i32* %2
ret i32 %36
}

LLVM IR (-O2):
@.str = [2 x i8] c"Z\00"
@.str.1 = [3 x i8] c"PS\00"
define i32 @dontcare(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add i64 %2, -1
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 126
br i1 %6, label %18, label %7
7: ; preds = %1
%8 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i32 46)
%9 = icmp eq i8* %8, null
br i1 %9, label %18, label %10
10: ; preds = %7
%11 = getelementptr inbounds i8, i8* %8, i64 1
%12 = tail call i32 @strcmp(i8* %11, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %10
%15 = tail call i32 @strcmp(i8* %11, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i32 %15, 0
%17 = zext i1 %16 to i32
br label %18
18: ; preds = %7, %14, %10, %1
%19 = phi i32 [ 1, %1 ], [ 0, %7 ], [ 1, %10 ], [ %17, %14 ]
ret i32 %19
}