#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*/ isalpha(char);
int strcasecmp(char *, char *);
int cmpstr(const void *s1, const void *s2) {
  char *p1 = (char *)s1;
  char *p2 = (char *)s2;
  while (!isalpha(*p1))
    p1++;
  while (!isalpha(*p2))
    p2++;
  return strcasecmp(p1, p2);
}


x86 assembly (clang, -O0):
<cmpstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isalpha@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1161 <cmpstr+0x41>
jmp    1172 <cmpstr+0x52>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1140 <cmpstr+0x20>
jmp    1177 <cmpstr+0x57>
mov    -0x20(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isalpha@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1198 <cmpstr+0x78>
jmp    11a9 <cmpstr+0x89>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1177 <cmpstr+0x57>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcasecmp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmpstr>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
add    $0xffffffffffffffff,%rbx
xchg   %ax,%ax
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1040 <isalpha@plt>
test   %eax,%eax
je     1130 <cmpstr+0x10>
add    $0xffffffffffffffff,%r14
cs nopw 0x0(%rax,%rax,1)
nop
movsbl 0x1(%r14),%edi
add    $0x1,%r14
call   1040 <isalpha@plt>
test   %eax,%eax
je     1150 <cmpstr+0x30>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <strcasecmp@plt>

LLVM IR (-O0):
define i32 @cmpstr(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
store i8* %7, i8** %5
%8 = load i8*, i8** %4
store i8* %8, i8** %6
br label %9
9: ; preds = %15, %2
%10 = load i8*, i8** %5
%11 = load i8, i8* %10
%12 = call i32 @isalpha(i8 signext %11)
%13 = icmp ne i32 %12, 0
%14 = xor i1 %13, true
br i1 %14, label %15, label %18
15: ; preds = %9
%16 = load i8*, i8** %5
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %5
br label %9
18: ; preds = %9
br label %19
19: ; preds = %25, %18
%20 = load i8*, i8** %6
%21 = load i8, i8* %20
%22 = call i32 @isalpha(i8 signext %21)
%23 = icmp ne i32 %22, 0
%24 = xor i1 %23, true
br i1 %24, label %25, label %28
25: ; preds = %19
%26 = load i8*, i8** %6
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %6
br label %19
28: ; preds = %19
%29 = load i8*, i8** %5
%30 = load i8*, i8** %6
%31 = call i32 @strcasecmp(i8* %29, i8* %30)
ret i32 %31
}

LLVM IR (-O2):
define i32 @cmpstr(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %8, %3 ]
%5 = load i8, i8* %4
%6 = tail call i32 @isalpha(i8 signext %5)
%7 = icmp eq i32 %6, 0
%8 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %7, label %3, label %9
9: ; preds = %3, %9
%10 = phi i8* [ %14, %9 ], [ %1, %3 ]
%11 = load i8, i8* %10
%12 = tail call i32 @isalpha(i8 signext %11)
%13 = icmp eq i32 %12, 0
%14 = getelementptr inbounds i8, i8* %10, i64 1
br i1 %13, label %9, label %15
15: ; preds = %9
%16 = tail call i32 @strcasecmp(i8* %4, i8* %10)
ret i32 %16
}