#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 */
char *skipEverything(char const *);
char *skipIdentifier(char const *);
int /*<<< orphan*/ strncmp(char const *, char *, int);
const char *findDefinitionOrClass(const char *cp) {
  while (*cp) {
    cp = skipEverything(cp);
    if (!strncmp(cp, "def", 3) || !strncmp(cp, "class", 5) ||
        !strncmp(cp, "cdef", 4) || !strncmp(cp, "cpdef", 5)) {
      return cp;
    }
    cp = skipIdentifier(cp);
  }
  return NULL;
}


x86 assembly (clang, -O0):
<findDefinitionOrClass>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11ed <findDefinitionOrClass+0xbd>
mov    -0x10(%rbp),%rdi
call   1050 <skipEverything@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
je     11ce <findDefinitionOrClass+0x9e>
mov    -0x10(%rbp),%rdi
lea    0xe81(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
je     11ce <findDefinitionOrClass+0x9e>
mov    -0x10(%rbp),%rdi
lea    0xe69(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
je     11ce <findDefinitionOrClass+0x9e>
mov    -0x10(%rbp),%rdi
lea    0xe50(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    11db <findDefinitionOrClass+0xab>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11f5 <findDefinitionOrClass+0xc5>
mov    -0x10(%rbp),%rdi
call   1040 <skipIdentifier@plt>
mov    %rax,-0x10(%rbp)
jmp    113c <findDefinitionOrClass+0xc>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findDefinitionOrClass>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
cmpb   $0x0,(%rdi)
je     11d8 <findDefinitionOrClass+0xa8>
mov    %rdi,%rax
lea    0xebb(%rip),%r12
lea    0xead(%rip),%r14
lea    0xeac(%rip),%r15
lea    0xeaa(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rax,%rdi
call   1050 <skipEverything@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r12,%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     11da <findDefinitionOrClass+0xaa>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     11da <findDefinitionOrClass+0xaa>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     11da <findDefinitionOrClass+0xaa>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     11da <findDefinitionOrClass+0xaa>
mov    %rbx,%rdi
call   1040 <skipIdentifier@plt>
cmpb   $0x0,(%rax)
jne    1170 <findDefinitionOrClass+0x40>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"def\00"
@.str.1 = [6 x i8] c"class\00"
@.str.2 = [5 x i8] c"cdef\00"
@.str.3 = [6 x i8] c"cpdef\00"
define i8* @findDefinitionOrClass(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
br label %4
4: ; preds = %28, %1
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %31
8: ; preds = %4
%9 = load i8*, i8** %3
%10 = call i8* @skipEverything(i8* %9)
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = call i32 @strncmp(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %26
14: ; preds = %8
%15 = load i8*, i8** %3
%16 = call i32 @strncmp(i8* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 5)
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %26
18: ; preds = %14
%19 = load i8*, i8** %3
%20 = call i32 @strncmp(i8* %19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4)
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load i8*, i8** %3
%24 = call i32 @strncmp(i8* %23, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 5)
%25 = icmp ne i32 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %22, %18, %14, %8
%27 = load i8*, i8** %3
store i8* %27, i8** %2
br label %32
28: ; preds = %22
%29 = load i8*, i8** %3
%30 = call i8* @skipIdentifier(i8* %29)
store i8* %30, i8** %3
br label %4
31: ; preds = %4
store i8* null, i8** %2
br label %32
32: ; preds = %31, %26
%33 = load i8*, i8** %2
ret i8* %33
}

LLVM IR (-O2):
@.str = [4 x i8] c"def\00"
@.str.1 = [6 x i8] c"class\00"
@.str.2 = [5 x i8] c"cdef\00"
@.str.3 = [6 x i8] c"cpdef\00"
define i8* @findDefinitionOrClass(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %22, label %4
4: ; preds = %1, %18
%5 = phi i8* [ %19, %18 ], [ %0, %1 ]
%6 = tail call i8* @skipEverything(i8* %5)
%7 = tail call i32 @strncmp(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%8 = icmp eq i32 %7, 0
br i1 %8, label %22, label %9
9: ; preds = %4
%10 = tail call i32 @strncmp(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 5)
%11 = icmp eq i32 %10, 0
br i1 %11, label %22, label %12
12: ; preds = %9
%13 = tail call i32 @strncmp(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4)
%14 = icmp eq i32 %13, 0
br i1 %14, label %22, label %15
15: ; preds = %12
%16 = tail call i32 @strncmp(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 5)
%17 = icmp eq i32 %16, 0
br i1 %17, label %22, label %18
18: ; preds = %15
%19 = tail call i8* @skipIdentifier(i8* %6)
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 0
br i1 %21, label %22, label %4
22: ; preds = %15, %12, %9, %4, %18, %1
%23 = phi i8* [ null, %1 ], [ null, %18 ], [ %6, %4 ], [ %6, %9 ], [ %6, %12 ], [ %6, %15 ]
ret i8* %23
}