#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 */
scalar_t__ strcmp(char const *, char const *);
int isunsupported(int argc, const char *argv[]) {
  enum {
    SERVE = 1,
    DAEMON = 2,
    SERVEDAEMON = SERVE | DAEMON,
  };
  unsigned int state = 0;
  int i;
  for (i = 0; i < argc; ++i) {
    if (strcmp(argv[i], "--") == 0)
      break;
    if (i == 0 && strcmp("serve", argv[i]) == 0)
      state |= SERVE;
    else if (strcmp("-d", argv[i]) == 0 || strcmp("--daemon", argv[i]) == 0)
      state |= DAEMON;
  }
  return (state & SERVEDAEMON) == SERVEDAEMON;
}


x86 assembly (clang, -O0):
<isunsupported>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11ff <isunsupported+0xef>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xeb4(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1160 <isunsupported+0x50>
jmp    11ff <isunsupported+0xef>
cmpl   $0x0,-0x18(%rbp)
jne    119a <isunsupported+0x8a>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe86(%rip),%rdi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    119a <isunsupported+0x8a>
mov    -0x14(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ec <isunsupported+0xdc>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe5c(%rip),%rdi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     11de <isunsupported+0xce>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe3d(%rip),%rdi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11e7 <isunsupported+0xd7>
mov    -0x14(%rbp),%eax
or     $0x2,%eax
mov    %eax,-0x14(%rbp)
jmp    11ec <isunsupported+0xdc>
jmp    11f1 <isunsupported+0xe1>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112d <isunsupported+0x1d>
mov    -0x14(%rbp),%eax
and    $0x3,%eax
cmp    $0x3,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isunsupported>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    11a4 <isunsupported+0x94>
mov    %rsi,%rbx
mov    %edi,%r15d
xor    %r13d,%r13d
lea    0xecd(%rip),%r14
lea    0xecf(%rip),%r12
xor    %ebp,%ebp
jmp    114c <isunsupported+0x3c>
xchg   %ax,%ax
or     $0x2,%ebp
add    $0x1,%r13
cmp    %r13,%r15
je     11a6 <isunsupported+0x96>
mov    (%rbx,%r13,8),%rdi
mov    %r14,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11a6 <isunsupported+0x96>
test   %r13,%r13
jne    1177 <isunsupported+0x67>
mov    (%rbx,%r13,8),%rsi
lea    0xe96(%rip),%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     119f <isunsupported+0x8f>
mov    (%rbx,%r13,8),%rsi
mov    %r12,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1140 <isunsupported+0x30>
mov    (%rbx,%r13,8),%rsi
lea    0xe79(%rip),%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    1143 <isunsupported+0x33>
jmp    1140 <isunsupported+0x30>
or     $0x1,%ebp
jmp    1143 <isunsupported+0x33>
xor    %ebp,%ebp
not    %ebp
xor    %eax,%eax
test   $0x3,%bpl
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"--\00"
@.str.1 = [6 x i8] c"serve\00"
@.str.2 = [3 x i8] c"-d\00"
@.str.3 = [9 x i8] c"--daemon\00"
define i32 @isunsupported(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %55, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %3
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %58
11: ; preds = %7
%12 = load i8**, i8*** %4
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %12, i64 %14
%16 = load i8*, i8** %15
%17 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %11
br label %58
20: ; preds = %11
%21 = load i32, i32* %6
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %34
23: ; preds = %20
%24 = load i8**, i8*** %4
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %28)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %23
%32 = load i32, i32* %5
%33 = or i32 %32, 1
store i32 %33, i32* %5
br label %54
34: ; preds = %23, %20
%35 = load i8**, i8*** %4
%36 = load i32, i32* %6
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8*, i8** %35, i64 %37
%39 = load i8*, i8** %38
%40 = call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %39)
%41 = icmp eq i64 %40, 0
br i1 %41, label %50, label %42
42: ; preds = %34
%43 = load i8**, i8*** %4
%44 = load i32, i32* %6
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8*, i8** %43, i64 %45
%47 = load i8*, i8** %46
%48 = call i64 @strcmp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %47)
%49 = icmp eq i64 %48, 0
br i1 %49, label %50, label %53
50: ; preds = %42, %34
%51 = load i32, i32* %5
%52 = or i32 %51, 2
store i32 %52, i32* %5
br label %53
53: ; preds = %50, %42
br label %54
54: ; preds = %53, %31
br label %55
55: ; preds = %54
%56 = load i32, i32* %6
%57 = add nsw i32 %56, 1
store i32 %57, i32* %6
br label %7
58: ; preds = %19, %7
%59 = load i32, i32* %5
%60 = and i32 %59, 3
%61 = icmp eq i32 %60, 3
%62 = zext i1 %61 to i32
ret i32 %62
}

LLVM IR (-O2):
@.str = [3 x i8] c"--\00"
@.str.1 = [6 x i8] c"serve\00"
@.str.2 = [3 x i8] c"-d\00"
@.str.3 = [9 x i8] c"--daemon\00"
define i32 @isunsupported(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %35
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %31
%7 = phi i64 [ 0, %4 ], [ %33, %31 ]
%8 = phi i32 [ 0, %4 ], [ %32, %31 ]
%9 = getelementptr inbounds i8*, i8** %1, i64 %7
%10 = load i8*, i8** %9
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %35, label %13
13: ; preds = %6
%14 = icmp eq i64 %7, 0
br i1 %14, label %15, label %21
15: ; preds = %13
%16 = load i8*, i8** %9
%17 = tail call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = or i32 %8, 1
br label %31
21: ; preds = %15, %13
%22 = load i8*, i8** %9
%23 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %29, label %25
25: ; preds = %21
%26 = load i8*, i8** %9
%27 = tail call i64 @strcmp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %26)
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %25, %21
%30 = or i32 %8, 2
br label %31
31: ; preds = %19, %29, %25
%32 = phi i32 [ %20, %19 ], [ %30, %29 ], [ %8, %25 ]
%33 = add nuw nsw i64 %7, 1
%34 = icmp eq i64 %33, %5
br i1 %34, label %35, label %6
35: ; preds = %31, %6, %2
%36 = phi i32 [ 0, %2 ], [ %8, %6 ], [ %32, %31 ]
%37 = and i32 %36, 3
%38 = icmp eq i32 %37, 3
%39 = zext i1 %38 to i32
ret i32 %39
}