#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 */
scalar_t__ strcmp(char *, char *);
char *strtok(char *, char *);
bool searchDuplicitySections(char **sections, char *last, unsigned int index) {
  char *tokenLast = strtok(last, " \t\n\v\f\r[]");
  for (unsigned int i = 0; i < index; i++) {
    char *tokenElement = strtok(sections[i], " \t\n\v\f\r[]");
    if (strcmp(tokenElement, tokenLast) == 0) {
      return true;
    }
  }
  return false;
}


x86 assembly (clang, -O0):
<searchDuplicitySections>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xec2(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jae    11ab <searchDuplicitySections+0x8b>
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
mov    (%rax,%rcx,8),%rdi
lea    0xe94(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1198 <searchDuplicitySections+0x78>
movl   $0x1,-0x4(%rbp)
jmp    11b2 <searchDuplicitySections+0x92>
jmp    119d <searchDuplicitySections+0x7d>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    114e <searchDuplicitySections+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<searchDuplicitySections>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%ebp
mov    %rsi,%rax
mov    %rdi,%r14
lea    0xec9(%rip),%rsi
mov    %rax,%rdi
call   1040 <strtok@plt>
test   %ebp,%ebp
je     11b2 <searchDuplicitySections+0x92>
mov    %rax,%r12
mov    (%r14),%rdi
lea    0xeb0(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,%rdi
mov    %r12,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11b6 <searchDuplicitySections+0x96>
mov    %ebp,%ebp
mov    $0x1,%ecx
lea    0xe8d(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rcx,%rbx
cmp    %rcx,%rbp
je     11a8 <searchDuplicitySections+0x88>
mov    (%r14,%rbx,8),%rdi
mov    %r15,%rsi
call   1040 <strtok@plt>
mov    %rax,%rdi
mov    %r12,%rsi
call   1030 <strcmp@plt>
lea    0x1(%rbx),%rcx
test   %rax,%rax
jne    1180 <searchDuplicitySections+0x60>
xor    %eax,%eax
cmp    %rbp,%rbx
setb   %al
jmp    11bb <searchDuplicitySections+0x9b>
xor    %eax,%eax
jmp    11bb <searchDuplicitySections+0x9b>
mov    $0x1,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c" \09\0A\0B\0C\0D[]\00"
define i32 @searchDuplicitySections(i8** %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
store i8** %0, i8*** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%11 = load i8*, i8** %6
%12 = call i8* @strtok(i8* %11, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i8* %12, i8** %8
store i32 0, i32* %9
br label %13
13: ; preds = %30, %3
%14 = load i32, i32* %9
%15 = load i32, i32* %7
%16 = icmp ult i32 %14, %15
br i1 %16, label %17, label %33
17: ; preds = %13
%18 = load i8**, i8*** %5
%19 = load i32, i32* %9
%20 = zext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = call i8* @strtok(i8* %22, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i8* %23, i8** %10
%24 = load i8*, i8** %10
%25 = load i8*, i8** %8
%26 = call i64 @strcmp(i8* %24, i8* %25)
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %17
store i32 1, i32* %4
br label %34
29: ; preds = %17
br label %30
30: ; preds = %29
%31 = load i32, i32* %9
%32 = add i32 %31, 1
store i32 %32, i32* %9
br label %13
33: ; preds = %13
store i32 0, i32* %4
br label %34
34: ; preds = %33, %28
%35 = load i32, i32* %4
ret i32 %35
}

LLVM IR (-O2):
@.str = [9 x i8] c" \09\0A\0B\0C\0D[]\00"
define i32 @searchDuplicitySections(i8** nocapture %0, i8* %1, i32 %2) {
%4 = tail call i8* @strtok(i8* %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32 %2, 0
br i1 %5, label %25, label %6
6: ; preds = %3
%7 = zext i32 %2 to i64
%8 = load i8*, i8** %0
%9 = tail call i8* @strtok(i8* %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%10 = tail call i64 @strcmp(i8* %9, i8* %4)
%11 = icmp eq i64 %10, 0
br i1 %11, label %25, label %12
12: ; preds = %6, %15
%13 = phi i64 [ %21, %15 ], [ 1, %6 ]
%14 = icmp eq i64 %13, %7
br i1 %14, label %22, label %15
15: ; preds = %12
%16 = getelementptr inbounds i8*, i8** %0, i64 %13
%17 = load i8*, i8** %16
%18 = tail call i8* @strtok(i8* %17, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%19 = tail call i64 @strcmp(i8* %18, i8* %4)
%20 = icmp eq i64 %19, 0
%21 = add nuw nsw i64 %13, 1
br i1 %20, label %22, label %12
22: ; preds = %15, %12
%23 = icmp ult i64 %13, %7
%24 = zext i1 %23 to i32
br label %25
25: ; preds = %22, %6, %3
%26 = phi i32 [ 0, %3 ], [ 1, %6 ], [ %24, %22 ]
ret i32 %26
}