#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 */
unsigned int atoi(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int getopt(int, char **, char *);
int /*<<< orphan*/ isprint(char);
char *optarg;
scalar_t__ opterr;
int optind;
char optopt;
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strncpy(char *, char *, int);
int get_params(int argc, char **argv, char *file_name, char *delim,
               int *use_header, unsigned int *max_cell_width,
               unsigned int *max_cell_height, unsigned int *min_cell_width) {
  int c;
  file_name[0] = '\0';
  *delim = ',';
  *use_header = 0;
  opterr = 0;
  while ((c = getopt(argc, argv, "hd:m:n:b:")) != -1) {
    switch (c) {
    case 'd':
      *delim = optarg[0];
      break;
    case 'm':
      fprintf(stdout, "%s\n", optarg);
      *max_cell_width = atoi(optarg);
      break;
    case 'n':
      *min_cell_width = atoi(optarg);
      break;
    case 'b':
      *max_cell_height = atoi(optarg);
      break;
    case 'h':
      *use_header = 1;
      break;
    case '?':
      if (optopt == 'd') {
        fprintf(stderr, "Option -%c requires an argument.\n", optopt);
      } else if (isprint(optopt)) {
        fprintf(stderr, "Unknown option `-%c'.\n", optopt);
      } else {
        fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt);
      }
      return 0;
    default:
      return 0;
    }
  }
  if (optind + 1 == argc) {
    strncpy(file_name, argv[optind], 255);
    return 1;
  } else if (optind == argc) {
    return 1;
  } else {
    fprintf(stderr, "Too many arguments\n");
    return 0;
  }
}


