#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 printSet(int set[], int x[], int k) {
  int i;
  printf("{  ");
  for (i = 0; i <= k; ++i)
    if (x[i] == 1)
      printf("%2d, ", set[i]);
  printf("\b\b  }\n");
}


x86 assembly (clang, -O0):
<printSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1182 <printSet+0x72>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpl   $0x1,(%rax,%rcx,4)
jne    116f <printSet+0x5f>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1174 <printSet+0x64>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1138 <printSet+0x28>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printSet>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %edx,%r13d
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xec7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r13d,%r13d
js     1180 <printSet+0x60>
add    $0x1,%r13d
lea    0xeb4(%rip),%r12
xor    %ebx,%ebx
jmp    1169 <printSet+0x49>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rbx
cmp    %rbx,%r13
je     1180 <printSet+0x60>
cmpl   $0x1,(%r14,%rbx,4)
jne    1160 <printSet+0x40>
mov    (%r15,%rbx,4),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1160 <printSet+0x40>
lea    0xe83(%rip),%rdi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <puts@plt>

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

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