#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int getopt(int, char **, char *);
int /*<<< orphan*/ help(char **);
int optind;
int /*<<< orphan*/ perror(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
void get_params(int argc, char *argv[]) {
  int opt_char;
  while ((opt_char = getopt(argc, argv, "h")) != -1) {
    switch (opt_char) {
    case 'h':
      help(argv);
      exit(EXIT_SUCCESS);
    default:
      fprintf(stderr, "Unknown option '-%c'\n", opt_char);
      exit(EXIT_FAILURE);
    }
  }
  if ((argc - optind) == 1) {
    if (0 != strcmp("-", argv[optind])) {
      FILE *fin = fopen(argv[optind], "r");
      extern FILE *nwsin;
      if (NULL == fin) {
        perror(NULL);
        exit(EXIT_FAILURE);
      }
      nwsin = fin;
    }
  } else {
    fprintf(stderr, "Usage: %s [-bhIL] <filename|->\n", argv[0]);
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<get_params>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe73(%rip),%rdx
call   1070 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     11ee <get_params+0x7e>
mov    -0x14(%rbp),%eax
sub    $0x68,%eax
jne    11c6 <get_params+0x56>
jmp    11af <get_params+0x3f>
mov    -0x10(%rbp),%rdi
call   1080 <help@plt>
mov    0x2e01(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    0x2e03(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0xe29(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    -0x4(%rbp),%eax
mov    0x2de8(%rip),%rcx
sub    (%rcx),%eax
cmp    $0x1,%eax
jne    1287 <get_params+0x117>
mov    -0x10(%rbp),%rax
mov    0x2dd2(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xdfc(%rip),%rdi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1282 <get_params+0x112>
mov    -0x10(%rbp),%rax
mov    0x2da6(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdd2(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
cmp    -0x20(%rbp),%rax
jne    1274 <get_params+0x104>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <perror@plt>
mov    0x2d5b(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    -0x20(%rbp),%rcx
mov    0x2d69(%rip),%rax
mov    %rcx,(%rax)
jmp    12b3 <get_params+0x143>
mov    0x2d42(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xd7e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2d1c(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_params>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe80(%rip),%rdx
call   1070 <getopt@plt>
cmp    $0xffffffff,%eax
jne    11d7 <get_params+0x67>
mov    0x2e4f(%rip),%r14
movslq (%r14),%rax
sub    %eax,%ebp
cmp    $0x1,%ebp
jne    11f2 <get_params+0x82>
mov    (%rbx,%rax,8),%rsi
lea    0xe72(%rip),%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11d2 <get_params+0x62>
movslq (%r14),%rax
mov    (%rbx,%rax,8),%rdi
lea    0xe5c(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     1229 <get_params+0xb9>
mov    0x2e19(%rip),%rcx
mov    %rax,(%rcx)
pop    %rbx
pop    %r14
pop    %rbp
ret
cmp    $0x68,%eax
jne    120e <get_params+0x9e>
mov    %rbx,%rdi
call   1080 <help@plt>
mov    0x2dd5(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    0x2dd7(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe17(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    1230 <get_params+0xc0>
mov    0x2dbb(%rip),%rcx
mov    (%rcx),%edi
lea    0xde4(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    1230 <get_params+0xc0>
xor    %edi,%edi
call   1060 <perror@plt>
mov    0x2d91(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"h\00"
@EXIT_SUCCESS = global i32 0
@stderr = global i32 0
@.str.1 = [22 x i8] c"Unknown option '-%c'\0A\00"
@EXIT_FAILURE = global i32 0
@optind = global i32 0
@.str.2 = [2 x i8] c"-\00"
@.str.3 = [2 x i8] c"r\00"
@nwsin = external global i32*
@.str.4 = [32 x i8] c"Usage: %s [-bhIL] <filename|->\0A\00"
define void @get_params(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32*
store i32 %0, i32* %3
store i8** %1, i8*** %4
br label %7
7: ; preds = %2
%8 = load i32, i32* %3
%9 = load i8**, i8*** %4
%10 = call i32 @getopt(i32 %8, i8** %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 %10, i32* %5
%11 = icmp ne i32 %10, -1
br i1 %11, label %12, label %25
12: ; preds = %7
%13 = load i32, i32* %5
switch i32 %13, label %19 [
i32 104, label %14
]
14: ; preds = %12
%15 = load i8**, i8*** %4
%16 = call i32 @help(i8** %15)
%17 = load i32, i32* @EXIT_SUCCESS
%18 = call i32 @exit(i32 %17)
unreachable
19: ; preds = %12
%20 = load i32, i32* @stderr
%21 = load i32, i32* %5
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = load i32, i32* @EXIT_FAILURE
%24 = call i32 @exit(i32 %23)
unreachable
25: ; preds = %7
%26 = load i32, i32* %3
%27 = load i32, i32* @optind
%28 = sub nsw i32 %26, %27
%29 = icmp eq i32 %28, 1
br i1 %29, label %30, label %54
30: ; preds = %25
%31 = load i8**, i8*** %4
%32 = load i32, i32* @optind
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8*, i8** %31, i64 %33
%35 = load i8*, i8** %34
%36 = call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* %35)
%37 = icmp ne i64 0, %36
br i1 %37, label %38, label %53
38: ; preds = %30
%39 = load i8**, i8*** %4
%40 = load i32, i32* @optind
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8*, i8** %39, i64 %41
%43 = load i8*, i8** %42
%44 = call i32* @fopen(i8* %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %44, i32** %6
%45 = load i32*, i32** %6
%46 = icmp eq i32* null, %45
br i1 %46, label %47, label %51
47: ; preds = %38
%48 = call i32 @perror(i32* null)
%49 = load i32, i32* @EXIT_FAILURE
%50 = call i32 @exit(i32 %49)
unreachable
51: ; preds = %38
%52 = load i32*, i32** %6
store i32* %52, i32** @nwsin
br label %53
53: ; preds = %51, %30
br label %62
54: ; preds = %25
%55 = load i32, i32* @stderr
%56 = load i8**, i8*** %4
%57 = getelementptr inbounds i8*, i8** %56, i64 0
%58 = load i8*, i8** %57
%59 = call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* %58)
%60 = load i32, i32* @EXIT_FAILURE
%61 = call i32 @exit(i32 %60)
unreachable
62: ; preds = %53
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"h\00"
@EXIT_SUCCESS = global i32 0
@stderr = global i32 0
@.str.1 = [22 x i8] c"Unknown option '-%c'\0A\00"
@EXIT_FAILURE = global i32 0
@optind = global i32 0
@.str.2 = [2 x i8] c"-\00"
@.str.3 = [2 x i8] c"r\00"
@nwsin = external global i32*
@.str.4 = [32 x i8] c"Usage: %s [-bhIL] <filename|->\0A\00"
define void @get_params(i32 %0, i8** %1) {
%3 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
switch i32 %3, label %8 [
i32 -1, label %13
i32 104, label %4
]
4: ; preds = %2
%5 = tail call i32 @help(i8** %1)
%6 = load i32, i32* @EXIT_SUCCESS
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
13: ; preds = %2
%14 = load i32, i32* @optind
%15 = sub nsw i32 %0, %14
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %35
17: ; preds = %13
%18 = sext i32 %14 to i64
%19 = getelementptr inbounds i8*, i8** %1, i64 %18
%20 = load i8*, i8** %19
%21 = tail call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* %20)
%22 = icmp eq i64 %21, 0
br i1 %22, label %41, label %23
23: ; preds = %17
%24 = load i32, i32* @optind
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %1, i64 %25
%27 = load i8*, i8** %26
%28 = tail call i32* @fopen(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %34
30: ; preds = %23
%31 = tail call i32 @perror(i32* null)
%32 = load i32, i32* @EXIT_FAILURE
%33 = tail call i32 @exit(i32 %32)
unreachable
34: ; preds = %23
store i32* %28, i32** @nwsin
br label %41
35: ; preds = %13
%36 = load i32, i32* @stderr
%37 = load i8*, i8** %1
%38 = tail call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* %37)
%39 = load i32, i32* @EXIT_FAILURE
%40 = tail call i32 @exit(i32 %39)
unreachable
41: ; preds = %17, %34
ret void
}