#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*/ displayBits(char);
int /*<<< orphan*/ printf(char *, char, ...);
void unpackCharacters(unsigned packed) {
  unsigned temp = packed;
  unsigned maskA = 65280, maskB = 255;
  char a, b;
  temp &= maskA;
  temp >>= 8;
  a = temp;
  packed &= maskB;
  b = packed;
  printf("a = %c\nb = %c\n", a, b);
  printf("%c = ", a);
  displayBits(a);
  printf("%c = ", b);
  displayBits(b);
}


x86 assembly (clang, -O0):
<unpackCharacters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0xff00,-0xc(%rbp)
movl   $0xff,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x8,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %al,-0x12(%rbp)
mov    -0x11(%rbp),%al
movsbl -0x12(%rbp),%edx
lea    0xe8c(%rip),%rdi
movsbl %al,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8a(%rip),%rdi
movsbl -0x11(%rbp),%esi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x11(%rbp),%edi
call   1040 <displayBits@plt>
lea    0xe6f(%rip),%rdi
movsbl -0x12(%rbp),%esi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x12(%rbp),%edi
call   1040 <displayBits@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unpackCharacters>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%eax
shr    $0x8,%eax
movsbl %al,%ebx
lea    0xecd(%rip),%rax
movsbl %dil,%ebp
mov    %rax,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec3(%rip),%r14
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebx,%edi
call   1040 <displayBits@plt>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebp,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <displayBits@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"a = %c\0Ab = %c\0A\00"
@.str.1 = [6 x i8] c"%c = \00"
define void @unpackCharacters(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
%7 = alloca i8
store i32 %0, i32* %2
%8 = load i32, i32* %2
store i32 %8, i32* %3
store i32 65280, i32* %4
store i32 255, i32* %5
%9 = load i32, i32* %4
%10 = load i32, i32* %3
%11 = and i32 %10, %9
store i32 %11, i32* %3
%12 = load i32, i32* %3
%13 = lshr i32 %12, 8
store i32 %13, i32* %3
%14 = load i32, i32* %3
%15 = trunc i32 %14 to i8
store i8 %15, i8* %6
%16 = load i32, i32* %5
%17 = load i32, i32* %2
%18 = and i32 %17, %16
store i32 %18, i32* %2
%19 = load i32, i32* %2
%20 = trunc i32 %19 to i8
store i8 %20, i8* %7
%21 = load i8, i8* %6
%22 = load i8, i8* %7
%23 = sext i8 %22 to i32
%24 = call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8 signext %21, i32 %23)
%25 = load i8, i8* %6
%26 = call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 signext %25)
%27 = load i8, i8* %6
%28 = call i32 @displayBits(i8 signext %27)
%29 = load i8, i8* %7
%30 = call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 signext %29)
%31 = load i8, i8* %7
%32 = call i32 @displayBits(i8 signext %31)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"a = %c\0Ab = %c\0A\00"
@.str.1 = [6 x i8] c"%c = \00"
define void @unpackCharacters(i32 %0) {
%2 = lshr i32 %0, 8
%3 = trunc i32 %2 to i8
%4 = trunc i32 %0 to i8
%5 = shl i32 %0, 24
%6 = ashr exact i32 %5, 24
%7 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8 signext %3, i32 %6)
%8 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 signext %3)
%9 = tail call i32 @displayBits(i8 signext %3)
%10 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 signext %4)
%11 = tail call i32 @displayBits(i8 signext %4)
ret void
}