#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 *);
print_block(char block) {
  int x, y;
  for (y = 0; y < 2; y++) {
    for (x = 0; x < 4; x++) {
      if ((block >> (y * 4 + x)) & 0x1) {
        printf("O");
      } else {
        printf(".");
      }
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print_block>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x2,-0x10(%rbp)
jge    11a5 <print_block+0x95>
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    118b <print_block+0x7b>
movsbl -0x5(%rbp),%eax
mov    -0x10(%rbp),%ecx
shl    $0x2,%ecx
add    -0xc(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     116c <print_block+0x5c>
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
jmp    1178 <print_block+0x68>
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
jmp    117d <print_block+0x6d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1136 <print_block+0x26>
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1125 <print_block+0x15>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_block>:
push   %rbp
push   %r14
push   %rbx
movd   %edi,%xmm0
pshufd $0x0,%xmm0,%xmm0
movdqa 0xedb(%rip),%xmm1
pand   %xmm0,%xmm1
pand   0xedf(%rip),%xmm0
pxor   %xmm2,%xmm2
pcmpeqd %xmm2,%xmm0
pcmpeqd %xmm2,%xmm1
packssdw %xmm0,%xmm1
packsswb %xmm1,%xmm1
pmovmskb %xmm1,%ebp
test   $0x80,%bpl
mov    $0x2e,%ebx
mov    $0x4f,%r14d
mov    $0x4f,%edi
cmovne %ebx,%edi
call   1030 <putchar@plt>
test   $0x40,%bpl
mov    $0x4f,%edi
cmovne %ebx,%edi
call   1030 <putchar@plt>
test   $0x20,%bpl
mov    $0x4f,%edi
cmovne %ebx,%edi
call   1030 <putchar@plt>
test   $0x10,%bpl
mov    $0x4f,%edi
cmovne %ebx,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   $0x8,%bpl
mov    $0x4f,%edi
cmovne %ebx,%edi
call   1030 <putchar@plt>
test   $0x4,%bpl
mov    $0x4f,%edi
cmovne %ebx,%edi
call   1030 <putchar@plt>
test   $0x2,%bpl
mov    $0x4f,%edi
cmovne %ebx,%edi
call   1030 <putchar@plt>
test   $0x1,%bpl
cmovne %ebx,%r14d
mov    %r14d,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define i32 @print_block(i8 signext %0) {
%2 = zext i8 %0 to i32
%3 = insertelement <8 x i32> poison, i32 %2, i64 0
%4 = shufflevector <8 x i32> %3, <8 x i32> poison, <8 x i32> zeroinitializer
%5 = and <8 x i32> %4, <i32 128, i32 64, i32 32, i32 16, i32 8, i32 4, i32 2, i32 1>
%6 = icmp eq <8 x i32> %5, zeroinitializer
%7 = extractelement <8 x i1> %6, i64 7
%8 = select i1 %7, i32 46, i32 79
%9 = tail call i32 @putchar(i32 %8)
%10 = extractelement <8 x i1> %6, i64 6
%11 = select i1 %10, i32 46, i32 79
%12 = tail call i32 @putchar(i32 %11)
%13 = extractelement <8 x i1> %6, i64 5
%14 = select i1 %13, i32 46, i32 79
%15 = tail call i32 @putchar(i32 %14)
%16 = extractelement <8 x i1> %6, i64 4
%17 = select i1 %16, i32 46, i32 79
%18 = tail call i32 @putchar(i32 %17)
%19 = tail call i32 @putchar(i32 10)
%20 = extractelement <8 x i1> %6, i64 3
%21 = select i1 %20, i32 46, i32 79
%22 = tail call i32 @putchar(i32 %21)
%23 = extractelement <8 x i1> %6, i64 2
%24 = select i1 %23, i32 46, i32 79
%25 = tail call i32 @putchar(i32 %24)
%26 = extractelement <8 x i1> %6, i64 1
%27 = select i1 %26, i32 46, i32 79
%28 = tail call i32 @putchar(i32 %27)
%29 = extractelement <8 x i1> %6, i64 0
%30 = select i1 %29, i32 46, i32 79
%31 = tail call i32 @putchar(i32 %30)
%32 = tail call i32 @putchar(i32 10)
ret i32 undef
}