#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*/ dup2(int, int);
int execlp(char *, char *, char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int worker_start(int fd, int case_sensitive) {
  char *cs = (case_sensitive ? "-c" : "");
  dup2(fd, 0);
  dup2(fd, 1);
  if (execlp("gln_tokens", "gln_tokens", cs, (char *)NULL) == -1) {
    fprintf(stderr, "worker execlp fail (is gln_tokens in your path?)\n");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<worker_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edx
lea    0xef7(%rip),%rax
lea    0xeb1(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
xor    %esi,%esi
call   1030 <dup2@plt>
mov    -0x8(%rbp),%edi
mov    $0x1,%esi
call   1030 <dup2@plt>
mov    -0x18(%rbp),%rdx
lea    0xe87(%rip),%rsi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rsi,%rdi
call   1050 <execlp@plt>
cmp    $0xffffffff,%eax
jne    11b2 <worker_start+0x82>
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
lea    0xe6d(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b9 <worker_start+0x89>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<worker_start>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebp
test   %esi,%esi
lea    0xf00(%rip),%rax
lea    0xeba(%rip),%rbx
cmove  %rax,%rbx
xor    %r14d,%r14d
xor    %esi,%esi
call   1030 <dup2@plt>
mov    %ebp,%edi
mov    $0x1,%esi
call   1030 <dup2@plt>
lea    0xe9c(%rip),%rdi
mov    %rdi,%rsi
mov    %rbx,%rdx
xor    %ecx,%ecx
call   1050 <execlp@plt>
cmp    $0xffffffff,%eax
jne    1194 <worker_start+0x64>
mov    0x2e60(%rip),%rax
mov    (%rax),%edi
lea    0xe85(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"-c\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [11 x i8] c"gln_tokens\00"
@stderr = global i32 0
@.str.3 = [50 x i8] c"worker execlp fail (is gln_tokens in your path?)\0A\00"
define i32 @worker_start(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* %5
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0)
store i8* %10, i8** %6
%11 = load i32, i32* %4
%12 = call i32 @dup2(i32 %11, i32 0)
%13 = load i32, i32* %4
%14 = call i32 @dup2(i32 %13, i32 1)
%15 = load i8*, i8** %6
%16 = call i32 @execlp(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %15, i8* null)
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %21
18: ; preds = %2
%19 = load i32, i32* @stderr
%20 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %3
br label %22
21: ; preds = %2
store i32 0, i32* %3
br label %22
22: ; preds = %21, %18
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@.str = [3 x i8] c"-c\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [11 x i8] c"gln_tokens\00"
@stderr = global i32 0
@.str.3 = [50 x i8] c"worker execlp fail (is gln_tokens in your path?)\0A\00"
define i32 @worker_start(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = select i1 %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)
%5 = tail call i32 @dup2(i32 %0, i32 0)
%6 = tail call i32 @dup2(i32 %0, i32 1)
%7 = tail call i32 @execlp(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %4, i8* null)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0))
br label %12
12: ; preds = %2, %9
%13 = phi i32 [ -1, %9 ], [ 0, %2 ]
ret i32 %13
}