#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*/ uint8_t;
typedef int uint16_t;

/* Variables and functions */
int checksum(int /*<<< orphan*/ *, int);
int verify_checksums(uint16_t *data) {
  int i;
  uint8_t *data8 = (uint8_t *)data;
  uint8_t even[32], odd[32];
  uint16_t csum1, csum2, csum3, csum4;
  int res;
  for (i = 0; i < 32; i++) {
    even[i] = data8[i * 2];
    odd[i] = data8[i * 2 + 1];
  }
  csum1 = checksum(data8 + 4, 28);
  csum2 = checksum(data8 + 32, 28);
  csum3 = checksum(even + 1, 30);
  csum4 = checksum(odd + 1, 30);
  res = 0;
  res ^= (csum1 ^ data[1]);
  res ^= (csum2 ^ data[30]);
  res ^= (csum3 ^ data[0]);
  res ^= (csum4 ^ data[31]);
  return res;
}


x86 assembly (clang, -O0):
<verify_checksums>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x20,-0xc(%rbp)
jge    117f <verify_checksums+0x6f>
mov    -0x18(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%ecx
movslq -0xc(%rbp),%rax
mov    %ecx,-0xa0(%rbp,%rax,4)
mov    -0x18(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%ecx
movslq -0xc(%rbp),%rax
mov    %ecx,-0x120(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112e <verify_checksums+0x1e>
mov    -0x18(%rbp),%rdi
add    $0x10,%rdi
mov    $0x1c,%esi
call   1030 <checksum@plt>
mov    %eax,-0x124(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x80,%rdi
mov    $0x1c,%esi
call   1030 <checksum@plt>
mov    %eax,-0x128(%rbp)
lea    -0xa0(%rbp),%rdi
add    $0x4,%rdi
mov    $0x1e,%esi
call   1030 <checksum@plt>
mov    %eax,-0x12c(%rbp)
lea    -0x120(%rbp),%rdi
add    $0x4,%rdi
mov    $0x1e,%esi
call   1030 <checksum@plt>
mov    %eax,-0x130(%rbp)
movl   $0x0,-0x134(%rbp)
mov    -0x124(%rbp),%eax
mov    -0x8(%rbp),%rcx
xor    0x4(%rcx),%eax
xor    -0x134(%rbp),%eax
mov    %eax,-0x134(%rbp)
mov    -0x128(%rbp),%eax
mov    -0x8(%rbp),%rcx
xor    0x78(%rcx),%eax
xor    -0x134(%rbp),%eax
mov    %eax,-0x134(%rbp)
mov    -0x12c(%rbp),%eax
mov    -0x8(%rbp),%rcx
xor    (%rcx),%eax
xor    -0x134(%rbp),%eax
mov    %eax,-0x134(%rbp)
mov    -0x130(%rbp),%eax
mov    -0x8(%rbp),%rcx
xor    0x7c(%rcx),%eax
xor    -0x134(%rbp),%eax
mov    %eax,-0x134(%rbp)
mov    -0x134(%rbp),%eax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verify_checksums>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rdi,%rbx
movups (%rdi),%xmm0
movups 0x10(%rdi),%xmm1
movaps %xmm0,%xmm2
shufps $0x88,%xmm1,%xmm2
shufps $0xdd,%xmm1,%xmm0
movaps %xmm2,0x80(%rsp)
movaps %xmm0,(%rsp)
movups 0x20(%rdi),%xmm0
movups 0x30(%rdi),%xmm1
movaps %xmm0,%xmm2
shufps $0x88,%xmm1,%xmm2
shufps $0xdd,%xmm1,%xmm0
movaps %xmm2,0x90(%rsp)
movaps %xmm0,0x10(%rsp)
movups 0x40(%rdi),%xmm0
movups 0x50(%rdi),%xmm1
movaps %xmm0,%xmm2
shufps $0x88,%xmm1,%xmm2
shufps $0xdd,%xmm1,%xmm0
movaps %xmm2,0xa0(%rsp)
movaps %xmm0,0x20(%rsp)
movups 0x60(%rdi),%xmm0
movups 0x70(%rdi),%xmm1
movaps %xmm0,%xmm2
shufps $0x88,%xmm1,%xmm2
shufps $0xdd,%xmm1,%xmm0
movaps %xmm2,0xb0(%rsp)
movaps %xmm0,0x30(%rsp)
lea    0x80(%rdi),%r14
movups 0x80(%rdi),%xmm0
movups 0x90(%rdi),%xmm1
movaps %xmm0,%xmm2
shufps $0x88,%xmm1,%xmm2
shufps $0xdd,%xmm1,%xmm0
movaps %xmm2,0xc0(%rsp)
movaps %xmm0,0x40(%rsp)
movups 0xa0(%rdi),%xmm0
movups 0xb0(%rdi),%xmm1
movaps %xmm0,%xmm2
shufps $0x88,%xmm1,%xmm2
shufps $0xdd,%xmm1,%xmm0
movaps %xmm2,0xd0(%rsp)
movaps %xmm0,0x50(%rsp)
movups 0xc0(%rdi),%xmm0
movups 0xd0(%rdi),%xmm1
movaps %xmm0,%xmm2
shufps $0x88,%xmm1,%xmm2
shufps $0xdd,%xmm1,%xmm0
movaps %xmm2,0xe0(%rsp)
movaps %xmm0,0x60(%rsp)
movups 0xe0(%rdi),%xmm0
movups 0xf0(%rdi),%xmm1
movaps %xmm0,%xmm2
shufps $0x88,%xmm1,%xmm2
shufps $0xdd,%xmm1,%xmm0
movaps %xmm2,0xf0(%rsp)
movaps %xmm0,0x70(%rsp)
add    $0x10,%rdi
mov    $0x1c,%esi
call   1030 <checksum@plt>
mov    %eax,%r15d
mov    %r14,%rdi
mov    $0x1c,%esi
call   1030 <checksum@plt>
mov    %eax,%ebp
lea    0x84(%rsp),%rdi
mov    $0x1e,%esi
call   1030 <checksum@plt>
mov    %eax,%r14d
lea    0x4(%rsp),%rdi
mov    $0x1e,%esi
call   1030 <checksum@plt>
xor    %r15d,%ebp
xor    %r14d,%eax
xor    %ebp,%eax
xor    0x4(%rbx),%eax
xor    0x78(%rbx),%eax
xor    (%rbx),%eax
xor    0x7c(%rbx),%eax
add    $0x108,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @verify_checksums(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32*
%5 = alloca [32 x i32]
%6 = alloca [32 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32* %0, i32** %2
%12 = load i32*, i32** %2
store i32* %12, i32** %4
store i32 0, i32* %3
br label %13
13: ; preds = %36, %1
%14 = load i32, i32* %3
%15 = icmp slt i32 %14, 32
br i1 %15, label %16, label %39
16: ; preds = %13
%17 = load i32*, i32** %4
%18 = load i32, i32* %3
%19 = mul nsw i32 %18, 2
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %17, i64 %20
%22 = load i32, i32* %21
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [32 x i32], [32 x i32]* %5, i64 0, i64 %24
store i32 %22, i32* %25
%26 = load i32*, i32** %4
%27 = load i32, i32* %3
%28 = mul nsw i32 %27, 2
%29 = add nsw i32 %28, 1
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %26, i64 %30
%32 = load i32, i32* %31
%33 = load i32, i32* %3
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 %34
store i32 %32, i32* %35
br label %36
36: ; preds = %16
%37 = load i32, i32* %3
%38 = add nsw i32 %37, 1
store i32 %38, i32* %3
br label %13
39: ; preds = %13
%40 = load i32*, i32** %4
%41 = getelementptr inbounds i32, i32* %40, i64 4
%42 = call i32 @checksum(i32* %41, i32 28)
store i32 %42, i32* %7
%43 = load i32*, i32** %4
%44 = getelementptr inbounds i32, i32* %43, i64 32
%45 = call i32 @checksum(i32* %44, i32 28)
store i32 %45, i32* %8
%46 = getelementptr inbounds [32 x i32], [32 x i32]* %5, i64 0, i64 0
%47 = getelementptr inbounds i32, i32* %46, i64 1
%48 = call i32 @checksum(i32* %47, i32 30)
store i32 %48, i32* %9
%49 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 0
%50 = getelementptr inbounds i32, i32* %49, i64 1
%51 = call i32 @checksum(i32* %50, i32 30)
store i32 %51, i32* %10
store i32 0, i32* %11
%52 = load i32, i32* %7
%53 = load i32*, i32** %2
%54 = getelementptr inbounds i32, i32* %53, i64 1
%55 = load i32, i32* %54
%56 = xor i32 %52, %55
%57 = load i32, i32* %11
%58 = xor i32 %57, %56
store i32 %58, i32* %11
%59 = load i32, i32* %8
%60 = load i32*, i32** %2
%61 = getelementptr inbounds i32, i32* %60, i64 30
%62 = load i32, i32* %61
%63 = xor i32 %59, %62
%64 = load i32, i32* %11
%65 = xor i32 %64, %63
store i32 %65, i32* %11
%66 = load i32, i32* %9
%67 = load i32*, i32** %2
%68 = getelementptr inbounds i32, i32* %67, i64 0
%69 = load i32, i32* %68
%70 = xor i32 %66, %69
%71 = load i32, i32* %11
%72 = xor i32 %71, %70
store i32 %72, i32* %11
%73 = load i32, i32* %10
%74 = load i32*, i32** %2
%75 = getelementptr inbounds i32, i32* %74, i64 31
%76 = load i32, i32* %75
%77 = xor i32 %73, %76
%78 = load i32, i32* %11
%79 = xor i32 %78, %77
store i32 %79, i32* %11
%80 = load i32, i32* %11
ret i32 %80
}

LLVM IR (-O2):
define i32 @verify_checksums(i32* %0) {
%2 = alloca [32 x i32]
%3 = alloca [32 x i32]
%4 = bitcast [32 x i32]* %2 to i8*
%5 = bitcast [32 x i32]* %3 to i8*
%6 = bitcast i32* %0 to <8 x i32>*
%7 = load <8 x i32>, <8 x i32>* %6
%8 = shufflevector <8 x i32> %7, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
%9 = shufflevector <8 x i32> %7, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
%10 = bitcast [32 x i32]* %2 to <4 x i32>*
store <4 x i32> %8, <4 x i32>* %10
%11 = bitcast [32 x i32]* %3 to <4 x i32>*
store <4 x i32> %9, <4 x i32>* %11
%12 = getelementptr inbounds i32, i32* %0, i64 8
%13 = bitcast i32* %12 to <8 x i32>*
%14 = load <8 x i32>, <8 x i32>* %13
%15 = shufflevector <8 x i32> %14, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
%16 = shufflevector <8 x i32> %14, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
%17 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 4
%18 = bitcast i32* %17 to <4 x i32>*
store <4 x i32> %15, <4 x i32>* %18
%19 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 4
%20 = bitcast i32* %19 to <4 x i32>*
store <4 x i32> %16, <4 x i32>* %20
%21 = getelementptr inbounds i32, i32* %0, i64 16
%22 = bitcast i32* %21 to <8 x i32>*
%23 = load <8 x i32>, <8 x i32>* %22
%24 = shufflevector <8 x i32> %23, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
%25 = shufflevector <8 x i32> %23, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
%26 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 8
%27 = bitcast i32* %26 to <4 x i32>*
store <4 x i32> %24, <4 x i32>* %27
%28 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 8
%29 = bitcast i32* %28 to <4 x i32>*
store <4 x i32> %25, <4 x i32>* %29
%30 = getelementptr inbounds i32, i32* %0, i64 24
%31 = bitcast i32* %30 to <8 x i32>*
%32 = load <8 x i32>, <8 x i32>* %31
%33 = shufflevector <8 x i32> %32, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
%34 = shufflevector <8 x i32> %32, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
%35 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 12
%36 = bitcast i32* %35 to <4 x i32>*
store <4 x i32> %33, <4 x i32>* %36
%37 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 12
%38 = bitcast i32* %37 to <4 x i32>*
store <4 x i32> %34, <4 x i32>* %38
%39 = getelementptr inbounds i32, i32* %0, i64 32
%40 = bitcast i32* %39 to <8 x i32>*
%41 = load <8 x i32>, <8 x i32>* %40
%42 = shufflevector <8 x i32> %41, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
%43 = shufflevector <8 x i32> %41, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
%44 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 16
%45 = bitcast i32* %44 to <4 x i32>*
store <4 x i32> %42, <4 x i32>* %45
%46 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 16
%47 = bitcast i32* %46 to <4 x i32>*
store <4 x i32> %43, <4 x i32>* %47
%48 = getelementptr inbounds i32, i32* %0, i64 40
%49 = bitcast i32* %48 to <8 x i32>*
%50 = load <8 x i32>, <8 x i32>* %49
%51 = shufflevector <8 x i32> %50, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
%52 = shufflevector <8 x i32> %50, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
%53 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 20
%54 = bitcast i32* %53 to <4 x i32>*
store <4 x i32> %51, <4 x i32>* %54
%55 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 20
%56 = bitcast i32* %55 to <4 x i32>*
store <4 x i32> %52, <4 x i32>* %56
%57 = getelementptr inbounds i32, i32* %0, i64 48
%58 = bitcast i32* %57 to <8 x i32>*
%59 = load <8 x i32>, <8 x i32>* %58
%60 = shufflevector <8 x i32> %59, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
%61 = shufflevector <8 x i32> %59, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
%62 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 24
%63 = bitcast i32* %62 to <4 x i32>*
store <4 x i32> %60, <4 x i32>* %63
%64 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 24
%65 = bitcast i32* %64 to <4 x i32>*
store <4 x i32> %61, <4 x i32>* %65
%66 = getelementptr inbounds i32, i32* %0, i64 56
%67 = bitcast i32* %66 to <8 x i32>*
%68 = load <8 x i32>, <8 x i32>* %67
%69 = shufflevector <8 x i32> %68, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
%70 = shufflevector <8 x i32> %68, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
%71 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 28
%72 = bitcast i32* %71 to <4 x i32>*
store <4 x i32> %69, <4 x i32>* %72
%73 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 28
%74 = bitcast i32* %73 to <4 x i32>*
store <4 x i32> %70, <4 x i32>* %74
%75 = getelementptr inbounds i32, i32* %0, i64 4
%76 = tail call i32 @checksum(i32* %75, i32 28)
%77 = getelementptr inbounds i32, i32* %0, i64 32
%78 = tail call i32 @checksum(i32* %77, i32 28)
%79 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 1
%80 = call i32 @checksum(i32* %79, i32 30)
%81 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 1
%82 = call i32 @checksum(i32* %81, i32 30)
%83 = getelementptr inbounds i32, i32* %0, i64 1
%84 = load i32, i32* %83
%85 = getelementptr inbounds i32, i32* %0, i64 30
%86 = load i32, i32* %85
%87 = load i32, i32* %0
%88 = getelementptr inbounds i32, i32* %0, i64 31
%89 = load i32, i32* %88
%90 = xor i32 %78, %76
%91 = xor i32 %90, %80
%92 = xor i32 %91, %82
%93 = xor i32 %92, %84
%94 = xor i32 %93, %86
%95 = xor i32 %94, %87
%96 = xor i32 %95, %89
ret i32 %96
}