#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 */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ eat_comments(int /*<<< orphan*/ *, char);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, char *);
scalar_t__ isalnum(char);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ realloc(char **, int);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *strchr(char *, char);
int strlen(char *);
char **file2charstarstar(char *FileName, int *N) {
  char **s = (char **)calloc(5000000, sizeof(char *));
  int n = 0;
  FILE *in;
  char temp[5000];
  int stop = 0;
  if ((in = fopen(FileName, "r")) == NULL) {
    printf("Couldn't open file %s to create array of strings from its "
           "contents\nExiting...\n",
           FileName);
    exit(1);
  }
  while (!stop) {
    eat_comments(in, '&');
    if (fscanf(in, " %s", temp)) {
      if (strchr(temp, '-') != NULL || isalnum(temp[0]) || temp[0] == '.' ||
          strchr(temp, '/') != NULL) {
        s[n] = (char *)calloc(strlen(temp) + 10, sizeof(char));
        sprintf(s[n++], "%s", temp);
        if (n % 5000000 == 0) {
          printf("Hey! We are about to reallocate to s in file2charstarstar. "
                 "n= %d \n\n",
                 n);
          if ((s = (char **)realloc(s, (n + 5000000) * sizeof(char *))) ==
              NULL) {
            fprintf(stderr,
                    "ERROR: Ah Crap!  realloc failure in file2charstarstar. n= "
                    "%d  MAX_COMM_FILE_TOKENS= %d\n",
                    n, 5000000);
            exit(1);
          }
        }
      }
      temp[0] = '\0';
    }
    if (feof(in)) {
      stop = 1;
    }
  }
  fclose(in);
  *N = n;
  return (s);
}


