#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 const *);
int b_arg(int argc, char *argv[], int *i, const char *arg, int *result,
          int invert) {
  if (i == NULL || result == NULL) {
    return 0;
  }
  if (!strcmp(argv[*i], arg)) {
    *result = !invert;
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<b_arg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1145 <b_arg+0x35>
cmpq   $0x0,-0x28(%rbp)
jne    1151 <b_arg+0x41>
movl   $0x0,-0x4(%rbp)
jmp    1199 <b_arg+0x89>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1192 <b_arg+0x82>
cmpl   $0x0,-0x2c(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1199 <b_arg+0x89>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<b_arg>:
push   %rbp
push   %r14
push   %rbx
xor    %ebp,%ebp
test   %rdx,%rdx
je     1148 <b_arg+0x38>
mov    %r8,%rbx
test   %r8,%r8
je     1148 <b_arg+0x38>
mov    %r9d,%r14d
movslq (%rdx),%rax
mov    (%rsi,%rax,8),%rdi
mov    %rcx,%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
jne    1148 <b_arg+0x38>
xor    %eax,%eax
test   %r14d,%r14d
sete   %al
mov    %eax,(%rbx)
mov    $0x1,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @b_arg(i32 %0, i8** nocapture %1, i32* %2, i8* nocapture %3, i32* writeonly %4, i32 %5) {
%7 = icmp eq i32* %2, null
%8 = icmp eq i32* %4, null
%9 = or i1 %7, %8
br i1 %9, label %20, label %10
10: ; preds = %6
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
%14 = load i8*, i8** %13
%15 = tail call i32 @strcmp(i8* dereferenceable(1) %14, i8* dereferenceable(1) %3)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %10
%18 = icmp eq i32 %5, 0
%19 = zext i1 %18 to i32
store i32 %19, i32* %4
br label %20
20: ; preds = %10, %6, %17
%21 = phi i32 [ 1, %17 ], [ 0, %6 ], [ 0, %10 ]
ret i32 %21
}