#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*/ Copy(unsigned int *, unsigned int *);
int Degree(unsigned int *);
int /*<<< orphan*/ Initialize(unsigned int *);
int /*<<< orphan*/ LeftShift(unsigned int *, int);
void LongLeftShift(unsigned a[], int sh) {
  int i, u;
  unsigned temp[500];
  if (sh < 16) {
    LeftShift(a, sh);
  } else {
    u = sh / 16;
    sh = sh - u * 16;
    i = Degree(a);
    Initialize(temp);
    while (i >= 0) {
      temp[i + u] = a[i];
      i--;
    }
    Copy(temp, a);
    LeftShift(a, sh);
  }
}


x86 assembly (clang, -O0):
<LongLeftShift>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7f0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    116d <LongLeftShift+0x2d>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <LeftShift@plt>
jmp    11ef <LongLeftShift+0xaf>
mov    -0xc(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
shl    $0x4,%ecx
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <Degree@plt>
mov    %eax,-0x10(%rbp)
lea    -0x7f0(%rbp),%rdi
call   1050 <Initialize@plt>
cmpl   $0x0,-0x10(%rbp)
jl     11d3 <LongLeftShift+0x93>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
cltq
mov    %ecx,-0x7f0(%rbp,%rax,4)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    11a1 <LongLeftShift+0x61>
lea    -0x7f0(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <Copy@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <LeftShift@plt>
add    $0x7f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LongLeftShift>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x7d8,%rsp
mov    %esi,%ebp
mov    %rdi,%r14
cmp    $0xf,%esi
jg     117e <LongLeftShift+0x2e>
mov    %r14,%rdi
mov    %ebp,%esi
add    $0x7d8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <LeftShift@plt>
mov    %ebp,%ebx
shr    $0x4,%ebx
mov    %ebx,%eax
shl    $0x4,%eax
sub    %eax,%ebp
mov    %r14,%rdi
call   1070 <Degree@plt>
mov    %eax,%r15d
mov    %rsp,%rdi
call   1060 <Initialize@plt>
test   %r15d,%r15d
js     11c2 <LongLeftShift+0x72>
add    %r15d,%ebx
movslq %ebx,%rax
mov    %r15d,%ecx
sub    %rcx,%rax
lea    (%rsp,%rax,4),%rdi
lea    0x4(,%rcx,4),%rdx
mov    %r14,%rsi
call   1050 <memcpy@plt>
mov    %rsp,%rdi
mov    %r14,%rsi
call   1040 <Copy@plt>
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <LeftShift@plt>
add    $0x7d8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @LongLeftShift(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [500 x i32]
store i32* %0, i32** %3
store i32 %1, i32* %4
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 16
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load i32*, i32** %3
%12 = load i32, i32* %4
%13 = call i32 @LeftShift(i32* %11, i32 %12)
br label %48
14: ; preds = %2
%15 = load i32, i32* %4
%16 = sdiv i32 %15, 16
store i32 %16, i32* %6
%17 = load i32, i32* %4
%18 = load i32, i32* %6
%19 = mul nsw i32 %18, 16
%20 = sub nsw i32 %17, %19
store i32 %20, i32* %4
%21 = load i32*, i32** %3
%22 = call i32 @Degree(i32* %21)
store i32 %22, i32* %5
%23 = getelementptr inbounds [500 x i32], [500 x i32]* %7, i64 0, i64 0
%24 = call i32 @Initialize(i32* %23)
br label %25
25: ; preds = %28, %14
%26 = load i32, i32* %5
%27 = icmp sge i32 %26, 0
br i1 %27, label %28, label %41
28: ; preds = %25
%29 = load i32*, i32** %3
%30 = load i32, i32* %5
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %29, i64 %31
%33 = load i32, i32* %32
%34 = load i32, i32* %5
%35 = load i32, i32* %6
%36 = add nsw i32 %34, %35
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [500 x i32], [500 x i32]* %7, i64 0, i64 %37
store i32 %33, i32* %38
%39 = load i32, i32* %5
%40 = add nsw i32 %39, -1
store i32 %40, i32* %5
br label %25
41: ; preds = %25
%42 = getelementptr inbounds [500 x i32], [500 x i32]* %7, i64 0, i64 0
%43 = load i32*, i32** %3
%44 = call i32 @Copy(i32* %42, i32* %43)
%45 = load i32*, i32** %3
%46 = load i32, i32* %4
%47 = call i32 @LeftShift(i32* %45, i32 %46)
br label %48
48: ; preds = %41, %10
ret void
}

LLVM IR (-O2):
define void @LongLeftShift(i32* %0, i32 %1) {
%3 = bitcast i32* %0 to i8*
%4 = alloca [500 x i32]
%5 = bitcast [500 x i32]* %4 to i8*
%6 = icmp slt i32 %1, 16
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 @LeftShift(i32* %0, i32 %1)
br label %29
9: ; preds = %2
%10 = lshr i32 %1, 4
%11 = mul nsw i32 %10, -16
%12 = add nsw i32 %11, %1
%13 = tail call i32 @Degree(i32* %0)
%14 = getelementptr inbounds [500 x i32], [500 x i32]* %4, i64 0, i64 0
%15 = call i32 @Initialize(i32* %14)
%16 = icmp sgt i32 %13, -1
br i1 %16, label %17, label %26
17: ; preds = %9
%18 = add nuw i32 %13, %10
%19 = sext i32 %18 to i64
%20 = zext i32 %13 to i64
%21 = sub nsw i64 %19, %20
%22 = getelementptr [500 x i32], [500 x i32]* %4, i64 0, i64 %21
%23 = bitcast i32* %22 to i8*
%24 = shl nuw nsw i64 %20, 2
%25 = add nuw nsw i64 %24, 4
br label %26
26: ; preds = %17, %9
%27 = call i32 @Copy(i32* %14, i32* %0)
%28 = call i32 @LeftShift(i32* %0, i32 %12)
br label %29
29: ; preds = %26, %7
ret void
}