#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 EOF;
int /*<<< orphan*/ getmatch(int *, char *);
int strindex(int c[], char s[]) {
  c[1] = 0;
  c[2] = -1;
  while (c[0] != EOF) {
    getmatch(c, s);
    if (c[0] == '\n')
      break;
  }
  if (c[2] > -1)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<strindex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x0,0x4(%rax)
mov    -0x10(%rbp),%rax
movl   $0xffffffff,0x8(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2ea5(%rip),%rcx
cmp    (%rcx),%eax
je     116f <strindex+0x5f>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <getmatch@plt>
mov    -0x10(%rbp),%rax
cmpl   $0xa,(%rax)
jne    116a <strindex+0x5a>
jmp    116f <strindex+0x5f>
jmp    1136 <strindex+0x26>
mov    -0x10(%rbp),%rax
cmpl   $0xffffffff,0x8(%rax)
jle    1189 <strindex+0x79>
movl   $0x1,-0x4(%rbp)
jmp    1190 <strindex+0x80>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strindex>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
movabs $0xffffffff00000000,%rax
ff ff ff
mov    %rax,0x4(%rdi)
mov    (%rdi),%eax
mov    0x2eb6(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    (%r15),%eax
je     1157 <strindex+0x47>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <getmatch@plt>
mov    (%rbx),%eax
cmp    $0xa,%eax
jne    1140 <strindex+0x30>
mov    0x8(%rbx),%eax
not    %eax
shr    $0x1f,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @strindex(i32* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8*
store i32* %0, i32** %4
store i8* %1, i8** %5
%6 = load i32*, i32** %4
%7 = getelementptr inbounds i32, i32* %6, i64 1
store i32 0, i32* %7
%8 = load i32*, i32** %4
%9 = getelementptr inbounds i32, i32* %8, i64 2
store i32 -1, i32* %9
br label %10
10: ; preds = %25, %2
%11 = load i32*, i32** %4
%12 = getelementptr inbounds i32, i32* %11, i64 0
%13 = load i32, i32* %12
%14 = load i32, i32* @EOF
%15 = icmp ne i32 %13, %14
br i1 %15, label %16, label %26
16: ; preds = %10
%17 = load i32*, i32** %4
%18 = load i8*, i8** %5
%19 = call i32 @getmatch(i32* %17, i8* %18)
%20 = load i32*, i32** %4
%21 = getelementptr inbounds i32, i32* %20, i64 0
%22 = load i32, i32* %21
%23 = icmp eq i32 %22, 10
br i1 %23, label %24, label %25
24: ; preds = %16
br label %26
25: ; preds = %16
br label %10
26: ; preds = %24, %10
%27 = load i32*, i32** %4
%28 = getelementptr inbounds i32, i32* %27, i64 2
%29 = load i32, i32* %28
%30 = icmp sgt i32 %29, -1
br i1 %30, label %31, label %32
31: ; preds = %26
store i32 1, i32* %3
br label %33
32: ; preds = %26
store i32 0, i32* %3
br label %33
33: ; preds = %32, %31
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @strindex(i32* %0, i8* %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 1
store i32 0, i32* %3
%4 = getelementptr inbounds i32, i32* %0, i64 2
store i32 -1, i32* %4
%5 = load i32, i32* %0
br label %6
6: ; preds = %10, %2
%7 = phi i32 [ %12, %10 ], [ %5, %2 ]
%8 = load i32, i32* @EOF
%9 = icmp eq i32 %7, %8
br i1 %9, label %14, label %10
10: ; preds = %6
%11 = tail call i32 @getmatch(i32* %0, i8* %1)
%12 = load i32, i32* %0
%13 = icmp eq i32 %12, 10
br i1 %13, label %14, label %6
14: ; preds = %10, %6
%15 = load i32, i32* %4
%16 = xor i32 %15, -1
%17 = lshr i32 %16, 31
ret i32 %17
}