#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int getopt(int, char **, char *);
char *optarg;
size_t optind;
int /*<<< orphan*/ print_help(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
void parse_command_line(char **include_regexp, char **exclude_regexp, int argc,
                        char *argv[]) {
  int res = 0;
  while ((res = getopt(argc, argv, "i:x:h")) != -1) {
    switch (res) {
    case 'i':
      *include_regexp = optarg;
      break;
    case 'x':
      *exclude_regexp = optarg;
      break;
    case 'h':
      print_help(stdout);
      exit(0);
      break;
    case '?':
      printf("Error input argument '%s'\n\n", argv[optind]);
      print_help(stderr);
      exit(1);
      break;
    };
  };
  if (argc != optind) {
    fprintf(stderr, "Error input argument: '%s'\n\n", argv[optind]);
    print_help(stderr);
    exit(1);
  };
}


x86 assembly (clang, -O0):
<parse_command_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
lea    0xe84(%rip),%rdx
call   1050 <getopt@plt>
mov    %eax,-0x24(%rbp)
cmp    $0xffffffff,%eax
je     1250 <parse_command_line+0x100>
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
sub    $0x3f,%eax
je     1215 <parse_command_line+0xc5>
jmp    11a1 <parse_command_line+0x51>
mov    -0x28(%rbp),%eax
sub    $0x68,%eax
je     1200 <parse_command_line+0xb0>
jmp    11b2 <parse_command_line+0x62>
mov    -0x28(%rbp),%eax
sub    $0x69,%eax
je     11d4 <parse_command_line+0x84>
jmp    11c3 <parse_command_line+0x73>
mov    -0x28(%rbp),%eax
sub    $0x78,%eax
je     11ea <parse_command_line+0x9a>
jmp    124b <parse_command_line+0xfb>
mov    0x2e1d(%rip),%rax
mov    (%rax),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
jmp    124b <parse_command_line+0xfb>
mov    0x2e07(%rip),%rax
mov    (%rax),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
jmp    124b <parse_command_line+0xfb>
mov    0x2dc1(%rip),%rax
mov    (%rax),%edi
call   1060 <print_help@plt>
xor    %edi,%edi
call   1070 <exit@plt>
mov    -0x20(%rbp),%rax
mov    0x2dc0(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xdd8(%rip),%rdi
call   1030 <printf@plt>
mov    0x2d96(%rip),%rax
mov    (%rax),%edi
call   1060 <print_help@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
jmp    116e <parse_command_line+0x1e>
movslq -0x14(%rbp),%rax
mov    0x2d85(%rip),%rcx
cmp    (%rcx),%rax
je     12a3 <parse_command_line+0x153>
mov    0x2d65(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rax
mov    0x2d68(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xd9c(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2d3e(%rip),%rax
mov    (%rax),%edi
call   1060 <print_help@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_command_line>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xe93(%rip),%r12
mov    0x2e84(%rip),%r13
jmp    1187 <parse_command_line+0x37>
cs nopw 0x0(%rax,%rax,1)
mov    0x0(%r13),%rax
mov    %rax,(%rcx)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1050 <getopt@plt>
cmp    $0x68,%eax
jg     11b0 <parse_command_line+0x60>
cmp    $0xffffffff,%eax
je     11c2 <parse_command_line+0x72>
cmp    $0x3f,%eax
je     11e3 <parse_command_line+0x93>
cmp    $0x68,%eax
jne    1187 <parse_command_line+0x37>
jmp    1215 <parse_command_line+0xc5>
nopw   0x0(%rax,%rax,1)
mov    %r15,%rcx
cmp    $0x69,%eax
je     1180 <parse_command_line+0x30>
mov    %r14,%rcx
cmp    $0x78,%eax
je     1180 <parse_command_line+0x30>
jmp    1187 <parse_command_line+0x37>
movslq %ebp,%rcx
mov    0x2e14(%rip),%rax
mov    (%rax),%rax
cmp    %rcx,%rax
jne    122a <parse_command_line+0xda>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2df6(%rip),%rax
mov    (%rax),%rax
mov    (%rbx,%rax,8),%rsi
lea    0xe0e(%rip),%rdi
call   1030 <printf@plt>
mov    0x2dcc(%rip),%rax
mov    (%rax),%edi
call   1060 <print_help@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    0x2dac(%rip),%rax
mov    (%rax),%edi
call   1060 <print_help@plt>
xor    %edi,%edi
call   1070 <exit@plt>
mov    0x2d9f(%rip),%rbp
mov    0x0(%rbp),%edi
mov    (%rbx,%rax,8),%rdx
lea    0xde3(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x0(%rbp),%edi
jmp    1206 <parse_command_line+0xb6>

LLVM IR (-O0):
@.str = [6 x i8] c"i:x:h\00"
@optarg = global i8* null
@stdout = global i32 0
@.str.1 = [28 x i8] c"Error input argument '%s'\0A\0A\00"
@optind = global i64 0
@stderr = global i32 0
@.str.2 = [29 x i8] c"Error input argument: '%s'\0A\0A\00"
define void @parse_command_line(i8** %0, i8** %1, i32 %2, i8** %3) {
%5 = alloca i8**
%6 = alloca i8**
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i32
store i8** %0, i8*** %5
store i8** %1, i8*** %6
store i32 %2, i32* %7
store i8** %3, i8*** %8
store i32 0, i32* %9
br label %10
10: ; preds = %36, %4
%11 = load i32, i32* %7
%12 = load i8**, i8*** %8
%13 = call i32 @getopt(i32 %11, i8** %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 %13, i32* %9
%14 = icmp ne i32 %13, -1
br i1 %14, label %15, label %37
15: ; preds = %10
%16 = load i32, i32* %9
switch i32 %16, label %36 [
i32 105, label %17
i32 120, label %20
i32 104, label %23
i32 63, label %27
]
17: ; preds = %15
%18 = load i8*, i8** @optarg
%19 = load i8**, i8*** %5
store i8* %18, i8** %19
br label %36
20: ; preds = %15
%21 = load i8*, i8** @optarg
%22 = load i8**, i8*** %6
store i8* %21, i8** %22
br label %36
23: ; preds = %15
%24 = load i32, i32* @stdout
%25 = call i32 @print_help(i32 %24)
%26 = call i32 @exit(i32 0)
unreachable
27: ; preds = %15
%28 = load i8**, i8*** %8
%29 = load i64, i64* @optind
%30 = getelementptr inbounds i8*, i8** %28, i64 %29
%31 = load i8*, i8** %30
%32 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %31)
%33 = load i32, i32* @stderr
%34 = call i32 @print_help(i32 %33)
%35 = call i32 @exit(i32 1)
unreachable
36: ; preds = %15, %20, %17
br label %10
37: ; preds = %10
%38 = load i32, i32* %7
%39 = sext i32 %38 to i64
%40 = load i64, i64* @optind
%41 = icmp ne i64 %39, %40
br i1 %41, label %42, label %52
42: ; preds = %37
%43 = load i32, i32* @stderr
%44 = load i8**, i8*** %8
%45 = load i64, i64* @optind
%46 = getelementptr inbounds i8*, i8** %44, i64 %45
%47 = load i8*, i8** %46
%48 = call i32 @fprintf(i32 %43, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %47)
%49 = load i32, i32* @stderr
%50 = call i32 @print_help(i32 %49)
%51 = call i32 @exit(i32 1)
unreachable
52: ; preds = %37
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"i:x:h\00"
@optarg = global i8* null
@stdout = global i32 0
@.str.1 = [28 x i8] c"Error input argument '%s'\0A\0A\00"
@optind = global i64 0
@stderr = global i32 0
@.str.2 = [29 x i8] c"Error input argument: '%s'\0A\0A\00"
define void @parse_command_line(i8** nocapture writeonly %0, i8** nocapture writeonly %1, i32 %2, i8** %3) {
br label %5
5: ; preds = %23, %4
%6 = tail call i32 @getopt(i32 %2, i8** %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
switch i32 %6, label %23 [
i32 -1, label %24
i32 105, label %20
i32 120, label %7
i32 104, label %8
i32 63, label %12
]
7: ; preds = %5
br label %20
8: ; preds = %5
%9 = load i32, i32* @stdout
%10 = tail call i32 @print_help(i32 %9)
%11 = tail call i32 @exit(i32 0)
unreachable
12: ; preds = %5
%13 = load i64, i64* @optind
%14 = getelementptr inbounds i8*, i8** %3, i64 %13
%15 = load i8*, i8** %14
%16 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = load i32, i32* @stderr
%18 = tail call i32 @print_help(i32 %17)
%19 = tail call i32 @exit(i32 1)
unreachable
20: ; preds = %5, %7
%21 = phi i8** [ %1, %7 ], [ %0, %5 ]
%22 = load i8*, i8** @optarg
store i8* %22, i8** %21
br label %23
23: ; preds = %20, %5
br label %5
24: ; preds = %5
%25 = sext i32 %2 to i64
%26 = load i64, i64* @optind
%27 = icmp eq i64 %26, %25
br i1 %27, label %36, label %28
28: ; preds = %24
%29 = load i32, i32* @stderr
%30 = getelementptr inbounds i8*, i8** %3, i64 %26
%31 = load i8*, i8** %30
%32 = tail call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %31)
%33 = load i32, i32* @stderr
%34 = tail call i32 @print_help(i32 %33)
%35 = tail call i32 @exit(i32 1)
unreachable
36: ; preds = %24
ret void
}