#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 */
const char *option_matches(const char *arg_str, const char *opt_name) {
  while (*arg_str != '\0' && *arg_str != '=') {
    if (*arg_str++ != *opt_name++)
      return NULL;
  }
  if (*opt_name)
    return NULL;
  return arg_str;
}


x86 assembly (clang, -O0):
<option_matches>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     1131 <option_matches+0x31>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1141 <option_matches+0x41>
jmp    117f <option_matches+0x7f>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     117a <option_matches+0x7a>
movq   $0x0,-0x8(%rbp)
jmp    11a1 <option_matches+0xa1>
jmp    110c <option_matches+0xc>
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1199 <option_matches+0x99>
movq   $0x0,-0x8(%rbp)
jmp    11a1 <option_matches+0xa1>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<option_matches>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rdi),%ecx
test   %cl,%cl
je     112c <option_matches+0x2c>
cmp    $0x3d,%cl
je     112c <option_matches+0x2c>
add    $0x1,%rdi
lea    0x1(%rsi),%rdx
cmp    (%rsi),%cl
mov    %rdx,%rsi
je     1110 <option_matches+0x10>
ret
xor    %eax,%eax
cmpb   $0x0,(%rsi)
cmove  %rdi,%rax
ret

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

LLVM IR (-O2):
define i8* @option_matches(i8* %0, i8* nocapture %1) {
br label %3
3: ; preds = %7, %2
%4 = phi i8* [ %0, %2 ], [ %8, %7 ]
%5 = phi i8* [ %1, %2 ], [ %9, %7 ]
%6 = load i8, i8* %4
switch i8 %6, label %7 [
i8 0, label %12
i8 61, label %12
]
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %4, i64 1
%9 = getelementptr inbounds i8, i8* %5, i64 1
%10 = load i8, i8* %5
%11 = icmp eq i8 %6, %10
br i1 %11, label %3, label %16
12: ; preds = %3, %3
%13 = load i8, i8* %5
%14 = icmp eq i8 %13, 0
%15 = select i1 %14, i8* %4, i8* null
br label %16
16: ; preds = %7, %12
%17 = phi i8* [ %15, %12 ], [ null, %7 ]
ret i8* %17
}