#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 mu_dump_set(int rset) {
  int reg = 3;
  int wr = 0;
  printf("{");
  while (rset != 0) {
    if (rset & 1) {
      if (wr++ != 0) {
        printf(" ");
      }
      printf("%d", reg);
    }
    reg--;
    rset >>= 1;
  }
  printf("}");
}


x86 assembly (clang, -O0):
<mu_dump_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x4(%rbp)
je     119a <mu_dump_set+0x8a>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1183 <mu_dump_set+0x73>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     1172 <mu_dump_set+0x62>
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1137 <mu_dump_set+0x27>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mu_dump_set>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0x7b,%edi
call   1030 <putchar@plt>
test   %ebx,%ebx
je     1184 <mu_dump_set+0x64>
mov    $0x3,%ebp
lea    0xebd(%rip),%r14
xor    %r15d,%r15d
jmp    116e <mu_dump_set+0x4e>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15d
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebp
mov    %ebx,%eax
sar    %eax
cmp    $0x1,%ebx
mov    %eax,%ebx
jbe    1184 <mu_dump_set+0x64>
test   $0x1,%bl
je     1160 <mu_dump_set+0x40>
test   %r15d,%r15d
je     1150 <mu_dump_set+0x30>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1150 <mu_dump_set+0x30>
mov    $0x7d,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

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