#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 */
scalar_t__ iswordpart(char);
char *str_quotefin2(char *, char);
char *word_find_any(char *s) {
  for (; *s; s++) {
    switch (*s) {
    case '"':
    case '\'':
      s = str_quotefin2(s + 1, *s);
      if (!s)
        return NULL;
      break;
    }
    if (iswordpart(*s))
      return s;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<word_find_any>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11d0 <word_find_any+0xb0>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
sub    $0x22,%eax
je     1162 <word_find_any+0x42>
jmp    1151 <word_find_any+0x31>
mov    -0x14(%rbp),%eax
sub    $0x27,%eax
jne    1197 <word_find_any+0x77>
jmp    1162 <word_find_any+0x42>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rax
movsbl (%rax),%esi
call   1040 <str_quotefin2@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1192 <word_find_any+0x72>
movq   $0x0,-0x8(%rbp)
jmp    11d8 <word_find_any+0xb8>
jmp    1197 <word_find_any+0x77>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <iswordpart@plt>
cmp    $0x0,%rax
je     11ba <word_find_any+0x9a>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11d8 <word_find_any+0xb8>
jmp    11bf <word_find_any+0x9f>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    112c <word_find_any+0xc>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<word_find_any>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     116d <word_find_any+0x4d>
mov    %rdi,%rbx
nopw   0x0(%rax,%rax,1)
movsbl %al,%esi
cmp    $0x27,%esi
je     113d <word_find_any+0x1d>
cmp    $0x22,%esi
jne    1154 <word_find_any+0x34>
add    $0x1,%rbx
mov    %rbx,%rdi
call   1040 <str_quotefin2@plt>
test   %rax,%rax
je     116d <word_find_any+0x4d>
mov    %rax,%rbx
movzbl (%rax),%eax
movsbl %al,%edi
call   1030 <iswordpart@plt>
test   %rax,%rax
jne    116f <word_find_any+0x4f>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <word_find_any+0x10>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @word_find_any(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
br label %4
4: ; preds = %30, %1
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %33
8: ; preds = %4
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
switch i32 %11, label %22 [
i32 34, label %12
i32 39, label %12
]
12: ; preds = %8, %8
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i64 1
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = call i8* @str_quotefin2(i8* %14, i8 signext %16)
store i8* %17, i8** %3
%18 = load i8*, i8** %3
%19 = icmp ne i8* %18, null
br i1 %19, label %21, label %20
20: ; preds = %12
store i8* null, i8** %2
br label %34
21: ; preds = %12
br label %22
22: ; preds = %8, %21
%23 = load i8*, i8** %3
%24 = load i8, i8* %23
%25 = call i64 @iswordpart(i8 signext %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %22
%28 = load i8*, i8** %3
store i8* %28, i8** %2
br label %34
29: ; preds = %22
br label %30
30: ; preds = %29
%31 = load i8*, i8** %3
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %3
br label %4
33: ; preds = %4
store i8* null, i8** %2
br label %34
34: ; preds = %33, %27, %20
%35 = load i8*, i8** %2
ret i8* %35
}

LLVM IR (-O2):
define i8* @word_find_any(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %23, label %4
4: ; preds = %1, %19
%5 = phi i8 [ %21, %19 ], [ %2, %1 ]
%6 = phi i8* [ %20, %19 ], [ %0, %1 ]
%7 = sext i8 %5 to i32
switch i32 %7, label %14 [
i32 34, label %8
i32 39, label %8
]
8: ; preds = %4, %4
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = tail call i8* @str_quotefin2(i8* %9, i8 signext %5)
%11 = icmp eq i8* %10, null
br i1 %11, label %23, label %12
12: ; preds = %8
%13 = load i8, i8* %10
br label %14
14: ; preds = %12, %4
%15 = phi i8 [ %5, %4 ], [ %13, %12 ]
%16 = phi i8* [ %6, %4 ], [ %10, %12 ]
%17 = tail call i64 @iswordpart(i8 signext %15)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %14
%20 = getelementptr inbounds i8, i8* %16, i64 1
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 0
br i1 %22, label %23, label %4
23: ; preds = %8, %14, %19, %1
%24 = phi i8* [ null, %1 ], [ null, %19 ], [ %16, %14 ], [ null, %8 ]
ret i8* %24
}