#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*/ f_ushrt_1(unsigned short);
int /*<<< orphan*/ f_ushrt_2(int, unsigned short);
int /*<<< orphan*/ sink(int /*<<< orphan*/);
void test_ushrt(unsigned short n) {
  sink(f_ushrt_1(0));
  sink(f_ushrt_2(0, 1));
  sink(f_ushrt_2(1, 0));
  sink(f_ushrt_2(n, 0));
  sink(f_ushrt_2(0, n));
  sink(f_ushrt_1(n));
  n = 0;
  sink(f_ushrt_1(n));
  sink(f_ushrt_2(1, n));
}


x86 assembly (clang, -O0):
<test_ushrt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
xor    %edi,%edi
call   1030 <f_ushrt_1@plt>
mov    %eax,%edi
call   1040 <sink@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1050 <f_ushrt_2@plt>
mov    %eax,%edi
call   1040 <sink@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1050 <f_ushrt_2@plt>
mov    %eax,%edi
call   1040 <sink@plt>
movzwl -0x2(%rbp),%edi
xor    %esi,%esi
call   1050 <f_ushrt_2@plt>
mov    %eax,%edi
call   1040 <sink@plt>
xor    %edi,%edi
movzwl -0x2(%rbp),%esi
call   1050 <f_ushrt_2@plt>
mov    %eax,%edi
call   1040 <sink@plt>
movzwl -0x2(%rbp),%edi
call   1030 <f_ushrt_1@plt>
mov    %eax,%edi
call   1040 <sink@plt>
movw   $0x0,-0x2(%rbp)
movzwl -0x2(%rbp),%edi
call   1030 <f_ushrt_1@plt>
mov    %eax,%edi
call   1040 <sink@plt>
mov    $0x1,%edi
movzwl -0x2(%rbp),%esi
call   1050 <f_ushrt_2@plt>
mov    %eax,%edi
call   1040 <sink@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_ushrt>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
call   1030 <f_ushrt_1@plt>
mov    %eax,%edi
call   1040 <sink@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1050 <f_ushrt_2@plt>
mov    %eax,%edi
call   1040 <sink@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1050 <f_ushrt_2@plt>
mov    %eax,%edi
call   1040 <sink@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1050 <f_ushrt_2@plt>
mov    %eax,%edi
call   1040 <sink@plt>
xor    %edi,%edi
mov    %ebx,%esi
call   1050 <f_ushrt_2@plt>
mov    %eax,%edi
call   1040 <sink@plt>
mov    %ebx,%edi
call   1030 <f_ushrt_1@plt>
mov    %eax,%edi
call   1040 <sink@plt>
xor    %edi,%edi
call   1030 <f_ushrt_1@plt>
mov    %eax,%edi
call   1040 <sink@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1050 <f_ushrt_2@plt>
mov    %eax,%edi
pop    %rbx
jmp    1040 <sink@plt>

LLVM IR (-O0):
define void @test_ushrt(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = call i32 @f_ushrt_1(i16 zeroext 0)
%4 = call i32 @sink(i32 %3)
%5 = call i32 @f_ushrt_2(i32 0, i16 zeroext 1)
%6 = call i32 @sink(i32 %5)
%7 = call i32 @f_ushrt_2(i32 1, i16 zeroext 0)
%8 = call i32 @sink(i32 %7)
%9 = load i16, i16* %2
%10 = zext i16 %9 to i32
%11 = call i32 @f_ushrt_2(i32 %10, i16 zeroext 0)
%12 = call i32 @sink(i32 %11)
%13 = load i16, i16* %2
%14 = call i32 @f_ushrt_2(i32 0, i16 zeroext %13)
%15 = call i32 @sink(i32 %14)
%16 = load i16, i16* %2
%17 = call i32 @f_ushrt_1(i16 zeroext %16)
%18 = call i32 @sink(i32 %17)
store i16 0, i16* %2
%19 = load i16, i16* %2
%20 = call i32 @f_ushrt_1(i16 zeroext %19)
%21 = call i32 @sink(i32 %20)
%22 = load i16, i16* %2
%23 = call i32 @f_ushrt_2(i32 1, i16 zeroext %22)
%24 = call i32 @sink(i32 %23)
ret void
}

LLVM IR (-O2):
define void @test_ushrt(i16 zeroext %0) {
%2 = tail call i32 @f_ushrt_1(i16 zeroext 0)
%3 = tail call i32 @sink(i32 %2)
%4 = tail call i32 @f_ushrt_2(i32 0, i16 zeroext 1)
%5 = tail call i32 @sink(i32 %4)
%6 = tail call i32 @f_ushrt_2(i32 1, i16 zeroext 0)
%7 = tail call i32 @sink(i32 %6)
%8 = zext i16 %0 to i32
%9 = tail call i32 @f_ushrt_2(i32 %8, i16 zeroext 0)
%10 = tail call i32 @sink(i32 %9)
%11 = tail call i32 @f_ushrt_2(i32 0, i16 zeroext %0)
%12 = tail call i32 @sink(i32 %11)
%13 = tail call i32 @f_ushrt_1(i16 zeroext %0)
%14 = tail call i32 @sink(i32 %13)
%15 = tail call i32 @f_ushrt_1(i16 zeroext 0)
%16 = tail call i32 @sink(i32 %15)
%17 = tail call i32 @f_ushrt_2(i32 1, i16 zeroext 0)
%18 = tail call i32 @sink(i32 %17)
ret void
}