#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 const *strstr(char const *, char const *);
const char *args_standard_abbreviations(const char *argument,
                                        const char **options,
                                        const char **standards, size_t count) {
  const char *found = NULL;
  size_t i;
  for (i = 0; i < count; i++)
    if (strstr(options[i], argument) == options[i]) {
      if (found == NULL)
        found = standards[i];
      else if (found != standards[i])
        return NULL;
    }
  return found;
}


x86 assembly (clang, -O0):
<args_standard_abbreviations>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    11d0 <args_standard_abbreviations+0xc0>
mov    -0x18(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strstr@plt>
mov    -0x18(%rbp),%rcx
mov    -0x38(%rbp),%rdx
cmp    (%rcx,%rdx,8),%rax
jne    11ba <args_standard_abbreviations+0xaa>
cmpq   $0x0,-0x30(%rbp)
jne    118d <args_standard_abbreviations+0x7d>
mov    -0x20(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x30(%rbp)
jmp    11b5 <args_standard_abbreviations+0xa5>
mov    -0x30(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    -0x38(%rbp),%rdx
cmp    (%rcx,%rdx,8),%rax
je     11b0 <args_standard_abbreviations+0xa0>
movq   $0x0,-0x8(%rbp)
jmp    11d8 <args_standard_abbreviations+0xc8>
jmp    11b5 <args_standard_abbreviations+0xa5>
jmp    11ba <args_standard_abbreviations+0xaa>
jmp    11bf <args_standard_abbreviations+0xaf>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1138 <args_standard_abbreviations+0x28>
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<args_standard_abbreviations>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,(%rsp)
test   %rcx,%rcx
je     117e <args_standard_abbreviations+0x5e>
mov    %rcx,%r12
mov    %rsi,%r15
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %rax,%rbp
xor    %r14d,%r14d
xor    %r13d,%r13d
jmp    1159 <args_standard_abbreviations+0x39>
mov    %rax,%r13
add    $0x1,%r14
cmp    %r14,%r12
je     1181 <args_standard_abbreviations+0x61>
mov    (%r15,%r14,8),%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1030 <strncmp@plt>
test   %eax,%eax
jne    1150 <args_standard_abbreviations+0x30>
mov    (%rsp),%rax
mov    (%rax,%r14,8),%rax
test   %r13,%r13
je     114d <args_standard_abbreviations+0x2d>
cmp    %rax,%r13
je     1150 <args_standard_abbreviations+0x30>
xor    %r13d,%r13d
mov    %r13,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i8* @args_standard_abbreviations(i8* %0, i8** %1, i8** %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8**
%8 = alloca i8**
%9 = alloca i64
%10 = alloca i8*
%11 = alloca i64
store i8* %0, i8** %6
store i8** %1, i8*** %7
store i8** %2, i8*** %8
store i64 %3, i64* %9
store i8* null, i8** %10
store i64 0, i64* %11
br label %12
12: ; preds = %47, %4
%13 = load i64, i64* %11
%14 = load i64, i64* %9
%15 = icmp ult i64 %13, %14
br i1 %15, label %16, label %50
16: ; preds = %12
%17 = load i8**, i8*** %7
%18 = load i64, i64* %11
%19 = getelementptr inbounds i8*, i8** %17, i64 %18
%20 = load i8*, i8** %19
%21 = load i8*, i8** %6
%22 = call i8* @strstr(i8* %20, i8* %21)
%23 = load i8**, i8*** %7
%24 = load i64, i64* %11
%25 = getelementptr inbounds i8*, i8** %23, i64 %24
%26 = load i8*, i8** %25
%27 = icmp eq i8* %22, %26
br i1 %27, label %28, label %46
28: ; preds = %16
%29 = load i8*, i8** %10
%30 = icmp eq i8* %29, null
br i1 %30, label %31, label %36
31: ; preds = %28
%32 = load i8**, i8*** %8
%33 = load i64, i64* %11
%34 = getelementptr inbounds i8*, i8** %32, i64 %33
%35 = load i8*, i8** %34
store i8* %35, i8** %10
br label %45
36: ; preds = %28
%37 = load i8*, i8** %10
%38 = load i8**, i8*** %8
%39 = load i64, i64* %11
%40 = getelementptr inbounds i8*, i8** %38, i64 %39
%41 = load i8*, i8** %40
%42 = icmp ne i8* %37, %41
br i1 %42, label %43, label %44
43: ; preds = %36
store i8* null, i8** %5
br label %52
44: ; preds = %36
br label %45
45: ; preds = %44, %31
br label %46
46: ; preds = %45, %16
br label %47
47: ; preds = %46
%48 = load i64, i64* %11
%49 = add i64 %48, 1
store i64 %49, i64* %11
br label %12
50: ; preds = %12
%51 = load i8*, i8** %10
store i8* %51, i8** %5
br label %52
52: ; preds = %50, %43
%53 = load i8*, i8** %5
ret i8* %53
}

LLVM IR (-O2):
define i8* @args_standard_abbreviations(i8* nocapture %0, i8** nocapture %1, i8** nocapture %2, i64 %3) {
%5 = icmp eq i64 %3, 0
br i1 %5, label %25, label %6
6: ; preds = %4
%7 = tail call i64 @strlen(i8* dereferenceable(1) %0)
br label %8
8: ; preds = %6, %21
%9 = phi i64 [ 0, %6 ], [ %23, %21 ]
%10 = phi i8* [ null, %6 ], [ %22, %21 ]
%11 = getelementptr inbounds i8*, i8** %1, i64 %9
%12 = load i8*, i8** %11
%13 = tail call i32 @strncmp(i8* %12, i8* %0, i64 %7)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %8
%16 = icmp eq i8* %10, null
%17 = getelementptr inbounds i8*, i8** %2, i64 %9
%18 = load i8*, i8** %17
br i1 %16, label %21, label %19
19: ; preds = %15
%20 = icmp eq i8* %10, %18
br i1 %20, label %21, label %25
21: ; preds = %15, %8, %19
%22 = phi i8* [ %10, %19 ], [ %10, %8 ], [ %18, %15 ]
%23 = add nuw i64 %9, 1
%24 = icmp eq i64 %23, %3
br i1 %24, label %25, label %8
25: ; preds = %19, %21, %4
%26 = phi i8* [ null, %4 ], [ %22, %21 ], [ null, %19 ]
ret i8* %26
}