#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 */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_packus_epi16(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_setr_epi16(int, int, int, int, int, int, int, int);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int main(void) {
  __m128i resultLo = _mm_setr_epi16(800, 700, 600, 500, 400, 300, 200, 100);
  __m128i resultHi =
      _mm_setr_epi16(0, -100, -200, -300, -400, -500, -600, -700);
  __m128i result = _mm_packus_epi16(resultLo, resultHi);
  printf("resultLo = %vhd\n", resultLo);
  printf("resultHi = %vhd\n", resultHi);
  printf("result   = %vu\n", result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x320,%edi
mov    $0x2bc,%esi
mov    $0x258,%edx
mov    $0x1f4,%ecx
mov    $0x190,%r8d
mov    $0x12c,%r9d
movl   $0xc8,(%rsp)
movl   $0x64,0x8(%rsp)
call   1030 <_mm_setr_epi16@plt>
mov    %eax,-0x8(%rbp)
xor    %edi,%edi
mov    $0xffffff9c,%esi
mov    $0xffffff38,%edx
mov    $0xfffffed4,%ecx
mov    $0xfffffe70,%r8d
mov    $0xfffffe0c,%r9d
movl   $0xfffffda8,(%rsp)
movl   $0xfffffd44,0x8(%rsp)
ff
call   1030 <_mm_setr_epi16@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <_mm_packus_epi16@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe3e(%rip),%rdi
call   1050 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe40(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe42(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x320,%edi
mov    $0x2bc,%esi
mov    $0x258,%edx
mov    $0x1f4,%ecx
mov    $0x190,%r8d
mov    $0x12c,%r9d
push   $0x64
push   $0xc8
call   1030 <_mm_setr_epi16@plt>
add    $0x10,%rsp
mov    %eax,%ebx
xor    %edi,%edi
mov    $0xffffff9c,%esi
mov    $0xffffff38,%edx
mov    $0xfffffed4,%ecx
mov    $0xfffffe70,%r8d
mov    $0xfffffe0c,%r9d
push   $0xfffffffffffffd44
push   $0xfffffffffffffda8
call   1030 <_mm_setr_epi16@plt>
add    $0x10,%rsp
mov    %eax,%ebp
mov    %ebx,%edi
mov    %eax,%esi
call   1040 <_mm_packus_epi16@plt>
mov    %eax,%r14d
lea    0xe55(%rip),%rdi
mov    %ebx,%esi
call   1050 <printf@plt>
lea    0xe58(%rip),%rdi
mov    %ebp,%esi
call   1050 <printf@plt>
lea    0xe5b(%rip),%rdi
mov    %r14d,%esi
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"resultLo = %vhd\0A\00"
@.str.1 = [17 x i8] c"resultHi = %vhd\0A\00"
@.str.2 = [16 x i8] c"result = %vu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @_mm_setr_epi16(i32 800, i32 700, i32 600, i32 500, i32 400, i32 300, i32 200, i32 100)
store i32 %5, i32* %2
%6 = call i32 @_mm_setr_epi16(i32 0, i32 -100, i32 -200, i32 -300, i32 -400, i32 -500, i32 -600, i32 -700)
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = call i32 @_mm_packus_epi16(i32 %7, i32 %8)
store i32 %9, i32* %4
%10 = load i32, i32* %2
%11 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %3
%13 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %4
%15 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"resultLo = %vhd\0A\00"
@.str.1 = [17 x i8] c"resultHi = %vhd\0A\00"
@.str.2 = [16 x i8] c"result = %vu\0A\00"
define i32 @main() {
%1 = tail call i32 @_mm_setr_epi16(i32 800, i32 700, i32 600, i32 500, i32 400, i32 300, i32 200, i32 100)
%2 = tail call i32 @_mm_setr_epi16(i32 0, i32 -100, i32 -200, i32 -300, i32 -400, i32 -500, i32 -600, i32 -700)
%3 = tail call i32 @_mm_packus_epi16(i32 %1, i32 %2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %1)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %2)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %3)
ret i32 0
}