#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*/ addSize(char *, int /*<<< orphan*/, struct hash *);
scalar_t__ lineFileChopNextTab(struct lineFile *, char **, int);
int /*<<< orphan*/ lineFileClose(struct lineFile **);
int /*<<< orphan*/ lineFileNeedNum(struct lineFile *, char **, int);
struct lineFile *lineFileOpen(char *, int);
void readSizesFile(char *fileName, struct hash *sizes) {
  struct lineFile *lf = lineFileOpen(fileName, 1);
  char *row[2];
  while (lineFileChopNextTab(lf, row, (sizeof(row) / sizeof((row)[0]))))
    addSize(row[0], lineFileNeedNum(lf, row, 1), sizes);
  lineFileClose(&lf);
}


x86 assembly (clang, -O0):
<readSizesFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1070 <lineFileOpen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x2,%edx
call   1050 <lineFileChopNextTab@plt>
cmp    $0x0,%rax
je     11bc <readSizesFile+0x6c>
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x1,%edx
call   1060 <lineFileNeedNum@plt>
mov    -0x38(%rbp),%rdi
mov    %eax,%esi
mov    -0x10(%rbp),%rdx
call   1040 <addSize@plt>
jmp    1172 <readSizesFile+0x22>
lea    -0x18(%rbp),%rdi
call   1030 <lineFileClose@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readSizesFile>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    $0x1,%esi
call   1070 <lineFileOpen@plt>
mov    %rax,%r12
mov    %rax,0x8(%rsp)
lea    0x10(%rsp),%rsi
mov    %rax,%rdi
mov    $0x2,%edx
call   1050 <lineFileChopNextTab@plt>
test   %rax,%rax
je     11c7 <readSizesFile+0x77>
lea    0x10(%rsp),%r15
nopl   0x0(%rax)
mov    0x10(%rsp),%rbx
mov    %r12,%rdi
mov    %r15,%rsi
mov    $0x1,%edx
call   1060 <lineFileNeedNum@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    %r14,%rdx
call   1040 <addSize@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    $0x2,%edx
call   1050 <lineFileChopNextTab@plt>
test   %rax,%rax
jne    1190 <readSizesFile+0x40>
lea    0x8(%rsp),%rdi
call   1030 <lineFileClose@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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