#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*/ fatal(char *);
scalar_t__ is_set_option(char const);
int /*<<< orphan*/ sprintf(char *, char *, char const, char const);
void allow_at_most_one_option_out_of(const char *opts) {
  const char *first;
  for (first = opts; *first; first++) {
    const char *second;
    for (second = first + 1; *second; second++) {
      if (is_set_option(*first) && is_set_option(*second)) {
        char msg[256];
        sprintf(msg, "options -%c and -%c are incompatible", *first, *second);
        fatal(msg);
      }
    }
  }
}


x86 assembly (clang, -O0):
<allow_at_most_one_option_out_of>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11f4 <allow_at_most_one_option_out_of+0xc4>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     11de <allow_at_most_one_option_out_of+0xae>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <is_set_option@plt>
cmp    $0x0,%rax
je     11c8 <allow_at_most_one_option_out_of+0x98>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <is_set_option@plt>
cmp    $0x0,%rax
je     11c8 <allow_at_most_one_option_out_of+0x98>
lea    -0x120(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
lea    0xe4f(%rip),%rsi
movsbl %cl,%edx
movsbl (%rax),%ecx
call   1040 <sprintf@plt>
lea    -0x120(%rbp),%rdi
call   1050 <fatal@plt>
jmp    11cd <allow_at_most_one_option_out_of+0x9d>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1160 <allow_at_most_one_option_out_of+0x30>
jmp    11e3 <allow_at_most_one_option_out_of+0xb3>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1147 <allow_at_most_one_option_out_of+0x17>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<allow_at_most_one_option_out_of>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    (%rdi),%al
test   %al,%al
je     11c4 <allow_at_most_one_option_out_of+0x94>
mov    %rdi,%rbx
lea    0x2(%rdi),%r12
lea    0xeab(%rip),%r14
mov    %rsp,%r15
jmp    116f <allow_at_most_one_option_out_of+0x3f>
nopw   0x0(%rax,%rax,1)
mov    0x0(%r13),%al
add    $0x1,%r12
mov    %r13,%rbx
test   %al,%al
je     11c4 <allow_at_most_one_option_out_of+0x94>
cmpb   $0x0,0x1(%rbx)
je     11c4 <allow_at_most_one_option_out_of+0x94>
lea    0x1(%rbx),%r13
mov    %r12,%rbp
nopl   0x0(%rax)
movsbl %al,%edi
call   1030 <is_set_option@plt>
test   %rax,%rax
je     11b5 <allow_at_most_one_option_out_of+0x85>
movsbl -0x1(%rbp),%edi
call   1030 <is_set_option@plt>
test   %rax,%rax
je     11b5 <allow_at_most_one_option_out_of+0x85>
movsbl (%rbx),%edx
movsbl -0x1(%rbp),%ecx
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <sprintf@plt>
mov    %r15,%rdi
call   1050 <fatal@plt>
cmpb   $0x0,0x0(%rbp)
je     1160 <allow_at_most_one_option_out_of+0x30>
movzbl (%rbx),%eax
add    $0x1,%rbp
jmp    1180 <allow_at_most_one_option_out_of+0x50>
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [37 x i8] c"options -%c and -%c are incompatible\00"
define void @allow_at_most_one_option_out_of(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [256 x i8]
store i8* %0, i8** %2
%6 = load i8*, i8** %2
store i8* %6, i8** %3
br label %7
7: ; preds = %42, %1
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %45
11: ; preds = %7
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i64 1
store i8* %13, i8** %4
br label %14
14: ; preds = %38, %11
%15 = load i8*, i8** %4
%16 = load i8, i8* %15
%17 = icmp ne i8 %16, 0
br i1 %17, label %18, label %41
18: ; preds = %14
%19 = load i8*, i8** %3
%20 = load i8, i8* %19
%21 = call i64 @is_set_option(i8 signext %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %37
23: ; preds = %18
%24 = load i8*, i8** %4
%25 = load i8, i8* %24
%26 = call i64 @is_set_option(i8 signext %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %37
28: ; preds = %23
%29 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%30 = load i8*, i8** %3
%31 = load i8, i8* %30
%32 = load i8*, i8** %4
%33 = load i8, i8* %32
%34 = call i32 @sprintf(i8* %29, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8 signext %31, i8 signext %33)
%35 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%36 = call i32 @fatal(i8* %35)
br label %37
37: ; preds = %28, %23, %18
br label %38
38: ; preds = %37
%39 = load i8*, i8** %4
%40 = getelementptr inbounds i8, i8* %39, i32 1
store i8* %40, i8** %4
br label %14
41: ; preds = %14
br label %42
42: ; preds = %41
%43 = load i8*, i8** %3
%44 = getelementptr inbounds i8, i8* %43, i32 1
store i8* %44, i8** %3
br label %7
45: ; preds = %7
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"options -%c and -%c are incompatible\00"
define void @allow_at_most_one_option_out_of(i8* nocapture %0) {
%2 = alloca [256 x i8]
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %36, label %5
5: ; preds = %1
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
br label %7
7: ; preds = %5, %33
%8 = phi i8 [ %3, %5 ], [ %34, %33 ]
%9 = phi i8* [ %0, %5 ], [ %10, %33 ]
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %36, label %13
13: ; preds = %7, %31
%14 = phi i8 [ %32, %31 ], [ %8, %7 ]
%15 = phi i8* [ %28, %31 ], [ %10, %7 ]
%16 = call i64 @is_set_option(i8 signext %14)
%17 = icmp eq i64 %16, 0
br i1 %17, label %27, label %18
18: ; preds = %13
%19 = load i8, i8* %15
%20 = call i64 @is_set_option(i8 signext %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %27, label %22
22: ; preds = %18
%23 = load i8, i8* %9
%24 = load i8, i8* %15
%25 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8 signext %23, i8 signext %24)
%26 = call i32 @fatal(i8* %6)
br label %27
27: ; preds = %13, %18, %22
%28 = getelementptr inbounds i8, i8* %15, i64 1
%29 = load i8, i8* %28
%30 = icmp eq i8 %29, 0
br i1 %30, label %33, label %31
31: ; preds = %27
%32 = load i8, i8* %9
br label %13
33: ; preds = %27
%34 = load i8, i8* %10
%35 = icmp eq i8 %34, 0
br i1 %35, label %36, label %7
36: ; preds = %7, %33, %1
ret void
}