#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*/ startsWith(char *, char *);
int startsWithWord(char *, char *);
size_t strlen(char *);
int startsWithWordByDelimiter(char *firstWord, char delimit, char *line) {
  if (delimit == ' ')
    return startsWithWord(firstWord, line);
  if (!startsWith(firstWord, line))
    return 0;
  char c = line[strlen(firstWord)];
  return (c == '\0' || c == delimit);
}


x86 assembly (clang, -O0):
<startsWithWordByDelimiter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    %rdx,-0x20(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x20,%eax
jne    1168 <startsWithWordByDelimiter+0x38>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <startsWithWord@plt>
mov    %eax,-0x4(%rbp)
jmp    11d5 <startsWithWordByDelimiter+0xa5>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <startsWith@plt>
cmp    $0x0,%eax
jne    118a <startsWithWordByDelimiter+0x5a>
movl   $0x0,-0x4(%rbp)
jmp    11d5 <startsWithWordByDelimiter+0xa5>
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
mov    (%rax,%rcx,1),%al
mov    %al,-0x21(%rbp)
movsbl -0x21(%rbp),%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x22(%rbp)
je     11ca <startsWithWordByDelimiter+0x9a>
movsbl -0x21(%rbp),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
mov    %al,-0x22(%rbp)
mov    -0x22(%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):
<startsWithWordByDelimiter>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
cmp    $0x20,%bpl
jne    1151 <startsWithWordByDelimiter+0x21>
mov    %rbx,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <startsWithWord@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <startsWith@plt>
test   %eax,%eax
je     117e <startsWithWordByDelimiter+0x4e>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    (%r14,%rax,1),%al
test   %al,%al
sete   %cl
cmp    %bpl,%al
sete   %al
or     %cl,%al
movzbl %al,%eax
jmp    1180 <startsWithWordByDelimiter+0x50>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @startsWithWordByDelimiter(i8* %0, i8 signext %1, i8* %2) {
%4 = icmp eq i8 %1, 32
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @startsWithWord(i8* %0, i8* %2)
br label %18
7: ; preds = %3
%8 = tail call i32 @startsWith(i8* %0, i8* %2)
%9 = icmp eq i32 %8, 0
br i1 %9, label %18, label %10
10: ; preds = %7
%11 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%12 = getelementptr inbounds i8, i8* %2, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
%15 = icmp eq i8 %13, %1
%16 = or i1 %14, %15
%17 = zext i1 %16 to i32
br label %18
18: ; preds = %7, %10, %5
%19 = phi i32 [ %6, %5 ], [ %17, %10 ], [ 0, %7 ]
ret i32 %19
}