#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 short Cal_CRC16(unsigned char *, unsigned int);
unsigned short crc16(int, unsigned char *, unsigned int);
unsigned short crc16_(unsigned char *, unsigned int);
unsigned short crc16_4(unsigned char *, unsigned int);
unsigned short crc16_area(unsigned char *, unsigned int, int);
unsigned short crc16_fast(unsigned char *, unsigned int);
unsigned short crc_16(unsigned char *, unsigned int);
unsigned short crc_ccitt(unsigned char *, unsigned int);
unsigned short csum(unsigned char *, unsigned int);
int /*<<< orphan*/ printf(char *, unsigned short);
int main(int argc, char **argv) {
  unsigned char buf[] = {0x45, 0x00, 0x00, 0x83, 0x00, 0x00, 0x40,
                         0x00, 0x40, 0x11, 0x00, 0x00, 0x0a, 0x44,
                         0x0c, 0x03, 0xff, 0xff, 0xff, 0xff};
  unsigned int len = 20;
  unsigned short cksum1;
  unsigned short cksum2;
  unsigned short cksum3;
  unsigned short cksum4;
  unsigned short cksum5;
  unsigned short cksum6;
  unsigned short cksum7;
  unsigned short cksum8;
  unsigned short cksum9;
  int i;
  cksum1 = crc16_(buf, len);
  cksum2 = crc16_fast(buf, len);
  cksum3 = crc16(~0x0000, buf, len);
  cksum4 = crc16_4(buf, len);
  cksum5 = crc_ccitt(buf, len);
  cksum6 = crc_16(buf, len);
  cksum7 = Cal_CRC16(buf, len);
  cksum8 = crc16_area(buf, len, ~0x0000);
  cksum9 = csum(buf, len);
  printf("crc16_1: 0x%x\n", cksum1);
  printf("crc16_2: 0x%x\n", cksum2);
  printf("crc16_3: 0x%x\n", cksum3);
  printf("crc16_4: 0x%x\n", cksum4);
  printf("crc16_5: 0x%x\n", cksum5);
  printf("crc16_6: 0x%x\n", cksum6);
  printf("crc16_7: 0x%x\n", cksum7);
  printf("crc16_8: 0x%x\n", cksum8);
  printf("crc16_9: 0x%x\n", cksum9);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xe43(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe40(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xe3e(%rip),%eax
mov    %eax,-0x20(%rbp)
movl   $0x14,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1040 <crc16_@plt>
mov    %ax,-0x36(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1090 <crc16_fast@plt>
mov    %ax,-0x38(%rbp)
lea    -0x30(%rbp),%rsi
mov    -0x34(%rbp),%edx
mov    $0xffffffff,%edi
call   10c0 <crc16@plt>
mov    %ax,-0x3a(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1060 <crc16_4@plt>
mov    %ax,-0x3c(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1050 <crc_ccitt@plt>
mov    %ax,-0x3e(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   10a0 <crc_16@plt>
mov    %ax,-0x40(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1030 <Cal_CRC16@plt>
mov    %ax,-0x42(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    $0xffffffff,%edx
call   10b0 <crc16_area@plt>
mov    %ax,-0x44(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1070 <csum@plt>
mov    %ax,-0x46(%rbp)
lea    0xd97(%rip),%rdi
movzwl -0x36(%rbp),%esi
call   1080 <printf@plt>
lea    0xd96(%rip),%rdi
movzwl -0x38(%rbp),%esi
call   1080 <printf@plt>
lea    0xd95(%rip),%rdi
movzwl -0x3a(%rbp),%esi
call   1080 <printf@plt>
lea    0xd94(%rip),%rdi
movzwl -0x3c(%rbp),%esi
call   1080 <printf@plt>
lea    0xd93(%rip),%rdi
movzwl -0x3e(%rbp),%esi
call   1080 <printf@plt>
lea    0xd92(%rip),%rdi
movzwl -0x40(%rbp),%esi
call   1080 <printf@plt>
lea    0xd91(%rip),%rdi
movzwl -0x42(%rbp),%esi
call   1080 <printf@plt>
lea    0xd90(%rip),%rdi
movzwl -0x44(%rbp),%esi
call   1080 <printf@plt>
lea    0xd8f(%rip),%rdi
movzwl -0x46(%rbp),%esi
call   1080 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movaps 0xe4b(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movl   $0xffffffff,0x20(%rsp)
ff
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x14,%esi
call   1040 <crc16_@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
mov    $0x14,%esi
call   1090 <crc16_fast@plt>
mov    %eax,%r14d
mov    $0xffffffff,%edi
mov    %rbx,%rsi
mov    $0x14,%edx
call   10c0 <crc16@plt>
mov    %eax,%r13d
mov    %rbx,%rdi
mov    $0x14,%esi
call   1060 <crc16_4@plt>
mov    %eax,%r15d
mov    %rbx,%rdi
mov    $0x14,%esi
call   1050 <crc_ccitt@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    $0x14,%esi
call   10a0 <crc_16@plt>
mov    %ax,0xa(%rsp)
mov    %rbx,%rdi
mov    $0x14,%esi
call   1030 <Cal_CRC16@plt>
mov    %ax,0xe(%rsp)
mov    %rbx,%rdi
mov    $0x14,%esi
mov    $0xffffffff,%edx
call   10b0 <crc16_area@plt>
mov    %ax,0xc(%rsp)
mov    %rbx,%rdi
mov    $0x14,%esi
call   1070 <csum@plt>
mov    %eax,%ebx
movzwl %r12w,%esi
lea    0xda4(%rip),%rdi
call   1080 <printf@plt>
movzwl %r14w,%esi
lea    0xda3(%rip),%rdi
call   1080 <printf@plt>
movzwl %r13w,%esi
lea    0xda2(%rip),%rdi
call   1080 <printf@plt>
movzwl %r15w,%esi
lea    0xda1(%rip),%rdi
call   1080 <printf@plt>
movzwl %bp,%esi
lea    0xda1(%rip),%rdi
call   1080 <printf@plt>
movzwl 0xa(%rsp),%esi
lea    0xd9f(%rip),%rdi
call   1080 <printf@plt>
movzwl 0xe(%rsp),%esi
lea    0xd9d(%rip),%rdi
call   1080 <printf@plt>
movzwl 0xc(%rsp),%esi
lea    0xd9b(%rip),%rdi
call   1080 <printf@plt>
movzwl %bx,%esi
lea    0xd9b(%rip),%rdi
call   1080 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.buf = [20 x i8] c"E\00\00\83\00\00@\00@\11\00\00\0AD\0C\03\FF\FF\FF\FF"
@.str = [15 x i8] c"crc16_1: 0x%x\0A\00"
@.str.1 = [15 x i8] c"crc16_2: 0x%x\0A\00"
@.str.2 = [15 x i8] c"crc16_3: 0x%x\0A\00"
@.str.3 = [15 x i8] c"crc16_4: 0x%x\0A\00"
@.str.4 = [15 x i8] c"crc16_5: 0x%x\0A\00"
@.str.5 = [15 x i8] c"crc16_6: 0x%x\0A\00"
@.str.6 = [15 x i8] c"crc16_7: 0x%x\0A\00"
@.str.7 = [15 x i8] c"crc16_8: 0x%x\0A\00"
@.str.8 = [15 x i8] c"crc16_9: 0x%x\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [20 x i8]
%7 = alloca i32
%8 = alloca i16
%9 = alloca i16
%10 = alloca i16
%11 = alloca i16
%12 = alloca i16
%13 = alloca i16
%14 = alloca i16
%15 = alloca i16
%16 = alloca i16
%17 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%18 = bitcast [20 x i8]* %6 to i8*
store i32 20, i32* %7
%19 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%20 = load i32, i32* %7
%21 = call zeroext i16 @crc16_(i8* %19, i32 %20)
store i16 %21, i16* %8
%22 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%23 = load i32, i32* %7
%24 = call zeroext i16 @crc16_fast(i8* %22, i32 %23)
store i16 %24, i16* %9
%25 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%26 = load i32, i32* %7
%27 = call zeroext i16 @crc16(i32 -1, i8* %25, i32 %26)
store i16 %27, i16* %10
%28 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%29 = load i32, i32* %7
%30 = call zeroext i16 @crc16_4(i8* %28, i32 %29)
store i16 %30, i16* %11
%31 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%32 = load i32, i32* %7
%33 = call zeroext i16 @crc_ccitt(i8* %31, i32 %32)
store i16 %33, i16* %12
%34 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%35 = load i32, i32* %7
%36 = call zeroext i16 @crc_16(i8* %34, i32 %35)
store i16 %36, i16* %13
%37 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%38 = load i32, i32* %7
%39 = call zeroext i16 @Cal_CRC16(i8* %37, i32 %38)
store i16 %39, i16* %14
%40 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%41 = load i32, i32* %7
%42 = call zeroext i16 @crc16_area(i8* %40, i32 %41, i32 -1)
store i16 %42, i16* %15
%43 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%44 = load i32, i32* %7
%45 = call zeroext i16 @csum(i8* %43, i32 %44)
store i16 %45, i16* %16
%46 = load i16, i16* %8
%47 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i16 zeroext %46)
%48 = load i16, i16* %9
%49 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i16 zeroext %48)
%50 = load i16, i16* %10
%51 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i16 zeroext %50)
%52 = load i16, i16* %11
%53 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i16 zeroext %52)
%54 = load i16, i16* %12
%55 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i16 zeroext %54)
%56 = load i16, i16* %13
%57 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i16 zeroext %56)
%58 = load i16, i16* %14
%59 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i16 zeroext %58)
%60 = load i16, i16* %15
%61 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i16 zeroext %60)
%62 = load i16, i16* %16
%63 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i16 zeroext %62)
ret i32 0
}

LLVM IR (-O2):
@__const.main.buf = [20 x i8] c"E\00\00\83\00\00@\00@\11\00\00\0AD\0C\03\FF\FF\FF\FF"
@.str = [15 x i8] c"crc16_1: 0x%x\0A\00"
@.str.1 = [15 x i8] c"crc16_2: 0x%x\0A\00"
@.str.2 = [15 x i8] c"crc16_3: 0x%x\0A\00"
@.str.3 = [15 x i8] c"crc16_4: 0x%x\0A\00"
@.str.4 = [15 x i8] c"crc16_5: 0x%x\0A\00"
@.str.5 = [15 x i8] c"crc16_6: 0x%x\0A\00"
@.str.6 = [15 x i8] c"crc16_7: 0x%x\0A\00"
@.str.7 = [15 x i8] c"crc16_8: 0x%x\0A\00"
@.str.8 = [15 x i8] c"crc16_9: 0x%x\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [20 x i8]
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%5 = call zeroext i16 @crc16_(i8* %4, i32 20)
%6 = call zeroext i16 @crc16_fast(i8* %4, i32 20)
%7 = call zeroext i16 @crc16(i32 -1, i8* %4, i32 20)
%8 = call zeroext i16 @crc16_4(i8* %4, i32 20)
%9 = call zeroext i16 @crc_ccitt(i8* %4, i32 20)
%10 = call zeroext i16 @crc_16(i8* %4, i32 20)
%11 = call zeroext i16 @Cal_CRC16(i8* %4, i32 20)
%12 = call zeroext i16 @crc16_area(i8* %4, i32 20, i32 -1)
%13 = call zeroext i16 @csum(i8* %4, i32 20)
%14 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i16 zeroext %5)
%15 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i16 zeroext %6)
%16 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i16 zeroext %7)
%17 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i16 zeroext %8)
%18 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i16 zeroext %9)
%19 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i16 zeroext %10)
%20 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i16 zeroext %11)
%21 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i16 zeroext %12)
%22 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i16 zeroext %13)
ret i32 0
}