#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;

/* Variables and functions */
int atoi(char *);
int crc16(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  if (argc < 2) {
    printf("%u", 0);
    exit(1);
  }
  int crc = 0;
  const char *cData = argv[1];
  int nSize = atoi(argv[2]);
  crc = crc16((uint8_t *)cData, nSize);
  printf("%u", crc);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1178 <main+0x38>
lea    0xe99(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1060 <crc16@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe4c(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x1,%edi
jle    1172 <main+0x32>
mov    0x8(%rsi),%rbx
mov    0x10(%rsi),%rdi
call   1040 <atoi@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1060 <crc16@plt>
lea    0xe9c(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rbx
ret
lea    0xe87(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%u\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 2
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 0)
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %2
store i32 0, i32* %6
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
store i8* %17, i8** %7
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 2
%20 = load i8*, i8** %19
%21 = call i32 @atoi(i8* %20)
store i32 %21, i32* %8
%22 = load i8*, i8** %7
%23 = bitcast i8* %22 to i32*
%24 = load i32, i32* %8
%25 = call i32 @crc16(i32* %23, i32 %24)
store i32 %25, i32* %6
%26 = load i32, i32* %6
%27 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %26)
ret i32 1
}

LLVM IR (-O2):
@.str = [3 x i8] c"%u\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 0)
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = bitcast i8** %8 to i32**
%10 = load i32*, i32** %9
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
%14 = tail call i32 @crc16(i32* %10, i32 %13)
%15 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i32 1
}