#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*/ const member_1;
};

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ basename(char *);
int /*<<< orphan*/ check_file(int *, char *, int, int, int, int);
int getopt_long(int, char **, char *, struct option *, int *);
#define no_argument 129
char *optarg;
int optind;
#define required_argument 128
scalar_t__ strcmp(int /*<<< orphan*/, char *);
int main(int argc, char *argv[]) {
  int had_err = 0;
  int opt = 0;
  int dos = 0;
  int trailing = 1;
  int firstspace = 1;
  int maxlen = 120;
  char *ignore = NULL;
  static struct option long_options[] = {
      {"ignore", required_argument, 0, 'i'},
      {"permit-dos-format", no_argument, 0, 'd'},
      {"disable-trailing-whitespace", no_argument, 0, 'w'},
      {"disable-first-space", no_argument, 0, 'f'},
      {"set-maxlength", required_argument, 0, 'l'},
      {0, 0, 0, 0}};
  int long_index = 0;
  while ((opt = getopt_long(argc, argv, "i:dwfl:", long_options,
                            &long_index)) != -1) {
    switch (opt) {
    case 'i':
      ignore = optarg;
      break;
    case 'd':
      dos = 1;
      break;
    case 'w':
      trailing = 0;
      break;
    case 'f':
      firstspace = 0;
      break;
    case 'l':
      maxlen = atoi(optarg);
      break;
    default:
      break;
    }
  }
  for (int i = optind; i < argc; ++i) {
    if (ignore == NULL || strcmp(basename(argv[i]), ignore) != 0) {
      check_file(&had_err, argv[i], dos, trailing, firstspace, maxlen);
    }
  }
  return had_err;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x1,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
movl   $0x78,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xefa(%rip),%rdx
lea    0x2e9c(%rip),%rcx
lea    -0x34(%rbp),%r8
call   1030 <getopt_long@plt>
mov    %eax,-0x18(%rbp)
cmp    $0xffffffff,%eax
je     124a <main+0xfa>
mov    -0x18(%rbp),%eax
add    $0xffffff9c,%eax
mov    %eax,%ecx
mov    %rcx,-0x40(%rbp)
sub    $0x13,%eax
ja     1240 <main+0xf0>
mov    -0x40(%rbp),%rax
lea    0xe17(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2dff(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    1245 <main+0xf5>
movl   $0x1,-0x1c(%rbp)
jmp    1245 <main+0xf5>
movl   $0x0,-0x20(%rbp)
jmp    1245 <main+0xf5>
movl   $0x0,-0x24(%rbp)
jmp    1245 <main+0xf5>
mov    0x2dc8(%rip),%rax
mov    (%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x28(%rbp)
jmp    1245 <main+0xf5>
jmp    1245 <main+0xf5>
jmp    119f <main+0x4f>
mov    0x2d8f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12c9 <main+0x179>
cmpq   $0x0,-0x30(%rbp)
je     1293 <main+0x143>
mov    -0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <basename@plt>
mov    %eax,%edi
mov    -0x30(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     12b6 <main+0x166>
mov    -0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0x24(%rbp),%r8d
mov    -0x28(%rbp),%r9d
lea    -0x14(%rbp),%rdi
call   1060 <check_file@plt>
jmp    12bb <main+0x16b>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1256 <main+0x106>
mov    -0x14(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
movl   $0x0,0xc(%rsp)
movl   $0x0,0x1c(%rsp)
movl   $0x78,0x8(%rsp)
movl   $0x1,(%rsp)
xor    %eax,%eax
mov    %rax,0x20(%rsp)
lea    0xf17(%rip),%r15
lea    0x2eb9(%rip),%r12
lea    0x1c(%rsp),%r13
lea    0xe5d(%rip),%rbp
movl   $0x1,0x4(%rsp)
xor    %eax,%eax
mov    %rax,0x10(%rsp)
jmp    11c5 <main+0x75>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    $0xffffffff,%eax
je     122f <main+0xdf>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
mov    %r13,%r8
call   1030 <getopt_long@plt>
lea    -0x64(%rax),%ecx
cmp    $0x13,%ecx
ja     11c0 <main+0x70>
movslq 0x0(%rbp,%rcx,4),%rax
add    %rbp,%rax
jmp    *%rax
mov    $0x1,%eax
mov    %rax,0x20(%rsp)
jmp    11c5 <main+0x75>
movl   $0x0,0x4(%rsp)
jmp    11c5 <main+0x75>
mov    0x2df1(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x10(%rsp)
jmp    11c5 <main+0x75>
mov    0x2de0(%rip),%rax
mov    (%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,0x8(%rsp)
jmp    11c5 <main+0x75>
movl   $0x0,(%rsp)
jmp    11c5 <main+0x75>
mov    0x2daa(%rip),%rax
movslq (%rax),%rcx
xor    %eax,%eax
cmp    %ebx,%ecx
jge    12ac <main+0x15c>
lea    (%r14,%rcx,8),%r15
sub    %ecx,%ebx
xor    %ebp,%ebp
lea    0xc(%rsp),%r14
mov    (%rsp),%r12d
mov    0x20(%rsp),%r13
jmp    1284 <main+0x134>
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rbp,8),%rsi
mov    %r14,%rdi
mov    %r13d,%edx
mov    %r12d,%ecx
mov    0x4(%rsp),%r8d
mov    0x8(%rsp),%r9d
call   1060 <check_file@plt>
add    $0x1,%rbp
cmp    %ebp,%ebx
je     12a8 <main+0x158>
cmpq   $0x0,0x10(%rsp)
je     1260 <main+0x110>
mov    (%r15,%rbp,8),%rdi
call   1050 <basename@plt>
mov    %eax,%edi
mov    0x10(%rsp),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    1260 <main+0x110>
jmp    127c <main+0x12c>
mov    0xc(%rsp),%eax
add    $0x28,%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.long_options = internal global [6 x %struct.option] [%struct.option { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0), i8 -128, i32 0, i32 105 }, %struct.option { i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i32 0, i32 0), i8 -127, i32 0, i32 100 }, %struct.option { i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i32 0, i32 0), i8 -127, i32 0, i32 119 }, %struct.option { i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i32 0, i32 0), i8 -127, i32 0, i32 102 }, %struct.option { i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i32 0, i32 0), i8 -128, i32 0, i32 108 }, %struct.option zeroinitializer]
@.str = [7 x i8] c"ignore\00"
@.str.1 = [18 x i8] c"permit-dos-format\00"
@.str.2 = [28 x i8] c"disable-trailing-whitespace\00"
@.str.3 = [20 x i8] c"disable-first-space\00"
@.str.4 = [14 x i8] c"set-maxlength\00"
@.str.5 = [8 x i8] c"i:dwfl:\00"
@optarg = global i8* null
@optind = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 1, i32* %9
store i32 1, i32* %10
store i32 120, i32* %11
store i8* null, i8** %12
store i32 0, i32* %13
br label %15
15: ; preds = %31, %2
%16 = load i32, i32* %4
%17 = load i8**, i8*** %5
%18 = call i32 @getopt_long(i32 %16, i8** %17, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), %struct.option* getelementptr inbounds ([6 x %struct.option], [6 x %struct.option]* @main.long_options, i64 0, i64 0), i32* %13)
store i32 %18, i32* %7
%19 = icmp ne i32 %18, -1
br i1 %19, label %20, label %32
20: ; preds = %15
%21 = load i32, i32* %7
switch i32 %21, label %30 [
i32 105, label %22
i32 100, label %24
i32 119, label %25
i32 102, label %26
i32 108, label %27
]
22: ; preds = %20
%23 = load i8*, i8** @optarg
store i8* %23, i8** %12
br label %31
24: ; preds = %20
store i32 1, i32* %8
br label %31
25: ; preds = %20
store i32 0, i32* %9
br label %31
26: ; preds = %20
store i32 0, i32* %10
br label %31
27: ; preds = %20
%28 = load i8*, i8** @optarg
%29 = call i32 @atoi(i8* %28)
store i32 %29, i32* %11
br label %31
30: ; preds = %20
br label %31
31: ; preds = %30, %27, %26, %25, %24, %22
br label %15
32: ; preds = %15
%33 = load i32, i32* @optind
store i32 %33, i32* %14
br label %34
34: ; preds = %63, %32
%35 = load i32, i32* %14
%36 = load i32, i32* %4
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %66
38: ; preds = %34
%39 = load i8*, i8** %12
%40 = icmp eq i8* %39, null
br i1 %40, label %51, label %41
41: ; preds = %38
%42 = load i8**, i8*** %5
%43 = load i32, i32* %14
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8*, i8** %42, i64 %44
%46 = load i8*, i8** %45
%47 = call i32 @basename(i8* %46)
%48 = load i8*, i8** %12
%49 = call i64 @strcmp(i32 %47, i8* %48)
%50 = icmp ne i64 %49, 0
br i1 %50, label %51, label %62
51: ; preds = %41, %38
%52 = load i8**, i8*** %5
%53 = load i32, i32* %14
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8*, i8** %52, i64 %54
%56 = load i8*, i8** %55
%57 = load i32, i32* %8
%58 = load i32, i32* %9
%59 = load i32, i32* %10
%60 = load i32, i32* %11
%61 = call i32 @check_file(i32* %6, i8* %56, i32 %57, i32 %58, i32 %59, i32 %60)
br label %62
62: ; preds = %51, %41
br label %63
63: ; preds = %62
%64 = load i32, i32* %14
%65 = add nsw i32 %64, 1
store i32 %65, i32* %14
br label %34
66: ; preds = %34
%67 = load i32, i32* %6
ret i32 %67
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32, i32 }
@main.long_options = internal global [6 x %struct.option] [%struct.option { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0), i8 -128, i32 0, i32 105 }, %struct.option { i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i32 0, i32 0), i8 -127, i32 0, i32 100 }, %struct.option { i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i32 0, i32 0), i8 -127, i32 0, i32 119 }, %struct.option { i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i32 0, i32 0), i8 -127, i32 0, i32 102 }, %struct.option { i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i32 0, i32 0), i8 -128, i32 0, i32 108 }, %struct.option zeroinitializer]
@.str = [7 x i8] c"ignore\00"
@.str.1 = [18 x i8] c"permit-dos-format\00"
@.str.2 = [28 x i8] c"disable-trailing-whitespace\00"
@.str.3 = [20 x i8] c"disable-first-space\00"
@.str.4 = [14 x i8] c"set-maxlength\00"
@.str.5 = [8 x i8] c"i:dwfl:\00"
@optarg = global i8* null
@optind = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%6 = bitcast i32* %4 to i8*
store i32 0, i32* %4
br label %7
7: ; preds = %27, %2
%8 = phi i32 [ 0, %2 ], [ 1, %27 ]
%9 = phi i32 [ 1, %2 ], [ %14, %27 ]
%10 = phi i32 [ 1, %2 ], [ %19, %27 ]
%11 = phi i32 [ 120, %2 ], [ %23, %27 ]
%12 = phi i8* [ null, %2 ], [ %26, %27 ]
br label %13
13: ; preds = %27, %7
%14 = phi i32 [ %9, %7 ], [ 0, %27 ]
%15 = phi i32 [ %10, %7 ], [ %19, %27 ]
%16 = phi i32 [ %11, %7 ], [ %23, %27 ]
%17 = phi i8* [ %12, %7 ], [ %26, %27 ]
br label %18
18: ; preds = %27, %13
%19 = phi i32 [ %15, %13 ], [ 0, %27 ]
%20 = phi i32 [ %16, %13 ], [ %23, %27 ]
%21 = phi i8* [ %17, %13 ], [ %26, %27 ]
br label %22
22: ; preds = %18, %31
%23 = phi i32 [ %20, %18 ], [ %33, %31 ]
%24 = phi i8* [ %21, %18 ], [ %26, %31 ]
br label %25
25: ; preds = %22, %29
%26 = phi i8* [ %24, %22 ], [ %30, %29 ]
br label %27
27: ; preds = %25, %27
%28 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), %struct.option* getelementptr inbounds ([6 x %struct.option], [6 x %struct.option]* @main.long_options, i64 0, i64 0), i32* %4)
switch i32 %28, label %27 [
i32 -1, label %34
i32 105, label %29
i32 100, label %7
i32 119, label %13
i32 102, label %18
i32 108, label %31
]
29: ; preds = %27
%30 = load i8*, i8** @optarg
br label %25
31: ; preds = %27
%32 = load i8*, i8** @optarg
%33 = call i32 @atoi(i8* %32)
br label %22
34: ; preds = %27
%35 = load i32, i32* @optind
%36 = icmp slt i32 %35, %0
br i1 %36, label %37, label %42
37: ; preds = %34
%38 = icmp eq i8* %26, null
%39 = sext i32 %35 to i64
br label %44
40: ; preds = %56
%41 = load i32, i32* %3
br label %42
42: ; preds = %40, %34
%43 = phi i32 [ %41, %40 ], [ 0, %34 ]
ret i32 %43
44: ; preds = %37, %56
%45 = phi i64 [ %39, %37 ], [ %57, %56 ]
br i1 %38, label %52, label %46
46: ; preds = %44
%47 = getelementptr inbounds i8*, i8** %1, i64 %45
%48 = load i8*, i8** %47
%49 = call i32 @basename(i8* %48)
%50 = call i64 @strcmp(i32 %49, i8* %26)
%51 = icmp eq i64 %50, 0
br i1 %51, label %56, label %52
52: ; preds = %46, %44
%53 = getelementptr inbounds i8*, i8** %1, i64 %45
%54 = load i8*, i8** %53
%55 = call i32 @check_file(i32* %3, i8* %54, i32 %8, i32 %14, i32 %19, i32 %23)
br label %56
56: ; preds = %46, %52
%57 = add nsw i64 %45, 1
%58 = trunc i64 %57 to i32
%59 = icmp eq i32 %58, %0
br i1 %59, label %40, label %44
}