#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 strlen(char *);
int /*<<< orphan*/ strncasecmp(char *, char *, int);
int skip_word(char **data, char *word) {
  int minsize =
      ((strlen(*data)) < (strlen(word)) ? (strlen(*data)) : (strlen(word)));
  if (!strncasecmp(*data, word, minsize) && (minsize == strlen(word))) {
    *data += minsize;
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<skip_word>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jge    1169 <skip_word+0x49>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
jmp    1175 <skip_word+0x55>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <strncasecmp@plt>
cmp    $0x0,%eax
jne    11d2 <skip_word+0xb2>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
cmp    %ecx,%eax
jne    11d2 <skip_word+0xb2>
mov    -0x1c(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
movslq %edx,%rdx
add    %rdx,%rcx
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    11d9 <skip_word+0xb9>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_word>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rdi),%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
cmp    %eax,%ebp
jge    1149 <skip_word+0x29>
mov    (%r14),%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    (%r14),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <strncasecmp@plt>
xor    %r15d,%r15d
test   %eax,%eax
jne    117c <skip_word+0x5c>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    %eax,%ebp
jne    117c <skip_word+0x5c>
movslq %ebp,%rax
add    %rax,(%r14)
mov    $0x1,%r15d
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @skip_word(i8** nocapture %0, i8* %1) {
%3 = load i8*, i8** %0
%4 = tail call i32 @strlen(i8* %3)
%5 = tail call i32 @strlen(i8* %1)
%6 = icmp slt i32 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = load i8*, i8** %0
br label %9
9: ; preds = %2, %7
%10 = phi i8* [ %8, %7 ], [ %1, %2 ]
%11 = tail call i32 @strlen(i8* %10)
%12 = load i8*, i8** %0
%13 = tail call i32 @strncasecmp(i8* %12, i8* %1, i32 %11)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %22
15: ; preds = %9
%16 = tail call i32 @strlen(i8* %1)
%17 = icmp eq i32 %11, %16
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = load i8*, i8** %0
%20 = sext i32 %11 to i64
%21 = getelementptr inbounds i8, i8* %19, i64 %20
store i8* %21, i8** %0
br label %22
22: ; preds = %9, %15, %18
%23 = phi i32 [ 1, %18 ], [ 0, %15 ], [ 0, %9 ]
ret i32 %23
}