#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 ttfinfo {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ DoDumpGlyph(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                               struct ttfinfo *, int, double *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
char *glyph2name(int, struct ttfinfo *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ stderr;
void DumpGlyph(FILE *ttf, struct ttfinfo *info, int glyph) {
  char *name = glyph2name(glyph, info);
  char buffer[300];
  FILE *eps;
  double trans[6];
  sprintf(buffer, "%s.eps", name);
  eps = fopen(buffer, "w");
  if (eps == NULL) {
    fprintf(stderr, "Could not open %s for writing\n", buffer);
    exit(1);
  }
  trans[0] = trans[3] = 1;
  trans[1] = trans[2] = trans[4] = trans[5] = 0;
  DoDumpGlyph(ttf, eps, info, glyph, trans, 1);
  fprintf(eps, "%%%%EOF\n");
  fclose(eps);
}


x86 assembly (clang, -O0):
<DumpGlyph>:
push   %rbp
mov    %rsp,%rbp
sub    $0x190,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <glyph2name@plt>
mov    %rax,-0x20(%rbp)
lea    -0x150(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe60(%rip),%rsi
call   1080 <sprintf@plt>
lea    -0x150(%rbp),%rdi
lea    0xe54(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x158(%rbp)
cmpq   $0x0,-0x158(%rbp)
jne    11fe <DumpGlyph+0x8e>
mov    0x2e04(%rip),%rax
movslq (%rax),%rdi
lea    -0x150(%rbp),%rdx
lea    0xe24(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
movsd  0xdfa(%rip),%xmm0
movsd  %xmm0,-0x178(%rbp)
ff
movsd  0xdea(%rip),%xmm0
movsd  %xmm0,-0x190(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x168(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x170(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x180(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x188(%rbp)
ff
mov    -0x8(%rbp),%rdi
mov    -0x158(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
lea    -0x190(%rbp),%r8
mov    $0x1,%r9d
call   1050 <DoDumpGlyph@plt>
mov    -0x158(%rbp),%rdi
lea    0xdb4(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x158(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x190,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DumpGlyph>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x168,%rsp
mov    %edx,%r15d
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %edx,%edi
call   1070 <glyph2name@plt>
lea    0xe6c(%rip),%rsi
lea    0x30(%rsp),%rbp
mov    %rbp,%rdi
mov    %rax,%rdx
call   1080 <sprintf@plt>
lea    0xe5c(%rip),%rsi
mov    %rbp,%rdi
call   1060 <fopen@plt>
test   %rax,%rax
je     121c <DumpGlyph+0xac>
mov    %rax,%rbp
movabs $0x3ff0000000000000,%rax
mov    %rax,0x18(%rsp)
mov    %rax,(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rsp)
movaps %xmm0,0x20(%rsp)
mov    %rsp,%r8
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    %r15d,%ecx
mov    $0x1,%r9d
call   1050 <DoDumpGlyph@plt>
lea    0xe2c(%rip),%rsi
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %rbp,%rdi
call   1030 <fclose@plt>
add    $0x168,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2dbd(%rip),%rax
movslq (%rax),%rdi
lea    0xddc(%rip),%rsi
lea    0x30(%rsp),%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
%struct.ttfinfo = type { i32 }
@.str = [7 x i8] c"%s.eps\00"
@.str.1 = [2 x i8] c"w\00"
@stderr = global i32 0
@.str.2 = [31 x i8] c"Could not open %s for writing\0A\00"
@.str.3 = [9 x i8] c"%%%%EOF\0A\00"
define void @DumpGlyph(i32* %0, %struct.ttfinfo* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca %struct.ttfinfo*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca [300 x i8]
%9 = alloca i32*
%10 = alloca [6 x double]
store i32* %0, i32** %4
store %struct.ttfinfo* %1, %struct.ttfinfo** %5
store i32 %2, i32* %6
%11 = load i32, i32* %6
%12 = load %struct.ttfinfo*, %struct.ttfinfo** %5
%13 = call i8* @glyph2name(i32 %11, %struct.ttfinfo* %12)
store i8* %13, i8** %7
%14 = getelementptr inbounds [300 x i8], [300 x i8]* %8, i64 0, i64 0
%15 = load i8*, i8** %7
%16 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds [300 x i8], [300 x i8]* %8, i64 0, i64 0
%18 = call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %18, i32** %9
%19 = load i32*, i32** %9
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %28
21: ; preds = %3
%22 = load i32, i32* @stderr
%23 = sext i32 %22 to i64
%24 = inttoptr i64 %23 to i32*
%25 = getelementptr inbounds [300 x i8], [300 x i8]* %8, i64 0, i64 0
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %25)
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %3
%29 = getelementptr inbounds [6 x double], [6 x double]* %10, i64 0, i64 3
store double 1.000000e+00, double* %29
%30 = getelementptr inbounds [6 x double], [6 x double]* %10, i64 0, i64 0
store double 1.000000e+00, double* %30
%31 = getelementptr inbounds [6 x double], [6 x double]* %10, i64 0, i64 5
store double 0.000000e+00, double* %31
%32 = getelementptr inbounds [6 x double], [6 x double]* %10, i64 0, i64 4
store double 0.000000e+00, double* %32
%33 = getelementptr inbounds [6 x double], [6 x double]* %10, i64 0, i64 2
store double 0.000000e+00, double* %33
%34 = getelementptr inbounds [6 x double], [6 x double]* %10, i64 0, i64 1
store double 0.000000e+00, double* %34
%35 = load i32*, i32** %4
%36 = load i32*, i32** %9
%37 = load %struct.ttfinfo*, %struct.ttfinfo** %5
%38 = load i32, i32* %6
%39 = getelementptr inbounds [6 x double], [6 x double]* %10, i64 0, i64 0
%40 = call i32 @DoDumpGlyph(i32* %35, i32* %36, %struct.ttfinfo* %37, i32 %38, double* %39, i32 1)
%41 = load i32*, i32** %9
%42 = call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%43 = load i32*, i32** %9
%44 = call i32 @fclose(i32* %43)
ret void
}

LLVM IR (-O2):
%struct.ttfinfo = type { i32 }
@.str = [7 x i8] c"%s.eps\00"
@.str.1 = [2 x i8] c"w\00"
@stderr = global i32 0
@.str.2 = [31 x i8] c"Could not open %s for writing\0A\00"
@.str.3 = [9 x i8] c"%%%%EOF\0A\00"
define void @DumpGlyph(i32* %0, %struct.ttfinfo* %1, i32 %2) {
%4 = alloca [300 x i8]
%5 = alloca [6 x double]
%6 = tail call i8* @glyph2name(i32 %2, %struct.ttfinfo* %1)
%7 = getelementptr inbounds [300 x i8], [300 x i8]* %4, i64 0, i64 0
%8 = bitcast [6 x double]* %5 to i8*
%9 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %6)
%10 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %18
12: ; preds = %3
%13 = load i32, i32* @stderr
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i32*
%16 = call i32 (i32*, i8*, ...) @fprintf(i32* %15, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %3
%19 = getelementptr inbounds [6 x double], [6 x double]* %5, i64 0, i64 3
store double 1.000000e+00, double* %19
%20 = getelementptr inbounds [6 x double], [6 x double]* %5, i64 0, i64 0
store double 1.000000e+00, double* %20
%21 = getelementptr inbounds [6 x double], [6 x double]* %5, i64 0, i64 4
%22 = getelementptr inbounds [6 x double], [6 x double]* %5, i64 0, i64 1
%23 = bitcast double* %22 to i8*
%24 = bitcast double* %21 to i8*
%25 = call i32 @DoDumpGlyph(i32* %0, i32* %10, %struct.ttfinfo* %1, i32 %2, double* %20, i32 1)
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%27 = call i32 @fclose(i32* %10)
ret void
}