#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 n;

/* Variables and functions */
int /*<<< orphan*/ transitive_closure(unsigned int *, int);
void reflexive_transitive_closure(unsigned *R, int n) {
  register int rowsize;
  register unsigned i;
  register unsigned *rp;
  register unsigned *relend;
  transitive_closure(R, n);
  rowsize = (((n) + (32 - 1)) / 32);
  relend = R + n * rowsize;
  i = 0;
  rp = R;
  while (rp < relend) {
    *rp |= (1 << i);
    if (++i >= 32) {
      i = 0;
      rp++;
    }
    rp += rowsize;
  }
}


x86 assembly (clang, -O0):
<reflexive_transitive_closure>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <transitive_closure@plt>
mov    -0xc(%rbp),%eax
add    $0x1f,%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
imul   -0x10(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    11c5 <reflexive_transitive_closure+0xb5>
mov    -0x14(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
or     (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmp    $0x20,%eax
jb     11ab <reflexive_transitive_closure+0x9b>
movl   $0x0,-0x14(%rbp)
mov    -0x20(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
jmp    1164 <reflexive_transitive_closure+0x54>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reflexive_transitive_closure>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%rbx
call   1030 <transitive_closure@plt>
lea    0x1f(%r14),%eax
lea    0x3e(%r14),%ecx
test   %eax,%eax
cmovns %eax,%ecx
sar    $0x5,%ecx
imul   %ecx,%r14d
test   %r14d,%r14d
jle    1175 <reflexive_transitive_closure+0x65>
movslq %r14d,%rax
lea    (%rbx,%rax,4),%rax
movslq %ecx,%rdx
xor    %esi,%esi
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
mov    $0x1,%edi
shl    %cl,%edi
or     %edi,(%rbx)
add    $0x1,%ecx
xor    %edi,%edi
cmp    $0x20,%ecx
setae  %dil
lea    (%rbx,%rdx,4),%rbx
cmovae %esi,%ecx
lea    (%rbx,%rdi,4),%rbx
cmp    %rax,%rbx
jb     1150 <reflexive_transitive_closure+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @reflexive_transitive_closure(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
store i32* %0, i32** %3
store i32 %1, i32* %4
%9 = load i32*, i32** %3
%10 = load i32, i32* %4
%11 = call i32 @transitive_closure(i32* %9, i32 %10)
%12 = load i32, i32* %4
%13 = add nsw i32 %12, 31
%14 = sdiv i32 %13, 32
store i32 %14, i32* %5
%15 = load i32*, i32** %3
%16 = load i32, i32* %4
%17 = load i32, i32* %5
%18 = mul nsw i32 %16, %17
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %15, i64 %19
store i32* %20, i32** %8
store i32 0, i32* %6
%21 = load i32*, i32** %3
store i32* %21, i32** %7
br label %22
22: ; preds = %38, %2
%23 = load i32*, i32** %7
%24 = load i32*, i32** %8
%25 = icmp ult i32* %23, %24
br i1 %25, label %26, label %43
26: ; preds = %22
%27 = load i32, i32* %6
%28 = shl i32 1, %27
%29 = load i32*, i32** %7
%30 = load i32, i32* %29
%31 = or i32 %30, %28
store i32 %31, i32* %29
%32 = load i32, i32* %6
%33 = add i32 %32, 1
store i32 %33, i32* %6
%34 = icmp uge i32 %33, 32
br i1 %34, label %35, label %38
35: ; preds = %26
store i32 0, i32* %6
%36 = load i32*, i32** %7
%37 = getelementptr inbounds i32, i32* %36, i32 1
store i32* %37, i32** %7
br label %38
38: ; preds = %35, %26
%39 = load i32, i32* %5
%40 = load i32*, i32** %7
%41 = sext i32 %39 to i64
%42 = getelementptr inbounds i32, i32* %40, i64 %41
store i32* %42, i32** %7
br label %22
43: ; preds = %22
ret void
}

LLVM IR (-O2):
define void @reflexive_transitive_closure(i32* %0, i32 %1) {
%3 = tail call i32 @transitive_closure(i32* %0, i32 %1)
%4 = add nsw i32 %1, 31
%5 = sdiv i32 %4, 32
%6 = mul nsw i32 %5, %1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = icmp sgt i32 %6, 0
br i1 %9, label %10, label %25
10: ; preds = %2
%11 = sext i32 %5 to i64
br label %12
12: ; preds = %10, %12
%13 = phi i32 [ 0, %10 ], [ %22, %12 ]
%14 = phi i32* [ %0, %10 ], [ %23, %12 ]
%15 = shl nuw i32 1, %13
%16 = load i32, i32* %14
%17 = or i32 %16, %15
store i32 %17, i32* %14
%18 = add i32 %13, 1
%19 = icmp ugt i32 %18, 31
%20 = zext i1 %19 to i64
%21 = getelementptr i32, i32* %14, i64 %11
%22 = select i1 %19, i32 0, i32 %18
%23 = getelementptr inbounds i32, i32* %21, i64 %20
%24 = icmp ult i32* %23, %8
br i1 %24, label %12, label %25
25: ; preds = %12, %2
ret void
}