#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 /*<<< orphan*/ can_ifindex;
  int /*<<< orphan*/ can_family;
};
struct sockaddr {
  int dummy;
};
struct ifreq {
  int /*<<< orphan*/ ifr_ifindex;
  int /*<<< orphan*/ ifr_name;
};
struct can_frame {
  int dummy;
};
typedef int /*<<< orphan*/ frame;
typedef int /*<<< orphan*/ addr;

/* Variables and functions */
int /*<<< orphan*/ AF_CAN;
int /*<<< orphan*/ CAN_RAW;
int /*<<< orphan*/ CAN_RAW_FILTER;
int /*<<< orphan*/ PF_CAN;
int /*<<< orphan*/ SIOCGIFINDEX;
int /*<<< orphan*/ SOCK_RAW;
int /*<<< orphan*/ SOL_CAN_RAW;
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ ioctl(int, int /*<<< orphan*/, struct ifreq *);
scalar_t__ parse_canframe(unsigned char *, struct can_frame *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/ *, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(int /*<<< orphan*/, char *);
int /*<<< orphan*/ usleep(int);
int write(int, struct can_frame *, int);
int main(int argc, char **argv) {
  int s;
  int nbytes;
  struct sockaddr_can addr;
  struct can_frame frame;
  struct ifreq ifr;
  int i;
  unsigned char buff[] = "7DF#0201050000000000";
  fprintf(stderr, "CAN testing\n");
  if (parse_canframe(buff, &frame)) {
    fprintf(stderr, "\nWrong CAN-frame format!\n\n");
    fprintf(stderr, "Try: <can_id>#{R|data}\n");
    fprintf(stderr, "can_id can have 3 (SFF) or 8 (EFF) hex chars\n");
    fprintf(stderr, "data has 0 to 8 hex-values that can (optionally)");
    fprintf(stderr, " be seperated by '.'\n\n");
    fprintf(stderr, "e.g. 5A1#11.2233.44556677.88 / 123#DEADBEEF / ");
    fprintf(stderr, "5AA# /\n     1F334455#1122334455667788 / 123#R ");
    fprintf(stderr, "for remote transmission request.\n\n");
    return 1;
  }
  if ((s = socket(PF_CAN, SOCK_RAW, CAN_RAW)) < 0) {
    perror("socket");
    return 1;
  }
  addr.can_family = AF_CAN;
  strcpy(ifr.ifr_name, "can0");
  if (ioctl(s, SIOCGIFINDEX, &ifr) < 0) {
    perror("SIOCGIFINDEX");
    return 1;
  }
  addr.can_ifindex = ifr.ifr_ifindex;
  setsockopt(s, SOL_CAN_RAW, CAN_RAW_FILTER, NULL, 0);
  if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
    perror("bind");
    return 1;
  }
  for (i = 0; i < 100; i++) {
    if ((nbytes = write(s, &frame, sizeof(frame))) != sizeof(frame)) {
      perror("write");
      return 1;
    }
    fprintf(stderr, "%d \n", i);
    usleep(10000);
  }
  close(s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xe33(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xe30(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xe2e(%rip),%eax
mov    %eax,-0x40(%rbp)
mov    0xe29(%rip),%al
mov    %al,-0x3c(%rbp)
mov    0x2dd3(%rip),%rax
mov    (%rax),%edi
lea    0xe17(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
lea    -0x50(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1090 <parse_canframe@plt>
cmp    $0x0,%rax
je     12e0 <main+0x130>
mov    0x2da5(%rip),%rax
mov    (%rax),%edi
lea    0xdf6(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2d8e(%rip),%rax
mov    (%rax),%edi
lea    0xdfa(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2d77(%rip),%rax
mov    (%rax),%edi
lea    0xdfb(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2d60(%rip),%rax
mov    (%rax),%edi
lea    0xe12(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2d49(%rip),%rax
mov    (%rax),%edi
lea    0xe2c(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2d32(%rip),%rax
mov    (%rax),%edi
lea    0xe2c(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2d1b(%rip),%rax
mov    (%rax),%edi
lea    0xe44(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2d04(%rip),%rax
mov    (%rax),%edi
lea    0xe5c(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    145a <main+0x2aa>
mov    0x2cd1(%rip),%rax
mov    (%rax),%edi
mov    0x2cf0(%rip),%rax
mov    (%rax),%esi
mov    0x2cb7(%rip),%rax
mov    (%rax),%edx
call   10d0 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    1324 <main+0x174>
lea    0xe39(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    145a <main+0x2aa>
mov    0x2cc5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x2c(%rbp),%edi
lea    0xe19(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x14(%rbp),%edi
mov    0x2c57(%rip),%rax
mov    (%rax),%esi
lea    -0x30(%rbp),%rdx
call   1060 <ioctl@plt>
cmp    $0x0,%rax
jge    1376 <main+0x1c6>
lea    0xdf3(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    145a <main+0x2aa>
mov    -0x30(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2c52(%rip),%rax
mov    (%rax),%esi
mov    0x2c31(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%ecx
xor    %r8d,%r8d
call   1040 <setsockopt@plt>
mov    -0x14(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0x8,%edx
call   10a0 <bind@plt>
cmp    $0x0,%rax
jge    13d0 <main+0x220>
lea    0xda6(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    145a <main+0x2aa>
movl   $0x0,-0x34(%rbp)
cmpl   $0x64,-0x34(%rbp)
jge    144b <main+0x29b>
mov    -0x14(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x4,%edx
call   1050 <write@plt>
mov    %eax,-0x18(%rbp)
cltq
cmp    $0x4,%rax
je     1419 <main+0x269>
lea    0xd62(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    145a <main+0x2aa>
mov    0x2ba8(%rip),%rax
mov    (%rax),%edi
mov    -0x34(%rbp),%edx
lea    0xd44(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x2710,%edi
call   10c0 <usleep@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    13d7 <main+0x227>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x40,%rsp
movaps 0xe3d(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movabs $0x30303030303030,%rax
mov    %rax,0x2d(%rsp)
mov    0x2dea(%rip),%r12
mov    (%r12),%edi
lea    0xe2c(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0x20(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1090 <parse_canframe@plt>
test   %rax,%rax
je     12a2 <main+0xf2>
mov    (%r12),%edi
lea    0xe0f(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    (%r12),%edi
lea    0xe18(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    (%r12),%edi
lea    0xe1e(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    (%r12),%edi
lea    0xe3a(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    (%r12),%edi
lea    0xe59(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    (%r12),%edi
lea    0xe5e(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    (%r12),%edi
lea    0xe7b(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    (%r12),%edi
lea    0xe98(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%eax
jmp    138f <main+0x1df>
mov    0x2d0f(%rip),%rax
mov    (%rax),%edi
mov    0x2d2e(%rip),%rax
mov    (%rax),%esi
mov    0x2cf5(%rip),%rax
mov    (%rax),%edx
call   10d0 <socket@plt>
test   %eax,%eax
js     139c <main+0x1ec>
mov    %eax,%ebx
mov    0x2d1d(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x14(%rsp)
lea    0xe73(%rip),%rsi
call   1030 <strcpy@plt>
mov    0x2cb4(%rip),%rax
mov    (%rax),%esi
lea    0x18(%rsp),%rdx
mov    %ebx,%edi
call   1060 <ioctl@plt>
test   %rax,%rax
js     13a5 <main+0x1f5>
mov    0x18(%rsp),%eax
mov    %eax,0x10(%rsp)
mov    0x2cc6(%rip),%rax
mov    (%rax),%esi
mov    0x2ca5(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1040 <setsockopt@plt>
lea    0x10(%rsp),%rsi
mov    %ebx,%edi
mov    $0x8,%edx
call   10a0 <bind@plt>
test   %rax,%rax
js     13ae <main+0x1fe>
lea    0x8(%rsp),%r14
lea    0xe25(%rip),%r15
xor    %ebp,%ebp
nopl   (%rax)
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1050 <write@plt>
cmp    $0x4,%eax
jne    13b7 <main+0x207>
mov    (%r12),%edi
mov    %r15,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x2710,%edi
call   10c0 <usleep@plt>
add    $0x1,%ebp
cmp    $0x64,%ebp
jne    1350 <main+0x1a0>
mov    %ebx,%edi
call   1070 <close@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xda9(%rip),%rdi
jmp    13be <main+0x20e>
lea    0xdac(%rip),%rdi
jmp    13be <main+0x20e>
lea    0xdb0(%rip),%rdi
jmp    13be <main+0x20e>
lea    0xdac(%rip),%rdi
call   10b0 <perror@plt>
jmp    1298 <main+0xe8>

LLVM IR (-O0):
%struct.sockaddr_can = type { i32, i32 }
%struct.can_frame = type { i32 }
%struct.ifreq = type { i32, i32 }
%struct.sockaddr = type { i32 }
@__const.main.buff = [21 x i8] c"7DF\00"
@stderr = global i32 0
@.str = [13 x i8] c"CAN testing\0A\00"
@.str.1 = [27 x i8] c"\0AWrong CAN-frame format!\0A\0A\00"
@.str.2 = [24 x i8] c"Try: <can_id>#{R|data}\0A\00"
@.str.3 = [46 x i8] c"can_id can have 3 (SFF) or 8 (EFF) hex chars\0A\00"
@.str.4 = [49 x i8] c"data has 0 to 8 hex-values that can (optionally)\00"
@.str.5 = [23 x i8] c" be seperated by '.'\0A\0A\00"
@.str.6 = [47 x i8] c"e.g. 5A1.2233.44556677.88 / 123#DEADBEEF / \00"
@.str.7 = [47 x i8] c"5AA# /\0A 1F334455 / 123#R \00"
@.str.8 = [35 x i8] c"for remote transmission request.\0A\0A\00"
@PF_CAN = global i32 0
@SOCK_RAW = global i32 0
@CAN_RAW = global i32 0
@.str.9 = [7 x i8] c"socket\00"
@AF_CAN = global i32 0
@.str.10 = [5 x i8] c"can0\00"
@SIOCGIFINDEX = global i32 0
@.str.11 = [13 x i8] c"SIOCGIFINDEX\00"
@SOL_CAN_RAW = global i32 0
@CAN_RAW_FILTER = global i32 0
@.str.12 = [5 x i8] c"bind\00"
@.str.13 = [6 x i8] c"write\00"
@.str.14 = [5 x i8] c"%d \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.sockaddr_can
%9 = alloca %struct.can_frame
%10 = alloca %struct.ifreq
%11 = alloca i32
%12 = alloca [21 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = bitcast [21 x i8]* %12 to i8*
%14 = load i32, i32* @stderr
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%16 = getelementptr inbounds [21 x i8], [21 x i8]* %12, i64 0, i64 0
%17 = call i64 @parse_canframe(i8* %16, %struct.can_frame* %9)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %36
19: ; preds = %2
%20 = load i32, i32* @stderr
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%22 = load i32, i32* @stderr
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%24 = load i32, i32* @stderr
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
%26 = load i32, i32* @stderr
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0))
%28 = load i32, i32* @stderr
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%30 = load i32, i32* @stderr
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0))
%32 = load i32, i32* @stderr
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.7, i64 0, i64 0))
%34 = load i32, i32* @stderr
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %3
br label %92
36: ; preds = %2
%37 = load i32, i32* @PF_CAN
%38 = load i32, i32* @SOCK_RAW
%39 = load i32, i32* @CAN_RAW
%40 = call i32 @socket(i32 %37, i32 %38, i32 %39)
store i32 %40, i32* %6
%41 = icmp slt i32 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %36
%43 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
store i32 1, i32* %3
br label %92
44: ; preds = %36
%45 = load i32, i32* @AF_CAN
%46 = getelementptr inbounds %struct.sockaddr_can, %struct.sockaddr_can* %8, i32 0, i32 1
store i32 %45, i32* %46
%47 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %10, i32 0, i32 1
%48 = load i32, i32* %47
%49 = call i32 @strcpy(i32 %48, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%50 = load i32, i32* %6
%51 = load i32, i32* @SIOCGIFINDEX
%52 = call i64 @ioctl(i32 %50, i32 %51, %struct.ifreq* %10)
%53 = icmp slt i64 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %44
%55 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0))
store i32 1, i32* %3
br label %92
56: ; preds = %44
%57 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %10, i32 0, i32 0
%58 = load i32, i32* %57
%59 = getelementptr inbounds %struct.sockaddr_can, %struct.sockaddr_can* %8, i32 0, i32 0
store i32 %58, i32* %59
%60 = load i32, i32* %6
%61 = load i32, i32* @SOL_CAN_RAW
%62 = load i32, i32* @CAN_RAW_FILTER
%63 = call i32 @setsockopt(i32 %60, i32 %61, i32 %62, i32* null, i32 0)
%64 = load i32, i32* %6
%65 = bitcast %struct.sockaddr_can* %8 to %struct.sockaddr*
%66 = call i64 @bind(i32 %64, %struct.sockaddr* %65, i32 8)
%67 = icmp slt i64 %66, 0
br i1 %67, label %68, label %70
68: ; preds = %56
%69 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
store i32 1, i32* %3
br label %92
70: ; preds = %56
store i32 0, i32* %11
br label %71
71: ; preds = %86, %70
%72 = load i32, i32* %11
%73 = icmp slt i32 %72, 100
br i1 %73, label %74, label %89
74: ; preds = %71
%75 = load i32, i32* %6
%76 = call i32 @write(i32 %75, %struct.can_frame* %9, i32 4)
store i32 %76, i32* %7
%77 = sext i32 %76 to i64
%78 = icmp ne i64 %77, 4
br i1 %78, label %79, label %81
79: ; preds = %74
%80 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0))
store i32 1, i32* %3
br label %92
81: ; preds = %74
%82 = load i32, i32* @stderr
%83 = load i32, i32* %11
%84 = call i32 (i32, i8*, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0), i32 %83)
%85 = call i32 @usleep(i32 10000)
br label %86
86: ; preds = %81
%87 = load i32, i32* %11
%88 = add nsw i32 %87, 1
store i32 %88, i32* %11
br label %71
89: ; preds = %71
%90 = load i32, i32* %6
%91 = call i32 @close(i32 %90)
store i32 0, i32* %3
br label %92
92: ; preds = %89, %79, %68, %54, %42, %19
%93 = load i32, i32* %3
ret i32 %93
}

LLVM IR (-O2):
%struct.sockaddr_can = type { i32, i32 }
%struct.can_frame = type { i32 }
%struct.ifreq = type { i32, i32 }
%struct.sockaddr = type { i32 }
@__const.main.buff = [21 x i8] c"7DF\00"
@stderr = global i32 0
@.str = [13 x i8] c"CAN testing\0A\00"
@.str.1 = [27 x i8] c"\0AWrong CAN-frame format!\0A\0A\00"
@.str.2 = [24 x i8] c"Try: <can_id>#{R|data}\0A\00"
@.str.3 = [46 x i8] c"can_id can have 3 (SFF) or 8 (EFF) hex chars\0A\00"
@.str.4 = [49 x i8] c"data has 0 to 8 hex-values that can (optionally)\00"
@.str.5 = [23 x i8] c" be seperated by '.'\0A\0A\00"
@.str.6 = [47 x i8] c"e.g. 5A1.2233.44556677.88 / 123#DEADBEEF / \00"
@.str.7 = [47 x i8] c"5AA# /\0A 1F334455 / 123#R \00"
@.str.8 = [35 x i8] c"for remote transmission request.\0A\0A\00"
@PF_CAN = global i32 0
@SOCK_RAW = global i32 0
@CAN_RAW = global i32 0
@.str.9 = [7 x i8] c"socket\00"
@AF_CAN = global i32 0
@.str.10 = [5 x i8] c"can0\00"
@SIOCGIFINDEX = global i32 0
@.str.11 = [13 x i8] c"SIOCGIFINDEX\00"
@SOL_CAN_RAW = global i32 0
@CAN_RAW_FILTER = global i32 0
@.str.12 = [5 x i8] c"bind\00"
@.str.13 = [6 x i8] c"write\00"
@.str.14 = [5 x i8] c"%d \0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.sockaddr_can
%4 = alloca %struct.can_frame
%5 = alloca %struct.ifreq
%6 = alloca [21 x i8]
%7 = bitcast %struct.sockaddr_can* %3 to i8*
%8 = bitcast %struct.can_frame* %4 to i8*
%9 = bitcast %struct.ifreq* %5 to i8*
%10 = getelementptr inbounds [21 x i8], [21 x i8]* %6, i64 0, i64 0
%11 = load i32, i32* @stderr
%12 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%13 = call i64 @parse_canframe(i8* %10, %struct.can_frame* %4)
%14 = icmp eq i64 %13, 0
br i1 %14, label %32, label %15
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%18 = load i32, i32* @stderr
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%20 = load i32, i32* @stderr
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
%22 = load i32, i32* @stderr
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0))
%24 = load i32, i32* @stderr
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%26 = load i32, i32* @stderr
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0))
%28 = load i32, i32* @stderr
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.7, i64 0, i64 0))
%30 = load i32, i32* @stderr
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0))
br label %75
32: ; preds = %2
%33 = load i32, i32* @PF_CAN
%34 = load i32, i32* @SOCK_RAW
%35 = load i32, i32* @CAN_RAW
%36 = call i32 @socket(i32 %33, i32 %34, i32 %35)
%37 = icmp slt i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %32
%39 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
br label %75
40: ; preds = %32
%41 = load i32, i32* @AF_CAN
%42 = getelementptr inbounds %struct.sockaddr_can, %struct.sockaddr_can* %3, i64 0, i32 1
store i32 %41, i32* %42
%43 = call i32 @strcpy(i32 undef, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%44 = load i32, i32* @SIOCGIFINDEX
%45 = call i64 @ioctl(i32 %36, i32 %44, %struct.ifreq* %5)
%46 = icmp slt i64 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %40
%48 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0))
br label %75
49: ; preds = %40
%50 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %5, i64 0, i32 0
%51 = load i32, i32* %50
%52 = getelementptr inbounds %struct.sockaddr_can, %struct.sockaddr_can* %3, i64 0, i32 0
store i32 %51, i32* %52
%53 = load i32, i32* @SOL_CAN_RAW
%54 = load i32, i32* @CAN_RAW_FILTER
%55 = call i32 @setsockopt(i32 %36, i32 %53, i32 %54, i32* null, i32 0)
%56 = bitcast %struct.sockaddr_can* %3 to %struct.sockaddr*
%57 = call i64 @bind(i32 %36, %struct.sockaddr* %56, i32 8)
%58 = icmp slt i64 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %49
%60 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
br label %75
61: ; preds = %49, %67
%62 = phi i32 [ %71, %67 ], [ 0, %49 ]
%63 = call i32 @write(i32 %36, %struct.can_frame* %4, i32 4)
%64 = icmp eq i32 %63, 4
br i1 %64, label %67, label %65
65: ; preds = %61
%66 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0))
br label %75
67: ; preds = %61
%68 = load i32, i32* @stderr
%69 = call i32 (i32, i8*, ...) @fprintf(i32 %68, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0), i32 %62)
%70 = call i32 @usleep(i32 10000)
%71 = add nuw nsw i32 %62, 1
%72 = icmp eq i32 %71, 100
br i1 %72, label %73, label %61
73: ; preds = %67
%74 = call i32 @close(i32 %36)
br label %75
75: ; preds = %73, %65, %59, %47, %38, %15
%76 = phi i32 [ 1, %15 ], [ 1, %38 ], [ 1, %47 ], [ 1, %59 ], [ 1, %65 ], [ 0, %73 ]
ret i32 %76
}