#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(char *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 ((1 << j))
        printf("%c (%d)", set[j], 1 << 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    11cb <printPowerSet+0xab>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11af <printPowerSet+0x8f>
mov    -0x18(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
cmp    $0x0,%eax
je     119c <printPowerSet+0x7c>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
mov    -0x18(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a1 <printPowerSet+0x81>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1159 <printPowerSet+0x39>
lea    0xe52(%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     11b4 <printPowerSet+0x84>
mov    %eax,%r15d
mov    0x4(%rsp),%ebx
lea    0xea2(%rip),%r12
xor    %r14d,%r14d
jmp    1183 <printPowerSet+0x53>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14d
cmp    %r15d,%r14d
je     11b4 <printPowerSet+0x84>
cmpl   $0x0,0x4(%rsp)
jle    1170 <printPowerSet+0x40>
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    $0x1,%edx
mov    %ebp,%ecx
shl    %cl,%edx
movsbl 0x0(%r13,%rbp,1),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1190 <printPowerSet+0x60>
jmp    1170 <printPowerSet+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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