int luby_mis(unsigned nneigh, int const neigh[], int in_V) {
  unsigned pi;
  unsigned neighpi;
  unsigned i;
  int in_Vp;
  int neigh_in_Vp;
  int in_I;
  int neigh_in_I;
  int any_neigh_in_I;
  int in_Ip;
  int is_min;
  int neigh_in_Ip;
  int in_Y;
  mersenne_twister_seed((unsigned)(comm_rank() + 1));
  in_I = 0;
  in_Vp = in_V;
  while (mpi_max_int(comm_mpi(), in_Vp)) {
    pi = mersenne_twister();
    for (i = 0; i < nneigh; ++i) {
      comm_pack(&(in_Vp), sizeof(in_Vp), neigh[i]);
      comm_pack(&(pi), sizeof(pi), neigh[i]);
    }
    comm_exch();
    is_min = 1;
    while (comm_recv()) {
      comm_unpack(&(neigh_in_Vp), sizeof(neigh_in_Vp));
      comm_unpack(&(neighpi), sizeof(neighpi));
      if (neigh_in_Vp && (!(pi < neighpi)))
        is_min = 0;
    }
    in_Ip = in_Vp && is_min;
    in_I = in_I || in_Ip;
    for (i = 0; i < nneigh; ++i)
      comm_pack(&(in_Ip), sizeof(in_Ip), neigh[i]);
    comm_exch();
    in_Y = in_Ip;
    while (comm_recv()) {
      comm_unpack(&(neigh_in_Ip), sizeof(neigh_in_Ip));
      if (in_Vp && neigh_in_Ip)
        in_Y = 1;
    }
    in_Vp = in_Vp && (!in_Y);
  }
  for (i = 0; i < nneigh; ++i)
    comm_pack(&(in_I), sizeof(in_I), neigh[i]);
  comm_exch();
  any_neigh_in_I = 0;
  while (comm_recv()) {
    comm_unpack(&(neigh_in_I), sizeof(neigh_in_I));
    for (i = 0; i < nneigh; ++i) {
      if (neigh[i] == comm_from())
        break;
      if (neigh[i] == comm_rank())
        die("luby_mis: %d is neighbor with self\n", comm_rank());
    }
    if (i == nneigh)
      die("luby_mis: graph not symmetric. %d unexpected neighbor %d\n",
          comm_rank(), comm_from());
    if (in_I && neigh_in_I)
      die("luby_mis: bug: not independent. %d and %d adjacent and in set\n",
          comm_rank(), comm_from());
    if (neigh_in_I)
      any_neigh_in_I = 1;
  }
  if ((!any_neigh_in_I) && (!in_I) && in_V)
    die("luby_mis: bug: not maximal. %d could have been taken but wasn't\n",
        comm_rank());
  return in_I;
}


