#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_real(int /*<<< orphan*/, int);
int shl_i16(int, int);
int shl_i8(int, int);
int test_shl(void) {
  if (shl_i8(1, 1) != 2)
    return fail_real(0, 400);
  if (shl_i8(1, 0) != 1)
    return fail_real(0, 402);
  if (shl_i8(254, 2) != -8)
    return fail_real(0, 404);
  if (shl_i16(0xfafe, 2) != 0xffffebf8)
    return fail_real(0, 406);
  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     1161 <test_shl+0x31>
xor    %edi,%edi
mov    $0x190,%esi
call   1040 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    11eb <test_shl+0xbb>
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <shl_i8@plt>
cmp    $0x1,%eax
je     118a <test_shl+0x5a>
xor    %edi,%edi
mov    $0x192,%esi
call   1040 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    11eb <test_shl+0xbb>
mov    $0xfe,%edi
mov    $0x2,%esi
call   1030 <shl_i8@plt>
cmp    $0xfffffff8,%eax
je     11b6 <test_shl+0x86>
xor    %edi,%edi
mov    $0x194,%esi
call   1040 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    11eb <test_shl+0xbb>
mov    $0xfafe,%edi
mov    $0x2,%esi
call   1050 <shl_i16@plt>
cmp    $0xffffebf8,%eax
je     11e4 <test_shl+0xb4>
xor    %edi,%edi
mov    $0x196,%esi
call   1040 <fail_real@plt>
mov    %eax,-0x4(%rbp)
jmp    11eb <test_shl+0xbb>
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>
mov    $0x190,%esi
cmp    $0x2,%eax
jne    119b <test_shl+0x6b>
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <shl_i8@plt>
mov    $0x192,%esi
cmp    $0x1,%eax
jne    119b <test_shl+0x6b>
mov    $0xfe,%edi
mov    $0x2,%esi
call   1030 <shl_i8@plt>
mov    $0x194,%esi
cmp    $0xfffffff8,%eax
jne    119b <test_shl+0x6b>
mov    $0xfafe,%edi
mov    $0x2,%esi
call   1050 <shl_i16@plt>
mov    $0x196,%esi
cmp    $0xffffebf8,%eax
jne    119b <test_shl+0x6b>
mov    $0x1000,%eax
pop    %rcx
ret
xor    %edi,%edi
pop    %rax
jmp    1040 <fail_real@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_real(i32 0, i32 400)
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_real(i32 0, i32 402)
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_real(i32 0, i32 404)
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_real(i32 0, i32 406)
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 %15, label %12
12: ; preds = %9, %6, %3, %0
%13 = phi i32 [ 400, %0 ], [ 402, %3 ], [ 404, %6 ], [ 406, %9 ]
%14 = tail call i32 @fail_real(i32 0, i32 %13)
br label %15
15: ; preds = %12, %9
%16 = phi i32 [ 4096, %9 ], [ %14, %12 ]
ret i32 %16
}