#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 EXIT_SUCCESS;
unsigned char left_rotation(unsigned char, int);
int /*<<< orphan*/ printf(char *, unsigned char, unsigned char, unsigned char,
                          unsigned char);
unsigned char right_rotation(unsigned char, int);
int main(void) {
  unsigned char val1 = 0xAF;
  unsigned char valr = right_rotation(val1, 4);
  unsigned char vall = left_rotation(val1, 3);
  printf("Before : %d (0x%X)\nAfter  : %d (0x%X)\n", val1, val1, valr, valr);
  printf("Before : %d (0x%X)\nAfter  : %d (0x%X)\n", val1, val1, vall, vall);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0xaf,-0x5(%rbp)
mov    $0x4,%esi
movzbl -0x5(%rbp),%edi
call   1030 <right_rotation@plt>
mov    %al,-0x6(%rbp)
mov    $0x3,%esi
movzbl -0x5(%rbp),%edi
call   1050 <left_rotation@plt>
mov    %al,-0x7(%rbp)
mov    -0x5(%rbp),%dl
mov    -0x5(%rbp),%cl
mov    -0x6(%rbp),%al
lea    0xe8b(%rip),%rdi
movzbl %dl,%esi
movzbl %cl,%edx
movzbl %al,%ecx
movzbl -0x6(%rbp),%r8d
call   1040 <printf@plt>
mov    -0x5(%rbp),%dl
mov    -0x5(%rbp),%cl
mov    -0x7(%rbp),%al
lea    0xe68(%rip),%rdi
movzbl %dl,%esi
movzbl %cl,%edx
movzbl %al,%ecx
movzbl -0x7(%rbp),%r8d
call   1040 <printf@plt>
mov    0x2e2e(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0xaf,%edi
mov    $0x4,%esi
call   1030 <right_rotation@plt>
mov    %eax,%ebx
mov    $0xaf,%edi
mov    $0x3,%esi
call   1050 <left_rotation@plt>
mov    %eax,%ebp
movzbl %bl,%ecx
lea    0xea1(%rip),%rbx
mov    %rbx,%rdi
mov    $0xaf,%esi
mov    $0xaf,%edx
mov    %ecx,%r8d
call   1040 <printf@plt>
movzbl %bpl,%ecx
mov    %rbx,%rdi
mov    $0xaf,%esi
mov    $0xaf,%edx
mov    %ecx,%r8d
call   1040 <printf@plt>
mov    0x2e4c(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [39 x i8] c"Before : %d (0x%X)\0AAfter : %d (0x%X)\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
%4 = alloca i8
store i32 0, i32* %1
store i8 -81, i8* %2
%5 = load i8, i8* %2
%6 = call zeroext i8 @right_rotation(i8 zeroext %5, i32 4)
store i8 %6, i8* %3
%7 = load i8, i8* %2
%8 = call zeroext i8 @left_rotation(i8 zeroext %7, i32 3)
store i8 %8, i8* %4
%9 = load i8, i8* %2
%10 = load i8, i8* %2
%11 = load i8, i8* %3
%12 = load i8, i8* %3
%13 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8 zeroext %9, i8 zeroext %10, i8 zeroext %11, i8 zeroext %12)
%14 = load i8, i8* %2
%15 = load i8, i8* %2
%16 = load i8, i8* %4
%17 = load i8, i8* %4
%18 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8 zeroext %14, i8 zeroext %15, i8 zeroext %16, i8 zeroext %17)
%19 = load i32, i32* @EXIT_SUCCESS
ret i32 %19
}

LLVM IR (-O2):
@.str = [39 x i8] c"Before : %d (0x%X)\0AAfter : %d (0x%X)\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call zeroext i8 @right_rotation(i8 zeroext -81, i32 4)
%2 = tail call zeroext i8 @left_rotation(i8 zeroext -81, i32 3)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8 zeroext -81, i8 zeroext -81, i8 zeroext %1, i8 zeroext %1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8 zeroext -81, i8 zeroext -81, i8 zeroext %2, i8 zeroext %2)
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}