#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 *);
void getoption(char *argv[], int *argp, int opts[2]) {
  for (; argv[*argp]; ++*argp)
    if (!strcmp("-s", argv[*argp]))
      opts[0] = 1;
    else if (!strcmp("-u", argv[*argp]))
      opts[0] = 0;
    else if (!strcmp("-q", argv[*argp]))
      opts[1] = 1;
    else
      break;
}


x86 assembly (clang, -O0):
<getoption>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     11f8 <getoption+0xe8>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xeb0(%rip),%rdi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    116d <getoption+0x5d>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
jmp    11e3 <getoption+0xd3>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe80(%rip),%rdi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11a0 <getoption+0x90>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
jmp    11de <getoption+0xce>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe50(%rip),%rdi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11d4 <getoption+0xc4>
mov    -0x18(%rbp),%rax
movl   $0x1,0x4(%rax)
jmp    11d9 <getoption+0xc9>
jmp    11f8 <getoption+0xe8>
jmp    11de <getoption+0xce>
jmp    11e3 <getoption+0xd3>
jmp    11e8 <getoption+0xd8>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    1124 <getoption+0x14>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getoption>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movslq (%rsi),%rax
mov    (%rdi,%rax,8),%rbp
test   %rbp,%rbp
je     11b9 <getoption+0xa9>
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
lea    0xec5(%rip),%r12
lea    0xec1(%rip),%r13
jmp    116a <getoption+0x5a>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movl   $0x1,(%r14)
movslq (%rbx),%rax
lea    0x1(%rax),%rcx
mov    %ecx,(%rbx)
mov    0x8(%r15,%rax,8),%rbp
test   %rbp,%rbp
je     11b9 <getoption+0xa9>
mov    %r12,%rdi
mov    %rbp,%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1150 <getoption+0x40>
mov    %r13,%rdi
mov    %rbp,%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11b0 <getoption+0xa0>
lea    0xe77(%rip),%rdi
mov    %rbp,%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
jne    11b9 <getoption+0xa9>
movl   $0x1,0x4(%r14)
jmp    1157 <getoption+0x47>
cs nopw 0x0(%rax,%rax,1)
nop
movl   $0x0,(%r14)
jmp    1157 <getoption+0x47>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"-s\00"
@.str.1 = [3 x i8] c"-u\00"
@.str.2 = [3 x i8] c"-q\00"
define void @getoption(i8** nocapture %0, i32* nocapture %1, i32* nocapture writeonly %2) {
%4 = load i32, i32* %1
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8*, i8** %0, i64 %5
%7 = load i8*, i8** %6
%8 = icmp eq i8* %7, null
br i1 %8, label %31, label %9
9: ; preds = %3
%10 = getelementptr inbounds i32, i32* %2, i64 1
br label %11
11: ; preds = %9, %24
%12 = phi i8* [ %7, %9 ], [ %29, %24 ]
%13 = tail call i32 @strcmp(i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11
store i32 1, i32* %2
br label %24
16: ; preds = %11
%17 = tail call i32 @strcmp(i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %16
store i32 0, i32* %2
br label %24
20: ; preds = %16
%21 = tail call i32 @strcmp(i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %12)
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %31
23: ; preds = %20
store i32 1, i32* %10
br label %24
24: ; preds = %15, %23, %19
%25 = load i32, i32* %1
%26 = add nsw i32 %25, 1
store i32 %26, i32* %1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %0, i64 %27
%29 = load i8*, i8** %28
%30 = icmp eq i8* %29, null
br i1 %30, label %31, label %11
31: ; preds = %24, %20, %3
ret void
}