#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*/ printf(char *, unsigned long long, long long, long long);
void llshift(long long a, int b) {
  printf("shift: %lld %lld %lld\n", (unsigned long long)a >> b, a >> b, a << b);
  printf("shiftc: %lld %lld %lld\n", (unsigned long long)a >> 3, a >> 3,
         a << 3);
  printf("shiftc: %lld %lld %lld\n", (unsigned long long)a >> 35, a >> 35,
         a << 35);
}


x86 assembly (clang, -O0):
<llshift>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
shr    %cl,%rsi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
sar    %cl,%rdx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    %cl,%rax
mov    %rax,%rcx
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
shr    $0x3,%rsi
mov    -0x8(%rbp),%rdx
sar    $0x3,%rdx
mov    -0x8(%rbp),%rcx
shl    $0x3,%rcx
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
shr    $0x23,%rsi
mov    -0x8(%rbp),%rdx
sar    $0x23,%rdx
mov    -0x8(%rbp),%rcx
shl    $0x23,%rcx
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<llshift>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ecx
mov    %rdi,%rbx
mov    %rdi,%rsi
shr    %cl,%rsi
mov    %rdi,%rdx
sar    %cl,%rdx
mov    %rdi,%rax
shl    %cl,%rax
lea    0xece(%rip),%rdi
mov    %rax,%rcx
call   1030 <printf@plt>
mov    %rbx,%rsi
shr    $0x3,%rsi
mov    %rbx,%rdx
sar    $0x3,%rdx
lea    0x0(,%rbx,8),%rcx
lea    0xec0(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %rbx,%rsi
shr    $0x23,%rsi
mov    %rbx,%rdx
sar    $0x23,%rdx
shl    $0x23,%rbx
mov    %r14,%rdi
mov    %rbx,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"shift: %lld %lld %lld\0A\00"
@.str.1 = [24 x i8] c"shiftc: %lld %lld %lld\0A\00"
define void @llshift(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i64, i64* %3
%6 = load i32, i32* %4
%7 = zext i32 %6 to i64
%8 = lshr i64 %5, %7
%9 = load i64, i64* %3
%10 = load i32, i32* %4
%11 = zext i32 %10 to i64
%12 = ashr i64 %9, %11
%13 = load i64, i64* %3
%14 = load i32, i32* %4
%15 = zext i32 %14 to i64
%16 = shl i64 %13, %15
%17 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i64 %8, i64 %12, i64 %16)
%18 = load i64, i64* %3
%19 = lshr i64 %18, 3
%20 = load i64, i64* %3
%21 = ashr i64 %20, 3
%22 = load i64, i64* %3
%23 = shl i64 %22, 3
%24 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i64 %19, i64 %21, i64 %23)
%25 = load i64, i64* %3
%26 = lshr i64 %25, 35
%27 = load i64, i64* %3
%28 = ashr i64 %27, 35
%29 = load i64, i64* %3
%30 = shl i64 %29, 35
%31 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i64 %26, i64 %28, i64 %30)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"shift: %lld %lld %lld\0A\00"
@.str.1 = [24 x i8] c"shiftc: %lld %lld %lld\0A\00"
define void @llshift(i64 %0, i32 %1) {
%3 = zext i32 %1 to i64
%4 = lshr i64 %0, %3
%5 = ashr i64 %0, %3
%6 = shl i64 %0, %3
%7 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i64 %4, i64 %5, i64 %6)
%8 = lshr i64 %0, 3
%9 = ashr i64 %0, 3
%10 = shl i64 %0, 3
%11 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i64 %8, i64 %9, i64 %10)
%12 = lshr i64 %0, 35
%13 = ashr i64 %0, 35
%14 = shl i64 %0, 35
%15 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i64 %12, i64 %13, i64 %14)
ret void
}