#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 */
char *strchr(char const *, char);
scalar_t__ strcmp(char const *, char const *);
scalar_t__ strncmp(char const *, char const *, int);
char const *strstr(char const *, char const *);
bool argument_name_matches(const char *wanted_name,
                           const char *current_argument) {
  char *equal_sign = strchr(current_argument, '=');
  if (equal_sign == NULL) {
    return strcmp(wanted_name, current_argument) == 0;
  }
  if (strstr(current_argument, wanted_name) != current_argument) {
    return false;
  }
  return strncmp(wanted_name, current_argument,
                 equal_sign - current_argument) == 0;
}


x86 assembly (clang, -O0):
<argument_name_matches>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x3d,%esi
call   1040 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    118e <argument_name_matches+0x4e>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    11da <argument_name_matches+0x9a>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strstr@plt>
cmp    -0x18(%rbp),%rax
je     11b1 <argument_name_matches+0x71>
movl   $0x0,-0x4(%rbp)
jmp    11da <argument_name_matches+0x9a>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<argument_name_matches>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
mov    $0x3d,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     117e <argument_name_matches+0x3e>
mov    %rax,%r15
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %rax,%rdx
call   1030 <strncmp@plt>
test   %eax,%eax
je     118b <argument_name_matches+0x4b>
xor    %eax,%eax
jmp    11a2 <argument_name_matches+0x62>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
jmp    119c <argument_name_matches+0x5c>
sub    %ebx,%r15d
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15d,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
sete   %al
movzbl %al,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @argument_name_matches(i8* %0, i8* %1) {
%3 = tail call i8* @strchr(i8* dereferenceable(1) %1, i8 signext 61)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i64 @strcmp(i8* %0, i8* %1)
%7 = icmp eq i64 %6, 0
br label %19
8: ; preds = %2
%9 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%10 = tail call i32 bitcast (i64 (i8*, i8*, i32)* @strncmp to i32 (i8*, i8*, i64)*)(i8* %1, i8* %0, i64 %9)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %19
12: ; preds = %8
%13 = ptrtoint i8* %3 to i64
%14 = ptrtoint i8* %1 to i64
%15 = sub i64 %13, %14
%16 = trunc i64 %15 to i32
%17 = tail call i64 @strncmp(i8* %0, i8* %1, i32 %16)
%18 = icmp eq i64 %17, 0
br label %19
19: ; preds = %8, %12, %5
%20 = phi i1 [ %7, %5 ], [ %18, %12 ], [ false, %8 ]
%21 = zext i1 %20 to i32
ret i32 %21
}