#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 slPair {
  int dummy;
};
struct lineFile {
  int dummy;
};
typedef int /*<<< orphan*/ row;

/* Variables and functions */
int /*<<< orphan*/ cloneString(char *);
int /*<<< orphan*/ lineFileClose(struct lineFile **);
scalar_t__ lineFileNextRow(struct lineFile *, char **, int);
struct lineFile *lineFileOpen(char *, int);
int /*<<< orphan*/ slPairAdd(struct slPair **, char *, int /*<<< orphan*/);
int /*<<< orphan*/ slReverse(struct slPair **);
struct slPair *slPairTwoColumnFile(char *fileName) {
  char *row[2];
  struct slPair *list = NULL;
  struct lineFile *lf = lineFileOpen(fileName, 1);
  while (lineFileNextRow(lf, row, (sizeof(row) / sizeof((row)[0]))))
    slPairAdd(&list, row[0], cloneString(row[1]));
  lineFileClose(&lf);
  slReverse(&list);
  return list;
}


x86 assembly (clang, -O0):
<slPairTwoColumnFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1080 <lineFileOpen@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x2,%edx
call   1030 <lineFileNextRow@plt>
cmp    $0x0,%rax
je     11c7 <slPairTwoColumnFile+0x67>
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <cloneString@plt>
mov    -0x38(%rbp),%rsi
mov    %eax,%edx
lea    -0x28(%rbp),%rdi
call   1070 <slPairAdd@plt>
jmp    1186 <slPairTwoColumnFile+0x26>
lea    -0x30(%rbp),%rdi
call   1040 <lineFileClose@plt>
lea    -0x28(%rbp),%rdi
call   1050 <slReverse@plt>
mov    -0x28(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slPairTwoColumnFile>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
movq   $0x0,0x8(%rsp)
mov    $0x1,%esi
call   1080 <lineFileOpen@plt>
mov    %rax,%r12
mov    %rax,0x20(%rsp)
lea    0x10(%rsp),%rsi
mov    %rax,%rdi
mov    $0x2,%edx
call   1030 <lineFileNextRow@plt>
test   %rax,%rax
je     11e1 <slPairTwoColumnFile+0x81>
lea    0x8(%rsp),%r14
lea    0x10(%rsp),%r15
nopw   0x0(%rax,%rax,1)
mov    0x10(%rsp),%rbx
mov    0x18(%rsp),%rdi
call   1060 <cloneString@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1070 <slPairAdd@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    $0x2,%edx
call   1030 <lineFileNextRow@plt>
test   %rax,%rax
jne    11b0 <slPairTwoColumnFile+0x50>
lea    0x20(%rsp),%rdi
call   1040 <lineFileClose@plt>
lea    0x8(%rsp),%rdi
call   1050 <slReverse@plt>
mov    0x8(%rsp),%rax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.slPair = type { i32 }
%struct.lineFile = type { i32 }
define %struct.slPair* @slPairTwoColumnFile(i8* %0) {
%2 = alloca i8*
%3 = alloca [2 x i8*]
%4 = alloca %struct.slPair*
%5 = alloca %struct.lineFile*
store i8* %0, i8** %2
store %struct.slPair* null, %struct.slPair** %4
%6 = load i8*, i8** %2
%7 = call %struct.lineFile* @lineFileOpen(i8* %6, i32 1)
store %struct.lineFile* %7, %struct.lineFile** %5
br label %8
8: ; preds = %13, %1
%9 = load %struct.lineFile*, %struct.lineFile** %5
%10 = getelementptr inbounds [2 x i8*], [2 x i8*]* %3, i64 0, i64 0
%11 = call i64 @lineFileNextRow(%struct.lineFile* %9, i8** %10, i32 2)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %20
13: ; preds = %8
%14 = getelementptr inbounds [2 x i8*], [2 x i8*]* %3, i64 0, i64 0
%15 = load i8*, i8** %14
%16 = getelementptr inbounds [2 x i8*], [2 x i8*]* %3, i64 0, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @cloneString(i8* %17)
%19 = call i32 @slPairAdd(%struct.slPair** %4, i8* %15, i32 %18)
br label %8
20: ; preds = %8
%21 = call i32 @lineFileClose(%struct.lineFile** %5)
%22 = call i32 @slReverse(%struct.slPair** %4)
%23 = load %struct.slPair*, %struct.slPair** %4
ret %struct.slPair* %23
}

LLVM IR (-O2):
%struct.slPair = type { i32 }
%struct.lineFile = type { i32 }
define %struct.slPair* @slPairTwoColumnFile(i8* %0) {
%2 = alloca [2 x i8*]
%3 = alloca %struct.slPair*
%4 = alloca %struct.lineFile*
%5 = bitcast [2 x i8*]* %2 to i8*
%6 = bitcast %struct.slPair** %3 to i8*
store %struct.slPair* null, %struct.slPair** %3
%7 = bitcast %struct.lineFile** %4 to i8*
%8 = tail call %struct.lineFile* @lineFileOpen(i8* %0, i32 1)
store %struct.lineFile* %8, %struct.lineFile** %4
%9 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 0
%10 = call i64 @lineFileNextRow(%struct.lineFile* %8, i8** %9, i32 2)
%11 = icmp eq i64 %10, 0
br i1 %11, label %21, label %12
12: ; preds = %1
%13 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 1
br label %14
14: ; preds = %12, %14
%15 = load i8*, i8** %9
%16 = load i8*, i8** %13
%17 = call i32 @cloneString(i8* %16)
%18 = call i32 @slPairAdd(%struct.slPair** %3, i8* %15, i32 %17)
%19 = call i64 @lineFileNextRow(%struct.lineFile* %8, i8** %9, i32 2)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %14
21: ; preds = %14, %1
%22 = call i32 @lineFileClose(%struct.lineFile** %4)
%23 = call i32 @slReverse(%struct.slPair** %3)
%24 = load %struct.slPair*, %struct.slPair** %3
ret %struct.slPair* %24
}