#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 ssize_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(char *);
int getline(char **, size_t *, int /*<<< orphan*/ *);
int /*<<< orphan*/ make_words(char **, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ test_general_make_words();
int /*<<< orphan*/ test_reachable_size();
int main(int argc, char **argv) {
  FILE *fp;
  if (argc > 1) {
    if (argc > 2 && strcmp(argv[1], "-args") == 0) {
      make_words(argv + 2, argc - 2);
      return EXIT_SUCCESS;
    } else if (argc == 3 && strcmp(argv[1], "-file") == 0 &&
               (fp = fopen(argv[2], "r"))) {
      char *lines[11] = {NULL, NULL, NULL, NULL, NULL, NULL,
                         NULL, NULL, NULL, NULL, NULL};
      ssize_t numchar;
      size_t n = 0;
      int numlines = 0;
      while ((numchar = getline(lines + numlines, &n, fp)) > 1 &&
             numlines < 10) {
        lines[numlines][numchar - 1] = '\0';
        n = 0;
        numlines++;
      }
      if (numlines == 0) {
        fprintf(stderr,
                "File is empty or getline failed! Cannot call make_words.\n");
      } else {
        make_words(lines, numlines);
        for (; numlines >= 0; numlines--) {
          free(lines[numlines]);
        }
      }
      fclose(fp);
      return EXIT_SUCCESS;
    } else {
      fprintf(stderr,
              "Invalid arguments to main or cannot open file. Aborting.\n");
      return EXIT_FAILURE;
    }
  }
  printf("\n==================================================================="
         "===\n\n");
  test_reachable_size();
  printf("\n==================================================================="
         "===\n\n");
  test_general_make_words();
  printf("\n==================================================================="
         "===\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    13c5 <main+0x215>
cmpl   $0x2,-0x8(%rbp)
jle    121f <main+0x6f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe14(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    121f <main+0x6f>
mov    -0x10(%rbp),%rdi
add    $0x10,%rdi
mov    -0x8(%rbp),%esi
sub    $0x2,%esi
call   10b0 <make_words@plt>
mov    0x2dbb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    13fe <main+0x24e>
cmpl   $0x3,-0x8(%rbp)
jne    139f <main+0x1ef>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdce(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    139f <main+0x1ef>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xdb6(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     139f <main+0x1ef>
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x58,%edx
call   1080 <memset@plt>
movq   $0x0,-0x80(%rbp)
movl   $0x0,-0x84(%rbp)
lea    -0x70(%rbp),%rdi
movslq -0x84(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x18(%rbp),%rdx
lea    -0x80(%rbp),%rsi
call   10d0 <getline@plt>
mov    %eax,%ecx
mov    %ecx,-0x74(%rbp)
xor    %eax,%eax
cmp    $0x1,%ecx
mov    %al,-0x85(%rbp)
jle    12d0 <main+0x120>
cmpl   $0xa,-0x84(%rbp)
setl   %al
mov    %al,-0x85(%rbp)
mov    -0x85(%rbp),%al
test   $0x1,%al
jne    12e3 <main+0x133>
jmp    1318 <main+0x168>
movslq -0x84(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rax
mov    -0x74(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
movq   $0x0,-0x80(%rbp)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    128b <main+0xdb>
cmpl   $0x0,-0x84(%rbp)
jne    133f <main+0x18f>
mov    0x2cb4(%rip),%rax
mov    (%rax),%edi
lea    0xcd9(%rip),%rsi
call   10a0 <fprintf@plt>
jmp    1385 <main+0x1d5>
lea    -0x70(%rbp),%rdi
mov    -0x84(%rbp),%esi
call   10b0 <make_words@plt>
cmpl   $0x0,-0x84(%rbp)
jl     1380 <main+0x1d0>
movslq -0x84(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rdi
call   1030 <free@plt>
mov    -0x84(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x84(%rbp)
jmp    134e <main+0x19e>
jmp    1385 <main+0x1d5>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
mov    0x2c3b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    13fe <main+0x24e>
mov    0x2c3a(%rip),%rax
mov    (%rax),%edi
lea    0xc99(%rip),%rsi
call   10a0 <fprintf@plt>
mov    0x2c1d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    13fe <main+0x24e>
lea    0xcb6(%rip),%rdi
call   1070 <printf@plt>
mov    $0x0,%al
call   1060 <test_reachable_size@plt>
lea    0xca3(%rip),%rdi
call   1070 <printf@plt>
mov    $0x0,%al
call   1040 <test_general_make_words@plt>
lea    0xc90(%rip),%rdi
call   1070 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x70,%rsp
cmp    $0x2,%edi
jl     1207 <main+0x67>
je     11e7 <main+0x47>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x8(%rsi),%rdi
lea    0xe3d(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1245 <main+0xa5>
cmp    $0x3,%ebp
jne    11e7 <main+0x47>
mov    0x8(%rbx),%rdi
lea    0xe29(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1261 <main+0xc1>
mov    0x2df2(%rip),%rax
mov    (%rax),%edi
lea    0xe51(%rip),%rsi
call   1090 <fprintf@plt>
mov    0x2dd5(%rip),%rax
mov    (%rax),%ebx
jmp    1236 <main+0x96>
lea    0xe74(%rip),%rbp
mov    %rbp,%rdi
call   1040 <puts@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <test_reachable_size@plt>
mov    %rbp,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <test_general_make_words@plt>
mov    %rbp,%rdi
call   1040 <puts@plt>
mov    %ebx,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
add    $0x10,%rbx
add    $0xfffffffe,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
call   10a0 <make_words@plt>
mov    0x2d73(%rip),%rax
mov    (%rax),%ebx
jmp    1236 <main+0x96>
mov    0x10(%rbx),%rdi
lea    0xda0(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     11e7 <main+0x47>
mov    %rax,%r14
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x60(%rsp)
movq   $0x0,0x8(%rsp)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
mov    %rax,%rdx
call   10c0 <getline@plt>
cmp    $0x2,%eax
jl     1338 <main+0x198>
lea    0x18(%rsp),%rbx
xor    %ebp,%ebp
lea    0x8(%rsp),%r12
xchg   %ax,%ax
mov    -0x8(%rbx),%rcx
add    $0xffffffff,%eax
movb   $0x0,(%rcx,%rax,1)
movq   $0x0,0x8(%rsp)
lea    0x1(%rbp),%r15
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
call   10c0 <getline@plt>
add    $0x8,%rbx
cmp    $0x2,%eax
jl     1308 <main+0x168>
cmp    $0x9,%rbp
mov    %r15,%rbp
jb     12d0 <main+0x130>
lea    0x10(%rsp),%rdi
mov    %r15d,%esi
call   10a0 <make_words@plt>
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    -0x8(%rbx,%rbp,8),%rdi
call   1030 <free@plt>
lea    -0x1(%rbp),%rax
add    %r15,%rbp
mov    %rax,%rbp
jne    1320 <main+0x180>
jmp    134d <main+0x1ad>
mov    0x2ca1(%rip),%rax
mov    (%rax),%edi
lea    0xcc6(%rip),%rsi
call   1090 <fprintf@plt>
mov    %r14,%rdi
call   1060 <fclose@plt>
jmp    1256 <main+0xb6>

LLVM IR (-O0):
@.str = [6 x i8] c"-args\00"
@EXIT_SUCCESS = global i32 0
@.str.1 = [6 x i8] c"-file\00"
@.str.2 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.3 = [58 x i8] c"File is empty or getline failed! Cannot call make_words.\0A\00"
@.str.4 = [58 x i8] c"Invalid arguments to main or cannot open file. Aborting.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.5 = [74 x i8] c"\0A======================================================================\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [11 x i8*]
%8 = alloca i32
%9 = alloca i64
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 1
br i1 %12, label %13, label %101
13: ; preds = %2
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, 2
br i1 %15, label %16, label %29
16: ; preds = %13
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %29
22: ; preds = %16
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i32, i32* %4
%26 = sub nsw i32 %25, 2
%27 = call i32 @make_words(i8** %24, i32 %26)
%28 = load i32, i32* @EXIT_SUCCESS
store i32 %28, i32* %3
br label %107
29: ; preds = %16, %13
%30 = load i32, i32* %4
%31 = icmp eq i32 %30, 3
br i1 %31, label %32, label %97
32: ; preds = %29
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %97
38: ; preds = %32
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 2
%41 = load i8*, i8** %40
%42 = call i32* @fopen(i8* %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %42, i32** %6
%43 = icmp ne i32* %42, null
br i1 %43, label %44, label %97
44: ; preds = %38
%45 = bitcast [11 x i8*]* %7 to i8*
store i64 0, i64* %9
store i32 0, i32* %10
br label %46
46: ; preds = %59, %44
%47 = getelementptr inbounds [11 x i8*], [11 x i8*]* %7, i64 0, i64 0
%48 = load i32, i32* %10
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8*, i8** %47, i64 %49
%51 = load i32*, i32** %6
%52 = call i32 @getline(i8** %50, i64* %9, i32* %51)
store i32 %52, i32* %8
%53 = icmp sgt i32 %52, 1
br i1 %53, label %54, label %57
54: ; preds = %46
%55 = load i32, i32* %10
%56 = icmp slt i32 %55, 10
br label %57
57: ; preds = %54, %46
%58 = phi i1 [ false, %46 ], [ %56, %54 ]
br i1 %58, label %59, label %70
59: ; preds = %57
%60 = load i32, i32* %10
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [11 x i8*], [11 x i8*]* %7, i64 0, i64 %61
%63 = load i8*, i8** %62
%64 = load i32, i32* %8
%65 = sub nsw i32 %64, 1
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i8, i8* %63, i64 %66
store i8 0, i8* %67
store i64 0, i64* %9
%68 = load i32, i32* %10
%69 = add nsw i32 %68, 1
store i32 %69, i32* %10
br label %46
70: ; preds = %57
%71 = load i32, i32* %10
%72 = icmp eq i32 %71, 0
br i1 %72, label %73, label %76
73: ; preds = %70
%74 = load i32, i32* @stderr
%75 = call i32 @fprintf(i32 %74, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0))
br label %93
76: ; preds = %70
%77 = getelementptr inbounds [11 x i8*], [11 x i8*]* %7, i64 0, i64 0
%78 = load i32, i32* %10
%79 = call i32 @make_words(i8** %77, i32 %78)
br label %80
80: ; preds = %89, %76
%81 = load i32, i32* %10
%82 = icmp sge i32 %81, 0
br i1 %82, label %83, label %92
83: ; preds = %80
%84 = load i32, i32* %10
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds [11 x i8*], [11 x i8*]* %7, i64 0, i64 %85
%87 = load i8*, i8** %86
%88 = call i32 @free(i8* %87)
br label %89
89: ; preds = %83
%90 = load i32, i32* %10
%91 = add nsw i32 %90, -1
store i32 %91, i32* %10
br label %80
92: ; preds = %80
br label %93
93: ; preds = %92, %73
%94 = load i32*, i32** %6
%95 = call i32 @fclose(i32* %94)
%96 = load i32, i32* @EXIT_SUCCESS
store i32 %96, i32* %3
br label %107
97: ; preds = %38, %32, %29
%98 = load i32, i32* @stderr
%99 = call i32 @fprintf(i32 %98, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0))
%100 = load i32, i32* @EXIT_FAILURE
store i32 %100, i32* %3
br label %107
101: ; preds = %2
%102 = call i32 @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.5, i64 0, i64 0))
%103 = call i32 (...) @test_reachable_size()
%104 = call i32 @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.5, i64 0, i64 0))
%105 = call i32 (...) @test_general_make_words()
%106 = call i32 @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %3
br label %107
107: ; preds = %101, %97, %93, %22
%108 = load i32, i32* %3
ret i32 %108
}

LLVM IR (-O2):
@.str = [6 x i8] c"-args\00"
@EXIT_SUCCESS = global i32 0
@.str.1 = [6 x i8] c"-file\00"
@.str.2 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.3 = [58 x i8] c"File is empty or getline failed! Cannot call make_words.\0A\00"
@.str.4 = [58 x i8] c"Invalid arguments to main or cannot open file. Aborting.\0A\00"
@EXIT_FAILURE = global i32 0
@str.7 = [73 x i8] c"\0A======================================================================\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [11 x i8*]
%4 = alloca i64
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %70
6: ; preds = %2
%7 = icmp eq i32 %0, 2
br i1 %7, label %66, label %8
8: ; preds = %6
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %8
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = add nsw i32 %0, -2
%16 = tail call i32 @make_words(i8** %14, i32 %15)
%17 = load i32, i32* @EXIT_SUCCESS
br label %76
18: ; preds = %8
%19 = icmp eq i32 %0, 3
br i1 %19, label %20, label %66
20: ; preds = %18
%21 = load i8*, i8** %9
%22 = tail call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %66
24: ; preds = %20
%25 = getelementptr inbounds i8*, i8** %1, i64 2
%26 = load i8*, i8** %25
%27 = tail call i32* @fopen(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%28 = icmp eq i32* %27, null
br i1 %28, label %66, label %29
29: ; preds = %24
%30 = bitcast [11 x i8*]* %3 to i8*
%31 = bitcast i64* %4 to i8*
store i64 0, i64* %4
%32 = getelementptr inbounds [11 x i8*], [11 x i8*]* %3, i64 0, i64 0
%33 = call i32 @getline(i8** %32, i64* %4, i32* %27)
%34 = icmp sgt i32 %33, 1
br i1 %34, label %35, label %53
35: ; preds = %29, %35
%36 = phi i64 [ %43, %35 ], [ 0, %29 ]
%37 = phi i32 [ %45, %35 ], [ %33, %29 ]
%38 = phi i8** [ %44, %35 ], [ %32, %29 ]
%39 = load i8*, i8** %38
%40 = add nsw i32 %37, -1
%41 = zext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %39, i64 %41
store i8 0, i8* %42
store i64 0, i64* %4
%43 = add nuw nsw i64 %36, 1
%44 = getelementptr inbounds [11 x i8*], [11 x i8*]* %3, i64 0, i64 %43
%45 = call i32 @getline(i8** %44, i64* %4, i32* %27)
%46 = icmp sgt i32 %45, 1
%47 = icmp ult i64 %36, 9
%48 = select i1 %46, i1 %47, i1 false
br i1 %48, label %35, label %49
49: ; preds = %35
%50 = trunc i64 %43 to i32
%51 = call i32 @make_words(i8** %32, i32 %50)
%52 = and i64 %43, 4294967295
br label %56
53: ; preds = %29
%54 = load i32, i32* @stderr
%55 = call i32 @fprintf(i32 %54, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0))
br label %63
56: ; preds = %49, %56
%57 = phi i64 [ %52, %49 ], [ %61, %56 ]
%58 = getelementptr inbounds [11 x i8*], [11 x i8*]* %3, i64 0, i64 %57
%59 = load i8*, i8** %58
%60 = call i32 @free(i8* %59)
%61 = add nsw i64 %57, -1
%62 = icmp eq i64 %57, 0
br i1 %62, label %63, label %56
63: ; preds = %56, %53
%64 = call i32 @fclose(i32* %27)
%65 = load i32, i32* @EXIT_SUCCESS
br label %76
66: ; preds = %6, %24, %20, %18
%67 = load i32, i32* @stderr
%68 = tail call i32 @fprintf(i32 %67, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0))
%69 = load i32, i32* @EXIT_FAILURE
br label %76
70: ; preds = %2
%71 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str.7, i64 0, i64 0))
%72 = tail call i32 (...) @test_reachable_size()
%73 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str.7, i64 0, i64 0))
%74 = tail call i32 (...) @test_general_make_words()
%75 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str.7, i64 0, i64 0))
br label %76
76: ; preds = %70, %66, %63, %13
%77 = phi i32 [ %17, %13 ], [ %65, %63 ], [ %69, %66 ], [ 0, %70 ]
ret i32 %77
}