#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_(struct boper *, struct boper *, struct boper *);
int /*<<< orphan*/ bins_shl_(struct boper *, struct boper *, struct boper *);
int /*<<< orphan*/ bins_shr_(struct boper *, struct boper *, struct boper *);
int /*<<< orphan*/ bins_sub_(struct boper *, struct boper *, struct boper *);
int /*<<< orphan*/ bins_umul_(struct boper *, struct boper *, struct boper *);
unsigned int boper_bits(struct boper *);
struct boper *boper_constant(unsigned int, int);
struct boper *boper_variable(unsigned int, char *);
int /*<<< orphan*/ list_append_(struct list *, int /*<<< orphan*/);
struct list *list_create();
struct boper *object_copy(struct boper *);
struct list *bins_asr_(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_shr_(boper_variable(bit_width, "asr_MASK_BIT"),
                               object_copy(operand),
                               boper_constant(bit_width, bit_width - 1)));
  list_append_(list, bins_sub_(boper_variable(bit_width, "asr_MASK_SIZE"),
                               boper_constant(bit_width, bit_width),
                               object_copy(bits)));
  list_append_(list, bins_shl_(boper_variable(bit_width, "asr_MASK"),
                               boper_constant(bit_width, -1),
                               boper_variable(bit_width, "asr_MASK_SIZE")));
  list_append_(list, bins_umul_(boper_variable(bit_width, "asr_MASK"),
                                boper_variable(bit_width, "asr_MASK"),
                                boper_variable(bit_width, "asr_MASK_BIT")));
  list_append_(list, bins_shr_(object_copy(dst), operand, bits));
  list_append_(list, bins_or_(object_copy(dst), dst,
                              boper_variable(bit_width, "asr_MASK")));
  return list;
}


