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

/* Variables and functions */
int /*<<< orphan*/ execl(char *, char *, char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fork();
struct href *parse_tex(char *, int *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, ...);
int /*<<< orphan*/ wait(int *);
struct href *file_create(char name[], int *p) {
  char tmp_name[512];
  pid_t child;
  int pages, status, relay = 0;
  FILE *CHECK;
  struct href *hhead;
  if ((hhead = parse_tex(name, &relay)) == NULL)
    return NULL;
  printf("MAP found %d tags that require resolving references.\n", relay);
  if ((child = fork()) == 0) {
    snprintf(tmp_name, 512, "%s-PREMAP.tex", name);
    while ((CHECK = fopen(tmp_name, "r+")) == NULL) {
    }
    fclose(CHECK);
    exit(1);
  }
  wait(&status);
  if ((child = fork()) == 0) {
    snprintf(tmp_name, 512,
             "/usr/bin/latex -interaction=batchmode %s-PREMAP.tex", name);
    execl("/bin/sh", "/bin/sh", "-c", tmp_name, NULL);
    exit(1);
  }
  wait(&status);
  if (relay > 0) {
    if ((child = fork()) == 0) {
      snprintf(tmp_name, 512,
               "/usr/bin/latex -interaction=batchmode %s-PREMAP.tex", name);
      execl("/bin/sh", "/bin/sh", "-c", tmp_name, NULL);
      exit(1);
    }
    wait(&status);
  }
  if ((child = fork()) == 0) {
    snprintf(tmp_name, 512,
             "/usr/bin/dvips -t letter -f %s-PREMAP.dvi > %s-PREMAP.ps", name,
             name);
    execl("/bin/sh", "/bin/sh", "-c", tmp_name, NULL);
    exit(1);
  }
  wait(&status);
  if ((child = fork()) == 0) {
    snprintf(tmp_name, 512,
             "/usr/bin/gs -q -dBATCH -dGraphicsAlphaBits=4 -dTextAlphaBits=4 "
             "-dNOPAUSE -sDEVICE=pnmraw -r100 -sOutputFile=%s-PREMAP%s.pnm "
             "%s-PREMAP.ps",
             name, "%02d", name);
    execl("/bin/sh", "/bin/sh", "-c", tmp_name, NULL);
    exit(1);
  }
  wait(&status);
  for (pages = 1;; pages++) {
    snprintf(tmp_name, 512, "%s-PREMAP%02d.pnm", name, pages);
    if ((CHECK = fopen(tmp_name, "r+")) != NULL) {
      fclose(CHECK);
    } else {
      pages -= 1;
      break;
    }
  }
  for (relay = 1; relay < (pages + 1); relay++) {
    if ((child = fork()) == 0) {
      snprintf(tmp_name, 512,
               "/usr/bin/pnmcrop < %s-PREMAP%02d.pnm | /usr/bin/pnmpad -white "
               "-l20 -r20 -t20 -b20 | /usr/bin/pnmtopng > %s-PREMAP%02d.png",
               name, relay, name, relay);
      execl("/bin/sh", "/bin/sh", "-c", tmp_name, NULL);
      exit(1);
    }
    wait(&status);
  }
  *p = pages;
  return hhead;
}


x86 assembly (clang, -O0):
<file_create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x250,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x230(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x230(%rbp),%rsi
call   1060 <parse_tex@plt>
mov    %rax,-0x240(%rbp)
cmp    $0x0,%rax
jne    11db <file_create+0x4b>
movq   $0x0,-0x8(%rbp)
jmp    1595 <file_create+0x405>
mov    -0x230(%rbp),%esi
lea    0xe18(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   10b0 <fork@plt>
mov    %eax,-0x224(%rbp)
cmp    $0x0,%eax
jne    1260 <file_create+0xd0>
lea    -0x220(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x200,%esi
lea    0xe45(%rip),%rdx
mov    $0x0,%al
call   1050 <snprintf@plt>
lea    -0x220(%rbp),%rdi
lea    0xe07(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x238(%rbp)
cmp    $0x0,%rax
jne    124a <file_create+0xba>
jmp    1221 <file_create+0x91>
mov    -0x238(%rbp),%rdi
call   1030 <fclose@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
lea    -0x22c(%rbp),%rdi
call   10a0 <wait@plt>
mov    $0x0,%al
call   10b0 <fork@plt>
mov    %eax,-0x224(%rbp)
cmp    $0x0,%eax
jne    12cc <file_create+0x13c>
lea    -0x220(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x200,%esi
lea    0xda0(%rip),%rdx
mov    $0x0,%al
call   1050 <snprintf@plt>
lea    -0x220(%rbp),%rcx
lea    0xdbf(%rip),%rsi
lea    0xdc0(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
mov    %rsi,%rdi
call   1090 <execl@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
lea    -0x22c(%rbp),%rdi
call   10a0 <wait@plt>
cmpl   $0x0,-0x230(%rbp)
jle    1351 <file_create+0x1c1>
mov    $0x0,%al
call   10b0 <fork@plt>
mov    %eax,-0x224(%rbp)
cmp    $0x0,%eax
jne    1345 <file_create+0x1b5>
lea    -0x220(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x200,%esi
lea    0xd27(%rip),%rdx
mov    $0x0,%al
call   1050 <snprintf@plt>
lea    -0x220(%rbp),%rcx
lea    0xd46(%rip),%rsi
lea    0xd47(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
mov    %rsi,%rdi
call   1090 <execl@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
lea    -0x22c(%rbp),%rdi
call   10a0 <wait@plt>
mov    $0x0,%al
call   10b0 <fork@plt>
mov    %eax,-0x224(%rbp)
cmp    $0x0,%eax
jne    13b5 <file_create+0x225>
lea    -0x220(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    $0x200,%esi
lea    0xcf6(%rip),%rdx
mov    $0x0,%al
call   1050 <snprintf@plt>
lea    -0x220(%rbp),%rcx
lea    0xcd6(%rip),%rsi
lea    0xcd7(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
mov    %rsi,%rdi
call   1090 <execl@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
lea    -0x22c(%rbp),%rdi
call   10a0 <wait@plt>
mov    $0x0,%al
call   10b0 <fork@plt>
mov    %eax,-0x224(%rbp)
cmp    $0x0,%eax
jne    142c <file_create+0x29c>
lea    -0x220(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x10(%rbp),%r9
mov    $0x200,%esi
lea    0xcbf(%rip),%rdx
lea    0xd41(%rip),%r8
mov    $0x0,%al
call   1050 <snprintf@plt>
lea    -0x220(%rbp),%rcx
lea    0xc5f(%rip),%rsi
lea    0xc60(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
mov    %rsi,%rdi
call   1090 <execl@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
lea    -0x22c(%rbp),%rdi
call   10a0 <wait@plt>
movl   $0x1,-0x228(%rbp)
lea    -0x220(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x228(%rbp),%r8d
mov    $0x200,%esi
lea    0xcdf(%rip),%rdx
mov    $0x0,%al
call   1050 <snprintf@plt>
lea    -0x220(%rbp),%rdi
lea    0xbc1(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x238(%rbp)
cmp    $0x0,%rax
je     149c <file_create+0x30c>
mov    -0x238(%rbp),%rdi
call   1030 <fclose@plt>
jmp    14b0 <file_create+0x320>
mov    -0x228(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x228(%rbp)
jmp    14c9 <file_create+0x339>
jmp    14b5 <file_create+0x325>
mov    -0x228(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x228(%rbp)
jmp    1442 <file_create+0x2b2>
movl   $0x1,-0x230(%rbp)
mov    -0x230(%rbp),%eax
mov    -0x228(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    157e <file_create+0x3ee>
mov    $0x0,%al
call   10b0 <fork@plt>
mov    %eax,-0x224(%rbp)
cmp    $0x0,%eax
jne    155e <file_create+0x3ce>
lea    -0x220(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x230(%rbp),%r8d
mov    -0x10(%rbp),%r9
mov    -0x230(%rbp),%eax
mov    $0x200,%esi
lea    0xc29(%rip),%rdx
mov    %eax,(%rsp)
mov    $0x0,%al
call   1050 <snprintf@plt>
lea    -0x220(%rbp),%rcx
lea    0xb2d(%rip),%rsi
lea    0xb2e(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
mov    %rsi,%rdi
call   1090 <execl@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
lea    -0x22c(%rbp),%rdi
call   10a0 <wait@plt>
mov    -0x230(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x230(%rbp)
jmp    14d3 <file_create+0x343>
mov    -0x228(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x240(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x250,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_create>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x228,%rsp
mov    %rsi,%rbp
mov    %rdi,%r12
movl   $0x0,0x10(%rsp)
lea    0x10(%rsp),%rsi
call   1060 <parse_tex@plt>
mov    %rax,%r15
test   %rax,%rax
je     1337 <file_create+0x1a7>
mov    0x10(%rsp),%esi
lea    0xe30(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   10b0 <fork@plt>
test   %eax,%eax
je     13bc <file_create+0x22c>
lea    0x14(%rsp),%rdi
call   10a0 <wait@plt>
xor    %eax,%eax
call   10b0 <fork@plt>
test   %eax,%eax
je     139c <file_create+0x20c>
lea    0x14(%rsp),%rdi
call   10a0 <wait@plt>
cmpl   $0x0,0x10(%rsp)
jle    1227 <file_create+0x97>
xor    %eax,%eax
call   10b0 <fork@plt>
test   %eax,%eax
je     139c <file_create+0x20c>
lea    0x14(%rsp),%rdi
call   10a0 <wait@plt>
xor    %eax,%eax
call   10b0 <fork@plt>
test   %eax,%eax
je     1412 <file_create+0x282>
lea    0x14(%rsp),%rdi
call   10a0 <wait@plt>
xor    %r14d,%r14d
xor    %eax,%eax
call   10b0 <fork@plt>
test   %eax,%eax
je     1438 <file_create+0x2a8>
lea    0x14(%rsp),%rdi
call   10a0 <wait@plt>
lea    0xedc(%rip),%rdx
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x200,%esi
mov    %r12,%rcx
mov    $0x1,%r8d
xor    %eax,%eax
call   1050 <snprintf@plt>
lea    0xdaf(%rip),%rsi
mov    %rbx,%rdi
call   1070 <fopen@plt>
test   %rax,%rax
je     1333 <file_create+0x1a3>
mov    %rbp,0x18(%rsp)
lea    0xe9b(%rip),%r13
lea    0x20(%rsp),%rbx
lea    0xd86(%rip),%rbp
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rax,%rdi
call   1030 <fclose@plt>
lea    0x2(%r14),%r8d
mov    %rbx,%rdi
mov    $0x200,%esi
mov    %r13,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1050 <snprintf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1070 <fopen@plt>
add    $0x1,%r14d
test   %rax,%rax
jne    12c0 <file_create+0x130>
movl   $0x1,0x10(%rsp)
lea    0x14(%rsp),%rbx
mov    0x18(%rsp),%rbp
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10b0 <fork@plt>
test   %eax,%eax
je     134c <file_create+0x1bc>
mov    %rbx,%rdi
call   10a0 <wait@plt>
mov    0x10(%rsp),%eax
lea    0x1(%rax),%ecx
mov    %ecx,0x10(%rsp)
cmp    %r14d,%eax
jl     1310 <file_create+0x180>
mov    %r14d,0x0(%rbp)
mov    %r15,%rax
add    $0x228,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x10(%rsp),%r8d
mov    %r8d,(%rsp)
lea    0xdf5(%rip),%rdx
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x200,%esi
mov    %r12,%rcx
mov    %r12,%r9
xor    %eax,%eax
call   1050 <snprintf@plt>
lea    0xcf0(%rip),%rdi
lea    0xcf1(%rip),%rdx
mov    %rdi,%rsi
mov    %rbx,%rcx
xor    %r8d,%r8d
call   1090 <execl@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
lea    0xc96(%rip),%rdx
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x200,%esi
mov    %r12,%rcx
xor    %eax,%eax
call   1050 <snprintf@plt>
jmp    1376 <file_create+0x1e6>
lea    0xc9c(%rip),%rdx
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x200,%esi
mov    %r12,%rcx
xor    %eax,%eax
call   1050 <snprintf@plt>
lea    0xc55(%rip),%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     13f0 <file_create+0x260>
mov    %rax,%rdi
call   1030 <fclose@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
lea    0xc5f(%rip),%rdx
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x200,%esi
mov    %r12,%rcx
mov    %r12,%r8
xor    %eax,%eax
call   1050 <snprintf@plt>
jmp    1376 <file_create+0x1e6>
lea    0xc72(%rip),%rdx
lea    0xcf4(%rip),%r8
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x200,%esi
mov    %r12,%rcx
mov    %r12,%r9
xor    %eax,%eax
call   1050 <snprintf@plt>
jmp    1376 <file_create+0x1e6>

LLVM IR (-O0):
%struct.href = type { i32 }
@.str = [54 x i8] c"MAP found %d tags that require resolving references.\0A\00"
@.str.1 = [14 x i8] c"%s-PREMAP.tex\00"
@.str.2 = [3 x i8] c"r+\00"
@.str.3 = [52 x i8] c"/usr/bin/latex -interaction=batchmode %s-PREMAP.tex\00"
@.str.4 = [8 x i8] c"/bin/sh\00"
@.str.5 = [3 x i8] c"-c\00"
@.str.6 = [57 x i8] c"/usr/bin/dvips -t letter -f %s-PREMAP.dvi > %s-PREMAP.ps\00"
@.str.7 = [137 x i8] c"/usr/bin/gs -q -dBATCH -dGraphicsAlphaBits=4 -dTextAlphaBits=4 -dNOPAUSE -sDEVICE=pnmraw -r100 -sOutputFile=%s-PREMAP%s.pnm %s-PREMAP.ps\00"
@.str.8 = [5 x i8] c"%02d\00"
@.str.9 = [18 x i8] c"%s-PREMAP%02d.pnm\00"
@.str.10 = [122 x i8] c"/usr/bin/pnmcrop < %s-PREMAP%02d.pnm | /usr/bin/pnmpad -white -l20 -r20 -t20 -b20 | /usr/bin/pnmtopng > %s-PREMAP%02d.png\00"
define %struct.href* @file_create(i8* %0, i32* %1) {
%3 = alloca %struct.href*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca [512 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32*
%12 = alloca %struct.href*
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32 0, i32* %10
%13 = load i8*, i8** %4
%14 = call %struct.href* @parse_tex(i8* %13, i32* %10)
store %struct.href* %14, %struct.href** %12
%15 = icmp eq %struct.href* %14, null
br i1 %15, label %16, label %17
16: ; preds = %2
store %struct.href* null, %struct.href** %3
br label %133
17: ; preds = %2
%18 = load i32, i32* %10
%19 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = call i32 (...) @fork()
store i32 %20, i32* %7
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %35
22: ; preds = %17
%23 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%24 = load i8*, i8** %4
%25 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %23, i32 512, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %24)
br label %26
26: ; preds = %30, %22
%27 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%28 = call i32* @fopen(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %28, i32** %11
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %31
30: ; preds = %26
br label %26
31: ; preds = %26
%32 = load i32*, i32** %11
%33 = call i32 @fclose(i32* %32)
%34 = call i32 @exit(i32 1)
unreachable
35: ; preds = %17
%36 = call i32 @wait(i32* %9)
%37 = call i32 (...) @fork()
store i32 %37, i32* %7
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %46
39: ; preds = %35
%40 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%41 = load i8*, i8** %4
%42 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %40, i32 512, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0), i8* %41)
%43 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%44 = call i32 @execl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %43, i32* null)
%45 = call i32 @exit(i32 1)
unreachable
46: ; preds = %35
%47 = call i32 @wait(i32* %9)
%48 = load i32, i32* %10
%49 = icmp sgt i32 %48, 0
br i1 %49, label %50, label %62
50: ; preds = %46
%51 = call i32 (...) @fork()
store i32 %51, i32* %7
%52 = icmp eq i32 %51, 0
br i1 %52, label %53, label %60
53: ; preds = %50
%54 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%55 = load i8*, i8** %4
%56 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %54, i32 512, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0), i8* %55)
%57 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%58 = call i32 @execl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %57, i32* null)
%59 = call i32 @exit(i32 1)
unreachable
60: ; preds = %50
%61 = call i32 @wait(i32* %9)
br label %62
62: ; preds = %60, %46
%63 = call i32 (...) @fork()
store i32 %63, i32* %7
%64 = icmp eq i32 %63, 0
br i1 %64, label %65, label %73
65: ; preds = %62
%66 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%67 = load i8*, i8** %4
%68 = load i8*, i8** %4
%69 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %66, i32 512, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0), i8* %67, i8* %68)
%70 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%71 = call i32 @execl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %70, i32* null)
%72 = call i32 @exit(i32 1)
unreachable
73: ; preds = %62
%74 = call i32 @wait(i32* %9)
%75 = call i32 (...) @fork()
store i32 %75, i32* %7
%76 = icmp eq i32 %75, 0
br i1 %76, label %77, label %85
77: ; preds = %73
%78 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%79 = load i8*, i8** %4
%80 = load i8*, i8** %4
%81 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %78, i32 512, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str.7, i64 0, i64 0), i8* %79, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* %80)
%82 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%83 = call i32 @execl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %82, i32* null)
%84 = call i32 @exit(i32 1)
unreachable
85: ; preds = %73
%86 = call i32 @wait(i32* %9)
store i32 1, i32* %8
br label %87
87: ; preds = %102, %85
%88 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%89 = load i8*, i8** %4
%90 = load i32, i32* %8
%91 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %88, i32 512, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i8* %89, i32 %90)
%92 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%93 = call i32* @fopen(i8* %92, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %93, i32** %11
%94 = icmp ne i32* %93, null
br i1 %94, label %95, label %98
95: ; preds = %87
%96 = load i32*, i32** %11
%97 = call i32 @fclose(i32* %96)
br label %101
98: ; preds = %87
%99 = load i32, i32* %8
%100 = sub nsw i32 %99, 1
store i32 %100, i32* %8
br label %105
101: ; preds = %95
br label %102
102: ; preds = %101
%103 = load i32, i32* %8
%104 = add nsw i32 %103, 1
store i32 %104, i32* %8
br label %87
105: ; preds = %98
store i32 1, i32* %10
br label %106
106: ; preds = %126, %105
%107 = load i32, i32* %10
%108 = load i32, i32* %8
%109 = add nsw i32 %108, 1
%110 = icmp slt i32 %107, %109
br i1 %110, label %111, label %129
111: ; preds = %106
%112 = call i32 (...) @fork()
store i32 %112, i32* %7
%113 = icmp eq i32 %112, 0
br i1 %113, label %114, label %124
114: ; preds = %111
%115 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%116 = load i8*, i8** %4
%117 = load i32, i32* %10
%118 = load i8*, i8** %4
%119 = load i32, i32* %10
%120 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %115, i32 512, i8* getelementptr inbounds ([122 x i8], [122 x i8]* @.str.10, i64 0, i64 0), i8* %116, i32 %117, i8* %118, i32 %119)
%121 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%122 = call i32 @execl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %121, i32* null)
%123 = call i32 @exit(i32 1)
unreachable
124: ; preds = %111
%125 = call i32 @wait(i32* %9)
br label %126
126: ; preds = %124
%127 = load i32, i32* %10
%128 = add nsw i32 %127, 1
store i32 %128, i32* %10
br label %106
129: ; preds = %106
%130 = load i32, i32* %8
%131 = load i32*, i32** %5
store i32 %130, i32* %131
%132 = load %struct.href*, %struct.href** %12
store %struct.href* %132, %struct.href** %3
br label %133
133: ; preds = %129, %16
%134 = load %struct.href*, %struct.href** %3
ret %struct.href* %134
}

LLVM IR (-O2):
%struct.href = type { i32 }
@.str = [54 x i8] c"MAP found %d tags that require resolving references.\0A\00"
@.str.1 = [14 x i8] c"%s-PREMAP.tex\00"
@.str.2 = [3 x i8] c"r+\00"
@.str.3 = [52 x i8] c"/usr/bin/latex -interaction=batchmode %s-PREMAP.tex\00"
@.str.4 = [8 x i8] c"/bin/sh\00"
@.str.5 = [3 x i8] c"-c\00"
@.str.6 = [57 x i8] c"/usr/bin/dvips -t letter -f %s-PREMAP.dvi > %s-PREMAP.ps\00"
@.str.7 = [137 x i8] c"/usr/bin/gs -q -dBATCH -dGraphicsAlphaBits=4 -dTextAlphaBits=4 -dNOPAUSE -sDEVICE=pnmraw -r100 -sOutputFile=%s-PREMAP%s.pnm %s-PREMAP.ps\00"
@.str.8 = [5 x i8] c"%02d\00"
@.str.9 = [18 x i8] c"%s-PREMAP%02d.pnm\00"
@.str.10 = [122 x i8] c"/usr/bin/pnmcrop < %s-PREMAP%02d.pnm | /usr/bin/pnmpad -white -l20 -r20 -t20 -b20 | /usr/bin/pnmtopng > %s-PREMAP%02d.png\00"
define %struct.href* @file_create(i8* %0, i32* nocapture writeonly %1) {
%3 = alloca [512 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%9 = call %struct.href* @parse_tex(i8* %0, i32* %5)
%10 = icmp eq %struct.href* %9, null
br i1 %10, label %89, label %11
11: ; preds = %2
%12 = load i32, i32* %5
%13 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = call i32 (...) @fork()
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %24
16: ; preds = %11
%17 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %6, i32 512, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %18
18: ; preds = %18, %16
%19 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp eq i32* %19, null
br i1 %20, label %18, label %21
21: ; preds = %18
%22 = call i32 @fclose(i32* %19)
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %11
%25 = call i32 @wait(i32* %4)
%26 = call i32 (...) @fork()
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %24
%29 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %6, i32 512, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%30 = call i32 @execl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %6, i32* null)
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %24
%33 = call i32 @wait(i32* %4)
%34 = load i32, i32* %5
%35 = icmp sgt i32 %34, 0
br i1 %35, label %36, label %45
36: ; preds = %32
%37 = call i32 (...) @fork()
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %43
39: ; preds = %36
%40 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %6, i32 512, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%41 = call i32 @execl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %6, i32* null)
%42 = call i32 @exit(i32 1)
unreachable
43: ; preds = %36
%44 = call i32 @wait(i32* %4)
br label %45
45: ; preds = %43, %32
%46 = call i32 (...) @fork()
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %52
48: ; preds = %45
%49 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %6, i32 512, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0), i8* %0, i8* %0)
%50 = call i32 @execl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %6, i32* null)
%51 = call i32 @exit(i32 1)
unreachable
52: ; preds = %45
%53 = call i32 @wait(i32* %4)
%54 = call i32 (...) @fork()
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %60
56: ; preds = %52
%57 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %6, i32 512, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str.7, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* %0)
%58 = call i32 @execl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %6, i32* null)
%59 = call i32 @exit(i32 1)
unreachable
60: ; preds = %52
%61 = call i32 @wait(i32* %4)
%62 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %6, i32 512, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i8* %0, i32 1)
%63 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%64 = icmp eq i32* %63, null
br i1 %64, label %87, label %65
65: ; preds = %60, %65
%66 = phi i32* [ %71, %65 ], [ %63, %60 ]
%67 = phi i32 [ %69, %65 ], [ 1, %60 ]
%68 = call i32 @fclose(i32* %66)
%69 = add nuw nsw i32 %67, 1
%70 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %6, i32 512, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i8* %0, i32 %69)
%71 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%72 = icmp eq i32* %71, null
br i1 %72, label %73, label %65
73: ; preds = %65
store i32 1, i32* %5
br label %74
74: ; preds = %73, %82
%75 = call i32 (...) @fork()
%76 = icmp eq i32 %75, 0
br i1 %76, label %77, label %82
77: ; preds = %74
%78 = load i32, i32* %5
%79 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %6, i32 512, i8* getelementptr inbounds ([122 x i8], [122 x i8]* @.str.10, i64 0, i64 0), i8* %0, i32 %78, i8* %0, i32 %78)
%80 = call i32 @execl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %6, i32* null)
%81 = call i32 @exit(i32 1)
unreachable
82: ; preds = %74
%83 = call i32 @wait(i32* %4)
%84 = load i32, i32* %5
%85 = add nsw i32 %84, 1
store i32 %85, i32* %5
%86 = icmp slt i32 %84, %67
br i1 %86, label %74, label %87
87: ; preds = %82, %60
%88 = phi i32 [ 0, %60 ], [ %67, %82 ]
store i32 %88, i32* %1
br label %89
89: ; preds = %2, %87
ret %struct.href* %9
}