#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*/ eFree(char *const);
char *eStrdup(char *);
char *getExecutableName();
int /*<<< orphan*/ setEtagsMode();
int /*<<< orphan*/ *strstr(char *const, char *const);
int /*<<< orphan*/ verbose(char *);
extern void testEtagsInvocation(void) {
  char *const execName = eStrdup(getExecutableName());
  char *const etags = eStrdup("etags");
  if (strstr(execName, etags) != NULL) {
    verbose("Running in etags mode\n");
    setEtagsMode();
  }
  eFree(execName);
  eFree(etags);
}


x86 assembly (clang, -O0):
<testEtagsInvocation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <getExecutableName@plt>
mov    %rax,%rdi
call   1060 <eStrdup@plt>
mov    %rax,-0x8(%rbp)
lea    0xe7e(%rip),%rdi
call   1060 <eStrdup@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <strstr@plt>
cmp    $0x0,%rax
je     11b5 <testEtagsInvocation+0x55>
lea    0xe5d(%rip),%rdi
call   1070 <verbose@plt>
mov    $0x0,%al
call   1050 <setEtagsMode@plt>
mov    -0x8(%rbp),%rdi
call   1030 <eFree@plt>
mov    -0x10(%rbp),%rdi
call   1030 <eFree@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testEtagsInvocation>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getExecutableName@plt>
mov    %rax,%rdi
call   1060 <eStrdup@plt>
mov    %rax,%r14
lea    0xe83(%rip),%rdi
call   1060 <eStrdup@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1080 <strstr@plt>
test   %rax,%rax
je     11a8 <testEtagsInvocation+0x48>
lea    0xe6a(%rip),%rdi
call   1070 <verbose@plt>
xor    %eax,%eax
call   1050 <setEtagsMode@plt>
mov    %r14,%rdi
call   1030 <eFree@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <eFree@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"etags\00"
@.str.1 = [23 x i8] c"Running in etags mode\0A\00"
define void @testEtagsInvocation() {
%1 = alloca i8*
%2 = alloca i8*
%3 = call i8* (...) @getExecutableName()
%4 = call i8* @eStrdup(i8* %3)
store i8* %4, i8** %1
%5 = call i8* @eStrdup(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** %2
%6 = load i8*, i8** %1
%7 = load i8*, i8** %2
%8 = call i32* @strstr(i8* %6, i8* %7)
%9 = icmp ne i32* %8, null
br i1 %9, label %10, label %13
10: ; preds = %0
%11 = call i32 @verbose(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 (...) @setEtagsMode()
br label %13
13: ; preds = %10, %0
%14 = load i8*, i8** %1
%15 = call i32 @eFree(i8* %14)
%16 = load i8*, i8** %2
%17 = call i32 @eFree(i8* %16)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"etags\00"
@.str.1 = [23 x i8] c"Running in etags mode\0A\00"
define void @testEtagsInvocation() {
%1 = tail call i8* (...) @getExecutableName()
%2 = tail call i8* @eStrdup(i8* %1)
%3 = tail call i8* @eStrdup(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32* @strstr(i8* dereferenceable(1) %2, i8* dereferenceable(1) %3)
%5 = icmp eq i32* %4, null
br i1 %5, label %9, label %6
6: ; preds = %0
%7 = tail call i32 @verbose(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 (...) @setEtagsMode()
br label %9
9: ; preds = %6, %0
%10 = tail call i32 @eFree(i8* %2)
%11 = tail call i32 @eFree(i8* %3)
ret void
}