#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*/ strcmp(char *, char *);
int strlen(char *);
int parseopt(char *arg, int *opt) {
  static int cont = 1;
  int tmpopt = *opt;
  if (!cont || *arg != '-' || !strcmp(arg, "-")) {
    cont = 0;
    return 0;
  }
  int i, len = strlen(arg);
  for (i = 1; i < len; i++) {
    char ch = arg[i];
    switch (ch) {
    case 'e':
      tmpopt |= (1 << 0);
      break;
    case 'E':
      tmpopt &= ~(1 << 0);
      break;
    case 'n':
      tmpopt &= ~(1 << 1);
      break;
    default:
      cont = 0;
      return 0;
    }
  }
  *opt = tmpopt;
  return 1;
}


x86 assembly (clang, -O0):
<parseopt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,0x2ef0(%rip)
je     116f <parseopt+0x4f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    116f <parseopt+0x4f>
mov    -0x10(%rbp),%rdi
lea    0xe9f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1185 <parseopt+0x65>
movl   $0x0,0x2eb7(%rip)
movl   $0x0,-0x4(%rbp)
jmp    124c <parseopt+0x12c>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    123c <parseopt+0x11c>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x25(%rbp)
movsbl -0x25(%rbp),%eax
mov    %eax,-0x2c(%rbp)
sub    $0x45,%eax
je     11f7 <parseopt+0xd7>
jmp    11c7 <parseopt+0xa7>
mov    -0x2c(%rbp),%eax
sub    $0x65,%eax
je     11e9 <parseopt+0xc9>
jmp    11d8 <parseopt+0xb8>
mov    -0x2c(%rbp),%eax
sub    $0x6e,%eax
je     1205 <parseopt+0xe5>
jmp    1213 <parseopt+0xf3>
mov    -0x1c(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1229 <parseopt+0x109>
mov    -0x1c(%rbp),%eax
and    $0xfffffffe,%eax
mov    %eax,-0x1c(%rbp)
jmp    1229 <parseopt+0x109>
mov    -0x1c(%rbp),%eax
and    $0xfffffffd,%eax
mov    %eax,-0x1c(%rbp)
jmp    1229 <parseopt+0x109>
movl   $0x0,0x2e13(%rip)
movl   $0x0,-0x4(%rbp)
jmp    124c <parseopt+0x12c>
jmp    122e <parseopt+0x10e>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1198 <parseopt+0x78>
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseopt>:
push   %rbp
push   %r14
push   %rbx
cmpb   $0x0,0x2f09(%rip)
jne    11a5 <parseopt+0x85>
mov    %rdi,%rbx
cmpb   $0x2d,(%rdi)
jne    11a5 <parseopt+0x85>
mov    %rsi,%r14
mov    (%rsi),%ebp
lea    0xebf(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11a5 <parseopt+0x85>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
jl     11b3 <parseopt+0x93>
mov    %eax,%eax
mov    $0x1,%ecx
jmp    117c <parseopt+0x5c>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
and    $0xfffffffe,%ebp
add    $0x1,%rcx
cmp    %rcx,%rax
je     11b3 <parseopt+0x93>
movsbl (%rbx,%rcx,1),%edx
cmp    $0x45,%edx
je     1170 <parseopt+0x50>
cmp    $0x6e,%edx
je     11a0 <parseopt+0x80>
cmp    $0x65,%edx
jne    11a5 <parseopt+0x85>
or     $0x1,%ebp
jmp    1173 <parseopt+0x53>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
and    $0xfffffffd,%ebp
jmp    1173 <parseopt+0x53>
movb   $0x1,0x2e88(%rip)
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %ebp,(%r14)
mov    $0x1,%eax
jmp    11ae <parseopt+0x8e>

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

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