#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 const *matchSpaces(char const *);
scalar_t__ tolower(char const);
const char *matchTerminal(const char *src, char terminal) {
  return terminal == ' '                      ? matchSpaces(src)
         : tolower(*src) == tolower(terminal) ? src + 1
                                              : NULL;
}


x86 assembly (clang, -O0):
<matchTerminal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x20,%eax
jne    1151 <matchTerminal+0x31>
mov    -0x8(%rbp),%rdi
call   1030 <matchSpaces@plt>
mov    %rax,-0x18(%rbp)
jmp    119e <matchTerminal+0x7e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1040 <tolower@plt>
mov    %rax,-0x20(%rbp)
movsbl -0x9(%rbp),%edi
call   1040 <tolower@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
jne    118b <matchTerminal+0x6b>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1196 <matchTerminal+0x76>
xor    %eax,%eax
mov    %rax,-0x28(%rbp)
jmp    1196 <matchTerminal+0x76>
mov    -0x28(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matchTerminal>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%rbx
cmp    $0x20,%bpl
jne    113b <matchTerminal+0x1b>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <matchSpaces@plt>
movsbl (%rbx),%edi
call   1040 <tolower@plt>
mov    %rax,%r14
movsbl %bpl,%edi
call   1040 <tolower@plt>
add    $0x1,%rbx
xor    %ecx,%ecx
cmp    %rax,%r14
cmove  %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @matchTerminal(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 32
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = call i8* @matchSpaces(i8* %9)
br label %24
11: ; preds = %2
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = call i64 @tolower(i8 signext %13)
%15 = load i8, i8* %4
%16 = call i64 @tolower(i8 signext %15)
%17 = icmp eq i64 %14, %16
br i1 %17, label %18, label %21
18: ; preds = %11
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i64 1
br label %22
21: ; preds = %11
br label %22
22: ; preds = %21, %18
%23 = phi i8* [ %20, %18 ], [ null, %21 ]
br label %24
24: ; preds = %22, %8
%25 = phi i8* [ %10, %8 ], [ %23, %22 ]
ret i8* %25
}

LLVM IR (-O2):
define i8* @matchTerminal(i8* %0, i8 signext %1) {
%3 = icmp eq i8 %1, 32
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i8* @matchSpaces(i8* %0)
br label %13
6: ; preds = %2
%7 = load i8, i8* %0
%8 = tail call i64 @tolower(i8 signext %7)
%9 = tail call i64 @tolower(i8 signext %1)
%10 = icmp eq i64 %8, %9
%11 = getelementptr inbounds i8, i8* %0, i64 1
%12 = select i1 %10, i8* %11, i8* null
br label %13
13: ; preds = %6, %4
%14 = phi i8* [ %5, %4 ], [ %12, %6 ]
ret i8* %14
}