#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 printBytesAsNumber(unsigned int e) {
  int i, j;
  int first = 1;
  j = 28;
  printf("  ");
  printf("{");
  for (i = 28 - 1; i >= 0; i--) {
    if (first) {
      if (((e >> i) & 0x1) == 1) {
        printf("%d", j);
        first = 0;
      }
    } else {
      if (((e >> i) & 0x1) == 1) {
        printf(",%d", j);
      }
    }
    j--;
  }
  printf("}");
  printf("\n");
}


x86 assembly (clang, -O0):
<printBytesAsNumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x1c,-0xc(%rbp)
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1b,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     11d2 <printBytesAsNumber+0xc2>
cmpl   $0x0,-0x10(%rbp)
je     1191 <printBytesAsNumber+0x81>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    %cl,%eax
and    $0x1,%eax
cmp    $0x1,%eax
jne    118c <printBytesAsNumber+0x7c>
mov    -0xc(%rbp),%esi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
jmp    11bb <printBytesAsNumber+0xab>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    %cl,%eax
and    $0x1,%eax
cmp    $0x1,%eax
jne    11b6 <printBytesAsNumber+0xa6>
mov    -0xc(%rbp),%esi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bb <printBytesAsNumber+0xab>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    114c <printBytesAsNumber+0x3c>
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printBytesAsNumber>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edi,%r12d
lea    0xece(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7b,%edi
call   1030 <putchar@plt>
mov    $0x1c,%ebx
mov    $0x1,%ebp
lea    0xeaf(%rip),%r14
lea    0xea9(%rip),%r15
jmp    1179 <printBytesAsNumber+0x59>
nopl   (%rax)
test   %ebp,%ebp
mov    %r15,%rdi
cmove  %r14,%rdi
xor    %ebp,%ebp
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebx
je     1195 <printBytesAsNumber+0x75>
xor    %eax,%eax
test   %ebp,%ebp
setne  %cl
lea    -0x1(%rbx),%edx
movzbl %dl,%edx
bt     %edx,%r12d
jb     1160 <printBytesAsNumber+0x40>
mov    %cl,%al
mov    %eax,%ebp
add    $0xffffffff,%ebx
jne    1179 <printBytesAsNumber+0x59>
mov    $0x7d,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

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