#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 */
struct list {
  int dummy;
};
struct boper {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ bins_or_(int /*<<< orphan*/, struct boper *,
                            int /*<<< orphan*/);
int /*<<< orphan*/ bins_shl_(int /*<<< orphan*/, int /*<<< orphan*/,
                             int /*<<< orphan*/);
int /*<<< orphan*/ bins_shr_(int /*<<< orphan*/, struct boper *,
                             struct boper *);
int /*<<< orphan*/ bins_sub_(int /*<<< orphan*/, int /*<<< orphan*/,
                             int /*<<< orphan*/);
unsigned int boper_bits(struct boper *);
int /*<<< orphan*/ boper_constant(unsigned int, unsigned int);
int /*<<< orphan*/ boper_variable(unsigned int, char *);
int /*<<< orphan*/ list_append_(struct list *, int /*<<< orphan*/);
struct list *list_create();
int /*<<< orphan*/ object_copy(struct boper *);
struct list *bins_ror_(struct boper *dst, struct boper *operand,
                       struct boper *bits) {
  struct list *list = list_create();
  unsigned int bit_width = boper_bits(dst);
  list_append_(list, bins_sub_(boper_variable(bit_width, "ror_TMP_BITS"),
                               boper_constant(bit_width, bit_width),
                               object_copy(bits)));
  list_append_(list, bins_shl_(boper_variable(bit_width, "ror_TMP"),
                               object_copy(operand),
                               boper_variable(bit_width, "ror_TMP_BITS")));
  list_append_(list, bins_shr_(object_copy(dst), operand, bits));
  list_append_(list, bins_or_(object_copy(dst), dst,
                              boper_variable(bit_width, "ror_TMP")));
  return list;
}


x86 assembly (clang, -O0):
<bins_ror_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1030 <list_create@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <boper_bits@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x24(%rbp),%edi
lea    0xe23(%rip),%rsi
call   10b0 <boper_variable@plt>
mov    %eax,-0x68(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x24(%rbp),%esi
call   1070 <boper_constant@plt>
mov    %eax,-0x64(%rbp)
mov    -0x18(%rbp),%rdi
call   10a0 <object_copy@plt>
mov    -0x68(%rbp),%edi
mov    -0x64(%rbp),%esi
mov    %eax,%edx
call   1050 <bins_sub_@plt>
mov    -0x60(%rbp),%rdi
mov    %eax,%esi
call   1090 <list_append_@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x24(%rbp),%edi
lea    0xde7(%rip),%rsi
call   10b0 <boper_variable@plt>
mov    %eax,-0x58(%rbp)
mov    -0x10(%rbp),%rdi
call   10a0 <object_copy@plt>
mov    %eax,-0x54(%rbp)
mov    -0x24(%rbp),%edi
lea    0xdbc(%rip),%rsi
call   10b0 <boper_variable@plt>
mov    -0x58(%rbp),%edi
mov    -0x54(%rbp),%esi
mov    %eax,%edx
call   10c0 <bins_shl_@plt>
mov    -0x50(%rbp),%rdi
mov    %eax,%esi
call   1090 <list_append_@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
call   10a0 <object_copy@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1080 <bins_shr_@plt>
mov    -0x48(%rbp),%rdi
mov    %eax,%esi
call   1090 <list_append_@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   10a0 <object_copy@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x24(%rbp),%edi
lea    0xd5b(%rip),%rsi
call   10b0 <boper_variable@plt>
mov    -0x3c(%rbp),%edi
mov    -0x38(%rbp),%rsi
mov    %eax,%edx
call   1040 <bins_or_@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,%esi
call   1090 <list_append_@plt>
mov    -0x20(%rbp),%rax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bins_ror_>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%rbx
mov    %rdx,0x10(%rsp)
mov    %rsi,0x8(%rsp)
mov    %rdi,%r14
xor    %eax,%eax
call   1030 <list_create@plt>
mov    %rax,%r12
mov    %r14,%rdi
call   1060 <boper_bits@plt>
mov    %eax,%ebp
lea    0xe27(%rip),%rsi
mov    %eax,%edi
call   10b0 <boper_variable@plt>
mov    %eax,%r13d
mov    %ebp,%edi
mov    %ebp,%esi
call   1070 <boper_constant@plt>
mov    %eax,%r15d
mov    %rbx,%rdi
call   10a0 <object_copy@plt>
mov    %r13d,%edi
mov    %r15d,%esi
mov    %eax,%edx
call   1050 <bins_sub_@plt>
mov    %r12,%rdi
mov    %eax,%esi
call   1090 <list_append_@plt>
lea    0xdf8(%rip),%rsi
mov    %ebp,%edi
call   10b0 <boper_variable@plt>
mov    %eax,%r15d
mov    0x8(%rsp),%r13
mov    %r13,%rdi
call   10a0 <object_copy@plt>
mov    %eax,%ebx
mov    %ebp,%edi
lea    0xdc9(%rip),%rsi
call   10b0 <boper_variable@plt>
mov    %r15d,%edi
mov    %ebx,%esi
mov    %eax,%edx
call   10c0 <bins_shl_@plt>
mov    %r12,%rdi
mov    %eax,%esi
call   1090 <list_append_@plt>
mov    %r14,%rdi
call   10a0 <object_copy@plt>
mov    %eax,%edi
mov    %r13,%rsi
mov    0x10(%rsp),%rdx
call   1080 <bins_shr_@plt>
mov    %r12,%rdi
mov    %eax,%esi
call   1090 <list_append_@plt>
mov    %r14,%rdi
call   10a0 <object_copy@plt>
mov    %eax,%ebx
mov    %ebp,%edi
lea    0xd87(%rip),%rsi
call   10b0 <boper_variable@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %eax,%edx
call   1040 <bins_or_@plt>
mov    %r12,%rdi
mov    %eax,%esi
call   1090 <list_append_@plt>
mov    %r12,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.list = type { i32 }
%struct.boper = type { i32 }
@.str = [13 x i8] c"ror_TMP_BITS\00"
@.str.1 = [8 x i8] c"ror_TMP\00"
define %struct.list* @bins_ror_(%struct.boper* %0, %struct.boper* %1, %struct.boper* %2) {
%4 = alloca %struct.boper*
%5 = alloca %struct.boper*
%6 = alloca %struct.boper*
%7 = alloca %struct.list*
%8 = alloca i32
store %struct.boper* %0, %struct.boper** %4
store %struct.boper* %1, %struct.boper** %5
store %struct.boper* %2, %struct.boper** %6
%9 = call %struct.list* (...) @list_create()
store %struct.list* %9, %struct.list** %7
%10 = load %struct.boper*, %struct.boper** %4
%11 = call i32 @boper_bits(%struct.boper* %10)
store i32 %11, i32* %8
%12 = load %struct.list*, %struct.list** %7
%13 = load i32, i32* %8
%14 = call i32 @boper_variable(i32 %13, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* %8
%16 = load i32, i32* %8
%17 = call i32 @boper_constant(i32 %15, i32 %16)
%18 = load %struct.boper*, %struct.boper** %6
%19 = call i32 @object_copy(%struct.boper* %18)
%20 = call i32 @bins_sub_(i32 %14, i32 %17, i32 %19)
%21 = call i32 @list_append_(%struct.list* %12, i32 %20)
%22 = load %struct.list*, %struct.list** %7
%23 = load i32, i32* %8
%24 = call i32 @boper_variable(i32 %23, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%25 = load %struct.boper*, %struct.boper** %5
%26 = call i32 @object_copy(%struct.boper* %25)
%27 = load i32, i32* %8
%28 = call i32 @boper_variable(i32 %27, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%29 = call i32 @bins_shl_(i32 %24, i32 %26, i32 %28)
%30 = call i32 @list_append_(%struct.list* %22, i32 %29)
%31 = load %struct.list*, %struct.list** %7
%32 = load %struct.boper*, %struct.boper** %4
%33 = call i32 @object_copy(%struct.boper* %32)
%34 = load %struct.boper*, %struct.boper** %5
%35 = load %struct.boper*, %struct.boper** %6
%36 = call i32 @bins_shr_(i32 %33, %struct.boper* %34, %struct.boper* %35)
%37 = call i32 @list_append_(%struct.list* %31, i32 %36)
%38 = load %struct.list*, %struct.list** %7
%39 = load %struct.boper*, %struct.boper** %4
%40 = call i32 @object_copy(%struct.boper* %39)
%41 = load %struct.boper*, %struct.boper** %4
%42 = load i32, i32* %8
%43 = call i32 @boper_variable(i32 %42, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%44 = call i32 @bins_or_(i32 %40, %struct.boper* %41, i32 %43)
%45 = call i32 @list_append_(%struct.list* %38, i32 %44)
%46 = load %struct.list*, %struct.list** %7
ret %struct.list* %46
}

LLVM IR (-O2):
%struct.list = type { i32 }
%struct.boper = type { i32 }
@.str = [13 x i8] c"ror_TMP_BITS\00"
@.str.1 = [8 x i8] c"ror_TMP\00"
define %struct.list* @bins_ror_(%struct.boper* %0, %struct.boper* %1, %struct.boper* %2) {
%4 = tail call %struct.list* (...) @list_create()
%5 = tail call i32 @boper_bits(%struct.boper* %0)
%6 = tail call i32 @boper_variable(i32 %5, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @boper_constant(i32 %5, i32 %5)
%8 = tail call i32 @object_copy(%struct.boper* %2)
%9 = tail call i32 @bins_sub_(i32 %6, i32 %7, i32 %8)
%10 = tail call i32 @list_append_(%struct.list* %4, i32 %9)
%11 = tail call i32 @boper_variable(i32 %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%12 = tail call i32 @object_copy(%struct.boper* %1)
%13 = tail call i32 @boper_variable(i32 %5, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%14 = tail call i32 @bins_shl_(i32 %11, i32 %12, i32 %13)
%15 = tail call i32 @list_append_(%struct.list* %4, i32 %14)
%16 = tail call i32 @object_copy(%struct.boper* %0)
%17 = tail call i32 @bins_shr_(i32 %16, %struct.boper* %1, %struct.boper* %2)
%18 = tail call i32 @list_append_(%struct.list* %4, i32 %17)
%19 = tail call i32 @object_copy(%struct.boper* %0)
%20 = tail call i32 @boper_variable(i32 %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%21 = tail call i32 @bins_or_(i32 %19, %struct.boper* %0, i32 %20)
%22 = tail call i32 @list_append_(%struct.list* %4, i32 %21)
ret %struct.list* %4
}