x86 assembly (clang, -O0):
<file2charstarstar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x13c0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x4c4b40,%edi
mov    $0x8,%esi
call   1090 <calloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x13b4(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xdde(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1251 <file2charstarstar+0x71>
mov    -0x8(%rbp),%rsi
lea    0xdc2(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
jmp    1256 <file2charstarstar+0x76>
cmpl   $0x0,-0x13b4(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    126f <file2charstarstar+0x8f>
jmp    13f3 <file2charstarstar+0x213>
mov    -0x28(%rbp),%rdi
mov    $0x26,%esi
call   1100 <eat_comments@plt>
mov    -0x28(%rbp),%rdi
lea    -0x13b0(%rbp),%rdx
lea    0xdc2(%rip),%rsi
call   1080 <fscanf@plt>
cmp    $0x0,%rax
je     13d1 <file2charstarstar+0x1f1>
lea    -0x13b0(%rbp),%rdi
mov    $0x2d,%esi
call   1050 <strchr@plt>
cmp    $0x0,%rax
jne    12fa <file2charstarstar+0x11a>
movsbl -0x13b0(%rbp),%edi
call   1070 <isalnum@plt>
cmp    $0x0,%rax
jne    12fa <file2charstarstar+0x11a>
movsbl -0x13b0(%rbp),%eax
cmp    $0x2e,%eax
je     12fa <file2charstarstar+0x11a>
lea    -0x13b0(%rbp),%rdi
mov    $0x2f,%esi
call   1050 <strchr@plt>
cmp    $0x0,%rax
je     13ca <file2charstarstar+0x1ea>
lea    -0x13b0(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%edi
add    $0xa,%edi
mov    $0x1,%esi
call   1090 <calloc@plt>
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x1c(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x13b0(%rbp),%rdx
lea    0xd0a(%rip),%rsi
call   10e0 <sprintf@plt>
mov    -0x1c(%rbp),%eax
mov    $0x4c4b40,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    13c5 <file2charstarstar+0x1e5>
mov    -0x1c(%rbp),%esi
lea    0xcea(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%eax
add    $0x4c4b40,%eax
cltq
shl    $0x3,%rax
mov    %eax,%esi
call   10c0 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    13c0 <file2charstarstar+0x1e0>
mov    0x2c40(%rip),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%edx
lea    0xced(%rip),%rsi
mov    $0x4c4b40,%ecx
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
jmp    13c5 <file2charstarstar+0x1e5>
jmp    13ca <file2charstarstar+0x1ea>
movb   $0x0,-0x13b0(%rbp)
mov    -0x28(%rbp),%rdi
call   10b0 <feof@plt>
cmp    $0x0,%rax
je     13ee <file2charstarstar+0x20e>
movl   $0x1,-0x13b4(%rbp)
jmp    1256 <file2charstarstar+0x76>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
add    $0x13c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file2charstarstar>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1398,%rsp
mov    %rsi,0x8(%rsp)
mov    %rdi,%rbp
mov    $0x4c4b40,%edi
mov    $0x8,%esi
call   10a0 <calloc@plt>
mov    %rax,%r15
lea    0xdee(%rip),%rsi
mov    %rbp,%rdi
call   10e0 <fopen@plt>
test   %rax,%rax
je     1384 <file2charstarstar+0x1a4>
mov    %rax,%rbx
lea    0xe24(%rip),%r12
lea    0x10(%rsp),%r13
xor    %ebp,%ebp
jmp    1259 <file2charstarstar+0x79>
cs nopw 0x0(%rax,%rax,1)
mov    %r14d,%ebp
movb   $0x0,0x10(%rsp)
mov    %rbx,%rdi
call   10c0 <feof@plt>
test   %rax,%rax
jne    1339 <file2charstarstar+0x159>
mov    %rbx,%rdi
mov    $0x26,%esi
call   1100 <eat_comments@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1090 <fscanf@plt>
test   %rax,%rax
je     1248 <file2charstarstar+0x68>
mov    %r13,%rdi
mov    $0x2d,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     1300 <file2charstarstar+0x120>
mov    %r13,%rdi
call   1050 <strlen@plt>
lea    0xa(%rax),%edi
mov    $0x1,%esi
call   10a0 <calloc@plt>
movslq %ebp,%r14
mov    %rax,(%r15,%r14,8)
add    $0x1,%r14d
mov    %rax,%rdi
mov    %r13,%rsi
call   1030 <strcpy@plt>
imul   $0xae8d46a5,%r14d,%eax
add    $0x6b40,%eax
ror    $0x6,%eax
cmp    $0x35a,%eax
ja     1240 <file2charstarstar+0x60>
lea    0xd7e(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x2625a08(,%rbp,8),%esi
mov    %r15,%rdi
call   10d0 <realloc@plt>
test   %rax,%rax
je     135d <file2charstarstar+0x17d>
mov    %rax,%r15
jmp    1240 <file2charstarstar+0x60>
nopl   (%rax)
movsbl 0x10(%rsp),%edi
call   1080 <isalnum@plt>
test   %rax,%rax
jne    128b <file2charstarstar+0xab>
cmpb   $0x2e,0x10(%rsp)
je     128b <file2charstarstar+0xab>
mov    %r13,%rdi
mov    $0x2f,%esi
call   1060 <strchr@plt>
test   %rax,%rax
jne    128b <file2charstarstar+0xab>
jmp    1243 <file2charstarstar+0x63>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    0x8(%rsp),%rax
mov    %ebp,(%rax)
mov    %r15,%rax
add    $0x1398,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c7c(%rip),%rax
mov    (%rax),%edi
lea    0xd2c(%rip),%rsi
mov    %r14d,%edx
mov    $0x4c4b40,%ecx
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
lea    0xc77(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [79 x i8] c"Couldn't open file %s to create array of strings from its contents\0AExiting...\0A\00"
@.str.2 = [4 x i8] c" %s\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [68 x i8] c"Hey! We are about to reallocate to s in file2charstarstar. n= %d \0A\0A\00"
@stderr = global i32 0
@.str.5 = [88 x i8] c"ERROR: Ah Crap! realloc failure in file2charstarstar. n= %d MAX_COMM_FILE_TOKENS= %d\0A\00"
define i8** @file2charstarstar(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
%8 = alloca [5000 x i8]
%9 = alloca i32
store i8* %0, i8** %3
store i32* %1, i32** %4
%10 = call i64 @calloc(i32 5000000, i32 8)
%11 = inttoptr i64 %10 to i8**
store i8** %11, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %9
%12 = load i8*, i8** %3
%13 = call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %13, i32** %7
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %19
15: ; preds = %2
%16 = load i8*, i8** %3
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %2
br label %20
20: ; preds = %96, %19
%21 = load i32, i32* %9
%22 = icmp ne i32 %21, 0
%23 = xor i1 %22, true
br i1 %23, label %24, label %97
24: ; preds = %20
%25 = load i32*, i32** %7
%26 = call i32 @eat_comments(i32* %25, i8 signext 38)
%27 = load i32*, i32** %7
%28 = getelementptr inbounds [5000 x i8], [5000 x i8]* %8, i64 0, i64 0
%29 = call i64 @fscanf(i32* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %91
31: ; preds = %24
%32 = getelementptr inbounds [5000 x i8], [5000 x i8]* %8, i64 0, i64 0
%33 = call i32* @strchr(i8* %32, i8 signext 45)
%34 = icmp ne i32* %33, null
br i1 %34, label %49, label %35
35: ; preds = %31
%36 = getelementptr inbounds [5000 x i8], [5000 x i8]* %8, i64 0, i64 0
%37 = load i8, i8* %36
%38 = call i64 @isalnum(i8 signext %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %49, label %40
40: ; preds = %35
%41 = getelementptr inbounds [5000 x i8], [5000 x i8]* %8, i64 0, i64 0
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 46
br i1 %44, label %49, label %45
45: ; preds = %40
%46 = getelementptr inbounds [5000 x i8], [5000 x i8]* %8, i64 0, i64 0
%47 = call i32* @strchr(i8* %46, i8 signext 47)
%48 = icmp ne i32* %47, null
br i1 %48, label %49, label %89
49: ; preds = %45, %40, %35, %31
%50 = getelementptr inbounds [5000 x i8], [5000 x i8]* %8, i64 0, i64 0
%51 = call i32 @strlen(i8* %50)
%52 = add nsw i32 %51, 10
%53 = call i64 @calloc(i32 %52, i32 1)
%54 = inttoptr i64 %53 to i8*
%55 = load i8**, i8*** %5
%56 = load i32, i32* %6
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8*, i8** %55, i64 %57
store i8* %54, i8** %58
%59 = load i8**, i8*** %5
%60 = load i32, i32* %6
%61 = add nsw i32 %60, 1
store i32 %61, i32* %6
%62 = sext i32 %60 to i64
%63 = getelementptr inbounds i8*, i8** %59, i64 %62
%64 = load i8*, i8** %63
%65 = getelementptr inbounds [5000 x i8], [5000 x i8]* %8, i64 0, i64 0
%66 = call i32 @sprintf(i8* %64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %65)
%67 = load i32, i32* %6
%68 = srem i32 %67, 5000000
%69 = icmp eq i32 %68, 0
br i1 %69, label %70, label %88
70: ; preds = %49
%71 = load i32, i32* %6
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.4, i64 0, i64 0), i32 %71)
%73 = load i8**, i8*** %5
%74 = load i32, i32* %6
%75 = add nsw i32 %74, 5000000
%76 = sext i32 %75 to i64
%77 = mul i64 %76, 8
%78 = trunc i64 %77 to i32
%79 = call i64 @realloc(i8** %73, i32 %78)
%80 = inttoptr i64 %79 to i8**
store i8** %80, i8*** %5
%81 = icmp eq i8** %80, null
br i1 %81, label %82, label %87
82: ; preds = %70
%83 = load i32, i32* @stderr
%84 = load i32, i32* %6
%85 = call i32 @fprintf(i32 %83, i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str.5, i64 0, i64 0), i32 %84, i32 5000000)
%86 = call i32 @exit(i32 1)
unreachable
87: ; preds = %70
br label %88
88: ; preds = %87, %49
br label %89
89: ; preds = %88, %45
%90 = getelementptr inbounds [5000 x i8], [5000 x i8]* %8, i64 0, i64 0
store i8 0, i8* %90
br label %91
91: ; preds = %89, %24
%92 = load i32*, i32** %7
%93 = call i64 @feof(i32* %92)
%94 = icmp ne i64 %93, 0
br i1 %94, label %95, label %96
95: ; preds = %91
store i32 1, i32* %9
br label %96
96: ; preds = %95, %91
br label %20
97: ; preds = %20
%98 = load i32*, i32** %7
%99 = call i32 @fclose(i32* %98)
%100 = load i32, i32* %6
%101 = load i32*, i32** %4
store i32 %100, i32* %101
%102 = load i8**, i8*** %5
ret i8** %102
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [79 x i8] c"Couldn't open file %s to create array of strings from its contents\0AExiting...\0A\00"
@.str.2 = [4 x i8] c" %s\00"
@.str.4 = [68 x i8] c"Hey! We are about to reallocate to s in file2charstarstar. n= %d \0A\0A\00"
@stderr = global i32 0
@.str.5 = [88 x i8] c"ERROR: Ah Crap! realloc failure in file2charstarstar. n= %d MAX_COMM_FILE_TOKENS= %d\0A\00"
define i8** @file2charstarstar(i8* %0, i32* nocapture writeonly %1) {
%3 = alloca [5000 x i8]
%4 = tail call i64 @calloc(i32 5000000, i32 8)
%5 = getelementptr inbounds [5000 x i8], [5000 x i8]* %3, i64 0, i64 0
%6 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32* %6, null
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = inttoptr i64 %4 to i8**
br label %13
10: ; preds = %2
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([79 x i8], [79 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%12 = tail call i32 @exit(i32 1)
unreachable
13: ; preds = %8, %57
%14 = phi i8** [ %59, %57 ], [ %9, %8 ]
%15 = phi i32 [ %58, %57 ], [ 0, %8 ]
%16 = call i32 @eat_comments(i32* %6, i8 signext 38)
%17 = call i64 @fscanf(i32* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%18 = icmp eq i64 %17, 0
br i1 %18, label %57, label %19
19: ; preds = %13
%20 = call i32* @strchr(i8* %5, i8 signext 45)
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %32
22: ; preds = %19
%23 = load i8, i8* %5
%24 = call i64 @isalnum(i8 signext %23)
%25 = icmp ne i64 %24, 0
%26 = load i8, i8* %5
%27 = icmp eq i8 %26, 46
%28 = select i1 %25, i1 true, i1 %27
br i1 %28, label %32, label %29
29: ; preds = %22
%30 = call i32* @strchr(i8* %5, i8 signext 47)
%31 = icmp eq i32* %30, null
br i1 %31, label %54, label %32
32: ; preds = %29, %22, %19
%33 = call i32 @strlen(i8* %5)
%34 = add nsw i32 %33, 10
%35 = call i64 @calloc(i32 %34, i32 1)
%36 = inttoptr i64 %35 to i8*
%37 = sext i32 %15 to i64
%38 = getelementptr inbounds i8*, i8** %14, i64 %37
store i8* %36, i8** %38
%39 = add nsw i32 %15, 1
%40 = call i8* @strcpy(i8* dereferenceable(1) %36, i8* %5)
%41 = srem i32 %39, 5000000
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %54
43: ; preds = %32
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @.str.4, i64 0, i64 0), i32 %39)
%45 = shl i32 %15, 3
%46 = add i32 %45, 40000008
%47 = call i64 @realloc(i8** %14, i32 %46)
%48 = inttoptr i64 %47 to i8**
%49 = icmp eq i64 %47, 0
br i1 %49, label %50, label %54
50: ; preds = %43
%51 = load i32, i32* @stderr
%52 = call i32 @fprintf(i32 %51, i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str.5, i64 0, i64 0), i32 %39, i32 5000000)
%53 = call i32 @exit(i32 1)
unreachable
54: ; preds = %32, %43, %29
%55 = phi i32 [ %39, %43 ], [ %39, %32 ], [ %15, %29 ]
%56 = phi i8** [ %48, %43 ], [ %14, %32 ], [ %14, %29 ]
store i8 0, i8* %5
br label %57
57: ; preds = %54, %13
%58 = phi i32 [ %55, %54 ], [ %15, %13 ]
%59 = phi i8** [ %56, %54 ], [ %14, %13 ]
%60 = call i64 @feof(i32* %6)
%61 = icmp eq i64 %60, 0
br i1 %61, label %13, label %62
62: ; preds = %57
%63 = call i32 @fclose(i32* %6)
store i32 %58, i32* %1
ret i8** %59
}