#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*/ abort();
int /*<<< orphan*/ foo(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                       int /*<<< orphan*/, int /*<<< orphan*/,
                       int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, short);
int main(void) {
  union {
    char c[16];
    __m128i v;
  } c = {-1}, d = {1}, e = {1};
  union {
    short s[8];
    __m128i v;
  } a, b;
  foo(&a.v, &b.v, c.v, d.v, e.v);
  if (0) {
    printf("a contains %d.\n", a.s[0]);
    printf("b contains %d.\n", b.s[0]);
  }
  if (a.s[0] != 255)
    abort();
  if (b.s[0] != 255)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xec1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeae(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xeab(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    -0x48(%rbp),%rdi
lea    -0x58(%rbp),%rsi
mov    -0x18(%rbp),%edx
mov    -0x28(%rbp),%ecx
mov    -0x38(%rbp),%r8d
call   1040 <foo@plt>
movswl -0x48(%rbp),%eax
cmp    $0xff,%eax
je     119e <main+0x7e>
mov    $0x0,%al
call   1030 <abort@plt>
movswl -0x58(%rbp),%eax
cmp    $0xff,%eax
je     11b4 <main+0x94>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
lea    0x18(%rsp),%rdi
lea    0x8(%rsp),%rsi
mov    $0xff,%edx
mov    $0x1,%ecx
mov    $0x1,%r8d
call   1040 <foo@plt>
movzwl 0x18(%rsp),%eax
cmp    $0xff,%eax
jne    1162 <main+0x42>
movzwl 0x8(%rsp),%eax
cmp    $0xff,%eax
jne    1162 <main+0x42>
xor    %eax,%eax
add    $0x28,%rsp
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
%union.anon = type { i32, [12 x i8] }
%union.anon.0 = type { i32, [12 x i8] }
@__const.main.c = { <{ i8, [15 x i8] }> } { <{ i8, [15 x i8] }> <{ i8 -1, [15 x i8] zeroinitializer }> }
@__const.main.d = { <{ i8, [15 x i8] }> } { <{ i8, [15 x i8] }> <{ i8 1, [15 x i8] zeroinitializer }> }
@__const.main.e = { <{ i8, [15 x i8] }> } { <{ i8, [15 x i8] }> <{ i8 1, [15 x i8] zeroinitializer }> }
define i32 @main() {
%1 = alloca i32
%2 = alloca %union.anon
%3 = alloca %union.anon
%4 = alloca %union.anon
%5 = alloca %union.anon.0
%6 = alloca %union.anon.0
store i32 0, i32* %1
%7 = bitcast %union.anon* %2 to i8*
%8 = bitcast %union.anon* %3 to i8*
%9 = bitcast %union.anon* %4 to i8*
%10 = bitcast %union.anon.0* %5 to i32*
%11 = bitcast %union.anon.0* %6 to i32*
%12 = bitcast %union.anon* %2 to i32*
%13 = load i32, i32* %12
%14 = bitcast %union.anon* %3 to i32*
%15 = load i32, i32* %14
%16 = bitcast %union.anon* %4 to i32*
%17 = load i32, i32* %16
%18 = call i32 @foo(i32* %10, i32* %11, i32 %13, i32 %15, i32 %17)
%19 = bitcast %union.anon.0* %5 to [8 x i16]*
%20 = getelementptr inbounds [8 x i16], [8 x i16]* %19, i64 0, i64 0
%21 = load i16, i16* %20
%22 = sext i16 %21 to i32
%23 = icmp ne i32 %22, 255
br i1 %23, label %24, label %26
24: ; preds = %0
%25 = call i32 (...) @abort()
unreachable
26: ; preds = %0
%27 = bitcast %union.anon.0* %6 to [8 x i16]*
%28 = getelementptr inbounds [8 x i16], [8 x i16]* %27, i64 0, i64 0
%29 = load i16, i16* %28
%30 = sext i16 %29 to i32
%31 = icmp ne i32 %30, 255
br i1 %31, label %32, label %34
32: ; preds = %26
%33 = call i32 (...) @abort()
unreachable
34: ; preds = %26
ret i32 0
}

LLVM IR (-O2):
%union.anon.0 = type { i32, [12 x i8] }
define i32 @main() {
%1 = alloca %union.anon.0
%2 = alloca %union.anon.0
%3 = bitcast %union.anon.0* %1 to i8*
%4 = bitcast %union.anon.0* %2 to i8*
%5 = getelementptr inbounds %union.anon.0, %union.anon.0* %1, i64 0, i32 0
%6 = getelementptr inbounds %union.anon.0, %union.anon.0* %2, i64 0, i32 0
%7 = call i32 @foo(i32* %5, i32* %6, i32 255, i32 1, i32 1)
%8 = bitcast %union.anon.0* %1 to i16*
%9 = load i16, i16* %8
%10 = icmp eq i16 %9, 255
br i1 %10, label %13, label %11
11: ; preds = %0
%12 = call i32 (...) @abort()
unreachable
13: ; preds = %0
%14 = bitcast %union.anon.0* %2 to i16*
%15 = load i16, i16* %14
%16 = icmp eq i16 %15, 255
br i1 %16, label %19, label %17
17: ; preds = %13
%18 = call i32 (...) @abort()
unreachable
19: ; preds = %13
ret i32 0
}