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

/* Variables and functions */
int /*<<< orphan*/ hashAddInt(struct hash *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ lineFileClose(struct lineFile **);
scalar_t__ lineFileNextRow(struct lineFile *, char **, int);
struct lineFile *lineFileOpen(char *, int);
struct hash *newHashExt(int /*<<< orphan*/, int);
int /*<<< orphan*/ sqlUnsigned(char *);
struct hash *bbiChromSizesFromFile(char *fileName) {
  struct hash *hash = newHashExt(0, 1);
  struct lineFile *lf = lineFileOpen(fileName, 1);
  char *row[2];
  while (lineFileNextRow(lf, row, (sizeof(row) / sizeof((row)[0]))))
    hashAddInt(hash, row[0], sqlUnsigned(row[1]));
  lineFileClose(&lf);
  return hash;
}


x86 assembly (clang, -O0):
<bbiChromSizesFromFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
xor    %edi,%edi
mov    $0x1,%esi
call   1060 <newHashExt@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1080 <lineFileOpen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x2,%edx
call   1030 <lineFileNextRow@plt>
cmp    $0x0,%rax
je     11d7 <bbiChromSizesFromFile+0x77>
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
call   1070 <sqlUnsigned@plt>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    %eax,%edx
call   1040 <hashAddInt@plt>
jmp    118e <bbiChromSizesFromFile+0x2e>
lea    -0x18(%rbp),%rdi
call   1050 <lineFileClose@plt>
mov    -0x10(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bbiChromSizesFromFile>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
xor    %edi,%edi
mov    $0x1,%esi
call   1060 <newHashExt@plt>
mov    %rax,%r14
mov    %rbx,%rdi
mov    $0x1,%esi
call   1080 <lineFileOpen@plt>
mov    %rax,%r12
mov    %rax,0x10(%rsp)
mov    %rsp,%rsi
mov    %rax,%rdi
mov    $0x2,%edx
call   1030 <lineFileNextRow@plt>
test   %rax,%rax
je     11e0 <bbiChromSizesFromFile+0x80>
mov    %rsp,%r15
nopw   0x0(%rax,%rax,1)
mov    (%rsp),%rbx
mov    0x8(%rsp),%rdi
call   1070 <sqlUnsigned@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <hashAddInt@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    $0x2,%edx
call   1030 <lineFileNextRow@plt>
test   %rax,%rax
jne    11b0 <bbiChromSizesFromFile+0x50>
lea    0x10(%rsp),%rdi
call   1050 <lineFileClose@plt>
mov    %r14,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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