#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 nibble_swap(int);
int /*<<< orphan*/ printf(char *, ...);
void print_number_as_visualized_binary(int number) {
  unsigned int i;
  unsigned int nibble;
  unsigned int mask = 0xF0000000;
  unsigned int remainder;
  remainder = nibble_swap(number);
  for (i = 0; i < (sizeof(unsigned int) * 2); i++) {
    nibble = (remainder & mask) >> (28 - i * 4);
    remainder = (remainder & (~mask));
    mask = mask >> 4;
    switch (nibble) {
    case 0:
      printf(" 0000 ");
      break;
    case 1:
      printf(" 0001 ");
      break;
    case 2:
      printf(" 0010 ");
      break;
    case 3:
      printf(" 0011 ");
      break;
    case 4:
      printf(" 0100 ");
      break;
    case 5:
      printf(" 0101 ");
      break;
    case 6:
      printf(" 0110 ");
      break;
    case 7:
      printf(" 0111 ");
      break;
    case 8:
      printf(" 1000 ");
      break;
    case 9:
      printf(" 1001 ");
      break;
    case 0xA:
      printf(" 1010 ");
      break;
    case 0xB:
      printf(" 1011 ");
      break;
    case 0xC:
      printf(" 1100 ");
      break;
    case 0xD:
      printf(" 1101 ");
      break;
    case 0xE:
      printf(" 1110 ");
      break;
    case 0xF:
      printf(" 1111 ");
      break;
    default:
      printf("oops.\n");
      break;
    }
    printf("(bits %2d -> %2d)\n", ((i * 4) + 4) - 1, i * 4);
    if (!remainder) {
      break;
    }
  }
}


