#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 *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, char *);
scalar_t__ isalnum(char);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ *strchr(char *, char);
int strlen(char *);
char **file2charstarstar(char *FileName, int *N) {
  char **s = (char **)calloc(1000000, 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);
      }
      sprintf(temp, "");
    }
    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    $0xf4240,%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    0xdfe(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    122f <file2charstarstar+0x6f>
mov    -0x8(%rbp),%rsi
lea    0xde2(%rip),%rdi
call   1060 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
jmp    1234 <file2charstarstar+0x74>
cmpl   $0x0,-0x13b4(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    124d <file2charstarstar+0x8d>
jmp    1364 <file2charstarstar+0x1a4>
mov    -0x28(%rbp),%rdi
mov    $0x26,%esi
call   10e0 <eat_comments@plt>
mov    -0x28(%rbp),%rdi
lea    -0x13b0(%rbp),%rdx
lea    0xde4(%rip),%rsi
call   1080 <fscanf@plt>
cmp    $0x0,%rax
je     1342 <file2charstarstar+0x182>
lea    -0x13b0(%rbp),%rdi
mov    $0x2d,%esi
call   1050 <strchr@plt>
cmp    $0x0,%rax
jne    12d8 <file2charstarstar+0x118>
movsbl -0x13b0(%rbp),%edi
call   1070 <isalnum@plt>
cmp    $0x0,%rax
jne    12d8 <file2charstarstar+0x118>
movsbl -0x13b0(%rbp),%eax
cmp    $0x2e,%eax
je     12d8 <file2charstarstar+0x118>
lea    -0x13b0(%rbp),%rdi
mov    $0x2f,%esi
call   1050 <strchr@plt>
cmp    $0x0,%rax
je     132d <file2charstarstar+0x16d>
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    0xd2c(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
lea    -0x13b0(%rbp),%rdi
lea    0xd15(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
mov    -0x28(%rbp),%rdi
call   10a0 <feof@plt>
cmp    $0x0,%rax
je     135f <file2charstarstar+0x19f>
movl   $0x1,-0x13b4(%rbp)
jmp    1234 <file2charstarstar+0x74>
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    $0x1388,%rsp
mov    %rsi,%r14
mov    %rdi,%r12
mov    $0xf4240,%edi
mov    $0x8,%esi
call   10a0 <calloc@plt>
mov    %rax,%r15
lea    0xe10(%rip),%rsi
mov    %r12,%rdi
call   10c0 <fopen@plt>
test   %rax,%rax
je     12dd <file2charstarstar+0x11d>
mov    %rax,%rbx
xor    %ebp,%ebp
lea    0xe44(%rip),%r12
mov    %rsp,%r13
jmp    125b <file2charstarstar+0x9b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r13,%rdi
call   1050 <strlen@plt>
lea    0xa(%rax),%edi
mov    $0x1,%esi
call   10a0 <calloc@plt>
movslq %ebp,%rbp
mov    %rax,(%r15,%rbp,8)
add    $0x1,%ebp
mov    %rax,%rdi
mov    %r13,%rsi
call   1030 <strcpy@plt>
movb   $0x0,(%rsp)
mov    %rbx,%rdi
call   10b0 <feof@plt>
test   %rax,%rax
jne    12bd <file2charstarstar+0xfd>
mov    %rbx,%rdi
mov    $0x26,%esi
call   10e0 <eat_comments@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1090 <fscanf@plt>
test   %rax,%rax
je     124e <file2charstarstar+0x8e>
mov    %r13,%rdi
mov    $0x2d,%esi
call   1060 <strchr@plt>
test   %rax,%rax
jne    1220 <file2charstarstar+0x60>
movsbl (%rsp),%edi
call   1080 <isalnum@plt>
test   %rax,%rax
jne    1220 <file2charstarstar+0x60>
cmpb   $0x2e,(%rsp)
je     1220 <file2charstarstar+0x60>
mov    %r13,%rdi
mov    $0x2f,%esi
call   1060 <strchr@plt>
test   %rax,%rax
jne    1220 <file2charstarstar+0x60>
jmp    124a <file2charstarstar+0x8a>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %ebp,(%r14)
mov    %r15,%rax
add    $0x1388,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd1e(%rip),%rdi
mov    %r12,%rsi
call   1070 <printf@plt>
mov    $0x1,%edi
call   10d0 <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 = [1 x i8] zeroinitializer
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 1000000, 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 @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 = %75, %19
%21 = load i32, i32* %9
%22 = icmp ne i32 %21, 0
%23 = xor i1 %22, true
br i1 %23, label %24, label %76
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 %70
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 %67
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 (i8*, i8*, ...) @sprintf(i8* %64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %65)
br label %67
67: ; preds = %49, %45
%68 = getelementptr inbounds [5000 x i8], [5000 x i8]* %8, i64 0, i64 0
%69 = call i32 (i8*, i8*, ...) @sprintf(i8* %68, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
br label %70
70: ; preds = %67, %24
%71 = load i32*, i32** %7
%72 = call i64 @feof(i32* %71)
%73 = icmp ne i64 %72, 0
br i1 %73, label %74, label %75
74: ; preds = %70
store i32 1, i32* %9
br label %75
75: ; preds = %74, %70
br label %20
76: ; preds = %20
%77 = load i32*, i32** %7
%78 = call i32 @fclose(i32* %77)
%79 = load i32, i32* %6
%80 = load i32*, i32** %4
store i32 %79, i32* %80
%81 = load i8**, i8*** %5
ret i8** %81
}

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"
define i8** @file2charstarstar(i8* %0, i32* nocapture writeonly %1) {
%3 = alloca [5000 x i8]
%4 = tail call i64 @calloc(i32 1000000, i32 8)
%5 = inttoptr i64 %4 to i8**
%6 = getelementptr inbounds [5000 x i8], [5000 x i8]* %3, i64 0, i64 0
%7 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = tail call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %2, %41
%13 = phi i32 [ %42, %41 ], [ 0, %2 ]
%14 = call i32 @eat_comments(i32* %7, i8 signext 38)
%15 = call i64 @fscanf(i32* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%16 = icmp eq i64 %15, 0
br i1 %16, label %41, label %17
17: ; preds = %12
%18 = call i32* @strchr(i8* %6, i8 signext 45)
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %30
20: ; preds = %17
%21 = load i8, i8* %6
%22 = call i64 @isalnum(i8 signext %21)
%23 = icmp ne i64 %22, 0
%24 = load i8, i8* %6
%25 = icmp eq i8 %24, 46
%26 = select i1 %23, i1 true, i1 %25
br i1 %26, label %30, label %27
27: ; preds = %20
%28 = call i32* @strchr(i8* %6, i8 signext 47)
%29 = icmp eq i32* %28, null
br i1 %29, label %39, label %30
30: ; preds = %27, %20, %17
%31 = call i32 @strlen(i8* %6)
%32 = add nsw i32 %31, 10
%33 = call i64 @calloc(i32 %32, i32 1)
%34 = inttoptr i64 %33 to i8*
%35 = sext i32 %13 to i64
%36 = getelementptr inbounds i8*, i8** %5, i64 %35
store i8* %34, i8** %36
%37 = add nsw i32 %13, 1
%38 = call i8* @strcpy(i8* dereferenceable(1) %34, i8* %6)
br label %39
39: ; preds = %30, %27
%40 = phi i32 [ %37, %30 ], [ %13, %27 ]
store i8 0, i8* %6
br label %41
41: ; preds = %39, %12
%42 = phi i32 [ %40, %39 ], [ %13, %12 ]
%43 = call i64 @feof(i32* %7)
%44 = icmp eq i64 %43, 0
br i1 %44, label %12, label %45
45: ; preds = %41
%46 = call i32 @fclose(i32* %7)
store i32 %42, i32* %1
ret i8** %5
}