#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 CRCpolynomial(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main() {
  char buffer[1025];
  strcpy((char *)buffer, "PACKET 9 line 10 jjjjjjjjjjjjjjjjjjjj");
  unsigned int CRCresult;
  CRCresult = CRCpolynomial(buffer);
  printf("The CRC hex value for: '%s' is lenght is %d ", buffer,
         strlen(buffer));
  printf(" 0x%X\n\n", CRCresult);
  printf(" %d\n\n", CRCresult);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x410(%rbp),%rdi
lea    0xea0(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x410(%rbp),%rdi
call   1030 <CRCpolynomial@plt>
mov    %eax,-0x414(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0x420(%rbp)
lea    -0x410(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x420(%rbp),%rsi
mov    %eax,%edx
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x414(%rbp),%esi
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x414(%rbp),%esi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x408,%rsp
lea    0xeb0(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
call   1030 <CRCpolynomial@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1050 <strlen@plt>
lea    0xeb2(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xecc(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xec4(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"PACKET 9 line 10 jjjjjjjjjjjjjjjjjjjj\00"
@.str.1 = [45 x i8] c"The CRC hex value for: '%s' is lenght is %d \00"
@.str.2 = [8 x i8] c" 0x%X\0A\0A\00"
@.str.3 = [6 x i8] c" %d\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1025 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = getelementptr inbounds [1025 x i8], [1025 x i8]* %2, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [1025 x i8], [1025 x i8]* %2, i64 0, i64 0
%7 = call i32 @CRCpolynomial(i8* %6)
store i32 %7, i32* %3
%8 = getelementptr inbounds [1025 x i8], [1025 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [1025 x i8], [1025 x i8]* %2, i64 0, i64 0
%10 = call i32 @strlen(i8* %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* %8, i32 %10)
%12 = load i32, i32* %3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %3
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [38 x i8] c"PACKET 9 line 10 jjjjjjjjjjjjjjjjjjjj\00"
@.str.1 = [45 x i8] c"The CRC hex value for: '%s' is lenght is %d \00"
@.str.2 = [8 x i8] c" 0x%X\0A\0A\00"
@.str.3 = [6 x i8] c" %d\0A\0A\00"
define i32 @main() {
%1 = alloca [1025 x i8]
%2 = getelementptr inbounds [1025 x i8], [1025 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @CRCpolynomial(i8* %2)
%5 = call i32 @strlen(i8* %2)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* %2, i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %4)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %4)
ret i32 0
}