#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 EXIT_FAILURE;
scalar_t__ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int getopt(int, char **, char *);
int /*<<< orphan*/ interval(int /*<<< orphan*/ *);
int optind;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  int opt;
  FILE *stream = stdin;
  while ((opt = getopt(argc, argv, "iIMmlh")) != -1) {
    switch (opt) {
    case 'h':
      fprintf(
          stdout,
          "numinterval - Show the numeric intervals between each line in a "
          "file.\nSynopsis : numinterval [-dhV] <FILE>\nThe only option is the "
          "help (-h) option and you are looking at it.\nNote : The calculation "
          "is made at the same time you're inputing numbers, in order to have "
          "a more esthetic result you can redirect the output.\nYou can "
          "consult the man page for further information.\n");
      return 0;
      break;
    default:
      fprintf(stderr, "Invalid option\n");
      return 1;
      break;
    }
  }
  if (argc > optind) {
    if (!(stream = fopen(argv[optind], "r"))) {
      perror("num-utils-ng");
      return EXIT_FAILURE;
    }
  }
  interval(stream);
  if (argc > optind) {
    if (fclose(stream) != 0) {
      perror("num-utils-ng");
      return EXIT_FAILURE;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e6b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe6e(%rip),%rdx
call   1070 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     11f6 <main+0x96>
mov    -0x14(%rbp),%eax
sub    $0x68,%eax
jne    11d5 <main+0x75>
jmp    11b4 <main+0x54>
mov    0x2e05(%rip),%rax
mov    (%rax),%edi
lea    0xe43(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12ad <main+0x14d>
mov    0x2df4(%rip),%rax
mov    (%rax),%edi
lea    0xf95(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12ad <main+0x14d>
mov    -0x8(%rbp),%eax
mov    0x2de0(%rip),%rcx
cmp    (%rcx),%eax
jle    1256 <main+0xf6>
mov    -0x10(%rbp),%rax
mov    0x2dcd(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xf69(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1251 <main+0xf1>
lea    0xf51(%rip),%rdi
call   1060 <perror@plt>
mov    0x2d81(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12ad <main+0x14d>
jmp    1256 <main+0xf6>
mov    -0x20(%rbp),%rdi
call   1080 <interval@plt>
mov    -0x8(%rbp),%eax
mov    0x2d77(%rip),%rcx
cmp    (%rcx),%eax
jle    12a6 <main+0x146>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
cmp    $0x0,%rax
je     12a1 <main+0x141>
lea    0xf01(%rip),%rdi
call   1060 <perror@plt>
mov    0x2d31(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12ad <main+0x14d>
jmp    12a6 <main+0x146>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbp
mov    %edi,%ebx
mov    0x2e75(%rip),%rax
mov    (%rax),%r14
lea    0xe83(%rip),%rdx
call   1070 <getopt@plt>
cmp    $0xffffffff,%eax
je     11a5 <main+0x45>
cmp    $0x68,%eax
jne    11ff <main+0x9f>
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
lea    0xe6b(%rip),%rsi
call   1040 <fprintf@plt>
xor    %ebp,%ebp
jmp    1219 <main+0xb9>
mov    0x2e34(%rip),%r15
movslq (%r15),%rax
cmp    %ebx,%eax
jge    11cc <main+0x6c>
mov    0x0(%rbp,%rax,8),%rdi
lea    0xfcb(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%r14
test   %rax,%rax
je     11e8 <main+0x88>
mov    %r14,%rdi
call   1080 <interval@plt>
xor    %ebp,%ebp
cmp    %ebx,(%r15)
jge    1219 <main+0xb9>
mov    %r14,%rdi
call   1030 <fclose@plt>
test   %rax,%rax
je     1219 <main+0xb9>
lea    0xf9d(%rip),%rdi
call   1060 <perror@plt>
mov    0x2dcd(%rip),%rax
mov    (%rax),%ebp
jmp    1219 <main+0xb9>
mov    0x2dca(%rip),%rax
mov    (%rax),%edi
lea    0xf6b(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32* null
@.str = [7 x i8] c"iIMmlh\00"
@stdout = global i32 0
@.str.1 = [371 x i8] c"numinterval - Show the numeric intervals between each line in a file.\0ASynopsis : numinterval [-dhV] <FILE>\0AThe only option is the help (-h) option and you are looking at it.\0ANote : The calculation is made at the same time you're inputing numbers, in order to have a more esthetic result you can redirect the output.\0AYou can consult the man page for further information.\0A\00"
@stderr = global i32 0
@.str.2 = [16 x i8] c"Invalid option\0A\00"
@optind = global i32 0
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [13 x i8] c"num-utils-ng\00"
@EXIT_FAILURE = 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*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32*, i32** @stdin
store i32* %8, i32** %7
br label %9
9: ; preds = %2
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i32 @getopt(i32 %10, i8** %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 %12, i32* %6
%13 = icmp ne i32 %12, -1
br i1 %13, label %14, label %22
14: ; preds = %9
%15 = load i32, i32* %6
switch i32 %15, label %19 [
i32 104, label %16
]
16: ; preds = %14
%17 = load i32, i32* @stdout
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([371 x i8], [371 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %53
19: ; preds = %14
%20 = load i32, i32* @stderr
%21 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %53
22: ; preds = %9
%23 = load i32, i32* %4
%24 = load i32, i32* @optind
%25 = icmp sgt i32 %23, %24
br i1 %25, label %26, label %38
26: ; preds = %22
%27 = load i8**, i8*** %5
%28 = load i32, i32* @optind
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8*, i8** %27, i64 %29
%31 = load i8*, i8** %30
%32 = call i32* @fopen(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %32, i32** %7
%33 = icmp ne i32* %32, null
br i1 %33, label %37, label %34
34: ; preds = %26
%35 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%36 = load i32, i32* @EXIT_FAILURE
store i32 %36, i32* %3
br label %53
37: ; preds = %26
br label %38
38: ; preds = %37, %22
%39 = load i32*, i32** %7
%40 = call i32 @interval(i32* %39)
%41 = load i32, i32* %4
%42 = load i32, i32* @optind
%43 = icmp sgt i32 %41, %42
br i1 %43, label %44, label %52
44: ; preds = %38
%45 = load i32*, i32** %7
%46 = call i64 @fclose(i32* %45)
%47 = icmp ne i64 %46, 0
br i1 %47, label %48, label %51
48: ; preds = %44
%49 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%50 = load i32, i32* @EXIT_FAILURE
store i32 %50, i32* %3
br label %53
51: ; preds = %44
br label %52
52: ; preds = %51, %38
store i32 0, i32* %3
br label %53
53: ; preds = %52, %48, %34, %19, %16
%54 = load i32, i32* %3
ret i32 %54
}

LLVM IR (-O2):
@stdin = global i32* null
@.str = [7 x i8] c"iIMmlh\00"
@stdout = global i32 0
@.str.1 = [371 x i8] c"numinterval - Show the numeric intervals between each line in a file.\0ASynopsis : numinterval [-dhV] <FILE>\0AThe only option is the help (-h) option and you are looking at it.\0ANote : The calculation is made at the same time you're inputing numbers, in order to have a more esthetic result you can redirect the output.\0AYou can consult the man page for further information.\0A\00"
@stderr = global i32 0
@.str.2 = [16 x i8] c"Invalid option\0A\00"
@optind = global i32 0
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [13 x i8] c"num-utils-ng\00"
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = load i32*, i32** @stdin
%4 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
switch i32 %4, label %8 [
i32 -1, label %11
i32 104, label %5
]
5: ; preds = %2
%6 = load i32, i32* @stdout
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([371 x i8], [371 x i8]* @.str.1, i64 0, i64 0))
br label %34
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %34
11: ; preds = %2
%12 = load i32, i32* @optind
%13 = icmp slt i32 %12, %0
br i1 %13, label %14, label %23
14: ; preds = %11
%15 = sext i32 %12 to i64
%16 = getelementptr inbounds i8*, i8** %1, i64 %15
%17 = load i8*, i8** %16
%18 = tail call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %23
20: ; preds = %14
%21 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%22 = load i32, i32* @EXIT_FAILURE
br label %34
23: ; preds = %14, %11
%24 = phi i32* [ %18, %14 ], [ %3, %11 ]
%25 = tail call i32 @interval(i32* %24)
%26 = load i32, i32* @optind
%27 = icmp slt i32 %26, %0
br i1 %27, label %28, label %34
28: ; preds = %23
%29 = tail call i64 @fclose(i32* %24)
%30 = icmp eq i64 %29, 0
br i1 %30, label %34, label %31
31: ; preds = %28
%32 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%33 = load i32, i32* @EXIT_FAILURE
br label %34
34: ; preds = %23, %28, %31, %20, %8, %5
%35 = phi i32 [ 0, %5 ], [ 1, %8 ], [ %33, %31 ], [ %22, %20 ], [ 0, %28 ], [ 0, %23 ]
ret i32 %35
}