int main() {
  unsigned int a[10] = {0xFFFFFFFF};
  unsigned int b[10] = {0xFFFFFFFF};
  unsigned int c[10] = {0xFFFFFFFE};
  if (__builtin_memcmp(&a, &a, sizeof(a))) {
    return 1;
  }
  if (__builtin_memcmp(&a, &b, sizeof(a))) {
    return 1;
  }
  if (!__builtin_memcmp(&a, &c, sizeof(a))) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1030 <memset@plt>
movl   $0xffffffff,-0x30(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1030 <memset@plt>
movl   $0xffffffff,-0x60(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1030 <memset@plt>
movl   $0xfffffffe,-0x90(%rbp)
ff ff ff
lea    -0x30(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x28,%edx
call   1040 <memcmp@plt>
cmp    $0x0,%eax
je     11a4 <main+0x84>
movl   $0x1,-0x4(%rbp)
jmp    11fc <main+0xdc>
lea    -0x30(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    $0x28,%edx
call   1040 <memcmp@plt>
cmp    $0x0,%eax
je     11cb <main+0xab>
movl   $0x1,-0x4(%rbp)
jmp    11fc <main+0xdc>
lea    -0x30(%rbp),%rdi
lea    -0x90(%rbp),%rsi
mov    $0x28,%edx
call   1040 <memcmp@plt>
cmp    $0x0,%eax
jne    11f5 <main+0xd5>
movl   $0x1,-0x4(%rbp)
jmp    11fc <main+0xdc>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x88,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x20(%rsp)
movl   $0xffffffff,(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x70(%rsp)
movq   $0x0,0x80(%rsp)
movl   $0xffffffff,0x60(%rsp)
ff
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
movq   $0x0,0x50(%rsp)
movl   $0xfffffffe,0x30(%rsp)
ff
mov    %rsp,%rdi
lea    0x60(%rsp),%rsi
mov    $0x28,%edx
call   1030 <bcmp@plt>
mov    %eax,%ecx
mov    $0x1,%eax
test   %ecx,%ecx
je     1191 <main+0x81>
add    $0x88,%rsp
ret
mov    %rsp,%rdi
lea    0x30(%rsp),%rsi
mov    $0x28,%edx
call   1030 <bcmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
add    $0x88,%rsp
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca [10 x i32]
%3 = alloca [10 x i32]
%4 = bitcast [10 x i32]* %1 to i8*
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
store i32 -1, i32* %5
%6 = bitcast [10 x i32]* %2 to i8*
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
store i32 -1, i32* %7
%8 = bitcast [10 x i32]* %3 to i8*
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
store i32 -2, i32* %9
%10 = call i32 @bcmp(i8* dereferenceable(40) %4, i8* dereferenceable(40) %6, i64 40)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %0
%13 = call i32 @bcmp(i8* dereferenceable(40) %4, i8* dereferenceable(40) %8, i64 40)
%14 = icmp eq i32 %13, 0
%15 = zext i1 %14 to i32
br label %16
16: ; preds = %12, %0
%17 = phi i32 [ 1, %0 ], [ %15, %12 ]
ret i32 %17
}