#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 */

/* Variables and functions */
int PACKET_FANOUT_FLAG_ROLLOVER;
int PACKET_FANOUT_ROLLOVER;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int sock_fanout_open(int, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void test_control_single(void) {
  fprintf(stderr, "test: control single socket\n");
  if (sock_fanout_open(PACKET_FANOUT_ROLLOVER | PACKET_FANOUT_FLAG_ROLLOVER,
                       0) != -1) {
    fprintf(stderr, "ERROR: opened socket with dual rollover\n");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<test_control_single>:
push   %rbp
mov    %rsp,%rbp
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
lea    0xebc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
mov    0x2e77(%rip),%rax
or     (%rax),%edi
xor    %esi,%esi
call   1040 <sock_fanout_open@plt>
cmp    $0xffffffff,%eax
je     118a <test_control_single+0x5a>
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
lea    0xea2(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_control_single>:
push   %rbx
mov    0x2ea0(%rip),%rbx
mov    (%rbx),%edi
lea    0xebf(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2ea3(%rip),%rax
mov    0x2e7c(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
xor    %esi,%esi
call   1040 <sock_fanout_open@plt>
cmp    $0xffffffff,%eax
jne    1166 <test_control_single+0x36>
pop    %rbx
ret
mov    (%rbx),%edi
lea    0xeae(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [29 x i8] c"test: control single socket\0A\00"
@PACKET_FANOUT_ROLLOVER = global i32 0
@PACKET_FANOUT_FLAG_ROLLOVER = global i32 0
@.str.1 = [41 x i8] c"ERROR: opened socket with dual rollover\0A\00"
define void @test_control_single() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @PACKET_FANOUT_ROLLOVER
%4 = load i32, i32* @PACKET_FANOUT_FLAG_ROLLOVER
%5 = or i32 %3, %4
%6 = call i32 @sock_fanout_open(i32 %5, i32 0)
%7 = icmp ne i32 %6, -1
br i1 %7, label %8, label %12
8: ; preds = %0
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %0
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [29 x i8] c"test: control single socket\0A\00"
@PACKET_FANOUT_ROLLOVER = global i32 0
@PACKET_FANOUT_FLAG_ROLLOVER = global i32 0
@.str.1 = [41 x i8] c"ERROR: opened socket with dual rollover\0A\00"
define void @test_control_single() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @PACKET_FANOUT_ROLLOVER
%4 = load i32, i32* @PACKET_FANOUT_FLAG_ROLLOVER
%5 = or i32 %4, %3
%6 = tail call i32 @sock_fanout_open(i32 %5, i32 0)
%7 = icmp eq i32 %6, -1
br i1 %7, label %12, label %8
8: ; preds = %0
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %0
ret void
}