#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 */
char *copyString(char *);
int /*<<< orphan*/ free(char *);
scalar_t__ listContains(char **, char *);
int strlen(char *);
char *strtok(char *, char *);
bool lineHasLongOpt(char *line, char **list) {
  char *copy = copyString(line);
  char *token = strtok(copy, " ,;\n");
  int len = strlen(token);
  for (int i = 0; token && len > 1 && token[0] == '-'; i++) {
    if (len >= 3 && token[0] == '-' && token[1] == '-' &&
        listContains(list, &token[2])) {
      free(copy);
      return true;
    }
    token = strtok(NULL, " ,;\n");
    if (token)
      len = strlen(token);
    else
      len = 0;
  }
  free(copy);
  return false;
}


x86 assembly (clang, -O0):
<lineHasLongOpt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <copyString@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe88(%rip),%rsi
call   1070 <strtok@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x28(%rbp)
mov    %al,-0x31(%rbp)
je     11c3 <lineHasLongOpt+0x73>
xor    %eax,%eax
cmpl   $0x1,-0x2c(%rbp)
mov    %al,-0x31(%rbp)
jle    11c3 <lineHasLongOpt+0x73>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
sete   %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
test   $0x1,%al
jne    11d3 <lineHasLongOpt+0x83>
jmp    1278 <lineHasLongOpt+0x128>
cmpl   $0x3,-0x2c(%rbp)
jl     122e <lineHasLongOpt+0xde>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    122e <lineHasLongOpt+0xde>
mov    -0x28(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2d,%eax
jne    122e <lineHasLongOpt+0xde>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
add    $0x2,%rsi
call   1060 <listContains@plt>
cmp    $0x0,%rax
je     122e <lineHasLongOpt+0xde>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
jmp    1288 <lineHasLongOpt+0x138>
xor    %eax,%eax
mov    %eax,%edi
lea    0xdc7(%rip),%rsi
call   1070 <strtok@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     125e <lineHasLongOpt+0x10e>
mov    -0x28(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x2c(%rbp)
jmp    1265 <lineHasLongOpt+0x115>
movl   $0x0,-0x2c(%rbp)
jmp    126a <lineHasLongOpt+0x11a>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1194 <lineHasLongOpt+0x44>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lineHasLongOpt>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r14
call   1040 <copyString@plt>
mov    %rax,%r15
lea    0xe95(%rip),%rsi
mov    %rax,%rdi
call   1070 <strtok@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <strlen@plt>
test   %rbx,%rbx
je     11d8 <lineHasLongOpt+0x88>
cmp    $0x2,%eax
jl     11d8 <lineHasLongOpt+0x88>
lea    0xe71(%rip),%r12
nop
cmpb   $0x2d,(%rbx)
jne    11d8 <lineHasLongOpt+0x88>
cmp    $0x3,%eax
jb     11b4 <lineHasLongOpt+0x64>
cmpb   $0x2d,0x1(%rbx)
jne    11b4 <lineHasLongOpt+0x64>
add    $0x2,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <listContains@plt>
test   %rax,%rax
jne    11f0 <lineHasLongOpt+0xa0>
xor    %r13d,%r13d
xor    %edi,%edi
mov    %r12,%rsi
call   1070 <strtok@plt>
test   %rax,%rax
je     11db <lineHasLongOpt+0x8b>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <strlen@plt>
cmp    $0x1,%eax
jg     1190 <lineHasLongOpt+0x40>
jmp    11db <lineHasLongOpt+0x8b>
xor    %r13d,%r13d
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r13d,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
mov    $0x1,%r13d
jmp    11db <lineHasLongOpt+0x8b>

LLVM IR (-O0):
@.str = [5 x i8] c" ,;\0A\00"
define i32 @lineHasLongOpt(i8* %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
%10 = load i8*, i8** %4
%11 = call i8* @copyString(i8* %10)
store i8* %11, i8** %6
%12 = load i8*, i8** %6
%13 = call i8* @strtok(i8* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %13, i8** %7
%14 = load i8*, i8** %7
%15 = call i32 @strlen(i8* %14)
store i32 %15, i32* %8
store i32 0, i32* %9
br label %16
16: ; preds = %63, %2
%17 = load i8*, i8** %7
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %28
19: ; preds = %16
%20 = load i32, i32* %8
%21 = icmp sgt i32 %20, 1
br i1 %21, label %22, label %28
22: ; preds = %19
%23 = load i8*, i8** %7
%24 = getelementptr inbounds i8, i8* %23, i64 0
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 45
br label %28
28: ; preds = %22, %19, %16
%29 = phi i1 [ false, %19 ], [ false, %16 ], [ %27, %22 ]
br i1 %29, label %30, label %66
30: ; preds = %28
%31 = load i32, i32* %8
%32 = icmp sge i32 %31, 3
br i1 %32, label %33, label %54
33: ; preds = %30
%34 = load i8*, i8** %7
%35 = getelementptr inbounds i8, i8* %34, i64 0
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 45
br i1 %38, label %39, label %54
39: ; preds = %33
%40 = load i8*, i8** %7
%41 = getelementptr inbounds i8, i8* %40, i64 1
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 45
br i1 %44, label %45, label %54
45: ; preds = %39
%46 = load i8**, i8*** %5
%47 = load i8*, i8** %7
%48 = getelementptr inbounds i8, i8* %47, i64 2
%49 = call i64 @listContains(i8** %46, i8* %48)
%50 = icmp ne i64 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %45
%52 = load i8*, i8** %6
%53 = call i32 @free(i8* %52)
store i32 1, i32* %3
br label %69
54: ; preds = %45, %39, %33, %30
%55 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %55, i8** %7
%56 = load i8*, i8** %7
%57 = icmp ne i8* %56, null
br i1 %57, label %58, label %61
58: ; preds = %54
%59 = load i8*, i8** %7
%60 = call i32 @strlen(i8* %59)
store i32 %60, i32* %8
br label %62
61: ; preds = %54
store i32 0, i32* %8
br label %62
62: ; preds = %61, %58
br label %63
63: ; preds = %62
%64 = load i32, i32* %9
%65 = add nsw i32 %64, 1
store i32 %65, i32* %9
br label %16
66: ; preds = %28
%67 = load i8*, i8** %6
%68 = call i32 @free(i8* %67)
store i32 0, i32* %3
br label %69
69: ; preds = %66, %51
%70 = load i32, i32* %3
ret i32 %70
}

LLVM IR (-O2):
@.str = [5 x i8] c" ,;\0A\00"
define i32 @lineHasLongOpt(i8* %0, i8** %1) {
%3 = tail call i8* @copyString(i8* %0)
%4 = tail call i8* @strtok(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @strlen(i8* %4)
%6 = icmp ne i8* %4, null
%7 = icmp sgt i32 %5, 1
%8 = select i1 %6, i1 %7, i1 false
br i1 %8, label %9, label %30
9: ; preds = %2, %27
%10 = phi i32 [ %28, %27 ], [ %5, %2 ]
%11 = phi i8* [ %25, %27 ], [ %4, %2 ]
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 45
br i1 %13, label %14, label %30
14: ; preds = %9
%15 = icmp ugt i32 %10, 2
br i1 %15, label %16, label %24
16: ; preds = %14
%17 = getelementptr inbounds i8, i8* %11, i64 1
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 45
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = getelementptr inbounds i8, i8* %11, i64 2
%22 = tail call i64 @listContains(i8** %1, i8* %21)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %30
24: ; preds = %20, %16, %14
%25 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%26 = icmp eq i8* %25, null
br i1 %26, label %30, label %27
27: ; preds = %24
%28 = tail call i32 @strlen(i8* %25)
%29 = icmp sgt i32 %28, 1
br i1 %29, label %9, label %30
30: ; preds = %27, %9, %24, %20, %2
%31 = phi i32 [ 0, %2 ], [ 1, %20 ], [ 0, %24 ], [ 0, %9 ], [ 0, %27 ]
%32 = tail call i32 @free(i8* %3)
ret i32 %31
}