#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 */

/* Variables and functions */
unsigned int docrc16_1(unsigned int, unsigned int);
unsigned int uidcsum(unsigned int u[3]) {
  unsigned int i, crc1 = 0, crc2 = 0;
  for (i = 0; i < 3; i++) {
    crc1 = docrc16_1(crc1, (u[i] >> 0) & 0xff);
    crc2 = docrc16_1(crc2, (u[i] >> 8) & 0xff);
    crc1 = docrc16_1(crc1, (u[i] >> 16) & 0xff);
    crc2 = docrc16_1(crc2, (u[i] >> 24) & 0xff);
  }
  return (crc2 << 16) | crc1;
}


x86 assembly (clang, -O0):
<uidcsum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jae    11c1 <uidcsum+0xb1>
mov    -0x10(%rbp),%edi
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    (%rax,%rcx,4),%esi
shr    $0x0,%esi
and    $0xff,%esi
call   1030 <docrc16_1@plt>
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    (%rax,%rcx,4),%esi
shr    $0x8,%esi
and    $0xff,%esi
call   1030 <docrc16_1@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    (%rax,%rcx,4),%esi
shr    $0x10,%esi
and    $0xff,%esi
call   1030 <docrc16_1@plt>
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    (%rax,%rcx,4),%esi
shr    $0x18,%esi
and    $0xff,%esi
call   1030 <docrc16_1@plt>
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1131 <uidcsum+0x21>
mov    -0x14(%rbp),%eax
shl    $0x10,%eax
or     -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uidcsum>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
movzbl (%rdi),%esi
xor    %edi,%edi
call   1030 <docrc16_1@plt>
mov    %eax,%ebp
movzbl 0x1(%rbx),%esi
xor    %edi,%edi
call   1030 <docrc16_1@plt>
mov    %eax,%r14d
movzbl 0x2(%rbx),%esi
mov    %ebp,%edi
call   1030 <docrc16_1@plt>
mov    %eax,%ebp
movzbl 0x3(%rbx),%esi
mov    %r14d,%edi
call   1030 <docrc16_1@plt>
mov    %eax,%r14d
movzbl 0x4(%rbx),%esi
mov    %ebp,%edi
call   1030 <docrc16_1@plt>
mov    %eax,%ebp
movzbl 0x5(%rbx),%esi
mov    %r14d,%edi
call   1030 <docrc16_1@plt>
mov    %eax,%r14d
movzbl 0x6(%rbx),%esi
mov    %ebp,%edi
call   1030 <docrc16_1@plt>
mov    %eax,%ebp
movzbl 0x7(%rbx),%esi
mov    %r14d,%edi
call   1030 <docrc16_1@plt>
mov    %eax,%r14d
movzbl 0x8(%rbx),%esi
mov    %ebp,%edi
call   1030 <docrc16_1@plt>
mov    %eax,%ebp
movzbl 0x9(%rbx),%esi
mov    %r14d,%edi
call   1030 <docrc16_1@plt>
mov    %eax,%r14d
movzbl 0xa(%rbx),%esi
mov    %ebp,%edi
call   1030 <docrc16_1@plt>
mov    %eax,%ebp
movzbl 0xb(%rbx),%esi
mov    %r14d,%edi
call   1030 <docrc16_1@plt>
shl    $0x10,%eax
or     %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @uidcsum(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %3
br label %6
6: ; preds = %46, %1
%7 = load i32, i32* %3
%8 = icmp ult i32 %7, 3
br i1 %8, label %9, label %49
9: ; preds = %6
%10 = load i32, i32* %4
%11 = load i32*, i32** %2
%12 = load i32, i32* %3
%13 = zext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = lshr i32 %15, 0
%17 = and i32 %16, 255
%18 = call i32 @docrc16_1(i32 %10, i32 %17)
store i32 %18, i32* %4
%19 = load i32, i32* %5
%20 = load i32*, i32** %2
%21 = load i32, i32* %3
%22 = zext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
%24 = load i32, i32* %23
%25 = lshr i32 %24, 8
%26 = and i32 %25, 255
%27 = call i32 @docrc16_1(i32 %19, i32 %26)
store i32 %27, i32* %5
%28 = load i32, i32* %4
%29 = load i32*, i32** %2
%30 = load i32, i32* %3
%31 = zext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %29, i64 %31
%33 = load i32, i32* %32
%34 = lshr i32 %33, 16
%35 = and i32 %34, 255
%36 = call i32 @docrc16_1(i32 %28, i32 %35)
store i32 %36, i32* %4
%37 = load i32, i32* %5
%38 = load i32*, i32** %2
%39 = load i32, i32* %3
%40 = zext i32 %39 to i64
%41 = getelementptr inbounds i32, i32* %38, i64 %40
%42 = load i32, i32* %41
%43 = lshr i32 %42, 24
%44 = and i32 %43, 255
%45 = call i32 @docrc16_1(i32 %37, i32 %44)
store i32 %45, i32* %5
br label %46
46: ; preds = %9
%47 = load i32, i32* %3
%48 = add i32 %47, 1
store i32 %48, i32* %3
br label %6
49: ; preds = %6
%50 = load i32, i32* %5
%51 = shl i32 %50, 16
%52 = load i32, i32* %4
%53 = or i32 %51, %52
ret i32 %53
}

LLVM IR (-O2):
define i32 @uidcsum(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 255
%4 = tail call i32 @docrc16_1(i32 0, i32 %3)
%5 = load i32, i32* %0
%6 = lshr i32 %5, 8
%7 = and i32 %6, 255
%8 = tail call i32 @docrc16_1(i32 0, i32 %7)
%9 = load i32, i32* %0
%10 = lshr i32 %9, 16
%11 = and i32 %10, 255
%12 = tail call i32 @docrc16_1(i32 %4, i32 %11)
%13 = load i32, i32* %0
%14 = lshr i32 %13, 24
%15 = tail call i32 @docrc16_1(i32 %8, i32 %14)
%16 = getelementptr inbounds i32, i32* %0, i64 1
%17 = load i32, i32* %16
%18 = and i32 %17, 255
%19 = tail call i32 @docrc16_1(i32 %12, i32 %18)
%20 = load i32, i32* %16
%21 = lshr i32 %20, 8
%22 = and i32 %21, 255
%23 = tail call i32 @docrc16_1(i32 %15, i32 %22)
%24 = load i32, i32* %16
%25 = lshr i32 %24, 16
%26 = and i32 %25, 255
%27 = tail call i32 @docrc16_1(i32 %19, i32 %26)
%28 = load i32, i32* %16
%29 = lshr i32 %28, 24
%30 = tail call i32 @docrc16_1(i32 %23, i32 %29)
%31 = getelementptr inbounds i32, i32* %0, i64 2
%32 = load i32, i32* %31
%33 = and i32 %32, 255
%34 = tail call i32 @docrc16_1(i32 %27, i32 %33)
%35 = load i32, i32* %31
%36 = lshr i32 %35, 8
%37 = and i32 %36, 255
%38 = tail call i32 @docrc16_1(i32 %30, i32 %37)
%39 = load i32, i32* %31
%40 = lshr i32 %39, 16
%41 = and i32 %40, 255
%42 = tail call i32 @docrc16_1(i32 %34, i32 %41)
%43 = load i32, i32* %31
%44 = lshr i32 %43, 24
%45 = tail call i32 @docrc16_1(i32 %38, i32 %44)
%46 = shl i32 %45, 16
%47 = or i32 %46, %42
ret i32 %47
}