#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 flipBit(int, int);
int /*<<< orphan*/ printLeftmostNBits(int, int);
void hypercubeDFS(int visited[], int node, int width) {
  printLeftmostNBits(node, width);
  visited[node] = 1;
  int bitLocation;
  for (bitLocation = 0; bitLocation < width; bitLocation++) {
    int neighbor = flipBit(node, bitLocation);
    if (!visited[neighbor]) {
      hypercubeDFS(visited, neighbor, width);
    }
  }
}


x86 assembly (clang, -O0):
<hypercubeDFS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1050 <printLeftmostNBits@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11b1 <hypercubeDFS+0x81>
mov    -0xc(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1040 <flipBit@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    119e <hypercubeDFS+0x6e>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <hypercubeDFS@plt>
jmp    11a3 <hypercubeDFS+0x73>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1163 <hypercubeDFS+0x33>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hypercubeDFS>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%r14d
mov    %rdi,%r15
mov    %esi,%edi
mov    %edx,%esi
call   1050 <printLeftmostNBits@plt>
movslq %r14d,%rax
movl   $0x1,(%r15,%rax,4)
test   %ebx,%ebx
jle    1189 <hypercubeDFS+0x59>
xor    %ebp,%ebp
jmp    1167 <hypercubeDFS+0x37>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    %ebp,%ebx
je     1189 <hypercubeDFS+0x59>
mov    %r14d,%edi
mov    %ebp,%esi
call   1040 <flipBit@plt>
movslq %eax,%rcx
cmpl   $0x0,(%r15,%rcx,4)
jne    1160 <hypercubeDFS+0x30>
mov    %r15,%rdi
mov    %eax,%esi
mov    %ebx,%edx
call   1030 <hypercubeDFS@plt>
jmp    1160 <hypercubeDFS+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @hypercubeDFS(i32* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 @printLeftmostNBits(i32 %1, i32 %2)
%5 = sext i32 %1 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
store i32 1, i32* %6
%7 = icmp sgt i32 %2, 0
br i1 %7, label %8, label %19
8: ; preds = %3, %16
%9 = phi i32 [ %17, %16 ], [ 0, %3 ]
%10 = tail call i32 @flipBit(i32 %1, i32 %9)
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %0, i64 %11
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %8
tail call void @hypercubeDFS(i32* %0, i32 %10, i32 %2)
br label %16
16: ; preds = %15, %8
%17 = add nuw nsw i32 %9, 1
%18 = icmp eq i32 %17, %2
br i1 %18, label %19, label %8
19: ; preds = %16, %3
ret void
}