#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*/ mu_assert(char *, int);
int /*<<< orphan*/ shift(int *, int, int);
char *test_shift_left() {
  int a[] = {1, 2, 3, 4};
  shift(a, 4, -1);
  mu_assert("a[0] != 2", a[0] == 2);
  mu_assert("a[1] != 3", a[1] == 3);
  mu_assert("a[2] != 4", a[2] == 4);
  mu_assert("a[3] != 1", a[3] == 1);
  return 0;
}


x86 assembly (clang, -O0):
<test_shift_left>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0x4,%esi
mov    $0xffffffff,%edx
call   1030 <shift@plt>
cmpl   $0x2,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%esi
lea    0xeac(%rip),%rdi
call   1040 <mu_assert@plt>
cmpl   $0x3,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%esi
lea    0xe9e(%rip),%rdi
call   1040 <mu_assert@plt>
cmpl   $0x4,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%esi
lea    0xe90(%rip),%rdi
call   1040 <mu_assert@plt>
cmpl   $0x1,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%esi
lea    0xe82(%rip),%rdi
call   1040 <mu_assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_shift_left>:
sub    $0x18,%rsp
movaps 0xed5(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x4,%esi
mov    $0xffffffff,%edx
call   1030 <shift@plt>
xor    %esi,%esi
cmpl   $0x2,(%rsp)
sete   %sil
lea    0xebe(%rip),%rdi
call   1040 <mu_assert@plt>
xor    %esi,%esi
cmpl   $0x3,0x4(%rsp)
sete   %sil
lea    0xeb1(%rip),%rdi
call   1040 <mu_assert@plt>
xor    %esi,%esi
cmpl   $0x4,0x8(%rsp)
sete   %sil
lea    0xea4(%rip),%rdi
call   1040 <mu_assert@plt>
xor    %esi,%esi
cmpl   $0x1,0xc(%rsp)
sete   %sil
lea    0xe97(%rip),%rdi
call   1040 <mu_assert@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.test_shift_left.a = [4 x i32] [i32 1, i32 2, i32 3, i32 4]
@.str = [10 x i8] c"a[0] != 2\00"
@.str.1 = [10 x i8] c"a[1] != 3\00"
@.str.2 = [10 x i8] c"a[2] != 4\00"
@.str.3 = [10 x i8] c"a[3] != 1\00"
define i8* @test_shift_left() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = call i32 @shift(i32* %3, i32 4, i32 -1)
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 2
%8 = zext i1 %7 to i32
%9 = call i32 @mu_assert(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 1
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, 3
%13 = zext i1 %12 to i32
%14 = call i32 @mu_assert(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 2
%16 = load i32, i32* %15
%17 = icmp eq i32 %16, 4
%18 = zext i1 %17 to i32
%19 = call i32 @mu_assert(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 3
%21 = load i32, i32* %20
%22 = icmp eq i32 %21, 1
%23 = zext i1 %22 to i32
%24 = call i32 @mu_assert(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %23)
ret i8* null
}

LLVM IR (-O2):
@__const.test_shift_left.a = [4 x i32] [i32 1, i32 2, i32 3, i32 4]
@.str = [10 x i8] c"a[0] != 2\00"
@.str.1 = [10 x i8] c"a[1] != 3\00"
@.str.2 = [10 x i8] c"a[2] != 4\00"
@.str.3 = [10 x i8] c"a[3] != 1\00"
define noalias i8* @test_shift_left() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = call i32 @shift(i32* %3, i32 4, i32 -1)
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 2
%7 = zext i1 %6 to i32
%8 = call i32 @mu_assert(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 1
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, 3
%12 = zext i1 %11 to i32
%13 = call i32 @mu_assert(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 2
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, 4
%17 = zext i1 %16 to i32
%18 = call i32 @mu_assert(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 3
%20 = load i32, i32* %19
%21 = icmp eq i32 %20, 1
%22 = zext i1 %21 to i32
%23 = call i32 @mu_assert(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %22)
ret i8* null
}