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

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
void *malloc(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strtok(char *, char *);
char ***readPairs(char *filename, char **plaintext, char **ciphertext) {
  FILE *fp;
  char ch;
  fp = fopen(filename, "r");
  if (fp == NULL) {
    perror("Error while opening the file.\n");
    exit(EXIT_FAILURE);
  }
  char ***pairsGroup = malloc(sizeof(char **) * 2);
  short lineNumber = 0;
  short column;
  char *string = malloc(sizeof(char) * 9);
  char line[19];
  while (fgets(line, sizeof(line), fp)) {
    char *actualLine = strtok(line, ",");
    for (column = 0; column < 2 && actualLine != NULL; column++) {
      if (actualLine[8] == '\n') {
        actualLine[8] = (char)'\0';
      }
      if (column == 0) {
        plaintext[lineNumber] = malloc(sizeof(char) * 9);
        strcpy(plaintext[lineNumber], actualLine);
      } else if (column == 1) {
        ciphertext[lineNumber] = malloc(sizeof(char) * 9);
        strcpy(ciphertext[lineNumber], actualLine);
      }
      actualLine = strtok(NULL, ",\0");
    }
    lineNumber++;
  }
  pairsGroup[0] = plaintext;
  pairsGroup[1] = ciphertext;
  fclose(fp);
  return pairsGroup;
}


x86 assembly (clang, -O0):
<readPairs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe61(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11cd <readPairs+0x4d>
lea    0xe48(%rip),%rdi
call   1080 <perror@plt>
mov    0x2e1a(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    $0x10,%edi
call   1060 <malloc@plt>
mov    %rax,-0x30(%rbp)
movw   $0x0,-0x32(%rbp)
mov    $0x9,%edi
call   1060 <malloc@plt>
mov    %rax,-0x40(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x13,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     1325 <readPairs+0x1a5>
lea    -0x60(%rbp),%rdi
lea    0xe0b(%rip),%rsi
call   1090 <strtok@plt>
mov    %rax,-0x68(%rbp)
movw   $0x0,-0x34(%rbp)
movswl -0x34(%rbp),%ecx
xor    %eax,%eax
cmp    $0x2,%ecx
mov    %al,-0x69(%rbp)
jge    1242 <readPairs+0xc2>
cmpq   $0x0,-0x68(%rbp)
setne  %al
mov    %al,-0x69(%rbp)
mov    -0x69(%rbp),%al
test   $0x1,%al
jne    1252 <readPairs+0xd2>
jmp    1314 <readPairs+0x194>
mov    -0x68(%rbp),%rax
movsbl 0x8(%rax),%eax
cmp    $0xa,%eax
jne    126b <readPairs+0xeb>
mov    -0x68(%rbp),%rax
movb   $0x0,0x8(%rax)
movswl -0x34(%rbp),%eax
cmp    $0x0,%eax
jne    12ad <readPairs+0x12d>
mov    $0x9,%edi
call   1060 <malloc@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
movswq -0x32(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movswq -0x32(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x68(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    12ef <readPairs+0x16f>
movswl -0x34(%rbp),%eax
cmp    $0x1,%eax
jne    12ea <readPairs+0x16a>
mov    $0x9,%edi
call   1060 <malloc@plt>
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
movswq -0x32(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movswq -0x32(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x68(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    12ef <readPairs+0x16f>
xor    %eax,%eax
mov    %eax,%edi
lea    0xd29(%rip),%rsi
call   1090 <strtok@plt>
mov    %rax,-0x68(%rbp)
mov    -0x34(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x34(%rbp)
jmp    1225 <readPairs+0xa5>
mov    -0x32(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x32(%rbp)
jmp    11ef <readPairs+0x6f>
mov    -0x10(%rbp),%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x30(%rbp),%rax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readPairs>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rdx,0x8(%rsp)
mov    %rsi,0x10(%rsp)
lea    0xe61(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     12d2 <readPairs+0x152>
mov    %rax,%r13
mov    $0x10,%edi
call   1060 <malloc@plt>
mov    %rax,0x18(%rsp)
lea    0x20(%rsp),%rdi
mov    $0x13,%esi
mov    %r13,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     12a2 <readPairs+0x122>
xor    %r12d,%r12d
lea    0x20(%rsp),%rbp
jmp    1235 <readPairs+0xb5>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x9,%edi
call   1060 <malloc@plt>
mov    0x8(%rsp),%rcx
mov    %rax,(%rcx,%r15,8)
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
xor    %edi,%edi
lea    0xe0c(%rip),%rsi
call   1090 <strtok@plt>
add    $0x1,%r12d
mov    %rbp,%rdi
mov    $0x13,%esi
mov    %r13,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     12a2 <readPairs+0x122>
mov    %rbp,%rdi
lea    0xde2(%rip),%rsi
call   1090 <strtok@plt>
test   %rax,%rax
je     121c <readPairs+0x9c>
mov    %rax,%r14
cmpb   $0xa,0x8(%rax)
jne    1257 <readPairs+0xd7>
movb   $0x0,0x8(%r14)
movswq %r12w,%r15
mov    $0x9,%edi
call   1060 <malloc@plt>
mov    0x10(%rsp),%rcx
mov    %rax,(%rcx,%r15,8)
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
xor    %edi,%edi
lea    0xda1(%rip),%rsi
call   1090 <strtok@plt>
test   %rax,%rax
je     121c <readPairs+0x9c>
mov    %rax,%rbx
cmpb   $0xa,0x8(%rax)
jne    11f0 <readPairs+0x70>
movb   $0x0,0x8(%rbx)
jmp    11f0 <readPairs+0x70>
mov    0x10(%rsp),%rax
mov    0x18(%rsp),%rbx
mov    %rax,(%rbx)
mov    0x8(%rsp),%rax
mov    %rax,0x8(%rbx)
mov    %r13,%rdi
call   1040 <fclose@plt>
mov    %rbx,%rax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd29(%rip),%rdi
call   1080 <perror@plt>
mov    0x2cfb(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [31 x i8] c"Error while opening the file.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [2 x i8] c",\00"
@.str.3 = [3 x i8] c",\00\00"
define i8*** @readPairs(i8* %0, i8** %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8**
%7 = alloca i32*
%8 = alloca i8
%9 = alloca i8***
%10 = alloca i16
%11 = alloca i16
%12 = alloca i8*
%13 = alloca [19 x i8]
%14 = alloca i8*
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i8** %2, i8*** %6
%15 = load i8*, i8** %4
%16 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %16, i32** %7
%17 = load i32*, i32** %7
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %23
19: ; preds = %3
%20 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%21 = load i32, i32* @EXIT_FAILURE
%22 = call i32 @exit(i32 %21)
unreachable
23: ; preds = %3
%24 = call i8* @malloc(i32 16)
%25 = bitcast i8* %24 to i8***
store i8*** %25, i8**** %9
store i16 0, i16* %10
%26 = call i8* @malloc(i32 9)
store i8* %26, i8** %12
br label %27
27: ; preds = %93, %23
%28 = getelementptr inbounds [19 x i8], [19 x i8]* %13, i64 0, i64 0
%29 = load i32*, i32** %7
%30 = call i64 @fgets(i8* %28, i32 19, i32* %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %96
32: ; preds = %27
%33 = getelementptr inbounds [19 x i8], [19 x i8]* %13, i64 0, i64 0
%34 = call i8* @strtok(i8* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i8* %34, i8** %14
store i16 0, i16* %11
br label %35
35: ; preds = %90, %32
%36 = load i16, i16* %11
%37 = sext i16 %36 to i32
%38 = icmp slt i32 %37, 2
br i1 %38, label %39, label %42
39: ; preds = %35
%40 = load i8*, i8** %14
%41 = icmp ne i8* %40, null
br label %42
42: ; preds = %39, %35
%43 = phi i1 [ false, %35 ], [ %41, %39 ]
br i1 %43, label %44, label %93
44: ; preds = %42
%45 = load i8*, i8** %14
%46 = getelementptr inbounds i8, i8* %45, i64 8
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %48, 10
br i1 %49, label %50, label %53
50: ; preds = %44
%51 = load i8*, i8** %14
%52 = getelementptr inbounds i8, i8* %51, i64 8
store i8 0, i8* %52
br label %53
53: ; preds = %50, %44
%54 = load i16, i16* %11
%55 = sext i16 %54 to i32
%56 = icmp eq i32 %55, 0
br i1 %56, label %57, label %70
57: ; preds = %53
%58 = call i8* @malloc(i32 9)
%59 = load i8**, i8*** %5
%60 = load i16, i16* %10
%61 = sext i16 %60 to i64
%62 = getelementptr inbounds i8*, i8** %59, i64 %61
store i8* %58, i8** %62
%63 = load i8**, i8*** %5
%64 = load i16, i16* %10
%65 = sext i16 %64 to i64
%66 = getelementptr inbounds i8*, i8** %63, i64 %65
%67 = load i8*, i8** %66
%68 = load i8*, i8** %14
%69 = call i32 @strcpy(i8* %67, i8* %68)
br label %88
70: ; preds = %53
%71 = load i16, i16* %11
%72 = sext i16 %71 to i32
%73 = icmp eq i32 %72, 1
br i1 %73, label %74, label %87
74: ; preds = %70
%75 = call i8* @malloc(i32 9)
%76 = load i8**, i8*** %6
%77 = load i16, i16* %10
%78 = sext i16 %77 to i64
%79 = getelementptr inbounds i8*, i8** %76, i64 %78
store i8* %75, i8** %79
%80 = load i8**, i8*** %6
%81 = load i16, i16* %10
%82 = sext i16 %81 to i64
%83 = getelementptr inbounds i8*, i8** %80, i64 %82
%84 = load i8*, i8** %83
%85 = load i8*, i8** %14
%86 = call i32 @strcpy(i8* %84, i8* %85)
br label %87
87: ; preds = %74, %70
br label %88
88: ; preds = %87, %57
%89 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i8* %89, i8** %14
br label %90
90: ; preds = %88
%91 = load i16, i16* %11
%92 = add i16 %91, 1
store i16 %92, i16* %11
br label %35
93: ; preds = %42
%94 = load i16, i16* %10
%95 = add i16 %94, 1
store i16 %95, i16* %10
br label %27
96: ; preds = %27
%97 = load i8**, i8*** %5
%98 = load i8***, i8**** %9
%99 = getelementptr inbounds i8**, i8*** %98, i64 0
store i8** %97, i8*** %99
%100 = load i8**, i8*** %6
%101 = load i8***, i8**** %9
%102 = getelementptr inbounds i8**, i8*** %101, i64 1
store i8** %100, i8*** %102
%103 = load i32*, i32** %7
%104 = call i32 @fclose(i32* %103)
%105 = load i8***, i8**** %9
ret i8*** %105
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [31 x i8] c"Error while opening the file.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [2 x i8] c",\00"
@.str.3 = [3 x i8] c",\00\00"
define noalias i8*** @readPairs(i8* nocapture %0, i8** %1, i8** %2) {
%4 = alloca [19 x i8]
%5 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %11
7: ; preds = %3
%8 = tail call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* @EXIT_FAILURE
%10 = tail call i32 @exit(i32 %9)
unreachable
11: ; preds = %3
%12 = tail call dereferenceable_or_null(16) i8* @malloc(i32 16)
%13 = bitcast i8* %12 to i8***
%14 = getelementptr inbounds [19 x i8], [19 x i8]* %4, i64 0, i64 0
%15 = call i64 @fgets(i8* %14, i32 19, i32* %5)
%16 = icmp eq i64 %15, 0
br i1 %16, label %47, label %17
17: ; preds = %11, %43
%18 = phi i16 [ %44, %43 ], [ 0, %11 ]
%19 = call i8* @strtok(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp eq i8* %19, null
br i1 %20, label %43, label %21
21: ; preds = %17
%22 = sext i16 %18 to i64
%23 = getelementptr inbounds i8, i8* %19, i64 8
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 10
br i1 %25, label %26, label %27
26: ; preds = %21
store i8 0, i8* %23
br label %27
27: ; preds = %26, %21
%28 = call dereferenceable_or_null(9) i8* @malloc(i32 9)
%29 = getelementptr inbounds i8*, i8** %1, i64 %22
store i8* %28, i8** %29
%30 = call i32 @strcpy(i8* %28, i8* %19)
%31 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%32 = icmp eq i8* %31, null
br i1 %32, label %43, label %33
33: ; preds = %27
%34 = getelementptr inbounds i8*, i8** %2, i64 %22
%35 = getelementptr inbounds i8, i8* %31, i64 8
%36 = load i8, i8* %35
%37 = icmp eq i8 %36, 10
br i1 %37, label %38, label %39
38: ; preds = %33
store i8 0, i8* %35
br label %39
39: ; preds = %38, %33
%40 = call dereferenceable_or_null(9) i8* @malloc(i32 9)
store i8* %40, i8** %34
%41 = call i32 @strcpy(i8* %40, i8* %31)
%42 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %43
43: ; preds = %27, %39, %17
%44 = add i16 %18, 1
%45 = call i64 @fgets(i8* %14, i32 19, i32* %5)
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %17
47: ; preds = %43, %11
store i8** %1, i8*** %13
%48 = getelementptr inbounds i8**, i8*** %13, i64 1
store i8** %2, i8*** %48
%49 = call i32 @fclose(i32* %5)
ret i8*** %13
}