#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 */
struct option {
  char *member_0;
  char member_3;
  int /*<<< orphan*/ member_2;
  int /*<<< orphan*/ member_1;
};

/* Variables and functions */
char EOF;
char getopt_long(int, char **, char *, struct option *, int *);
int /*<<< orphan*/ help();
int optind;
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ tolowercase(char *);
int /*<<< orphan*/ version();
int main(int argc, char *argv[]) {
  int cmd_x;
  static char optstring[] = "hv";
  struct option long_opts[] = {
      {"help", 0, 0, 'h'}, {"version", 0, 0, 'v'}, {NULL, 0, 0, 0}};
  char optch;
  int i;
  while ((optch = getopt_long(argc, argv, optstring, long_opts, &cmd_x)) !=
         EOF) {
    switch (optch) {
    case 'h':
      help();
      return 0;
    case 'v':
      version();
      return 0;
    default:
      printf("-%c: unkown option\n", optch);
      break;
    }
  }
  if (argc - optind < 1) {
    printf("Missing input file(s)\n");
    return 0;
  }
  for (i = optind; i < argc; i++) {
    if (tolowercase(argv[i]) != 0) {
      continue;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1050 <memset@plt>
lea    0xe73(%rip),%rax
mov    %rax,-0x60(%rbp)
movl   $0x68,-0x50(%rbp)
lea    0xe66(%rip),%rax
mov    %rax,-0x48(%rbp)
movl   $0x76,-0x38(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x60(%rbp),%rcx
lea    0x2e94(%rip),%rdx
lea    -0x14(%rbp),%r8
call   1030 <getopt_long@plt>
mov    %al,-0x61(%rbp)
movsbl %al,%eax
mov    0x2e16(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1240 <main+0xe0>
movsbl -0x61(%rbp),%eax
mov    %eax,-0x6c(%rbp)
sub    $0x68,%eax
je     1203 <main+0xa3>
jmp    11f2 <main+0x92>
mov    -0x6c(%rbp),%eax
sub    $0x76,%eax
je     1216 <main+0xb6>
jmp    1229 <main+0xc9>
mov    $0x0,%al
call   1080 <help@plt>
movl   $0x0,-0x4(%rbp)
jmp    12c1 <main+0x161>
mov    $0x0,%al
call   1070 <version@plt>
movl   $0x0,-0x4(%rbp)
jmp    12c1 <main+0x161>
movsbl -0x61(%rbp),%esi
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11aa <main+0x4a>
mov    -0x8(%rbp),%eax
mov    0x2d96(%rip),%rcx
sub    (%rcx),%eax
cmp    $0x1,%eax
jge    126f <main+0x10f>
lea    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12c1 <main+0x161>
mov    0x2d6a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12ba <main+0x15a>
mov    -0x10(%rbp),%rax
movslq -0x68(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <tolowercase@plt>
cmp    $0x0,%rax
je     12a7 <main+0x147>
jmp    12ac <main+0x14c>
jmp    12ac <main+0x14c>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    127b <main+0x11b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rsi,%r14
mov    %edi,%r12d
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
movq   $0x0,0x50(%rsp)
lea    0xe65(%rip),%rax
mov    %rax,0x10(%rsp)
movl   $0x68,0x20(%rsp)
lea    0xe56(%rip),%rax
mov    %rax,0x28(%rsp)
movl   $0x76,0x38(%rsp)
lea    0x2e8d(%rip),%rdx
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r8
call   1040 <getopt_long@plt>
mov    0x2e0f(%rip),%r15
cmp    (%r15),%al
je     1224 <main+0xc4>
lea    0x2e6b(%rip),%rbx
lea    0x10(%rsp),%r13
lea    0xc(%rsp),%rbp
nop
movsbl %al,%esi
cmp    $0x76,%esi
je     1263 <main+0x103>
cmp    $0x68,%esi
je     126c <main+0x10c>
lea    0xe09(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12d,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %r13,%rcx
mov    %rbp,%r8
call   1040 <getopt_long@plt>
cmp    (%r15),%al
jne    11f0 <main+0x90>
mov    0x2db5(%rip),%rax
movslq (%rax),%rax
cmp    %r12d,%eax
jge    1255 <main+0xf5>
lea    (%r14,%rax,8),%rbp
sub    %eax,%r12d
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    0x0(%rbp,%rbx,8),%rdi
call   1060 <tolowercase@plt>
add    $0x1,%rbx
cmp    %ebx,%r12d
jne    1240 <main+0xe0>
jmp    1273 <main+0x113>
lea    0xdc5(%rip),%rdi
call   1030 <puts@plt>
jmp    1273 <main+0x113>
xor    %eax,%eax
call   1070 <version@plt>
jmp    1273 <main+0x113>
xor    %eax,%eax
call   1080 <help@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32, i32 }
@main.optstring = internal global [3 x i8] c"hv\00"
@.str = [5 x i8] c"help\00"
@.str.1 = [8 x i8] c"version\00"
@EOF = global i8 0
@.str.2 = [20 x i8] c"-%c: unkown option\0A\00"
@optind = global i32 0
@.str.3 = [23 x i8] c"Missing input file(s)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [3 x %struct.option]
%8 = alloca i8
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [3 x %struct.option]* %7 to i8*
%11 = bitcast i8* %10 to [3 x %struct.option]*
%12 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %11, i32 0, i32 0
%13 = getelementptr inbounds %struct.option, %struct.option* %12, i32 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8** %13
%14 = getelementptr inbounds %struct.option, %struct.option* %12, i32 0, i32 3
store i32 104, i32* %14
%15 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %11, i32 0, i32 1
%16 = getelementptr inbounds %struct.option, %struct.option* %15, i32 0, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8** %16
%17 = getelementptr inbounds %struct.option, %struct.option* %15, i32 0, i32 3
store i32 118, i32* %17
br label %18
18: ; preds = %38, %2
%19 = load i32, i32* %4
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %7, i64 0, i64 0
%22 = call signext i8 @getopt_long(i32 %19, i8** %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @main.optstring, i64 0, i64 0), %struct.option* %21, i32* %6)
store i8 %22, i8* %8
%23 = sext i8 %22 to i32
%24 = load i8, i8* @EOF
%25 = sext i8 %24 to i32
%26 = icmp ne i32 %23, %25
br i1 %26, label %27, label %39
27: ; preds = %18
%28 = load i8, i8* %8
%29 = sext i8 %28 to i32
switch i32 %29, label %34 [
i32 104, label %30
i32 118, label %32
]
30: ; preds = %27
%31 = call i32 (...) @help()
store i32 0, i32* %3
br label %66
32: ; preds = %27
%33 = call i32 (...) @version()
store i32 0, i32* %3
br label %66
34: ; preds = %27
%35 = load i8, i8* %8
%36 = sext i8 %35 to i32
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %34
br label %18
39: ; preds = %18
%40 = load i32, i32* %4
%41 = load i32, i32* @optind
%42 = sub nsw i32 %40, %41
%43 = icmp slt i32 %42, 1
br i1 %43, label %44, label %46
44: ; preds = %39
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %3
br label %66
46: ; preds = %39
%47 = load i32, i32* @optind
store i32 %47, i32* %9
br label %48
48: ; preds = %62, %46
%49 = load i32, i32* %9
%50 = load i32, i32* %4
%51 = icmp slt i32 %49, %50
br i1 %51, label %52, label %65
52: ; preds = %48
%53 = load i8**, i8*** %5
%54 = load i32, i32* %9
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8*, i8** %53, i64 %55
%57 = load i8*, i8** %56
%58 = call i64 @tolowercase(i8* %57)
%59 = icmp ne i64 %58, 0
br i1 %59, label %60, label %61
60: ; preds = %52
br label %62
61: ; preds = %52
br label %62
62: ; preds = %61, %60
%63 = load i32, i32* %9
%64 = add nsw i32 %63, 1
store i32 %64, i32* %9
br label %48
65: ; preds = %48
store i32 0, i32* %3
br label %66
66: ; preds = %65, %44, %32, %30
%67 = load i32, i32* %3
ret i32 %67
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32, i32 }
@main.optstring = internal global [3 x i8] c"hv\00"
@.str = [5 x i8] c"help\00"
@.str.1 = [8 x i8] c"version\00"
@EOF = global i8 0
@.str.2 = [20 x i8] c"-%c: unkown option\0A\00"
@optind = global i32 0
@str = [22 x i8] c"Missing input file(s)\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca [3 x %struct.option]
%5 = bitcast i32* %3 to i8*
%6 = bitcast [3 x %struct.option]* %4 to i8*
%7 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %4, i64 0, i64 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %4, i64 0, i64 0, i32 3
store i32 104, i32* %8
%9 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %4, i64 0, i64 1, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %9
%10 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %4, i64 0, i64 1, i32 3
store i32 118, i32* %10
%11 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %4, i64 0, i64 0
%12 = call signext i8 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @main.optstring, i64 0, i64 0), %struct.option* %11, i32* %3)
%13 = load i8, i8* @EOF
%14 = icmp eq i8 %12, %13
br i1 %14, label %27, label %15
15: ; preds = %2, %22
%16 = phi i8 [ %24, %22 ], [ %12, %2 ]
%17 = sext i8 %16 to i32
switch i32 %17, label %22 [
i32 104, label %18
i32 118, label %20
]
18: ; preds = %15
%19 = call i32 (...) @help()
br label %42
20: ; preds = %15
%21 = call i32 (...) @version()
br label %42
22: ; preds = %15
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%24 = call signext i8 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @main.optstring, i64 0, i64 0), %struct.option* %11, i32* %3)
%25 = load i8, i8* @EOF
%26 = icmp eq i8 %24, %25
br i1 %26, label %27, label %15
27: ; preds = %22, %2
%28 = load i32, i32* @optind
%29 = icmp slt i32 %28, %0
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = sext i32 %28 to i64
br label %34
32: ; preds = %27
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
br label %42
34: ; preds = %30, %34
%35 = phi i64 [ %31, %30 ], [ %39, %34 ]
%36 = getelementptr inbounds i8*, i8** %1, i64 %35
%37 = load i8*, i8** %36
%38 = call i64 @tolowercase(i8* %37)
%39 = add nsw i64 %35, 1
%40 = trunc i64 %39 to i32
%41 = icmp eq i32 %40, %0
br i1 %41, label %42, label %34
42: ; preds = %34, %32, %20, %18
ret i32 0
}