#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*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ freeup(char **, int);
int /*<<< orphan*/ openit(char *, int /*<<< orphan*/ **, char *);
int splitup(char *, char **, int);
int /*<<< orphan*/ *stdin;
char *strdup(char *);
int getss(char **ss, char *fname) {
  char line[10000];
  char qqq[10000];
  char *spt[50];
  char *sx;
  int nsplit, i, j, num = 0, maxff;
  FILE *fff;
  if (fname == NULL)
    fff = stdin;
  else {
    openit(fname, &fff, "r");
  }
  maxff = 50;
  while (fgets(line, 10000, fff) != NULL) {
    nsplit = splitup(line, spt, maxff);
    sx = spt[0];
    if (sx[0] == '#') {
      freeup(spt, nsplit);
      continue;
    }
    if (nsplit < 1) {
      continue;
    }
    ss[num] = strdup(spt[0]);
    freeup(spt, nsplit);
    ++num;
  }
  if (fname != NULL)
    fclose(fff);
  return num;
}


x86 assembly (clang, -O0):
<getss>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4ff0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x4fd8(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    119e <getss+0x3e>
mov    0x2e59(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x4fe8(%rbp)
jmp    11b5 <getss+0x55>
mov    -0x10(%rbp),%rdi
lea    -0x4fe8(%rbp),%rsi
lea    0xe50(%rip),%rdx
call   1070 <openit@plt>
movl   $0x32,-0x4fdc(%rbp)
lea    -0x2720(%rbp),%rdi
mov    -0x4fe8(%rbp),%rdx
mov    $0x2710,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     128e <getss+0x12e>
lea    -0x2720(%rbp),%rdi
lea    -0x4fc0(%rbp),%rsi
mov    -0x4fdc(%rbp),%edx
call   1030 <splitup@plt>
mov    %eax,-0x4fcc(%rbp)
mov    -0x4fc0(%rbp),%rax
mov    %rax,-0x4fc8(%rbp)
mov    -0x4fc8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x23,%eax
jne    1238 <getss+0xd8>
lea    -0x4fc0(%rbp),%rdi
mov    -0x4fcc(%rbp),%esi
call   1060 <freeup@plt>
jmp    11bf <getss+0x5f>
cmpl   $0x1,-0x4fcc(%rbp)
jge    124a <getss+0xea>
jmp    11bf <getss+0x5f>
mov    -0x4fc0(%rbp),%rdi
call   1080 <strdup@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
movslq -0x4fd8(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
lea    -0x4fc0(%rbp),%rdi
mov    -0x4fcc(%rbp),%esi
call   1060 <freeup@plt>
mov    -0x4fd8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4fd8(%rbp)
jmp    11bf <getss+0x5f>
cmpq   $0x0,-0x10(%rbp)
je     12a5 <getss+0x145>
mov    -0x4fe8(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x4fd8(%rbp),%eax
add    $0x4ff0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getss>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28b8,%rsp
mov    %rsi,%r15
mov    %rdi,%r14
test   %rsi,%rsi
je     1197 <getss+0x37>
lea    0xe7d(%rip),%rdx
lea    0x8(%rsp),%rsi
mov    %r15,%rdi
call   1070 <openit@plt>
mov    0x8(%rsp),%rdx
jmp    11a6 <getss+0x46>
mov    0x2e4a(%rip),%rax
mov    (%rax),%rdx
mov    %rdx,0x8(%rsp)
lea    0x1a0(%rsp),%rdi
mov    $0x2710,%esi
call   1050 <fgets@plt>
xor    %r12d,%r12d
test   %rax,%rax
je     122a <getss+0xca>
lea    0x1a0(%rsp),%rbx
lea    0x10(%rsp),%r13
jmp    11f1 <getss+0x91>
nop
mov    %r13,%rdi
mov    %ebp,%esi
call   1060 <freeup@plt>
mov    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x2710,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     122a <getss+0xca>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    $0x32,%edx
call   1030 <splitup@plt>
mov    %eax,%ebp
mov    0x10(%rsp),%rdi
cmpb   $0x23,(%rdi)
je     11d0 <getss+0x70>
test   %ebp,%ebp
jle    11da <getss+0x7a>
call   1080 <strdup@plt>
mov    %rax,(%r14,%r12,8)
mov    %r13,%rdi
mov    %ebp,%esi
call   1060 <freeup@plt>
add    $0x1,%r12
jmp    11da <getss+0x7a>
test   %r15,%r15
je     1239 <getss+0xd9>
mov    0x8(%rsp),%rdi
call   1040 <fclose@plt>
mov    %r12d,%eax
add    $0x28b8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@stdin = global i32* null
@.str = [2 x i8] c"r\00"
define i32 @getss(i8** nocapture writeonly %0, i8* %1) {
%3 = alloca [10000 x i8]
%4 = alloca [50 x i8*]
%5 = alloca i32*
%6 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 0
%7 = bitcast [50 x i8*]* %4 to i8*
%8 = bitcast i32** %5 to i8*
%9 = icmp eq i8* %1, null
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load i32*, i32** @stdin
store i32* %11, i32** %5
br label %15
12: ; preds = %2
%13 = call i32 @openit(i8* %1, i32** %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = load i32*, i32** %5
br label %15
15: ; preds = %12, %10
%16 = phi i32* [ %14, %12 ], [ %11, %10 ]
%17 = call i32* @fgets(i8* %6, i32 10000, i32* %16)
%18 = icmp eq i32* %17, null
br i1 %18, label %48, label %19
19: ; preds = %15
%20 = getelementptr inbounds [50 x i8*], [50 x i8*]* %4, i64 0, i64 0
br label %21
21: ; preds = %19, %36
%22 = phi i64 [ 0, %19 ], [ %40, %36 ]
br label %23
23: ; preds = %21, %30
%24 = call i32 @splitup(i8* %6, i8** %20, i32 50)
%25 = load i8*, i8** %20
%26 = load i8, i8* %25
%27 = icmp eq i8 %26, 35
br i1 %27, label %28, label %34
28: ; preds = %23
%29 = call i32 @freeup(i8** %20, i32 %24)
br label %30
30: ; preds = %28, %34
%31 = load i32*, i32** %5
%32 = call i32* @fgets(i8* %6, i32 10000, i32* %31)
%33 = icmp eq i32* %32, null
br i1 %33, label %44, label %23
34: ; preds = %23
%35 = icmp slt i32 %24, 1
br i1 %35, label %30, label %36
36: ; preds = %34
%37 = call i8* @strdup(i8* %25)
%38 = getelementptr inbounds i8*, i8** %0, i64 %22
store i8* %37, i8** %38
%39 = call i32 @freeup(i8** %20, i32 %24)
%40 = add nuw i64 %22, 1
%41 = load i32*, i32** %5
%42 = call i32* @fgets(i8* %6, i32 10000, i32* %41)
%43 = icmp eq i32* %42, null
br i1 %43, label %46, label %21
44: ; preds = %30
%45 = trunc i64 %22 to i32
br label %48
46: ; preds = %36
%47 = trunc i64 %40 to i32
br label %48
48: ; preds = %46, %44, %15
%49 = phi i32 [ 0, %15 ], [ %45, %44 ], [ %47, %46 ]
br i1 %9, label %53, label %50
50: ; preds = %48
%51 = load i32*, i32** %5
%52 = call i32 @fclose(i32* %51)
br label %53
53: ; preds = %50, %48
ret i32 %49
}