#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 check_epi16_overflow_x4(int /*<<< orphan*/ const *,
                            int /*<<< orphan*/ const *,
                            int /*<<< orphan*/ const *,
                            int /*<<< orphan*/ const *);
int check_epi16_overflow_x12(const __m128i *preg0, const __m128i *preg1,
                             const __m128i *preg2, const __m128i *preg3,
                             const __m128i *preg4, const __m128i *preg5,
                             const __m128i *preg6, const __m128i *preg7,
                             const __m128i *preg8, const __m128i *preg9,
                             const __m128i *preg10, const __m128i *preg11) {
  int res0, res1;
  res0 = check_epi16_overflow_x4(preg0, preg1, preg2, preg3);
  res1 = check_epi16_overflow_x4(preg4, preg5, preg6, preg7);
  if (!res0)
    res0 = check_epi16_overflow_x4(preg8, preg9, preg10, preg11);
  return res0 + res1;
}


x86 assembly (clang, -O0):
<check_epi16_overflow_x12>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <check_epi16_overflow_x4@plt>
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    0x10(%rbp),%rdx
mov    0x18(%rbp),%rcx
call   1030 <check_epi16_overflow_x4@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x34(%rbp)
jne    119a <check_epi16_overflow_x12+0x8a>
mov    0x20(%rbp),%rdi
mov    0x28(%rbp),%rsi
mov    0x30(%rbp),%rdx
mov    0x38(%rbp),%rcx
call   1030 <check_epi16_overflow_x4@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
add    -0x38(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_epi16_overflow_x12>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r9,%r14
mov    %r8,%rbx
mov    0x30(%rsp),%r15
mov    0x38(%rsp),%r12
call   1030 <check_epi16_overflow_x4@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1030 <check_epi16_overflow_x4@plt>
mov    %eax,%ebx
test   %ebp,%ebp
jne    1161 <check_epi16_overflow_x12+0x51>
mov    0x58(%rsp),%rcx
mov    0x50(%rsp),%rdx
mov    0x48(%rsp),%rsi
mov    0x40(%rsp),%rdi
call   1030 <check_epi16_overflow_x4@plt>
mov    %eax,%ebp
add    %ebx,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @check_epi16_overflow_x12(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, i32* %8, i32* %9, i32* %10, i32* %11) {
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i32*
%18 = alloca i32*
%19 = alloca i32*
%20 = alloca i32*
%21 = alloca i32*
%22 = alloca i32*
%23 = alloca i32*
%24 = alloca i32*
%25 = alloca i32
%26 = alloca i32
store i32* %0, i32** %13
store i32* %1, i32** %14
store i32* %2, i32** %15
store i32* %3, i32** %16
store i32* %4, i32** %17
store i32* %5, i32** %18
store i32* %6, i32** %19
store i32* %7, i32** %20
store i32* %8, i32** %21
store i32* %9, i32** %22
store i32* %10, i32** %23
store i32* %11, i32** %24
%27 = load i32*, i32** %13
%28 = load i32*, i32** %14
%29 = load i32*, i32** %15
%30 = load i32*, i32** %16
%31 = call i32 @check_epi16_overflow_x4(i32* %27, i32* %28, i32* %29, i32* %30)
store i32 %31, i32* %25
%32 = load i32*, i32** %17
%33 = load i32*, i32** %18
%34 = load i32*, i32** %19
%35 = load i32*, i32** %20
%36 = call i32 @check_epi16_overflow_x4(i32* %32, i32* %33, i32* %34, i32* %35)
store i32 %36, i32* %26
%37 = load i32, i32* %25
%38 = icmp ne i32 %37, 0
br i1 %38, label %45, label %39
39: ; preds = %12
%40 = load i32*, i32** %21
%41 = load i32*, i32** %22
%42 = load i32*, i32** %23
%43 = load i32*, i32** %24
%44 = call i32 @check_epi16_overflow_x4(i32* %40, i32* %41, i32* %42, i32* %43)
store i32 %44, i32* %25
br label %45
45: ; preds = %39, %12
%46 = load i32, i32* %25
%47 = load i32, i32* %26
%48 = add nsw i32 %46, %47
ret i32 %48
}

LLVM IR (-O2):
define i32 @check_epi16_overflow_x12(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, i32* %8, i32* %9, i32* %10, i32* %11) {
%13 = tail call i32 @check_epi16_overflow_x4(i32* %0, i32* %1, i32* %2, i32* %3)
%14 = tail call i32 @check_epi16_overflow_x4(i32* %4, i32* %5, i32* %6, i32* %7)
%15 = icmp eq i32 %13, 0
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = tail call i32 @check_epi16_overflow_x4(i32* %8, i32* %9, i32* %10, i32* %11)
br label %18
18: ; preds = %16, %12
%19 = phi i32 [ %13, %12 ], [ %17, %16 ]
%20 = add nsw i32 %19, %14
ret i32 %20
}