#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 *strtok(char *, char *);
char tolower(char);
int isTautogram(char poem[]) {
  char *word, delim[] = " ", firstWordChar;
  word = strtok(poem, delim);
  if (word == NULL)
    return 1;
  firstWordChar = tolower(word[0]);
  while (1) {
    word = strtok(NULL, delim);
    if (word == NULL)
      break;
    if (tolower(word[0]) != firstWordChar)
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<isTautogram>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    0xecd(%rip),%ax
mov    %ax,-0x1a(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x1a(%rbp),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    115f <isTautogram+0x3f>
movl   $0x1,-0x4(%rbp)
jmp    11c2 <isTautogram+0xa2>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <tolower@plt>
mov    %al,-0x1b(%rbp)
lea    -0x1a(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1040 <strtok@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    118f <isTautogram+0x6f>
jmp    11bb <isTautogram+0x9b>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <tolower@plt>
movsbl %al,%eax
movsbl -0x1b(%rbp),%ecx
cmp    %ecx,%eax
je     11b6 <isTautogram+0x96>
movl   $0x0,-0x4(%rbp)
jmp    11c2 <isTautogram+0xa2>
jmp    116e <isTautogram+0x4e>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isTautogram>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movw   $0x20,0xe(%rsp)
lea    0xe(%rsp),%rsi
call   1040 <strtok@plt>
mov    $0x1,%r14d
test   %rax,%rax
je     117e <isTautogram+0x5e>
movsbl (%rax),%edi
call   1030 <tolower@plt>
mov    %eax,%ebx
lea    0xe(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %edi,%edi
mov    %rbp,%rsi
call   1040 <strtok@plt>
test   %rax,%rax
je     117e <isTautogram+0x5e>
movsbl (%rax),%edi
call   1030 <tolower@plt>
cmp    %bl,%al
je     1160 <isTautogram+0x40>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.isTautogram.delim = [2 x i8] c" \00"
define i32 @isTautogram(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [2 x i8]
%6 = alloca i8
store i8* %0, i8** %3
%7 = bitcast [2 x i8]* %5 to i8*
%8 = load i8*, i8** %3
%9 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%10 = call i8* @strtok(i8* %8, i8* %9)
store i8* %10, i8** %4
%11 = load i8*, i8** %4
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %14
13: ; preds = %1
store i32 1, i32* %2
br label %37
14: ; preds = %1
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i64 0
%17 = load i8, i8* %16
%18 = call signext i8 @tolower(i8 signext %17)
store i8 %18, i8* %6
br label %19
19: ; preds = %14, %35
%20 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%21 = call i8* @strtok(i8* null, i8* %20)
store i8* %21, i8** %4
%22 = load i8*, i8** %4
%23 = icmp eq i8* %22, null
br i1 %23, label %24, label %25
24: ; preds = %19
br label %36
25: ; preds = %19
%26 = load i8*, i8** %4
%27 = getelementptr inbounds i8, i8* %26, i64 0
%28 = load i8, i8* %27
%29 = call signext i8 @tolower(i8 signext %28)
%30 = sext i8 %29 to i32
%31 = load i8, i8* %6
%32 = sext i8 %31 to i32
%33 = icmp ne i32 %30, %32
br i1 %33, label %34, label %35
34: ; preds = %25
store i32 0, i32* %2
br label %37
35: ; preds = %25
br label %19
36: ; preds = %24
store i32 1, i32* %2
br label %37
37: ; preds = %36, %34, %13
%38 = load i32, i32* %2
ret i32 %38
}

LLVM IR (-O2):
define i32 @isTautogram(i8* %0) {
%2 = alloca i16
%3 = bitcast i16* %2 to i8*
store i16 32, i16* %2
%4 = call i8* @strtok(i8* %0, i8* %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %16, label %6
6: ; preds = %1
%7 = load i8, i8* %4
%8 = tail call signext i8 @tolower(i8 signext %7)
br label %9
9: ; preds = %12, %6
%10 = call i8* @strtok(i8* null, i8* %3)
%11 = icmp eq i8* %10, null
br i1 %11, label %16, label %12
12: ; preds = %9
%13 = load i8, i8* %10
%14 = tail call signext i8 @tolower(i8 signext %13)
%15 = icmp eq i8 %14, %8
br i1 %15, label %9, label %16
16: ; preds = %9, %12, %1
%17 = phi i32 [ 1, %1 ], [ 1, %9 ], [ 0, %12 ]
ret i32 %17
}