#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 stat {
  int /*<<< orphan*/ st_size;
};

/* Variables and functions */
int /*<<< orphan*/ MAP_PRIVATE;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ PROT_READ;
int /*<<< orphan*/ fstat(int, struct stat *);
int /*<<< orphan*/ handle_pcf(void *);
int /*<<< orphan*/ init_data_buffer();
void *mmap(int /*<<< orphan*/ *, int /*<<< orphan*/, int /*<<< orphan*/,
           int /*<<< orphan*/, int, int /*<<< orphan*/);
int open(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ output_interesting_cursors();
int main() {
  const char filename[] = "cursor.pcf";
  int fd = open(filename, O_RDONLY);
  struct stat filestat;
  fstat(fd, &filestat);
  void *fontbuf = mmap(NULL, filestat.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
  handle_pcf(fontbuf);
  init_data_buffer();
  output_interesting_cursors();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xe91(%rip),%rax
mov    %rax,-0xb(%rbp)
mov    0xe8e(%rip),%ax
mov    %ax,-0x3(%rbp)
mov    0xe86(%rip),%al
mov    %al,-0x1(%rbp)
lea    -0xb(%rbp),%rdi
mov    0x2e4e(%rip),%rax
mov    (%rax),%esi
call   1060 <open@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
lea    -0x18(%rbp),%rsi
call   1080 <fstat@plt>
mov    -0x18(%rbp),%esi
mov    0x2e46(%rip),%rax
mov    (%rax),%edx
mov    0x2e15(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
xor    %r9d,%r9d
call   1050 <mmap@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <handle_pcf@plt>
mov    $0x0,%al
call   1030 <init_data_buffer@plt>
mov    $0x0,%al
call   1070 <output_interesting_cursors@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movabs $0x702e726f73727563,%rax
72 2e 70
mov    %rax,0x10(%rsp)
movl   $0x666370,0x17(%rsp)
mov    0x2e5d(%rip),%rax
mov    (%rax),%esi
lea    0x10(%rsp),%rdi
call   1060 <open@plt>
mov    %eax,%ebx
lea    0x8(%rsp),%rsi
mov    %eax,%edi
call   1080 <fstat@plt>
mov    0x8(%rsp),%esi
mov    0x2e50(%rip),%rax
mov    (%rax),%edx
mov    0x2e1f(%rip),%rax
mov    (%rax),%ecx
xor    %edi,%edi
mov    %ebx,%r8d
xor    %r9d,%r9d
call   1050 <mmap@plt>
mov    %rax,%rdi
call   1040 <handle_pcf@plt>
xor    %eax,%eax
call   1030 <init_data_buffer@plt>
xor    %eax,%eax
call   1070 <output_interesting_cursors@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@__const.main.filename = [11 x i8] c"cursor.pcf\00"
@O_RDONLY = global i32 0
@PROT_READ = global i32 0
@MAP_PRIVATE = global i32 0
define i32 @main() {
%1 = alloca [11 x i8]
%2 = alloca i32
%3 = alloca %struct.stat
%4 = alloca i8*
%5 = bitcast [11 x i8]* %1 to i8*
%6 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 0
%7 = load i32, i32* @O_RDONLY
%8 = call i32 @open(i8* %6, i32 %7)
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = call i32 @fstat(i32 %9, %struct.stat* %3)
%11 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%12 = load i32, i32* %11
%13 = load i32, i32* @PROT_READ
%14 = load i32, i32* @MAP_PRIVATE
%15 = load i32, i32* %2
%16 = call i8* @mmap(i32* null, i32 %12, i32 %13, i32 %14, i32 %15, i32 0)
store i8* %16, i8** %4
%17 = load i8*, i8** %4
%18 = call i32 @handle_pcf(i8* %17)
%19 = call i32 (...) @init_data_buffer()
%20 = call i32 (...) @output_interesting_cursors()
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@__const.main.filename = [11 x i8] c"cursor.pcf\00"
@O_RDONLY = global i32 0
@PROT_READ = global i32 0
@MAP_PRIVATE = global i32 0
define i32 @main() {
%1 = alloca [11 x i8]
%2 = alloca %struct.stat
%3 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 0
%4 = load i32, i32* @O_RDONLY
%5 = call i32 @open(i8* %3, i32 %4)
%6 = bitcast %struct.stat* %2 to i8*
%7 = call i32 @fstat(i32 %5, %struct.stat* %2)
%8 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%9 = load i32, i32* %8
%10 = load i32, i32* @PROT_READ
%11 = load i32, i32* @MAP_PRIVATE
%12 = tail call i8* @mmap(i32* null, i32 %9, i32 %10, i32 %11, i32 %5, i32 0)
%13 = tail call i32 @handle_pcf(i8* %12)
%14 = tail call i32 (...) @init_data_buffer()
%15 = tail call i32 (...) @output_interesting_cursors()
ret i32 0
}