#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*/ convert(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
main(int argc, char **argv) {
  if (argc == 3) {
    FILE *in = fopen(argv[1], "rb");
    FILE *out = fopen(argv[2], "wb");
    if (!in) {
      perror(argv[1]);
      exit(1);
    }
    if (!out) {
      perror(argv[2]);
      exit(1);
    }
    convert(in, out);
    exit(0);
  }
  fprintf(stderr, "Usage: %s showfont-output outfile\n", argv[0]);
  exit(1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    11f8 <main+0xa8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe81(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe6c(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11c2 <main+0x72>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <perror@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
cmpq   $0x0,-0x20(%rbp)
jne    11e4 <main+0x94>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <perror@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <convert@plt>
xor    %edi,%edi
call   1070 <exit@plt>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdf7(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    118a <main+0x3a>
mov    0x8(%rbx),%rdi
lea    0xe99(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
lea    0xe89(%rip),%rsi
call   1050 <fopen@plt>
test   %r14,%r14
jne    11ac <main+0x5c>
mov    0x8(%rbx),%rdi
jmp    11b5 <main+0x65>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe69(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
test   %rax,%rax
jne    11c4 <main+0x74>
mov    0x10(%rbx),%rdi
call   1060 <perror@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <convert@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@.str.1 = [3 x i8] c"wb\00"
@stderr = global i32 0
@.str.2 = [35 x i8] c"Usage: %s showfont-output outfile\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 3
br i1 %9, label %10, label %41
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32* @fopen(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %14, i32** %6
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 2
%17 = load i8*, i8** %16
%18 = call i32* @fopen(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %18, i32** %7
%19 = load i32*, i32** %6
%20 = icmp ne i32* %19, null
br i1 %20, label %27, label %21
21: ; preds = %10
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32 @perror(i8* %24)
%26 = call i32 @exit(i32 1)
unreachable
27: ; preds = %10
%28 = load i32*, i32** %7
%29 = icmp ne i32* %28, null
br i1 %29, label %36, label %30
30: ; preds = %27
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 2
%33 = load i8*, i8** %32
%34 = call i32 @perror(i8* %33)
%35 = call i32 @exit(i32 1)
unreachable
36: ; preds = %27
%37 = load i32*, i32** %6
%38 = load i32*, i32** %7
%39 = call i32 @convert(i32* %37, i32* %38)
%40 = call i32 @exit(i32 0)
unreachable
41: ; preds = %2
%42 = load i32, i32* @stderr
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 0
%45 = load i8*, i8** %44
%46 = call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i8* %45)
%47 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@.str.1 = [3 x i8] c"wb\00"
@stderr = global i32 0
@.str.2 = [35 x i8] c"Usage: %s showfont-output outfile\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %4, label %25
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32* @fopen(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %8
%10 = tail call i32* @fopen(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i32* %7, null
br i1 %11, label %12, label %16
12: ; preds = %4
%13 = load i8*, i8** %5
%14 = tail call i32 @perror(i8* %13)
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %4
%17 = icmp eq i32* %10, null
br i1 %17, label %18, label %22
18: ; preds = %16
%19 = load i8*, i8** %8
%20 = tail call i32 @perror(i8* %19)
%21 = tail call i32 @exit(i32 1)
unreachable
22: ; preds = %16
%23 = tail call i32 @convert(i32* %7, i32* %10)
%24 = tail call i32 @exit(i32 0)
unreachable
25: ; preds = %2
%26 = load i32, i32* @stderr
%27 = load i8*, i8** %1
%28 = tail call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i8* %27)
%29 = tail call i32 @exit(i32 1)
unreachable
}