#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 /*<<< orphan*/ printf(char *, ...);
void printSubset(int *binrep, int limit) {
  int i;
  printf("{");
  for (i = 0; i < limit; i++) {
    if (*(binrep + sizeof(int) * i) == 1) {
      printf("%d, ", i + 1);
    }
  }
  printf("}");
}


x86 assembly (clang, -O0):
<printSubset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    117d <printSubset+0x6d>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
shl    $0x2,%rcx
cmpl   $0x1,(%rax,%rcx,4)
jne    116a <printSubset+0x5a>
mov    -0x10(%rbp),%esi
add    $0x1,%esi
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    116f <printSubset+0x5f>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1134 <printSubset+0x24>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printSubset>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r15
mov    $0x7b,%edi
call   1030 <putchar@plt>
test   %ebp,%ebp
jle    1181 <printSubset+0x61>
mov    %ebp,%r12d
shl    $0x4,%r12
mov    $0x1,%ebp
lea    0xeb2(%rip),%r14
xor    %ebx,%ebx
jmp    116c <printSubset+0x4c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x10,%rbx
add    $0x1,%ebp
cmp    %rbx,%r12
je     1181 <printSubset+0x61>
cmpl   $0x1,(%r15,%rbx,1)
jne    1160 <printSubset+0x40>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1160 <printSubset+0x40>
mov    $0x7d,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"{\00"
@.str.1 = [5 x i8] c"%d, \00"
@.str.2 = [2 x i8] c"}\00"
define void @printSubset(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %7
7: ; preds = %24, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %27
11: ; preds = %7
%12 = load i32*, i32** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = mul i64 4, %14
%16 = getelementptr inbounds i32, i32* %12, i64 %15
%17 = load i32, i32* %16
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %23
19: ; preds = %11
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %19, %11
br label %24
24: ; preds = %23
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %7
27: ; preds = %7
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

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