#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 */
unsigned int pow(int, int);
int /*<<< orphan*/ printf(char *, ...);
void printPowerSet(int *set, int set_size) {
  unsigned int pow_set_size = pow(2, set_size);
  int counter, j;
  for (counter = 0; counter < pow_set_size; counter++) {
    for (j = 0; j < set_size; j++) {
      if (counter & (1 << j))
        printf("%d", set[j]);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<printPowerSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jae    11c7 <printPowerSet+0xa7>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ab <printPowerSet+0x8b>
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1198 <printPowerSet+0x78>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119d <printPowerSet+0x7d>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1159 <printPowerSet+0x39>
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1146 <printPowerSet+0x26>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printPowerSet>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r13
mov    $0x2,%edi
mov    %esi,0x4(%rsp)
call   1050 <pow@plt>
test   %eax,%eax
je     11b0 <printPowerSet+0x80>
mov    %eax,%r15d
mov    0x4(%rsp),%ebp
lea    0xea2(%rip),%r12
xor    %ebx,%ebx
jmp    1182 <printPowerSet+0x52>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    %r15d,%ebx
je     11b0 <printPowerSet+0x80>
cmpl   $0x0,0x4(%rsp)
jle    1170 <printPowerSet+0x40>
xor    %r14d,%r14d
jmp    1199 <printPowerSet+0x69>
xchg   %ax,%ax
add    $0x1,%r14
cmp    %r14,%rbp
je     1170 <printPowerSet+0x40>
bt     %r14d,%ebx
jae    1190 <printPowerSet+0x60>
mov    0x0(%r13,%r14,4),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1190 <printPowerSet+0x60>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @printPowerSet(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%8 = load i32, i32* %4
%9 = call i32 @pow(i32 2, i32 %8)
store i32 %9, i32* %5
store i32 0, i32* %6
br label %10
10: ; preds = %38, %2
%11 = load i32, i32* %6
%12 = load i32, i32* %5
%13 = icmp ult i32 %11, %12
br i1 %13, label %14, label %41
14: ; preds = %10
store i32 0, i32* %7
br label %15
15: ; preds = %33, %14
%16 = load i32, i32* %7
%17 = load i32, i32* %4
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %36
19: ; preds = %15
%20 = load i32, i32* %6
%21 = load i32, i32* %7
%22 = shl i32 1, %21
%23 = and i32 %20, %22
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %32
25: ; preds = %19
%26 = load i32*, i32** %3
%27 = load i32, i32* %7
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i32, i32* %26, i64 %28
%30 = load i32, i32* %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %25, %19
br label %33
33: ; preds = %32
%34 = load i32, i32* %7
%35 = add nsw i32 %34, 1
store i32 %35, i32* %7
br label %15
36: ; preds = %15
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %38
38: ; preds = %36
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
store i32 %40, i32* %6
br label %10
41: ; preds = %10
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @printPowerSet(i32* nocapture %0, i32 %1) {
%3 = tail call i32 @pow(i32 2, i32 %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %27, label %5
5: ; preds = %2
%6 = icmp sgt i32 %1, 0
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %5, %23
%9 = phi i32 [ 0, %5 ], [ %25, %23 ]
br i1 %6, label %10, label %23
10: ; preds = %8, %20
%11 = phi i64 [ %21, %20 ], [ 0, %8 ]
%12 = trunc i64 %11 to i32
%13 = shl nuw i32 1, %12
%14 = and i32 %13, %9
%15 = icmp eq i32 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %10
%17 = getelementptr inbounds i32, i32* %0, i64 %11
%18 = load i32, i32* %17
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %10, %16
%21 = add nuw nsw i64 %11, 1
%22 = icmp eq i64 %21, %7
br i1 %22, label %23, label %10
23: ; preds = %20, %8
%24 = tail call i32 @putchar(i32 10)
%25 = add nuw i32 %9, 1
%26 = icmp eq i32 %25, %3
br i1 %26, label %27, label %8
27: ; preds = %23, %2
ret void
}