#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 */
struct cgw_csum_crc8 {
  int profile;
  int *profile_data;
};

/* Variables and functions */
#define CGW_CRC8PRF_16U8 130
#define CGW_CRC8PRF_1U8 129
#define CGW_CRC8PRF_SFFID_XOR 128
int /*<<< orphan*/ printf(char *, ...);
void print_cs_crc8_profile(struct cgw_csum_crc8 *cs_crc8) {
  int i;
  printf("-p %d:", cs_crc8->profile);
  switch (cs_crc8->profile) {
  case CGW_CRC8PRF_1U8:
    printf("%02X", cs_crc8->profile_data[0]);
    break;
  case CGW_CRC8PRF_16U8:
    for (i = 0; i < 16; i++)
      printf("%02X", cs_crc8->profile_data[i]);
    break;
  case CGW_CRC8PRF_SFFID_XOR:
    break;
  default:
    printf("<unknown profile #%d>", cs_crc8->profile);
  }
  printf(" ");
}


x86 assembly (clang, -O0):
<print_cs_crc8_profile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xed7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
sub    $0x80,%eax
je     11cd <print_cs_crc8_profile+0xbd>
jmp    1149 <print_cs_crc8_profile+0x39>
mov    -0x10(%rbp),%eax
sub    $0x81,%eax
je     116f <print_cs_crc8_profile+0x5f>
jmp    115c <print_cs_crc8_profile+0x4c>
mov    -0x10(%rbp),%eax
sub    $0x82,%eax
je     118c <print_cs_crc8_profile+0x7c>
jmp    11d2 <print_cs_crc8_profile+0xc2>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%esi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e6 <print_cs_crc8_profile+0xd6>
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    11c8 <print_cs_crc8_profile+0xb8>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1193 <print_cs_crc8_profile+0x83>
jmp    11e6 <print_cs_crc8_profile+0xd6>
jmp    11e6 <print_cs_crc8_profile+0xd6>
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_cs_crc8_profile>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%esi
lea    0xed0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rbx),%esi
cmp    $0x80,%esi
je     128b <print_cs_crc8_profile+0x16b>
cmp    $0x81,%esi
je     126e <print_cs_crc8_profile+0x14e>
cmp    $0x82,%esi
jne    127d <print_cs_crc8_profile+0x15d>
mov    0x8(%rbx),%rax
mov    (%rax),%esi
lea    0xe9d(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%rax
mov    0x4(%rax),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%rax
mov    0x8(%rax),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%rax
mov    0xc(%rax),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%rax
mov    0x10(%rax),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%rax
mov    0x14(%rax),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%rax
mov    0x18(%rax),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%rax
mov    0x1c(%rax),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%rax
mov    0x20(%rax),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%rax
mov    0x24(%rax),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%rax
mov    0x28(%rax),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%rax
mov    0x2c(%rax),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%rax
mov    0x30(%rax),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%rax
mov    0x34(%rax),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%rax
mov    0x38(%rax),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%rax
mov    0x3c(%rax),%esi
mov    %r14,%rdi
jmp    1284 <print_cs_crc8_profile+0x164>
mov    0x8(%rbx),%rax
mov    (%rax),%esi
lea    0xd8c(%rip),%rdi
jmp    1284 <print_cs_crc8_profile+0x164>
lea    0xd88(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x20,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

LLVM IR (-O0):
%struct.cgw_csum_crc8 = type { i32, i32* }
@.str = [7 x i8] c"-p %d:\00"
@.str.1 = [5 x i8] c"%02X\00"
@.str.2 = [22 x i8] c"<unknown profile #%d>\00"
@.str.3 = [2 x i8] c" \00"
define void @print_cs_crc8_profile(%struct.cgw_csum_crc8* %0) {
%2 = alloca %struct.cgw_csum_crc8*
%3 = alloca i32
store %struct.cgw_csum_crc8* %0, %struct.cgw_csum_crc8** %2
%4 = load %struct.cgw_csum_crc8*, %struct.cgw_csum_crc8** %2
%5 = getelementptr inbounds %struct.cgw_csum_crc8, %struct.cgw_csum_crc8* %4, i32 0, i32 0
%6 = load i32, i32* %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load %struct.cgw_csum_crc8*, %struct.cgw_csum_crc8** %2
%9 = getelementptr inbounds %struct.cgw_csum_crc8, %struct.cgw_csum_crc8* %8, i32 0, i32 0
%10 = load i32, i32* %9
switch i32 %10, label %36 [
i32 129, label %11
i32 130, label %18
i32 128, label %35
]
11: ; preds = %1
%12 = load %struct.cgw_csum_crc8*, %struct.cgw_csum_crc8** %2
%13 = getelementptr inbounds %struct.cgw_csum_crc8, %struct.cgw_csum_crc8* %12, i32 0, i32 1
%14 = load i32*, i32** %13
%15 = getelementptr inbounds i32, i32* %14, i64 0
%16 = load i32, i32* %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %16)
br label %41
18: ; preds = %1
store i32 0, i32* %3
br label %19
19: ; preds = %31, %18
%20 = load i32, i32* %3
%21 = icmp slt i32 %20, 16
br i1 %21, label %22, label %34
22: ; preds = %19
%23 = load %struct.cgw_csum_crc8*, %struct.cgw_csum_crc8** %2
%24 = getelementptr inbounds %struct.cgw_csum_crc8, %struct.cgw_csum_crc8* %23, i32 0, i32 1
%25 = load i32*, i32** %24
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %25, i64 %27
%29 = load i32, i32* %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %22
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %19
34: ; preds = %19
br label %41
35: ; preds = %1
br label %41
36: ; preds = %1
%37 = load %struct.cgw_csum_crc8*, %struct.cgw_csum_crc8** %2
%38 = getelementptr inbounds %struct.cgw_csum_crc8, %struct.cgw_csum_crc8* %37, i32 0, i32 0
%39 = load i32, i32* %38
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %39)
br label %41
41: ; preds = %36, %35, %34, %11
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.cgw_csum_crc8 = type { i32, i32* }
@.str = [7 x i8] c"-p %d:\00"
@.str.1 = [5 x i8] c"%02X\00"
@.str.2 = [22 x i8] c"<unknown profile #%d>\00"
define void @print_cs_crc8_profile(%struct.cgw_csum_crc8* nocapture %0) {
%2 = getelementptr inbounds %struct.cgw_csum_crc8, %struct.cgw_csum_crc8* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %2
switch i32 %5, label %76 [
i32 129, label %71
i32 130, label %6
i32 128, label %78
]
6: ; preds = %1
%7 = getelementptr inbounds %struct.cgw_csum_crc8, %struct.cgw_csum_crc8* %0, i64 0, i32 1
%8 = load i32*, i32** %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = load i32*, i32** %7
%12 = getelementptr inbounds i32, i32* %11, i64 1
%13 = load i32, i32* %12
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = load i32*, i32** %7
%16 = getelementptr inbounds i32, i32* %15, i64 2
%17 = load i32, i32* %16
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = load i32*, i32** %7
%20 = getelementptr inbounds i32, i32* %19, i64 3
%21 = load i32, i32* %20
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = load i32*, i32** %7
%24 = getelementptr inbounds i32, i32* %23, i64 4
%25 = load i32, i32* %24
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = load i32*, i32** %7
%28 = getelementptr inbounds i32, i32* %27, i64 5
%29 = load i32, i32* %28
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %29)
%31 = load i32*, i32** %7
%32 = getelementptr inbounds i32, i32* %31, i64 6
%33 = load i32, i32* %32
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %33)
%35 = load i32*, i32** %7
%36 = getelementptr inbounds i32, i32* %35, i64 7
%37 = load i32, i32* %36
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %37)
%39 = load i32*, i32** %7
%40 = getelementptr inbounds i32, i32* %39, i64 8
%41 = load i32, i32* %40
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %41)
%43 = load i32*, i32** %7
%44 = getelementptr inbounds i32, i32* %43, i64 9
%45 = load i32, i32* %44
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %45)
%47 = load i32*, i32** %7
%48 = getelementptr inbounds i32, i32* %47, i64 10
%49 = load i32, i32* %48
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %49)
%51 = load i32*, i32** %7
%52 = getelementptr inbounds i32, i32* %51, i64 11
%53 = load i32, i32* %52
%54 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %53)
%55 = load i32*, i32** %7
%56 = getelementptr inbounds i32, i32* %55, i64 12
%57 = load i32, i32* %56
%58 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %57)
%59 = load i32*, i32** %7
%60 = getelementptr inbounds i32, i32* %59, i64 13
%61 = load i32, i32* %60
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %61)
%63 = load i32*, i32** %7
%64 = getelementptr inbounds i32, i32* %63, i64 14
%65 = load i32, i32* %64
%66 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %65)
%67 = load i32*, i32** %7
%68 = getelementptr inbounds i32, i32* %67, i64 15
%69 = load i32, i32* %68
%70 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %69)
br label %78
71: ; preds = %1
%72 = getelementptr inbounds %struct.cgw_csum_crc8, %struct.cgw_csum_crc8* %0, i64 0, i32 1
%73 = load i32*, i32** %72
%74 = load i32, i32* %73
%75 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %74)
br label %78
76: ; preds = %1
%77 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %5)
br label %78
78: ; preds = %6, %76, %1, %71
%79 = tail call i32 @putchar(i32 32)
ret void
}