x86 assembly (clang, -O0):
<print_number_as_visualized_binary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0xf0000000,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <nibble_swap@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    $0x8,%rax
jae    1323 <print_number_as_visualized_binary+0x203>
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%dl
shl    $0x2,%dl
mov    $0x1c,%cl
sub    %dl,%cl
shr    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%ecx
not    %ecx
and    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
shr    $0x4,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x20(%rbp)
sub    $0xf,%rax
ja     12d3 <print_number_as_visualized_binary+0x1b3>
mov    -0x20(%rbp),%rax
lea    0xe66(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e1 <print_number_as_visualized_binary+0x1c1>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e1 <print_number_as_visualized_binary+0x1c1>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e1 <print_number_as_visualized_binary+0x1c1>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e1 <print_number_as_visualized_binary+0x1c1>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e1 <print_number_as_visualized_binary+0x1c1>
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e1 <print_number_as_visualized_binary+0x1c1>
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e1 <print_number_as_visualized_binary+0x1c1>
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e1 <print_number_as_visualized_binary+0x1c1>
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e1 <print_number_as_visualized_binary+0x1c1>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e1 <print_number_as_visualized_binary+0x1c1>
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e1 <print_number_as_visualized_binary+0x1c1>
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e1 <print_number_as_visualized_binary+0x1c1>
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e1 <print_number_as_visualized_binary+0x1c1>
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e1 <print_number_as_visualized_binary+0x1c1>
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e1 <print_number_as_visualized_binary+0x1c1>
lea    0xde2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e1 <print_number_as_visualized_binary+0x1c1>
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
shl    $0x2,%esi
add    $0x4,%esi
sub    $0x1,%esi
mov    -0x8(%rbp),%edx
shl    $0x2,%edx
lea    0xdbd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x14(%rbp)
jne    1310 <print_number_as_visualized_binary+0x1f0>
jmp    1323 <print_number_as_visualized_binary+0x203>
jmp    1315 <print_number_as_visualized_binary+0x1f5>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1144 <print_number_as_visualized_binary+0x24>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_number_as_visualized_binary>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
call   1050 <nibble_swap@plt>
mov    %eax,%r14d
mov    $0xf0000000,%ebp
mov    $0x1c,%ebx
lea    0xf5c(%rip),%r15
lea    0xea5(%rip),%r12
xor    %r13d,%r13d
xchg   %ax,%ax
mov    %r14d,%eax
mov    %ebp,%r14d
not    %r14d
and    %eax,%r14d
and    %ebp,%eax
mov    %ebx,%ecx
shr    %cl,%eax
cmp    $0xf,%eax
ja     118c <print_number_as_visualized_binary+0x5c>
movslq (%r12,%rax,4),%rax
add    %r12,%rax
jmp    *%rax
lea    0xeb9(%rip),%rdi
jmp    1230 <print_number_as_visualized_binary+0x100>
lea    0xf30(%rip),%rdi
call   1030 <puts@plt>
jmp    1237 <print_number_as_visualized_binary+0x107>
lea    0xea3(%rip),%rdi
jmp    1230 <print_number_as_visualized_binary+0x100>
lea    0xe9e(%rip),%rdi
jmp    1230 <print_number_as_visualized_binary+0x100>
lea    0xe9c(%rip),%rdi
jmp    1230 <print_number_as_visualized_binary+0x100>
lea    0xe9a(%rip),%rdi
jmp    1230 <print_number_as_visualized_binary+0x100>
lea    0xe98(%rip),%rdi
jmp    1230 <print_number_as_visualized_binary+0x100>
lea    0xe96(%rip),%rdi
jmp    1230 <print_number_as_visualized_binary+0x100>
lea    0xe94(%rip),%rdi
jmp    1230 <print_number_as_visualized_binary+0x100>
lea    0xe92(%rip),%rdi
jmp    1230 <print_number_as_visualized_binary+0x100>
lea    0xe90(%rip),%rdi
jmp    1230 <print_number_as_visualized_binary+0x100>
lea    0xe8e(%rip),%rdi
jmp    1230 <print_number_as_visualized_binary+0x100>
lea    0xe8c(%rip),%rdi
jmp    1230 <print_number_as_visualized_binary+0x100>
lea    0xe8a(%rip),%rdi
jmp    1230 <print_number_as_visualized_binary+0x100>
lea    0xe88(%rip),%rdi
jmp    1230 <print_number_as_visualized_binary+0x100>
lea    0xe86(%rip),%rdi
jmp    1230 <print_number_as_visualized_binary+0x100>
lea    0xe84(%rip),%rdi
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x3(%r13),%esi
mov    %r15,%rdi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
test   %r14d,%r14d
je     1261 <print_number_as_visualized_binary+0x131>
shr    $0x4,%ebp
lea    -0x4(%rbx),%eax
add    $0x4,%r13d
test   %ebx,%ebx
mov    %eax,%ebx
jne    1160 <print_number_as_visualized_binary+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c" 0000 \00"
@.str.1 = [7 x i8] c" 0001 \00"
@.str.2 = [7 x i8] c" 0010 \00"
@.str.3 = [7 x i8] c" 0011 \00"
@.str.4 = [7 x i8] c" 0100 \00"
@.str.5 = [7 x i8] c" 0101 \00"
@.str.6 = [7 x i8] c" 0110 \00"
@.str.7 = [7 x i8] c" 0111 \00"
@.str.8 = [7 x i8] c" 1000 \00"
@.str.9 = [7 x i8] c" 1001 \00"
@.str.10 = [7 x i8] c" 1010 \00"
@.str.11 = [7 x i8] c" 1011 \00"
@.str.12 = [7 x i8] c" 1100 \00"
@.str.13 = [7 x i8] c" 1101 \00"
@.str.14 = [7 x i8] c" 1110 \00"
@.str.15 = [7 x i8] c" 1111 \00"
@.str.16 = [7 x i8] c"oops.\0A\00"
@.str.17 = [19 x i8] c"(bits %2d -> %2d)\0A\00"
define void @print_number_as_visualized_binary(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
store i32 -268435456, i32* %5
%7 = load i32, i32* %2
%8 = call i32 @nibble_swap(i32 %7)
store i32 %8, i32* %6
store i32 0, i32* %3
br label %9
9: ; preds = %74, %1
%10 = load i32, i32* %3
%11 = zext i32 %10 to i64
%12 = icmp ult i64 %11, 8
br i1 %12, label %13, label %77
13: ; preds = %9
%14 = load i32, i32* %6
%15 = load i32, i32* %5
%16 = and i32 %14, %15
%17 = load i32, i32* %3
%18 = mul i32 %17, 4
%19 = sub i32 28, %18
%20 = lshr i32 %16, %19
store i32 %20, i32* %4
%21 = load i32, i32* %6
%22 = load i32, i32* %5
%23 = xor i32 %22, -1
%24 = and i32 %21, %23
store i32 %24, i32* %6
%25 = load i32, i32* %5
%26 = lshr i32 %25, 4
store i32 %26, i32* %5
%27 = load i32, i32* %4
switch i32 %27, label %60 [
i32 0, label %28
i32 1, label %30
i32 2, label %32
i32 3, label %34
i32 4, label %36
i32 5, label %38
i32 6, label %40
i32 7, label %42
i32 8, label %44
i32 9, label %46
i32 10, label %48
i32 11, label %50
i32 12, label %52
i32 13, label %54
i32 14, label %56
i32 15, label %58
]
28: ; preds = %13
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %62
30: ; preds = %13
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %62
32: ; preds = %13
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %62
34: ; preds = %13
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %62
36: ; preds = %13
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %62
38: ; preds = %13
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
br label %62
40: ; preds = %13
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
br label %62
42: ; preds = %13
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
br label %62
44: ; preds = %13
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
br label %62
46: ; preds = %13
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
br label %62
48: ; preds = %13
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
br label %62
50: ; preds = %13
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
br label %62
52: ; preds = %13
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0))
br label %62
54: ; preds = %13
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0))
br label %62
56: ; preds = %13
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0))
br label %62
58: ; preds = %13
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0))
br label %62
60: ; preds = %13
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0))
br label %62
62: ; preds = %60, %58, %56, %54, %52, %50, %48, %46, %44, %42, %40, %38, %36, %34, %32, %30, %28
%63 = load i32, i32* %3
%64 = mul i32 %63, 4
%65 = add i32 %64, 4
%66 = sub i32 %65, 1
%67 = load i32, i32* %3
%68 = mul i32 %67, 4
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.17, i64 0, i64 0), i32 %66, i32 %68)
%70 = load i32, i32* %6
%71 = icmp ne i32 %70, 0
br i1 %71, label %73, label %72
72: ; preds = %62
br label %77
73: ; preds = %62
br label %74
74: ; preds = %73
%75 = load i32, i32* %3
%76 = add i32 %75, 1
store i32 %76, i32* %3
br label %9
77: ; preds = %72, %9
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c" 0000 \00"
@.str.1 = [7 x i8] c" 0001 \00"
@.str.2 = [7 x i8] c" 0010 \00"
@.str.3 = [7 x i8] c" 0011 \00"
@.str.4 = [7 x i8] c" 0100 \00"
@.str.5 = [7 x i8] c" 0101 \00"
@.str.6 = [7 x i8] c" 0110 \00"
@.str.7 = [7 x i8] c" 0111 \00"
@.str.8 = [7 x i8] c" 1000 \00"
@.str.9 = [7 x i8] c" 1001 \00"
@.str.10 = [7 x i8] c" 1010 \00"
@.str.11 = [7 x i8] c" 1011 \00"
@.str.12 = [7 x i8] c" 1100 \00"
@.str.13 = [7 x i8] c" 1101 \00"
@.str.14 = [7 x i8] c" 1110 \00"
@.str.15 = [7 x i8] c" 1111 \00"
@.str.17 = [19 x i8] c"(bits %2d -> %2d)\0A\00"
@str = [6 x i8] c"oops.\00"
define void @print_number_as_visualized_binary(i32 %0) {
%2 = tail call i32 @nibble_swap(i32 %0)
br label %3
3: ; preds = %48, %1
%4 = phi i32 [ %2, %1 ], [ %12, %48 ]
%5 = phi i32 [ -268435456, %1 ], [ %13, %48 ]
%6 = phi i32 [ 0, %1 ], [ %52, %48 ]
%7 = and i32 %4, %5
%8 = shl nuw nsw i32 %6, 2
%9 = sub nuw nsw i32 28, %8
%10 = lshr i32 %7, %9
%11 = xor i32 %5, -1
%12 = and i32 %4, %11
%13 = lshr i32 %5, 4
switch i32 %10, label %46 [
i32 0, label %14
i32 1, label %16
i32 2, label %18
i32 3, label %20
i32 4, label %22
i32 5, label %24
i32 6, label %26
i32 7, label %28
i32 8, label %30
i32 9, label %32
i32 10, label %34
i32 11, label %36
i32 12, label %38
i32 13, label %40
i32 14, label %42
i32 15, label %44
]
14: ; preds = %3
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %48
16: ; preds = %3
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %48
18: ; preds = %3
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %48
20: ; preds = %3
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %48
22: ; preds = %3
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %48
24: ; preds = %3
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
br label %48
26: ; preds = %3
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
br label %48
28: ; preds = %3
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
br label %48
30: ; preds = %3
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
br label %48
32: ; preds = %3
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
br label %48
34: ; preds = %3
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
br label %48
36: ; preds = %3
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
br label %48
38: ; preds = %3
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0))
br label %48
40: ; preds = %3
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0))
br label %48
42: ; preds = %3
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0))
br label %48
44: ; preds = %3
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0))
br label %48
46: ; preds = %3
%47 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
br label %48
48: ; preds = %46, %44, %42, %40, %38, %36, %34, %32, %30, %28, %26, %24, %22, %20, %18, %16, %14
%49 = or i32 %8, 3
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.17, i64 0, i64 0), i32 %49, i32 %8)
%51 = icmp eq i32 %12, 0
%52 = add nuw nsw i32 %6, 1
%53 = icmp eq i32 %52, 8
%54 = select i1 %51, i1 true, i1 %53
br i1 %54, label %55, label %3
55: ; preds = %48
ret void
}