#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 *, unsigned int);
int main(void) {
  unsigned int original = 0xABC;
  unsigned int result = 0;
  unsigned int mask = 0xF;
  printf("\n original = %X", original);
  result |= original & mask;
  original >>= 4;
  result <<= 4;
  result |= original & mask;
  original >>= 4;
  result <<= 4;
  result |= original & mask;
  printf("\t result = %X\n", result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xabc,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0xf,-0x10(%rbp)
mov    -0x8(%rbp),%esi
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
and    -0x10(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x4,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    -0x10(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x4,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    -0x10(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0xabc,%esi
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
mov    $0xcba,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"\0A original = %X\00"
@.str.1 = [15 x i8] c"\09 result = %X\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 2748, i32* %2
store i32 0, i32* %3
store i32 15, i32* %4
%5 = load i32, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %2
%8 = load i32, i32* %4
%9 = and i32 %7, %8
%10 = load i32, i32* %3
%11 = or i32 %10, %9
store i32 %11, i32* %3
%12 = load i32, i32* %2
%13 = lshr i32 %12, 4
store i32 %13, i32* %2
%14 = load i32, i32* %3
%15 = shl i32 %14, 4
store i32 %15, i32* %3
%16 = load i32, i32* %2
%17 = load i32, i32* %4
%18 = and i32 %16, %17
%19 = load i32, i32* %3
%20 = or i32 %19, %18
store i32 %20, i32* %3
%21 = load i32, i32* %2
%22 = lshr i32 %21, 4
store i32 %22, i32* %2
%23 = load i32, i32* %3
%24 = shl i32 %23, 4
store i32 %24, i32* %3
%25 = load i32, i32* %2
%26 = load i32, i32* %4
%27 = and i32 %25, %26
%28 = load i32, i32* %3
%29 = or i32 %28, %27
store i32 %29, i32* %3
%30 = load i32, i32* %3
%31 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"\0A original = %X\00"
@.str.1 = [15 x i8] c"\09 result = %X\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 2748)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 3258)
ret i32 0
}