#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 get_cmd_single_par(int argc, char *argv[], char *clswitch) {
  long i;
  for (i = 1; i < argc; i++) {
    if (strcmp(argv[i], clswitch) == 0) {
      return (1);
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<get_cmd_single_par>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x8(%rbp),%rcx
cmp    %rcx,%rax
jge    117d <get_cmd_single_par+0x6d>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1167 <get_cmd_single_par+0x57>
movl   $0x1,-0x4(%rbp)
jmp    1184 <get_cmd_single_par+0x74>
jmp    116c <get_cmd_single_par+0x5c>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    112b <get_cmd_single_par+0x1b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_cmd_single_par>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %r14d,%r14d
cmp    $0x2,%edi
jl     1152 <get_cmd_single_par+0x42>
mov    %rdx,%r15
mov    %rsi,%r12
movslq %edi,%rbx
mov    $0x1,%ebp
xchg   %ax,%ax
mov    (%r12,%rbp,8),%rdi
mov    %r15,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     114c <get_cmd_single_par+0x3c>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1130 <get_cmd_single_par+0x20>
jmp    1152 <get_cmd_single_par+0x42>
mov    $0x1,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @get_cmd_single_par(i32 %0, i8** %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8*
%8 = alloca i64
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8* %2, i8** %7
store i64 1, i64* %8
br label %9
9: ; preds = %24, %3
%10 = load i64, i64* %8
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = icmp slt i64 %10, %12
br i1 %13, label %14, label %27
14: ; preds = %9
%15 = load i8**, i8*** %6
%16 = load i64, i64* %8
%17 = getelementptr inbounds i8*, i8** %15, i64 %16
%18 = load i8*, i8** %17
%19 = load i8*, i8** %7
%20 = call i64 @strcmp(i8* %18, i8* %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %14
store i32 1, i32* %4
br label %28
23: ; preds = %14
br label %24
24: ; preds = %23
%25 = load i64, i64* %8
%26 = add nsw i64 %25, 1
store i64 %26, i64* %8
br label %9
27: ; preds = %9
store i32 0, i32* %4
br label %28
28: ; preds = %27, %22
%29 = load i32, i32* %4
ret i32 %29
}

LLVM IR (-O2):
define i32 @get_cmd_single_par(i32 %0, i8** nocapture %1, i8* %2) {
%4 = sext i32 %0 to i64
%5 = icmp sgt i32 %0, 1
br i1 %5, label %8, label %15
6: ; preds = %8
%7 = icmp eq i64 %14, %4
br i1 %7, label %15, label %8
8: ; preds = %3, %6
%9 = phi i64 [ %14, %6 ], [ 1, %3 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i64 @strcmp(i8* %11, i8* %2)
%13 = icmp eq i64 %12, 0
%14 = add nuw nsw i64 %9, 1
br i1 %13, label %15, label %6
15: ; preds = %8, %6, %3
%16 = phi i32 [ 0, %3 ], [ 0, %6 ], [ 1, %8 ]
ret i32 %16
}