#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*/ like_option(char const *, char const *);
int /*<<< orphan*/ like_optterm(char const *, char const *);
int like_optarg(const char *arg, const char *optleaders, int allow_option) {
  return arg != NULL && (allow_option || (!like_option(arg, optleaders) &&
                                          !like_optterm(arg, optleaders)));
}


x86 assembly (clang, -O0):
<like_optarg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x15(%rbp)
je     1193 <like_optarg+0x73>
mov    $0x1,%al
cmpl   $0x0,-0x14(%rbp)
mov    %al,-0x16(%rbp)
jne    118d <like_optarg+0x6d>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <like_option@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x17(%rbp)
jne    1187 <like_optarg+0x67>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <like_optterm@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x17(%rbp)
mov    -0x17(%rbp),%al
mov    %al,-0x16(%rbp)
mov    -0x16(%rbp),%al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<like_optarg>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
test   %rdi,%rdi
je     115e <like_optarg+0x3e>
mov    $0x1,%eax
test   %edx,%edx
jne    115e <like_optarg+0x3e>
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <like_option@plt>
mov    %eax,%ecx
mov    $0x0,%eax
test   %ecx,%ecx
jne    115e <like_optarg+0x3e>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <like_optterm@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @like_optarg(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %27
9: ; preds = %3
%10 = load i32, i32* %6
%11 = icmp ne i32 %10, 0
br i1 %11, label %25, label %12
12: ; preds = %9
%13 = load i8*, i8** %4
%14 = load i8*, i8** %5
%15 = call i32 @like_option(i8* %13, i8* %14)
%16 = icmp ne i32 %15, 0
br i1 %16, label %23, label %17
17: ; preds = %12
%18 = load i8*, i8** %4
%19 = load i8*, i8** %5
%20 = call i32 @like_optterm(i8* %18, i8* %19)
%21 = icmp ne i32 %20, 0
%22 = xor i1 %21, true
br label %23
23: ; preds = %17, %12
%24 = phi i1 [ false, %12 ], [ %22, %17 ]
br label %25
25: ; preds = %23, %9
%26 = phi i1 [ true, %9 ], [ %24, %23 ]
br label %27
27: ; preds = %25, %3
%28 = phi i1 [ false, %3 ], [ %26, %25 ]
%29 = zext i1 %28 to i32
ret i32 %29
}

LLVM IR (-O2):
define i32 @like_optarg(i8* %0, i8* %1, i32 %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %14, label %5
5: ; preds = %3
%6 = icmp eq i32 %2, 0
br i1 %6, label %7, label %14
7: ; preds = %5
%8 = tail call i32 @like_option(i8* %0, i8* %1)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = tail call i32 @like_optterm(i8* %0, i8* %1)
%12 = icmp eq i32 %11, 0
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %5, %10, %7, %3
%15 = phi i32 [ 0, %3 ], [ 1, %5 ], [ 0, %7 ], [ %13, %10 ]
ret i32 %15
}