#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 */

/* Variables and functions */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ exit(int);
scalar_t__ ferror(int /*<<< orphan*/);
char *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ intersect_friends(char *, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ puts(char *);
scalar_t__ sscanf(char *, char *, char *, int *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void myReduceLines(void) {
  char *line = (char *)calloc(10000, sizeof(char));
  char *key = (char *)calloc(10000, sizeof(char));
  char *prev_key = (char *)calloc(10000, sizeof(char));
  char *friends = (char *)calloc(40 * 10000, sizeof(char));
  char *mutual_friends = (char *)calloc(40 * 10000, sizeof(char));
  char *outputs = (char *)calloc(40 * 10000, sizeof(char));
  {
    if (line == NULL) {
      fprintf(stderr, "couldnt allocate mem\n");
      exit(1);
    }
  };
  {
    if (key == NULL) {
      fprintf(stderr, "couldnt allocate mem\n");
      exit(1);
    }
  };
  {
    if (prev_key == NULL) {
      fprintf(stderr, "couldnt allocate mem\n");
      exit(1);
    }
  };
  {
    if (friends == NULL) {
      fprintf(stderr, "couldnt allocate mem\n");
      exit(1);
    }
  };
  {
    if (mutual_friends == NULL) {
      fprintf(stderr, "couldnt allocate mem\n");
      exit(1);
    }
  };
  {
    if (outputs == NULL) {
      fprintf(stderr, "couldnt allocate mem\n");
      exit(1);
    }
  };
  char *result;
  int key_count = 0;
  int idx;
  while ((result = fgets(line, 10000, stdin)) != NULL) {
    if (ferror(stdin)) {
      perror("Error reading stdin.");
    }
    while (line[idx]) {
      if (line[idx] == '\n') {
        line[idx] = ' ';
      }
      idx++;
    }
    idx = 0;
    if (sscanf(line, "%[^\t]%n", key, &idx) > 0) {
      strcpy(friends, &line[idx]);
      ;
      ;
      ;
      if (strcmp(prev_key, key) == 0) {
        key_count += 1;
        intersect_friends(mutual_friends, friends);
      } else {
        if (key_count != 0) {
          strcpy(outputs, prev_key);
          strcat(outputs, "\t");
          strcat(outputs, mutual_friends);
          puts(outputs);
        }
        strcpy(prev_key, key);
        strcpy(mutual_friends, friends);
        key_count = 0;
      }
    }
  }
  if (ferror(stdin)) {
    perror("Error reading stdin.");
  }
  free(outputs);
  free(mutual_friends);
  free(friends);
  free(prev_key);
  free(key);
  free(line);
}


x86 assembly (clang, -O0):
<myReduceLines>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    $0x2710,%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
mov    %rax,-0x8(%rbp)
mov    $0x2710,%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x2710,%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x61a80,%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
mov    %rax,-0x20(%rbp)
mov    $0x61a80,%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
mov    %rax,-0x28(%rbp)
mov    $0x61a80,%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1274 <myReduceLines+0xa4>
mov    0x2d7c(%rip),%rax
mov    (%rax),%edi
lea    0xd9b(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
cmpq   $0x0,-0x10(%rbp)
jne    129e <myReduceLines+0xce>
mov    0x2d52(%rip),%rax
mov    (%rax),%edi
lea    0xd71(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
cmpq   $0x0,-0x18(%rbp)
jne    12c8 <myReduceLines+0xf8>
mov    0x2d28(%rip),%rax
mov    (%rax),%edi
lea    0xd47(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
cmpq   $0x0,-0x20(%rbp)
jne    12f2 <myReduceLines+0x122>
mov    0x2cfe(%rip),%rax
mov    (%rax),%edi
lea    0xd1d(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
cmpq   $0x0,-0x28(%rbp)
jne    131c <myReduceLines+0x14c>
mov    0x2cd4(%rip),%rax
mov    (%rax),%edi
lea    0xcf3(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
cmpq   $0x0,-0x30(%rbp)
jne    1346 <myReduceLines+0x176>
mov    0x2caa(%rip),%rax
mov    (%rax),%edi
lea    0xcc9(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2c90(%rip),%rax
mov    (%rax),%edx
mov    $0x2710,%esi
call   1070 <fgets@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
je     14b3 <myReduceLines+0x2e3>
mov    0x2c6f(%rip),%rax
mov    (%rax),%edi
call   1060 <ferror@plt>
cmp    $0x0,%rax
je     1396 <myReduceLines+0x1c6>
lea    0xc85(%rip),%rdi
call   10d0 <perror@plt>
jmp    139b <myReduceLines+0x1cb>
mov    -0x8(%rbp),%rax
movslq -0x40(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     13dc <myReduceLines+0x20c>
mov    -0x8(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    13ce <myReduceLines+0x1fe>
mov    -0x8(%rbp),%rax
movslq -0x40(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    139b <myReduceLines+0x1cb>
movl   $0x0,-0x40(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xc39(%rip),%rsi
lea    -0x40(%rbp),%rcx
call   10c0 <sscanf@plt>
cmp    $0x0,%rax
jle    14ae <myReduceLines+0x2de>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x40(%rbp),%rax
add    %rax,%rsi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    144b <myReduceLines+0x27b>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10b0 <intersect_friends@plt>
jmp    14a9 <myReduceLines+0x2d9>
cmpl   $0x0,-0x3c(%rbp)
je     1488 <myReduceLines+0x2b8>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x30(%rbp),%rdi
lea    0xbc6(%rip),%rsi
call   10e0 <strcat@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   10e0 <strcat@plt>
mov    -0x30(%rbp),%rdi
call   1050 <puts@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <strcpy@plt>
movl   $0x0,-0x3c(%rbp)
jmp    14ae <myReduceLines+0x2de>
jmp    134d <myReduceLines+0x17d>
mov    0x2b2e(%rip),%rax
mov    (%rax),%edi
call   1060 <ferror@plt>
cmp    $0x0,%rax
je     14d7 <myReduceLines+0x307>
lea    0xb44(%rip),%rdi
call   10d0 <perror@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myReduceLines>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    $0x2710,%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
mov    %rax,%rbx
mov    $0x2710,%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
mov    %rax,%r14
mov    $0x2710,%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
mov    %rax,%r15
mov    $0x61a80,%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
mov    %rax,%r12
mov    $0x61a80,%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
mov    %rax,%rbp
mov    $0x61a80,%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
mov    %rax,0x10(%rsp)
test   %rbx,%rbx
je     145a <myReduceLines+0x28a>
test   %r14,%r14
je     145a <myReduceLines+0x28a>
test   %r15,%r15
je     145a <myReduceLines+0x28a>
test   %r12,%r12
je     145a <myReduceLines+0x28a>
test   %rbp,%rbp
je     145a <myReduceLines+0x28a>
mov    %rbp,0x18(%rsp)
cmpq   $0x0,0x10(%rsp)
je     145a <myReduceLines+0x28a>
mov    0x2d57(%rip),%r13
mov    0x0(%r13),%edx
mov    %rbx,%rdi
mov    $0x2710,%esi
call   1070 <fgets@plt>
test   %rax,%rax
je     13fb <myReduceLines+0x22b>
xor    %ebp,%ebp
mov    %r14,0x20(%rsp)
jmp    12ea <myReduceLines+0x11a>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ebp
mov    0x18(%rsp),%rdi
mov    %r12,%rsi
call   10b0 <intersect_friends@plt>
mov    0x0(%r13),%edx
mov    %rbx,%rdi
mov    $0x2710,%esi
call   1070 <fgets@plt>
test   %rax,%rax
je     13fb <myReduceLines+0x22b>
mov    0x0(%r13),%edi
call   1060 <ferror@plt>
test   %rax,%rax
jne    13ea <myReduceLines+0x21a>
mov    0xc(%rsp),%eax
jmp    131f <myReduceLines+0x14f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movb   $0x20,(%rbx,%rcx,1)
mov    0xc(%rsp),%eax
add    $0x1,%eax
mov    %eax,0xc(%rsp)
movslq %eax,%rcx
movzbl (%rbx,%rcx,1),%edx
cmp    $0xa,%dl
je     1310 <myReduceLines+0x140>
test   %dl,%dl
jne    1318 <myReduceLines+0x148>
movl   $0x0,0xc(%rsp)
mov    %rbx,%rdi
lea    0xcea(%rip),%rsi
mov    %r14,%rdx
lea    0xc(%rsp),%rcx
call   10c0 <sscanf@plt>
test   %rax,%rax
jle    12d0 <myReduceLines+0x100>
movslq 0xc(%rsp),%rsi
add    %rbx,%rsi
mov    %r12,%rdi
call   1040 <strcpy@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
je     12c0 <myReduceLines+0xf0>
test   %ebp,%ebp
mov    0x18(%rsp),%rbp
je     13cd <myReduceLines+0x1fd>
mov    %r13,%r14
mov    %r12,%r13
mov    %r15,%r12
mov    0x10(%rsp),%r15
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <strcpy@plt>
mov    %r15,%rdi
lea    0xc8c(%rip),%rsi
call   10e0 <strcat@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
call   10e0 <strcat@plt>
mov    %r15,%rdi
mov    %r12,%r15
mov    %r13,%r12
mov    %r14,%r13
mov    0x20(%rsp),%r14
call   1050 <puts@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1040 <strcpy@plt>
xor    %ebp,%ebp
jmp    12d0 <myReduceLines+0x100>
lea    0xc25(%rip),%rdi
call   10d0 <perror@plt>
jmp    12fc <myReduceLines+0x12c>
mov    0x0(%r13),%edi
call   1060 <ferror@plt>
test   %rax,%rax
jne    144c <myReduceLines+0x27c>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xbc3(%rip),%rdi
call   10d0 <perror@plt>
jmp    1409 <myReduceLines+0x239>
mov    0x2b77(%rip),%rax
mov    (%rax),%edi
lea    0xb96(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c"couldnt allocate mem\0A\00"
@stdin = global i32 0
@.str.1 = [21 x i8] c"Error reading stdin.\00"
@.str.2 = [8 x i8] c"%[^\09]%n\00"
@.str.3 = [2 x i8] c"\09\00"
define void @myReduceLines() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = call i64 @calloc(i32 10000, i32 1)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %1
%12 = call i64 @calloc(i32 10000, i32 1)
%13 = inttoptr i64 %12 to i8*
store i8* %13, i8** %2
%14 = call i64 @calloc(i32 10000, i32 1)
%15 = inttoptr i64 %14 to i8*
store i8* %15, i8** %3
%16 = call i64 @calloc(i32 400000, i32 1)
%17 = inttoptr i64 %16 to i8*
store i8* %17, i8** %4
%18 = call i64 @calloc(i32 400000, i32 1)
%19 = inttoptr i64 %18 to i8*
store i8* %19, i8** %5
%20 = call i64 @calloc(i32 400000, i32 1)
%21 = inttoptr i64 %20 to i8*
store i8* %21, i8** %6
%22 = load i8*, i8** %1
%23 = icmp eq i8* %22, null
br i1 %23, label %24, label %28
24: ; preds = %0
%25 = load i32, i32* @stderr
%26 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %0
%29 = load i8*, i8** %2
%30 = icmp eq i8* %29, null
br i1 %30, label %31, label %35
31: ; preds = %28
%32 = load i32, i32* @stderr
%33 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%34 = call i32 @exit(i32 1)
unreachable
35: ; preds = %28
%36 = load i8*, i8** %3
%37 = icmp eq i8* %36, null
br i1 %37, label %38, label %42
38: ; preds = %35
%39 = load i32, i32* @stderr
%40 = call i32 @fprintf(i32 %39, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%41 = call i32 @exit(i32 1)
unreachable
42: ; preds = %35
%43 = load i8*, i8** %4
%44 = icmp eq i8* %43, null
br i1 %44, label %45, label %49
45: ; preds = %42
%46 = load i32, i32* @stderr
%47 = call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%48 = call i32 @exit(i32 1)
unreachable
49: ; preds = %42
%50 = load i8*, i8** %5
%51 = icmp eq i8* %50, null
br i1 %51, label %52, label %56
52: ; preds = %49
%53 = load i32, i32* @stderr
%54 = call i32 @fprintf(i32 %53, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%55 = call i32 @exit(i32 1)
unreachable
56: ; preds = %49
%57 = load i8*, i8** %6
%58 = icmp eq i8* %57, null
br i1 %58, label %59, label %63
59: ; preds = %56
%60 = load i32, i32* @stderr
%61 = call i32 @fprintf(i32 %60, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%62 = call i32 @exit(i32 1)
unreachable
63: ; preds = %56
store i32 0, i32* %8
br label %64
64: ; preds = %143, %63
%65 = load i8*, i8** %1
%66 = load i32, i32* @stdin
%67 = call i8* @fgets(i8* %65, i32 10000, i32 %66)
store i8* %67, i8** %7
%68 = icmp ne i8* %67, null
br i1 %68, label %69, label %144
69: ; preds = %64
%70 = load i32, i32* @stdin
%71 = call i64 @ferror(i32 %70)
%72 = icmp ne i64 %71, 0
br i1 %72, label %73, label %75
73: ; preds = %69
%74 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %75
75: ; preds = %73, %69
br label %76
76: ; preds = %96, %75
%77 = load i8*, i8** %1
%78 = load i32, i32* %9
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i8, i8* %77, i64 %79
%81 = load i8, i8* %80
%82 = icmp ne i8 %81, 0
br i1 %82, label %83, label %99
83: ; preds = %76
%84 = load i8*, i8** %1
%85 = load i32, i32* %9
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i8, i8* %84, i64 %86
%88 = load i8, i8* %87
%89 = sext i8 %88 to i32
%90 = icmp eq i32 %89, 10
br i1 %90, label %91, label %96
91: ; preds = %83
%92 = load i8*, i8** %1
%93 = load i32, i32* %9
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds i8, i8* %92, i64 %94
store i8 32, i8* %95
br label %96
96: ; preds = %91, %83
%97 = load i32, i32* %9
%98 = add nsw i32 %97, 1
store i32 %98, i32* %9
br label %76
99: ; preds = %76
store i32 0, i32* %9
%100 = load i8*, i8** %1
%101 = load i8*, i8** %2
%102 = call i64 @sscanf(i8* %100, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %101, i32* %9)
%103 = icmp sgt i64 %102, 0
br i1 %103, label %104, label %143
104: ; preds = %99
%105 = load i8*, i8** %4
%106 = load i8*, i8** %1
%107 = load i32, i32* %9
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds i8, i8* %106, i64 %108
%110 = call i32 @strcpy(i8* %105, i8* %109)
%111 = load i8*, i8** %3
%112 = load i8*, i8** %2
%113 = call i64 @strcmp(i8* %111, i8* %112)
%114 = icmp eq i64 %113, 0
br i1 %114, label %115, label %121
115: ; preds = %104
%116 = load i32, i32* %8
%117 = add nsw i32 %116, 1
store i32 %117, i32* %8
%118 = load i8*, i8** %5
%119 = load i8*, i8** %4
%120 = call i32 @intersect_friends(i8* %118, i8* %119)
br label %142
121: ; preds = %104
%122 = load i32, i32* %8
%123 = icmp ne i32 %122, 0
br i1 %123, label %124, label %135
124: ; preds = %121
%125 = load i8*, i8** %6
%126 = load i8*, i8** %3
%127 = call i32 @strcpy(i8* %125, i8* %126)
%128 = load i8*, i8** %6
%129 = call i32 @strcat(i8* %128, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%130 = load i8*, i8** %6
%131 = load i8*, i8** %5
%132 = call i32 @strcat(i8* %130, i8* %131)
%133 = load i8*, i8** %6
%134 = call i32 @puts(i8* %133)
br label %135
135: ; preds = %124, %121
%136 = load i8*, i8** %3
%137 = load i8*, i8** %2
%138 = call i32 @strcpy(i8* %136, i8* %137)
%139 = load i8*, i8** %5
%140 = load i8*, i8** %4
%141 = call i32 @strcpy(i8* %139, i8* %140)
store i32 0, i32* %8
br label %142
142: ; preds = %135, %115
br label %143
143: ; preds = %142, %99
br label %64
144: ; preds = %64
%145 = load i32, i32* @stdin
%146 = call i64 @ferror(i32 %145)
%147 = icmp ne i64 %146, 0
br i1 %147, label %148, label %150
148: ; preds = %144
%149 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %150
150: ; preds = %148, %144
%151 = load i8*, i8** %6
%152 = call i32 @free(i8* %151)
%153 = load i8*, i8** %5
%154 = call i32 @free(i8* %153)
%155 = load i8*, i8** %4
%156 = call i32 @free(i8* %155)
%157 = load i8*, i8** %3
%158 = call i32 @free(i8* %157)
%159 = load i8*, i8** %2
%160 = call i32 @free(i8* %159)
%161 = load i8*, i8** %1
%162 = call i32 @free(i8* %161)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"couldnt allocate mem\0A\00"
@stdin = global i32 0
@.str.1 = [21 x i8] c"Error reading stdin.\00"
@.str.2 = [8 x i8] c"%[^\09]%n\00"
@.str.3 = [2 x i8] c"\09\00"
define void @myReduceLines() {
%1 = alloca i32
%2 = tail call i64 @calloc(i32 10000, i32 1)
%3 = inttoptr i64 %2 to i8*
%4 = tail call i64 @calloc(i32 10000, i32 1)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i64 @calloc(i32 10000, i32 1)
%7 = inttoptr i64 %6 to i8*
%8 = tail call i64 @calloc(i32 400000, i32 1)
%9 = inttoptr i64 %8 to i8*
%10 = tail call i64 @calloc(i32 400000, i32 1)
%11 = inttoptr i64 %10 to i8*
%12 = tail call i64 @calloc(i32 400000, i32 1)
%13 = inttoptr i64 %12 to i8*
%14 = icmp eq i64 %2, 0
br i1 %14, label %15, label %19
15: ; preds = %0
%16 = load i32, i32* @stderr
%17 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%18 = tail call i32 @exit(i32 1)
unreachable
19: ; preds = %0
%20 = icmp eq i64 %4, 0
br i1 %20, label %21, label %25
21: ; preds = %19
%22 = load i32, i32* @stderr
%23 = tail call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%24 = tail call i32 @exit(i32 1)
unreachable
25: ; preds = %19
%26 = icmp eq i64 %6, 0
br i1 %26, label %27, label %31
27: ; preds = %25
%28 = load i32, i32* @stderr
%29 = tail call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%30 = tail call i32 @exit(i32 1)
unreachable
31: ; preds = %25
%32 = icmp eq i64 %8, 0
br i1 %32, label %33, label %37
33: ; preds = %31
%34 = load i32, i32* @stderr
%35 = tail call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%36 = tail call i32 @exit(i32 1)
unreachable
37: ; preds = %31
%38 = icmp eq i64 %10, 0
br i1 %38, label %39, label %43
39: ; preds = %37
%40 = load i32, i32* @stderr
%41 = tail call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%42 = tail call i32 @exit(i32 1)
unreachable
43: ; preds = %37
%44 = icmp eq i64 %12, 0
br i1 %44, label %45, label %49
45: ; preds = %43
%46 = load i32, i32* @stderr
%47 = tail call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%48 = tail call i32 @exit(i32 1)
unreachable
49: ; preds = %43
%50 = bitcast i32* %1 to i8*
%51 = load i32, i32* @stdin
%52 = call i8* @fgets(i8* %3, i32 10000, i32 %51)
%53 = icmp eq i8* %52, null
br i1 %53, label %101, label %54
54: ; preds = %49, %96
%55 = phi i32 [ %97, %96 ], [ 0, %49 ]
%56 = load i32, i32* @stdin
%57 = call i64 @ferror(i32 %56)
%58 = icmp eq i64 %57, 0
br i1 %58, label %61, label %59
59: ; preds = %54
%60 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %61
61: ; preds = %59, %54
%62 = load i32, i32* %1
br label %63
63: ; preds = %70, %61
%64 = phi i32 [ %72, %70 ], [ %62, %61 ]
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i8, i8* %3, i64 %65
%67 = load i8, i8* %66
switch i8 %67, label %70 [
i8 0, label %73
i8 10, label %68
]
68: ; preds = %63
store i8 32, i8* %66
%69 = load i32, i32* %1
br label %70
70: ; preds = %63, %68
%71 = phi i32 [ %64, %63 ], [ %69, %68 ]
%72 = add nsw i32 %71, 1
store i32 %72, i32* %1
br label %63
73: ; preds = %63
store i32 0, i32* %1
%74 = call i64 @sscanf(i8* %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %5, i32* %1)
%75 = icmp sgt i64 %74, 0
br i1 %75, label %76, label %96
76: ; preds = %73
%77 = load i32, i32* %1
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i8, i8* %3, i64 %78
%80 = call i32 @strcpy(i8* %9, i8* %79)
%81 = call i64 @strcmp(i8* %7, i8* %5)
%82 = icmp eq i64 %81, 0
br i1 %82, label %83, label %86
83: ; preds = %76
%84 = add nsw i32 %55, 1
%85 = call i32 @intersect_friends(i8* %11, i8* %9)
br label %96
86: ; preds = %76
%87 = icmp eq i32 %55, 0
br i1 %87, label %93, label %88
88: ; preds = %86
%89 = call i32 @strcpy(i8* %13, i8* %7)
%90 = call i32 @strcat(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%91 = call i32 @strcat(i8* %13, i8* %11)
%92 = call i32 @puts(i8* %13)
br label %93
93: ; preds = %88, %86
%94 = call i32 @strcpy(i8* %7, i8* %5)
%95 = call i32 @strcpy(i8* %11, i8* %9)
br label %96
96: ; preds = %83, %93, %73
%97 = phi i32 [ %84, %83 ], [ 0, %93 ], [ %55, %73 ]
%98 = load i32, i32* @stdin
%99 = call i8* @fgets(i8* %3, i32 10000, i32 %98)
%100 = icmp eq i8* %99, null
br i1 %100, label %101, label %54
101: ; preds = %96, %49
%102 = load i32, i32* @stdin
%103 = call i64 @ferror(i32 %102)
%104 = icmp eq i64 %103, 0
br i1 %104, label %107, label %105
105: ; preds = %101
%106 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %107
107: ; preds = %105, %101
%108 = call i32 @free(i8* %13)
%109 = call i32 @free(i8* %11)
%110 = call i32 @free(i8* %9)
%111 = call i32 @free(i8* %7)
%112 = call i32 @free(i8* %5)
%113 = call i32 @free(i8* %3)
ret void
}