#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 printSet(int inputs) {
  unsigned int num_points, num_pos, this_point, i, j;
  num_points = pow(2, inputs);
  for (i = 0; i < num_points; i++) {
    num_pos = 0;
    this_point = i;
    for (j = 0; j < inputs; j++) {
      if (j != 0)
        printf(", ");
      if ((this_point & 1) == 1) {
        printf("+");
        num_pos++;
      } else
        printf("-");
      this_point >>= 1;
    }
    if ((num_pos % 2) == 1)
      printf("  =>  +;\n");
    else
      printf("  =>  -;\n");
  }
}


x86 assembly (clang, -O0):
<printSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    120f <printSet+0xef>
movl   $0x0,-0xc(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    11d0 <printSet+0xb0>
cmpl   $0x0,-0x18(%rbp)
je     1184 <printSet+0x64>
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
and    $0x1,%eax
cmp    $0x1,%eax
jne    11ad <printSet+0x8d>
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b9 <printSet+0x99>
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1162 <printSet+0x42>
mov    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x1,%eax
jne    11f0 <printSet+0xd0>
lea    0xe21(%rip),%rdi
call   1030 <printf@plt>
jmp    11fc <printSet+0xdc>
lea    0xe1a(%rip),%rdi
call   1030 <printf@plt>
jmp    1201 <printSet+0xe1>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1142 <printSet+0x22>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printSet>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,%r12d
mov    $0x2,%edi
mov    %r12d,%esi
call   1060 <pow@plt>
mov    %eax,0x4(%rsp)
test   %eax,%eax
je     1210 <printSet+0xd0>
lea    -0x1(%r12),%eax
mov    %eax,(%rsp)
xor    %r14d,%r14d
lea    0xe87(%rip),%rbp
jmp    1197 <printSet+0x57>
nopl   0x0(%rax,%rax,1)
lea    0xe7c(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%r14d
cmp    0x4(%rsp),%r14d
je     1210 <printSet+0xd0>
test   %r12d,%r12d
je     1180 <printSet+0x40>
xor    %eax,%eax
mov    %r14d,%ebx
and    $0x1,%ebx
sete   %al
lea    (%rax,%rax,1),%edi
add    $0x2b,%edi
call   1030 <putchar@plt>
cmp    $0x1,%r12d
jne    11d0 <printSet+0x90>
lea    0xe4d(%rip),%rdi
test   $0x1,%bl
je     1180 <printSet+0x40>
jmp    1187 <printSet+0x47>
cs nopw 0x0(%rax,%rax,1)
mov    (%rsp),%r13d
mov    %r14d,%r15d
jmp    11f3 <printSet+0xb3>
nopl   0x0(%rax)
mov    $0x2d,%edi
call   1030 <putchar@plt>
shr    %r15d
add    $0xffffffff,%r13d
je     11b8 <printSet+0x78>
mov    %rbp,%rdi
call   1050 <printf@plt>
test   $0x2,%r15b
je     11e0 <printSet+0xa0>
mov    $0x2b,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
jmp    11ea <printSet+0xaa>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c", \00"
@.str.1 = [2 x i8] c"+\00"
@.str.2 = [2 x i8] c"-\00"
@.str.3 = [10 x i8] c" => +;\0A\00"
@.str.4 = [10 x i8] c" => -;\0A\00"
define void @printSet(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %2
%8 = load i32, i32* %2
%9 = call i32 @pow(i32 2, i32 %8)
store i32 %9, i32* %3
store i32 0, i32* %6
br label %10
10: ; preds = %50, %1
%11 = load i32, i32* %6
%12 = load i32, i32* %3
%13 = icmp ult i32 %11, %12
br i1 %13, label %14, label %53
14: ; preds = %10
store i32 0, i32* %4
%15 = load i32, i32* %6
store i32 %15, i32* %5
store i32 0, i32* %7
br label %16
16: ; preds = %38, %14
%17 = load i32, i32* %7
%18 = load i32, i32* %2
%19 = icmp ult i32 %17, %18
br i1 %19, label %20, label %41
20: ; preds = %16
%21 = load i32, i32* %7
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %25
25: ; preds = %23, %20
%26 = load i32, i32* %5
%27 = and i32 %26, 1
%28 = icmp eq i32 %27, 1
br i1 %28, label %29, label %33
29: ; preds = %25
%30 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%31 = load i32, i32* %4
%32 = add i32 %31, 1
store i32 %32, i32* %4
br label %35
33: ; preds = %25
%34 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %35
35: ; preds = %33, %29
%36 = load i32, i32* %5
%37 = lshr i32 %36, 1
store i32 %37, i32* %5
br label %38
38: ; preds = %35
%39 = load i32, i32* %7
%40 = add i32 %39, 1
store i32 %40, i32* %7
br label %16
41: ; preds = %16
%42 = load i32, i32* %4
%43 = urem i32 %42, 2
%44 = icmp eq i32 %43, 1
br i1 %44, label %45, label %47
45: ; preds = %41
%46 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %49
47: ; preds = %41
%48 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
br label %49
49: ; preds = %47, %45
br label %50
50: ; preds = %49
%51 = load i32, i32* %6
%52 = add i32 %51, 1
store i32 %52, i32* %6
br label %10
53: ; preds = %10
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c", \00"
@str = [9 x i8] c" => -;\00"
@str.5 = [9 x i8] c" => +;\00"
define void @printSet(i32 %0) {
%2 = tail call i32 @pow(i32 2, i32 %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %43, label %4
4: ; preds = %1
%5 = icmp eq i32 %0, 0
%6 = icmp eq i32 %0, 1
br label %7
7: ; preds = %4, %38
%8 = phi i32 [ 0, %4 ], [ %41, %38 ]
br i1 %5, label %37, label %9
9: ; preds = %7
%10 = and i32 %8, 1
%11 = icmp eq i32 %10, 0
%12 = select i1 %11, i32 45, i32 43
%13 = xor i1 %11, true
%14 = zext i1 %13 to i32
%15 = tail call i32 @putchar(i32 %12)
br i1 %6, label %33, label %16
16: ; preds = %9, %29
%17 = phi i32 [ %31, %29 ], [ 1, %9 ]
%18 = phi i32 [ %20, %29 ], [ %8, %9 ]
%19 = phi i32 [ %30, %29 ], [ %14, %9 ]
%20 = lshr i32 %18, 1
%21 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%22 = and i32 %18, 2
%23 = icmp eq i32 %22, 0
br i1 %23, label %27, label %24
24: ; preds = %16
%25 = tail call i32 @putchar(i32 43)
%26 = add i32 %19, 1
br label %29
27: ; preds = %16
%28 = tail call i32 @putchar(i32 45)
br label %29
29: ; preds = %27, %24
%30 = phi i32 [ %26, %24 ], [ %19, %27 ]
%31 = add nuw i32 %17, 1
%32 = icmp eq i32 %31, %0
br i1 %32, label %33, label %16
33: ; preds = %29, %9
%34 = phi i32 [ %14, %9 ], [ %30, %29 ]
%35 = and i32 %34, 1
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %7, %33
br label %38
38: ; preds = %33, %37
%39 = phi i8* [ getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0), %37 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @str.5, i64 0, i64 0), %33 ]
%40 = tail call i32 @puts(i8* dereferenceable(1) %39)
%41 = add nuw i32 %8, 1
%42 = icmp eq i32 %41, %2
br i1 %42, label %43, label %7
43: ; preds = %38, %1
ret void
}