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

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ recv_own_msgs;
typedef int /*<<< orphan*/ loopback;

/* Variables and functions */
int /*<<< orphan*/ CAN_RAW_LOOPBACK;
int /*<<< orphan*/ CAN_RAW_RECV_OWN_MSGS;
int /*<<< orphan*/ SOL_CAN_RAW;
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/,
                              int *, int);
void setopts(int s, int loopback, int recv_own_msgs) {
  setsockopt(s, SOL_CAN_RAW, CAN_RAW_LOOPBACK, &loopback, sizeof(loopback));
  setsockopt(s, SOL_CAN_RAW, CAN_RAW_RECV_OWN_MSGS, &recv_own_msgs,
             sizeof(recv_own_msgs));
  printf("check loopback %d recv_own_msgs %d ... ", loopback, recv_own_msgs);
}


x86 assembly (clang, -O0):
<setopts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ea5(%rip),%rax
mov    (%rax),%esi
mov    0x2e84(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    -0x4(%rbp),%edi
mov    0x2e81(%rip),%rax
mov    (%rax),%esi
mov    0x2e80(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setopts>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    %esi,0x4(%rsp)
mov    %edx,(%rsp)
mov    0x2eac(%rip),%r14
mov    (%r14),%esi
mov    0x2e8a(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    (%r14),%esi
mov    0x2e8e(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rcx
mov    %ebx,%edi
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0xe86(%rip),%rdi
call   1040 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@SOL_CAN_RAW = global i32 0
@CAN_RAW_LOOPBACK = global i32 0
@CAN_RAW_RECV_OWN_MSGS = global i32 0
@.str = [40 x i8] c"check loopback %d recv_own_msgs %d ... \00"
define void @setopts(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* @SOL_CAN_RAW
%9 = load i32, i32* @CAN_RAW_LOOPBACK
%10 = call i32 @setsockopt(i32 %7, i32 %8, i32 %9, i32* %5, i32 4)
%11 = load i32, i32* %4
%12 = load i32, i32* @SOL_CAN_RAW
%13 = load i32, i32* @CAN_RAW_RECV_OWN_MSGS
%14 = call i32 @setsockopt(i32 %11, i32 %12, i32 %13, i32* %6, i32 4)
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %16)
ret void
}

LLVM IR (-O2):
@SOL_CAN_RAW = global i32 0
@CAN_RAW_LOOPBACK = global i32 0
@CAN_RAW_RECV_OWN_MSGS = global i32 0
@.str = [40 x i8] c"check loopback %d recv_own_msgs %d ... \00"
define void @setopts(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
store i32 %1, i32* %4
store i32 %2, i32* %5
%6 = load i32, i32* @SOL_CAN_RAW
%7 = load i32, i32* @CAN_RAW_LOOPBACK
%8 = call i32 @setsockopt(i32 %0, i32 %6, i32 %7, i32* %4, i32 4)
%9 = load i32, i32* @SOL_CAN_RAW
%10 = load i32, i32* @CAN_RAW_RECV_OWN_MSGS
%11 = call i32 @setsockopt(i32 %0, i32 %9, i32 %10, i32* %5, i32 4)
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %13)
ret void
}