#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 */
struct option {
  char *member_0;
  char member_3;
  int /*<<< orphan*/ member_2;
  int /*<<< orphan*/ member_1;
};

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ add_to_list(char *);
int atoi(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int getopt_long(int, char **, char *, struct option *, int *);
int /*<<< orphan*/ optarg;
int /*<<< orphan*/ print_and_free();
#define required_argument 128
scalar_t__ scanf(char *, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  char input_word[256];
  int c;
  int option_index = 0;
  int count = -1;
  static struct option long_options[] = {{"count", required_argument, 0, 'c'},
                                         {0, 0, 0, 0}};
  while (1) {
    c = getopt_long(argc, argv, "c:", long_options, &option_index);
    if (c == -1) {
      break;
    }
    switch (c) {
    case 'c':
      count = atoi(optarg);
      break;
    }
  }
  fprintf(stderr, "Accepting %i input strings\n", count);
  while (scanf("%256s", input_word) != EOF) {
    add_to_list(input_word);
    if (!--count)
      break;
  }
  print_and_free();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x118(%rbp)
movl   $0xffffffff,-0x11c(%rbp)
ff ff ff
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe6b(%rip),%rdx
lea    0x2ebe(%rip),%rcx
lea    -0x118(%rbp),%r8
call   1030 <getopt_long@plt>
mov    %eax,-0x114(%rbp)
cmpl   $0xffffffff,-0x114(%rbp)
jne    11c6 <main+0x66>
jmp    11f3 <main+0x93>
mov    -0x114(%rbp),%eax
sub    $0x63,%eax
jne    11ee <main+0x8e>
jmp    11da <main+0x7a>
mov    0x2e17(%rip),%rax
mov    (%rax),%edi
call   1080 <atoi@plt>
mov    %eax,-0x11c(%rbp)
jmp    118d <main+0x2d>
mov    0x2dd6(%rip),%rax
mov    (%rax),%edi
mov    -0x11c(%rbp),%edx
lea    0xe00(%rip),%rsi
call   1040 <fprintf@plt>
lea    -0x110(%rbp),%rsi
lea    0xe09(%rip),%rdi
call   1070 <scanf@plt>
mov    0x2db8(%rip),%rcx
cmp    (%rcx),%rax
je     125f <main+0xff>
lea    -0x110(%rbp),%rdi
call   1050 <add_to_list@plt>
mov    -0x11c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x11c(%rbp)
cmp    $0x0,%eax
jne    125a <main+0xfa>
jmp    125f <main+0xff>
jmp    120e <main+0xae>
mov    $0x0,%al
call   1060 <print_and_free@plt>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
movl   $0x0,0xc(%rsp)
mov    $0xffffffff,%ebx
lea    0xe7c(%rip),%r15
lea    0x2ecf(%rip),%r12
lea    0xc(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
mov    %r13,%r8
call   1030 <getopt_long@plt>
cmp    $0xffffffff,%eax
je     11cf <main+0x6f>
cmp    $0x63,%eax
jne    11a0 <main+0x40>
mov    0x2e34(%rip),%rax
mov    (%rax),%edi
call   1080 <atoi@plt>
mov    %eax,%ebx
jmp    11a0 <main+0x40>
mov    0x2dfa(%rip),%rax
mov    (%rax),%edi
lea    0xe2a(%rip),%rsi
mov    %ebx,%edx
call   1040 <fprintf@plt>
lea    0xe38(%rip),%r14
lea    0x10(%rsp),%rbp
mov    0x2de7(%rip),%r15
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbp,%rsi
call   1070 <scanf@plt>
cmp    (%r15),%rax
je     121d <main+0xbd>
mov    %rbp,%rdi
call   1050 <add_to_list@plt>
add    $0xffffffff,%ebx
jne    1200 <main+0xa0>
xor    %eax,%eax
call   1060 <print_and_free@plt>
xor    %eax,%eax
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32, i32 }
@main.long_options = internal global [2 x %struct.option] [%struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8 -128, i32 0, i32 99 }, %struct.option zeroinitializer]
@.str = [6 x i8] c"count\00"
@.str.1 = [3 x i8] c"c:\00"
@optarg = global i32 0
@stderr = global i32 0
@.str.2 = [28 x i8] c"Accepting %i input strings\0A\00"
@.str.3 = [6 x i8] c"%256s\00"
@EOF = global i64 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [256 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
store i32 -1, i32* %9
br label %10
10: ; preds = %2, %22
%11 = load i32, i32* %4
%12 = load i8**, i8*** %5
%13 = call i32 @getopt_long(i32 %11, i8** %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %struct.option* getelementptr inbounds ([2 x %struct.option], [2 x %struct.option]* @main.long_options, i64 0, i64 0), i32* %8)
store i32 %13, i32* %7
%14 = load i32, i32* %7
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %17
16: ; preds = %10
br label %23
17: ; preds = %10
%18 = load i32, i32* %7
switch i32 %18, label %22 [
i32 99, label %19
]
19: ; preds = %17
%20 = load i32, i32* @optarg
%21 = call i32 @atoi(i32 %20)
store i32 %21, i32* %9
br label %22
22: ; preds = %17, %19
br label %10
23: ; preds = %16
%24 = load i32, i32* @stderr
%25 = load i32, i32* %9
%26 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %39, %23
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%29 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %28)
%30 = load i64, i64* @EOF
%31 = icmp ne i64 %29, %30
br i1 %31, label %32, label %40
32: ; preds = %27
%33 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%34 = call i32 @add_to_list(i8* %33)
%35 = load i32, i32* %9
%36 = add nsw i32 %35, -1
store i32 %36, i32* %9
%37 = icmp ne i32 %36, 0
br i1 %37, label %39, label %38
38: ; preds = %32
br label %40
39: ; preds = %32
br label %27
40: ; preds = %38, %27
%41 = call i32 (...) @print_and_free()
ret i32 0
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32, i32 }
@main.long_options = internal global [2 x %struct.option] [%struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8 -128, i32 0, i32 99 }, %struct.option zeroinitializer]
@.str = [6 x i8] c"count\00"
@.str.1 = [3 x i8] c"c:\00"
@optarg = global i32 0
@stderr = global i32 0
@.str.2 = [28 x i8] c"Accepting %i input strings\0A\00"
@.str.3 = [6 x i8] c"%256s\00"
@EOF = global i64 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [256 x i8]
%4 = alloca i32
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%6 = bitcast i32* %4 to i8*
store i32 0, i32* %4
br label %7
7: ; preds = %11, %2
%8 = phi i32 [ %13, %11 ], [ -1, %2 ]
br label %9
9: ; preds = %7, %9
%10 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %struct.option* getelementptr inbounds ([2 x %struct.option], [2 x %struct.option]* @main.long_options, i64 0, i64 0), i32* %4)
switch i32 %10, label %9 [
i32 -1, label %14
i32 99, label %11
]
11: ; preds = %9
%12 = load i32, i32* @optarg
%13 = call i32 @atoi(i32 %12)
br label %7
14: ; preds = %9
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %8)
br label %17
17: ; preds = %22, %14
%18 = phi i32 [ %8, %14 ], [ %24, %22 ]
%19 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %5)
%20 = load i64, i64* @EOF
%21 = icmp eq i64 %19, %20
br i1 %21, label %26, label %22
22: ; preds = %17
%23 = call i32 @add_to_list(i8* %5)
%24 = add nsw i32 %18, -1
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %17
26: ; preds = %22, %17
%27 = call i32 (...) @print_and_free()
ret i32 0
}