#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int strlen(char *);
int info(const char *dictionary, int *shortest, int *longest, int *num_words) {
  int wordLength, wordCount = 0;
  char buffer[50 + 2];
  FILE *infile;
  *shortest = 50 + 1;
  *longest = 0;
  infile = fopen(dictionary, "rt");
  if (infile != NULL) {
    while (!feof(infile)) {
      fgets(buffer, 50 + 1, infile);
      wordLength = strlen(buffer);
      if (!feof(infile)) {
        buffer[wordLength - 1] = '\0';
        wordLength--;
        if (wordLength < *shortest && wordLength > 0) {
          *shortest = wordLength;
        } else if (wordLength > *longest) {
          *longest = wordLength;
        }
        wordCount++;
      }
    }
    *num_words = wordCount;
    fclose(infile);
  } else {
    return -2;
  }
  return -1;
}


x86 assembly (clang, -O0):
<info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x33,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
lea    0xe6f(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
je     1277 <info+0x127>
jmp    11aa <info+0x5a>
mov    -0x78(%rbp),%rdi
call   1060 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11c8 <info+0x78>
jmp    1260 <info+0x110>
lea    -0x70(%rbp),%rdi
mov    -0x78(%rbp),%rdx
mov    $0x33,%esi
call   1050 <fgets@plt>
lea    -0x70(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x78(%rbp),%rdi
call   1060 <feof@plt>
cmp    $0x0,%eax
jne    125b <info+0x10b>
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
cltq
movb   $0x0,-0x70(%rbp,%rax,1)
mov    -0x2c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jge    1235 <info+0xe5>
cmpl   $0x0,-0x2c(%rbp)
jle    1235 <info+0xe5>
mov    -0x2c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    1252 <info+0x102>
mov    -0x2c(%rbp),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
jle    124d <info+0xfd>
mov    -0x2c(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    1252 <info+0x102>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11aa <info+0x5a>
mov    -0x30(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x78(%rbp),%rdi
call   1030 <fclose@plt>
jmp    1283 <info+0x133>
movl   $0xfffffffe,-0x4(%rbp)
jmp    128a <info+0x13a>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<info>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rcx,%rbp
mov    %rdx,%r15
mov    %rsi,%r12
movl   $0x33,(%rsi)
movl   $0x0,(%rdx)
lea    0xe86(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     11b2 <info+0x62>
mov    %rax,%rbx
mov    %rbp,0x8(%rsp)
mov    %rax,%rdi
call   1060 <feof@plt>
xor    %r14d,%r14d
test   %eax,%eax
je     11c6 <info+0x76>
mov    0x8(%rsp),%rax
mov    %r14d,(%rax)
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    $0xffffffff,%eax
jmp    11b7 <info+0x67>
mov    $0xfffffffe,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r14d,%r14d
lea    0x10(%rsp),%r13
jmp    11e2 <info+0x92>
mov    %eax,(%rcx)
add    $0x1,%r14d
mov    %rbx,%rdi
call   1060 <feof@plt>
test   %eax,%eax
jne    119b <info+0x4b>
mov    %r13,%rdi
mov    $0x33,%esi
mov    %rbx,%rdx
call   1050 <fgets@plt>
mov    %r13,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <feof@plt>
test   %eax,%eax
jne    11d6 <info+0x86>
movslq %ebp,%rcx
lea    -0x1(%rcx),%rax
movb   $0x0,0xf(%rsp,%rcx,1)
cmp    $0x2,%ecx
jl     1222 <info+0xd2>
mov    %r12,%rcx
cmp    (%r12),%ebp
jle    11d0 <info+0x80>
mov    %r15,%rcx
cmp    (%r15),%eax
jg     11d0 <info+0x80>
jmp    11d2 <info+0x82>

LLVM IR (-O0):
@.str = [3 x i8] c"rt\00"
define i32 @info(i8* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca [52 x i8]
%13 = alloca i32*
store i8* %0, i8** %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i32 0, i32* %11
%14 = load i32*, i32** %7
store i32 51, i32* %14
%15 = load i32*, i32** %8
store i32 0, i32* %15
%16 = load i8*, i8** %6
%17 = call i32* @fopen(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %17, i32** %13
%18 = load i32*, i32** %13
%19 = icmp ne i32* %18, null
br i1 %19, label %20, label %70
20: ; preds = %4
br label %21
21: ; preds = %64, %20
%22 = load i32*, i32** %13
%23 = call i32 @feof(i32* %22)
%24 = icmp ne i32 %23, 0
%25 = xor i1 %24, true
br i1 %25, label %26, label %65
26: ; preds = %21
%27 = getelementptr inbounds [52 x i8], [52 x i8]* %12, i64 0, i64 0
%28 = load i32*, i32** %13
%29 = call i32 @fgets(i8* %27, i32 51, i32* %28)
%30 = getelementptr inbounds [52 x i8], [52 x i8]* %12, i64 0, i64 0
%31 = call i32 @strlen(i8* %30)
store i32 %31, i32* %10
%32 = load i32*, i32** %13
%33 = call i32 @feof(i32* %32)
%34 = icmp ne i32 %33, 0
br i1 %34, label %64, label %35
35: ; preds = %26
%36 = load i32, i32* %10
%37 = sub nsw i32 %36, 1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [52 x i8], [52 x i8]* %12, i64 0, i64 %38
store i8 0, i8* %39
%40 = load i32, i32* %10
%41 = add nsw i32 %40, -1
store i32 %41, i32* %10
%42 = load i32, i32* %10
%43 = load i32*, i32** %7
%44 = load i32, i32* %43
%45 = icmp slt i32 %42, %44
br i1 %45, label %46, label %52
46: ; preds = %35
%47 = load i32, i32* %10
%48 = icmp sgt i32 %47, 0
br i1 %48, label %49, label %52
49: ; preds = %46
%50 = load i32, i32* %10
%51 = load i32*, i32** %7
store i32 %50, i32* %51
br label %61
52: ; preds = %46, %35
%53 = load i32, i32* %10
%54 = load i32*, i32** %8
%55 = load i32, i32* %54
%56 = icmp sgt i32 %53, %55
br i1 %56, label %57, label %60
57: ; preds = %52
%58 = load i32, i32* %10
%59 = load i32*, i32** %8
store i32 %58, i32* %59
br label %60
60: ; preds = %57, %52
br label %61
61: ; preds = %60, %49
%62 = load i32, i32* %11
%63 = add nsw i32 %62, 1
store i32 %63, i32* %11
br label %64
64: ; preds = %61, %26
br label %21
65: ; preds = %21
%66 = load i32, i32* %11
%67 = load i32*, i32** %9
store i32 %66, i32* %67
%68 = load i32*, i32** %13
%69 = call i32 @fclose(i32* %68)
br label %71
70: ; preds = %4
store i32 -2, i32* %5
br label %72
71: ; preds = %65
store i32 -1, i32* %5
br label %72
72: ; preds = %71, %70
%73 = load i32, i32* %5
ret i32 %73
}

LLVM IR (-O2):
@.str = [3 x i8] c"rt\00"
define i32 @info(i8* nocapture %0, i32* nocapture %1, i32* nocapture %2, i32* nocapture writeonly %3) {
%5 = alloca [52 x i8]
%6 = getelementptr inbounds [52 x i8], [52 x i8]* %5, i64 0, i64 0
store i32 51, i32* %1
store i32 0, i32* %2
%7 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %40, label %9
9: ; preds = %4
%10 = call i32 @feof(i32* %7)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %37
12: ; preds = %9, %33
%13 = phi i32 [ %34, %33 ], [ 0, %9 ]
%14 = call i32 @fgets(i8* %6, i32 51, i32* %7)
%15 = call i32 @strlen(i8* %6)
%16 = call i32 @feof(i32* %7)
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %33
18: ; preds = %12
%19 = add nsw i32 %15, -1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [52 x i8], [52 x i8]* %5, i64 0, i64 %20
store i8 0, i8* %21
%22 = load i32, i32* %1
%23 = icmp sle i32 %15, %22
%24 = icmp sgt i32 %15, 1
%25 = and i1 %24, %23
br i1 %25, label %29, label %26
26: ; preds = %18
%27 = load i32, i32* %2
%28 = icmp sgt i32 %19, %27
br i1 %28, label %29, label %31
29: ; preds = %26, %18
%30 = phi i32* [ %1, %18 ], [ %2, %26 ]
store i32 %19, i32* %30
br label %31
31: ; preds = %29, %26
%32 = add nsw i32 %13, 1
br label %33
33: ; preds = %31, %12
%34 = phi i32 [ %13, %12 ], [ %32, %31 ]
%35 = call i32 @feof(i32* %7)
%36 = icmp eq i32 %35, 0
br i1 %36, label %12, label %37
37: ; preds = %33, %9
%38 = phi i32 [ 0, %9 ], [ %34, %33 ]
store i32 %38, i32* %3
%39 = call i32 @fclose(i32* %7)
br label %40
40: ; preds = %4, %37
%41 = phi i32 [ -1, %37 ], [ -2, %4 ]
ret i32 %41
}