#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
struct timeval {
  int /*<<< orphan*/ tv_usec;
  int /*<<< orphan*/ tv_sec;
};
struct can_frame {
  int can_id;
  int can_dlc;
  int *data;
};
typedef int /*<<< orphan*/ cf;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int CAN_ERR_BUSERROR;
int CAN_ERR_DLC;
int CAN_ERR_FLAG;
int CAN_RTR_FLAG;
int /*<<< orphan*/ basename(char *);
int /*<<< orphan*/ calc_tv(struct timeval *, struct timeval *, struct timeval *,
                           char, int);
int /*<<< orphan*/ ctime(int /*<<< orphan*/ *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(int /*<<< orphan*/, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ get_can_id(struct can_frame *, char *, int);
scalar_t__ get_date(struct timeval *, char *);
int getopt(int, char **, char *);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(struct can_frame *, int /*<<< orphan*/, int);
int /*<<< orphan*/ optarg;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ prframe(int /*<<< orphan*/ *, struct timeval *, int,
                           struct can_frame *);
int /*<<< orphan*/ print_usage(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int sscanf(char *, char *, char *, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ *stdout;
int strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
int main(int argc, char **argv) {
  char buf[100], tmp1[100], tmp2[100];
  FILE *infile = stdin;
  FILE *outfile = stdout;
  static int verbose;
  struct can_frame cf;
  static struct timeval tv;
  static struct timeval read_tv;
  static struct timeval date_tv;
  static int dplace;
  static char base;
  static char timestamps;
  int interface;
  char rtr;
  int dlc = 0;
  int data[8];
  int i, found, opt;
  while ((opt = getopt(argc, argv, "I:O:v?")) != -1) {
    switch (opt) {
    case 'I':
      infile = fopen(optarg, "r");
      if (!infile) {
        perror("infile");
        return 1;
      }
      break;
    case 'O':
      outfile = fopen(optarg, "w");
      if (!outfile) {
        perror("outfile");
        return 1;
      }
      break;
    case 'v':
      verbose = 1;
      break;
    case '?':
      print_usage(basename(argv[0]));
      return 0;
      break;
    default:
      fprintf(stderr, "Unknown option %c\n", opt);
      print_usage(basename(argv[0]));
      return 1;
      break;
    }
  }
  while (fgets(buf, 99, infile)) {
    if (!dplace) {
      if ((!base) && (sscanf(buf, "base %s timestamps %s", tmp1, tmp2) == 2)) {
        base = tmp1[0];
        timestamps = tmp2[0];
        if (verbose)
          printf("base %c timestamps %c\n", base, timestamps);
        if ((base != 'h') && (base != 'd')) {
          printf("invalid base %s (must be 'hex' or 'dez')!\n", tmp1);
          return 1;
        }
        if ((timestamps != 'a') && (timestamps != 'r')) {
          printf("invalid timestamps %s (must be 'absolute'"
                 " or 'relative')!\n",
                 tmp2);
          return 1;
        }
        continue;
      }
      if ((!date_tv.tv_sec) && (!strncmp(buf, "date", 4))) {
        if (get_date(&date_tv, &buf[9])) {
          fprintf(stderr, "Not able to determine original log "
                          "file date. Using current time.\n");
          gettimeofday(&date_tv, NULL);
        }
        if (verbose)
          printf("date %ld => %s", date_tv.tv_sec, ctime(&date_tv.tv_sec));
        continue;
      }
      if (sscanf(buf, "%ld.%s %d ", &tv.tv_sec, tmp2, &i) == 3) {
        dplace = strlen(tmp2);
        if (verbose)
          printf("decimal place %d, e.g. '%s'\n", dplace, tmp2);
        if (dplace < 4 || dplace > 6) {
          printf("invalid dplace %d (must be 4, 5 or 6)!\n", dplace);
          return 1;
        }
      } else
        continue;
    }
    found = 0;
    if (base == 'h') {
      if (sscanf(buf, "%ld.%ld %d %s %*s %c %d %x %x %x %x %x %x %x %x",
                 &read_tv.tv_sec, &read_tv.tv_usec, &interface, tmp1, &rtr,
                 &dlc, &data[0], &data[1], &data[2], &data[3], &data[4],
                 &data[5], &data[6], &data[7]) == dlc + 6) {
        found = 1;
        get_can_id(&cf, tmp1, 16);
      }
    } else {
      if (sscanf(buf, "%ld.%ld %d %s %*s %c %d %d %d %d %d %d %d %d %d",
                 &read_tv.tv_sec, &read_tv.tv_usec, &interface, tmp1, &rtr,
                 &dlc, &data[0], &data[1], &data[2], &data[3], &data[4],
                 &data[5], &data[6], &data[7]) == dlc + 6) {
        found = 1;
        get_can_id(&cf, tmp1, 10);
      }
    }
    if (found) {
      if (rtr == 'r')
        cf.can_id |= CAN_RTR_FLAG;
      cf.can_dlc = dlc & 0x0FU;
      for (i = 0; i < dlc; i++)
        cf.data[i] = data[i] & 0xFFU;
      calc_tv(&tv, &read_tv, &date_tv, timestamps, dplace);
      prframe(outfile, &tv, interface, &cf);
      fflush(outfile);
      continue;
    }
    if (sscanf(buf, "%ld.%ld %d %s", &read_tv.tv_sec, &read_tv.tv_usec,
               &interface, tmp1) == 4) {
      if (!strncmp(tmp1, "ErrorFrame", strlen("ErrorFrame"))) {
        memset(&cf, 0, sizeof(cf));
        cf.can_id = (CAN_ERR_FLAG | CAN_ERR_BUSERROR);
        cf.can_dlc = CAN_ERR_DLC;
        calc_tv(&tv, &read_tv, &date_tv, timestamps, dplace);
        prframe(outfile, &tv, interface, &cf);
        fflush(outfile);
      }
    }
  }
  fclose(outfile);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x248,%rsp
movl   $0x0,-0x2c(%rbp)
mov    %edi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
mov    0x2d67(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x188(%rbp)
mov    0x2d2e(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x190(%rbp)
movl   $0x0,-0x1ac(%rbp)
mov    -0x30(%rbp),%edi
mov    -0x38(%rbp),%rsi
lea    0xd64(%rip),%rdx
call   1140 <getopt@plt>
mov    %eax,-0x1dc(%rbp)
cmp    $0xffffffff,%eax
je     1403 <main+0x1c3>
mov    -0x1dc(%rbp),%eax
mov    %eax,-0x1e0(%rbp)
sub    $0x3f,%eax
je     13a3 <main+0x163>
jmp    12ca <main+0x8a>
mov    -0x1e0(%rbp),%eax
sub    $0x49,%eax
je     1306 <main+0xc6>
jmp    12de <main+0x9e>
mov    -0x1e0(%rbp),%eax
sub    $0x4f,%eax
je     134d <main+0x10d>
jmp    12f2 <main+0xb2>
mov    -0x1e0(%rbp),%eax
sub    $0x76,%eax
je     1394 <main+0x154>
jmp    13c2 <main+0x182>
mov    0x2ceb(%rip),%rax
mov    (%rax),%edi
lea    0xcf1(%rip),%rsi
call   1120 <fopen@plt>
mov    %rax,-0x188(%rbp)
cmpq   $0x0,-0x188(%rbp)
jne    1348 <main+0x108>
lea    0xcd2(%rip),%rdi
call   1130 <perror@plt>
movl   $0x1,-0x2c(%rbp)
jmp    1b22 <main+0x8e2>
jmp    13fe <main+0x1be>
mov    0x2ca4(%rip),%rax
mov    (%rax),%edi
lea    0xcb3(%rip),%rsi
call   1120 <fopen@plt>
mov    %rax,-0x190(%rbp)
cmpq   $0x0,-0x190(%rbp)
jne    138f <main+0x14f>
lea    0xc94(%rip),%rdi
call   1130 <perror@plt>
movl   $0x1,-0x2c(%rbp)
jmp    1b22 <main+0x8e2>
jmp    13fe <main+0x1be>
movl   $0x1,0x2d3a(%rip)
jmp    13fe <main+0x1be>
mov    -0x38(%rbp),%rax
mov    (%rax),%rdi
call   10d0 <basename@plt>
mov    %eax,%edi
call   1150 <print_usage@plt>
movl   $0x0,-0x2c(%rbp)
jmp    1b22 <main+0x8e2>
mov    0x2bf7(%rip),%rax
mov    (%rax),%edi
mov    -0x1dc(%rbp),%edx
lea    0xc42(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    -0x38(%rbp),%rax
mov    (%rax),%rdi
call   10d0 <basename@plt>
mov    %eax,%edi
call   1150 <print_usage@plt>
movl   $0x1,-0x2c(%rbp)
jmp    1b22 <main+0x8e2>
jmp    128e <main+0x4e>
jmp    1408 <main+0x1c8>
lea    -0xa0(%rbp),%rdi
mov    -0x188(%rbp),%rdx
mov    $0x63,%esi
call   10b0 <fgets@plt>
cmp    $0x0,%rax
je     1b0f <main+0x8cf>
cmpl   $0x0,0x2cc3(%rip)
jne    16ac <main+0x46c>
cmpb   $0x0,0x2cba(%rip)
jne    1538 <main+0x2f8>
lea    -0xa0(%rbp),%rdi
lea    -0x110(%rbp),%rdx
lea    -0x180(%rbp),%rcx
lea    0xbcd(%rip),%rsi
mov    $0x0,%al
call   1100 <sscanf@plt>
cmp    $0x2,%eax
jne    1538 <main+0x2f8>
mov    -0x110(%rbp),%al
mov    %al,0x2c7c(%rip)
mov    -0x180(%rbp),%al
mov    %al,0x2c71(%rip)
cmpl   $0x0,0x2c49(%rip)
je     14b1 <main+0x271>
movsbl 0x2c5c(%rip),%esi
movsbl 0x2c56(%rip),%edx
lea    0xb99(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movsbl 0x2c40(%rip),%eax
cmp    $0x68,%eax
je     14f2 <main+0x2b2>
movsbl 0x2c30(%rip),%eax
cmp    $0x64,%eax
je     14f2 <main+0x2b2>
lea    -0x110(%rbp),%rsi
lea    0xb7b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x2c(%rbp)
jmp    1b22 <main+0x8e2>
movsbl 0x2c00(%rip),%eax
cmp    $0x61,%eax
je     1533 <main+0x2f3>
movsbl 0x2bf0(%rip),%eax
cmp    $0x72,%eax
je     1533 <main+0x2f3>
lea    -0x180(%rbp),%rsi
lea    0xb65(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x2c(%rbp)
jmp    1b22 <main+0x8e2>
jmp    1408 <main+0x1c8>
cmpl   $0x0,0x2bb1(%rip)
jne    15f2 <main+0x3b2>
lea    -0xa0(%rbp),%rdi
lea    0xb6d(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    15f2 <main+0x3b2>
lea    -0xa0(%rbp),%rsi
add    $0x9,%rsi
lea    0x2b74(%rip),%rdi
call   1160 <get_date@plt>
cmp    $0x0,%rax
je     15ae <main+0x36e>
mov    0x2a32(%rip),%rax
mov    (%rax),%edi
lea    0xb2e(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
lea    0x2b47(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1080 <gettimeofday@plt>
cmpl   $0x0,0x2b23(%rip)
je     15ed <main+0x3ad>
mov    0x2b2f(%rip),%eax
mov    %eax,-0x1e4(%rbp)
lea    0x2b1e(%rip),%rdi
add    $0x4,%rdi
call   1050 <ctime@plt>
mov    -0x1e4(%rbp),%esi
mov    %eax,%edx
lea    0xb22(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1408 <main+0x1c8>
lea    -0xa0(%rbp),%rdi
lea    -0x180(%rbp),%rcx
lea    0xb10(%rip),%rsi
lea    0x2ace(%rip),%rdx
add    $0x4,%rdx
lea    -0x1d4(%rbp),%r8
mov    $0x0,%al
call   1100 <sscanf@plt>
cmp    $0x3,%eax
jne    16a2 <main+0x462>
lea    -0x180(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,0x2ab9(%rip)
cmpl   $0x0,0x2a96(%rip)
je     1663 <main+0x423>
mov    0x2aa6(%rip),%esi
lea    -0x180(%rbp),%rdx
lea    0xac6(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
cmpl   $0x4,0x2a8a(%rip)
jl     167d <main+0x43d>
cmpl   $0x6,0x2a7d(%rip)
jle    169d <main+0x45d>
mov    0x2a71(%rip),%esi
lea    0xab5(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x2c(%rbp)
jmp    1b22 <main+0x8e2>
jmp    16a7 <main+0x467>
jmp    1408 <main+0x1c8>
jmp    16ac <main+0x46c>
movl   $0x0,-0x1d8(%rbp)
movsbl 0x2a3b(%rip),%eax
cmp    $0x68,%eax
jne    17ec <main+0x5ac>
lea    -0xa0(%rbp),%rdi
lea    -0x110(%rbp),%r9
lea    -0x1d0(%rbp),%r13
lea    -0x1d0(%rbp),%r12
add    $0x4,%r12
lea    -0x1d0(%rbp),%r15
add    $0x8,%r15
lea    -0x1d0(%rbp),%r14
add    $0xc,%r14
lea    -0x1d0(%rbp),%rbx
add    $0x10,%rbx
lea    -0x1d0(%rbp),%r11
add    $0x14,%r11
lea    -0x1d0(%rbp),%r10
add    $0x18,%r10
lea    -0x1d0(%rbp),%rax
add    $0x1c,%rax
mov    %rax,-0x1f0(%rbp)
lea    0xa31(%rip),%rsi
lea    0x29a7(%rip),%rcx
mov    %rcx,%rdx
add    $0x4,%rdx
lea    -0x1a4(%rbp),%r8
lea    -0x1a5(%rbp),%rax
mov    %rax,-0x200(%rbp)
lea    -0x1ac(%rbp),%rax
mov    %rax,-0x1f8(%rbp)
mov    -0x200(%rbp),%rax
mov    %rax,(%rsp)
mov    -0x1f8(%rbp),%rax
mov    %rax,0x8(%rsp)
mov    -0x1f0(%rbp),%rax
mov    %r13,0x10(%rsp)
mov    %r12,0x18(%rsp)
mov    %r15,0x20(%rsp)
mov    %r14,0x28(%rsp)
mov    %rbx,0x30(%rsp)
mov    %r11,0x38(%rsp)
mov    %r10,0x40(%rsp)
mov    %rax,0x48(%rsp)
mov    $0x0,%al
call   1100 <sscanf@plt>
mov    -0x1ac(%rbp),%ecx
add    $0x6,%ecx
cmp    %ecx,%eax
jne    17e7 <main+0x5a7>
movl   $0x1,-0x1d8(%rbp)
lea    -0x110(%rbp),%rsi
lea    -0x1a0(%rbp),%rdi
mov    $0x10,%edx
call   10f0 <get_can_id@plt>
jmp    1912 <main+0x6d2>
lea    -0xa0(%rbp),%rdi
lea    -0x110(%rbp),%r9
lea    -0x1d0(%rbp),%r13
lea    -0x1d0(%rbp),%r12
add    $0x4,%r12
lea    -0x1d0(%rbp),%r15
add    $0x8,%r15
lea    -0x1d0(%rbp),%r14
add    $0xc,%r14
lea    -0x1d0(%rbp),%rbx
add    $0x10,%rbx
lea    -0x1d0(%rbp),%r11
add    $0x14,%r11
lea    -0x1d0(%rbp),%r10
add    $0x18,%r10
lea    -0x1d0(%rbp),%rax
add    $0x1c,%rax
mov    %rax,-0x208(%rbp)
lea    0x93b(%rip),%rsi
lea    0x2881(%rip),%rcx
mov    %rcx,%rdx
add    $0x4,%rdx
lea    -0x1a4(%rbp),%r8
lea    -0x1a5(%rbp),%rax
mov    %rax,-0x218(%rbp)
lea    -0x1ac(%rbp),%rax
mov    %rax,-0x210(%rbp)
mov    -0x218(%rbp),%rax
mov    %rax,(%rsp)
mov    -0x210(%rbp),%rax
mov    %rax,0x8(%rsp)
mov    -0x208(%rbp),%rax
mov    %r13,0x10(%rsp)
mov    %r12,0x18(%rsp)
mov    %r15,0x20(%rsp)
mov    %r14,0x28(%rsp)
mov    %rbx,0x30(%rsp)
mov    %r11,0x38(%rsp)
mov    %r10,0x40(%rsp)
mov    %rax,0x48(%rsp)
mov    $0x0,%al
call   1100 <sscanf@plt>
mov    -0x1ac(%rbp),%ecx
add    $0x6,%ecx
cmp    %ecx,%eax
jne    190d <main+0x6cd>
movl   $0x1,-0x1d8(%rbp)
lea    -0x110(%rbp),%rsi
lea    -0x1a0(%rbp),%rdi
mov    $0xa,%edx
call   10f0 <get_can_id@plt>
jmp    1912 <main+0x6d2>
cmpl   $0x0,-0x1d8(%rbp)
je     1a03 <main+0x7c3>
movsbl -0x1a5(%rbp),%eax
cmp    $0x72,%eax
jne    1944 <main+0x704>
mov    0x267a(%rip),%rax
mov    (%rax),%eax
or     -0x1a0(%rbp),%eax
mov    %eax,-0x1a0(%rbp)
mov    -0x1ac(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0x19c(%rbp)
movl   $0x0,-0x1d4(%rbp)
mov    -0x1d4(%rbp),%eax
cmp    -0x1ac(%rbp),%eax
jge    19a8 <main+0x768>
movslq -0x1d4(%rbp),%rax
mov    -0x1d0(%rbp,%rax,4),%edx
and    $0xff,%edx
mov    -0x198(%rbp),%rax
movslq -0x1d4(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1d4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1d4(%rbp)
jmp    195d <main+0x71d>
mov    0x274b(%rip),%al
mov    0x273f(%rip),%r8d
lea    0x2720(%rip),%rdi
lea    0x2721(%rip),%rsi
lea    0x2722(%rip),%rdx
movsbl %al,%ecx
call   1090 <calc_tv@plt>
mov    -0x190(%rbp),%rdi
mov    -0x1a4(%rbp),%edx
lea    0x26f6(%rip),%rsi
lea    -0x1a0(%rbp),%rcx
call   1110 <prframe@plt>
mov    -0x190(%rbp),%rdi
call   10e0 <fflush@plt>
jmp    1408 <main+0x1c8>
lea    -0xa0(%rbp),%rdi
lea    -0x110(%rbp),%r9
lea    0x7af(%rip),%rsi
lea    0x26c5(%rip),%rcx
mov    %rcx,%rdx
add    $0x4,%rdx
lea    -0x1a4(%rbp),%r8
mov    $0x0,%al
call   1100 <sscanf@plt>
cmp    $0x4,%eax
jne    1b0a <main+0x8ca>
lea    -0x110(%rbp),%rax
mov    %rax,-0x220(%rbp)
lea    0x783(%rip),%rdi
call   1060 <strlen@plt>
mov    -0x220(%rbp),%rdi
mov    %eax,%edx
lea    0x76e(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1b05 <main+0x8c5>
lea    -0x1a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   10a0 <memset@plt>
mov    0x2549(%rip),%rax
mov    (%rax),%eax
mov    0x2520(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x1a0(%rbp)
mov    0x2549(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x19c(%rbp)
mov    0x2644(%rip),%al
mov    0x2638(%rip),%r8d
lea    0x2619(%rip),%rdi
lea    0x261a(%rip),%rsi
lea    0x261b(%rip),%rdx
movsbl %al,%ecx
call   1090 <calc_tv@plt>
mov    -0x190(%rbp),%rdi
mov    -0x1a4(%rbp),%edx
lea    0x25ef(%rip),%rsi
lea    -0x1a0(%rbp),%rcx
call   1110 <prframe@plt>
mov    -0x190(%rbp),%rdi
call   10e0 <fflush@plt>
jmp    1b0a <main+0x8ca>
jmp    1408 <main+0x1c8>
mov    -0x190(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x248,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x198,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2d73(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x10(%rsp)
mov    0x2d3c(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x18(%rsp)
movl   $0x0,0x4(%rsp)
lea    0xd7d(%rip),%r15
mov    0x2d6e(%rip),%r12
lea    0xd76(%rip),%r14
lea    0xd78(%rip),%r13
jmp    12a7 <main+0x67>
nopw   0x0(%rax,%rax,1)
movb   $0x1,0x2e31(%rip)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1140 <getopt@plt>
cmp    $0x76,%eax
je     12a0 <main+0x60>
cmp    $0x48,%eax
jle    130e <main+0xce>
cmp    $0x49,%eax
je     12e7 <main+0xa7>
cmp    $0x4f,%eax
jne    181a <main+0x5da>
mov    (%r12),%edi
mov    %r13,%rsi
call   1120 <fopen@plt>
mov    %rax,0x18(%rsp)
test   %rax,%rax
jne    12a7 <main+0x67>
jmp    189f <main+0x65f>
mov    (%r12),%edi
mov    %r14,%rsi
call   1120 <fopen@plt>
mov    %rax,0x10(%rsp)
test   %rax,%rax
jne    12a7 <main+0x67>
lea    0xd05(%rip),%rdi
call   1130 <perror@plt>
jmp    1842 <main+0x602>
cmp    $0xffffffff,%eax
je     1330 <main+0xf0>
cmp    $0x3f,%eax
jne    181a <main+0x5da>
mov    (%rbx),%rdi
call   10d0 <basename@plt>
mov    %eax,%edi
call   1150 <print_usage@plt>
jmp    1853 <main+0x613>
lea    0x130(%rsp),%rdi
mov    $0x63,%esi
mov    0x10(%rsp),%rbp
mov    %rbp,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
je     1849 <main+0x609>
lea    0x130(%rsp),%r13
lea    0x50(%rsp),%rbx
lea    0x2d81(%rip),%r15
lea    0x8(%rsp),%r8
mov    %rbp,0x10(%rsp)
jmp    13f2 <main+0x1b2>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl 0x2d72(%rip),%ecx
mov    0x2d66(%rip),%r8d
lea    0x2d47(%rip),%rbp
mov    %rbp,%rdi
lea    0x2d4d(%rip),%rdx
call   1090 <calc_tv@plt>
mov    0x8(%rsp),%edx
mov    0x18(%rsp),%rbx
mov    %rbx,%rdi
mov    %rbp,%rsi
lea    0x40(%rsp),%rcx
call   1110 <prframe@plt>
mov    %rbx,%rdi
call   10e0 <fflush@plt>
mov    0x10(%rsp),%rbp
mov    %r15,%rbx
mov    %r13,%rdi
mov    $0x63,%esi
mov    %rbp,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
lea    0x2d01(%rip),%r15
lea    0x8(%rsp),%r8
je     1849 <main+0x609>
cmpl   $0x0,0x2cfb(%rip)
je     1680 <main+0x440>
cmpb   $0x68,0x2cf2(%rip)
jne    1570 <main+0x330>
mov    %r13,%rdi
lea    0xd51(%rip),%rsi
mov    %r15,%rdx
lea    0x2cc4(%rip),%r12
mov    %r12,%rcx
mov    %r13,%rbx
mov    %r8,%r13
lea    0xc0(%rsp),%r14
mov    %r14,%r9
xor    %eax,%eax
lea    0x3c(%rsp),%rbp
push   %rbp
lea    0x40(%rsp),%rbp
push   %rbp
lea    0x44(%rsp),%rbp
push   %rbp
lea    0x48(%rsp),%rbp
push   %rbp
lea    0x4c(%rsp),%rbp
push   %rbp
lea    0x50(%rsp),%rbp
push   %rbp
lea    0x54(%rsp),%rbp
push   %rbp
lea    0x58(%rsp),%rbp
push   %rbp
lea    0x44(%rsp),%rbp
push   %rbp
lea    0x4b(%rsp),%rbp
push   %rbp
call   1100 <sscanf@plt>
add    $0x50,%rsp
mov    0x4(%rsp),%ecx
add    $0x6,%ecx
mov    $0x10,%edx
cmp    %ecx,%eax
je     15f3 <main+0x3b3>
mov    %rbx,%rdi
lea    0xd2e(%rip),%rsi
mov    %r15,%rdx
mov    %r12,%rcx
mov    %r13,%r8
mov    %r14,%r9
xor    %eax,%eax
call   1100 <sscanf@plt>
cmp    $0x4,%eax
lea    0x50(%rsp),%r15
mov    %rbx,%r13
mov    0x10(%rsp),%rbp
jne    13ca <main+0x18a>
lea    0xd0c(%rip),%rbx
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
jne    13ca <main+0x18a>
lea    0x40(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   10a0 <memset@plt>
mov    0x2ab7(%rip),%rax
mov    (%rax),%eax
mov    0x2ace(%rip),%rcx
or     (%rcx),%eax
mov    %eax,0x40(%rsp)
mov    0x2ad9(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x44(%rsp)
movsbl 0x2bd5(%rip),%ecx
mov    0x2bc9(%rip),%r8d
lea    0x2baa(%rip),%rbp
mov    %rbp,%rdi
mov    %r12,%rsi
lea    0x2bad(%rip),%rdx
call   1090 <calc_tv@plt>
mov    0x8(%rsp),%edx
mov    0x18(%rsp),%rbx
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14,%rcx
call   1110 <prframe@plt>
mov    %rbx,%rdi
mov    0x10(%rsp),%rbp
call   10e0 <fflush@plt>
jmp    13ca <main+0x18a>
nopl   (%rax)
mov    %r13,%rdi
lea    0xc1d(%rip),%rsi
mov    %r15,%rdx
lea    0x2b60(%rip),%r12
mov    %r12,%rcx
mov    %r13,%rbx
mov    %r8,%r13
lea    0xc0(%rsp),%r14
mov    %r14,%r9
xor    %eax,%eax
lea    0x3c(%rsp),%rbp
push   %rbp
lea    0x40(%rsp),%rbp
push   %rbp
lea    0x44(%rsp),%rbp
push   %rbp
lea    0x48(%rsp),%rbp
push   %rbp
lea    0x4c(%rsp),%rbp
push   %rbp
lea    0x50(%rsp),%rbp
push   %rbp
lea    0x54(%rsp),%rbp
push   %rbp
lea    0x58(%rsp),%rbp
push   %rbp
lea    0x44(%rsp),%rbp
push   %rbp
lea    0x4b(%rsp),%rbp
push   %rbp
call   1100 <sscanf@plt>
add    $0x50,%rsp
mov    0x4(%rsp),%ecx
add    $0x6,%ecx
mov    $0xa,%edx
cmp    %ecx,%eax
jne    148f <main+0x24f>
lea    0x40(%rsp),%rdi
mov    %r14,%rsi
call   10f0 <get_can_id@plt>
cmpb   $0x72,0x3(%rsp)
lea    0x50(%rsp),%r15
jne    1619 <main+0x3d9>
mov    0x299d(%rip),%rax
mov    (%rax),%eax
or     %eax,0x40(%rsp)
mov    0x4(%rsp),%eax
mov    %eax,%ecx
and    $0xf,%ecx
mov    %ecx,0x44(%rsp)
movl   $0x0,0xc(%rsp)
test   %eax,%eax
lea    0x2aad(%rip),%rsi
mov    %rbx,%r13
jle    1380 <main+0x140>
xor    %ecx,%ecx
mov    0x48(%rsp),%rax
nopw   0x0(%rax,%rax,1)
movslq %ecx,%rcx
movzbl 0x20(%rsp,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
mov    0xc(%rsp),%ecx
add    $0x1,%ecx
mov    %ecx,0xc(%rsp)
cmp    0x4(%rsp),%ecx
jl     1650 <main+0x410>
jmp    1380 <main+0x140>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmpb   $0x0,0x2a71(%rip)
lea    0xc0(%rsp),%rdx
mov    %rbx,%r15
jne    1710 <main+0x4d0>
mov    %r13,%rdi
lea    0x98f(%rip),%rsi
mov    %r15,%rcx
xor    %eax,%eax
call   1100 <sscanf@plt>
cmp    $0x2,%eax
jne    1710 <main+0x4d0>
mov    0xc0(%rsp),%al
mov    %al,0x2a3e(%rip)
movsbl 0x50(%rsp),%edx
mov    %dl,0x2a34(%rip)
cmpb   $0x1,0x2a0c(%rip)
jne    16e5 <main+0x4a5>
movsbl %al,%esi
lea    0x96b(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2a13(%rip),%al
cmp    $0x64,%al
je     16f1 <main+0x4b1>
cmp    $0x68,%al
jne    1879 <main+0x639>
mov    0x2a02(%rip),%al
cmp    $0x61,%al
je     13ca <main+0x18a>
cmp    $0x72,%al
je     13ca <main+0x18a>
jmp    188a <main+0x64a>
nopl   0x0(%rax)
cmpl   $0x0,0x29d9(%rip)
jne    1731 <main+0x4f1>
mov    %r13,%rdi
lea    0x99d(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     17a7 <main+0x567>
mov    %r13,%rdi
lea    0x9dc(%rip),%rsi
lea    0x299e(%rip),%rdx
mov    %r15,%rcx
lea    0xc(%rsp),%r8
xor    %eax,%eax
call   1100 <sscanf@plt>
cmp    $0x3,%eax
jne    13ca <main+0x18a>
mov    %r15,%rdi
call   1060 <strlen@plt>
mov    %eax,0x298c(%rip)
cmpb   $0x1,0x2969(%rip)
jne    178a <main+0x54a>
lea    0x9aa(%rip),%rdi
mov    %eax,%esi
mov    %r15,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x296a(%rip),%eax
lea    0x2957(%rip),%r15
lea    0x8(%rsp),%r8
lea    -0x7(%rax),%ecx
cmp    $0xfffffffc,%ecx
ja     13ff <main+0x1bf>
jmp    1867 <main+0x627>
lea    0x293e(%rip),%rbx
mov    %rbx,%rdi
lea    0x139(%rsp),%rsi
call   1160 <get_date@plt>
test   %rax,%rax
je     17e4 <main+0x5a4>
mov    0x27f6(%rip),%rax
mov    (%rax),%edi
lea    0x8f2(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <gettimeofday@plt>
cmpb   $0x1,0x28ed(%rip)
jne    13ca <main+0x18a>
mov    0x28f9(%rip),%ebx
lea    0x28f2(%rip),%rdi
call   1050 <ctime@plt>
lea    0x8fe(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1070 <printf@plt>
jmp    13ca <main+0x18a>
mov    0x279f(%rip),%rcx
mov    (%rcx),%edi
lea    0x7f0(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    (%rbx),%rdi
call   10d0 <basename@plt>
mov    %eax,%edi
call   1150 <print_usage@plt>
mov    $0x1,%eax
jmp    1855 <main+0x615>
mov    0x18(%rsp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x198,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x8d1(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1842 <main+0x602>
lea    0x7da(%rip),%rdi
lea    0xc0(%rsp),%rsi
jmp    1896 <main+0x656>
lea    0x7f4(%rip),%rdi
lea    0x50(%rsp),%rsi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1842 <main+0x602>
lea    0x76c(%rip),%rdi
call   1130 <perror@plt>
jmp    1842 <main+0x602>

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
%struct.can_frame = type { i32, i32, i32* }
@stdin = global i32* null
@stdout = global i32* null
@main.verbose = internal global i32 0
@main.tv = internal global %struct.timeval zeroinitializer
@main.read_tv = internal global %struct.timeval zeroinitializer
@main.date_tv = internal global %struct.timeval zeroinitializer
@main.dplace = internal global i32 0
@main.base = internal global i8 0
@main.timestamps = internal global i8 0
@.str = [7 x i8] c"I:O:v?\00"
@optarg = global i32 0
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [7 x i8] c"infile\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [8 x i8] c"outfile\00"
@stderr = global i32 0
@.str.5 = [19 x i8] c"Unknown option %c\0A\00"
@.str.6 = [22 x i8] c"base %s timestamps %s\00"
@.str.7 = [23 x i8] c"base %c timestamps %c\0A\00"
@.str.8 = [43 x i8] c"invalid base %s (must be 'hex' or 'dez')!\0A\00"
@.str.9 = [59 x i8] c"invalid timestamps %s (must be 'absolute' or 'relative')!\0A\00"
@.str.10 = [5 x i8] c"date\00"
@.str.11 = [67 x i8] c"Not able to determine original log file date. Using current time.\0A\00"
@.str.12 = [15 x i8] c"date %ld => %s\00"
@.str.13 = [11 x i8] c"%ld.%s %d \00"
@.str.14 = [29 x i8] c"decimal place %d, e.g. '%s'\0A\00"
@.str.15 = [40 x i8] c"invalid dplace %d (must be 4, 5 or 6)!\0A\00"
@.str.16 = [48 x i8] c"%ld.%ld %d %s %*s %c %d %x %x %x %x %x %x %x %x\00"
@.str.17 = [48 x i8] c"%ld.%ld %d %s %*s %c %d %d %d %d %d %d %d %d %d\00"
@CAN_RTR_FLAG = global i32 0
@.str.18 = [14 x i8] c"%ld.%ld %d %s\00"
@.str.19 = [11 x i8] c"ErrorFrame\00"
@CAN_ERR_FLAG = global i32 0
@CAN_ERR_BUSERROR = global i32 0
@CAN_ERR_DLC = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [100 x i8]
%7 = alloca [100 x i8]
%8 = alloca [100 x i8]
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca %struct.can_frame
%12 = alloca i32
%13 = alloca i8
%14 = alloca i32
%15 = alloca [8 x i32]
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%19 = load i32*, i32** @stdin
store i32* %19, i32** %9
%20 = load i32*, i32** @stdout
store i32* %20, i32** %10
store i32 0, i32* %14
br label %21
21: ; preds = %60, %2
%22 = load i32, i32* %4
%23 = load i8**, i8*** %5
%24 = call i32 @getopt(i32 %22, i8** %23, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 %24, i32* %18
%25 = icmp ne i32 %24, -1
br i1 %25, label %26, label %61
26: ; preds = %21
%27 = load i32, i32* %18
switch i32 %27, label %51 [
i32 73, label %28
i32 79, label %36
i32 118, label %44
i32 63, label %45
]
28: ; preds = %26
%29 = load i32, i32* @optarg
%30 = call i32* @fopen(i32 %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %30, i32** %9
%31 = load i32*, i32** %9
%32 = icmp ne i32* %31, null
br i1 %32, label %35, label %33
33: ; preds = %28
%34 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %280
35: ; preds = %28
br label %60
36: ; preds = %26
%37 = load i32, i32* @optarg
%38 = call i32* @fopen(i32 %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %38, i32** %10
%39 = load i32*, i32** %10
%40 = icmp ne i32* %39, null
br i1 %40, label %43, label %41
41: ; preds = %36
%42 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %280
43: ; preds = %36
br label %60
44: ; preds = %26
store i32 1, i32* @main.verbose
br label %60
45: ; preds = %26
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 0
%48 = load i8*, i8** %47
%49 = call i32 @basename(i8* %48)
%50 = call i32 @print_usage(i32 %49)
store i32 0, i32* %3
br label %280
51: ; preds = %26
%52 = load i32, i32* @stderr
%53 = load i32, i32* %18
%54 = call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %53)
%55 = load i8**, i8*** %5
%56 = getelementptr inbounds i8*, i8** %55, i64 0
%57 = load i8*, i8** %56
%58 = call i32 @basename(i8* %57)
%59 = call i32 @print_usage(i32 %58)
store i32 1, i32* %3
br label %280
60: ; preds = %44, %43, %35
br label %21
61: ; preds = %21
br label %62
62: ; preds = %276, %240, %162, %137, %114, %61
%63 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%64 = load i32*, i32** %9
%65 = call i64 @fgets(i8* %63, i32 99, i32* %64)
%66 = icmp ne i64 %65, 0
br i1 %66, label %67, label %277
67: ; preds = %62
%68 = load i32, i32* @main.dplace
%69 = icmp ne i32 %68, 0
br i1 %69, label %164, label %70
70: ; preds = %67
%71 = load i8, i8* @main.base
%72 = icmp ne i8 %71, 0
br i1 %72, label %115, label %73
73: ; preds = %70
%74 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%75 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%76 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%77 = call i32 (i8*, i8*, i8*, i8*, ...) @sscanf(i8* %74, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i8* %75, i8* %76)
%78 = icmp eq i32 %77, 2
br i1 %78, label %79, label %115
79: ; preds = %73
%80 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%81 = load i8, i8* %80
store i8 %81, i8* @main.base
%82 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%83 = load i8, i8* %82
store i8 %83, i8* @main.timestamps
%84 = load i32, i32* @main.verbose
%85 = icmp ne i32 %84, 0
br i1 %85, label %86, label %92
86: ; preds = %79
%87 = load i8, i8* @main.base
%88 = sext i8 %87 to i32
%89 = load i8, i8* @main.timestamps
%90 = sext i8 %89 to i32
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 %88, i32 %90)
br label %92
92: ; preds = %86, %79
%93 = load i8, i8* @main.base
%94 = sext i8 %93 to i32
%95 = icmp ne i32 %94, 104
br i1 %95, label %96, label %103
96: ; preds = %92
%97 = load i8, i8* @main.base
%98 = sext i8 %97 to i32
%99 = icmp ne i32 %98, 100
br i1 %99, label %100, label %103
100: ; preds = %96
%101 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.8, i64 0, i64 0), i8* %101)
store i32 1, i32* %3
br label %280
103: ; preds = %96, %92
%104 = load i8, i8* @main.timestamps
%105 = sext i8 %104 to i32
%106 = icmp ne i32 %105, 97
br i1 %106, label %107, label %114
107: ; preds = %103
%108 = load i8, i8* @main.timestamps
%109 = sext i8 %108 to i32
%110 = icmp ne i32 %109, 114
br i1 %110, label %111, label %114
111: ; preds = %107
%112 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.9, i64 0, i64 0), i8* %112)
store i32 1, i32* %3
br label %280
114: ; preds = %107, %103
br label %62
115: ; preds = %73, %70
%116 = load i32, i32* getelementptr inbounds (%struct.timeval, %struct.timeval* @main.date_tv, i32 0, i32 1)
%117 = icmp ne i32 %116, 0
br i1 %117, label %138, label %118
118: ; preds = %115
%119 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%120 = call i32 @strncmp(i8* %119, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i32 4)
%121 = icmp ne i32 %120, 0
br i1 %121, label %138, label %122
122: ; preds = %118
%123 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 9
%124 = call i64 @get_date(%struct.timeval* @main.date_tv, i8* %123)
%125 = icmp ne i64 %124, 0
br i1 %125, label %126, label %130
126: ; preds = %122
%127 = load i32, i32* @stderr
%128 = call i32 (i32, i8*, ...) @fprintf(i32 %127, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.11, i64 0, i64 0))
%129 = call i32 @gettimeofday(%struct.timeval* @main.date_tv, i32* null)
br label %130
130: ; preds = %126, %122
%131 = load i32, i32* @main.verbose
%132 = icmp ne i32 %131, 0
br i1 %132, label %133, label %137
133: ; preds = %130
%134 = load i32, i32* getelementptr inbounds (%struct.timeval, %struct.timeval* @main.date_tv, i32 0, i32 1)
%135 = call i32 @ctime(i32* getelementptr inbounds (%struct.timeval, %struct.timeval* @main.date_tv, i32 0, i32 1))
%136 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0), i32 %134, i32 %135)
br label %137
137: ; preds = %133, %130
br label %62
138: ; preds = %118, %115
%139 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%140 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%141 = call i32 (i8*, i8*, i8*, i8*, ...) @sscanf(i8* %139, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0), i8* bitcast (i32* getelementptr inbounds (%struct.timeval, %struct.timeval* @main.tv, i32 0, i32 1) to i8*), i8* %140, i32* %16)
%142 = icmp eq i32 %141, 3
br i1 %142, label %143, label %162
143: ; preds = %138
%144 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%145 = call i32 @strlen(i8* %144)
store i32 %145, i32* @main.dplace
%146 = load i32, i32* @main.verbose
%147 = icmp ne i32 %146, 0
br i1 %147, label %148, label %152
148: ; preds = %143
%149 = load i32, i32* @main.dplace
%150 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%151 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.14, i64 0, i64 0), i32 %149, i8* %150)
br label %152
152: ; preds = %148, %143
%153 = load i32, i32* @main.dplace
%154 = icmp slt i32 %153, 4
br i1 %154, label %158, label %155
155: ; preds = %152
%156 = load i32, i32* @main.dplace
%157 = icmp sgt i32 %156, 6
br i1 %157, label %158, label %161
158: ; preds = %155, %152
%159 = load i32, i32* @main.dplace
%160 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.15, i64 0, i64 0), i32 %159)
store i32 1, i32* %3
br label %280
161: ; preds = %155
br label %163
162: ; preds = %138
br label %62
163: ; preds = %161
br label %164
164: ; preds = %163, %67
store i32 0, i32* %17
%165 = load i8, i8* @main.base
%166 = sext i8 %165 to i32
%167 = icmp eq i32 %166, 104
br i1 %167, label %168, label %187
168: ; preds = %164
%169 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%170 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%171 = getelementptr inbounds [8 x i32], [8 x i32]* %15, i64 0, i64 0
%172 = getelementptr inbounds [8 x i32], [8 x i32]* %15, i64 0, i64 1
%173 = getelementptr inbounds [8 x i32], [8 x i32]* %15, i64 0, i64 2
%174 = getelementptr inbounds [8 x i32], [8 x i32]* %15, i64 0, i64 3
%175 = getelementptr inbounds [8 x i32], [8 x i32]* %15, i64 0, i64 4
%176 = getelementptr inbounds [8 x i32], [8 x i32]* %15, i64 0, i64 5
%177 = getelementptr inbounds [8 x i32], [8 x i32]* %15, i64 0, i64 6
%178 = getelementptr inbounds [8 x i32], [8 x i32]* %15, i64 0, i64 7
%179 = call i32 (i8*, i8*, i8*, i8*, ...) @sscanf(i8* %169, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.16, i64 0, i64 0), i8* bitcast (i32* getelementptr inbounds (%struct.timeval, %struct.timeval* @main.read_tv, i32 0, i32 1) to i8*), i8* bitcast (%struct.timeval* @main.read_tv to i8*), i32* %12, i8* %170, i8* %13, i32* %14, i32* %171, i32* %172, i32* %173, i32* %174, i32* %175, i32* %176, i32* %177, i32* %178)
%180 = load i32, i32* %14
%181 = add nsw i32 %180, 6
%182 = icmp eq i32 %179, %181
br i1 %182, label %183, label %186
183: ; preds = %168
store i32 1, i32* %17
%184 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%185 = call i32 @get_can_id(%struct.can_frame* %11, i8* %184, i32 16)
br label %186
186: ; preds = %183, %168
br label %206
187: ; preds = %164
%188 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%189 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%190 = getelementptr inbounds [8 x i32], [8 x i32]* %15, i64 0, i64 0
%191 = getelementptr inbounds [8 x i32], [8 x i32]* %15, i64 0, i64 1
%192 = getelementptr inbounds [8 x i32], [8 x i32]* %15, i64 0, i64 2
%193 = getelementptr inbounds [8 x i32], [8 x i32]* %15, i64 0, i64 3
%194 = getelementptr inbounds [8 x i32], [8 x i32]* %15, i64 0, i64 4
%195 = getelementptr inbounds [8 x i32], [8 x i32]* %15, i64 0, i64 5
%196 = getelementptr inbounds [8 x i32], [8 x i32]* %15, i64 0, i64 6
%197 = getelementptr inbounds [8 x i32], [8 x i32]* %15, i64 0, i64 7
%198 = call i32 (i8*, i8*, i8*, i8*, ...) @sscanf(i8* %188, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.17, i64 0, i64 0), i8* bitcast (i32* getelementptr inbounds (%struct.timeval, %struct.timeval* @main.read_tv, i32 0, i32 1) to i8*), i8* bitcast (%struct.timeval* @main.read_tv to i8*), i32* %12, i8* %189, i8* %13, i32* %14, i32* %190, i32* %191, i32* %192, i32* %193, i32* %194, i32* %195, i32* %196, i32* %197)
%199 = load i32, i32* %14
%200 = add nsw i32 %199, 6
%201 = icmp eq i32 %198, %200
br i1 %201, label %202, label %205
202: ; preds = %187
store i32 1, i32* %17
%203 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%204 = call i32 @get_can_id(%struct.can_frame* %11, i8* %203, i32 10)
br label %205
205: ; preds = %202, %187
br label %206
206: ; preds = %205, %186
%207 = load i32, i32* %17
%208 = icmp ne i32 %207, 0
br i1 %208, label %209, label %249
209: ; preds = %206
%210 = load i8, i8* %13
%211 = sext i8 %210 to i32
%212 = icmp eq i32 %211, 114
br i1 %212, label %213, label %218
213: ; preds = %209
%214 = load i32, i32* @CAN_RTR_FLAG
%215 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %11, i32 0, i32 0
%216 = load i32, i32* %215
%217 = or i32 %216, %214
store i32 %217, i32* %215
br label %218
218: ; preds = %213, %209
%219 = load i32, i32* %14
%220 = and i32 %219, 15
%221 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %11, i32 0, i32 1
store i32 %220, i32* %221
store i32 0, i32* %16
br label %222
222: ; preds = %237, %218
%223 = load i32, i32* %16
%224 = load i32, i32* %14
%225 = icmp slt i32 %223, %224
br i1 %225, label %226, label %240
226: ; preds = %222
%227 = load i32, i32* %16
%228 = sext i32 %227 to i64
%229 = getelementptr inbounds [8 x i32], [8 x i32]* %15, i64 0, i64 %228
%230 = load i32, i32* %229
%231 = and i32 %230, 255
%232 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %11, i32 0, i32 2
%233 = load i32*, i32** %232
%234 = load i32, i32* %16
%235 = sext i32 %234 to i64
%236 = getelementptr inbounds i32, i32* %233, i64 %235
store i32 %231, i32* %236
br label %237
237: ; preds = %226
%238 = load i32, i32* %16
%239 = add nsw i32 %238, 1
store i32 %239, i32* %16
br label %222
240: ; preds = %222
%241 = load i8, i8* @main.timestamps
%242 = load i32, i32* @main.dplace
%243 = call i32 @calc_tv(%struct.timeval* @main.tv, %struct.timeval* @main.read_tv, %struct.timeval* @main.date_tv, i8 signext %241, i32 %242)
%244 = load i32*, i32** %10
%245 = load i32, i32* %12
%246 = call i32 @prframe(i32* %244, %struct.timeval* @main.tv, i32 %245, %struct.can_frame* %11)
%247 = load i32*, i32** %10
%248 = call i32 @fflush(i32* %247)
br label %62
249: ; preds = %206
%250 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%251 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%252 = call i32 (i8*, i8*, i8*, i8*, ...) @sscanf(i8* %250, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.18, i64 0, i64 0), i8* bitcast (i32* getelementptr inbounds (%struct.timeval, %struct.timeval* @main.read_tv, i32 0, i32 1) to i8*), i8* bitcast (%struct.timeval* @main.read_tv to i8*), i32* %12, i8* %251)
%253 = icmp eq i32 %252, 4
br i1 %253, label %254, label %276
254: ; preds = %249
%255 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%256 = call i32 @strlen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.19, i64 0, i64 0))
%257 = call i32 @strncmp(i8* %255, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.19, i64 0, i64 0), i32 %256)
%258 = icmp ne i32 %257, 0
br i1 %258, label %275, label %259
259: ; preds = %254
%260 = call i32 @memset(%struct.can_frame* %11, i32 0, i32 16)
%261 = load i32, i32* @CAN_ERR_FLAG
%262 = load i32, i32* @CAN_ERR_BUSERROR
%263 = or i32 %261, %262
%264 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %11, i32 0, i32 0
store i32 %263, i32* %264
%265 = load i32, i32* @CAN_ERR_DLC
%266 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %11, i32 0, i32 1
store i32 %265, i32* %266
%267 = load i8, i8* @main.timestamps
%268 = load i32, i32* @main.dplace
%269 = call i32 @calc_tv(%struct.timeval* @main.tv, %struct.timeval* @main.read_tv, %struct.timeval* @main.date_tv, i8 signext %267, i32 %268)
%270 = load i32*, i32** %10
%271 = load i32, i32* %12
%272 = call i32 @prframe(i32* %270, %struct.timeval* @main.tv, i32 %271, %struct.can_frame* %11)
%273 = load i32*, i32** %10
%274 = call i32 @fflush(i32* %273)
br label %275
275: ; preds = %259, %254
br label %276
276: ; preds = %275, %249
br label %62
277: ; preds = %62
%278 = load i32*, i32** %10
%279 = call i32 @fclose(i32* %278)
store i32 0, i32* %3
br label %280
280: ; preds = %277, %158, %111, %100, %51, %45, %41, %33
%281 = load i32, i32* %3
ret i32 %281
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
%struct.can_frame = type { i32, i32, i32* }
@stdin = global i32* null
@stdout = global i32* null
@main.verbose = internal unnamed_addr global i1 false
@main.tv = internal global %struct.timeval zeroinitializer
@main.read_tv = internal global %struct.timeval zeroinitializer
@main.date_tv = internal global %struct.timeval zeroinitializer
@main.dplace = internal unnamed_addr global i32 0
@main.base = internal unnamed_addr global i8 0
@main.timestamps = internal unnamed_addr global i8 0
@.str = [7 x i8] c"I:O:v?\00"
@optarg = global i32 0
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [7 x i8] c"infile\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [8 x i8] c"outfile\00"
@stderr = global i32 0
@.str.5 = [19 x i8] c"Unknown option %c\0A\00"
@.str.6 = [22 x i8] c"base %s timestamps %s\00"
@.str.7 = [23 x i8] c"base %c timestamps %c\0A\00"
@.str.8 = [43 x i8] c"invalid base %s (must be 'hex' or 'dez')!\0A\00"
@.str.9 = [59 x i8] c"invalid timestamps %s (must be 'absolute' or 'relative')!\0A\00"
@.str.10 = [5 x i8] c"date\00"
@.str.11 = [67 x i8] c"Not able to determine original log file date. Using current time.\0A\00"
@.str.12 = [15 x i8] c"date %ld => %s\00"
@.str.13 = [11 x i8] c"%ld.%s %d \00"
@.str.14 = [29 x i8] c"decimal place %d, e.g. '%s'\0A\00"
@.str.15 = [40 x i8] c"invalid dplace %d (must be 4, 5 or 6)!\0A\00"
@.str.16 = [48 x i8] c"%ld.%ld %d %s %*s %c %d %x %x %x %x %x %x %x %x\00"
@.str.17 = [48 x i8] c"%ld.%ld %d %s %*s %c %d %d %d %d %d %d %d %d %d\00"
@CAN_RTR_FLAG = global i32 0
@.str.18 = [14 x i8] c"%ld.%ld %d %s\00"
@.str.19 = [11 x i8] c"ErrorFrame\00"
@CAN_ERR_FLAG = global i32 0
@CAN_ERR_BUSERROR = global i32 0
@CAN_ERR_DLC = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = alloca [100 x i8]
%6 = alloca %struct.can_frame
%7 = alloca i32
%8 = alloca i8
%9 = alloca i32
%10 = alloca [8 x i32]
%11 = alloca i32
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%15 = load i32*, i32** @stdin
%16 = load i32*, i32** @stdout
%17 = bitcast %struct.can_frame* %6 to i8*
%18 = bitcast i32* %7 to i8*
%19 = bitcast i32* %9 to i8*
store i32 0, i32* %9
%20 = bitcast [8 x i32]* %10 to i8*
%21 = bitcast i32* %11 to i8*
br label %22
22: ; preds = %45, %2
%23 = phi i32* [ %47, %45 ], [ %15, %2 ]
%24 = phi i32* [ %26, %45 ], [ %16, %2 ]
br label %25
25: ; preds = %22, %51
%26 = phi i32* [ %24, %22 ], [ %53, %51 ]
br label %27
27: ; preds = %25, %57
%28 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
switch i32 %28, label %62 [
i32 -1, label %29
i32 73, label %45
i32 79, label %51
i32 118, label %57
i32 63, label %58
]
29: ; preds = %27
%30 = call i64 @fgets(i8* %12, i32 99, i32* %23)
%31 = icmp eq i64 %30, 0
br i1 %31, label %196, label %32
32: ; preds = %29
%33 = getelementptr inbounds [8 x i32], [8 x i32]* %10, i64 0, i64 0
%34 = getelementptr inbounds [8 x i32], [8 x i32]* %10, i64 0, i64 1
%35 = getelementptr inbounds [8 x i32], [8 x i32]* %10, i64 0, i64 2
%36 = getelementptr inbounds [8 x i32], [8 x i32]* %10, i64 0, i64 3
%37 = getelementptr inbounds [8 x i32], [8 x i32]* %10, i64 0, i64 4
%38 = getelementptr inbounds [8 x i32], [8 x i32]* %10, i64 0, i64 5
%39 = getelementptr inbounds [8 x i32], [8 x i32]* %10, i64 0, i64 6
%40 = getelementptr inbounds [8 x i32], [8 x i32]* %10, i64 0, i64 7
%41 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %6, i64 0, i32 0
%42 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %6, i64 0, i32 1
%43 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %6, i64 0, i32 2
%44 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 9
br label %68
45: ; preds = %27
%46 = load i32, i32* @optarg
%47 = tail call i32* @fopen(i32 %46, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%48 = icmp eq i32* %47, null
br i1 %48, label %49, label %22
49: ; preds = %45
%50 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %198
51: ; preds = %27
%52 = load i32, i32* @optarg
%53 = tail call i32* @fopen(i32 %52, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%54 = icmp eq i32* %53, null
br i1 %54, label %55, label %25
55: ; preds = %51
%56 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
br label %198
57: ; preds = %27
store i1 true, i1* @main.verbose
br label %27
58: ; preds = %27
%59 = load i8*, i8** %1
%60 = tail call i32 @basename(i8* %59)
%61 = tail call i32 @print_usage(i32 %60)
br label %198
62: ; preds = %27
%63 = load i32, i32* @stderr
%64 = tail call i32 (i32, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %28)
%65 = load i8*, i8** %1
%66 = tail call i32 @basename(i8* %65)
%67 = tail call i32 @print_usage(i32 %66)
br label %198
68: ; preds = %32, %113
%69 = load i32, i32* @main.dplace
%70 = icmp eq i32 %69, 0
br i1 %70, label %71, label %131
71: ; preds = %68
%72 = load i8, i8* @main.base
%73 = icmp eq i8 %72, 0
br i1 %73, label %74, label %94
74: ; preds = %71
%75 = call i32 (i8*, i8*, i8*, i8*, ...) @sscanf(i8* %12, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i8* %13, i8* %14)
%76 = icmp eq i32 %75, 2
br i1 %76, label %77, label %94
77: ; preds = %74
%78 = load i8, i8* %13
store i8 %78, i8* @main.base
%79 = load i8, i8* %14
store i8 %79, i8* @main.timestamps
%80 = load i1, i1* @main.verbose
br i1 %80, label %81, label %86
81: ; preds = %77
%82 = sext i8 %78 to i32
%83 = sext i8 %79 to i32
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 %82, i32 %83)
%85 = load i8, i8* @main.base
br label %86
86: ; preds = %81, %77
%87 = phi i8 [ %85, %81 ], [ %78, %77 ]
switch i8 %87, label %88 [
i8 104, label %90
i8 100, label %90
]
88: ; preds = %86
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.8, i64 0, i64 0), i8* %13)
br label %198
90: ; preds = %86, %86
%91 = load i8, i8* @main.timestamps
switch i8 %91, label %92 [
i8 114, label %113
i8 97, label %113
]
92: ; preds = %90
%93 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.9, i64 0, i64 0), i8* %14)
br label %198
94: ; preds = %74, %71
%95 = load i32, i32* getelementptr inbounds (%struct.timeval, %struct.timeval* @main.date_tv, i64 0, i32 1)
%96 = icmp eq i32 %95, 0
br i1 %96, label %97, label %116
97: ; preds = %94
%98 = call i32 @strncmp(i8* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i32 4)
%99 = icmp eq i32 %98, 0
br i1 %99, label %100, label %116
100: ; preds = %97
%101 = call i64 @get_date(%struct.timeval* @main.date_tv, i8* %44)
%102 = icmp eq i64 %101, 0
br i1 %102, label %107, label %103
103: ; preds = %100
%104 = load i32, i32* @stderr
%105 = call i32 (i32, i8*, ...) @fprintf(i32 %104, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.11, i64 0, i64 0))
%106 = call i32 @gettimeofday(%struct.timeval* @main.date_tv, i32* null)
br label %107
107: ; preds = %103, %100
%108 = load i1, i1* @main.verbose
br i1 %108, label %109, label %113
109: ; preds = %107
%110 = load i32, i32* getelementptr inbounds (%struct.timeval, %struct.timeval* @main.date_tv, i64 0, i32 1)
%111 = call i32 @ctime(i32* getelementptr inbounds (%struct.timeval, %struct.timeval* @main.date_tv, i64 0, i32 1))
%112 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0), i32 %110, i32 %111)
br label %113
113: ; preds = %177, %184, %180, %107, %109, %170, %116, %90, %90
%114 = call i64 @fgets(i8* %12, i32 99, i32* %23)
%115 = icmp eq i64 %114, 0
br i1 %115, label %196, label %68
116: ; preds = %97, %94
%117 = call i32 (i8*, i8*, i8*, i8*, ...) @sscanf(i8* %12, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0), i8* bitcast (i32* getelementptr inbounds (%struct.timeval, %struct.timeval* @main.tv, i64 0, i32 1) to i8*), i8* %14, i32* %11)
%118 = icmp eq i32 %117, 3
br i1 %118, label %119, label %113
119: ; preds = %116
%120 = call i32 @strlen(i8* %14)
store i32 %120, i32* @main.dplace
%121 = load i1, i1* @main.verbose
br i1 %121, label %122, label %125
122: ; preds = %119
%123 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.14, i64 0, i64 0), i32 %120, i8* %14)
%124 = load i32, i32* @main.dplace
br label %125
125: ; preds = %122, %119
%126 = phi i32 [ %124, %122 ], [ %120, %119 ]
%127 = add i32 %126, -7
%128 = icmp ult i32 %127, -3
br i1 %128, label %129, label %131
129: ; preds = %125
%130 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.15, i64 0, i64 0), i32 %126)
br label %198
131: ; preds = %125, %68
%132 = load i8, i8* @main.base
%133 = icmp eq i8 %132, 104
br i1 %133, label %134, label %139
134: ; preds = %131
%135 = call i32 (i8*, i8*, i8*, i8*, ...) @sscanf(i8* %12, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.16, i64 0, i64 0), i8* bitcast (i32* getelementptr inbounds (%struct.timeval, %struct.timeval* @main.read_tv, i64 0, i32 1) to i8*), i8* bitcast (%struct.timeval* @main.read_tv to i8*), i32* %7, i8* %13, i8* %8, i32* %9, i32* %33, i32* %34, i32* %35, i32* %36, i32* %37, i32* %38, i32* %39, i32* %40)
%136 = load i32, i32* %9
%137 = add nsw i32 %136, 6
%138 = icmp eq i32 %135, %137
br i1 %138, label %144, label %177
139: ; preds = %131
%140 = call i32 (i8*, i8*, i8*, i8*, ...) @sscanf(i8* %12, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.17, i64 0, i64 0), i8* bitcast (i32* getelementptr inbounds (%struct.timeval, %struct.timeval* @main.read_tv, i64 0, i32 1) to i8*), i8* bitcast (%struct.timeval* @main.read_tv to i8*), i32* %7, i8* %13, i8* %8, i32* %9, i32* %33, i32* %34, i32* %35, i32* %36, i32* %37, i32* %38, i32* %39, i32* %40)
%141 = load i32, i32* %9
%142 = add nsw i32 %141, 6
%143 = icmp eq i32 %140, %142
br i1 %143, label %144, label %177
144: ; preds = %139, %134
%145 = phi i32 [ 16, %134 ], [ 10, %139 ]
%146 = call i32 @get_can_id(%struct.can_frame* %6, i8* %13, i32 %145)
%147 = load i8, i8* %8
%148 = icmp eq i8 %147, 114
br i1 %148, label %149, label %153
149: ; preds = %144
%150 = load i32, i32* @CAN_RTR_FLAG
%151 = load i32, i32* %41
%152 = or i32 %151, %150
store i32 %152, i32* %41
br label %153
153: ; preds = %149, %144
%154 = load i32, i32* %9
%155 = and i32 %154, 15
store i32 %155, i32* %42
store i32 0, i32* %11
%156 = icmp sgt i32 %154, 0
br i1 %156, label %157, label %170
157: ; preds = %153
%158 = load i32*, i32** %43
br label %159
159: ; preds = %157, %159
%160 = phi i32 [ 0, %157 ], [ %167, %159 ]
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds [8 x i32], [8 x i32]* %10, i64 0, i64 %161
%163 = load i32, i32* %162
%164 = and i32 %163, 255
%165 = getelementptr inbounds i32, i32* %158, i64 %161
store i32 %164, i32* %165
%166 = load i32, i32* %11
%167 = add nsw i32 %166, 1
store i32 %167, i32* %11
%168 = load i32, i32* %9
%169 = icmp slt i32 %167, %168
br i1 %169, label %159, label %170
170: ; preds = %159, %153
%171 = load i8, i8* @main.timestamps
%172 = load i32, i32* @main.dplace
%173 = call i32 @calc_tv(%struct.timeval* @main.tv, %struct.timeval* @main.read_tv, %struct.timeval* @main.date_tv, i8 signext %171, i32 %172)
%174 = load i32, i32* %7
%175 = call i32 @prframe(i32* %26, %struct.timeval* @main.tv, i32 %174, %struct.can_frame* %6)
%176 = call i32 @fflush(i32* %26)
br label %113
177: ; preds = %134, %139
%178 = call i32 (i8*, i8*, i8*, i8*, ...) @sscanf(i8* %12, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.18, i64 0, i64 0), i8* bitcast (i32* getelementptr inbounds (%struct.timeval, %struct.timeval* @main.read_tv, i64 0, i32 1) to i8*), i8* bitcast (%struct.timeval* @main.read_tv to i8*), i32* %7, i8* %13)
%179 = icmp eq i32 %178, 4
br i1 %179, label %180, label %113
180: ; preds = %177
%181 = call i32 @strlen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.19, i64 0, i64 0))
%182 = call i32 @strncmp(i8* %13, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.19, i64 0, i64 0), i32 %181)
%183 = icmp eq i32 %182, 0
br i1 %183, label %184, label %113
184: ; preds = %180
%185 = call i32 @memset(%struct.can_frame* %6, i32 0, i32 16)
%186 = load i32, i32* @CAN_ERR_FLAG
%187 = load i32, i32* @CAN_ERR_BUSERROR
%188 = or i32 %187, %186
store i32 %188, i32* %41
%189 = load i32, i32* @CAN_ERR_DLC
store i32 %189, i32* %42
%190 = load i8, i8* @main.timestamps
%191 = load i32, i32* @main.dplace
%192 = call i32 @calc_tv(%struct.timeval* @main.tv, %struct.timeval* @main.read_tv, %struct.timeval* @main.date_tv, i8 signext %190, i32 %191)
%193 = load i32, i32* %7
%194 = call i32 @prframe(i32* %26, %struct.timeval* @main.tv, i32 %193, %struct.can_frame* %6)
%195 = call i32 @fflush(i32* %26)
br label %113
196: ; preds = %113, %29
%197 = call i32 @fclose(i32* %26)
br label %198
198: ; preds = %196, %129, %92, %88, %62, %58, %55, %49
%199 = phi i32 [ 1, %62 ], [ 0, %58 ], [ 1, %55 ], [ 1, %49 ], [ 1, %129 ], [ 1, %88 ], [ 1, %92 ], [ 0, %196 ]
ret i32 %199
}