#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*/ strlen(char *);
scalar_t__ strncmp(char *, char *, int /*<<< orphan*/);
int strmatch(char *str, char *token, int *indent) {
  int i = 0;
  while (*str == ' ' || *str == '\t') {
    str++;
    i++;
  }
  if (strncmp(str, token, strlen(token)) != 0)
    return 0;
  if (indent != NULL)
    *indent = i;
  return 1;
}


x86 assembly (clang, -O0):
<strmatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x25(%rbp)
je     1160 <strmatch+0x40>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
test   $0x1,%al
jne    1170 <strmatch+0x50>
jmp    118a <strmatch+0x6a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    113b <strmatch+0x1b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     11c8 <strmatch+0xa8>
movl   $0x0,-0x4(%rbp)
jmp    11e3 <strmatch+0xc3>
cmpq   $0x0,-0x20(%rbp)
je     11dc <strmatch+0xbc>
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strmatch>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
xor    %ebx,%ebx
jmp    1144 <strmatch+0x24>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rbx
movzbl (%r12,%rbx,1),%eax
cmp    $0x20,%al
je     1140 <strmatch+0x20>
cmp    $0x9,%al
je     1140 <strmatch+0x20>
mov    %r15,%rdi
call   1040 <strlen@plt>
add    %rbx,%r12
mov    %r12,%rdi
mov    %r15,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    1180 <strmatch+0x60>
mov    $0x1,%eax
test   %r14,%r14
je     1180 <strmatch+0x60>
mov    %ebx,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @strmatch(i8* %0, i8* %1, i32* writeonly %2) {
br label %4
4: ; preds = %8, %3
%5 = phi i8* [ %0, %3 ], [ %9, %8 ]
%6 = phi i32 [ 0, %3 ], [ %10, %8 ]
%7 = load i8, i8* %5
switch i8 %7, label %11 [
i8 32, label %8
i8 9, label %8
]
8: ; preds = %4, %4
%9 = getelementptr inbounds i8, i8* %5, i64 1
%10 = add nuw nsw i32 %6, 1
br label %4
11: ; preds = %4
%12 = tail call i32 @strlen(i8* %1)
%13 = tail call i64 @strncmp(i8* %5, i8* %1, i32 %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = icmp eq i32* %2, null
br i1 %16, label %18, label %17
17: ; preds = %15
store i32 %6, i32* %2
br label %18
18: ; preds = %15, %17, %11
%19 = phi i32 [ 0, %11 ], [ 1, %17 ], [ 1, %15 ]
ret i32 %19
}