#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 *);
int verifyampersand(char **inputlist, int size) {
  int i;
  for (i = 0; i < size - 1; i++) {
    if (strcmp(inputlist[i], "&") == 0) {
      return -1;
    }
  }
  if (strcmp(inputlist[size - 1], "&") == 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<verifyampersand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1178 <verifyampersand+0x68>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xeb6(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1165 <verifyampersand+0x55>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b2 <verifyampersand+0xa2>
jmp    116a <verifyampersand+0x5a>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1126 <verifyampersand+0x16>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe70(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11ab <verifyampersand+0x9b>
movl   $0x1,-0x4(%rbp)
jmp    11b2 <verifyampersand+0xa2>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verifyampersand>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%rbx
lea    -0x1(%rsi),%r15d
cmp    $0x2,%esi
jl     114a <verifyampersand+0x3a>
mov    %r15d,%r12d
xor    %ebp,%ebp
lea    0xed0(%rip),%r14
mov    (%rbx,%rbp,8),%rdi
mov    %r14,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     116a <verifyampersand+0x5a>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    1130 <verifyampersand+0x20>
movslq %r15d,%rax
mov    (%rbx,%rax,8),%rdi
lea    0xea8(%rip),%rsi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
jmp    116f <verifyampersand+0x5f>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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