#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*/ STDOUT_FILENO;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ dup2(int, int /*<<< orphan*/);
int /*<<< orphan*/ execlp(char *, char *, char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fdopen(int, char *);
scalar_t__ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fork();
int /*<<< orphan*/ pipe(int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sscanf(char *, char *, double *, double *);
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
char *strstr(char *, char *);
int main(int argc, char *argv[]) {
  char datestr[512] = "", *c, *d, buf[512];
  FILE *kmlinf;
  int argp, pipefrom[2], pid;
  double la = 0.0, lo = 0.0;
  printf("<?xml version=\"1.0\"?>\n<gpx version=\"1.0\" creator=\"kml2gpx\" "
         "xmlnx=\"http://www.topografix.com/GPX/1/0\">\n");
  printf("<trk><trkseg>\n");
  for (argp = 1; argp < argc; argp++) {
    kmlinf = NULL;
    if (strstr(argv[argp], ".kml"))
      kmlinf = fopen(argv[argp], "r");
    else if (strstr(argv[argp], ".kmz")) {
      pipe(pipefrom);
      pid = fork();
      if (!pid) {
        dup2(pipefrom[1], STDOUT_FILENO);
        close(pipefrom[0]);
        close(pipefrom[1]);
        execlp("/usr/bin/unzip", "unzip", "-p", argv[argp], NULL);
        exit(-1);
      }
      close(pipefrom[1]);
      kmlinf = fdopen(pipefrom[0], "r");
    }
    if (kmlinf == NULL)
      continue;
    for (;;) {
      if (feof(kmlinf))
        break;
      fgets(buf, 512, kmlinf);
      if ((c = strstr(buf, "<TimeStamp><when>"))) {
        c += 17;
        strcpy(datestr, c);
        c = strstr(datestr, "<");
        *c = 0;
        continue;
      }
      if (!strchr(buf, '<')) {
        double la1, lo1;
        if (!strlen(datestr))
          continue;
        sscanf(buf, "%lf,%lf", &lo1, &la1);
        if (la1 == la && lo1 == lo)
          continue;
        la = la1;
        lo = lo1;
        printf("<trkpt lat=\"%.6f\" lon=\"%.6f\"><time>%s</time></trkpt>\n",
               la1, lo1, datestr);
      }
      if (!(c = strchr(buf, '$')))
        continue;
      d = strchr(c, '*');
      if (!d)
        continue;
      d += 3;
      *d++ = '\r';
      *d++ = '\n';
      *d = 0;
      c++;
      if (!strncmp(c, "GPRMC", 5)) {
      }
      if (!strncmp(c, "GPGLL", 5)) {
      }
      if (!strncmp(c, "GPGGA", 5)) {
      }
    }
    fclose(kmlinf);
  }
  printf("</trkseg></trk></gpx>\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x460,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x210(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   10a0 <memset@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x440(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x448(%rbp)
ff
lea    0xd87(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x42c(%rbp)
mov    -0x42c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    16b0 <main+0x480>
movq   $0x0,-0x428(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x42c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdae(%rip),%rsi
call   1150 <strstr@plt>
cmp    $0x0,%rax
je     12fe <main+0xce>
mov    -0x10(%rbp),%rax
movslq -0x42c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd8e(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,-0x428(%rbp)
jmp    13d4 <main+0x1a4>
mov    -0x10(%rbp),%rax
movslq -0x42c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd69(%rip),%rsi
call   1150 <strstr@plt>
cmp    $0x0,%rax
je     13cf <main+0x19f>
lea    -0x434(%rbp),%rdi
call   10c0 <pipe@plt>
mov    $0x0,%al
call   1140 <fork@plt>
mov    %eax,-0x438(%rbp)
cmpl   $0x0,-0x438(%rbp)
jne    13ab <main+0x17b>
mov    -0x430(%rbp),%edi
mov    0x2c9a(%rip),%rax
mov    (%rax),%esi
call   1070 <dup2@plt>
mov    -0x434(%rbp),%edi
call   10b0 <close@plt>
mov    -0x430(%rbp),%edi
call   10b0 <close@plt>
mov    -0x10(%rbp),%rax
movslq -0x42c(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xcf9(%rip),%rdi
lea    0xcfb(%rip),%rsi
lea    0xcfa(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
call   1130 <execlp@plt>
mov    $0xffffffff,%edi
call   1120 <exit@plt>
mov    -0x430(%rbp),%edi
call   10b0 <close@plt>
mov    -0x434(%rbp),%edi
lea    0xcb8(%rip),%rsi
call   1100 <fdopen@plt>
mov    %rax,-0x428(%rbp)
jmp    13d4 <main+0x1a4>
cmpq   $0x0,-0x428(%rbp)
jne    13e7 <main+0x1b7>
jmp    169c <main+0x46c>
jmp    13ec <main+0x1bc>
mov    -0x428(%rbp),%rdi
call   10e0 <feof@plt>
cmp    $0x0,%rax
je     1407 <main+0x1d7>
jmp    1690 <main+0x460>
lea    -0x420(%rbp),%rdi
mov    -0x428(%rbp),%rdx
mov    $0x200,%esi
call   10d0 <fgets@plt>
lea    -0x420(%rbp),%rdi
lea    0xc67(%rip),%rsi
call   1150 <strstr@plt>
mov    %rax,-0x218(%rbp)
cmp    $0x0,%rax
je     1491 <main+0x261>
mov    -0x218(%rbp),%rax
add    $0x11,%rax
mov    %rax,-0x218(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x218(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x210(%rbp),%rdi
lea    0xc30(%rip),%rsi
call   1150 <strstr@plt>
mov    %rax,-0x218(%rbp)
mov    -0x218(%rbp),%rax
movb   $0x0,(%rax)
jmp    13ec <main+0x1bc>
lea    -0x420(%rbp),%rdi
mov    $0x3c,%esi
call   1080 <strchr@plt>
cmp    $0x0,%rax
jne    1569 <main+0x339>
lea    -0x210(%rbp),%rdi
call   1060 <strlen@plt>
cmp    $0x0,%eax
jne    14c6 <main+0x296>
jmp    13ec <main+0x1bc>
lea    -0x420(%rbp),%rdi
lea    0xbd4(%rip),%rsi
lea    -0x458(%rbp),%rdx
lea    -0x450(%rbp),%rcx
call   10f0 <sscanf@plt>
movsd  -0x450(%rbp),%xmm0
ff
ucomisd -0x440(%rbp),%xmm0
ff
jne    1524 <main+0x2f4>
jp     1524 <main+0x2f4>
movsd  -0x458(%rbp),%xmm0
ff
ucomisd -0x448(%rbp),%xmm0
ff
jne    1524 <main+0x2f4>
jp     1524 <main+0x2f4>
jmp    13ec <main+0x1bc>
movsd  -0x450(%rbp),%xmm0
ff
movsd  %xmm0,-0x440(%rbp)
ff
movsd  -0x458(%rbp),%xmm0
ff
movsd  %xmm0,-0x448(%rbp)
ff
movsd  -0x450(%rbp),%xmm0
ff
movsd  -0x458(%rbp),%xmm1
ff
lea    -0x210(%rbp),%rsi
lea    0xb4e(%rip),%rdi
mov    $0x2,%al
call   1090 <printf@plt>
lea    -0x420(%rbp),%rdi
mov    $0x24,%esi
call   1080 <strchr@plt>
mov    %rax,-0x218(%rbp)
cmp    $0x0,%rax
jne    1590 <main+0x360>
jmp    13ec <main+0x1bc>
mov    -0x218(%rbp),%rdi
mov    $0x2a,%esi
call   1080 <strchr@plt>
mov    %rax,-0x220(%rbp)
cmpq   $0x0,-0x220(%rbp)
jne    15bb <main+0x38b>
jmp    13ec <main+0x1bc>
mov    -0x220(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x220(%rbp)
mov    -0x220(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x220(%rbp)
movb   $0xd,(%rax)
mov    -0x220(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x220(%rbp)
movb   $0xa,(%rax)
mov    -0x220(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x218(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x218(%rbp)
mov    -0x218(%rbp),%rdi
lea    0xabf(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    163f <main+0x40f>
jmp    163f <main+0x40f>
mov    -0x218(%rbp),%rdi
lea    0xa9f(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1665 <main+0x435>
jmp    1665 <main+0x435>
mov    -0x218(%rbp),%rdi
lea    0xa7f(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    168b <main+0x45b>
jmp    168b <main+0x45b>
jmp    13ec <main+0x1bc>
mov    -0x428(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x42c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x42c(%rbp)
jmp    1298 <main+0x68>
lea    0xa41(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
xor    %eax,%eax
add    $0x460,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x458,%rsp
mov    %rsi,0x10(%rsp)
mov    %edi,%ebp
lea    0x50(%rsp),%rdi
mov    $0x200,%edx
xor    %esi,%esi
call   10b0 <memset@plt>
lea    0xe10(%rip),%rdi
call   1050 <puts@plt>
lea    0xe6a(%rip),%rdi
call   1050 <puts@plt>
cmp    $0x2,%ebp
jl     14ce <main+0x28e>
mov    %ebp,%eax
mov    %rax,0x38(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
mov    $0x1,%r13d
lea    0x250(%rsp),%rbp
lea    0xd6e(%rip),%r12
lea    0x50(%rsp),%r15
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x20(%rsp)
jmp    12e7 <main+0xa7>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1060 <fclose@plt>
add    $0x1,%r13
cmp    0x38(%rsp),%r13
je     14ce <main+0x28e>
mov    0x10(%rsp),%rax
mov    (%rax,%r13,8),%rbx
mov    %rbx,%rdi
lea    0xd06(%rip),%rsi
call   1160 <strstr@plt>
mov    %rbx,%rdi
test   %rax,%rax
je     1320 <main+0xe0>
lea    0xcf7(%rip),%rsi
call   1120 <fopen@plt>
jmp    1363 <main+0x123>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xce0(%rip),%rsi
call   1160 <strstr@plt>
test   %rax,%rax
je     12d8 <main+0x98>
lea    0x8(%rsp),%rdi
call   10d0 <pipe@plt>
xor    %eax,%eax
call   1150 <fork@plt>
test   %eax,%eax
je     14ee <main+0x2ae>
mov    0xc(%rsp),%edi
call   10c0 <close@plt>
mov    0x8(%rsp),%edi
lea    0xca7(%rip),%rsi
call   1110 <fdopen@plt>
mov    %rax,%r14
test   %rax,%rax
jne    138f <main+0x14f>
jmp    12d8 <main+0x98>
add    $0x11,%rax
mov    %r15,%rdi
mov    %rax,%rsi
call   1040 <strcpy@plt>
mov    %r15,%rdi
mov    $0x3c,%esi
call   1090 <strchr@plt>
movb   $0x0,(%rax)
mov    %r14,%rdi
call   10f0 <feof@plt>
test   %rax,%rax
jne    12d0 <main+0x90>
mov    %rbp,%rdi
mov    $0x200,%esi
mov    %r14,%rdx
call   10e0 <fgets@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1160 <strstr@plt>
test   %rax,%rax
jne    1370 <main+0x130>
mov    %rbp,%rdi
mov    $0x3c,%esi
call   1090 <strchr@plt>
test   %rax,%rax
jne    1450 <main+0x210>
mov    %r15,%rdi
call   1070 <strlen@plt>
test   %eax,%eax
je     138f <main+0x14f>
mov    %rbp,%rdi
lea    0xc48(%rip),%rsi
lea    0x40(%rsp),%rdx
lea    0x48(%rsp),%rcx
call   1100 <sscanf@plt>
movsd  0x48(%rsp),%xmm0
ucomisd 0x20(%rsp),%xmm0
movsd  0x40(%rsp),%xmm1
jne    141b <main+0x1db>
jp     141b <main+0x1db>
ucomisd 0x18(%rsp),%xmm1
jne    141b <main+0x1db>
jnp    138f <main+0x14f>
lea    0xc16(%rip),%rdi
movsd  %xmm0,0x30(%rsp)
movsd  %xmm1,0x28(%rsp)
mov    %r15,%rsi
mov    $0x2,%al
call   10a0 <printf@plt>
movsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x28(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
mov    %rbp,%rdi
mov    $0x24,%esi
call   1090 <strchr@plt>
test   %rax,%rax
je     138f <main+0x14f>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x2a,%esi
call   1090 <strchr@plt>
test   %rax,%rax
je     138f <main+0x14f>
movw   $0xa0d,0x3(%rax)
movb   $0x0,0x5(%rax)
add    $0x1,%rbx
mov    %rbx,%rdi
lea    0xbd7(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
mov    %rbx,%rdi
lea    0xbc9(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
mov    %rbx,%rdi
lea    0xbbb(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
jmp    138f <main+0x14f>
lea    0xc1f(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x458,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r13d,%ebx
mov    0xc(%rsp),%edi
mov    0x2af4(%rip),%rax
mov    (%rax),%esi
call   1080 <dup2@plt>
mov    0x8(%rsp),%edi
call   10c0 <close@plt>
mov    0xc(%rsp),%edi
call   10c0 <close@plt>
mov    0x10(%rsp),%rax
mov    (%rax,%rbx,8),%rcx
lea    0xae7(%rip),%rdi
lea    0xae9(%rip),%rsi
lea    0xae8(%rip),%rdx
xor    %r8d,%r8d
call   1140 <execlp@plt>
mov    $0xffffffff,%edi
call   1130 <exit@plt>

LLVM IR (-O0):
@.str = [103 x i8] c"<?xml version=\221.0\22?>\0A<gpx version=\221.0\22 creator=\22kml2gpx\22 xmlnx=\22http://www.topografix.com/GPX/1/0\22>\0A\00"
@.str.1 = [15 x i8] c"<trk><trkseg>\0A\00"
@.str.2 = [5 x i8] c".kml\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [5 x i8] c".kmz\00"
@STDOUT_FILENO = global i32 0
@.str.5 = [15 x i8] c"/usr/bin/unzip\00"
@.str.6 = [6 x i8] c"unzip\00"
@.str.7 = [3 x i8] c"-p\00"
@.str.8 = [18 x i8] c"<TimeStamp><when>\00"
@.str.9 = [2 x i8] c"<\00"
@.str.10 = [8 x i8] c"%lf,%lf\00"
@.str.11 = [54 x i8] c"<trkpt lat=\22%.6f\22 lon=\22%.6f\22><time>%s</time></trkpt>\0A\00"
@.str.12 = [6 x i8] c"GPRMC\00"
@.str.13 = [6 x i8] c"GPGLL\00"
@.str.14 = [6 x i8] c"GPGGA\00"
@.str.15 = [23 x i8] c"</trkseg></trk></gpx>\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [512 x i8]
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [512 x i8]
%10 = alloca i32*
%11 = alloca i32
%12 = alloca [2 x i32]
%13 = alloca i32
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%18 = bitcast [512 x i8]* %6 to i8*
store double 0.000000e+00, double* %14
store double 0.000000e+00, double* %15
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([103 x i8], [103 x i8]* @.str, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %11
br label %21
21: ; preds = %172, %2
%22 = load i32, i32* %11
%23 = load i32, i32* %4
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %175
25: ; preds = %21
store i32* null, i32** %10
%26 = load i8**, i8*** %5
%27 = load i32, i32* %11
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8*, i8** %26, i64 %28
%30 = load i8*, i8** %29
%31 = call i8* @strstr(i8* %30, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%32 = icmp ne i8* %31, null
br i1 %32, label %33, label %40
33: ; preds = %25
%34 = load i8**, i8*** %5
%35 = load i32, i32* %11
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %34, i64 %36
%38 = load i8*, i8** %37
%39 = call i32* @fopen(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %39, i32** %10
br label %80
40: ; preds = %25
%41 = load i8**, i8*** %5
%42 = load i32, i32* %11
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8*, i8** %41, i64 %43
%45 = load i8*, i8** %44
%46 = call i8* @strstr(i8* %45, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%47 = icmp ne i8* %46, null
br i1 %47, label %48, label %79
48: ; preds = %40
%49 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%50 = call i32 @pipe(i32* %49)
%51 = call i32 (...) @fork()
store i32 %51, i32* %13
%52 = load i32, i32* %13
%53 = icmp ne i32 %52, 0
br i1 %53, label %72, label %54
54: ; preds = %48
%55 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 1
%56 = load i32, i32* %55
%57 = load i32, i32* @STDOUT_FILENO
%58 = call i32 @dup2(i32 %56, i32 %57)
%59 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%60 = load i32, i32* %59
%61 = call i32 @close(i32 %60)
%62 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 1
%63 = load i32, i32* %62
%64 = call i32 @close(i32 %63)
%65 = load i8**, i8*** %5
%66 = load i32, i32* %11
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i8*, i8** %65, i64 %67
%69 = load i8*, i8** %68
%70 = call i32 @execlp(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %69, i32* null)
%71 = call i32 @exit(i32 -1)
unreachable
72: ; preds = %48
%73 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 1
%74 = load i32, i32* %73
%75 = call i32 @close(i32 %74)
%76 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%77 = load i32, i32* %76
%78 = call i32* @fdopen(i32 %77, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %78, i32** %10
br label %79
79: ; preds = %72, %40
br label %80
80: ; preds = %79, %33
%81 = load i32*, i32** %10
%82 = icmp eq i32* %81, null
br i1 %82, label %83, label %84
83: ; preds = %80
br label %172
84: ; preds = %80
br label %85
85: ; preds = %168, %143, %137, %125, %114, %97, %84
%86 = load i32*, i32** %10
%87 = call i64 @feof(i32* %86)
%88 = icmp ne i64 %87, 0
br i1 %88, label %89, label %90
89: ; preds = %85
br label %169
90: ; preds = %85
%91 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%92 = load i32*, i32** %10
%93 = call i32 @fgets(i8* %91, i32 512, i32* %92)
%94 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%95 = call i8* @strstr(i8* %94, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
store i8* %95, i8** %7
%96 = icmp ne i8* %95, null
br i1 %96, label %97, label %106
97: ; preds = %90
%98 = load i8*, i8** %7
%99 = getelementptr inbounds i8, i8* %98, i64 17
store i8* %99, i8** %7
%100 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%101 = load i8*, i8** %7
%102 = call i32 @strcpy(i8* %100, i8* %101)
%103 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%104 = call i8* @strstr(i8* %103, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
store i8* %104, i8** %7
%105 = load i8*, i8** %7
store i8 0, i8* %105
br label %85
106: ; preds = %90
%107 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%108 = call i8* @strchr(i8* %107, i8 signext 60)
%109 = icmp ne i8* %108, null
br i1 %109, label %133, label %110
110: ; preds = %106
%111 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%112 = call i32 @strlen(i8* %111)
%113 = icmp ne i32 %112, 0
br i1 %113, label %115, label %114
114: ; preds = %110
br label %85
115: ; preds = %110
%116 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%117 = call i32 @sscanf(i8* %116, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), double* %17, double* %16)
%118 = load double, double* %16
%119 = load double, double* %14
%120 = fcmp oeq double %118, %119
br i1 %120, label %121, label %126
121: ; preds = %115
%122 = load double, double* %17
%123 = load double, double* %15
%124 = fcmp oeq double %122, %123
br i1 %124, label %125, label %126
125: ; preds = %121
br label %85
126: ; preds = %121, %115
%127 = load double, double* %16
store double %127, double* %14
%128 = load double, double* %17
store double %128, double* %15
%129 = load double, double* %16
%130 = load double, double* %17
%131 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%132 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.11, i64 0, i64 0), double %129, double %130, i8* %131)
br label %133
133: ; preds = %126, %106
%134 = getelementptr inbounds [512 x i8], [512 x i8]* %9, i64 0, i64 0
%135 = call i8* @strchr(i8* %134, i8 signext 36)
store i8* %135, i8** %7
%136 = icmp ne i8* %135, null
br i1 %136, label %138, label %137
137: ; preds = %133
br label %85
138: ; preds = %133
%139 = load i8*, i8** %7
%140 = call i8* @strchr(i8* %139, i8 signext 42)
store i8* %140, i8** %8
%141 = load i8*, i8** %8
%142 = icmp ne i8* %141, null
br i1 %142, label %144, label %143
143: ; preds = %138
br label %85
144: ; preds = %138
%145 = load i8*, i8** %8
%146 = getelementptr inbounds i8, i8* %145, i64 3
store i8* %146, i8** %8
%147 = load i8*, i8** %8
%148 = getelementptr inbounds i8, i8* %147, i32 1
store i8* %148, i8** %8
store i8 13, i8* %147
%149 = load i8*, i8** %8
%150 = getelementptr inbounds i8, i8* %149, i32 1
store i8* %150, i8** %8
store i8 10, i8* %149
%151 = load i8*, i8** %8
store i8 0, i8* %151
%152 = load i8*, i8** %7
%153 = getelementptr inbounds i8, i8* %152, i32 1
store i8* %153, i8** %7
%154 = load i8*, i8** %7
%155 = call i32 @strncmp(i8* %154, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 5)
%156 = icmp ne i32 %155, 0
br i1 %156, label %158, label %157
157: ; preds = %144
br label %158
158: ; preds = %157, %144
%159 = load i8*, i8** %7
%160 = call i32 @strncmp(i8* %159, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i32 5)
%161 = icmp ne i32 %160, 0
br i1 %161, label %163, label %162
162: ; preds = %158
br label %163
163: ; preds = %162, %158
%164 = load i8*, i8** %7
%165 = call i32 @strncmp(i8* %164, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i32 5)
%166 = icmp ne i32 %165, 0
br i1 %166, label %168, label %167
167: ; preds = %163
br label %168
168: ; preds = %167, %163
br label %85
169: ; preds = %89
%170 = load i32*, i32** %10
%171 = call i32 @fclose(i32* %170)
br label %172
172: ; preds = %169, %83
%173 = load i32, i32* %11
%174 = add nsw i32 %173, 1
store i32 %174, i32* %11
br label %21
175: ; preds = %21
%176 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.15, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [5 x i8] c".kml\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [5 x i8] c".kmz\00"
@STDOUT_FILENO = global i32 0
@.str.5 = [15 x i8] c"/usr/bin/unzip\00"
@.str.6 = [6 x i8] c"unzip\00"
@.str.7 = [3 x i8] c"-p\00"
@.str.8 = [18 x i8] c"<TimeStamp><when>\00"
@.str.10 = [8 x i8] c"%lf,%lf\00"
@.str.11 = [54 x i8] c"<trkpt lat=\22%.6f\22 lon=\22%.6f\22><time>%s</time></trkpt>\0A\00"
@.str.12 = [6 x i8] c"GPRMC\00"
@.str.13 = [6 x i8] c"GPGLL\00"
@.str.14 = [6 x i8] c"GPGGA\00"
@str = [102 x i8] c"<?xml version=\221.0\22?>\0A<gpx version=\221.0\22 creator=\22kml2gpx\22 xmlnx=\22http://www.topografix.com/GPX/1/0\22>\00"
@str.16 = [14 x i8] c"<trk><trkseg>\00"
@str.17 = [22 x i8] c"</trkseg></trk></gpx>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [512 x i8]
%4 = alloca [512 x i8]
%5 = alloca [2 x i32]
%6 = alloca double
%7 = alloca double
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%10 = bitcast [2 x i32]* %5 to i8*
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([102 x i8], [102 x i8]* @str, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.16, i64 0, i64 0))
%13 = icmp sgt i32 %0, 1
br i1 %13, label %14, label %119
14: ; preds = %2
%15 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 1
%17 = bitcast double* %6 to i8*
%18 = bitcast double* %7 to i8*
%19 = zext i32 %0 to i64
br label %20
20: ; preds = %14, %114
%21 = phi i64 [ 1, %14 ], [ %117, %114 ]
%22 = phi double [ 0.000000e+00, %14 ], [ %116, %114 ]
%23 = phi double [ 0.000000e+00, %14 ], [ %115, %114 ]
%24 = getelementptr inbounds i8*, i8** %1, i64 %21
%25 = load i8*, i8** %24
%26 = call i8* @strstr(i8* dereferenceable(1) %25, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%27 = icmp eq i8* %26, null
br i1 %27, label %30, label %28
28: ; preds = %20
%29 = call i32* @fopen(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %55
30: ; preds = %20
%31 = call i8* @strstr(i8* dereferenceable(1) %25, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%32 = icmp eq i8* %31, null
br i1 %32, label %114, label %33
33: ; preds = %30
%34 = call i32 @pipe(i32* %15)
%35 = call i32 (...) @fork()
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %50
37: ; preds = %33
%38 = and i64 %21, 4294967295
%39 = getelementptr inbounds i8*, i8** %1, i64 %38
%40 = load i32, i32* %16
%41 = load i32, i32* @STDOUT_FILENO
%42 = call i32 @dup2(i32 %40, i32 %41)
%43 = load i32, i32* %15
%44 = call i32 @close(i32 %43)
%45 = load i32, i32* %16
%46 = call i32 @close(i32 %45)
%47 = load i8*, i8** %39
%48 = call i32 @execlp(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %47, i32* null)
%49 = call i32 @exit(i32 -1)
unreachable
50: ; preds = %33
%51 = load i32, i32* %16
%52 = call i32 @close(i32 %51)
%53 = load i32, i32* %15
%54 = call i32* @fdopen(i32 %53, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %55
55: ; preds = %50, %28
%56 = phi i32* [ %29, %28 ], [ %54, %50 ]
%57 = icmp eq i32* %56, null
br i1 %57, label %114, label %58
58: ; preds = %55
%59 = call i64 @feof(i32* %56)
%60 = icmp eq i64 %59, 0
br i1 %60, label %61, label %110
61: ; preds = %58, %107
%62 = phi double [ %93, %107 ], [ %22, %58 ]
%63 = phi double [ %92, %107 ], [ %23, %58 ]
br label %64
64: ; preds = %61, %72
%65 = call i32 @fgets(i8* %9, i32 512, i32* %56)
%66 = call i8* @strstr(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
%67 = icmp eq i8* %66, null
br i1 %67, label %75, label %68
68: ; preds = %64
%69 = getelementptr inbounds i8, i8* %66, i64 17
%70 = call i32 @strcpy(i8* %8, i8* %69)
%71 = call i8* bitcast (i8* (i8*, i8)* @strchr to i8* (i8*, i32)*)(i8* %8, i32 60)
store i8 0, i8* %71
br label %72
72: ; preds = %68, %90
%73 = call i64 @feof(i32* %56)
%74 = icmp eq i64 %73, 0
br i1 %74, label %64, label %110
75: ; preds = %64
%76 = call i8* @strchr(i8* %9, i8 signext 60)
%77 = icmp eq i8* %76, null
br i1 %77, label %78, label %91
78: ; preds = %75
%79 = call i32 @strlen(i8* %8)
%80 = icmp eq i32 %79, 0
br i1 %80, label %90, label %81
81: ; preds = %78
%82 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), double* %7, double* %6)
%83 = load double, double* %6
%84 = fcmp oeq double %83, %63
%85 = load double, double* %7
%86 = fcmp oeq double %85, %62
%87 = select i1 %84, i1 %86, i1 false
br i1 %87, label %90, label %88
88: ; preds = %81
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.11, i64 0, i64 0), double %83, double %85, i8* %8)
br label %91
90: ; preds = %81, %78
br label %72
91: ; preds = %75, %88
%92 = phi double [ %83, %88 ], [ %63, %75 ]
%93 = phi double [ %85, %88 ], [ %62, %75 ]
%94 = call i8* @strchr(i8* %9, i8 signext 36)
%95 = icmp eq i8* %94, null
br i1 %95, label %107, label %96
96: ; preds = %91
%97 = call i8* @strchr(i8* %94, i8 signext 42)
%98 = icmp eq i8* %97, null
br i1 %98, label %107, label %99
99: ; preds = %96
%100 = getelementptr inbounds i8, i8* %97, i64 3
%101 = getelementptr inbounds i8, i8* %97, i64 4
store i8 13, i8* %100
%102 = getelementptr inbounds i8, i8* %97, i64 5
store i8 10, i8* %101
store i8 0, i8* %102
%103 = getelementptr inbounds i8, i8* %94, i64 1
%104 = call i32 @strncmp(i8* %103, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 5)
%105 = call i32 @strncmp(i8* %103, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i32 5)
%106 = call i32 @strncmp(i8* %103, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i32 5)
br label %107
107: ; preds = %99, %96, %91
%108 = call i64 @feof(i32* %56)
%109 = icmp eq i64 %108, 0
br i1 %109, label %61, label %110
110: ; preds = %107, %72, %58
%111 = phi double [ %23, %58 ], [ %63, %72 ], [ %92, %107 ]
%112 = phi double [ %22, %58 ], [ %62, %72 ], [ %93, %107 ]
%113 = call i32 @fclose(i32* %56)
br label %114
114: ; preds = %30, %55, %110
%115 = phi double [ %23, %55 ], [ %111, %110 ], [ %23, %30 ]
%116 = phi double [ %22, %55 ], [ %112, %110 ], [ %22, %30 ]
%117 = add nuw nsw i64 %21, 1
%118 = icmp eq i64 %117, %19
br i1 %118, label %119, label %20
119: ; preds = %114, %2
%120 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.17, i64 0, i64 0))
ret i32 0
}