#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 sockaddr_can {
  int can_ifindex;
  int /*<<< orphan*/ can_family;
};
struct sockaddr {
  int dummy;
};
struct ifreq {
  char *ifr_name;
  int ifr_ifindex;
};
struct can_frame {
  int can_id;
  int can_dlc;
  int *data;
};
struct can_filter {
  void *can_mask;
  void *can_id;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ addr;

/* Variables and functions */
int /*<<< orphan*/ AF_CAN;
int CAN_EFF_FLAG;
int CAN_EFF_MASK;
int /*<<< orphan*/ CAN_RAW;
int /*<<< orphan*/ CAN_RAW_FILTER;
int CAN_RTR_FLAG;
int CAN_SFF_MASK;
int MSG_PEEK;
int /*<<< orphan*/ PF_CAN;
int /*<<< orphan*/ SIOCGIFINDEX;
int /*<<< orphan*/ SIOCGIFNAME;
int /*<<< orphan*/ SOCK_RAW;
int /*<<< orphan*/ SOL_CAN_RAW;
int atoi(char *);
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int getopt(int, char **, char *);
int /*<<< orphan*/ ioctl(int, int /*<<< orphan*/, struct ifreq *);
char *optarg;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recvfrom(int, struct can_frame *, int, int, struct sockaddr *, int *);
int /*<<< orphan*/ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/,
                              struct can_filter **, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strtok(char *, char *);
void *strtoul(int /*<<< orphan*/, int /*<<< orphan*/ *, int);
int main(int argc, char **argv) {
  int s;
  struct sockaddr_can addr;
  struct can_filter rfilter[32];
  struct can_frame frame;
  int nbytes, i;
  struct ifreq ifr;
  char *ifname = "any";
  int ifindex;
  int opt;
  int peek = 0;
  int nfilters = 0;
  int deflt = 0;
  while ((opt = getopt(argc, argv, "i:p:f:d")) != -1) {
    switch (opt) {
    case 'i':
      ifname = optarg;
      break;
    case 'p':
      peek = atoi(optarg);
      break;
    case 'd':
      deflt = 1;
      break;
    case 'f':
      if (nfilters >= 32) {
        fputs("too many filters\n", stderr);
        break;
      }
      rfilter[nfilters].can_id = strtoul(strtok(optarg, ":"), NULL, 16);
      rfilter[nfilters].can_mask = strtoul(strtok(NULL, ":"), NULL, 16);
      nfilters++;
      break;
    default:
      fprintf(stderr, "Unknown option %c\n", opt);
      break;
    }
  }
  if ((s = socket(PF_CAN, SOCK_RAW, CAN_RAW)) < 0) {
    perror("socket");
    return 1;
  }
  if (deflt) {
    printf("%s: using CAN_RAW socket default filter.\n", argv[0]);
  } else {
    printf("%s: setting %d CAN filter(s).\n", argv[0], nfilters);
    setsockopt(s, SOL_CAN_RAW, CAN_RAW_FILTER, &rfilter,
               sizeof(*rfilter) * nfilters);
  }
  if (strcmp(ifname, "any") == 0)
    ifindex = 0;
  else {
    strcpy(ifr.ifr_name, ifname);
    ioctl(s, SIOCGIFINDEX, &ifr);
    ifindex = ifr.ifr_ifindex;
  }
  addr.can_family = AF_CAN;
  addr.can_ifindex = ifindex;
  if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
    perror("bind");
    return 1;
  }
  while (1) {
    socklen_t len = sizeof(addr);
    int flags;
    if (peek && peek--)
      flags = MSG_PEEK;
    else
      flags = 0;
    nbytes = recvfrom(s, &frame, sizeof(struct can_frame), flags,
                      (struct sockaddr *)&addr, &len);
    if (nbytes < 0) {
      perror("read");
      return 1;
    } else if (nbytes < sizeof(struct can_frame)) {
      fprintf(stderr, "read: incomplete CAN frame from iface %d\n",
              addr.can_ifindex);
      return 1;
    } else {
      ifr.ifr_ifindex = addr.can_ifindex;
      ioctl(s, SIOCGIFNAME, &ifr);
      printf(" %-5s ", ifr.ifr_name);
      if (frame.can_id & CAN_EFF_FLAG)
        printf("%8X  ", frame.can_id & CAN_EFF_MASK);
      else
        printf("%3X  ", frame.can_id & CAN_SFF_MASK);
      printf("[%d] ", frame.can_dlc);
      for (i = 0; i < frame.can_dlc; i++) {
        printf("%02X ", frame.data[i]);
      }
      if (frame.can_id & CAN_RTR_FLAG)
        printf("remote request");
      if (flags & MSG_PEEK)
        printf(" (MSG_PEEK)");
      printf("\n");
      fflush(stdout);
    }
  }
  close(s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x280,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe14(%rip),%rax
mov    %rax,-0x250(%rbp)
movl   $0x0,-0x25c(%rbp)
movl   $0x0,-0x260(%rbp)
movl   $0x0,-0x264(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xde5(%rip),%rdx
call   10f0 <getopt@plt>
mov    %eax,-0x258(%rbp)
cmp    $0xffffffff,%eax
je     13b0 <main+0x1b0>
mov    -0x258(%rbp),%eax
add    $0xffffff9c,%eax
mov    %eax,%ecx
mov    %rcx,-0x278(%rbp)
sub    $0xc,%eax
ja     1390 <main+0x190>
mov    -0x278(%rbp),%rax
lea    0xd70(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2d58(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x250(%rbp)
jmp    13ab <main+0x1ab>
mov    0x2d42(%rip),%rax
mov    (%rax),%rdi
call   1110 <atoi@plt>
mov    %eax,-0x25c(%rbp)
jmp    13ab <main+0x1ab>
movl   $0x1,-0x264(%rbp)
jmp    13ab <main+0x1ab>
cmpl   $0x20,-0x260(%rbp)
jl     12ff <main+0xff>
mov    0x2cbc(%rip),%rax
mov    (%rax),%esi
lea    0xd4b(%rip),%rdi
call   1060 <fputs@plt>
jmp    13ab <main+0x1ab>
mov    0x2cf2(%rip),%rax
mov    (%rax),%rdi
lea    0xd42(%rip),%rsi
call   10e0 <strtok@plt>
mov    %eax,%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1100 <strtoul@plt>
mov    %rax,%rcx
movslq -0x260(%rbp),%rdx
lea    -0x220(%rbp),%rax
shl    $0x4,%rdx
add    %rdx,%rax
mov    %rcx,0x8(%rax)
xor    %eax,%eax
mov    %eax,%edi
lea    0xd06(%rip),%rsi
call   10e0 <strtok@plt>
mov    %eax,%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1100 <strtoul@plt>
mov    %rax,%rcx
movslq -0x260(%rbp),%rdx
lea    -0x220(%rbp),%rax
shl    $0x4,%rdx
add    %rdx,%rax
mov    %rcx,(%rax)
mov    -0x260(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x260(%rbp)
jmp    13ab <main+0x1ab>
mov    0x2c11(%rip),%rax
mov    (%rax),%edi
mov    -0x258(%rbp),%edx
lea    0xcae(%rip),%rsi
call   1090 <fprintf@plt>
jmp    1245 <main+0x45>
mov    0x2bc9(%rip),%rax
mov    (%rax),%edi
mov    0x2c10(%rip),%rax
mov    (%rax),%esi
mov    0x2baf(%rip),%rax
mov    (%rax),%edx
call   1120 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    13f4 <main+0x1f4>
lea    0xc84(%rip),%rdi
call   10d0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    174b <main+0x54b>
cmpl   $0x0,-0x264(%rbp)
je     141b <main+0x21b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xc5f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1465 <main+0x265>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x260(%rbp),%edx
lea    0xc69(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
mov    0x2b88(%rip),%rax
mov    (%rax),%esi
mov    0x2b57(%rip),%rax
mov    (%rax),%edx
lea    -0x220(%rbp),%rcx
movslq -0x260(%rbp),%rax
shl    $0x4,%rax
mov    %eax,%r8d
call   1040 <setsockopt@plt>
mov    -0x250(%rbp),%rdi
lea    0xbc1(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1491 <main+0x291>
movl   $0x0,-0x254(%rbp)
jmp    14c8 <main+0x2c8>
mov    -0x248(%rbp),%rdi
mov    -0x250(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x14(%rbp),%edi
mov    0x2ab2(%rip),%rax
mov    (%rax),%esi
lea    -0x248(%rbp),%rdx
call   1070 <ioctl@plt>
mov    -0x240(%rbp),%eax
mov    %eax,-0x254(%rbp)
mov    0x2b19(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x254(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0x8,%edx
call   10c0 <bind@plt>
cmp    $0x0,%rax
jge    1510 <main+0x310>
lea    0xbb8(%rip),%rdi
call   10d0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    174b <main+0x54b>
jmp    1515 <main+0x315>
movl   $0x8,-0x268(%rbp)
cmpl   $0x0,-0x25c(%rbp)
je     155a <main+0x35a>
mov    -0x25c(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x25c(%rbp)
cmp    $0x0,%eax
je     155a <main+0x35a>
mov    0x2a73(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x26c(%rbp)
jmp    1564 <main+0x364>
movl   $0x0,-0x26c(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x26c(%rbp),%ecx
lea    -0x20(%rbp),%r8
lea    -0x230(%rbp),%rsi
mov    $0x10,%edx
lea    -0x268(%rbp),%r9
call   10b0 <recvfrom@plt>
mov    %eax,-0x234(%rbp)
cmpl   $0x0,-0x234(%rbp)
jge    15b4 <main+0x3b4>
lea    0xb19(%rip),%rdi
call   10d0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    174b <main+0x54b>
movslq -0x234(%rbp),%rax
cmp    $0x10,%rax
jae    15e9 <main+0x3e9>
mov    0x29dc(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%edx
lea    0xae9(%rip),%rsi
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    174b <main+0x54b>
mov    -0x20(%rbp),%eax
mov    %eax,-0x240(%rbp)
mov    -0x14(%rbp),%edi
mov    0x29b4(%rip),%rax
mov    (%rax),%esi
lea    -0x248(%rbp),%rdx
call   1070 <ioctl@plt>
mov    -0x248(%rbp),%rsi
lea    0xad3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x230(%rbp),%eax
mov    0x296c(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1659 <main+0x459>
mov    -0x230(%rbp),%esi
mov    0x2994(%rip),%rax
and    (%rax),%esi
lea    0xaa5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1676 <main+0x476>
mov    -0x230(%rbp),%esi
mov    0x2902(%rip),%rax
and    (%rax),%esi
lea    0xa89(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x22c(%rbp),%esi
lea    0xa7b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x238(%rbp)
mov    -0x238(%rbp),%eax
cmp    -0x22c(%rbp),%eax
jge    16d9 <main+0x4d9>
mov    -0x228(%rbp),%rax
movslq -0x238(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xa46(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x238(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x238(%rbp)
jmp    1694 <main+0x494>
mov    -0x230(%rbp),%eax
mov    0x28aa(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     16ff <main+0x4ff>
lea    0xa12(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x26c(%rbp),%eax
mov    0x28b4(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1725 <main+0x525>
lea    0x9fb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0x989(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x284e(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
jmp    1746 <main+0x546>
jmp    1515 <main+0x315>
mov    -0x4(%rbp),%eax
add    $0x280,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x258,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %r12d,%r12d
lea    0xe04(%rip),%rax
mov    %rax,0x20(%rsp)
lea    0xdfc(%rip),%r15
lea    0xdbd(%rip),%r14
xor    %r13d,%r13d
movl   $0x0,0x1c(%rsp)
jmp    1270 <main+0x60>
cmp    $0xffffffff,%eax
je     133e <main+0x12e>
mov    0x2d48(%rip),%rcx
mov    (%rcx),%edi
lea    0xdeb(%rip),%rsi
mov    %eax,%edx
call   10a0 <fprintf@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1100 <getopt@plt>
lea    -0x64(%rax),%ecx
cmp    $0xc,%ecx
ja     1250 <main+0x40>
movslq (%r14,%rcx,4),%rcx
add    %r14,%rcx
jmp    *%rcx
cmp    $0x20,%r13d
jl     12da <main+0xca>
mov    0x2d0d(%rip),%rax
mov    (%rax),%esi
lea    0xd9c(%rip),%rdi
call   1070 <fputs@plt>
jmp    1270 <main+0x60>
movl   $0x1,0x1c(%rsp)
jmp    1270 <main+0x60>
mov    0x2d3c(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x20(%rsp)
jmp    1270 <main+0x60>
mov    0x2d2b(%rip),%rax
mov    (%rax),%rdi
call   1120 <atoi@plt>
mov    %eax,%r12d
jmp    1270 <main+0x60>
mov    0x2d17(%rip),%rax
mov    (%rax),%rdi
lea    0xd67(%rip),%rsi
call   10f0 <strtok@plt>
mov    %eax,%edi
xor    %esi,%esi
mov    $0x10,%edx
call   1110 <strtoul@plt>
movslq %r13d,%rcx
shl    $0x4,%rcx
mov    %rcx,0x48(%rsp)
mov    %rax,0x58(%rsp,%rcx,1)
xor    %edi,%edi
lea    0xd3a(%rip),%rsi
call   10f0 <strtok@plt>
mov    %eax,%edi
xor    %esi,%esi
mov    $0x10,%edx
call   1110 <strtoul@plt>
mov    0x48(%rsp),%rcx
mov    %rax,0x50(%rsp,%rcx,1)
add    $0x1,%r13d
jmp    1270 <main+0x60>
mov    0x2c3b(%rip),%rax
mov    (%rax),%edi
mov    0x2c82(%rip),%rax
mov    (%rax),%esi
mov    0x2c21(%rip),%rax
mov    (%rax),%edx
call   1130 <socket@plt>
test   %eax,%eax
js     15fd <main+0x3ed>
mov    %eax,%r15d
mov    (%rbx),%rsi
cmpl   $0x0,0x1c(%rsp)
je     1383 <main+0x173>
lea    0xcf4(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    13ba <main+0x1aa>
lea    0xd0e(%rip),%rdi
mov    %r13d,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2c2d(%rip),%rax
mov    (%rax),%esi
mov    0x2bfc(%rip),%rax
mov    (%rax),%edx
shl    $0x4,%r13d
lea    0x50(%rsp),%rcx
mov    %r15d,%edi
mov    %r13d,%r8d
call   1050 <setsockopt@plt>
mov    0x20(%rsp),%rbx
lea    0xc6e(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     13f7 <main+0x1e7>
mov    %rbx,%rsi
call   1040 <strcpy@plt>
mov    0x2b7e(%rip),%rax
mov    (%rax),%esi
lea    0x38(%rsp),%rdx
mov    %r15d,%edi
call   1080 <ioctl@plt>
mov    0x40(%rsp),%eax
jmp    13f9 <main+0x1e9>
xor    %eax,%eax
mov    0x2be8(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,0x14(%rsp)
mov    %eax,0x10(%rsp)
lea    0x10(%rsp),%rsi
mov    %r15d,%edi
mov    $0x8,%edx
call   10d0 <bind@plt>
test   %rax,%rax
js     1606 <main+0x3f6>
movl   $0x8,0xc(%rsp)
mov    %r12d,%ebp
test   %r12d,%r12d
je     143e <main+0x22e>
mov    0x2b84(%rip),%rax
mov    (%rax),%ebp
lea    0x28(%rsp),%rsi
lea    0x10(%rsp),%r8
lea    0xc(%rsp),%r9
mov    %r15d,%edi
mov    $0x10,%edx
mov    %ebp,%ecx
call   10c0 <recvfrom@plt>
test   %eax,%eax
js     15f4 <main+0x3e4>
xor    %ecx,%ecx
sub    $0x1,%r12d
cmovb  %ecx,%r12d
lea    0xc8f(%rip),%r14
jmp    14a9 <main+0x299>
nopw   0x0(%rax,%rax,1)
mov    %r15d,%edi
lea    0x28(%rsp),%rsi
mov    $0x10,%edx
mov    %ebp,%ecx
lea    0x10(%rsp),%r8
lea    0xc(%rsp),%r9
call   10c0 <recvfrom@plt>
mov    %r13d,%r12d
test   %eax,%eax
js     15f4 <main+0x3e4>
cmp    $0xf,%eax
jbe    15d9 <main+0x3c9>
mov    0x10(%rsp),%eax
mov    %eax,0x40(%rsp)
mov    0x2aef(%rip),%rax
mov    (%rax),%esi
mov    %r15d,%edi
lea    0x38(%rsp),%rdx
call   1080 <ioctl@plt>
mov    0x38(%rsp),%rsi
lea    0xc0f(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x28(%rsp),%esi
mov    0x2aaa(%rip),%rax
mov    (%rax),%eax
and    %esi,%eax
lea    0xbf9(%rip),%rdi
lea    0xbf8(%rip),%rax
cmove  %rax,%rdi
mov    0x2acd(%rip),%rax
cmove  0x2a55(%rip),%rax
and    (%rax),%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2c(%rsp),%esi
lea    0xbd7(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
cmpl   $0x0,0x2c(%rsp)
jle    1560 <main+0x350>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    0x30(%rsp),%rax
mov    (%rax,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbx
movslq 0x2c(%rsp),%rax
cmp    %rax,%rbx
jl     1540 <main+0x330>
mov    0x2a29(%rip),%rax
mov    (%rax),%eax
test   %eax,0x28(%rsp)
je     157d <main+0x36d>
lea    0xb94(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2a3c(%rip),%rax
test   %ebp,(%rax)
je     1596 <main+0x386>
lea    0xb8a(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x29e1(%rip),%rax
mov    (%rax),%edi
call   10b0 <fflush@plt>
movl   $0x8,0xc(%rsp)
xor    %r13d,%r13d
mov    $0x0,%ebp
sub    $0x1,%r12d
jb     1480 <main+0x270>
mov    0x29f1(%rip),%rax
mov    (%rax),%ebp
mov    %r12d,%r13d
jmp    1480 <main+0x270>
mov    0x29c8(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rsp),%edx
lea    0xad4(%rip),%rsi
call   10a0 <fprintf@plt>
jmp    1612 <main+0x402>
lea    0xac1(%rip),%rdi
jmp    160d <main+0x3fd>
lea    0xa63(%rip),%rdi
jmp    160d <main+0x3fd>
lea    0xaaa(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%eax
add    $0x258,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_can = type { i32, i32 }
%struct.can_filter = type { i8*, i8* }
%struct.can_frame = type { i32, i32, i32* }
%struct.ifreq = type { i8*, i32 }
%struct.sockaddr = type { i32 }
@.str = [4 x i8] c"any\00"
@.str.1 = [8 x i8] c"i:p:f:d\00"
@optarg = global i8* null
@.str.2 = [18 x i8] c"too many filters\0A\00"
@stderr = global i32 0
@.str.3 = [2 x i8] c":\00"
@.str.4 = [19 x i8] c"Unknown option %c\0A\00"
@PF_CAN = global i32 0
@SOCK_RAW = global i32 0
@CAN_RAW = global i32 0
@.str.5 = [7 x i8] c"socket\00"
@.str.6 = [42 x i8] c"%s: using CAN_RAW socket default filter.\0A\00"
@.str.7 = [31 x i8] c"%s: setting %d CAN filter(s).\0A\00"
@SOL_CAN_RAW = global i32 0
@CAN_RAW_FILTER = global i32 0
@SIOCGIFINDEX = global i32 0
@AF_CAN = global i32 0
@.str.8 = [5 x i8] c"bind\00"
@MSG_PEEK = global i32 0
@.str.9 = [5 x i8] c"read\00"
@.str.10 = [42 x i8] c"read: incomplete CAN frame from iface %d\0A\00"
@SIOCGIFNAME = global i32 0
@.str.11 = [7 x i8] c" %-5s \00"
@CAN_EFF_FLAG = global i32 0
@.str.12 = [6 x i8] c"%8X \00"
@CAN_EFF_MASK = global i32 0
@.str.13 = [6 x i8] c"%3X \00"
@CAN_SFF_MASK = global i32 0
@.str.14 = [6 x i8] c"[%d] \00"
@.str.15 = [6 x i8] c"%02X \00"
@CAN_RTR_FLAG = global i32 0
@.str.16 = [15 x i8] c"remote request\00"
@.str.17 = [12 x i8] c" (MSG_PEEK)\00"
@.str.18 = [2 x i8] c"\0A\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.sockaddr_can
%8 = alloca [32 x %struct.can_filter]
%9 = alloca %struct.can_frame
%10 = alloca i32
%11 = alloca i32
%12 = alloca %struct.ifreq
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %13
store i32 0, i32* %16
store i32 0, i32* %17
store i32 0, i32* %18
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 ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
store i32 %24, i32* %15
%25 = icmp ne i32 %24, -1
br i1 %25, label %26, label %61
26: ; preds = %21
%27 = load i32, i32* %15
switch i32 %27, label %56 [
i32 105, label %28
i32 112, label %30
i32 100, label %33
i32 102, label %34
]
28: ; preds = %26
%29 = load i8*, i8** @optarg
store i8* %29, i8** %13
br label %60
30: ; preds = %26
%31 = load i8*, i8** @optarg
%32 = call i32 @atoi(i8* %31)
store i32 %32, i32* %16
br label %60
33: ; preds = %26
store i32 1, i32* %18
br label %60
34: ; preds = %26
%35 = load i32, i32* %17
%36 = icmp sge i32 %35, 32
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = load i32, i32* @stderr
%39 = call i32 @fputs(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %38)
br label %60
40: ; preds = %34
%41 = load i8*, i8** @optarg
%42 = call i32 @strtok(i8* %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%43 = call i8* @strtoul(i32 %42, i32* null, i32 16)
%44 = load i32, i32* %17
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [32 x %struct.can_filter], [32 x %struct.can_filter]* %8, i64 0, i64 %45
%47 = getelementptr inbounds %struct.can_filter, %struct.can_filter* %46, i32 0, i32 1
store i8* %43, i8** %47
%48 = call i32 @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%49 = call i8* @strtoul(i32 %48, i32* null, i32 16)
%50 = load i32, i32* %17
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [32 x %struct.can_filter], [32 x %struct.can_filter]* %8, i64 0, i64 %51
%53 = getelementptr inbounds %struct.can_filter, %struct.can_filter* %52, i32 0, i32 0
store i8* %49, i8** %53
%54 = load i32, i32* %17
%55 = add nsw i32 %54, 1
store i32 %55, i32* %17
br label %60
56: ; preds = %26
%57 = load i32, i32* @stderr
%58 = load i32, i32* %15
%59 = call i32 @fprintf(i32 %57, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %58)
br label %60
60: ; preds = %56, %40, %37, %33, %30, %28
br label %21
61: ; preds = %21
%62 = load i32, i32* @PF_CAN
%63 = load i32, i32* @SOCK_RAW
%64 = load i32, i32* @CAN_RAW
%65 = call i32 @socket(i32 %62, i32 %63, i32 %64)
store i32 %65, i32* %6
%66 = icmp slt i32 %65, 0
br i1 %66, label %67, label %69
67: ; preds = %61
%68 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %3
br label %215
69: ; preds = %61
%70 = load i32, i32* %18
%71 = icmp ne i32 %70, 0
br i1 %71, label %72, label %77
72: ; preds = %69
%73 = load i8**, i8*** %5
%74 = getelementptr inbounds i8*, i8** %73, i64 0
%75 = load i8*, i8** %74
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i8* %75)
br label %92
77: ; preds = %69
%78 = load i8**, i8*** %5
%79 = getelementptr inbounds i8*, i8** %78, i64 0
%80 = load i8*, i8** %79
%81 = load i32, i32* %17
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i8* %80, i32 %81)
%83 = load i32, i32* %6
%84 = load i32, i32* @SOL_CAN_RAW
%85 = load i32, i32* @CAN_RAW_FILTER
%86 = bitcast [32 x %struct.can_filter]* %8 to %struct.can_filter**
%87 = load i32, i32* %17
%88 = sext i32 %87 to i64
%89 = mul i64 16, %88
%90 = trunc i64 %89 to i32
%91 = call i32 @setsockopt(i32 %83, i32 %84, i32 %85, %struct.can_filter** %86, i32 %90)
br label %92
92: ; preds = %77, %72
%93 = load i8*, i8** %13
%94 = call i64 @strcmp(i8* %93, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%95 = icmp eq i64 %94, 0
br i1 %95, label %96, label %97
96: ; preds = %92
store i32 0, i32* %14
br label %107
97: ; preds = %92
%98 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %12, i32 0, i32 0
%99 = load i8*, i8** %98
%100 = load i8*, i8** %13
%101 = call i32 @strcpy(i8* %99, i8* %100)
%102 = load i32, i32* %6
%103 = load i32, i32* @SIOCGIFINDEX
%104 = call i32 @ioctl(i32 %102, i32 %103, %struct.ifreq* %12)
%105 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %12, i32 0, i32 1
%106 = load i32, i32* %105
store i32 %106, i32* %14
br label %107
107: ; preds = %97, %96
%108 = load i32, i32* @AF_CAN
%109 = getelementptr inbounds %struct.sockaddr_can, %struct.sockaddr_can* %7, i32 0, i32 1
store i32 %108, i32* %109
%110 = load i32, i32* %14
%111 = getelementptr inbounds %struct.sockaddr_can, %struct.sockaddr_can* %7, i32 0, i32 0
store i32 %110, i32* %111
%112 = load i32, i32* %6
%113 = bitcast %struct.sockaddr_can* %7 to %struct.sockaddr*
%114 = call i64 @bind(i32 %112, %struct.sockaddr* %113, i32 8)
%115 = icmp slt i64 %114, 0
br i1 %115, label %116, label %118
116: ; preds = %107
%117 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %3
br label %215
118: ; preds = %107
br label %119
119: ; preds = %118, %214
store i32 8, i32* %19
%120 = load i32, i32* %16
%121 = icmp ne i32 %120, 0
br i1 %121, label %122, label %128
122: ; preds = %119
%123 = load i32, i32* %16
%124 = add nsw i32 %123, -1
store i32 %124, i32* %16
%125 = icmp ne i32 %123, 0
br i1 %125, label %126, label %128
126: ; preds = %122
%127 = load i32, i32* @MSG_PEEK
store i32 %127, i32* %20
br label %129
128: ; preds = %122, %119
store i32 0, i32* %20
br label %129
129: ; preds = %128, %126
%130 = load i32, i32* %6
%131 = load i32, i32* %20
%132 = bitcast %struct.sockaddr_can* %7 to %struct.sockaddr*
%133 = call i32 @recvfrom(i32 %130, %struct.can_frame* %9, i32 16, i32 %131, %struct.sockaddr* %132, i32* %19)
store i32 %133, i32* %10
%134 = load i32, i32* %10
%135 = icmp slt i32 %134, 0
br i1 %135, label %136, label %138
136: ; preds = %129
%137 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
store i32 1, i32* %3
br label %215
138: ; preds = %129
%139 = load i32, i32* %10
%140 = sext i32 %139 to i64
%141 = icmp ult i64 %140, 16
br i1 %141, label %142, label %147
142: ; preds = %138
%143 = load i32, i32* @stderr
%144 = getelementptr inbounds %struct.sockaddr_can, %struct.sockaddr_can* %7, i32 0, i32 0
%145 = load i32, i32* %144
%146 = call i32 @fprintf(i32 %143, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.10, i64 0, i64 0), i32 %145)
store i32 1, i32* %3
br label %215
147: ; preds = %138
%148 = getelementptr inbounds %struct.sockaddr_can, %struct.sockaddr_can* %7, i32 0, i32 0
%149 = load i32, i32* %148
%150 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %12, i32 0, i32 1
store i32 %149, i32* %150
%151 = load i32, i32* %6
%152 = load i32, i32* @SIOCGIFNAME
%153 = call i32 @ioctl(i32 %151, i32 %152, %struct.ifreq* %12)
%154 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %12, i32 0, i32 0
%155 = load i8*, i8** %154
%156 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8* %155)
%157 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %9, i32 0, i32 0
%158 = load i32, i32* %157
%159 = load i32, i32* @CAN_EFF_FLAG
%160 = and i32 %158, %159
%161 = icmp ne i32 %160, 0
br i1 %161, label %162, label %168
162: ; preds = %147
%163 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %9, i32 0, i32 0
%164 = load i32, i32* %163
%165 = load i32, i32* @CAN_EFF_MASK
%166 = and i32 %164, %165
%167 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 %166)
br label %174
168: ; preds = %147
%169 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %9, i32 0, i32 0
%170 = load i32, i32* %169
%171 = load i32, i32* @CAN_SFF_MASK
%172 = and i32 %170, %171
%173 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i32 %172)
br label %174
174: ; preds = %168, %162
%175 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %9, i32 0, i32 1
%176 = load i32, i32* %175
%177 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i32 %176)
store i32 0, i32* %11
br label %178
178: ; preds = %191, %174
%179 = load i32, i32* %11
%180 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %9, i32 0, i32 1
%181 = load i32, i32* %180
%182 = icmp slt i32 %179, %181
br i1 %182, label %183, label %194
183: ; preds = %178
%184 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %9, i32 0, i32 2
%185 = load i32*, i32** %184
%186 = load i32, i32* %11
%187 = sext i32 %186 to i64
%188 = getelementptr inbounds i32, i32* %185, i64 %187
%189 = load i32, i32* %188
%190 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0), i32 %189)
br label %191
191: ; preds = %183
%192 = load i32, i32* %11
%193 = add nsw i32 %192, 1
store i32 %193, i32* %11
br label %178
194: ; preds = %178
%195 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %9, i32 0, i32 0
%196 = load i32, i32* %195
%197 = load i32, i32* @CAN_RTR_FLAG
%198 = and i32 %196, %197
%199 = icmp ne i32 %198, 0
br i1 %199, label %200, label %202
200: ; preds = %194
%201 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.16, i64 0, i64 0))
br label %202
202: ; preds = %200, %194
%203 = load i32, i32* %20
%204 = load i32, i32* @MSG_PEEK
%205 = and i32 %203, %204
%206 = icmp ne i32 %205, 0
br i1 %206, label %207, label %209
207: ; preds = %202
%208 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.17, i64 0, i64 0))
br label %209
209: ; preds = %207, %202
%210 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.18, i64 0, i64 0))
%211 = load i32, i32* @stdout
%212 = call i32 @fflush(i32 %211)
br label %213
213: ; preds = %209
br label %214
214: ; preds = %213
br label %119
215: ; preds = %142, %136, %116, %67
%216 = load i32, i32* %3
ret i32 %216
}

LLVM IR (-O2):
%struct.sockaddr_can = type { i32, i32 }
%struct.can_filter = type { i8*, i8* }
%struct.can_frame = type { i32, i32, i32* }
%struct.ifreq = type { i8*, i32 }
%struct.sockaddr = type { i32 }
@.str = [4 x i8] c"any\00"
@.str.1 = [8 x i8] c"i:p:f:d\00"
@optarg = global i8* null
@.str.2 = [18 x i8] c"too many filters\0A\00"
@stderr = global i32 0
@.str.3 = [2 x i8] c":\00"
@.str.4 = [19 x i8] c"Unknown option %c\0A\00"
@PF_CAN = global i32 0
@SOCK_RAW = global i32 0
@CAN_RAW = global i32 0
@.str.5 = [7 x i8] c"socket\00"
@.str.6 = [42 x i8] c"%s: using CAN_RAW socket default filter.\0A\00"
@.str.7 = [31 x i8] c"%s: setting %d CAN filter(s).\0A\00"
@SOL_CAN_RAW = global i32 0
@CAN_RAW_FILTER = global i32 0
@SIOCGIFINDEX = global i32 0
@AF_CAN = global i32 0
@.str.8 = [5 x i8] c"bind\00"
@MSG_PEEK = global i32 0
@.str.9 = [5 x i8] c"read\00"
@.str.10 = [42 x i8] c"read: incomplete CAN frame from iface %d\0A\00"
@SIOCGIFNAME = global i32 0
@.str.11 = [7 x i8] c" %-5s \00"
@CAN_EFF_FLAG = global i32 0
@.str.12 = [6 x i8] c"%8X \00"
@CAN_EFF_MASK = global i32 0
@.str.13 = [6 x i8] c"%3X \00"
@CAN_SFF_MASK = global i32 0
@.str.14 = [6 x i8] c"[%d] \00"
@.str.15 = [6 x i8] c"%02X \00"
@CAN_RTR_FLAG = global i32 0
@.str.16 = [15 x i8] c"remote request\00"
@.str.17 = [12 x i8] c" (MSG_PEEK)\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca %struct.sockaddr_can
%4 = alloca [32 x %struct.can_filter]
%5 = alloca %struct.can_frame
%6 = alloca %struct.ifreq
%7 = alloca i32
%8 = bitcast %struct.sockaddr_can* %3 to i8*
%9 = bitcast [32 x %struct.can_filter]* %4 to i8*
%10 = bitcast %struct.can_frame* %5 to i8*
%11 = bitcast %struct.ifreq* %6 to i8*
br label %12
12: ; preds = %29, %2
%13 = phi i8* [ %30, %29 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %2 ]
%14 = phi i32 [ %18, %29 ], [ 0, %2 ]
%15 = phi i32 [ %22, %29 ], [ 0, %2 ]
%16 = phi i32 [ %26, %29 ], [ 0, %2 ]
br label %17
17: ; preds = %12, %31
%18 = phi i32 [ %14, %12 ], [ %33, %31 ]
%19 = phi i32 [ %15, %12 ], [ %22, %31 ]
%20 = phi i32 [ %16, %12 ], [ %26, %31 ]
br label %21
21: ; preds = %17, %38
%22 = phi i32 [ %19, %17 ], [ %47, %38 ]
%23 = phi i32 [ %20, %17 ], [ %26, %38 ]
%24 = icmp sgt i32 %22, 31
br label %25
25: ; preds = %27, %21
%26 = phi i32 [ %23, %21 ], [ 1, %27 ]
br label %27
27: ; preds = %51, %25
%28 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
switch i32 %28, label %48 [
i32 -1, label %52
i32 105, label %29
i32 112, label %31
i32 100, label %25
i32 102, label %34
]
29: ; preds = %27
%30 = load i8*, i8** @optarg
br label %12
31: ; preds = %27
%32 = load i8*, i8** @optarg
%33 = tail call i32 @atoi(i8* %32)
br label %17
34: ; preds = %27
br i1 %24, label %35, label %38
35: ; preds = %34
%36 = load i32, i32* @stderr
%37 = tail call i32 @fputs(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %36)
br label %51
38: ; preds = %34
%39 = load i8*, i8** @optarg
%40 = tail call i32 @strtok(i8* %39, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%41 = tail call i8* @strtoul(i32 %40, i32* null, i32 16)
%42 = sext i32 %22 to i64
%43 = getelementptr inbounds [32 x %struct.can_filter], [32 x %struct.can_filter]* %4, i64 0, i64 %42, i32 1
store i8* %41, i8** %43
%44 = tail call i32 @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%45 = tail call i8* @strtoul(i32 %44, i32* null, i32 16)
%46 = getelementptr inbounds [32 x %struct.can_filter], [32 x %struct.can_filter]* %4, i64 0, i64 %42, i32 0
store i8* %45, i8** %46
%47 = add nsw i32 %22, 1
br label %21
48: ; preds = %27
%49 = load i32, i32* @stderr
%50 = tail call i32 @fprintf(i32 %49, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %28)
br label %51
51: ; preds = %48, %35
br label %27
52: ; preds = %27
%53 = load i32, i32* @PF_CAN
%54 = load i32, i32* @SOCK_RAW
%55 = load i32, i32* @CAN_RAW
%56 = tail call i32 @socket(i32 %53, i32 %54, i32 %55)
%57 = icmp slt i32 %56, 0
br i1 %57, label %58, label %60
58: ; preds = %52
%59 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
br label %172
60: ; preds = %52
%61 = icmp eq i32 %26, 0
%62 = load i8*, i8** %1
br i1 %61, label %65, label %63
63: ; preds = %60
%64 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i8* %62)
br label %72
65: ; preds = %60
%66 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i8* %62, i32 %22)
%67 = load i32, i32* @SOL_CAN_RAW
%68 = load i32, i32* @CAN_RAW_FILTER
%69 = bitcast [32 x %struct.can_filter]* %4 to %struct.can_filter**
%70 = shl i32 %22, 4
%71 = call i32 @setsockopt(i32 %56, i32 %67, i32 %68, %struct.can_filter** %69, i32 %70)
br label %72
72: ; preds = %65, %63
%73 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%74 = icmp eq i64 %73, 0
br i1 %74, label %81, label %75
75: ; preds = %72
%76 = call i32 @strcpy(i8* undef, i8* %13)
%77 = load i32, i32* @SIOCGIFINDEX
%78 = call i32 @ioctl(i32 %56, i32 %77, %struct.ifreq* %6)
%79 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %6, i64 0, i32 1
%80 = load i32, i32* %79
br label %81
81: ; preds = %72, %75
%82 = phi i32 [ %80, %75 ], [ 0, %72 ]
%83 = load i32, i32* @AF_CAN
%84 = getelementptr inbounds %struct.sockaddr_can, %struct.sockaddr_can* %3, i64 0, i32 1
store i32 %83, i32* %84
%85 = getelementptr inbounds %struct.sockaddr_can, %struct.sockaddr_can* %3, i64 0, i32 0
store i32 %82, i32* %85
%86 = bitcast %struct.sockaddr_can* %3 to %struct.sockaddr*
%87 = call i64 @bind(i32 %56, %struct.sockaddr* %86, i32 8)
%88 = icmp slt i64 %87, 0
br i1 %88, label %104, label %89
89: ; preds = %81
%90 = bitcast i32* %7 to i8*
store i32 8, i32* %7
%91 = icmp eq i32 %18, 0
%92 = load i32, i32* @MSG_PEEK
%93 = select i1 %91, i32 0, i32 %92
%94 = call i32 @recvfrom(i32 %56, %struct.can_frame* %5, i32 16, i32 %93, %struct.sockaddr* %86, i32* %7)
%95 = icmp slt i32 %94, 0
br i1 %95, label %106, label %96
96: ; preds = %89
%97 = add nsw i32 %18, -1
%98 = select i1 %91, i32 0, i32 %97
%99 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %6, i64 0, i32 1
%100 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %6, i64 0, i32 0
%101 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %5, i64 0, i32 0
%102 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %5, i64 0, i32 1
%103 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %5, i64 0, i32 2
br label %108
104: ; preds = %81
%105 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
br label %172
106: ; preds = %161, %89
%107 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
br label %160
108: ; preds = %96, %161
%109 = phi i32 [ %94, %96 ], [ %170, %161 ]
%110 = phi i32 [ %93, %96 ], [ %169, %161 ]
%111 = phi i32 [ %98, %96 ], [ %168, %161 ]
%112 = icmp ult i32 %109, 16
br i1 %112, label %113, label %117
113: ; preds = %108
%114 = load i32, i32* @stderr
%115 = load i32, i32* %85
%116 = call i32 @fprintf(i32 %114, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.10, i64 0, i64 0), i32 %115)
br label %160
117: ; preds = %108
%118 = load i32, i32* %85
store i32 %118, i32* %99
%119 = load i32, i32* @SIOCGIFNAME
%120 = call i32 @ioctl(i32 %56, i32 %119, %struct.ifreq* %6)
%121 = load i8*, i8** %100
%122 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8* %121)
%123 = load i32, i32* %101
%124 = load i32, i32* @CAN_EFF_FLAG
%125 = and i32 %124, %123
%126 = icmp eq i32 %125, 0
%127 = select i1 %126, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0)
%128 = load i32, i32* @CAN_SFF_MASK
%129 = load i32, i32* @CAN_EFF_MASK
%130 = select i1 %126, i32 %128, i32 %129
%131 = and i32 %130, %123
%132 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %127, i32 %131)
%133 = load i32, i32* %102
%134 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i32 %133)
%135 = load i32, i32* %102
%136 = icmp sgt i32 %135, 0
br i1 %136, label %137, label %147
137: ; preds = %117, %137
%138 = phi i64 [ %143, %137 ], [ 0, %117 ]
%139 = load i32*, i32** %103
%140 = getelementptr inbounds i32, i32* %139, i64 %138
%141 = load i32, i32* %140
%142 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0), i32 %141)
%143 = add nuw nsw i64 %138, 1
%144 = load i32, i32* %102
%145 = sext i32 %144 to i64
%146 = icmp slt i64 %143, %145
br i1 %146, label %137, label %147
147: ; preds = %137, %117
%148 = load i32, i32* %101
%149 = load i32, i32* @CAN_RTR_FLAG
%150 = and i32 %149, %148
%151 = icmp eq i32 %150, 0
br i1 %151, label %154, label %152
152: ; preds = %147
%153 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.16, i64 0, i64 0))
br label %154
154: ; preds = %152, %147
%155 = load i32, i32* @MSG_PEEK
%156 = and i32 %155, %110
%157 = icmp eq i32 %156, 0
br i1 %157, label %161, label %158
158: ; preds = %154
%159 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.17, i64 0, i64 0))
br label %161
160: ; preds = %106, %113
br label %172
161: ; preds = %154, %158
%162 = call i32 @putchar(i32 10)
%163 = load i32, i32* @stdout
%164 = call i32 @fflush(i32 %163)
store i32 8, i32* %7
%165 = icmp eq i32 %111, 0
%166 = add nsw i32 %111, -1
%167 = load i32, i32* @MSG_PEEK
%168 = select i1 %165, i32 0, i32 %166
%169 = select i1 %165, i32 0, i32 %167
%170 = call i32 @recvfrom(i32 %56, %struct.can_frame* %5, i32 16, i32 %169, %struct.sockaddr* %86, i32* %7)
%171 = icmp slt i32 %170, 0
br i1 %171, label %106, label %108
172: ; preds = %160, %104, %58
ret i32 1
}