#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 option(char *);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ strcmp(char *, char *);
int optionfull(char *str) {
  if (strcmp(str, "help") == 0)
    return option("h");
  else if (strcmp(str, "line-number") == 0)
    return option("n");
  else if (strcmp(str, "except") == 0)
    return option("x");
  else {
    printf("Unrecoginized option '--%s'\n", str);
    printf("Try '%s --help' for a list of regognized options\n", "mini-grep");
    return -1;
  }
}


x86 assembly (clang, -O0):
<optionfull>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    116a <optionfull+0x3a>
lea    0xea8(%rip),%rdi
call   1050 <option@plt>
mov    %eax,-0x4(%rbp)
jmp    11f0 <optionfull+0xc0>
mov    -0x10(%rbp),%rdi
lea    0xe92(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1198 <optionfull+0x68>
lea    0xe88(%rip),%rdi
call   1050 <option@plt>
mov    %eax,-0x4(%rbp)
jmp    11f0 <optionfull+0xc0>
mov    -0x10(%rbp),%rdi
lea    0xe72(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11c6 <optionfull+0x96>
lea    0xe63(%rip),%rdi
call   1050 <option@plt>
mov    %eax,-0x4(%rbp)
jmp    11f0 <optionfull+0xc0>
mov    -0x10(%rbp),%rsi
lea    0xe4d(%rip),%rdi
call   1030 <printf@plt>
lea    0xe5e(%rip),%rdi
lea    0xe89(%rip),%rsi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<optionfull>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1196 <optionfull+0x66>
lea    0xebb(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11a3 <optionfull+0x73>
lea    0xeb5(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11b0 <optionfull+0x80>
lea    0xeaa(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    0xee3(%rip),%rsi
call   1030 <printf@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret
lea    0xe68(%rip),%rdi
pop    %rbx
jmp    1050 <option@plt>
lea    0xe69(%rip),%rdi
pop    %rbx
jmp    1050 <option@plt>
lea    0xe65(%rip),%rdi
pop    %rbx
jmp    1050 <option@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"help\00"
@.str.1 = [2 x i8] c"h\00"
@.str.2 = [12 x i8] c"line-number\00"
@.str.3 = [2 x i8] c"n\00"
@.str.4 = [7 x i8] c"except\00"
@.str.5 = [2 x i8] c"x\00"
@.str.6 = [29 x i8] c"Unrecoginized option '--%s'\0A\00"
@.str.7 = [50 x i8] c"Try '%s --help' for a list of regognized options\0A\00"
@.str.8 = [10 x i8] c"mini-grep\00"
define i32 @optionfull(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @option(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 %8, i32* %2
br label %25
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32 @option(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32 %14, i32* %2
br label %25
15: ; preds = %9
%16 = load i8*, i8** %3
%17 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = call i32 @option(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32 %20, i32* %2
br label %25
21: ; preds = %15
%22 = load i8*, i8** %3
%23 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
store i32 -1, i32* %2
br label %25
25: ; preds = %21, %19, %13, %7
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
@.str = [5 x i8] c"help\00"
@.str.1 = [2 x i8] c"h\00"
@.str.2 = [12 x i8] c"line-number\00"
@.str.3 = [2 x i8] c"n\00"
@.str.4 = [7 x i8] c"except\00"
@.str.5 = [2 x i8] c"x\00"
@.str.6 = [29 x i8] c"Unrecoginized option '--%s'\0A\00"
@.str.7 = [50 x i8] c"Try '%s --help' for a list of regognized options\0A\00"
@.str.8 = [10 x i8] c"mini-grep\00"
define i32 @optionfull(i8* %0) {
%2 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @option(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %19
6: ; preds = %1
%7 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 @option(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %19
11: ; preds = %6
%12 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = tail call i32 @option(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %19
16: ; preds = %11
%17 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* %0)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
br label %19
19: ; preds = %16, %14, %9, %4
%20 = phi i32 [ %5, %4 ], [ %10, %9 ], [ %15, %14 ], [ -1, %16 ]
ret i32 %20
}