x86 assembly (clang, -O0):
<luby_mis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0x0,%al
call   1060 <comm_rank@plt>
mov    %eax,%edi
add    $0x1,%edi
mov    $0x0,%al
call   1070 <mersenne_twister_seed@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    $0x0,%al
call   1050 <comm_mpi@plt>
mov    %eax,%edi
mov    -0x24(%rbp),%esi
mov    $0x0,%al
call   1040 <mpi_max_int@plt>
cmp    $0x0,%eax
je     13b8 <luby_mis+0x208>
mov    $0x0,%al
call   10c0 <mersenne_twister@plt>
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    125d <luby_mis+0xad>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
mov    (%rax,%rcx,4),%edx
lea    -0x24(%rbp),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1080 <comm_pack@plt>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
mov    (%rax,%rcx,4),%edx
lea    -0x18(%rbp),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1080 <comm_pack@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    120f <luby_mis+0x5f>
mov    $0x0,%al
call   10d0 <comm_exch@plt>
movl   $0x1,-0x3c(%rbp)
mov    $0x0,%al
call   1030 <comm_recv@plt>
cmp    $0x0,%eax
je     12bd <luby_mis+0x10d>
lea    -0x28(%rbp),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1090 <comm_unpack@plt>
lea    -0x1c(%rbp),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1090 <comm_unpack@plt>
cmpl   $0x0,-0x28(%rbp)
je     12b8 <luby_mis+0x108>
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jb     12b8 <luby_mis+0x108>
movl   $0x0,-0x3c(%rbp)
jmp    126b <luby_mis+0xbb>
xor    %eax,%eax
cmpl   $0x0,-0x24(%rbp)
mov    %al,-0x45(%rbp)
je     12d6 <luby_mis+0x126>
cmpl   $0x0,-0x3c(%rbp)
setne  %al
mov    %al,-0x45(%rbp)
mov    -0x45(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x38(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x2c(%rbp)
mov    %al,-0x46(%rbp)
jne    12fa <luby_mis+0x14a>
cmpl   $0x0,-0x38(%rbp)
setne  %al
mov    %al,-0x46(%rbp)
mov    -0x46(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x2c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    1340 <luby_mis+0x190>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
mov    (%rax,%rcx,4),%edx
lea    -0x38(%rbp),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1080 <comm_pack@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    130c <luby_mis+0x15c>
mov    $0x0,%al
call   10d0 <comm_exch@plt>
mov    -0x38(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    $0x0,%al
call   1030 <comm_recv@plt>
cmp    $0x0,%eax
je     138d <luby_mis+0x1dd>
lea    -0x40(%rbp),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1090 <comm_unpack@plt>
cmpl   $0x0,-0x24(%rbp)
je     1388 <luby_mis+0x1d8>
cmpl   $0x0,-0x40(%rbp)
je     1388 <luby_mis+0x1d8>
movl   $0x1,-0x44(%rbp)
jmp    134d <luby_mis+0x19d>
xor    %eax,%eax
cmpl   $0x0,-0x24(%rbp)
mov    %al,-0x47(%rbp)
je     13a8 <luby_mis+0x1f8>
cmpl   $0x0,-0x44(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x47(%rbp)
mov    -0x47(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x24(%rbp)
jmp    11e2 <luby_mis+0x32>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    13f3 <luby_mis+0x243>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
mov    (%rax,%rcx,4),%edx
lea    -0x2c(%rbp),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1080 <comm_pack@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    13bf <luby_mis+0x20f>
mov    $0x0,%al
call   10d0 <comm_exch@plt>
movl   $0x0,-0x34(%rbp)
mov    $0x0,%al
call   1030 <comm_recv@plt>
cmp    $0x0,%eax
je     1523 <luby_mis+0x373>
lea    -0x30(%rbp),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1090 <comm_unpack@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    14a5 <luby_mis+0x2f5>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x4c(%rbp)
mov    $0x0,%al
call   10b0 <comm_from@plt>
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
cmp    %ecx,%eax
jne    145a <luby_mis+0x2aa>
jmp    14a5 <luby_mis+0x2f5>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x50(%rbp)
mov    $0x0,%al
call   1060 <comm_rank@plt>
mov    %eax,%ecx
mov    -0x50(%rbp),%eax
cmp    %ecx,%eax
jne    1492 <luby_mis+0x2e2>
mov    $0x0,%al
call   1060 <comm_rank@plt>
mov    %eax,%esi
lea    0xb75(%rip),%rdi
mov    $0x0,%al
call   10a0 <die@plt>
jmp    1497 <luby_mis+0x2e7>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1428 <luby_mis+0x278>
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jne    14d5 <luby_mis+0x325>
mov    $0x0,%al
call   1060 <comm_rank@plt>
mov    %eax,-0x54(%rbp)
mov    $0x0,%al
call   10b0 <comm_from@plt>
mov    -0x54(%rbp),%esi
mov    %eax,%edx
lea    0xb56(%rip),%rdi
mov    $0x0,%al
call   10a0 <die@plt>
cmpl   $0x0,-0x2c(%rbp)
je     150d <luby_mis+0x35d>
cmpl   $0x0,-0x30(%rbp)
je     150d <luby_mis+0x35d>
mov    $0x0,%al
call   1060 <comm_rank@plt>
mov    %eax,-0x58(%rbp)
mov    $0x0,%al
call   10b0 <comm_from@plt>
mov    -0x58(%rbp),%esi
mov    %eax,%edx
lea    0xb58(%rip),%rdi
mov    $0x0,%al
call   10a0 <die@plt>
cmpl   $0x0,-0x30(%rbp)
je     151e <luby_mis+0x36e>
movl   $0x1,-0x34(%rbp)
jmp    1401 <luby_mis+0x251>
cmpl   $0x0,-0x34(%rbp)
jne    1558 <luby_mis+0x3a8>
cmpl   $0x0,-0x2c(%rbp)
jne    1558 <luby_mis+0x3a8>
cmpl   $0x0,-0x14(%rbp)
je     1558 <luby_mis+0x3a8>
mov    $0x0,%al
call   1060 <comm_rank@plt>
mov    %eax,%esi
lea    0xb4c(%rip),%rdi
mov    $0x0,%al
call   10a0 <die@plt>
mov    -0x2c(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<luby_mis>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %edx,%ebx
mov    %rsi,%r15
mov    %edi,%ebp
xor    %eax,%eax
call   1060 <comm_rank@plt>
lea    0x1(%rax),%edi
xor    %eax,%eax
call   1070 <mersenne_twister_seed@plt>
movl   $0x0,0x14(%rsp)
mov    %ebx,0xc(%rsp)
xor    %eax,%eax
call   1050 <comm_mpi@plt>
mov    %eax,%edi
mov    %ebx,0x28(%rsp)
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <mpi_max_int@plt>
mov    %ebp,0x10(%rsp)
mov    %ebp,%r13d
test   %eax,%eax
je     13f1 <luby_mis+0x241>
lea    0x18(%rsp),%rax
lea    0xc(%rsp),%r12
movl   $0x0,0x1c(%rsp)
jmp    1257 <luby_mis+0xa7>
nopl   0x0(%rax,%rax,1)
cmpl   $0x0,0xc(%rsp)
setne  %al
test   %ebp,%ebp
sete   %cl
and    %al,%cl
movzbl %cl,%eax
mov    %eax,0xc(%rsp)
xor    %eax,%eax
call   1050 <comm_mpi@plt>
mov    0xc(%rsp),%esi
mov    %eax,%edi
xor    %eax,%eax
call   1040 <mpi_max_int@plt>
test   %eax,%eax
lea    0x18(%rsp),%rax
je     13f1 <luby_mis+0x241>
mov    %rax,%rbx
xor    %eax,%eax
call   10c0 <mersenne_twister@plt>
mov    %eax,0x24(%rsp)
cmpl   $0x0,0x10(%rsp)
mov    %r13,%r14
lea    0x24(%rsp),%r13
je     12af <luby_mis+0xff>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    (%r15,%rbp,4),%edx
mov    $0x4,%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1080 <comm_pack@plt>
mov    (%r15,%rbp,4),%edx
mov    $0x4,%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1080 <comm_pack@plt>
add    $0x1,%rbp
cmp    %rbp,%r14
jne    1280 <luby_mis+0xd0>
xor    %eax,%eax
call   10d0 <comm_exch@plt>
xor    %eax,%eax
call   1030 <comm_recv@plt>
mov    $0x1,%ebp
test   %eax,%eax
je     1330 <luby_mis+0x180>
lea    0x34(%rsp),%r12
mov    %r14,%r13
mov    %rbx,%r14
lea    0x30(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    $0x4,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1090 <comm_unpack@plt>
mov    $0x4,%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1090 <comm_unpack@plt>
mov    0x24(%rsp),%eax
cmp    0x34(%rsp),%eax
mov    $0x0,%eax
cmovb  %ebp,%eax
cmpl   $0x0,0x30(%rsp)
cmovne %eax,%ebp
xor    %eax,%eax
call   1030 <comm_recv@plt>
test   %eax,%eax
jne    12e0 <luby_mis+0x130>
jmp    1336 <luby_mis+0x186>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%r13
mov    %rbx,%r14
cmpl   $0x0,0xc(%rsp)
setne  %al
test   %ebp,%ebp
setne  %cl
and    %al,%cl
cmpl   $0x0,0x1c(%rsp)
setne  %al
or     %cl,%al
movzbl %cl,%ecx
mov    %ecx,0x18(%rsp)
movzbl %al,%eax
mov    %eax,0x1c(%rsp)
mov    %eax,0x14(%rsp)
cmpl   $0x0,0x10(%rsp)
je     138c <luby_mis+0x1dc>
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rbp,4),%edx
mov    $0x4,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1080 <comm_pack@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1370 <luby_mis+0x1c0>
xor    %eax,%eax
call   10d0 <comm_exch@plt>
mov    0x18(%rsp),%ebp
xor    %eax,%eax
call   1030 <comm_recv@plt>
test   %eax,%eax
lea    0xc(%rsp),%r12
je     1220 <luby_mis+0x70>
lea    0x2c(%rsp),%r14
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x4,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1090 <comm_unpack@plt>
cmpl   $0x0,0x2c(%rsp)
mov    %ebp,%eax
cmovne %ebx,%eax
cmpl   $0x0,0xc(%rsp)
cmovne %eax,%ebp
xor    %eax,%eax
call   1030 <comm_recv@plt>
test   %eax,%eax
jne    13c0 <luby_mis+0x210>
jmp    1220 <luby_mis+0x70>
cmpl   $0x0,0x10(%rsp)
je     141c <luby_mis+0x26c>
lea    0x14(%rsp),%r14
xor    %ebp,%ebp
nop
mov    (%r15,%rbp,4),%edx
mov    $0x4,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1080 <comm_pack@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1400 <luby_mis+0x250>
xor    %eax,%eax
call   10d0 <comm_exch@plt>
xor    %eax,%eax
call   1030 <comm_recv@plt>
test   %eax,%eax
je     1542 <luby_mis+0x392>
xor    %r12d,%r12d
jmp    145a <luby_mis+0x2aa>
nopw   0x0(%rax,%rax,1)
test   %eax,%eax
mov    $0x1,%eax
cmovne %eax,%r12d
xor    %eax,%eax
call   1030 <comm_recv@plt>
test   %eax,%eax
je     153a <luby_mis+0x38a>
xor    %ebp,%ebp
mov    $0x4,%esi
lea    0x20(%rsp),%rdi
xor    %eax,%eax
call   1090 <comm_unpack@plt>
cmpl   $0x0,0x10(%rsp)
je     14d0 <luby_mis+0x320>
xor    %ebp,%ebp
jmp    1489 <luby_mis+0x2d9>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    %rbp,%r13
je     14d6 <luby_mis+0x326>
mov    (%r15,%rbp,4),%r14d
xor    %eax,%eax
call   10b0 <comm_from@plt>
cmp    %eax,%r14d
je     14d0 <luby_mis+0x320>
mov    (%r15,%rbp,4),%ebx
xor    %eax,%eax
call   1060 <comm_rank@plt>
cmp    %eax,%ebx
jne    1480 <luby_mis+0x2d0>
xor    %eax,%eax
call   1060 <comm_rank@plt>
lea    0xb4a(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   10a0 <die@plt>
jmp    1480 <luby_mis+0x2d0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    0x10(%rsp),%ebp
jne    14f8 <luby_mis+0x348>
xor    %eax,%eax
call   1060 <comm_rank@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   10b0 <comm_from@plt>
lea    0xb37(%rip),%rdi
mov    %ebp,%esi
mov    %eax,%edx
xor    %eax,%eax
call   10a0 <die@plt>
cmpl   $0x0,0x14(%rsp)
mov    0x20(%rsp),%eax
je     1440 <luby_mis+0x290>
test   %eax,%eax
je     1440 <luby_mis+0x290>
xor    %eax,%eax
call   1060 <comm_rank@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   10b0 <comm_from@plt>
lea    0xb38(%rip),%rdi
mov    %ebp,%esi
mov    %eax,%edx
xor    %eax,%eax
call   10a0 <die@plt>
mov    0x20(%rsp),%eax
jmp    1440 <luby_mis+0x290>
test   %r12d,%r12d
sete   %cl
jmp    1544 <luby_mis+0x394>
mov    $0x1,%cl
mov    0x14(%rsp),%eax
cmpl   $0x0,0x28(%rsp)
je     1572 <luby_mis+0x3c2>
test   %cl,%cl
je     1572 <luby_mis+0x3c2>
test   %eax,%eax
jne    1572 <luby_mis+0x3c2>
xor    %eax,%eax
call   1060 <comm_rank@plt>
lea    0xb38(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   10a0 <die@plt>
mov    0x14(%rsp),%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [36 x i8] c"luby_mis: %d is neighbor with self\0A\00"
@.str.1 = [58 x i8] c"luby_mis: graph not symmetric. %d unexpected neighbor %d\0A\00"
@.str.2 = [63 x i8] c"luby_mis: bug: not independent. %d and %d adjacent and in set\0A\00"
@.str.3 = [65 x i8] c"luby_mis: bug: not maximal. %d could have been taken but wasn't\0A\00"
define i32 @luby_mis(i32 %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%19 = call i32 (...) @comm_rank()
%20 = add nsw i32 %19, 1
%21 = call i32 (i32, ...) bitcast (i32 (...)* @mersenne_twister_seed to i32 (i32, ...)*)(i32 %20)
store i32 0, i32* %12
%22 = load i32, i32* %6
store i32 %22, i32* %10
br label %23
23: ; preds = %119, %3
%24 = call i32 (...) @comm_mpi()
%25 = load i32, i32* %10
%26 = call i32 (i32, i32, ...) bitcast (i32 (...)* @mpi_max_int to i32 (i32, i32, ...)*)(i32 %24, i32 %25)
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %122
28: ; preds = %23
%29 = call i32 (...) @mersenne_twister()
store i32 %29, i32* %7
store i32 0, i32* %9
br label %30
30: ; preds = %47, %28
%31 = load i32, i32* %9
%32 = load i32, i32* %4
%33 = icmp ult i32 %31, %32
br i1 %33, label %34, label %50
34: ; preds = %30
%35 = load i32*, i32** %5
%36 = load i32, i32* %9
%37 = zext i32 %36 to i64
%38 = getelementptr inbounds i32, i32* %35, i64 %37
%39 = load i32, i32* %38
%40 = call i32 (i32*, i64, i32, ...) bitcast (i32 (...)* @comm_pack to i32 (i32*, i64, i32, ...)*)(i32* %10, i64 4, i32 %39)
%41 = load i32*, i32** %5
%42 = load i32, i32* %9
%43 = zext i32 %42 to i64
%44 = getelementptr inbounds i32, i32* %41, i64 %43
%45 = load i32, i32* %44
%46 = call i32 (i32*, i64, i32, ...) bitcast (i32 (...)* @comm_pack to i32 (i32*, i64, i32, ...)*)(i32* %7, i64 4, i32 %45)
br label %47
47: ; preds = %34
%48 = load i32, i32* %9
%49 = add i32 %48, 1
store i32 %49, i32* %9
br label %30
50: ; preds = %30
%51 = call i32 (...) @comm_exch()
store i32 1, i32* %16
br label %52
52: ; preds = %65, %50
%53 = call i32 (...) @comm_recv()
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %66
55: ; preds = %52
%56 = call i32 (i32*, i64, ...) bitcast (i32 (...)* @comm_unpack to i32 (i32*, i64, ...)*)(i32* %11, i64 4)
%57 = call i32 (i32*, i64, ...) bitcast (i32 (...)* @comm_unpack to i32 (i32*, i64, ...)*)(i32* %8, i64 4)
%58 = load i32, i32* %11
%59 = icmp ne i32 %58, 0
br i1 %59, label %60, label %65
60: ; preds = %55
%61 = load i32, i32* %7
%62 = load i32, i32* %8
%63 = icmp ult i32 %61, %62
br i1 %63, label %65, label %64
64: ; preds = %60
store i32 0, i32* %16
br label %65
65: ; preds = %64, %60, %55
br label %52
66: ; preds = %52
%67 = load i32, i32* %10
%68 = icmp ne i32 %67, 0
br i1 %68, label %69, label %72
69: ; preds = %66
%70 = load i32, i32* %16
%71 = icmp ne i32 %70, 0
br label %72
72: ; preds = %69, %66
%73 = phi i1 [ false, %66 ], [ %71, %69 ]
%74 = zext i1 %73 to i32
store i32 %74, i32* %15
%75 = load i32, i32* %12
%76 = icmp ne i32 %75, 0
br i1 %76, label %80, label %77
77: ; preds = %72
%78 = load i32, i32* %15
%79 = icmp ne i32 %78, 0
br label %80
80: ; preds = %77, %72
%81 = phi i1 [ true, %72 ], [ %79, %77 ]
%82 = zext i1 %81 to i32
store i32 %82, i32* %12
store i32 0, i32* %9
br label %83
83: ; preds = %94, %80
%84 = load i32, i32* %9
%85 = load i32, i32* %4
%86 = icmp ult i32 %84, %85
br i1 %86, label %87, label %97
87: ; preds = %83
%88 = load i32*, i32** %5
%89 = load i32, i32* %9
%90 = zext i32 %89 to i64
%91 = getelementptr inbounds i32, i32* %88, i64 %90
%92 = load i32, i32* %91
%93 = call i32 (i32*, i64, i32, ...) bitcast (i32 (...)* @comm_pack to i32 (i32*, i64, i32, ...)*)(i32* %15, i64 4, i32 %92)
br label %94
94: ; preds = %87
%95 = load i32, i32* %9
%96 = add i32 %95, 1
store i32 %96, i32* %9
br label %83
97: ; preds = %83
%98 = call i32 (...) @comm_exch()
%99 = load i32, i32* %15
store i32 %99, i32* %18
br label %100
100: ; preds = %111, %97
%101 = call i32 (...) @comm_recv()
%102 = icmp ne i32 %101, 0
br i1 %102, label %103, label %112
103: ; preds = %100
%104 = call i32 (i32*, i64, ...) bitcast (i32 (...)* @comm_unpack to i32 (i32*, i64, ...)*)(i32* %17, i64 4)
%105 = load i32, i32* %10
%106 = icmp ne i32 %105, 0
br i1 %106, label %107, label %111
107: ; preds = %103
%108 = load i32, i32* %17
%109 = icmp ne i32 %108, 0
br i1 %109, label %110, label %111
110: ; preds = %107
store i32 1, i32* %18
br label %111
111: ; preds = %110, %107, %103
br label %100
112: ; preds = %100
%113 = load i32, i32* %10
%114 = icmp ne i32 %113, 0
br i1 %114, label %115, label %119
115: ; preds = %112
%116 = load i32, i32* %18
%117 = icmp ne i32 %116, 0
%118 = xor i1 %117, true
br label %119
119: ; preds = %115, %112
%120 = phi i1 [ false, %112 ], [ %118, %115 ]
%121 = zext i1 %120 to i32
store i32 %121, i32* %10
br label %23
122: ; preds = %23
store i32 0, i32* %9
br label %123
123: ; preds = %134, %122
%124 = load i32, i32* %9
%125 = load i32, i32* %4
%126 = icmp ult i32 %124, %125
br i1 %126, label %127, label %137
127: ; preds = %123
%128 = load i32*, i32** %5
%129 = load i32, i32* %9
%130 = zext i32 %129 to i64
%131 = getelementptr inbounds i32, i32* %128, i64 %130
%132 = load i32, i32* %131
%133 = call i32 (i32*, i64, i32, ...) bitcast (i32 (...)* @comm_pack to i32 (i32*, i64, i32, ...)*)(i32* %12, i64 4, i32 %132)
br label %134
134: ; preds = %127
%135 = load i32, i32* %9
%136 = add i32 %135, 1
store i32 %136, i32* %9
br label %123
137: ; preds = %123
%138 = call i32 (...) @comm_exch()
store i32 0, i32* %14
br label %139
139: ; preds = %194, %137
%140 = call i32 (...) @comm_recv()
%141 = icmp ne i32 %140, 0
br i1 %141, label %142, label %195
142: ; preds = %139
%143 = call i32 (i32*, i64, ...) bitcast (i32 (...)* @comm_unpack to i32 (i32*, i64, ...)*)(i32* %13, i64 4)
store i32 0, i32* %9
br label %144
144: ; preds = %169, %142
%145 = load i32, i32* %9
%146 = load i32, i32* %4
%147 = icmp ult i32 %145, %146
br i1 %147, label %148, label %172
148: ; preds = %144
%149 = load i32*, i32** %5
%150 = load i32, i32* %9
%151 = zext i32 %150 to i64
%152 = getelementptr inbounds i32, i32* %149, i64 %151
%153 = load i32, i32* %152
%154 = call i32 (...) @comm_from()
%155 = icmp eq i32 %153, %154
br i1 %155, label %156, label %157
156: ; preds = %148
br label %172
157: ; preds = %148
%158 = load i32*, i32** %5
%159 = load i32, i32* %9
%160 = zext i32 %159 to i64
%161 = getelementptr inbounds i32, i32* %158, i64 %160
%162 = load i32, i32* %161
%163 = call i32 (...) @comm_rank()
%164 = icmp eq i32 %162, %163
br i1 %164, label %165, label %168
165: ; preds = %157
%166 = call i32 (...) @comm_rank()
%167 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @die to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %166)
br label %168
168: ; preds = %165, %157
br label %169
169: ; preds = %168
%170 = load i32, i32* %9
%171 = add i32 %170, 1
store i32 %171, i32* %9
br label %144
172: ; preds = %156, %144
%173 = load i32, i32* %9
%174 = load i32, i32* %4
%175 = icmp eq i32 %173, %174
br i1 %175, label %176, label %180
176: ; preds = %172
%177 = call i32 (...) @comm_rank()
%178 = call i32 (...) @comm_from()
%179 = call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @die to i32 (i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0), i32 %177, i32 %178)
br label %180
180: ; preds = %176, %172
%181 = load i32, i32* %12
%182 = icmp ne i32 %181, 0
br i1 %182, label %183, label %190
183: ; preds = %180
%184 = load i32, i32* %13
%185 = icmp ne i32 %184, 0
br i1 %185, label %186, label %190
186: ; preds = %183
%187 = call i32 (...) @comm_rank()
%188 = call i32 (...) @comm_from()
%189 = call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @die to i32 (i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.2, i64 0, i64 0), i32 %187, i32 %188)
br label %190
190: ; preds = %186, %183, %180
%191 = load i32, i32* %13
%192 = icmp ne i32 %191, 0
br i1 %192, label %193, label %194
193: ; preds = %190
store i32 1, i32* %14
br label %194
194: ; preds = %193, %190
br label %139
195: ; preds = %139
%196 = load i32, i32* %14
%197 = icmp ne i32 %196, 0
br i1 %197, label %207, label %198
198: ; preds = %195
%199 = load i32, i32* %12
%200 = icmp ne i32 %199, 0
br i1 %200, label %207, label %201
201: ; preds = %198
%202 = load i32, i32* %6
%203 = icmp ne i32 %202, 0
br i1 %203, label %204, label %207
204: ; preds = %201
%205 = call i32 (...) @comm_rank()
%206 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @die to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.3, i64 0, i64 0), i32 %205)
br label %207
207: ; preds = %204, %201, %198, %195
%208 = load i32, i32* %12
ret i32 %208
}

LLVM IR (-O2):
@.str = [36 x i8] c"luby_mis: %d is neighbor with self\0A\00"
@.str.1 = [58 x i8] c"luby_mis: graph not symmetric. %d unexpected neighbor %d\0A\00"
@.str.2 = [63 x i8] c"luby_mis: bug: not independent. %d and %d adjacent and in set\0A\00"
@.str.3 = [65 x i8] c"luby_mis: bug: not maximal. %d could have been taken but wasn't\0A\00"
define i32 @luby_mis(i32 %0, i32* nocapture %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = bitcast i32* %4 to i8*
%13 = bitcast i32* %5 to i8*
%14 = bitcast i32* %6 to i8*
%15 = bitcast i32* %7 to i8*
%16 = bitcast i32* %8 to i8*
%17 = bitcast i32* %9 to i8*
%18 = bitcast i32* %10 to i8*
%19 = bitcast i32* %11 to i8*
%20 = tail call i32 (...) @comm_rank()
%21 = add nsw i32 %20, 1
%22 = tail call i32 (i32, ...) bitcast (i32 (...)* @mersenne_twister_seed to i32 (i32, ...)*)(i32 %21)
store i32 0, i32* %8
store i32 %2, i32* %6
%23 = call i32 (...) @comm_mpi()
%24 = call i32 (i32, i32, ...) bitcast (i32 (...)* @mpi_max_int to i32 (i32, i32, ...)*)(i32 %23, i32 %2)
%25 = icmp eq i32 %24, 0
br i1 %25, label %30, label %26
26: ; preds = %3
%27 = icmp eq i32 %0, 0
%28 = zext i32 %0 to i64
%29 = zext i32 %0 to i64
br label %34
30: ; preds = %96, %3
%31 = icmp eq i32 %0, 0
br i1 %31, label %114, label %32
32: ; preds = %30
%33 = zext i32 %0 to i64
br label %107
34: ; preds = %26, %96
%35 = phi i32 [ 0, %26 ], [ %72, %96 ]
%36 = call i32 (...) @mersenne_twister()
store i32 %36, i32* %4
br i1 %27, label %46, label %37
37: ; preds = %34, %37
%38 = phi i64 [ %44, %37 ], [ 0, %34 ]
%39 = getelementptr inbounds i32, i32* %1, i64 %38
%40 = load i32, i32* %39
%41 = call i32 (i32*, i64, i32, ...) bitcast (i32 (...)* @comm_pack to i32 (i32*, i64, i32, ...)*)(i32* %6, i64 4, i32 %40)
%42 = load i32, i32* %39
%43 = call i32 (i32*, i64, i32, ...) bitcast (i32 (...)* @comm_pack to i32 (i32*, i64, i32, ...)*)(i32* %4, i64 4, i32 %42)
%44 = add nuw nsw i64 %38, 1
%45 = icmp eq i64 %44, %28
br i1 %45, label %46, label %37
46: ; preds = %37, %34
%47 = call i32 (...) @comm_exch()
%48 = call i32 (...) @comm_recv()
%49 = icmp eq i32 %48, 0
br i1 %49, label %63, label %50
50: ; preds = %46, %50
%51 = phi i32 [ %60, %50 ], [ 1, %46 ]
%52 = call i32 (i32*, i64, ...) bitcast (i32 (...)* @comm_unpack to i32 (i32*, i64, ...)*)(i32* %7, i64 4)
%53 = call i32 (i32*, i64, ...) bitcast (i32 (...)* @comm_unpack to i32 (i32*, i64, ...)*)(i32* %5, i64 4)
%54 = load i32, i32* %7
%55 = icmp eq i32 %54, 0
%56 = load i32, i32* %4
%57 = load i32, i32* %5
%58 = icmp ult i32 %56, %57
%59 = select i1 %55, i1 true, i1 %58
%60 = select i1 %59, i32 %51, i32 0
%61 = call i32 (...) @comm_recv()
%62 = icmp eq i32 %61, 0
br i1 %62, label %63, label %50
63: ; preds = %50, %46
%64 = phi i32 [ 1, %46 ], [ %60, %50 ]
%65 = load i32, i32* %6
%66 = icmp ne i32 %65, 0
%67 = icmp ne i32 %64, 0
%68 = select i1 %66, i1 %67, i1 false
%69 = zext i1 %68 to i32
store i32 %69, i32* %10
%70 = icmp ne i32 %35, 0
%71 = select i1 %70, i1 true, i1 %68
%72 = zext i1 %71 to i32
store i32 %72, i32* %8
br i1 %27, label %80, label %73
73: ; preds = %63, %73
%74 = phi i64 [ %78, %73 ], [ 0, %63 ]
%75 = getelementptr inbounds i32, i32* %1, i64 %74
%76 = load i32, i32* %75
%77 = call i32 (i32*, i64, i32, ...) bitcast (i32 (...)* @comm_pack to i32 (i32*, i64, i32, ...)*)(i32* %10, i64 4, i32 %76)
%78 = add nuw nsw i64 %74, 1
%79 = icmp eq i64 %78, %29
br i1 %79, label %80, label %73
80: ; preds = %73, %63
%81 = call i32 (...) @comm_exch()
%82 = load i32, i32* %10
%83 = call i32 (...) @comm_recv()
%84 = icmp eq i32 %83, 0
br i1 %84, label %96, label %85
85: ; preds = %80, %85
%86 = phi i32 [ %93, %85 ], [ %82, %80 ]
%87 = call i32 (i32*, i64, ...) bitcast (i32 (...)* @comm_unpack to i32 (i32*, i64, ...)*)(i32* %11, i64 4)
%88 = load i32, i32* %6
%89 = icmp ne i32 %88, 0
%90 = load i32, i32* %11
%91 = icmp ne i32 %90, 0
%92 = select i1 %89, i1 %91, i1 false
%93 = select i1 %92, i32 1, i32 %86
%94 = call i32 (...) @comm_recv()
%95 = icmp eq i32 %94, 0
br i1 %95, label %96, label %85
96: ; preds = %85, %80
%97 = phi i32 [ %82, %80 ], [ %93, %85 ]
%98 = load i32, i32* %6
%99 = icmp ne i32 %98, 0
%100 = icmp eq i32 %97, 0
%101 = select i1 %99, i1 %100, i1 false
%102 = zext i1 %101 to i32
store i32 %102, i32* %6
%103 = call i32 (...) @comm_mpi()
%104 = load i32, i32* %6
%105 = call i32 (i32, i32, ...) bitcast (i32 (...)* @mpi_max_int to i32 (i32, i32, ...)*)(i32 %103, i32 %104)
%106 = icmp eq i32 %105, 0
br i1 %106, label %30, label %34
107: ; preds = %32, %107
%108 = phi i64 [ 0, %32 ], [ %112, %107 ]
%109 = getelementptr inbounds i32, i32* %1, i64 %108
%110 = load i32, i32* %109
%111 = call i32 (i32*, i64, i32, ...) bitcast (i32 (...)* @comm_pack to i32 (i32*, i64, i32, ...)*)(i32* %8, i64 4, i32 %110)
%112 = add nuw nsw i64 %108, 1
%113 = icmp eq i64 %112, %33
br i1 %113, label %114, label %107
114: ; preds = %107, %30
%115 = call i32 (...) @comm_exch()
%116 = call i32 (...) @comm_recv()
%117 = icmp eq i32 %116, 0
br i1 %117, label %167, label %118
118: ; preds = %114
%119 = zext i32 %0 to i64
br label %120
120: ; preds = %118, %159
%121 = phi i32 [ 0, %118 ], [ %162, %159 ]
%122 = call i32 (i32*, i64, ...) bitcast (i32 (...)* @comm_unpack to i32 (i32*, i64, ...)*)(i32* %9, i64 4)
br i1 %31, label %141, label %123
123: ; preds = %120, %136
%124 = phi i64 [ %137, %136 ], [ 0, %120 ]
%125 = getelementptr inbounds i32, i32* %1, i64 %124
%126 = load i32, i32* %125
%127 = call i32 (...) @comm_from()
%128 = icmp eq i32 %126, %127
br i1 %128, label %139, label %129
129: ; preds = %123
%130 = load i32, i32* %125
%131 = call i32 (...) @comm_rank()
%132 = icmp eq i32 %130, %131
br i1 %132, label %133, label %136
133: ; preds = %129
%134 = call i32 (...) @comm_rank()
%135 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @die to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %134)
br label %136
136: ; preds = %129, %133
%137 = add nuw nsw i64 %124, 1
%138 = icmp eq i64 %137, %119
br i1 %138, label %144, label %123
139: ; preds = %123
%140 = trunc i64 %124 to i32
br label %141
141: ; preds = %139, %120
%142 = phi i32 [ 0, %120 ], [ %140, %139 ]
%143 = icmp eq i32 %142, %0
br i1 %143, label %144, label %148
144: ; preds = %136, %141
%145 = call i32 (...) @comm_rank()
%146 = call i32 (...) @comm_from()
%147 = call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @die to i32 (i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0), i32 %145, i32 %146)
br label %148
148: ; preds = %144, %141
%149 = load i32, i32* %8
%150 = icmp ne i32 %149, 0
%151 = load i32, i32* %9
%152 = icmp ne i32 %151, 0
%153 = select i1 %150, i1 %152, i1 false
br i1 %153, label %154, label %159
154: ; preds = %148
%155 = call i32 (...) @comm_rank()
%156 = call i32 (...) @comm_from()
%157 = call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @die to i32 (i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.2, i64 0, i64 0), i32 %155, i32 %156)
%158 = load i32, i32* %9
br label %159
159: ; preds = %154, %148
%160 = phi i32 [ %158, %154 ], [ %151, %148 ]
%161 = icmp eq i32 %160, 0
%162 = select i1 %161, i32 %121, i32 1
%163 = call i32 (...) @comm_recv()
%164 = icmp eq i32 %163, 0
br i1 %164, label %165, label %120
165: ; preds = %159
%166 = icmp eq i32 %162, 0
br label %167
167: ; preds = %165, %114
%168 = phi i1 [ true, %114 ], [ %166, %165 ]
%169 = load i32, i32* %8
%170 = icmp eq i32 %169, 0
%171 = select i1 %168, i1 %170, i1 false
%172 = icmp ne i32 %2, 0
%173 = and i1 %172, %171
br i1 %173, label %174, label %178
174: ; preds = %167
%175 = call i32 (...) @comm_rank()
%176 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @die to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.3, i64 0, i64 0), i32 %175)
%177 = load i32, i32* %8
br label %178
178: ; preds = %174, %167
%179 = phi i32 [ %177, %174 ], [ %169, %167 ]
ret i32 %179
}