#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 nmatch(char, char);
int strlen(char *);
bool wmatch(char *word) {
  for (int i = 0; i < strlen(word) - 1; i++) {
    if (nmatch(word[i], word[i + 1]) == false)
      return false;
  }
  return true;
}


x86 assembly (clang, -O0):
<wmatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    119e <wmatch+0x7e>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl %dl,%edi
movsbl (%rax,%rcx,1),%esi
call   1040 <nmatch@plt>
cmp    $0x0,%eax
jne    118b <wmatch+0x6b>
movl   $0x0,-0x4(%rbp)
jmp    11a5 <wmatch+0x85>
jmp    1190 <wmatch+0x70>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1133 <wmatch+0x13>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wmatch>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %r12d,%r12d
xchg   %ax,%ax
mov    %r12,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
add    $0xffffffff,%eax
movslq %eax,%r15
cmp    %r15,%r12
jge    115e <wmatch+0x3e>
movsbl (%r14,%rbx,1),%edi
lea    0x1(%rbx),%r12
movsbl 0x1(%r14,%rbx,1),%esi
call   1040 <nmatch@plt>
test   %eax,%eax
jne    1130 <wmatch+0x10>
xor    %eax,%eax
cmp    %r15,%rbx
setge  %al
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @wmatch(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
br label %5
5: ; preds = %27, %1
%6 = load i32, i32* %4
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
%9 = sub nsw i32 %8, 1
%10 = icmp slt i32 %6, %9
br i1 %10, label %11, label %30
11: ; preds = %5
%12 = load i8*, i8** %3
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = load i8*, i8** %3
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %17, i64 %20
%22 = load i8, i8* %21
%23 = call i32 @nmatch(i8 signext %16, i8 signext %22)
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %11
store i32 0, i32* %2
br label %31
26: ; preds = %11
br label %27
27: ; preds = %26
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %5
30: ; preds = %5
store i32 1, i32* %2
br label %31
31: ; preds = %30, %25
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
define i32 @wmatch(i8* %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i64 [ %11, %8 ], [ 0, %1 ]
%4 = tail call i32 @strlen(i8* %0)
%5 = add nsw i32 %4, -1
%6 = sext i32 %5 to i64
%7 = icmp slt i64 %3, %6
br i1 %7, label %8, label %16
8: ; preds = %2
%9 = getelementptr inbounds i8, i8* %0, i64 %3
%10 = load i8, i8* %9
%11 = add nuw nsw i64 %3, 1
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = tail call i32 @nmatch(i8 signext %10, i8 signext %13)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %2
16: ; preds = %8, %2
%17 = xor i1 %7, true
%18 = zext i1 %17 to i32
ret i32 %18
}