#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*/ strcmp(char *, char *);
int parArgTypExists(int argc, char *argv[], char argType) {
  int i;
  char tmp[3];
  tmp[0] = '-';
  tmp[1] = argType;
  tmp[2] = 0;
  if (argc > 1) {
    for (i = 1; i < argc; i++) {
      if (!strcmp(argv[i], tmp))
        return (i);
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<parArgTypExists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movb   $0x2d,-0x1b(%rbp)
mov    -0x11(%rbp),%al
mov    %al,-0x1a(%rbp)
movb   $0x0,-0x19(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1190 <parArgTypExists+0x80>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    118b <parArgTypExists+0x7b>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x1b(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1178 <parArgTypExists+0x68>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1197 <parArgTypExists+0x87>
jmp    117d <parArgTypExists+0x6d>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1143 <parArgTypExists+0x33>
jmp    1190 <parArgTypExists+0x80>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parArgTypExists>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
movb   $0x2d,0xd(%rsp)
mov    %dl,0xe(%rsp)
movb   $0x0,0xf(%rsp)
xor    %r14d,%r14d
cmp    $0x2,%edi
jl     116e <parArgTypExists+0x5e>
mov    %rsi,%r12
mov    %edi,%ebx
mov    $0x1,%ebp
lea    0xd(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r12,%rbp,8),%rdi
mov    %r15,%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     116b <parArgTypExists+0x5b>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1150 <parArgTypExists+0x40>
jmp    116e <parArgTypExists+0x5e>
mov    %ebp,%r14d
mov    %r14d,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @parArgTypExists(i32 %0, i8** nocapture %1, i8 signext %2) {
%4 = alloca [3 x i8]
%5 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
store i8 45, i8* %5
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 1
store i8 %2, i8* %6
%7 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 2
store i8 0, i8* %7
%8 = icmp sgt i32 %0, 1
br i1 %8, label %9, label %22
9: ; preds = %3
%10 = zext i32 %0 to i64
br label %11
11: ; preds = %9, %17
%12 = phi i64 [ 1, %9 ], [ %18, %17 ]
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
%14 = load i8*, i8** %13
%15 = call i32 @strcmp(i8* dereferenceable(1) %14, i8* %5)
%16 = icmp eq i32 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %11
%18 = add nuw nsw i64 %12, 1
%19 = icmp eq i64 %18, %10
br i1 %19, label %22, label %11
20: ; preds = %11
%21 = trunc i64 %12 to i32
br label %22
22: ; preds = %17, %20, %3
%23 = phi i32 [ 0, %3 ], [ %21, %20 ], [ 0, %17 ]
ret i32 %23
}