#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*/ delete_arg(int *, char **, int);
scalar_t__ strcmp(char *, char *);
int check_arg(int *argc, register char **argv, register char *s) {
  register int i;
  for (i = 1; i < *argc; i++) {
    if (strcmp(argv[i], s) == 0) {
      delete_arg(argc, argv, i);
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_arg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    1198 <check_arg+0x78>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1185 <check_arg+0x65>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <delete_arg@plt>
movl   $0x1,-0x4(%rbp)
jmp    119f <check_arg+0x7f>
jmp    118a <check_arg+0x6a>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    113b <check_arg+0x1b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_arg>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %r14d,%r14d
cmpl   $0x2,(%rdi)
jl     1173 <check_arg+0x53>
mov    %rdx,%r12
mov    %rsi,%r15
mov    %rdi,%rbp
mov    $0x1,%ebx
xchg   %ax,%ax
mov    (%r15,%rbx,8),%rdi
mov    %r12,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1160 <check_arg+0x40>
add    $0x1,%rbx
movslq 0x0(%rbp),%rax
cmp    %rax,%rbx
jl     1140 <check_arg+0x20>
jmp    1173 <check_arg+0x53>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1030 <delete_arg@plt>
mov    $0x1,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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