#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 fail(int /*<<< orphan*/);
int shl_i16(int, int);
int shl_i8(int, int);
int test_shl(void) {
  if (shl_i8(1, 1) != 2)
    return fail(0);
  if (shl_i8(1, 0) != 1)
    return fail(0);
  if (shl_i8(254, 2) != -8)
    return fail(0);
  if (shl_i16(0xfafe, 2) != 0xffffebf8)
    return fail(0);
  return 0x1000;
}


x86 assembly (clang, -O0):
<test_shl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%esi
mov    %esi,%edi
call   1030 <shl_i8@plt>
cmp    $0x2,%eax
je     115c <test_shl+0x2c>
xor    %edi,%edi
call   1040 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    11d7 <test_shl+0xa7>
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <shl_i8@plt>
cmp    $0x1,%eax
je     1180 <test_shl+0x50>
xor    %edi,%edi
call   1040 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    11d7 <test_shl+0xa7>
mov    $0xfe,%edi
mov    $0x2,%esi
call   1030 <shl_i8@plt>
cmp    $0xfffffff8,%eax
je     11a7 <test_shl+0x77>
xor    %edi,%edi
call   1040 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    11d7 <test_shl+0xa7>
mov    $0xfafe,%edi
mov    $0x2,%esi
call   1050 <shl_i16@plt>
cmp    $0xffffebf8,%eax
je     11d0 <test_shl+0xa0>
xor    %edi,%edi
call   1040 <fail@plt>
mov    %eax,-0x4(%rbp)
jmp    11d7 <test_shl+0xa7>
movl   $0x1000,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_shl>:
push   %rax
mov    $0x1,%edi
mov    $0x1,%esi
call   1030 <shl_i8@plt>
cmp    $0x2,%eax
jne    1187 <test_shl+0x57>
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <shl_i8@plt>
cmp    $0x1,%eax
jne    1187 <test_shl+0x57>
mov    $0xfe,%edi
mov    $0x2,%esi
call   1030 <shl_i8@plt>
cmp    $0xfffffff8,%eax
jne    1187 <test_shl+0x57>
mov    $0xfafe,%edi
mov    $0x2,%esi
call   1050 <shl_i16@plt>
cmp    $0xffffebf8,%eax
jne    1187 <test_shl+0x57>
mov    $0x1000,%eax
pop    %rcx
ret
xor    %edi,%edi
pop    %rax
jmp    1040 <fail@plt>

LLVM IR (-O0):
define i32 @test_shl() {
%1 = alloca i32
%2 = call i32 @shl_i8(i32 1, i32 1)
%3 = icmp ne i32 %2, 2
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @fail(i32 0)
store i32 %5, i32* %1
br label %22
6: ; preds = %0
%7 = call i32 @shl_i8(i32 1, i32 0)
%8 = icmp ne i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 @fail(i32 0)
store i32 %10, i32* %1
br label %22
11: ; preds = %6
%12 = call i32 @shl_i8(i32 254, i32 2)
%13 = icmp ne i32 %12, -8
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 @fail(i32 0)
store i32 %15, i32* %1
br label %22
16: ; preds = %11
%17 = call i32 @shl_i16(i32 64254, i32 2)
%18 = icmp ne i32 %17, -5128
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 @fail(i32 0)
store i32 %20, i32* %1
br label %22
21: ; preds = %16
store i32 4096, i32* %1
br label %22
22: ; preds = %21, %19, %14, %9, %4
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
define i32 @test_shl() {
%1 = tail call i32 @shl_i8(i32 1, i32 1)
%2 = icmp eq i32 %1, 2
br i1 %2, label %3, label %12
3: ; preds = %0
%4 = tail call i32 @shl_i8(i32 1, i32 0)
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = tail call i32 @shl_i8(i32 254, i32 2)
%8 = icmp eq i32 %7, -8
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = tail call i32 @shl_i16(i32 64254, i32 2)
%11 = icmp eq i32 %10, -5128
br i1 %11, label %14, label %12
12: ; preds = %9, %6, %3, %0
%13 = tail call i32 @fail(i32 0)
br label %14
14: ; preds = %12, %9
%15 = phi i32 [ 4096, %9 ], [ %13, %12 ]
ret i32 %15
}