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

/* Variables and functions */
int /*<<< orphan*/ fatal(char *, char const *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ parse_cache_line();
scalar_t__ readln(int /*<<< orphan*/ *, int *);
void read_cache(const char *name) {
  int lineno = 0;
  FILE *file = fopen(name, "r");
  if (!file)
    fatal("could not open cache `%s'\n", name);
  while (readln(file, &lineno))
    parse_cache_line();
  fclose(file);
}


x86 assembly (clang, -O0):
<read_cache>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe92(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1192 <read_cache+0x42>
mov    -0x8(%rbp),%rsi
lea    0xe75(%rip),%rdi
call   1070 <fatal@plt>
jmp    1197 <read_cache+0x47>
mov    -0x18(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <readln@plt>
cmp    $0x0,%rax
je     11ba <read_cache+0x6a>
mov    $0x0,%al
call   1040 <parse_cache_line@plt>
jmp    1197 <read_cache+0x47>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_cache>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
movl   $0x0,0x4(%rsp)
lea    0xe9a(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1182 <read_cache+0x32>
lea    0xe88(%rip),%rdi
mov    %r14,%rsi
call   1070 <fatal@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <readln@plt>
test   %rax,%rax
je     11b7 <read_cache+0x67>
lea    0x4(%rsp),%r14
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <parse_cache_line@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <readln@plt>
test   %rax,%rax
jne    11a0 <read_cache+0x50>
mov    %rbx,%rdi
call   1030 <fclose@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [27 x i8] c"could not open cache `%s'\0A\00"
define void @read_cache(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32*
store i8* %0, i8** %2
store i32 0, i32* %3
%5 = load i8*, i8** %2
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %4
%7 = load i32*, i32** %4
%8 = icmp ne i32* %7, null
br i1 %8, label %12, label %9
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i32 @fatal(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %9, %1
br label %13
13: ; preds = %17, %12
%14 = load i32*, i32** %4
%15 = call i64 @readln(i32* %14, i32* %3)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = call i32 (...) @parse_cache_line()
br label %13
19: ; preds = %13
%20 = load i32*, i32** %4
%21 = call i32 @fclose(i32* %20)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [27 x i8] c"could not open cache `%s'\0A\00"
define void @read_cache(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @fatal(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %8
8: ; preds = %6, %1
%9 = call i64 @readln(i32* %4, i32* %2)
%10 = icmp eq i64 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %8, %11
%12 = call i32 (...) @parse_cache_line()
%13 = call i64 @readln(i32* %4, i32* %2)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %11
15: ; preds = %11, %8
%16 = call i32 @fclose(i32* %4)
ret void
}