#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ stringcmp(char *, char *);
int strlen(char *);
int isfasta(char *p) {
  int len, i;
  len = strlen(p);
  for (i = len - 1; *(p + i) != '.'; i--)
    ;
  if (!stringcmp(p + i, ".fasta") || !stringcmp(p + i, ".fa"))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<isfasta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
je     1169 <isfasta+0x49>
jmp    115b <isfasta+0x3b>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1141 <isfasta+0x21>
mov    -0x10(%rbp),%rdi
movslq -0x18(%rbp),%rax
add    %rax,%rdi
lea    0xe85(%rip),%rsi
call   1040 <stringcmp@plt>
cmp    $0x0,%eax
je     11a9 <isfasta+0x89>
mov    -0x10(%rbp),%rdi
movslq -0x18(%rbp),%rax
add    %rax,%rdi
lea    0xe6c(%rip),%rsi
call   1040 <stringcmp@plt>
cmp    $0x0,%eax
jne    11b5 <isfasta+0x95>
movl   $0x1,-0x4(%rbp)
jmp    11bc <isfasta+0x9c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isfasta>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
movslq %eax,%rbx
add    %r14,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmpb   $0x2e,-0x1(%rbx)
lea    -0x1(%rbx),%rbx
jne    1140 <isfasta+0x20>
lea    0xeaf(%rip),%rsi
mov    %rbx,%rdi
call   1040 <stringcmp@plt>
test   %eax,%eax
je     1177 <isfasta+0x57>
lea    0xea3(%rip),%rsi
mov    %rbx,%rdi
call   1040 <stringcmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
jmp    117c <isfasta+0x5c>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c".fasta\00"
@.str.1 = [4 x i8] c".fa\00"
define i32 @isfasta(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = sub nsw i32 %8, 1
store i32 %9, i32* %5
br label %10
10: ; preds = %19, %1
%11 = load i8*, i8** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 46
br i1 %17, label %18, label %22
18: ; preds = %10
br label %19
19: ; preds = %18
%20 = load i32, i32* %5
%21 = add nsw i32 %20, -1
store i32 %21, i32* %5
br label %10
22: ; preds = %10
%23 = load i8*, i8** %3
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
%27 = call i32 @stringcmp(i8* %26, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %36
29: ; preds = %22
%30 = load i8*, i8** %3
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = call i32 @stringcmp(i8* %33, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%35 = icmp ne i32 %34, 0
br i1 %35, label %37, label %36
36: ; preds = %29, %22
store i32 1, i32* %2
br label %38
37: ; preds = %29
store i32 0, i32* %2
br label %38
38: ; preds = %37, %36
%39 = load i32, i32* %2
ret i32 %39
}

LLVM IR (-O2):
@.str = [7 x i8] c".fasta\00"
@.str.1 = [4 x i8] c".fa\00"
define i32 @isfasta(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = sext i32 %2 to i64
br label %4
4: ; preds = %4, %1
%5 = phi i64 [ %6, %4 ], [ %3, %1 ]
%6 = add i64 %5, -1
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 46
br i1 %9, label %10, label %4
10: ; preds = %4
%11 = getelementptr inbounds i8, i8* %0, i64 %6
%12 = tail call i32 @stringcmp(i8* %11, i8* getelementptr inbounds ([7 x i8], [7 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 @stringcmp(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 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 = %14, %10
%19 = phi i32 [ 1, %10 ], [ %17, %14 ]
ret i32 %19
}