#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*/ speedbuf;
typedef int /*<<< orphan*/ headingbuf;
typedef int /*<<< orphan*/ chkbuf;

/* Variables and functions */
scalar_t__ compass_get_heading(float *);
char *memchr(char *, char, int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ memmove(char *, char *, int);
int my_split(char *, char **, char *, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
scalar_t__ strncmp(char *, char *, int);
int strtoul(char *, int /*<<< orphan*/ *, int);
scalar_t__ tacho_get_speed(float *);
double to_seconds(char *);
int proc_gps_input(int l, int *bufpos, int buflen, char *buf,
                   void (*gpsproc)(char *ptime, char *date, double longg,
                                   double latt, void *),
                   void *data, char *writeptr) {
  char *endp;
  int wlen = 0;
  if (l <= 0) {
    perror("proc_gps_input: ");
    return l;
  }
  (*bufpos) += l;
  while ((endp = memchr(buf, '\n', *bufpos))) {
    int readlen;
    memcpy(writeptr, buf, endp - buf + 1);
    *endp = 0;
    if (strncmp(buf, "$GPRMC", 6) == 0) {
      char linebuf[256];
      char *fields[13];
      char headingbuf[10];
      char speedbuf[10];
      strcpy(linebuf, buf);
      int numfields = my_split(linebuf, fields, ",", 13);
      if ((numfields == 12) || (numfields == 13)) {
        double lattsec;
        double longsec;
        float heading;
        float speed;
        if (compass_get_heading(&heading)) {
          snprintf(headingbuf, sizeof(headingbuf), "%.1f", heading);
        } else {
          headingbuf[0] = 0;
        }
        if (tacho_get_speed(&speed)) {
          snprintf(speedbuf, sizeof(speedbuf), "%.1f", speed);
        } else {
          speedbuf[0] = 0;
        }
        if (1) {
          int i;
          int chksum;
          char *chkptr;
          if ((chkptr = strchr(fields[numfields - 1], '*'))) {
            if (strlen(chkptr) > 2) {
              char chkbuf[3];
              chksum = strtoul(chkptr + 1, NULL, 16);
              for (i = 0; i < strlen(fields[8]); i++) {
                chksum ^= (fields[8])[i];
              }
              for (i = 0; i < strlen(headingbuf); i++) {
                chksum ^= headingbuf[i];
              }
              if (speedbuf[0] != 0) {
                for (i = 0; i < strlen(fields[7]); i++) {
                  chksum ^= (fields[7])[i];
                }
                for (i = 0; i < strlen(speedbuf); i++) {
                  chksum ^= speedbuf[i];
                }
              }
              snprintf(chkbuf, sizeof(chkbuf), "%02X", 0xff & (int)chksum);
              chkptr[1] = chkbuf[0];
              chkptr[2] = chkbuf[1];
            }
          }
          fields[8] = headingbuf;
          if (speedbuf[0])
            fields[7] = speedbuf;
          for (i = 0; i < numfields; i++) {
            if (i) {
              writeptr[0] = ',';
              wlen++;
              writeptr++;
            }
            strcpy(writeptr, fields[i]);
            wlen += strlen(fields[i]);
            writeptr += strlen(fields[i]);
          }
          *writeptr = '\n';
          writeptr++;
          wlen++;
        } else {
          wlen += (endp - buf) + 1;
          writeptr += (endp - buf) + 1;
        }
        longsec = to_seconds(fields[5]);
        lattsec = to_seconds(fields[3]);
        if ((fields[4])[0] == 'S')
          lattsec = -lattsec;
        if ((fields[6])[0] == 'W')
          longsec = -longsec;
        gpsproc(fields[1], fields[9], longsec, lattsec, data);
      } else {
        wlen += (endp - buf) + 1;
        writeptr += (endp - buf) + 1;
      }
    } else {
      wlen += (endp - buf) + 1;
      writeptr += (endp - buf) + 1;
    }
    *endp = '\n';
    endp++;
    readlen = endp - buf;
    if (readlen != *bufpos)
      memmove(buf, endp, (*bufpos) - readlen);
    (*bufpos) -= readlen;
  }
  return wlen;
}


x86 assembly (clang, -O0):
<proc_gps_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0x3c(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     122d <proc_gps_input+0x4d>
lea    0xde3(%rip),%rdi
call   10e0 <perror@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    183b <proc_gps_input+0x65b>
mov    -0x8(%rbp),%ecx
mov    -0x10(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
mov    $0xa,%esi
call   1090 <memchr@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
je     1835 <proc_gps_input+0x655>
mov    0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x38(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %eax,%edx
call   10b0 <memcpy@plt>
mov    -0x38(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rdi
lea    0xd87(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    17ad <proc_gps_input+0x5cd>
lea    -0x140(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <strcpy@plt>
lea    -0x140(%rbp),%rdi
lea    -0x1b0(%rbp),%rsi
lea    0xd55(%rip),%rdx
mov    $0xd,%ecx
call   1040 <my_split@plt>
mov    %eax,-0x1c8(%rbp)
cmpl   $0xc,-0x1c8(%rbp)
je     12ed <proc_gps_input+0x10d>
cmpl   $0xd,-0x1c8(%rbp)
jne    1778 <proc_gps_input+0x598>
lea    -0x1dc(%rbp),%rdi
call   1100 <compass_get_heading@plt>
cmp    $0x0,%rax
je     1328 <proc_gps_input+0x148>
lea    -0x1ba(%rbp),%rdi
cvttss2si -0x1dc(%rbp),%ecx
ff
mov    $0xa,%esi
lea    0xcfc(%rip),%rdx
call   1080 <snprintf@plt>
jmp    132f <proc_gps_input+0x14f>
movb   $0x0,-0x1ba(%rbp)
lea    -0x1e0(%rbp),%rdi
call   10d0 <tacho_get_speed@plt>
cmp    $0x0,%rax
je     136a <proc_gps_input+0x18a>
lea    -0x1c4(%rbp),%rdi
cvttss2si -0x1e0(%rbp),%ecx
ff
mov    $0xa,%esi
lea    0xcba(%rip),%rdx
call   1080 <snprintf@plt>
jmp    1371 <proc_gps_input+0x191>
movb   $0x0,-0x1c4(%rbp)
mov    -0x1c8(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x1b0(%rbp,%rax,8),%rdi
ff
mov    $0x2a,%esi
call   1070 <strchr@plt>
mov    %rax,-0x1f0(%rbp)
cmp    $0x0,%rax
je     15bb <proc_gps_input+0x3db>
mov    -0x1f0(%rbp),%rdi
call   1060 <strlen@plt>
cmp    $0x2,%eax
jle    15b6 <proc_gps_input+0x3d6>
mov    -0x1f0(%rbp),%rdi
add    $0x1,%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   10f0 <strtoul@plt>
mov    %eax,-0x1e8(%rbp)
movl   $0x0,-0x1e4(%rbp)
mov    -0x1e4(%rbp),%eax
mov    %eax,-0x1f8(%rbp)
mov    -0x170(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x1f8(%rbp),%eax
cmp    %ecx,%eax
jge    1437 <proc_gps_input+0x257>
mov    -0x170(%rbp),%rax
movslq -0x1e4(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
xor    -0x1e8(%rbp),%eax
mov    %eax,-0x1e8(%rbp)
mov    -0x1e4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1e4(%rbp)
jmp    13dd <proc_gps_input+0x1fd>
movl   $0x0,-0x1e4(%rbp)
mov    -0x1e4(%rbp),%eax
mov    %eax,-0x1fc(%rbp)
lea    -0x1ba(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x1fc(%rbp),%eax
cmp    %ecx,%eax
jge    1498 <proc_gps_input+0x2b8>
movslq -0x1e4(%rbp),%rax
movsbl -0x1ba(%rbp,%rax,1),%eax
ff
xor    -0x1e8(%rbp),%eax
mov    %eax,-0x1e8(%rbp)
mov    -0x1e4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1e4(%rbp)
jmp    1441 <proc_gps_input+0x261>
movsbl -0x1c4(%rbp),%eax
cmp    $0x0,%eax
je     1572 <proc_gps_input+0x392>
movl   $0x0,-0x1e4(%rbp)
mov    -0x1e4(%rbp),%eax
mov    %eax,-0x200(%rbp)
mov    -0x178(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x200(%rbp),%eax
cmp    %ecx,%eax
jge    150c <proc_gps_input+0x32c>
mov    -0x178(%rbp),%rax
movslq -0x1e4(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
xor    -0x1e8(%rbp),%eax
mov    %eax,-0x1e8(%rbp)
mov    -0x1e4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1e4(%rbp)
jmp    14b2 <proc_gps_input+0x2d2>
movl   $0x0,-0x1e4(%rbp)
mov    -0x1e4(%rbp),%eax
mov    %eax,-0x204(%rbp)
lea    -0x1c4(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x204(%rbp),%eax
cmp    %ecx,%eax
jge    156d <proc_gps_input+0x38d>
movslq -0x1e4(%rbp),%rax
movsbl -0x1c4(%rbp,%rax,1),%eax
ff
xor    -0x1e8(%rbp),%eax
mov    %eax,-0x1e8(%rbp)
mov    -0x1e4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1e4(%rbp)
jmp    1516 <proc_gps_input+0x336>
jmp    1572 <proc_gps_input+0x392>
lea    -0x1f3(%rbp),%rdi
mov    -0x1e8(%rbp),%ecx
and    $0xff,%ecx
mov    $0x3,%esi
lea    0xa8e(%rip),%rdx
call   1080 <snprintf@plt>
mov    -0x1f3(%rbp),%cl
mov    -0x1f0(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x1f2(%rbp),%cl
mov    -0x1f0(%rbp),%rax
mov    %cl,0x2(%rax)
jmp    15bb <proc_gps_input+0x3db>
lea    -0x1ba(%rbp),%rax
mov    %rax,-0x170(%rbp)
cmpb   $0x0,-0x1c4(%rbp)
je     15e4 <proc_gps_input+0x404>
lea    -0x1c4(%rbp),%rax
mov    %rax,-0x178(%rbp)
movl   $0x0,-0x1e4(%rbp)
mov    -0x1e4(%rbp),%eax
cmp    -0x1c8(%rbp),%eax
jge    1693 <proc_gps_input+0x4b3>
cmpl   $0x0,-0x1e4(%rbp)
je     1629 <proc_gps_input+0x449>
mov    0x10(%rbp),%rax
movb   $0x2c,(%rax)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,0x10(%rbp)
mov    0x10(%rbp),%rdi
movslq -0x1e4(%rbp),%rax
mov    -0x1b0(%rbp,%rax,8),%rsi
ff
call   1050 <strcpy@plt>
movslq -0x1e4(%rbp),%rax
mov    -0x1b0(%rbp,%rax,8),%rdi
ff
call   1060 <strlen@plt>
add    -0x3c(%rbp),%eax
mov    %eax,-0x3c(%rbp)
movslq -0x1e4(%rbp),%rax
mov    -0x1b0(%rbp,%rax,8),%rdi
ff
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    0x10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,0x10(%rbp)
mov    -0x1e4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1e4(%rbp)
jmp    15ee <proc_gps_input+0x40e>
mov    0x10(%rbp),%rax
movb   $0xa,(%rax)
mov    0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,0x10(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x188(%rbp),%rdi
call   10a0 <to_seconds@plt>
movsd  %xmm0,-0x1d8(%rbp)
ff
mov    -0x198(%rbp),%rdi
call   10a0 <to_seconds@plt>
movsd  %xmm0,-0x1d0(%rbp)
ff
mov    -0x190(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x53,%eax
jne    1711 <proc_gps_input+0x531>
movsd  -0x1d0(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x1d0(%rbp)
ff
mov    -0x180(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x57,%eax
jne    174b <proc_gps_input+0x56b>
movsd  -0x1d8(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x1d8(%rbp)
ff
mov    -0x28(%rbp),%rax
mov    -0x1a8(%rbp),%rdi
mov    -0x168(%rbp),%rsi
movsd  -0x1d8(%rbp),%xmm0
ff
movsd  -0x1d0(%rbp),%xmm1
ff
mov    -0x30(%rbp),%rdx
call   *%rax
jmp    17a8 <proc_gps_input+0x5c8>
mov    -0x38(%rbp),%rcx
mov    -0x20(%rbp),%rax
sub    %rax,%rcx
add    $0x1,%rcx
movslq -0x3c(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
add    0x10(%rbp),%rax
mov    %rax,0x10(%rbp)
jmp    17dd <proc_gps_input+0x5fd>
mov    -0x38(%rbp),%rcx
mov    -0x20(%rbp),%rax
sub    %rax,%rcx
add    $0x1,%rcx
movslq -0x3c(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
add    0x10(%rbp),%rax
mov    %rax,0x10(%rbp)
mov    -0x38(%rbp),%rax
movb   $0xa,(%rax)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
je     1823 <proc_gps_input+0x643>
mov    -0x20(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
sub    -0x40(%rbp),%edx
call   10c0 <memmove@plt>
mov    -0x40(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
sub    %edx,%ecx
mov    %ecx,(%rax)
jmp    1238 <proc_gps_input+0x58>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<proc_gps_input>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1e8,%rsp
mov    %r9,0x68(%rsp)
mov    %r8,0x60(%rsp)
mov    %edi,%edx
test   %edi,%edi
jle    1680 <proc_gps_input+0x4a0>
mov    %rcx,%r13
mov    %rsi,%r12
add    (%rsi),%edx
mov    %edx,(%rsi)
mov    %rcx,%rdi
mov    $0xa,%esi
call   1090 <memchr@plt>
test   %rax,%rax
je     1662 <proc_gps_input+0x482>
mov    %rax,%r15
mov    0x220(%rsp),%rbx
xor    %eax,%eax
mov    %rax,0x8(%rsp)
lea    0xde3(%rip),%r14
mov    %r12,0x58(%rsp)
jmp    1274 <proc_gps_input+0x94>
cs nopw 0x0(%rax,%rax,1)
nop
sub    %ebx,%edx
mov    %edx,(%r12)
mov    %r13,%rdi
mov    $0xa,%esi
call   1090 <memchr@plt>
mov    %rax,%r15
test   %rax,%rax
mov    0x20(%rsp),%rbx
je     1669 <proc_gps_input+0x489>
mov    %r15,%rbp
sub    %r13,%rbp
add    $0x1,%rbp
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %ebp,%edx
call   10b0 <memcpy@plt>
movb   $0x0,(%r15)
mov    %r13,%rdi
mov    %r14,%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     12c0 <proc_gps_input+0xe0>
mov    0x8(%rsp),%rax
add    %ebp,%eax
mov    %rax,0x8(%rsp)
add    %rbp,%rbx
mov    %rbx,0x20(%rsp)
jmp    1630 <proc_gps_input+0x450>
nopl   (%rax)
mov    %rbx,0x20(%rsp)
lea    0xe0(%rsp),%rbx
mov    %rbx,%rdi
mov    %r13,%rsi
call   1050 <strcpy@plt>
mov    %rbx,%rdi
lea    0x70(%rsp),%rsi
lea    0xd41(%rip),%rdx
mov    $0xd,%ecx
call   1040 <my_split@plt>
mov    %rax,0x30(%rsp)
and    $0xfffffffe,%eax
cmp    $0xc,%eax
jne    132e <proc_gps_input+0x14e>
lea    0x40(%rsp),%rdi
call   1100 <compass_get_heading@plt>
test   %rax,%rax
je     1344 <proc_gps_input+0x164>
cvttss2si 0x40(%rsp),%ecx
lea    0x46(%rsp),%rbp
mov    %rbp,%rdi
mov    $0xa,%esi
lea    0xd03(%rip),%rdx
call   1080 <snprintf@plt>
jmp    134e <proc_gps_input+0x16e>
mov    0x8(%rsp),%rax
add    %ebp,%eax
mov    %rax,0x8(%rsp)
add    %rbp,0x20(%rsp)
jmp    1630 <proc_gps_input+0x450>
movb   $0x0,0x46(%rsp)
lea    0x46(%rsp),%rbp
lea    0x16(%rsp),%rbx
mov    0x30(%rsp),%r14
lea    0x3c(%rsp),%rdi
call   10d0 <tacho_get_speed@plt>
test   %rax,%rax
je     1383 <proc_gps_input+0x1a3>
cvttss2si 0x3c(%rsp),%ecx
mov    %rbx,%rdi
mov    $0xa,%esi
lea    0xcae(%rip),%rdx
call   1080 <snprintf@plt>
jmp    1388 <proc_gps_input+0x1a8>
movb   $0x0,0x16(%rsp)
lea    -0x1(%r14),%eax
mov    0x70(%rsp,%rax,8),%rdi
mov    $0x2a,%esi
call   1070 <strchr@plt>
test   %rax,%rax
je     14fc <proc_gps_input+0x31c>
mov    %rax,%rdi
mov    %rax,0x50(%rsp)
call   1060 <strlen@plt>
cmp    $0x3,%eax
mov    0x50(%rsp),%rdi
jl     14fc <proc_gps_input+0x31c>
add    $0x1,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   10f0 <strtoul@plt>
mov    %eax,%r14d
mov    0xb0(%rsp),%rdi
call   1060 <strlen@plt>
test   %eax,%eax
jle    140f <proc_gps_input+0x22f>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    0xb0(%rsp),%rdi
movzbl (%rdi,%rbx,1),%eax
xor    %eax,%r14d
add    $0x1,%rbx
call   1060 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     13f0 <proc_gps_input+0x210>
mov    %rbp,%rdi
call   1060 <strlen@plt>
test   %eax,%eax
jle    143b <proc_gps_input+0x25b>
xor    %ebx,%ebx
nopl   (%rax)
movzbl 0x46(%rsp,%rbx,1),%eax
xor    %eax,%r14d
add    $0x1,%rbx
mov    %rbp,%rdi
call   1060 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1420 <proc_gps_input+0x240>
cmpb   $0x0,0x16(%rsp)
je     14bd <proc_gps_input+0x2dd>
mov    0xa8(%rsp),%rdi
call   1060 <strlen@plt>
test   %eax,%eax
jle    147f <proc_gps_input+0x29f>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    0xa8(%rsp),%rdi
movzbl (%rdi,%rbx,1),%eax
xor    %eax,%r14d
add    $0x1,%rbx
call   1060 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1460 <proc_gps_input+0x280>
lea    0x16(%rsp),%rdi
call   1060 <strlen@plt>
test   %eax,%eax
jle    14bd <proc_gps_input+0x2dd>
xor    %ebx,%ebx
lea    0x16(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl 0x16(%rsp,%rbx,1),%eax
xor    %eax,%r14d
add    $0x1,%rbx
mov    %rbp,%rdi
call   1060 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     14a0 <proc_gps_input+0x2c0>
jmp    14c2 <proc_gps_input+0x2e2>
lea    0x16(%rsp),%rbp
movzbl %r14b,%ecx
lea    0x13(%rsp),%rdi
mov    $0x3,%esi
lea    0xb58(%rip),%rdx
call   1080 <snprintf@plt>
mov    0x13(%rsp),%al
mov    0x50(%rsp),%rcx
mov    %al,0x1(%rcx)
mov    0x14(%rsp),%al
mov    %al,0x2(%rcx)
mov    %rbp,%rbx
mov    0x30(%rsp),%r14
lea    0x46(%rsp),%rbp
mov    %rbp,0xb0(%rsp)
cmpb   $0x0,0x16(%rsp)
je     1513 <proc_gps_input+0x333>
mov    %rbx,0xa8(%rsp)
test   %r14d,%r14d
jle    15a0 <proc_gps_input+0x3c0>
mov    0x70(%rsp),%rsi
mov    0x20(%rsp),%rbp
mov    %rbp,%rdi
call   1050 <strcpy@plt>
mov    0x70(%rsp),%rdi
call   1060 <strlen@plt>
mov    %eax,%r12d
add    0x8(%rsp),%r12d
mov    0x70(%rsp),%rdi
call   1060 <strlen@plt>
movslq %eax,%rbx
add    %rbp,%rbx
cmp    $0x1,%r14d
je     15aa <proc_gps_input+0x3ca>
mov    %r14d,%r14d
mov    $0x1,%ebp
xchg   %ax,%ax
movb   $0x2c,(%rbx)
lea    0x1(%rbx),%rdi
mov    0x70(%rsp,%rbp,8),%rsi
call   1050 <strcpy@plt>
mov    0x70(%rsp,%rbp,8),%rdi
call   1060 <strlen@plt>
add    %eax,%r12d
add    $0x1,%r12d
mov    0x70(%rsp,%rbp,8),%rdi
call   1060 <strlen@plt>
cltq
add    %rax,%rbx
add    $0x1,%rbx
add    $0x1,%rbp
cmp    %rbp,%r14
jne    1560 <proc_gps_input+0x380>
jmp    15aa <proc_gps_input+0x3ca>
mov    0x8(%rsp),%r12
mov    0x20(%rsp),%rbx
movb   $0xa,(%rbx)
mov    0x98(%rsp),%rdi
call   10a0 <to_seconds@plt>
movaps %xmm0,0x20(%rsp)
mov    0x88(%rsp),%rdi
call   10a0 <to_seconds@plt>
movaps %xmm0,%xmm1
mov    0x78(%rsp),%rdi
mov    0x90(%rsp),%rax
cmpb   $0x53,(%rax)
jne    15e8 <proc_gps_input+0x408>
xorps  0xa18(%rip),%xmm1
lea    0xa32(%rip),%r14
mov    0xa0(%rsp),%rax
cmpb   $0x57,(%rax)
movaps 0x20(%rsp),%xmm0
jne    1608 <proc_gps_input+0x428>
xorps  0x9f8(%rip),%xmm0
add    $0x1,%rbx
add    $0x1,%r12d
mov    0xb8(%rsp),%rsi
mov    0x68(%rsp),%rdx
call   *0x60(%rsp)
mov    %r12,0x8(%rsp)
mov    %rbx,0x20(%rsp)
mov    0x58(%rsp),%r12
movb   $0xa,(%r15)
add    $0x1,%r15
mov    %r15d,%ebx
sub    %r13d,%ebx
mov    (%r12),%eax
mov    %ebx,%edx
sub    %ebx,%eax
je     1250 <proc_gps_input+0x70>
mov    %r13,%rdi
mov    %r15,%rsi
mov    %eax,%edx
call   10c0 <memmove@plt>
mov    (%r12),%edx
jmp    1250 <proc_gps_input+0x70>
xor    %eax,%eax
mov    %rax,0x8(%rsp)
mov    0x8(%rsp),%rax
add    $0x1e8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rdx,0x8(%rsp)
lea    0x984(%rip),%rdi
call   10e0 <perror@plt>
jmp    1669 <proc_gps_input+0x489>

LLVM IR (-O0):
@.str = [17 x i8] c"proc_gps_input: \00"
@.str.1 = [7 x i8] c"$GPRMC\00"
@.str.2 = [2 x i8] c",\00"
@.str.3 = [5 x i8] c"%.1f\00"
@.str.4 = [5 x i8] c"%02X\00"
define i32 @proc_gps_input(i32 %0, i32* %1, i32 %2, i8* %3, void (i8*, i8*, double, double, i8*)* %4, i8* %5, i8* %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i8*
%13 = alloca void (i8*, i8*, double, double, i8*)*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i32
%18 = alloca i32
%19 = alloca [256 x i8]
%20 = alloca [13 x i8*]
%21 = alloca [10 x i8]
%22 = alloca [10 x i8]
%23 = alloca i32
%24 = alloca double
%25 = alloca double
%26 = alloca float
%27 = alloca float
%28 = alloca i32
%29 = alloca i32
%30 = alloca i8*
%31 = alloca [3 x i8]
store i32 %0, i32* %9
store i32* %1, i32** %10
store i32 %2, i32* %11
store i8* %3, i8** %12
store void (i8*, i8*, double, double, i8*)* %4, void (i8*, i8*, double, double, i8*)** %13
store i8* %5, i8** %14
store i8* %6, i8** %15
store i32 0, i32* %17
%32 = load i32, i32* %9
%33 = icmp sle i32 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %7
%35 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%36 = load i32, i32* %9
store i32 %36, i32* %8
br label %361
37: ; preds = %7
%38 = load i32, i32* %9
%39 = load i32*, i32** %10
%40 = load i32, i32* %39
%41 = add nsw i32 %40, %38
store i32 %41, i32* %39
br label %42
42: ; preds = %354, %37
%43 = load i8*, i8** %12
%44 = load i32*, i32** %10
%45 = load i32, i32* %44
%46 = call i8* @memchr(i8* %43, i8 signext 10, i32 %45)
store i8* %46, i8** %16
%47 = icmp ne i8* %46, null
br i1 %47, label %48, label %359
48: ; preds = %42
%49 = load i8*, i8** %15
%50 = load i8*, i8** %12
%51 = load i8*, i8** %16
%52 = load i8*, i8** %12
%53 = ptrtoint i8* %51 to i64
%54 = ptrtoint i8* %52 to i64
%55 = sub i64 %53, %54
%56 = add nsw i64 %55, 1
%57 = trunc i64 %56 to i32
%58 = call i32 @memcpy(i8* %49, i8* %50, i32 %57)
%59 = load i8*, i8** %16
store i8 0, i8* %59
%60 = load i8*, i8** %12
%61 = call i64 @strncmp(i8* %60, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
%62 = icmp eq i64 %61, 0
br i1 %62, label %63, label %313
63: ; preds = %48
%64 = getelementptr inbounds [256 x i8], [256 x i8]* %19, i64 0, i64 0
%65 = load i8*, i8** %12
%66 = call i32 @strcpy(i8* %64, i8* %65)
%67 = getelementptr inbounds [256 x i8], [256 x i8]* %19, i64 0, i64 0
%68 = getelementptr inbounds [13 x i8*], [13 x i8*]* %20, i64 0, i64 0
%69 = call i32 @my_split(i8* %67, i8** %68, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 13)
store i32 %69, i32* %23
%70 = load i32, i32* %23
%71 = icmp eq i32 %70, 12
br i1 %71, label %75, label %72
72: ; preds = %63
%73 = load i32, i32* %23
%74 = icmp eq i32 %73, 13
br i1 %74, label %75, label %293
75: ; preds = %72, %63
%76 = call i64 @compass_get_heading(float* %26)
%77 = icmp ne i64 %76, 0
br i1 %77, label %78, label %83
78: ; preds = %75
%79 = getelementptr inbounds [10 x i8], [10 x i8]* %21, i64 0, i64 0
%80 = load float, float* %26
%81 = fptosi float %80 to i32
%82 = call i32 @snprintf(i8* %79, i32 10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %81)
br label %85
83: ; preds = %75
%84 = getelementptr inbounds [10 x i8], [10 x i8]* %21, i64 0, i64 0
store i8 0, i8* %84
br label %85
85: ; preds = %83, %78
%86 = call i64 @tacho_get_speed(float* %27)
%87 = icmp ne i64 %86, 0
br i1 %87, label %88, label %93
88: ; preds = %85
%89 = getelementptr inbounds [10 x i8], [10 x i8]* %22, i64 0, i64 0
%90 = load float, float* %27
%91 = fptosi float %90 to i32
%92 = call i32 @snprintf(i8* %89, i32 10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %91)
br label %95
93: ; preds = %85
%94 = getelementptr inbounds [10 x i8], [10 x i8]* %22, i64 0, i64 0
store i8 0, i8* %94
br label %95
95: ; preds = %93, %88
%96 = load i32, i32* %23
%97 = sub nsw i32 %96, 1
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [13 x i8*], [13 x i8*]* %20, i64 0, i64 %98
%100 = load i8*, i8** %99
%101 = call i8* @strchr(i8* %100, i8 signext 42)
store i8* %101, i8** %30
%102 = icmp ne i8* %101, null
br i1 %102, label %103, label %204
103: ; preds = %95
%104 = load i8*, i8** %30
%105 = call i32 @strlen(i8* %104)
%106 = icmp sgt i32 %105, 2
br i1 %106, label %107, label %203
107: ; preds = %103
%108 = load i8*, i8** %30
%109 = getelementptr inbounds i8, i8* %108, i64 1
%110 = call i32 @strtoul(i8* %109, i32* null, i32 16)
store i32 %110, i32* %29
store i32 0, i32* %28
br label %111
111: ; preds = %127, %107
%112 = load i32, i32* %28
%113 = getelementptr inbounds [13 x i8*], [13 x i8*]* %20, i64 0, i64 8
%114 = load i8*, i8** %113
%115 = call i32 @strlen(i8* %114)
%116 = icmp slt i32 %112, %115
br i1 %116, label %117, label %130
117: ; preds = %111
%118 = getelementptr inbounds [13 x i8*], [13 x i8*]* %20, i64 0, i64 8
%119 = load i8*, i8** %118
%120 = load i32, i32* %28
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds i8, i8* %119, i64 %121
%123 = load i8, i8* %122
%124 = sext i8 %123 to i32
%125 = load i32, i32* %29
%126 = xor i32 %125, %124
store i32 %126, i32* %29
br label %127
127: ; preds = %117
%128 = load i32, i32* %28
%129 = add nsw i32 %128, 1
store i32 %129, i32* %28
br label %111
130: ; preds = %111
store i32 0, i32* %28
br label %131
131: ; preds = %144, %130
%132 = load i32, i32* %28
%133 = getelementptr inbounds [10 x i8], [10 x i8]* %21, i64 0, i64 0
%134 = call i32 @strlen(i8* %133)
%135 = icmp slt i32 %132, %134
br i1 %135, label %136, label %147
136: ; preds = %131
%137 = load i32, i32* %28
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds [10 x i8], [10 x i8]* %21, i64 0, i64 %138
%140 = load i8, i8* %139
%141 = sext i8 %140 to i32
%142 = load i32, i32* %29
%143 = xor i32 %142, %141
store i32 %143, i32* %29
br label %144
144: ; preds = %136
%145 = load i32, i32* %28
%146 = add nsw i32 %145, 1
store i32 %146, i32* %28
br label %131
147: ; preds = %131
%148 = getelementptr inbounds [10 x i8], [10 x i8]* %22, i64 0, i64 0
%149 = load i8, i8* %148
%150 = sext i8 %149 to i32
%151 = icmp ne i32 %150, 0
br i1 %151, label %152, label %190
152: ; preds = %147
store i32 0, i32* %28
br label %153
153: ; preds = %169, %152
%154 = load i32, i32* %28
%155 = getelementptr inbounds [13 x i8*], [13 x i8*]* %20, i64 0, i64 7
%156 = load i8*, i8** %155
%157 = call i32 @strlen(i8* %156)
%158 = icmp slt i32 %154, %157
br i1 %158, label %159, label %172
159: ; preds = %153
%160 = getelementptr inbounds [13 x i8*], [13 x i8*]* %20, i64 0, i64 7
%161 = load i8*, i8** %160
%162 = load i32, i32* %28
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds i8, i8* %161, i64 %163
%165 = load i8, i8* %164
%166 = sext i8 %165 to i32
%167 = load i32, i32* %29
%168 = xor i32 %167, %166
store i32 %168, i32* %29
br label %169
169: ; preds = %159
%170 = load i32, i32* %28
%171 = add nsw i32 %170, 1
store i32 %171, i32* %28
br label %153
172: ; preds = %153
store i32 0, i32* %28
br label %173
173: ; preds = %186, %172
%174 = load i32, i32* %28
%175 = getelementptr inbounds [10 x i8], [10 x i8]* %22, i64 0, i64 0
%176 = call i32 @strlen(i8* %175)
%177 = icmp slt i32 %174, %176
br i1 %177, label %178, label %189
178: ; preds = %173
%179 = load i32, i32* %28
%180 = sext i32 %179 to i64
%181 = getelementptr inbounds [10 x i8], [10 x i8]* %22, i64 0, i64 %180
%182 = load i8, i8* %181
%183 = sext i8 %182 to i32
%184 = load i32, i32* %29
%185 = xor i32 %184, %183
store i32 %185, i32* %29
br label %186
186: ; preds = %178
%187 = load i32, i32* %28
%188 = add nsw i32 %187, 1
store i32 %188, i32* %28
br label %173
189: ; preds = %173
br label %190
190: ; preds = %189, %147
%191 = getelementptr inbounds [3 x i8], [3 x i8]* %31, i64 0, i64 0
%192 = load i32, i32* %29
%193 = and i32 255, %192
%194 = call i32 @snprintf(i8* %191, i32 3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %193)
%195 = getelementptr inbounds [3 x i8], [3 x i8]* %31, i64 0, i64 0
%196 = load i8, i8* %195
%197 = load i8*, i8** %30
%198 = getelementptr inbounds i8, i8* %197, i64 1
store i8 %196, i8* %198
%199 = getelementptr inbounds [3 x i8], [3 x i8]* %31, i64 0, i64 1
%200 = load i8, i8* %199
%201 = load i8*, i8** %30
%202 = getelementptr inbounds i8, i8* %201, i64 2
store i8 %200, i8* %202
br label %203
203: ; preds = %190, %103
br label %204
204: ; preds = %203, %95
%205 = getelementptr inbounds [10 x i8], [10 x i8]* %21, i64 0, i64 0
%206 = getelementptr inbounds [13 x i8*], [13 x i8*]* %20, i64 0, i64 8
store i8* %205, i8** %206
%207 = getelementptr inbounds [10 x i8], [10 x i8]* %22, i64 0, i64 0
%208 = load i8, i8* %207
%209 = icmp ne i8 %208, 0
br i1 %209, label %210, label %213
210: ; preds = %204
%211 = getelementptr inbounds [10 x i8], [10 x i8]* %22, i64 0, i64 0
%212 = getelementptr inbounds [13 x i8*], [13 x i8*]* %20, i64 0, i64 7
store i8* %211, i8** %212
br label %213
213: ; preds = %210, %204
store i32 0, i32* %28
br label %214
214: ; preds = %250, %213
%215 = load i32, i32* %28
%216 = load i32, i32* %23
%217 = icmp slt i32 %215, %216
br i1 %217, label %218, label %253
218: ; preds = %214
%219 = load i32, i32* %28
%220 = icmp ne i32 %219, 0
br i1 %220, label %221, label %228
221: ; preds = %218
%222 = load i8*, i8** %15
%223 = getelementptr inbounds i8, i8* %222, i64 0
store i8 44, i8* %223
%224 = load i32, i32* %17
%225 = add nsw i32 %224, 1
store i32 %225, i32* %17
%226 = load i8*, i8** %15
%227 = getelementptr inbounds i8, i8* %226, i32 1
store i8* %227, i8** %15
br label %228
228: ; preds = %221, %218
%229 = load i8*, i8** %15
%230 = load i32, i32* %28
%231 = sext i32 %230 to i64
%232 = getelementptr inbounds [13 x i8*], [13 x i8*]* %20, i64 0, i64 %231
%233 = load i8*, i8** %232
%234 = call i32 @strcpy(i8* %229, i8* %233)
%235 = load i32, i32* %28
%236 = sext i32 %235 to i64
%237 = getelementptr inbounds [13 x i8*], [13 x i8*]* %20, i64 0, i64 %236
%238 = load i8*, i8** %237
%239 = call i32 @strlen(i8* %238)
%240 = load i32, i32* %17
%241 = add nsw i32 %240, %239
store i32 %241, i32* %17
%242 = load i32, i32* %28
%243 = sext i32 %242 to i64
%244 = getelementptr inbounds [13 x i8*], [13 x i8*]* %20, i64 0, i64 %243
%245 = load i8*, i8** %244
%246 = call i32 @strlen(i8* %245)
%247 = load i8*, i8** %15
%248 = sext i32 %246 to i64
%249 = getelementptr inbounds i8, i8* %247, i64 %248
store i8* %249, i8** %15
br label %250
250: ; preds = %228
%251 = load i32, i32* %28
%252 = add nsw i32 %251, 1
store i32 %252, i32* %28
br label %214
253: ; preds = %214
%254 = load i8*, i8** %15
store i8 10, i8* %254
%255 = load i8*, i8** %15
%256 = getelementptr inbounds i8, i8* %255, i32 1
store i8* %256, i8** %15
%257 = load i32, i32* %17
%258 = add nsw i32 %257, 1
store i32 %258, i32* %17
%259 = getelementptr inbounds [13 x i8*], [13 x i8*]* %20, i64 0, i64 5
%260 = load i8*, i8** %259
%261 = call double @to_seconds(i8* %260)
store double %261, double* %25
%262 = getelementptr inbounds [13 x i8*], [13 x i8*]* %20, i64 0, i64 3
%263 = load i8*, i8** %262
%264 = call double @to_seconds(i8* %263)
store double %264, double* %24
%265 = getelementptr inbounds [13 x i8*], [13 x i8*]* %20, i64 0, i64 4
%266 = load i8*, i8** %265
%267 = getelementptr inbounds i8, i8* %266, i64 0
%268 = load i8, i8* %267
%269 = sext i8 %268 to i32
%270 = icmp eq i32 %269, 83
br i1 %270, label %271, label %274
271: ; preds = %253
%272 = load double, double* %24
%273 = fneg double %272
store double %273, double* %24
br label %274
274: ; preds = %271, %253
%275 = getelementptr inbounds [13 x i8*], [13 x i8*]* %20, i64 0, i64 6
%276 = load i8*, i8** %275
%277 = getelementptr inbounds i8, i8* %276, i64 0
%278 = load i8, i8* %277
%279 = sext i8 %278 to i32
%280 = icmp eq i32 %279, 87
br i1 %280, label %281, label %284
281: ; preds = %274
%282 = load double, double* %25
%283 = fneg double %282
store double %283, double* %25
br label %284
284: ; preds = %281, %274
%285 = load void (i8*, i8*, double, double, i8*)*, void (i8*, i8*, double, double, i8*)** %13
%286 = getelementptr inbounds [13 x i8*], [13 x i8*]* %20, i64 0, i64 1
%287 = load i8*, i8** %286
%288 = getelementptr inbounds [13 x i8*], [13 x i8*]* %20, i64 0, i64 9
%289 = load i8*, i8** %288
%290 = load double, double* %25
%291 = load double, double* %24
%292 = load i8*, i8** %14
br label %312
293: ; preds = %72
%294 = load i8*, i8** %16
%295 = load i8*, i8** %12
%296 = ptrtoint i8* %294 to i64
%297 = ptrtoint i8* %295 to i64
%298 = sub i64 %296, %297
%299 = add nsw i64 %298, 1
%300 = load i32, i32* %17
%301 = sext i32 %300 to i64
%302 = add nsw i64 %301, %299
%303 = trunc i64 %302 to i32
store i32 %303, i32* %17
%304 = load i8*, i8** %16
%305 = load i8*, i8** %12
%306 = ptrtoint i8* %304 to i64
%307 = ptrtoint i8* %305 to i64
%308 = sub i64 %306, %307
%309 = add nsw i64 %308, 1
%310 = load i8*, i8** %15
%311 = getelementptr inbounds i8, i8* %310, i64 %309
store i8* %311, i8** %15
br label %312
312: ; preds = %293, %284
br label %332
313: ; preds = %48
%314 = load i8*, i8** %16
%315 = load i8*, i8** %12
%316 = ptrtoint i8* %314 to i64
%317 = ptrtoint i8* %315 to i64
%318 = sub i64 %316, %317
%319 = add nsw i64 %318, 1
%320 = load i32, i32* %17
%321 = sext i32 %320 to i64
%322 = add nsw i64 %321, %319
%323 = trunc i64 %322 to i32
store i32 %323, i32* %17
%324 = load i8*, i8** %16
%325 = load i8*, i8** %12
%326 = ptrtoint i8* %324 to i64
%327 = ptrtoint i8* %325 to i64
%328 = sub i64 %326, %327
%329 = add nsw i64 %328, 1
%330 = load i8*, i8** %15
%331 = getelementptr inbounds i8, i8* %330, i64 %329
store i8* %331, i8** %15
br label %332
332: ; preds = %313, %312
%333 = load i8*, i8** %16
store i8 10, i8* %333
%334 = load i8*, i8** %16
%335 = getelementptr inbounds i8, i8* %334, i32 1
store i8* %335, i8** %16
%336 = load i8*, i8** %16
%337 = load i8*, i8** %12
%338 = ptrtoint i8* %336 to i64
%339 = ptrtoint i8* %337 to i64
%340 = sub i64 %338, %339
%341 = trunc i64 %340 to i32
store i32 %341, i32* %18
%342 = load i32, i32* %18
%343 = load i32*, i32** %10
%344 = load i32, i32* %343
%345 = icmp ne i32 %342, %344
br i1 %345, label %346, label %354
346: ; preds = %332
%347 = load i8*, i8** %12
%348 = load i8*, i8** %16
%349 = load i32*, i32** %10
%350 = load i32, i32* %349
%351 = load i32, i32* %18
%352 = sub nsw i32 %350, %351
%353 = call i32 @memmove(i8* %347, i8* %348, i32 %352)
br label %354
354: ; preds = %346, %332
%355 = load i32, i32* %18
%356 = load i32*, i32** %10
%357 = load i32, i32* %356
%358 = sub nsw i32 %357, %355
store i32 %358, i32* %356
br label %42
359: ; preds = %42
%360 = load i32, i32* %17
store i32 %360, i32* %8
br label %361
361: ; preds = %359, %34
%362 = load i32, i32* %8
ret i32 %362
}

LLVM IR (-O2):
@.str = [17 x i8] c"proc_gps_input: \00"
@.str.1 = [7 x i8] c"$GPRMC\00"
@.str.2 = [2 x i8] c",\00"
@.str.3 = [5 x i8] c"%.1f\00"
@.str.4 = [5 x i8] c"%02X\00"
define i32 @proc_gps_input(i32 %0, i32* nocapture %1, i32 %2, i8* %3, void (i8*, i8*, double, double, i8*)* nocapture %4, i8* %5, i8* %6) {
%8 = alloca [256 x i8]
%9 = alloca [13 x i8*]
%10 = alloca [10 x i8]
%11 = alloca [10 x i8]
%12 = alloca float
%13 = alloca float
%14 = alloca [3 x i8]
%15 = icmp slt i32 %0, 1
br i1 %15, label %16, label %18
16: ; preds = %7
%17 = tail call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %243
18: ; preds = %7
%19 = load i32, i32* %1
%20 = add nsw i32 %19, %0
store i32 %20, i32* %1
%21 = call i8* @memchr(i8* %3, i8 signext 10, i32 %20)
%22 = icmp eq i8* %21, null
br i1 %22, label %243, label %23
23: ; preds = %18
%24 = ptrtoint i8* %3 to i64
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%26 = bitcast [13 x i8*]* %9 to i8*
%27 = getelementptr inbounds [10 x i8], [10 x i8]* %10, i64 0, i64 0
%28 = getelementptr inbounds [10 x i8], [10 x i8]* %11, i64 0, i64 0
%29 = getelementptr inbounds [13 x i8*], [13 x i8*]* %9, i64 0, i64 0
%30 = bitcast float* %12 to i8*
%31 = bitcast float* %13 to i8*
%32 = getelementptr inbounds [3 x i8], [3 x i8]* %14, i64 0, i64 0
%33 = getelementptr inbounds [13 x i8*], [13 x i8*]* %9, i64 0, i64 8
%34 = getelementptr inbounds [13 x i8*], [13 x i8*]* %9, i64 0, i64 7
%35 = getelementptr inbounds [3 x i8], [3 x i8]* %14, i64 0, i64 1
%36 = getelementptr inbounds [13 x i8*], [13 x i8*]* %9, i64 0, i64 5
%37 = getelementptr inbounds [13 x i8*], [13 x i8*]* %9, i64 0, i64 3
%38 = getelementptr inbounds [13 x i8*], [13 x i8*]* %9, i64 0, i64 4
%39 = getelementptr inbounds [13 x i8*], [13 x i8*]* %9, i64 0, i64 6
%40 = getelementptr inbounds [13 x i8*], [13 x i8*]* %9, i64 0, i64 1
%41 = getelementptr inbounds [13 x i8*], [13 x i8*]* %9, i64 0, i64 9
br label %42
42: ; preds = %23, %238
%43 = phi i8* [ %21, %23 ], [ %241, %238 ]
%44 = phi i8* [ %6, %23 ], [ %227, %238 ]
%45 = phi i32 [ 0, %23 ], [ %226, %238 ]
%46 = ptrtoint i8* %43 to i64
%47 = sub i64 %46, %24
%48 = add nsw i64 %47, 1
%49 = trunc i64 %48 to i32
%50 = call i32 @memcpy(i8* %44, i8* %3, i32 %49)
store i8 0, i8* %43
%51 = call i64 @strncmp(i8* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %222
53: ; preds = %42
%54 = call i32 @strcpy(i8* %25, i8* %3)
%55 = call i32 @my_split(i8* %25, i8** %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 13)
%56 = and i32 %55, -2
%57 = icmp eq i32 %56, 12
br i1 %57, label %58, label %216
58: ; preds = %53
%59 = call i64 @compass_get_heading(float* %12)
%60 = icmp eq i64 %59, 0
br i1 %60, label %65, label %61
61: ; preds = %58
%62 = load float, float* %12
%63 = fptosi float %62 to i32
%64 = call i32 @snprintf(i8* %27, i32 10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %63)
br label %66
65: ; preds = %58
store i8 0, i8* %27
br label %66
66: ; preds = %65, %61
%67 = call i64 @tacho_get_speed(float* %13)
%68 = icmp eq i64 %67, 0
br i1 %68, label %73, label %69
69: ; preds = %66
%70 = load float, float* %13
%71 = fptosi float %70 to i32
%72 = call i32 @snprintf(i8* %28, i32 10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %71)
br label %74
73: ; preds = %66
store i8 0, i8* %28
br label %74
74: ; preds = %73, %69
%75 = add nsw i32 %55, -1
%76 = zext i32 %75 to i64
%77 = getelementptr inbounds [13 x i8*], [13 x i8*]* %9, i64 0, i64 %76
%78 = load i8*, i8** %77
%79 = call i8* @strchr(i8* dereferenceable(1) %78, i8 signext 42)
%80 = icmp eq i8* %79, null
br i1 %80, label %159, label %81
81: ; preds = %74
%82 = call i32 @strlen(i8* %79)
%83 = icmp sgt i32 %82, 2
br i1 %83, label %84, label %159
84: ; preds = %81
%85 = getelementptr inbounds i8, i8* %79, i64 1
%86 = call i32 @strtoul(i8* nocapture %85, i32* null, i32 16)
%87 = load i8*, i8** %33
%88 = call i32 @strlen(i8* %87)
%89 = icmp sgt i32 %88, 0
br i1 %89, label %94, label %90
90: ; preds = %94, %84
%91 = phi i32 [ %86, %84 ], [ %101, %94 ]
%92 = call i32 @strlen(i8* %27)
%93 = icmp sgt i32 %92, 0
br i1 %93, label %106, label %117
94: ; preds = %84, %94
%95 = phi i64 [ %102, %94 ], [ 0, %84 ]
%96 = phi i32 [ %101, %94 ], [ %86, %84 ]
%97 = load i8*, i8** %33
%98 = getelementptr inbounds i8, i8* %97, i64 %95
%99 = load i8, i8* %98
%100 = zext i8 %99 to i32
%101 = xor i32 %96, %100
%102 = add nuw nsw i64 %95, 1
%103 = call i32 @strlen(i8* %97)
%104 = sext i32 %103 to i64
%105 = icmp slt i64 %102, %104
br i1 %105, label %94, label %90
106: ; preds = %90, %106
%107 = phi i64 [ %113, %106 ], [ 0, %90 ]
%108 = phi i32 [ %112, %106 ], [ %91, %90 ]
%109 = getelementptr inbounds [10 x i8], [10 x i8]* %10, i64 0, i64 %107
%110 = load i8, i8* %109
%111 = zext i8 %110 to i32
%112 = xor i32 %108, %111
%113 = add nuw nsw i64 %107, 1
%114 = call i32 @strlen(i8* %27)
%115 = sext i32 %114 to i64
%116 = icmp slt i64 %113, %115
br i1 %116, label %106, label %117
117: ; preds = %106, %90
%118 = phi i32 [ %91, %90 ], [ %112, %106 ]
%119 = load i8, i8* %28
%120 = icmp eq i8 %119, 0
br i1 %120, label %152, label %121
121: ; preds = %117
%122 = load i8*, i8** %34
%123 = call i32 @strlen(i8* %122)
%124 = icmp sgt i32 %123, 0
br i1 %124, label %129, label %125
125: ; preds = %129, %121
%126 = phi i32 [ %118, %121 ], [ %136, %129 ]
%127 = call i32 @strlen(i8* %28)
%128 = icmp sgt i32 %127, 0
br i1 %128, label %141, label %152
129: ; preds = %121, %129
%130 = phi i64 [ %137, %129 ], [ 0, %121 ]
%131 = phi i32 [ %136, %129 ], [ %118, %121 ]
%132 = load i8*, i8** %34
%133 = getelementptr inbounds i8, i8* %132, i64 %130
%134 = load i8, i8* %133
%135 = zext i8 %134 to i32
%136 = xor i32 %131, %135
%137 = add nuw nsw i64 %130, 1
%138 = call i32 @strlen(i8* %132)
%139 = sext i32 %138 to i64
%140 = icmp slt i64 %137, %139
br i1 %140, label %129, label %125
141: ; preds = %125, %141
%142 = phi i64 [ %148, %141 ], [ 0, %125 ]
%143 = phi i32 [ %147, %141 ], [ %126, %125 ]
%144 = getelementptr inbounds [10 x i8], [10 x i8]* %11, i64 0, i64 %142
%145 = load i8, i8* %144
%146 = zext i8 %145 to i32
%147 = xor i32 %143, %146
%148 = add nuw nsw i64 %142, 1
%149 = call i32 @strlen(i8* %28)
%150 = sext i32 %149 to i64
%151 = icmp slt i64 %148, %150
br i1 %151, label %141, label %152
152: ; preds = %141, %125, %117
%153 = phi i32 [ %118, %117 ], [ %126, %125 ], [ %147, %141 ]
%154 = and i32 %153, 255
%155 = call i32 @snprintf(i8* %32, i32 3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %154)
%156 = load i8, i8* %32
store i8 %156, i8* %85
%157 = load i8, i8* %35
%158 = getelementptr inbounds i8, i8* %79, i64 2
store i8 %157, i8* %158
br label %159
159: ; preds = %81, %152, %74
store i8* %27, i8** %33
%160 = load i8, i8* %28
%161 = icmp eq i8 %160, 0
br i1 %161, label %163, label %162
162: ; preds = %159
store i8* %28, i8** %34
br label %163
163: ; preds = %162, %159
%164 = icmp sgt i32 %55, 0
br i1 %164, label %165, label %195
165: ; preds = %163
%166 = zext i32 %55 to i64
%167 = load i8*, i8** %29
%168 = call i32 @strcpy(i8* %44, i8* %167)
%169 = load i8*, i8** %29
%170 = call i32 @strlen(i8* %169)
%171 = add nsw i32 %170, %45
%172 = load i8*, i8** %29
%173 = call i32 @strlen(i8* %172)
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds i8, i8* %44, i64 %174
%176 = icmp eq i32 %55, 1
br i1 %176, label %195, label %177
177: ; preds = %165, %177
%178 = phi i64 [ %193, %177 ], [ 1, %165 ]
%179 = phi i8* [ %192, %177 ], [ %175, %165 ]
%180 = phi i32 [ %188, %177 ], [ %171, %165 ]
store i8 44, i8* %179
%181 = add nsw i32 %180, 1
%182 = getelementptr inbounds i8, i8* %179, i64 1
%183 = getelementptr inbounds [13 x i8*], [13 x i8*]* %9, i64 0, i64 %178
%184 = load i8*, i8** %183
%185 = call i32 @strcpy(i8* %182, i8* %184)
%186 = load i8*, i8** %183
%187 = call i32 @strlen(i8* %186)
%188 = add nsw i32 %187, %181
%189 = load i8*, i8** %183
%190 = call i32 @strlen(i8* %189)
%191 = sext i32 %190 to i64
%192 = getelementptr inbounds i8, i8* %182, i64 %191
%193 = add nuw nsw i64 %178, 1
%194 = icmp eq i64 %193, %166
br i1 %194, label %195, label %177
195: ; preds = %177, %165, %163
%196 = phi i32 [ %45, %163 ], [ %171, %165 ], [ %188, %177 ]
%197 = phi i8* [ %44, %163 ], [ %175, %165 ], [ %192, %177 ]
store i8 10, i8* %197
%198 = getelementptr inbounds i8, i8* %197, i64 1
%199 = add nsw i32 %196, 1
%200 = load i8*, i8** %36
%201 = call double @to_seconds(i8* %200)
%202 = load i8*, i8** %37
%203 = call double @to_seconds(i8* %202)
%204 = load i8*, i8** %38
%205 = load i8, i8* %204
%206 = icmp eq i8 %205, 83
%207 = fneg double %203
%208 = select i1 %206, double %207, double %203
%209 = load i8*, i8** %39
%210 = load i8, i8* %209
%211 = icmp eq i8 %210, 87
%212 = fneg double %201
%213 = select i1 %211, double %212, double %201
%214 = load i8*, i8** %40
%215 = load i8*, i8** %41
br label %219
216: ; preds = %53
%217 = add i32 %45, %49
%218 = getelementptr inbounds i8, i8* %44, i64 %48
br label %219
219: ; preds = %216, %195
%220 = phi i32 [ %199, %195 ], [ %217, %216 ]
%221 = phi i8* [ %198, %195 ], [ %218, %216 ]
br label %225
222: ; preds = %42
%223 = add i32 %45, %49
%224 = getelementptr inbounds i8, i8* %44, i64 %48
br label %225
225: ; preds = %222, %219
%226 = phi i32 [ %220, %219 ], [ %223, %222 ]
%227 = phi i8* [ %221, %219 ], [ %224, %222 ]
store i8 10, i8* %43
%228 = getelementptr inbounds i8, i8* %43, i64 1
%229 = ptrtoint i8* %228 to i64
%230 = sub i64 %229, %24
%231 = trunc i64 %230 to i32
%232 = load i32, i32* %1
%233 = icmp eq i32 %232, %231
br i1 %233, label %238, label %234
234: ; preds = %225
%235 = sub nsw i32 %232, %231
%236 = call i32 @memmove(i8* %3, i8* %228, i32 %235)
%237 = load i32, i32* %1
br label %238
238: ; preds = %234, %225
%239 = phi i32 [ %237, %234 ], [ %231, %225 ]
%240 = sub nsw i32 %239, %231
store i32 %240, i32* %1
%241 = call i8* @memchr(i8* %3, i8 signext 10, i32 %240)
%242 = icmp eq i8* %241, null
br i1 %242, label %243, label %42
243: ; preds = %238, %18, %16
%244 = phi i32 [ %0, %16 ], [ 0, %18 ], [ %226, %238 ]
ret i32 %244
}