x86 assembly (clang, -O0):
<bins_asr_>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1040 <list_create@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <boper_bits@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x24(%rbp),%edi
lea    0xe0d(%rip),%rsi
call   10c0 <boper_variable@plt>
mov    %rax,-0xa8(%rbp)
mov    -0x10(%rbp),%rdi
call   10b0 <object_copy@plt>
mov    %rax,-0xa0(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x24(%rbp),%esi
sub    $0x1,%esi
call   1080 <boper_constant@plt>
mov    -0xa8(%rbp),%rdi
mov    -0xa0(%rbp),%rsi
mov    %rax,%rdx
call   1090 <bins_shr_@plt>
mov    -0x98(%rbp),%rdi
mov    %eax,%esi
call   10a0 <list_append_@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x24(%rbp),%edi
lea    0xdba(%rip),%rsi
call   10c0 <boper_variable@plt>
mov    %rax,-0x90(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x24(%rbp),%esi
call   1080 <boper_constant@plt>
mov    %rax,-0x88(%rbp)
mov    -0x18(%rbp),%rdi
call   10b0 <object_copy@plt>
mov    -0x90(%rbp),%rdi
mov    -0x88(%rbp),%rsi
mov    %rax,%rdx
call   1060 <bins_sub_@plt>
mov    -0x80(%rbp),%rdi
mov    %eax,%esi
call   10a0 <list_append_@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x24(%rbp),%edi
lea    0xd6e(%rip),%rsi
call   10c0 <boper_variable@plt>
mov    %rax,-0x78(%rbp)
mov    -0x24(%rbp),%edi
mov    $0xffffffff,%esi
call   1080 <boper_constant@plt>
mov    %rax,-0x70(%rbp)
mov    -0x24(%rbp),%edi
lea    0xd3c(%rip),%rsi
call   10c0 <boper_variable@plt>
mov    -0x78(%rbp),%rdi
mov    -0x70(%rbp),%rsi
mov    %rax,%rdx
call   10d0 <bins_shl_@plt>
mov    -0x68(%rbp),%rdi
mov    %eax,%esi
call   10a0 <list_append_@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x24(%rbp),%edi
lea    0xd18(%rip),%rsi
call   10c0 <boper_variable@plt>
mov    %rax,-0x60(%rbp)
mov    -0x24(%rbp),%edi
lea    0xd05(%rip),%rsi
call   10c0 <boper_variable@plt>
mov    %rax,-0x58(%rbp)
mov    -0x24(%rbp),%edi
lea    0xcd7(%rip),%rsi
call   10c0 <boper_variable@plt>
mov    -0x60(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    %rax,%rdx
call   1030 <bins_umul_@plt>
mov    -0x50(%rbp),%rdi
mov    %eax,%esi
call   10a0 <list_append_@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
call   10b0 <object_copy@plt>
mov    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1090 <bins_shr_@plt>
mov    -0x48(%rbp),%rdi
mov    %eax,%esi
call   10a0 <list_append_@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   10b0 <object_copy@plt>
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x24(%rbp),%edi
lea    0xc7f(%rip),%rsi
call   10c0 <boper_variable@plt>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    %rax,%rdx
call   1050 <bins_or_@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,%esi
call   10a0 <list_append_@plt>
mov    -0x20(%rbp),%rax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bins_asr_>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r14
mov    %rsi,%rbp
mov    %rsi,0x8(%rsp)
mov    %rdi,%rbx
mov    %rdi,0x10(%rsp)
xor    %eax,%eax
call   1040 <list_create@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1070 <boper_bits@plt>
mov    %eax,%ebx
lea    0xe14(%rip),%rsi
mov    %eax,%edi
call   10c0 <boper_variable@plt>
mov    %rax,%r12
mov    %rbp,%rdi
call   10b0 <object_copy@plt>
mov    %rax,%rbp
lea    -0x1(%rbx),%esi
mov    %ebx,%edi
call   1080 <boper_constant@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
mov    %rax,%rdx
call   1090 <bins_shr_@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   10a0 <list_append_@plt>
lea    0xde3(%rip),%rsi
mov    %ebx,%edi
call   10c0 <boper_variable@plt>
mov    %rax,%rbp
mov    %ebx,%edi
mov    %ebx,%esi
call   1080 <boper_constant@plt>
mov    %rax,%r13
mov    %r14,%rdi
call   10b0 <object_copy@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %rax,%rdx
call   1060 <bins_sub_@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   10a0 <list_append_@plt>
lea    0xdb4(%rip),%r13
mov    %ebx,%edi
mov    %r13,%rsi
call   10c0 <boper_variable@plt>
mov    %rax,%rbp
mov    %ebx,%edi
mov    $0xffffffff,%esi
call   1080 <boper_constant@plt>
mov    %rax,%r12
mov    %ebx,%edi
lea    0xd81(%rip),%rsi
call   10c0 <boper_variable@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
mov    %rax,%rdx
call   10d0 <bins_shl_@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   10a0 <list_append_@plt>
mov    %ebx,%edi
mov    %r13,%rsi
call   10c0 <boper_variable@plt>
mov    %rax,%r12
mov    %ebx,%edi
mov    %r13,%rsi
call   10c0 <boper_variable@plt>
mov    %rax,%rbp
mov    %ebx,%edi
lea    0xd34(%rip),%rsi
call   10c0 <boper_variable@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
mov    %rax,%rdx
call   1030 <bins_umul_@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   10a0 <list_append_@plt>
mov    0x10(%rsp),%rbp
mov    %rbp,%rdi
call   10b0 <object_copy@plt>
mov    %rax,%rdi
mov    0x8(%rsp),%rsi
mov    %r14,%rdx
call   1090 <bins_shr_@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   10a0 <list_append_@plt>
mov    %rbp,%rdi
mov    %rbp,%r14
call   10b0 <object_copy@plt>
mov    %rax,%rbp
mov    %ebx,%edi
mov    %r13,%rsi
call   10c0 <boper_variable@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %rax,%rdx
call   1050 <bins_or_@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   10a0 <list_append_@plt>
mov    %r15,%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"asr_MASK_BIT\00"
@.str.1 = [14 x i8] c"asr_MASK_SIZE\00"
@.str.2 = [9 x i8] c"asr_MASK\00"
define %struct.list* @bins_asr_(%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 %struct.boper* @boper_variable(i32 %13, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%15 = load %struct.boper*, %struct.boper** %5
%16 = call %struct.boper* @object_copy(%struct.boper* %15)
%17 = load i32, i32* %8
%18 = load i32, i32* %8
%19 = sub i32 %18, 1
%20 = call %struct.boper* @boper_constant(i32 %17, i32 %19)
%21 = call i32 @bins_shr_(%struct.boper* %14, %struct.boper* %16, %struct.boper* %20)
%22 = call i32 @list_append_(%struct.list* %12, i32 %21)
%23 = load %struct.list*, %struct.list** %7
%24 = load i32, i32* %8
%25 = call %struct.boper* @boper_variable(i32 %24, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%26 = load i32, i32* %8
%27 = load i32, i32* %8
%28 = call %struct.boper* @boper_constant(i32 %26, i32 %27)
%29 = load %struct.boper*, %struct.boper** %6
%30 = call %struct.boper* @object_copy(%struct.boper* %29)
%31 = call i32 @bins_sub_(%struct.boper* %25, %struct.boper* %28, %struct.boper* %30)
%32 = call i32 @list_append_(%struct.list* %23, i32 %31)
%33 = load %struct.list*, %struct.list** %7
%34 = load i32, i32* %8
%35 = call %struct.boper* @boper_variable(i32 %34, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%36 = load i32, i32* %8
%37 = call %struct.boper* @boper_constant(i32 %36, i32 -1)
%38 = load i32, i32* %8
%39 = call %struct.boper* @boper_variable(i32 %38, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%40 = call i32 @bins_shl_(%struct.boper* %35, %struct.boper* %37, %struct.boper* %39)
%41 = call i32 @list_append_(%struct.list* %33, i32 %40)
%42 = load %struct.list*, %struct.list** %7
%43 = load i32, i32* %8
%44 = call %struct.boper* @boper_variable(i32 %43, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%45 = load i32, i32* %8
%46 = call %struct.boper* @boper_variable(i32 %45, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%47 = load i32, i32* %8
%48 = call %struct.boper* @boper_variable(i32 %47, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%49 = call i32 @bins_umul_(%struct.boper* %44, %struct.boper* %46, %struct.boper* %48)
%50 = call i32 @list_append_(%struct.list* %42, i32 %49)
%51 = load %struct.list*, %struct.list** %7
%52 = load %struct.boper*, %struct.boper** %4
%53 = call %struct.boper* @object_copy(%struct.boper* %52)
%54 = load %struct.boper*, %struct.boper** %5
%55 = load %struct.boper*, %struct.boper** %6
%56 = call i32 @bins_shr_(%struct.boper* %53, %struct.boper* %54, %struct.boper* %55)
%57 = call i32 @list_append_(%struct.list* %51, i32 %56)
%58 = load %struct.list*, %struct.list** %7
%59 = load %struct.boper*, %struct.boper** %4
%60 = call %struct.boper* @object_copy(%struct.boper* %59)
%61 = load %struct.boper*, %struct.boper** %4
%62 = load i32, i32* %8
%63 = call %struct.boper* @boper_variable(i32 %62, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%64 = call i32 @bins_or_(%struct.boper* %60, %struct.boper* %61, %struct.boper* %63)
%65 = call i32 @list_append_(%struct.list* %58, i32 %64)
%66 = load %struct.list*, %struct.list** %7
ret %struct.list* %66
}

LLVM IR (-O2):
%struct.list = type { i32 }
%struct.boper = type { i32 }
@.str = [13 x i8] c"asr_MASK_BIT\00"
@.str.1 = [14 x i8] c"asr_MASK_SIZE\00"
@.str.2 = [9 x i8] c"asr_MASK\00"
define %struct.list* @bins_asr_(%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 %struct.boper* @boper_variable(i32 %5, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%7 = tail call %struct.boper* @object_copy(%struct.boper* %1)
%8 = add i32 %5, -1
%9 = tail call %struct.boper* @boper_constant(i32 %5, i32 %8)
%10 = tail call i32 @bins_shr_(%struct.boper* %6, %struct.boper* %7, %struct.boper* %9)
%11 = tail call i32 @list_append_(%struct.list* %4, i32 %10)
%12 = tail call %struct.boper* @boper_variable(i32 %5, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%13 = tail call %struct.boper* @boper_constant(i32 %5, i32 %5)
%14 = tail call %struct.boper* @object_copy(%struct.boper* %2)
%15 = tail call i32 @bins_sub_(%struct.boper* %12, %struct.boper* %13, %struct.boper* %14)
%16 = tail call i32 @list_append_(%struct.list* %4, i32 %15)
%17 = tail call %struct.boper* @boper_variable(i32 %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%18 = tail call %struct.boper* @boper_constant(i32 %5, i32 -1)
%19 = tail call %struct.boper* @boper_variable(i32 %5, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%20 = tail call i32 @bins_shl_(%struct.boper* %17, %struct.boper* %18, %struct.boper* %19)
%21 = tail call i32 @list_append_(%struct.list* %4, i32 %20)
%22 = tail call %struct.boper* @boper_variable(i32 %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%23 = tail call %struct.boper* @boper_variable(i32 %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%24 = tail call %struct.boper* @boper_variable(i32 %5, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%25 = tail call i32 @bins_umul_(%struct.boper* %22, %struct.boper* %23, %struct.boper* %24)
%26 = tail call i32 @list_append_(%struct.list* %4, i32 %25)
%27 = tail call %struct.boper* @object_copy(%struct.boper* %0)
%28 = tail call i32 @bins_shr_(%struct.boper* %27, %struct.boper* %1, %struct.boper* %2)
%29 = tail call i32 @list_append_(%struct.list* %4, i32 %28)
%30 = tail call %struct.boper* @object_copy(%struct.boper* %0)
%31 = tail call %struct.boper* @boper_variable(i32 %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%32 = tail call i32 @bins_or_(%struct.boper* %30, %struct.boper* %0, %struct.boper* %31)
%33 = tail call i32 @list_append_(%struct.list* %4, i32 %32)
ret %struct.list* %4
}