#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_CBPF;
int PACKET_FANOUT_CPU;
int PACKET_FANOUT_EBPF;
int PACKET_FANOUT_FLAG_ROLLOVER;
int PACKET_FANOUT_FLAG_UNIQUEID;
int PACKET_FANOUT_HASH;
int PACKET_FANOUT_LB;
int PACKET_FANOUT_ROLLOVER;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ set_cpuaffinity(int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ test_control_group();
int /*<<< orphan*/ test_control_single();
int test_datapath(int, int, int const *, int const *);
int /*<<< orphan*/ test_unique_fanout_group_ids();
int main(int argc, char **argv) {
  const int expect_hash[2][2] = {{15, 5}, {20, 5}};
  const int expect_hash_rb[2][2] = {{15, 5}, {20, 15}};
  const int expect_lb[2][2] = {{10, 10}, {18, 17}};
  const int expect_rb[2][2] = {{15, 5}, {20, 15}};
  const int expect_cpu0[2][2] = {{20, 0}, {20, 0}};
  const int expect_cpu1[2][2] = {{0, 20}, {0, 20}};
  const int expect_bpf[2][2] = {{15, 5}, {15, 20}};
  const int expect_uniqueid[2][2] = {{20, 20}, {20, 20}};
  int port_off = 2, tries = 5, ret;
  test_control_single();
  test_control_group();
  test_unique_fanout_group_ids();
  ret = test_datapath(PACKET_FANOUT_HASH, port_off, expect_hash[0],
                      expect_hash[1]);
  while (ret && tries--) {
    fprintf(stderr, "info: trying alternate ports (%d)\n", tries);
    ret = test_datapath(PACKET_FANOUT_HASH, ++port_off, expect_hash[0],
                        expect_hash[1]);
  }
  ret |= test_datapath(PACKET_FANOUT_HASH | PACKET_FANOUT_FLAG_ROLLOVER,
                       port_off, expect_hash_rb[0], expect_hash_rb[1]);
  ret |= test_datapath(PACKET_FANOUT_LB, port_off, expect_lb[0], expect_lb[1]);
  ret |= test_datapath(PACKET_FANOUT_ROLLOVER, port_off, expect_rb[0],
                       expect_rb[1]);
  ret |=
      test_datapath(PACKET_FANOUT_CBPF, port_off, expect_bpf[0], expect_bpf[1]);
  ret |=
      test_datapath(PACKET_FANOUT_EBPF, port_off, expect_bpf[0], expect_bpf[1]);
  set_cpuaffinity(0);
  ret |= test_datapath(PACKET_FANOUT_CPU, port_off, expect_cpu0[0],
                       expect_cpu0[1]);
  if (!set_cpuaffinity(1))
    ret |= test_datapath(PACKET_FANOUT_CPU, port_off, expect_cpu1[0],
                         expect_cpu1[1]);
  ret |= test_datapath(PACKET_FANOUT_FLAG_UNIQUEID, port_off,
                       expect_uniqueid[0], expect_uniqueid[1]);
  if (ret)
    return 1;
  printf("OK. All tests passed\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xe70(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe6d(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe6a(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe67(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xe64(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xe61(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xe3e(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xe3b(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xe48(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xe45(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xe42(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xe3f(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0xe3c(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    0xe39(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    0xe36(%rip),%rax
mov    %rax,-0x90(%rbp)
mov    0xe30(%rip),%rax
mov    %rax,-0x88(%rbp)
movl   $0x2,-0x94(%rbp)
movl   $0x5,-0x98(%rbp)
mov    $0x0,%al
call   1090 <test_control_single@plt>
mov    $0x0,%al
call   1050 <test_control_group@plt>
mov    $0x0,%al
call   1060 <test_unique_fanout_group_ids@plt>
mov    0x2d61(%rip),%rax
mov    (%rax),%edi
mov    -0x94(%rbp),%esi
lea    -0x20(%rbp),%rdx
lea    -0x20(%rbp),%rcx
add    $0x8,%rcx
call   1080 <test_datapath@plt>
mov    %eax,-0x9c(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x9c(%rbp)
mov    %al,-0x9d(%rbp)
je     12c0 <main+0x150>
mov    -0x98(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x98(%rbp)
cmp    $0x0,%eax
setne  %al
mov    %al,-0x9d(%rbp)
mov    -0x9d(%rbp),%al
test   $0x1,%al
jne    12d3 <main+0x163>
jmp    1322 <main+0x1b2>
mov    0x2cde(%rip),%rax
mov    (%rax),%edi
mov    -0x98(%rbp),%edx
lea    0xd87(%rip),%rsi
call   1070 <fprintf@plt>
mov    0x2cdb(%rip),%rax
mov    (%rax),%edi
mov    -0x94(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0x94(%rbp)
lea    -0x20(%rbp),%rdx
lea    -0x20(%rbp),%rcx
add    $0x8,%rcx
call   1080 <test_datapath@plt>
mov    %eax,-0x9c(%rbp)
jmp    128e <main+0x11e>
mov    0x2ca7(%rip),%rax
mov    (%rax),%edi
mov    0x2c76(%rip),%rax
or     (%rax),%edi
mov    -0x94(%rbp),%esi
lea    -0x30(%rbp),%rdx
lea    -0x30(%rbp),%rcx
add    $0x8,%rcx
call   1080 <test_datapath@plt>
or     -0x9c(%rbp),%eax
mov    %eax,-0x9c(%rbp)
mov    0x2c6a(%rip),%rax
mov    (%rax),%edi
mov    -0x94(%rbp),%esi
lea    -0x40(%rbp),%rdx
lea    -0x40(%rbp),%rcx
add    $0x8,%rcx
call   1080 <test_datapath@plt>
or     -0x9c(%rbp),%eax
mov    %eax,-0x9c(%rbp)
mov    0x2c66(%rip),%rax
mov    (%rax),%edi
mov    -0x94(%rbp),%esi
lea    -0x50(%rbp),%rdx
lea    -0x50(%rbp),%rcx
add    $0x8,%rcx
call   1080 <test_datapath@plt>
or     -0x9c(%rbp),%eax
mov    %eax,-0x9c(%rbp)
mov    0x2be2(%rip),%rax
mov    (%rax),%edi
mov    -0x94(%rbp),%esi
lea    -0x80(%rbp),%rdx
lea    -0x80(%rbp),%rcx
add    $0x8,%rcx
call   1080 <test_datapath@plt>
or     -0x9c(%rbp),%eax
mov    %eax,-0x9c(%rbp)
mov    0x2bf6(%rip),%rax
mov    (%rax),%edi
mov    -0x94(%rbp),%esi
lea    -0x80(%rbp),%rdx
lea    -0x80(%rbp),%rcx
add    $0x8,%rcx
call   1080 <test_datapath@plt>
or     -0x9c(%rbp),%eax
mov    %eax,-0x9c(%rbp)
xor    %edi,%edi
call   1030 <set_cpuaffinity@plt>
mov    0x2bd3(%rip),%rax
mov    (%rax),%edi
mov    -0x94(%rbp),%esi
lea    -0x60(%rbp),%rdx
lea    -0x60(%rbp),%rcx
add    $0x8,%rcx
call   1080 <test_datapath@plt>
or     -0x9c(%rbp),%eax
mov    %eax,-0x9c(%rbp)
mov    $0x1,%edi
call   1030 <set_cpuaffinity@plt>
cmp    $0x0,%eax
jne    1479 <main+0x309>
mov    0x2b94(%rip),%rax
mov    (%rax),%edi
mov    -0x94(%rbp),%esi
lea    -0x70(%rbp),%rdx
lea    -0x70(%rbp),%rcx
add    $0x8,%rcx
call   1080 <test_datapath@plt>
or     -0x9c(%rbp),%eax
mov    %eax,-0x9c(%rbp)
mov    0x2b30(%rip),%rax
mov    (%rax),%edi
mov    -0x94(%rbp),%esi
lea    -0x90(%rbp),%rdx
lea    -0x90(%rbp),%rcx
add    $0x8,%rcx
call   1080 <test_datapath@plt>
or     -0x9c(%rbp),%eax
mov    %eax,-0x9c(%rbp)
cmpl   $0x0,-0x9c(%rbp)
je     14c4 <main+0x354>
movl   $0x1,-0x4(%rbp)
jmp    14d7 <main+0x367>
lea    0xbc8(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
movaps 0xe78(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xe8d(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xe71(%rip),%xmm1
movaps %xmm1,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps 0xe80(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xe84(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe88(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe8c(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
xor    %r12d,%r12d
xor    %eax,%eax
call   1090 <test_control_single@plt>
xor    %eax,%eax
call   1050 <test_control_group@plt>
xor    %eax,%eax
call   1060 <test_unique_fanout_group_ids@plt>
mov    0x2dd8(%rip),%rbx
mov    (%rbx),%edi
lea    0x8(%rsp),%rbp
mov    $0x2,%r15d
mov    %rsp,%rdx
mov    $0x2,%esi
mov    %rbp,%rcx
call   1080 <test_datapath@plt>
test   %eax,%eax
je     131a <main+0x1aa>
mov    0x2d94(%rip),%r14
mov    (%r14),%edi
lea    0xe42(%rip),%rsi
mov    $0x4,%edx
call   1070 <fprintf@plt>
mov    (%rbx),%edi
mov    $0x3,%r15d
mov    %rsp,%rdx
mov    $0x3,%esi
mov    %rbp,%rcx
call   1080 <test_datapath@plt>
test   %eax,%eax
je     131a <main+0x1aa>
mov    (%r14),%edi
lea    0xe0e(%rip),%rsi
mov    $0x3,%edx
call   1070 <fprintf@plt>
mov    (%rbx),%edi
mov    %rsp,%rdx
mov    $0x4,%esi
mov    %rbp,%rcx
call   1080 <test_datapath@plt>
test   %eax,%eax
je     1314 <main+0x1a4>
mov    (%r14),%edi
lea    0xde0(%rip),%rsi
mov    $0x2,%edx
call   1070 <fprintf@plt>
mov    (%rbx),%edi
mov    $0x5,%r15d
mov    %rsp,%rdx
mov    $0x5,%esi
mov    %rbp,%rcx
call   1080 <test_datapath@plt>
test   %eax,%eax
je     131a <main+0x1aa>
mov    (%r14),%edi
lea    0xdb0(%rip),%rsi
mov    $0x1,%edx
call   1070 <fprintf@plt>
mov    (%rbx),%edi
mov    $0x6,%r15d
mov    %rsp,%rdx
mov    $0x6,%esi
mov    %rbp,%rcx
call   1080 <test_datapath@plt>
test   %eax,%eax
je     131a <main+0x1aa>
mov    (%r14),%edi
lea    0xd80(%rip),%rsi
xor    %edx,%edx
call   1070 <fprintf@plt>
mov    (%rbx),%edi
mov    $0x7,%r15d
mov    %rsp,%rdx
mov    $0x7,%esi
mov    %rbp,%rcx
call   1080 <test_datapath@plt>
mov    %eax,%r12d
jmp    131a <main+0x1aa>
mov    $0x4,%r15d
mov    0x2c87(%rip),%rax
mov    (%rax),%edi
or     (%rbx),%edi
lea    0x78(%rsp),%rcx
lea    0x70(%rsp),%rdx
mov    %r15d,%esi
call   1080 <test_datapath@plt>
mov    %eax,%ebx
mov    0x2c88(%rip),%rax
mov    (%rax),%edi
lea    0x68(%rsp),%rcx
lea    0x60(%rsp),%rdx
mov    %r15d,%esi
call   1080 <test_datapath@plt>
mov    %eax,%r14d
or     %r12d,%r14d
or     %ebx,%r14d
mov    0x2c8c(%rip),%rax
mov    (%rax),%edi
lea    0x58(%rsp),%rcx
lea    0x50(%rsp),%rdx
mov    %r15d,%esi
call   1080 <test_datapath@plt>
mov    %eax,%r13d
mov    0x2c16(%rip),%rax
mov    (%rax),%edi
lea    0x28(%rsp),%rbp
lea    0x20(%rsp),%r12
mov    %r15d,%esi
mov    %r12,%rdx
mov    %rbp,%rcx
call   1080 <test_datapath@plt>
mov    %eax,%ebx
or     %r13d,%ebx
mov    0x2c30(%rip),%rax
mov    (%rax),%edi
mov    %r15d,%esi
mov    %r12,%rdx
mov    %rbp,%rcx
call   1080 <test_datapath@plt>
mov    %eax,%ebp
or     %ebx,%ebp
or     %r14d,%ebp
xor    %edi,%edi
call   1030 <set_cpuaffinity@plt>
mov    0x2c1b(%rip),%r12
mov    (%r12),%edi
lea    0x48(%rsp),%rcx
lea    0x40(%rsp),%rdx
mov    %r15d,%esi
call   1080 <test_datapath@plt>
mov    %eax,%ebx
or     %ebp,%ebx
mov    $0x1,%r14d
mov    $0x1,%edi
call   1030 <set_cpuaffinity@plt>
test   %eax,%eax
jne    1413 <main+0x2a3>
mov    (%r12),%edi
lea    0x38(%rsp),%rcx
lea    0x30(%rsp),%rdx
mov    %r15d,%esi
call   1080 <test_datapath@plt>
or     %eax,%ebx
mov    0x2b96(%rip),%rax
mov    (%rax),%edi
lea    0x18(%rsp),%rcx
lea    0x10(%rsp),%rdx
mov    %r15d,%esi
call   1080 <test_datapath@plt>
or     %ebx,%eax
jne    1441 <main+0x2d1>
lea    0xc5a(%rip),%rdi
call   1040 <puts@plt>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.expect_hash = [2 x [2 x i32]] [[2 x i32] [i32 15, i32 5], [2 x i32] [i32 20, i32 5]]
@__const.main.expect_hash_rb = [2 x [2 x i32]] [[2 x i32] [i32 15, i32 5], [2 x i32] [i32 20, i32 15]]
@__const.main.expect_lb = [2 x [2 x i32]] [[2 x i32] [i32 10, i32 10], [2 x i32] [i32 18, i32 17]]
@__const.main.expect_rb = [2 x [2 x i32]] [[2 x i32] [i32 15, i32 5], [2 x i32] [i32 20, i32 15]]
@__const.main.expect_cpu0 = [2 x [2 x i32]] [[2 x i32] [i32 20, i32 0], [2 x i32] [i32 20, i32 0]]
@__const.main.expect_cpu1 = [2 x [2 x i32]] [[2 x i32] [i32 0, i32 20], [2 x i32] [i32 0, i32 20]]
@__const.main.expect_bpf = [2 x [2 x i32]] [[2 x i32] [i32 15, i32 5], [2 x i32] [i32 15, i32 20]]
@__const.main.expect_uniqueid = [2 x [2 x i32]] [[2 x i32] [i32 20, i32 20], [2 x i32] [i32 20, i32 20]]
@PACKET_FANOUT_HASH = global i32 0
@stderr = global i32 0
@.str = [35 x i8] c"info: trying alternate ports (%d)\0A\00"
@PACKET_FANOUT_FLAG_ROLLOVER = global i32 0
@PACKET_FANOUT_LB = global i32 0
@PACKET_FANOUT_ROLLOVER = global i32 0
@PACKET_FANOUT_CBPF = global i32 0
@PACKET_FANOUT_EBPF = global i32 0
@PACKET_FANOUT_CPU = global i32 0
@PACKET_FANOUT_FLAG_UNIQUEID = global i32 0
@.str.1 = [22 x i8] c"OK. All tests passed\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [2 x [2 x i32]]
%7 = alloca [2 x [2 x i32]]
%8 = alloca [2 x [2 x i32]]
%9 = alloca [2 x [2 x i32]]
%10 = alloca [2 x [2 x i32]]
%11 = alloca [2 x [2 x i32]]
%12 = alloca [2 x [2 x i32]]
%13 = alloca [2 x [2 x i32]]
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = bitcast [2 x [2 x i32]]* %6 to i8*
%18 = bitcast [2 x [2 x i32]]* %7 to i8*
%19 = bitcast [2 x [2 x i32]]* %8 to i8*
%20 = bitcast [2 x [2 x i32]]* %9 to i8*
%21 = bitcast [2 x [2 x i32]]* %10 to i8*
%22 = bitcast [2 x [2 x i32]]* %11 to i8*
%23 = bitcast [2 x [2 x i32]]* %12 to i8*
%24 = bitcast [2 x [2 x i32]]* %13 to i8*
store i32 2, i32* %14
store i32 5, i32* %15
%25 = call i32 (...) @test_control_single()
%26 = call i32 (...) @test_control_group()
%27 = call i32 (...) @test_unique_fanout_group_ids()
%28 = load i32, i32* @PACKET_FANOUT_HASH
%29 = load i32, i32* %14
%30 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %6, i64 0, i64 0
%31 = getelementptr inbounds [2 x i32], [2 x i32]* %30, i64 0, i64 0
%32 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %6, i64 0, i64 1
%33 = getelementptr inbounds [2 x i32], [2 x i32]* %32, i64 0, i64 0
%34 = call i32 @test_datapath(i32 %28, i32 %29, i32* %31, i32* %33)
store i32 %34, i32* %16
br label %35
35: ; preds = %44, %2
%36 = load i32, i32* %16
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %42
38: ; preds = %35
%39 = load i32, i32* %15
%40 = add nsw i32 %39, -1
store i32 %40, i32* %15
%41 = icmp ne i32 %39, 0
br label %42
42: ; preds = %38, %35
%43 = phi i1 [ false, %35 ], [ %41, %38 ]
br i1 %43, label %44, label %56
44: ; preds = %42
%45 = load i32, i32* @stderr
%46 = load i32, i32* %15
%47 = call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %46)
%48 = load i32, i32* @PACKET_FANOUT_HASH
%49 = load i32, i32* %14
%50 = add nsw i32 %49, 1
store i32 %50, i32* %14
%51 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %6, i64 0, i64 0
%52 = getelementptr inbounds [2 x i32], [2 x i32]* %51, i64 0, i64 0
%53 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %6, i64 0, i64 1
%54 = getelementptr inbounds [2 x i32], [2 x i32]* %53, i64 0, i64 0
%55 = call i32 @test_datapath(i32 %48, i32 %50, i32* %52, i32* %54)
store i32 %55, i32* %16
br label %35
56: ; preds = %42
%57 = load i32, i32* @PACKET_FANOUT_HASH
%58 = load i32, i32* @PACKET_FANOUT_FLAG_ROLLOVER
%59 = or i32 %57, %58
%60 = load i32, i32* %14
%61 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %7, i64 0, i64 0
%62 = getelementptr inbounds [2 x i32], [2 x i32]* %61, i64 0, i64 0
%63 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %7, i64 0, i64 1
%64 = getelementptr inbounds [2 x i32], [2 x i32]* %63, i64 0, i64 0
%65 = call i32 @test_datapath(i32 %59, i32 %60, i32* %62, i32* %64)
%66 = load i32, i32* %16
%67 = or i32 %66, %65
store i32 %67, i32* %16
%68 = load i32, i32* @PACKET_FANOUT_LB
%69 = load i32, i32* %14
%70 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %8, i64 0, i64 0
%71 = getelementptr inbounds [2 x i32], [2 x i32]* %70, i64 0, i64 0
%72 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %8, i64 0, i64 1
%73 = getelementptr inbounds [2 x i32], [2 x i32]* %72, i64 0, i64 0
%74 = call i32 @test_datapath(i32 %68, i32 %69, i32* %71, i32* %73)
%75 = load i32, i32* %16
%76 = or i32 %75, %74
store i32 %76, i32* %16
%77 = load i32, i32* @PACKET_FANOUT_ROLLOVER
%78 = load i32, i32* %14
%79 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %9, i64 0, i64 0
%80 = getelementptr inbounds [2 x i32], [2 x i32]* %79, i64 0, i64 0
%81 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %9, i64 0, i64 1
%82 = getelementptr inbounds [2 x i32], [2 x i32]* %81, i64 0, i64 0
%83 = call i32 @test_datapath(i32 %77, i32 %78, i32* %80, i32* %82)
%84 = load i32, i32* %16
%85 = or i32 %84, %83
store i32 %85, i32* %16
%86 = load i32, i32* @PACKET_FANOUT_CBPF
%87 = load i32, i32* %14
%88 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %12, i64 0, i64 0
%89 = getelementptr inbounds [2 x i32], [2 x i32]* %88, i64 0, i64 0
%90 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %12, i64 0, i64 1
%91 = getelementptr inbounds [2 x i32], [2 x i32]* %90, i64 0, i64 0
%92 = call i32 @test_datapath(i32 %86, i32 %87, i32* %89, i32* %91)
%93 = load i32, i32* %16
%94 = or i32 %93, %92
store i32 %94, i32* %16
%95 = load i32, i32* @PACKET_FANOUT_EBPF
%96 = load i32, i32* %14
%97 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %12, i64 0, i64 0
%98 = getelementptr inbounds [2 x i32], [2 x i32]* %97, i64 0, i64 0
%99 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %12, i64 0, i64 1
%100 = getelementptr inbounds [2 x i32], [2 x i32]* %99, i64 0, i64 0
%101 = call i32 @test_datapath(i32 %95, i32 %96, i32* %98, i32* %100)
%102 = load i32, i32* %16
%103 = or i32 %102, %101
store i32 %103, i32* %16
%104 = call i32 @set_cpuaffinity(i32 0)
%105 = load i32, i32* @PACKET_FANOUT_CPU
%106 = load i32, i32* %14
%107 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %10, i64 0, i64 0
%108 = getelementptr inbounds [2 x i32], [2 x i32]* %107, i64 0, i64 0
%109 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %10, i64 0, i64 1
%110 = getelementptr inbounds [2 x i32], [2 x i32]* %109, i64 0, i64 0
%111 = call i32 @test_datapath(i32 %105, i32 %106, i32* %108, i32* %110)
%112 = load i32, i32* %16
%113 = or i32 %112, %111
store i32 %113, i32* %16
%114 = call i32 @set_cpuaffinity(i32 1)
%115 = icmp ne i32 %114, 0
br i1 %115, label %126, label %116
116: ; preds = %56
%117 = load i32, i32* @PACKET_FANOUT_CPU
%118 = load i32, i32* %14
%119 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %11, i64 0, i64 0
%120 = getelementptr inbounds [2 x i32], [2 x i32]* %119, i64 0, i64 0
%121 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %11, i64 0, i64 1
%122 = getelementptr inbounds [2 x i32], [2 x i32]* %121, i64 0, i64 0
%123 = call i32 @test_datapath(i32 %117, i32 %118, i32* %120, i32* %122)
%124 = load i32, i32* %16
%125 = or i32 %124, %123
store i32 %125, i32* %16
br label %126
126: ; preds = %116, %56
%127 = load i32, i32* @PACKET_FANOUT_FLAG_UNIQUEID
%128 = load i32, i32* %14
%129 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %13, i64 0, i64 0
%130 = getelementptr inbounds [2 x i32], [2 x i32]* %129, i64 0, i64 0
%131 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %13, i64 0, i64 1
%132 = getelementptr inbounds [2 x i32], [2 x i32]* %131, i64 0, i64 0
%133 = call i32 @test_datapath(i32 %127, i32 %128, i32* %130, i32* %132)
%134 = load i32, i32* %16
%135 = or i32 %134, %133
store i32 %135, i32* %16
%136 = load i32, i32* %16
%137 = icmp ne i32 %136, 0
br i1 %137, label %138, label %139
138: ; preds = %126
store i32 1, i32* %3
br label %141
139: ; preds = %126
%140 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %141
141: ; preds = %139, %138
%142 = load i32, i32* %3
ret i32 %142
}

LLVM IR (-O2):
@__const.main.expect_hash = [2 x [2 x i32]] [[2 x i32] [i32 15, i32 5], [2 x i32] [i32 20, i32 5]]
@__const.main.expect_lb = [2 x [2 x i32]] [[2 x i32] [i32 10, i32 10], [2 x i32] [i32 18, i32 17]]
@__const.main.expect_rb = [2 x [2 x i32]] [[2 x i32] [i32 15, i32 5], [2 x i32] [i32 20, i32 15]]
@__const.main.expect_cpu0 = [2 x [2 x i32]] [[2 x i32] [i32 20, i32 0], [2 x i32] [i32 20, i32 0]]
@__const.main.expect_cpu1 = [2 x [2 x i32]] [[2 x i32] [i32 0, i32 20], [2 x i32] [i32 0, i32 20]]
@__const.main.expect_bpf = [2 x [2 x i32]] [[2 x i32] [i32 15, i32 5], [2 x i32] [i32 15, i32 20]]
@__const.main.expect_uniqueid = [2 x [2 x i32]] [[2 x i32] [i32 20, i32 20], [2 x i32] [i32 20, i32 20]]
@PACKET_FANOUT_HASH = global i32 0
@stderr = global i32 0
@.str = [35 x i8] c"info: trying alternate ports (%d)\0A\00"
@PACKET_FANOUT_FLAG_ROLLOVER = global i32 0
@PACKET_FANOUT_LB = global i32 0
@PACKET_FANOUT_ROLLOVER = global i32 0
@PACKET_FANOUT_CBPF = global i32 0
@PACKET_FANOUT_EBPF = global i32 0
@PACKET_FANOUT_CPU = global i32 0
@PACKET_FANOUT_FLAG_UNIQUEID = global i32 0
@str = [21 x i8] c"OK. All tests passed\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [2 x [2 x i32]]
%4 = alloca [2 x [2 x i32]]
%5 = alloca [2 x [2 x i32]]
%6 = alloca [2 x [2 x i32]]
%7 = alloca [2 x [2 x i32]]
%8 = alloca [2 x [2 x i32]]
%9 = alloca [2 x [2 x i32]]
%10 = alloca [2 x [2 x i32]]
%11 = bitcast [2 x [2 x i32]]* %3 to i8*
%12 = bitcast [2 x [2 x i32]]* %4 to i8*
%13 = bitcast [2 x [2 x i32]]* %5 to i8*
%14 = bitcast [2 x [2 x i32]]* %6 to i8*
%15 = bitcast [2 x [2 x i32]]* %7 to i8*
%16 = bitcast [2 x [2 x i32]]* %8 to i8*
%17 = bitcast [2 x [2 x i32]]* %9 to i8*
%18 = bitcast [2 x [2 x i32]]* %10 to i8*
%19 = tail call i32 (...) @test_control_single()
%20 = tail call i32 (...) @test_control_group()
%21 = tail call i32 (...) @test_unique_fanout_group_ids()
%22 = load i32, i32* @PACKET_FANOUT_HASH
%23 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 0, i64 0
%24 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %3, i64 0, i64 1, i64 0
%25 = call i32 @test_datapath(i32 %22, i32 2, i32* %23, i32* %24)
%26 = icmp eq i32 %25, 0
br i1 %26, label %56, label %27
27: ; preds = %2
%28 = load i32, i32* @stderr
%29 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 4)
%30 = load i32, i32* @PACKET_FANOUT_HASH
%31 = call i32 @test_datapath(i32 %30, i32 3, i32* %23, i32* %24)
%32 = icmp eq i32 %31, 0
br i1 %32, label %56, label %33
33: ; preds = %27
%34 = load i32, i32* @stderr
%35 = call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 3)
%36 = load i32, i32* @PACKET_FANOUT_HASH
%37 = call i32 @test_datapath(i32 %36, i32 4, i32* %23, i32* %24)
%38 = icmp eq i32 %37, 0
br i1 %38, label %56, label %39
39: ; preds = %33
%40 = load i32, i32* @stderr
%41 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 2)
%42 = load i32, i32* @PACKET_FANOUT_HASH
%43 = call i32 @test_datapath(i32 %42, i32 5, i32* %23, i32* %24)
%44 = icmp eq i32 %43, 0
br i1 %44, label %56, label %45
45: ; preds = %39
%46 = load i32, i32* @stderr
%47 = call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 1)
%48 = load i32, i32* @PACKET_FANOUT_HASH
%49 = call i32 @test_datapath(i32 %48, i32 6, i32* %23, i32* %24)
%50 = icmp eq i32 %49, 0
br i1 %50, label %56, label %51
51: ; preds = %45
%52 = load i32, i32* @stderr
%53 = call i32 @fprintf(i32 %52, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 0)
%54 = load i32, i32* @PACKET_FANOUT_HASH
%55 = call i32 @test_datapath(i32 %54, i32 7, i32* %23, i32* %24)
br label %56
56: ; preds = %51, %27, %33, %39, %45, %2
%57 = phi i32 [ 2, %2 ], [ 3, %27 ], [ 4, %33 ], [ 5, %39 ], [ 6, %45 ], [ 7, %51 ]
%58 = phi i32 [ 0, %2 ], [ 0, %27 ], [ 0, %33 ], [ 0, %39 ], [ 0, %45 ], [ %55, %51 ]
%59 = load i32, i32* @PACKET_FANOUT_HASH
%60 = load i32, i32* @PACKET_FANOUT_FLAG_ROLLOVER
%61 = or i32 %60, %59
%62 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %4, i64 0, i64 0, i64 0
%63 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %4, i64 0, i64 1, i64 0
%64 = call i32 @test_datapath(i32 %61, i32 %57, i32* %62, i32* %63)
%65 = or i32 %64, %58
%66 = load i32, i32* @PACKET_FANOUT_LB
%67 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %5, i64 0, i64 0, i64 0
%68 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %5, i64 0, i64 1, i64 0
%69 = call i32 @test_datapath(i32 %66, i32 %57, i32* %67, i32* %68)
%70 = or i32 %65, %69
%71 = load i32, i32* @PACKET_FANOUT_ROLLOVER
%72 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %6, i64 0, i64 0, i64 0
%73 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %6, i64 0, i64 1, i64 0
%74 = call i32 @test_datapath(i32 %71, i32 %57, i32* %72, i32* %73)
%75 = or i32 %70, %74
%76 = load i32, i32* @PACKET_FANOUT_CBPF
%77 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %9, i64 0, i64 0, i64 0
%78 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %9, i64 0, i64 1, i64 0
%79 = call i32 @test_datapath(i32 %76, i32 %57, i32* %77, i32* %78)
%80 = or i32 %75, %79
%81 = load i32, i32* @PACKET_FANOUT_EBPF
%82 = call i32 @test_datapath(i32 %81, i32 %57, i32* %77, i32* %78)
%83 = or i32 %80, %82
%84 = call i32 @set_cpuaffinity(i32 0)
%85 = load i32, i32* @PACKET_FANOUT_CPU
%86 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %7, i64 0, i64 0, i64 0
%87 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %7, i64 0, i64 1, i64 0
%88 = call i32 @test_datapath(i32 %85, i32 %57, i32* %86, i32* %87)
%89 = or i32 %83, %88
%90 = call i32 @set_cpuaffinity(i32 1)
%91 = icmp eq i32 %90, 0
br i1 %91, label %92, label %98
92: ; preds = %56
%93 = load i32, i32* @PACKET_FANOUT_CPU
%94 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %8, i64 0, i64 0, i64 0
%95 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %8, i64 0, i64 1, i64 0
%96 = call i32 @test_datapath(i32 %93, i32 %57, i32* %94, i32* %95)
%97 = or i32 %96, %89
br label %98
98: ; preds = %92, %56
%99 = phi i32 [ %89, %56 ], [ %97, %92 ]
%100 = load i32, i32* @PACKET_FANOUT_FLAG_UNIQUEID
%101 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %10, i64 0, i64 0, i64 0
%102 = getelementptr inbounds [2 x [2 x i32]], [2 x [2 x i32]]* %10, i64 0, i64 1, i64 0
%103 = call i32 @test_datapath(i32 %100, i32 %57, i32* %101, i32* %102)
%104 = or i32 %103, %99
%105 = icmp eq i32 %104, 0
br i1 %105, label %106, label %108
106: ; preds = %98
%107 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
br label %108
108: ; preds = %98, %106
%109 = phi i32 [ 0, %106 ], [ 1, %98 ]
ret i32 %109
}