#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char const *, char const *);
bool is_arg(const char *arg, char short_code, const char *long_code) {
  if (arg[0] != '-') {
    fprintf(stderr, "Not an argument: %s\n", arg);
    exit(1);
  }
  if (arg[1] != '-' && arg[1] == short_code) {
    return true;
  } else if (!strcmp(arg + 2, long_code)) {
    return true;
  }
  return false;
}


x86 assembly (clang, -O0):
<is_arg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
je     1179 <is_arg+0x49>
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe96(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2d,%eax
je     11aa <is_arg+0x7a>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    11aa <is_arg+0x7a>
movl   $0x1,-0x4(%rbp)
jmp    11dc <is_arg+0xac>
mov    -0x10(%rbp),%rdi
add    $0x2,%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11d0 <is_arg+0xa0>
movl   $0x1,-0x4(%rbp)
jmp    11dc <is_arg+0xac>
jmp    11d5 <is_arg+0xa5>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_arg>:
push   %rax
mov    %rdi,%rcx
cmpb   $0x2d,(%rdi)
jne    1169 <is_arg+0x39>
mov    0x1(%rcx),%dil
cmp    $0x2d,%dil
je     114f <is_arg+0x1f>
mov    $0x1,%eax
cmp    %sil,%dil
jne    114f <is_arg+0x1f>
pop    %rcx
ret
add    $0x2,%rcx
mov    %rcx,%rdi
mov    %rdx,%rsi
call   1030 <strcmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
pop    %rcx
ret
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
lea    0xe87(%rip),%rsi
mov    %rcx,%rdx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"Not an argument: %s\0A\00"
define i32 @is_arg(i8* %0, i8 signext %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8
%7 = alloca i8*
store i8* %0, i8** %5
store i8 %1, i8* %6
store i8* %2, i8** %7
%8 = load i8*, i8** %5
%9 = getelementptr inbounds i8, i8* %8, i64 0
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 45
br i1 %12, label %13, label %18
13: ; preds = %3
%14 = load i32, i32* @stderr
%15 = load i8*, i8** %5
%16 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %3
%19 = load i8*, i8** %5
%20 = getelementptr inbounds i8, i8* %19, i64 1
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 45
br i1 %23, label %24, label %33
24: ; preds = %18
%25 = load i8*, i8** %5
%26 = getelementptr inbounds i8, i8* %25, i64 1
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = load i8, i8* %6
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %28, %30
br i1 %31, label %32, label %33
32: ; preds = %24
store i32 1, i32* %4
br label %42
33: ; preds = %24, %18
%34 = load i8*, i8** %5
%35 = getelementptr inbounds i8, i8* %34, i64 2
%36 = load i8*, i8** %7
%37 = call i32 @strcmp(i8* %35, i8* %36)
%38 = icmp ne i32 %37, 0
br i1 %38, label %40, label %39
39: ; preds = %33
store i32 1, i32* %4
br label %42
40: ; preds = %33
br label %41
41: ; preds = %40
store i32 0, i32* %4
br label %42
42: ; preds = %41, %39, %32
%43 = load i32, i32* %4
ret i32 %43
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"Not an argument: %s\0A\00"
define i32 @is_arg(i8* %0, i8 signext %1, i8* nocapture %2) {
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 45
br i1 %5, label %10, label %6
6: ; preds = %3
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %3
%11 = getelementptr inbounds i8, i8* %0, i64 1
%12 = load i8, i8* %11
%13 = icmp ne i8 %12, 45
%14 = icmp eq i8 %12, %1
%15 = and i1 %13, %14
br i1 %15, label %21, label %16
16: ; preds = %10
%17 = getelementptr inbounds i8, i8* %0, i64 2
%18 = tail call i32 @strcmp(i8* %17, i8* dereferenceable(1) %2)
%19 = icmp eq i32 %18, 0
%20 = zext i1 %19 to i32
br label %21
21: ; preds = %16, %10
%22 = phi i32 [ 1, %10 ], [ %20, %16 ]
ret i32 %22
}