#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*/ dec2bin(int);
int /*<<< orphan*/ printf(char *);
int rightrot(unsigned int, int);
int main(void) {
  unsigned x = 170;
  int n = 3;
  int result = rightrot(x, n);
  printf("x   = ");
  dec2bin(x);
  printf("n   = ");
  dec2bin(n);
  printf("result   = ");
  dec2bin(result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xaa,-0x8(%rbp)
movl   $0x3,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <rightrot@plt>
mov    %eax,-0x10(%rbp)
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
call   1050 <dec2bin@plt>
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
call   1050 <dec2bin@plt>
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%edi
call   1050 <dec2bin@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xaa,%edi
mov    $0x3,%esi
call   1040 <rightrot@plt>
mov    %eax,%ebx
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
mov    $0xaa,%edi
call   1050 <dec2bin@plt>
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
mov    $0x3,%edi
call   1050 <dec2bin@plt>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
mov    %ebx,%edi
call   1050 <dec2bin@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"x = \00"
@.str.1 = [7 x i8] c"n = \00"
@.str.2 = [12 x i8] c"result = \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 170, i32* %2
store i32 3, i32* %3
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = call i32 @rightrot(i32 %5, i32 %6)
store i32 %7, i32* %4
%8 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* %2
%10 = call i32 @dec2bin(i32 %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32, i32* %3
%13 = call i32 @dec2bin(i32 %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%15 = load i32, i32* %4
%16 = call i32 @dec2bin(i32 %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"x = \00"
@.str.1 = [7 x i8] c"n = \00"
@.str.2 = [12 x i8] c"result = \00"
define i32 @main() {
%1 = tail call i32 @rightrot(i32 170, i32 3)
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @dec2bin(i32 170)
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @dec2bin(i32 3)
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @dec2bin(i32 %1)
ret i32 0
}