x86 assembly (clang, -O0):
<get_params>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movb   $0x2c,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
mov    0x2e2a(%rip),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xf15(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x34(%rbp)
cmp    $0xffffffff,%eax
je     133a <get_params+0x1ea>
mov    -0x34(%rbp),%eax
add    $0xffffffc1,%eax
mov    %eax,%ecx
mov    %rcx,-0x40(%rbp)
sub    $0x2f,%eax
ja     1329 <get_params+0x1d9>
mov    -0x40(%rbp),%rax
lea    0xe24(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e0c(%rip),%rax
mov    (%rax),%rax
mov    (%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
jmp    1335 <get_params+0x1e5>
mov    0x2db5(%rip),%rax
mov    (%rax),%edi
mov    0x2dec(%rip),%rax
mov    (%rax),%rdx
lea    0xeb4(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2dd4(%rip),%rax
mov    (%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
jmp    1335 <get_params+0x1e5>
mov    0x2db8(%rip),%rax
mov    (%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,%ecx
mov    0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    1335 <get_params+0x1e5>
mov    0x2d9c(%rip),%rax
mov    (%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    1335 <get_params+0x1e5>
mov    -0x28(%rbp),%rax
movl   $0x1,(%rax)
jmp    1335 <get_params+0x1e5>
mov    0x2d59(%rip),%rax
movsbl (%rax),%eax
cmp    $0x64,%eax
jne    12b9 <get_params+0x169>
mov    0x2d2e(%rip),%rax
mov    (%rax),%edi
mov    0x2d3d(%rip),%rax
movsbl (%rax),%edx
lea    0xe21(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    131d <get_params+0x1cd>
mov    0x2d20(%rip),%rax
movsbl (%rax),%edi
call   1050 <isprint@plt>
cmp    $0x0,%eax
je     12f7 <get_params+0x1a7>
mov    0x2cf0(%rip),%rax
mov    (%rax),%edi
mov    0x2cff(%rip),%rax
movsbl (%rax),%edx
lea    0xe05(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    1318 <get_params+0x1c8>
mov    0x2cca(%rip),%rax
mov    (%rax),%edi
mov    0x2cd9(%rip),%rax
movsbl (%rax),%edx
lea    0xdf6(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    131d <get_params+0x1cd>
movl   $0x0,-0x4(%rbp)
jmp    13b7 <get_params+0x267>
movl   $0x0,-0x4(%rbp)
jmp    13b7 <get_params+0x267>
jmp    119d <get_params+0x4d>
mov    0x2c97(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
jne    137b <get_params+0x22b>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x2c7a(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rsi
mov    $0xff,%edx
call   1030 <strncpy@plt>
movl   $0x1,-0x4(%rbp)
jmp    13b7 <get_params+0x267>
mov    0x2c56(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jne    1399 <get_params+0x249>
movl   $0x1,-0x4(%rbp)
jmp    13b7 <get_params+0x267>
mov    0x2c28(%rip),%rax
mov    (%rax),%edi
lea    0xd80(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_params>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,0x10(%rsp)
mov    %rcx,%r13
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rdx,(%rsp)
movb   $0x0,(%rdx)
movb   $0x2c,(%rcx)
mov    %r8,0x8(%rsp)
movl   $0x0,(%r8)
mov    0x2e38(%rip),%rax
movq   $0x0,(%rax)
lea    0xf2a(%rip),%r14
lea    0xe63(%rip),%r15
mov    0x2e54(%rip),%r12
jmp    11c0 <get_params+0x70>
mov    0x8(%rsp),%rax
movl   $0x1,(%rax)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1060 <getopt@plt>
lea    -0x3f(%rax),%ecx
cmp    $0x2f,%ecx
ja     123c <get_params+0xec>
movslq (%r15,%rcx,4),%rax
add    %r15,%rax
jmp    *%rax
mov    (%r12),%rdi
call   1070 <atoi@plt>
mov    0x50(%rsp),%rcx
mov    %eax,(%rcx)
jmp    11c0 <get_params+0x70>
mov    (%r12),%rax
movzbl (%rax),%eax
mov    %al,0x0(%r13)
jmp    11c0 <get_params+0x70>
mov    0x2db4(%rip),%rax
mov    (%rax),%edi
mov    (%r12),%rdx
lea    0xeb9(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r12),%rdi
call   1070 <atoi@plt>
mov    0x10(%rsp),%rcx
mov    %eax,(%rcx)
jmp    11c0 <get_params+0x70>
mov    (%r12),%rdi
call   1070 <atoi@plt>
mov    0x58(%rsp),%rcx
mov    %eax,(%rcx)
jmp    11c0 <get_params+0x70>
cmp    $0xffffffff,%eax
jne    126b <get_params+0x11b>
mov    0x2d90(%rip),%rax
movslq (%rax),%rax
lea    0x1(%rax),%ecx
cmp    %ebp,%ecx
jne    12b6 <get_params+0x166>
mov    (%rbx,%rax,8),%rsi
mov    (%rsp),%rdi
mov    $0xff,%edx
call   1030 <strncpy@plt>
mov    $0x1,%ebx
jmp    12ea <get_params+0x19a>
xor    %ebx,%ebx
jmp    12ea <get_params+0x19a>
mov    0x2d6a(%rip),%rbx
mov    (%rbx),%al
cmp    $0x64,%al
jne    1295 <get_params+0x145>
mov    0x2d45(%rip),%rax
mov    (%rax),%edi
lea    0xe42(%rip),%rsi
xor    %ebx,%ebx
mov    $0x64,%edx
jmp    12e3 <get_params+0x193>
movsbl %al,%edi
call   1050 <isprint@plt>
mov    0x2d24(%rip),%rcx
mov    (%rcx),%edi
movsbl (%rbx),%edx
test   %eax,%eax
je     12da <get_params+0x18a>
lea    0xe3c(%rip),%rsi
jmp    12e1 <get_params+0x191>
mov    $0x1,%ebx
cmp    %ebp,%eax
je     12ea <get_params+0x19a>
mov    0x2d02(%rip),%rax
mov    (%rax),%edi
lea    0xe5a(%rip),%rsi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    12ea <get_params+0x19a>
lea    0xe26(%rip),%rsi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@opterr = global i64 0
@.str = [10 x i8] c"hd:m:n:b:\00"
@optarg = global i8* null
@stdout = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
@optopt = global i8 0
@stderr = global i32 0
@.str.2 = [34 x i8] c"Option -%c requires an argument.\0A\00"
@.str.3 = [23 x i8] c"Unknown option `-%c'.\0A\00"
@.str.4 = [34 x i8] c"Unknown option character `\\x%x'.\0A\00"
@optind = global i32 0
@.str.5 = [20 x i8] c"Too many arguments\0A\00"
define i32 @get_params(i32 %0, i8** %1, i8* %2, i8* %3, i32* %4, i32* %5, i32* %6, i32* %7) {
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8**
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i32*
%18 = alloca i32
store i32 %0, i32* %10
store i8** %1, i8*** %11
store i8* %2, i8** %12
store i8* %3, i8** %13
store i32* %4, i32** %14
store i32* %5, i32** %15
store i32* %6, i32** %16
store i32* %7, i32** %17
%19 = load i8*, i8** %12
%20 = getelementptr inbounds i8, i8* %19, i64 0
store i8 0, i8* %20
%21 = load i8*, i8** %13
store i8 44, i8* %21
%22 = load i32*, i32** %14
store i32 0, i32* %22
store i64 0, i64* @opterr
br label %23
23: ; preds = %78, %8
%24 = load i32, i32* %10
%25 = load i8**, i8*** %11
%26 = call i32 @getopt(i32 %24, i8** %25, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32 %26, i32* %18
%27 = icmp ne i32 %26, -1
br i1 %27, label %28, label %79
28: ; preds = %23
%29 = load i32, i32* %18
switch i32 %29, label %77 [
i32 100, label %30
i32 109, label %35
i32 110, label %42
i32 98, label %46
i32 104, label %50
i32 63, label %52
]
30: ; preds = %28
%31 = load i8*, i8** @optarg
%32 = getelementptr inbounds i8, i8* %31, i64 0
%33 = load i8, i8* %32
%34 = load i8*, i8** %13
store i8 %33, i8* %34
br label %78
35: ; preds = %28
%36 = load i32, i32* @stdout
%37 = load i8*, i8** @optarg
%38 = call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %37)
%39 = load i8*, i8** @optarg
%40 = call i32 @atoi(i8* %39)
%41 = load i32*, i32** %15
store i32 %40, i32* %41
br label %78
42: ; preds = %28
%43 = load i8*, i8** @optarg
%44 = call i32 @atoi(i8* %43)
%45 = load i32*, i32** %17
store i32 %44, i32* %45
br label %78
46: ; preds = %28
%47 = load i8*, i8** @optarg
%48 = call i32 @atoi(i8* %47)
%49 = load i32*, i32** %16
store i32 %48, i32* %49
br label %78
50: ; preds = %28
%51 = load i32*, i32** %14
store i32 1, i32* %51
br label %78
52: ; preds = %28
%53 = load i8, i8* @optopt
%54 = sext i8 %53 to i32
%55 = icmp eq i32 %54, 100
br i1 %55, label %56, label %61
56: ; preds = %52
%57 = load i32, i32* @stderr
%58 = load i8, i8* @optopt
%59 = sext i8 %58 to i32
%60 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %59)
br label %76
61: ; preds = %52
%62 = load i8, i8* @optopt
%63 = call i32 @isprint(i8 signext %62)
%64 = icmp ne i32 %63, 0
br i1 %64, label %65, label %70
65: ; preds = %61
%66 = load i32, i32* @stderr
%67 = load i8, i8* @optopt
%68 = sext i8 %67 to i32
%69 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %68)
br label %75
70: ; preds = %61
%71 = load i32, i32* @stderr
%72 = load i8, i8* @optopt
%73 = sext i8 %72 to i32
%74 = call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32 %73)
br label %75
75: ; preds = %70, %65
br label %76
76: ; preds = %75, %56
store i32 0, i32* %9
br label %100
77: ; preds = %28
store i32 0, i32* %9
br label %100
78: ; preds = %50, %46, %42, %35, %30
br label %23
79: ; preds = %23
%80 = load i32, i32* @optind
%81 = add nsw i32 %80, 1
%82 = load i32, i32* %10
%83 = icmp eq i32 %81, %82
br i1 %83, label %84, label %92
84: ; preds = %79
%85 = load i8*, i8** %12
%86 = load i8**, i8*** %11
%87 = load i32, i32* @optind
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i8*, i8** %86, i64 %88
%90 = load i8*, i8** %89
%91 = call i32 @strncpy(i8* %85, i8* %90, i32 255)
store i32 1, i32* %9
br label %100
92: ; preds = %79
%93 = load i32, i32* @optind
%94 = load i32, i32* %10
%95 = icmp eq i32 %93, %94
br i1 %95, label %96, label %97
96: ; preds = %92
store i32 1, i32* %9
br label %100
97: ; preds = %92
%98 = load i32, i32* @stderr
%99 = call i32 (i32, i8*, ...) @fprintf(i32 %98, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %9
br label %100
100: ; preds = %97, %96, %84, %77, %76
%101 = load i32, i32* %9
ret i32 %101
}

LLVM IR (-O2):
@opterr = global i64 0
@.str = [10 x i8] c"hd:m:n:b:\00"
@optarg = global i8* null
@stdout = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
@optopt = global i8 0
@stderr = global i32 0
@.str.2 = [34 x i8] c"Option -%c requires an argument.\0A\00"
@.str.3 = [23 x i8] c"Unknown option `-%c'.\0A\00"
@.str.4 = [34 x i8] c"Unknown option character `\\x%x'.\0A\00"
@optind = global i32 0
@.str.5 = [20 x i8] c"Too many arguments\0A\00"
define i32 @get_params(i32 %0, i8** %1, i8* %2, i8* nocapture writeonly %3, i32* nocapture writeonly %4, i32* nocapture writeonly %5, i32* nocapture writeonly %6, i32* nocapture writeonly %7) {
store i8 0, i8* %2
store i8 44, i8* %3
store i32 0, i32* %4
store i64 0, i64* @opterr
br label %9
9: ; preds = %27, %8
%10 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
switch i32 %10, label %58 [
i32 -1, label %44
i32 100, label %11
i32 109, label %14
i32 110, label %20
i32 98, label %23
i32 104, label %26
i32 63, label %28
]
11: ; preds = %9
%12 = load i8*, i8** @optarg
%13 = load i8, i8* %12
store i8 %13, i8* %3
br label %27
14: ; preds = %9
%15 = load i32, i32* @stdout
%16 = load i8*, i8** @optarg
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = load i8*, i8** @optarg
%19 = tail call i32 @atoi(i8* %18)
store i32 %19, i32* %5
br label %27
20: ; preds = %9
%21 = load i8*, i8** @optarg
%22 = tail call i32 @atoi(i8* %21)
store i32 %22, i32* %7
br label %27
23: ; preds = %9
%24 = load i8*, i8** @optarg
%25 = tail call i32 @atoi(i8* %24)
store i32 %25, i32* %6
br label %27
26: ; preds = %9
store i32 1, i32* %4
br label %27
27: ; preds = %26, %23, %20, %14, %11
br label %9
28: ; preds = %9
%29 = load i8, i8* @optopt
%30 = icmp eq i8 %29, 100
br i1 %30, label %31, label %34
31: ; preds = %28
%32 = load i32, i32* @stderr
%33 = tail call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 100)
br label %58
34: ; preds = %28
%35 = tail call i32 @isprint(i8 signext %29)
%36 = icmp eq i32 %35, 0
%37 = load i32, i32* @stderr
%38 = load i8, i8* @optopt
%39 = sext i8 %38 to i32
br i1 %36, label %42, label %40
40: ; preds = %34
%41 = tail call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %39)
br label %58
42: ; preds = %34
%43 = tail call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32 %39)
br label %58
44: ; preds = %9
%45 = load i32, i32* @optind
%46 = add nsw i32 %45, 1
%47 = icmp eq i32 %46, %0
br i1 %47, label %48, label %53
48: ; preds = %44
%49 = sext i32 %45 to i64
%50 = getelementptr inbounds i8*, i8** %1, i64 %49
%51 = load i8*, i8** %50
%52 = tail call i32 @strncpy(i8* %2, i8* %51, i32 255)
br label %58
53: ; preds = %44
%54 = icmp eq i32 %45, %0
br i1 %54, label %58, label %55
55: ; preds = %53
%56 = load i32, i32* @stderr
%57 = tail call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %58
58: ; preds = %9, %53, %31, %42, %40, %55, %48
%59 = phi i32 [ 1, %48 ], [ 0, %55 ], [ 0, %40 ], [ 0, %42 ], [ 0, %31 ], [ 1, %53 ], [ 0, %9 ]
ret i32 %59
}