#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*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *, ...);
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ sscanf(char *, char *, char *, char *, ...);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ unlink(char *);
int /*<<< orphan*/ usage(char *);
main(int argc, char **argv) {
  char *mapfile, bigcmdline[512];
  FILE *fp;
  char line[80], name[40], status[40], coord[20], xc[10], yc[10], syscl[256],
      tempfile[50], infile[50], plotfile[256], outputfile[256], sourceimage[40],
      imagelist[3][40], word[3][40], *image;
  int iter = 0, x;
  if (argc < 2)
    usage(argv[0]);
  mapfile = argv[1];
  printf("Using map file %s\n", mapfile);
  fp = fopen(mapfile, "r");
  if (fp) {
    sprintf(tempfile, "/tmp/status-temp%d%d.ppm", iter, getpid());
    fscanf(fp, "%s", outputfile);
    fscanf(fp, "%s", sourceimage);
    sprintf(plotfile, "%s", sourceimage);
    strcpy(infile, plotfile);
    printf("Source image file is '%s'\n", sourceimage);
    for (x = 0; x < 3; x++)
      fscanf(fp, "%s %s", imagelist[x], word[x]);
    while (!feof(fp)) {
      fgets(line, 80, fp);
      if (feof(fp))
        break;
      if (line[0] == '#')
        continue;
      if (line[0] == '\n')
        continue;
      sscanf(line, "%s %s %s", name, status, coord);
      sscanf(coord, "(%[^(),], %[^(),]", xc, yc);
      for (x = 0; x < 3; x++)
        if (strcmp(status, word[x]) == 0) {
          image = imagelist[x];
          break;
        }
      sprintf(syscl, "pnmpaste %s %s %s %s > %s", image, xc, yc, infile,
              tempfile);
      printf("%s\n", syscl);
      system(syscl);
      if (iter)
        unlink(infile);
      strcpy(infile, tempfile);
      sprintf(tempfile, "/tmp/status-temp%d%d.ppm", ++iter, getpid());
    }
    fclose(fp);
    unlink(outputfile);
    sprintf(syscl, "ppmtogif -transparent white %s > %s", infile, outputfile);
    printf("%s\n", syscl);
    system(syscl);
    unlink(infile);
  } else {
    fprintf(stderr, "%s: Unable to read mapping file %s\n", argv[0], mapfile);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x810,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x7dc(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1239 <main+0x39>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10f0 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xdb0(%rip),%rdi
call   1080 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    0xdb3(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x228(%rbp)
cmpq   $0x0,-0x228(%rbp)
je     1627 <main+0x427>
lea    -0x460(%rbp),%rax
mov    %rax,-0x7f0(%rbp)
mov    -0x7dc(%rbp),%eax
mov    %eax,-0x7e4(%rbp)
mov    $0x0,%al
call   1050 <getpid@plt>
mov    -0x7f0(%rbp),%rdi
mov    -0x7e4(%rbp),%edx
mov    %eax,%ecx
lea    0xd64(%rip),%rsi
mov    $0x0,%al
call   1110 <sprintf@plt>
mov    -0x228(%rbp),%rdi
lea    -0x6a0(%rbp),%rdx
lea    0xdd2(%rip),%rsi
mov    $0x0,%al
call   1090 <fscanf@plt>
mov    -0x228(%rbp),%rdi
lea    -0x6d0(%rbp),%rdx
lea    0xdb6(%rip),%rsi
mov    $0x0,%al
call   1090 <fscanf@plt>
lea    -0x5a0(%rbp),%rdi
lea    -0x6d0(%rbp),%rdx
lea    0xd9a(%rip),%rsi
mov    $0x0,%al
call   1110 <sprintf@plt>
lea    -0x4a0(%rbp),%rdi
lea    -0x5a0(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x6d0(%rbp),%rsi
lea    0xd01(%rip),%rdi
call   1080 <printf@plt>
movl   $0x0,-0x7e0(%rbp)
cmpl   $0x3,-0x7e0(%rbp)
jge    139c <main+0x19c>
mov    -0x228(%rbp),%rdi
movslq -0x7e0(%rbp),%rax
lea    -0x750(%rbp),%rdx
imul   $0x28,%rax,%rax
add    %rax,%rdx
movslq -0x7e0(%rbp),%rax
lea    -0x7d0(%rbp),%rcx
imul   $0x28,%rax,%rax
add    %rax,%rcx
lea    0xccb(%rip),%rsi
mov    $0x0,%al
call   1090 <fscanf@plt>
mov    -0x7e0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7e0(%rbp)
jmp    133c <main+0x13c>
jmp    13a1 <main+0x1a1>
mov    -0x228(%rbp),%rdi
call   10d0 <feof@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    13c3 <main+0x1c3>
jmp    15bc <main+0x3bc>
lea    -0x280(%rbp),%rdi
mov    -0x228(%rbp),%rdx
mov    $0x50,%esi
call   10a0 <fgets@plt>
mov    -0x228(%rbp),%rdi
call   10d0 <feof@plt>
cmp    $0x0,%rax
je     13f6 <main+0x1f6>
jmp    15bc <main+0x3bc>
movsbl -0x280(%rbp),%eax
cmp    $0x23,%eax
jne    140b <main+0x20b>
jmp    13a1 <main+0x1a1>
movsbl -0x280(%rbp),%eax
cmp    $0xa,%eax
jne    1420 <main+0x220>
jmp    13a1 <main+0x1a1>
lea    -0x280(%rbp),%rdi
lea    -0x2b0(%rbp),%rdx
lea    -0x2e0(%rbp),%rcx
lea    -0x300(%rbp),%r8
lea    0xc06(%rip),%rsi
mov    $0x0,%al
call   10e0 <sscanf@plt>
lea    -0x300(%rbp),%rdi
lea    -0x30a(%rbp),%rdx
lea    -0x314(%rbp),%rcx
lea    0xbec(%rip),%rsi
mov    $0x0,%al
call   10e0 <sscanf@plt>
movl   $0x0,-0x7e0(%rbp)
cmpl   $0x3,-0x7e0(%rbp)
jge    14e9 <main+0x2e9>
lea    -0x2e0(%rbp),%rdi
movslq -0x7e0(%rbp),%rax
lea    -0x7d0(%rbp),%rsi
imul   $0x28,%rax,%rax
add    %rax,%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    14d0 <main+0x2d0>
movslq -0x7e0(%rbp),%rcx
lea    -0x750(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x7d8(%rbp)
jmp    14e9 <main+0x2e9>
jmp    14d5 <main+0x2d5>
mov    -0x7e0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7e0(%rbp)
jmp    1477 <main+0x277>
lea    -0x420(%rbp),%rdi
mov    -0x7d8(%rbp),%rdx
lea    -0x30a(%rbp),%rcx
lea    -0x314(%rbp),%r8
lea    -0x4a0(%rbp),%r9
lea    -0x460(%rbp),%rax
lea    0xb4a(%rip),%rsi
mov    %rax,(%rsp)
mov    $0x0,%al
call   1110 <sprintf@plt>
lea    -0x420(%rbp),%rsi
lea    0xb8f(%rip),%rdi
call   1080 <printf@plt>
lea    -0x420(%rbp),%rdi
call   1070 <system@plt>
cmpl   $0x0,-0x7dc(%rbp)
je     155d <main+0x35d>
lea    -0x4a0(%rbp),%rdi
call   1030 <unlink@plt>
lea    -0x4a0(%rbp),%rdi
lea    -0x460(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x460(%rbp),%rax
mov    %rax,-0x800(%rbp)
mov    -0x7dc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7f4(%rbp)
mov    %eax,-0x7dc(%rbp)
mov    $0x0,%al
call   1050 <getpid@plt>
mov    -0x800(%rbp),%rdi
mov    -0x7f4(%rbp),%edx
mov    %eax,%ecx
lea    0xa65(%rip),%rsi
mov    $0x0,%al
call   1110 <sprintf@plt>
jmp    13a1 <main+0x1a1>
mov    -0x228(%rbp),%rdi
call   1060 <fclose@plt>
lea    -0x6a0(%rbp),%rdi
call   1030 <unlink@plt>
lea    -0x420(%rbp),%rdi
lea    -0x4a0(%rbp),%rdx
lea    -0x6a0(%rbp),%rcx
lea    0xa8e(%rip),%rsi
mov    $0x0,%al
call   1110 <sprintf@plt>
lea    -0x420(%rbp),%rsi
lea    0xabd(%rip),%rdi
call   1080 <printf@plt>
lea    -0x420(%rbp),%rdi
call   1070 <system@plt>
lea    -0x4a0(%rbp),%rdi
call   1030 <unlink@plt>
jmp    1651 <main+0x451>
mov    0x29b2(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x18(%rbp),%rcx
lea    0xa60(%rip),%rsi
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x810,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x5b8,%rsp
mov    %rsi,%r14
cmp    $0x1,%edi
jg     1221 <main+0x21>
mov    (%r14),%rdi
call   10f0 <usage@plt>
mov    0x8(%r14),%rbp
lea    0xdd4(%rip),%rdi
mov    %rbp,%rsi
call   1080 <printf@plt>
lea    0xdd8(%rip),%rsi
mov    %rbp,%rdi
call   1100 <fopen@plt>
test   %rax,%rax
je     157d <main+0x37d>
mov    %rax,%rbx
xor    %eax,%eax
call   1050 <getpid@plt>
lea    0xdb8(%rip),%rsi
lea    0x70(%rsp),%rdi
xor    %edx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1110 <sprintf@plt>
lea    0xe2b(%rip),%r15
lea    0x2b0(%rsp),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1090 <fscanf@plt>
lea    0x1d0(%rsp),%r12
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1090 <fscanf@plt>
lea    0x4b0(%rsp),%rbp
mov    %rbp,%rdi
mov    %r12,%rsi
call   1040 <strcpy@plt>
lea    0x30(%rsp),%rdi
mov    %rbp,%rsi
call   1040 <strcpy@plt>
lea    0xd66(%rip),%rdi
mov    %r12,%rsi
call   1080 <printf@plt>
lea    0xd75(%rip),%rbp
lea    0x150(%rsp),%rdx
lea    0xb0(%rsp),%rcx
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1090 <fscanf@plt>
lea    0x178(%rsp),%rdx
lea    0xd8(%rsp),%rcx
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1090 <fscanf@plt>
lea    0x1a0(%rsp),%rdx
lea    0x100(%rsp),%rcx
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1090 <fscanf@plt>
mov    %rbx,%rdi
call   10d0 <feof@plt>
test   %rax,%rax
je     13aa <main+0x1aa>
mov    %rbx,%rdi
call   1060 <fclose@plt>
lea    0x2b0(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <unlink@plt>
lea    0xd24(%rip),%rsi
lea    0x3b0(%rsp),%rbp
lea    0x30(%rsp),%r14
mov    %rbp,%rdi
mov    %r14,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1110 <sprintf@plt>
lea    0xd44(%rip),%rdi
mov    %rbp,%rsi
call   1080 <printf@plt>
mov    %rbp,%rdi
call   1070 <system@plt>
mov    %r14,%rdi
call   1030 <unlink@plt>
xor    %eax,%eax
add    $0x5b8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x260(%rsp),%r13
lea    0x1e(%rsp),%r12
lea    0x14(%rsp),%r15
movl   $0x0,0x10(%rsp)
jmp    13e1 <main+0x1e1>
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   10d0 <feof@plt>
test   %rax,%rax
jne    133b <main+0x13b>
mov    %r13,%rdi
mov    $0x50,%esi
mov    %rbx,%rdx
call   10a0 <fgets@plt>
mov    %rbx,%rdi
call   10d0 <feof@plt>
test   %rax,%rax
jne    133b <main+0x13b>
movzbl 0x260(%rsp),%eax
cmp    $0x23,%al
je     13d0 <main+0x1d0>
cmp    $0xa,%al
je     13d0 <main+0x1d0>
mov    %r13,%rdi
lea    0xc2d(%rip),%rsi
lea    0x230(%rsp),%rdx
lea    0x200(%rsp),%rbp
mov    %rbp,%rcx
lea    0x130(%rsp),%r14
mov    %r14,%r8
xor    %eax,%eax
call   10e0 <sscanf@plt>
mov    %r14,%rdi
lea    0xc07(%rip),%rsi
mov    %r12,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   10e0 <sscanf@plt>
mov    %rbp,%rdi
lea    0xb0(%rsp),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     14b2 <main+0x2b2>
mov    %rbp,%rdi
lea    0xd8(%rsp),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
lea    0x70(%rsp),%r14
lea    0x30(%rsp),%r15
mov    0x10(%rsp),%r12d
je     14c5 <main+0x2c5>
mov    %rbp,%rdi
lea    0x100(%rsp),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
mov    0x28(%rsp),%rdx
jne    14d9 <main+0x2d9>
mov    $0x2,%eax
jmp    14ca <main+0x2ca>
xor    %eax,%eax
lea    0x70(%rsp),%r14
lea    0x30(%rsp),%r15
mov    0x10(%rsp),%r12d
jmp    14ca <main+0x2ca>
mov    $0x1,%eax
lea    (%rax,%rax,4),%rax
lea    (%rsp,%rax,8),%rdx
add    $0x150,%rdx
mov    %r14,(%rsp)
lea    0x3b0(%rsp),%rbp
mov    %rbp,%rdi
lea    0xb75(%rip),%rsi
mov    %rdx,0x28(%rsp)
lea    0x1e(%rsp),%rcx
lea    0x14(%rsp),%r8
mov    %r15,%r9
xor    %eax,%eax
call   1110 <sprintf@plt>
lea    0xbb3(%rip),%rdi
mov    %rbp,%rsi
call   1080 <printf@plt>
mov    %rbp,%rdi
call   1070 <system@plt>
test   %r12d,%r12d
je     152c <main+0x32c>
mov    %r15,%rdi
call   1030 <unlink@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
add    $0x1,%r12d
xor    %eax,%eax
call   1050 <getpid@plt>
mov    %r14,%rdi
lea    0xac9(%rip),%rsi
mov    %r12d,0x10(%rsp)
mov    %r12d,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1110 <sprintf@plt>
mov    %rbx,%rdi
call   10d0 <feof@plt>
test   %rax,%rax
lea    0x1e(%rsp),%r12
lea    0x14(%rsp),%r15
je     13e1 <main+0x1e1>
jmp    133b <main+0x13b>
mov    0x2a5c(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xb12(%rip),%rsi
mov    %rbp,%rcx
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"Using map file %s\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [25 x i8] c"/tmp/status-temp%d%d.ppm\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [27 x i8] c"Source image file is '%s'\0A\00"
@.str.5 = [6 x i8] c"%s %s\00"
@.str.6 = [9 x i8] c"%s %s %s\00"
@.str.7 = [18 x i8] c"(%[^(),], %[^(),]\00"
@.str.8 = [26 x i8] c"pnmpaste %s %s %s %s > %s\00"
@.str.9 = [4 x i8] c"%s\0A\00"
@.str.10 = [36 x i8] c"ppmtogif -transparent white %s > %s\00"
@stderr = global i32 0
@.str.11 = [36 x i8] c"%s: Unable to read mapping file %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca [512 x i8]
%8 = alloca i32*
%9 = alloca [80 x i8]
%10 = alloca [40 x i8]
%11 = alloca [40 x i8]
%12 = alloca [20 x i8]
%13 = alloca [10 x i8]
%14 = alloca [10 x i8]
%15 = alloca [256 x i8]
%16 = alloca [50 x i8]
%17 = alloca [50 x i8]
%18 = alloca [256 x i8]
%19 = alloca [256 x i8]
%20 = alloca [40 x i8]
%21 = alloca [3 x [40 x i8]]
%22 = alloca [3 x [40 x i8]]
%23 = alloca i8*
%24 = alloca i32
%25 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %24
%26 = load i32, i32* %4
%27 = icmp slt i32 %26, 2
br i1 %27, label %28, label %33
28: ; preds = %2
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 0
%31 = load i8*, i8** %30
%32 = call i32 @usage(i8* %31)
br label %33
33: ; preds = %28, %2
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
store i8* %36, i8** %6
%37 = load i8*, i8** %6
%38 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %37)
%39 = load i8*, i8** %6
%40 = call i32* @fopen(i8* %39, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %40, i32** %8
%41 = load i32*, i32** %8
%42 = icmp ne i32* %41, null
br i1 %42, label %43, label %176
43: ; preds = %33
%44 = getelementptr inbounds [50 x i8], [50 x i8]* %16, i64 0, i64 0
%45 = load i32, i32* %24
%46 = call i32 (...) @getpid()
%47 = call i32 (i8*, i8*, ...) @sprintf(i8* %44, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %45, i32 %46)
%48 = load i32*, i32** %8
%49 = getelementptr inbounds [256 x i8], [256 x i8]* %19, i64 0, i64 0
%50 = call i32 (i32*, i8*, i8*, ...) @fscanf(i32* %48, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %49)
%51 = load i32*, i32** %8
%52 = getelementptr inbounds [40 x i8], [40 x i8]* %20, i64 0, i64 0
%53 = call i32 (i32*, i8*, i8*, ...) @fscanf(i32* %51, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %52)
%54 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%55 = getelementptr inbounds [40 x i8], [40 x i8]* %20, i64 0, i64 0
%56 = call i32 (i8*, i8*, ...) @sprintf(i8* %54, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %55)
%57 = getelementptr inbounds [50 x i8], [50 x i8]* %17, i64 0, i64 0
%58 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%59 = call i32 @strcpy(i8* %57, i8* %58)
%60 = getelementptr inbounds [40 x i8], [40 x i8]* %20, i64 0, i64 0
%61 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %60)
store i32 0, i32* %25
br label %62
62: ; preds = %76, %43
%63 = load i32, i32* %25
%64 = icmp slt i32 %63, 3
br i1 %64, label %65, label %79
65: ; preds = %62
%66 = load i32*, i32** %8
%67 = load i32, i32* %25
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [3 x [40 x i8]], [3 x [40 x i8]]* %21, i64 0, i64 %68
%70 = getelementptr inbounds [40 x i8], [40 x i8]* %69, i64 0, i64 0
%71 = load i32, i32* %25
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [3 x [40 x i8]], [3 x [40 x i8]]* %22, i64 0, i64 %72
%74 = getelementptr inbounds [40 x i8], [40 x i8]* %73, i64 0, i64 0
%75 = call i32 (i32*, i8*, i8*, ...) @fscanf(i32* %66, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %70, i8* %74)
br label %76
76: ; preds = %65
%77 = load i32, i32* %25
%78 = add nsw i32 %77, 1
store i32 %78, i32* %25
br label %62
79: ; preds = %62
br label %80
80: ; preds = %152, %104, %98, %79
%81 = load i32*, i32** %8
%82 = call i64 @feof(i32* %81)
%83 = icmp ne i64 %82, 0
%84 = xor i1 %83, true
br i1 %84, label %85, label %161
85: ; preds = %80
%86 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%87 = load i32*, i32** %8
%88 = call i32 @fgets(i8* %86, i32 80, i32* %87)
%89 = load i32*, i32** %8
%90 = call i64 @feof(i32* %89)
%91 = icmp ne i64 %90, 0
br i1 %91, label %92, label %93
92: ; preds = %85
br label %161
93: ; preds = %85
%94 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%95 = load i8, i8* %94
%96 = sext i8 %95 to i32
%97 = icmp eq i32 %96, 35
br i1 %97, label %98, label %99
98: ; preds = %93
br label %80
99: ; preds = %93
%100 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%101 = load i8, i8* %100
%102 = sext i8 %101 to i32
%103 = icmp eq i32 %102, 10
br i1 %103, label %104, label %105
104: ; preds = %99
br label %80
105: ; preds = %99
%106 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%107 = getelementptr inbounds [40 x i8], [40 x i8]* %10, i64 0, i64 0
%108 = getelementptr inbounds [40 x i8], [40 x i8]* %11, i64 0, i64 0
%109 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%110 = call i32 (i8*, i8*, i8*, i8*, ...) @sscanf(i8* %106, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* %107, i8* %108, i8* %109)
%111 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%112 = getelementptr inbounds [10 x i8], [10 x i8]* %13, i64 0, i64 0
%113 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 0
%114 = call i32 (i8*, i8*, i8*, i8*, ...) @sscanf(i8* %111, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i8* %112, i8* %113)
store i32 0, i32* %25
br label %115
115: ; preds = %132, %105
%116 = load i32, i32* %25
%117 = icmp slt i32 %116, 3
br i1 %117, label %118, label %135
118: ; preds = %115
%119 = getelementptr inbounds [40 x i8], [40 x i8]* %11, i64 0, i64 0
%120 = load i32, i32* %25
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds [3 x [40 x i8]], [3 x [40 x i8]]* %22, i64 0, i64 %121
%123 = getelementptr inbounds [40 x i8], [40 x i8]* %122, i64 0, i64 0
%124 = call i64 @strcmp(i8* %119, i8* %123)
%125 = icmp eq i64 %124, 0
br i1 %125, label %126, label %131
126: ; preds = %118
%127 = load i32, i32* %25
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds [3 x [40 x i8]], [3 x [40 x i8]]* %21, i64 0, i64 %128
%130 = getelementptr inbounds [40 x i8], [40 x i8]* %129, i64 0, i64 0
store i8* %130, i8** %23
br label %135
131: ; preds = %118
br label %132
132: ; preds = %131
%133 = load i32, i32* %25
%134 = add nsw i32 %133, 1
store i32 %134, i32* %25
br label %115
135: ; preds = %126, %115
%136 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%137 = load i8*, i8** %23
%138 = getelementptr inbounds [10 x i8], [10 x i8]* %13, i64 0, i64 0
%139 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 0
%140 = getelementptr inbounds [50 x i8], [50 x i8]* %17, i64 0, i64 0
%141 = getelementptr inbounds [50 x i8], [50 x i8]* %16, i64 0, i64 0
%142 = call i32 (i8*, i8*, ...) @sprintf(i8* %136, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i8* %137, i8* %138, i8* %139, i8* %140, i8* %141)
%143 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%144 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %143)
%145 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%146 = call i32 @system(i8* %145)
%147 = load i32, i32* %24
%148 = icmp ne i32 %147, 0
br i1 %148, label %149, label %152
149: ; preds = %135
%150 = getelementptr inbounds [50 x i8], [50 x i8]* %17, i64 0, i64 0
%151 = call i32 @unlink(i8* %150)
br label %152
152: ; preds = %149, %135
%153 = getelementptr inbounds [50 x i8], [50 x i8]* %17, i64 0, i64 0
%154 = getelementptr inbounds [50 x i8], [50 x i8]* %16, i64 0, i64 0
%155 = call i32 @strcpy(i8* %153, i8* %154)
%156 = getelementptr inbounds [50 x i8], [50 x i8]* %16, i64 0, i64 0
%157 = load i32, i32* %24
%158 = add nsw i32 %157, 1
store i32 %158, i32* %24
%159 = call i32 (...) @getpid()
%160 = call i32 (i8*, i8*, ...) @sprintf(i8* %156, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %158, i32 %159)
br label %80
161: ; preds = %92, %80
%162 = load i32*, i32** %8
%163 = call i32 @fclose(i32* %162)
%164 = getelementptr inbounds [256 x i8], [256 x i8]* %19, i64 0, i64 0
%165 = call i32 @unlink(i8* %164)
%166 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%167 = getelementptr inbounds [50 x i8], [50 x i8]* %17, i64 0, i64 0
%168 = getelementptr inbounds [256 x i8], [256 x i8]* %19, i64 0, i64 0
%169 = call i32 (i8*, i8*, ...) @sprintf(i8* %166, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.10, i64 0, i64 0), i8* %167, i8* %168)
%170 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%171 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %170)
%172 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%173 = call i32 @system(i8* %172)
%174 = getelementptr inbounds [50 x i8], [50 x i8]* %17, i64 0, i64 0
%175 = call i32 @unlink(i8* %174)
br label %184
176: ; preds = %33
%177 = load i32, i32* @stderr
%178 = load i8**, i8*** %5
%179 = getelementptr inbounds i8*, i8** %178, i64 0
%180 = load i8*, i8** %179
%181 = load i8*, i8** %6
%182 = call i32 @fprintf(i32 %177, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.11, i64 0, i64 0), i8* %180, i8* %181)
%183 = call i32 @exit(i32 1)
unreachable
184: ; preds = %161
%185 = load i32, i32* %3
ret i32 %185
}

LLVM IR (-O2):
@.str = [19 x i8] c"Using map file %s\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [25 x i8] c"/tmp/status-temp%d%d.ppm\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [27 x i8] c"Source image file is '%s'\0A\00"
@.str.5 = [6 x i8] c"%s %s\00"
@.str.6 = [9 x i8] c"%s %s %s\00"
@.str.7 = [18 x i8] c"(%[^(),], %[^(),]\00"
@.str.8 = [26 x i8] c"pnmpaste %s %s %s %s > %s\00"
@.str.9 = [4 x i8] c"%s\0A\00"
@.str.10 = [36 x i8] c"ppmtogif -transparent white %s > %s\00"
@stderr = global i32 0
@.str.11 = [36 x i8] c"%s: Unable to read mapping file %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [80 x i8]
%4 = alloca [40 x i8]
%5 = alloca [40 x i8]
%6 = alloca [20 x i8]
%7 = alloca [10 x i8]
%8 = alloca [10 x i8]
%9 = alloca [256 x i8]
%10 = alloca [50 x i8]
%11 = alloca [50 x i8]
%12 = alloca [256 x i8]
%13 = alloca [256 x i8]
%14 = alloca [40 x i8]
%15 = alloca [3 x [40 x i8]]
%16 = alloca [3 x [40 x i8]]
%17 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%18 = getelementptr inbounds [40 x i8], [40 x i8]* %4, i64 0, i64 0
%19 = getelementptr inbounds [40 x i8], [40 x i8]* %5, i64 0, i64 0
%20 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%21 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%22 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%24 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%25 = getelementptr inbounds [50 x i8], [50 x i8]* %11, i64 0, i64 0
%26 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%28 = getelementptr inbounds [40 x i8], [40 x i8]* %14, i64 0, i64 0
%29 = getelementptr inbounds [3 x [40 x i8]], [3 x [40 x i8]]* %15, i64 0, i64 0, i64 0
%30 = getelementptr inbounds [3 x [40 x i8]], [3 x [40 x i8]]* %16, i64 0, i64 0, i64 0
%31 = icmp slt i32 %0, 2
br i1 %31, label %32, label %35
32: ; preds = %2
%33 = load i8*, i8** %1
%34 = tail call i32 @usage(i8* %33)
br label %35
35: ; preds = %32, %2
%36 = getelementptr inbounds i8*, i8** %1, i64 1
%37 = load i8*, i8** %36
%38 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %37)
%39 = tail call i32* @fopen(i8* %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%40 = icmp eq i32* %39, null
br i1 %40, label %106, label %41
41: ; preds = %35
%42 = tail call i32 (...) @getpid()
%43 = call i32 (i8*, i8*, ...) @sprintf(i8* %24, i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 %42)
%44 = call i32 (i32*, i8*, i8*, ...) @fscanf(i32* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %27)
%45 = call i32 (i32*, i8*, i8*, ...) @fscanf(i32* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %28)
%46 = call i8* bitcast (i32 (i8*, i8*)* @strcpy to i8* (i8*, i8*)*)(i8* %26, i8* %28)
%47 = call i32 @strcpy(i8* %25, i8* %26)
%48 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %28)
%49 = call i32 (i32*, i8*, i8*, ...) @fscanf(i32* %39, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %29, i8* %30)
%50 = getelementptr inbounds [3 x [40 x i8]], [3 x [40 x i8]]* %15, i64 0, i64 1, i64 0
%51 = getelementptr inbounds [3 x [40 x i8]], [3 x [40 x i8]]* %16, i64 0, i64 1, i64 0
%52 = call i32 (i32*, i8*, i8*, ...) @fscanf(i32* %39, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %50, i8* %51)
%53 = getelementptr inbounds [3 x [40 x i8]], [3 x [40 x i8]]* %15, i64 0, i64 2, i64 0
%54 = getelementptr inbounds [3 x [40 x i8]], [3 x [40 x i8]]* %16, i64 0, i64 2, i64 0
%55 = call i32 (i32*, i8*, i8*, ...) @fscanf(i32* %39, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* %53, i8* %54)
%56 = call i64 @feof(i32* %39)
%57 = icmp eq i64 %56, 0
br i1 %57, label %96, label %99
58: ; preds = %96, %64
%59 = call i32 @fgets(i8* %17, i32 80, i32* %39)
%60 = call i64 @feof(i32* %39)
%61 = icmp eq i64 %60, 0
br i1 %61, label %62, label %99
62: ; preds = %58
%63 = load i8, i8* %17
switch i8 %63, label %67 [
i8 35, label %64
i8 10, label %64
]
64: ; preds = %62, %62
%65 = call i64 @feof(i32* %39)
%66 = icmp eq i64 %65, 0
br i1 %66, label %58, label %99
67: ; preds = %62
%68 = call i32 (i8*, i8*, i8*, i8*, ...) @sscanf(i8* %17, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* %18, i8* %19, i8* %20)
%69 = call i32 (i8*, i8*, i8*, i8*, ...) @sscanf(i8* %20, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i8* %21, i8* %22)
%70 = call i64 @strcmp(i8* %19, i8* %30)
%71 = icmp eq i64 %70, 0
br i1 %71, label %72, label %75
72: ; preds = %78, %75, %67
%73 = phi i64 [ 0, %67 ], [ 1, %75 ], [ 2, %78 ]
%74 = getelementptr inbounds [3 x [40 x i8]], [3 x [40 x i8]]* %15, i64 0, i64 %73, i64 0
br label %81
75: ; preds = %67
%76 = call i64 @strcmp(i8* %19, i8* %51)
%77 = icmp eq i64 %76, 0
br i1 %77, label %72, label %78
78: ; preds = %75
%79 = call i64 @strcmp(i8* %19, i8* %54)
%80 = icmp eq i64 %79, 0
br i1 %80, label %72, label %81
81: ; preds = %78, %72
%82 = phi i8* [ %74, %72 ], [ %98, %78 ]
%83 = call i32 (i8*, i8*, ...) @sprintf(i8* %23, i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i8* %82, i8* %21, i8* %22, i8* %25, i8* %24)
%84 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %23)
%85 = call i32 @system(i8* %23)
%86 = icmp eq i32 %97, 0
br i1 %86, label %89, label %87
87: ; preds = %81
%88 = call i32 @unlink(i8* %25)
br label %89
89: ; preds = %87, %81
%90 = call i32 @strcpy(i8* %25, i8* %24)
%91 = add nuw nsw i32 %97, 1
%92 = call i32 (...) @getpid()
%93 = call i32 (i8*, i8*, ...) @sprintf(i8* %24, i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %91, i32 %92)
%94 = call i64 @feof(i32* %39)
%95 = icmp eq i64 %94, 0
br i1 %95, label %96, label %99
96: ; preds = %41, %89
%97 = phi i32 [ %91, %89 ], [ 0, %41 ]
%98 = phi i8* [ %82, %89 ], [ undef, %41 ]
br label %58
99: ; preds = %89, %64, %58, %41
%100 = call i32 @fclose(i32* %39)
%101 = call i32 @unlink(i8* %27)
%102 = call i32 (i8*, i8*, ...) @sprintf(i8* %23, i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.10, i64 0, i64 0), i8* %25, i8* %27)
%103 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %23)
%104 = call i32 @system(i8* %23)
%105 = call i32 @unlink(i8* %25)
ret i32 0
106: ; preds = %35
%107 = load i32, i32* @stderr
%108 = load i8*, i8** %1
%109 = tail call i32 @fprintf(i32 %107, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.11, i64 0, i64 0), i8* %108, i8* %37)
%110 = tail call i32 @exit(i32 1)
unreachable
}