#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 */
int /*<<< orphan*/ extension_version(unsigned char *);
int parse_cea(unsigned char *);
int parse_extension(unsigned char *x) {
  int conformant_extension;
  (void)("\n");
  switch (x[0]) {
  case 0x02:
    (void)("CEA extension block\n");
    extension_version(x);
    conformant_extension = parse_cea(x);
    break;
  case 0x10:
    (void)("VTB extension block\n");
    break;
  case 0x40:
    (void)("DI extension block\n");
    break;
  case 0x50:
    (void)("LS extension block\n");
    break;
  case 0x60:
    (void)("DPVL extension block\n");
    break;
  case 0xF0:
    (void)("Block map\n");
    break;
  case 0xFF:
    (void)("Manufacturer-specific extension block\n");
  default:
    (void)("Unknown extension block\n");
    break;
  }
  (void)("\n");
  return conformant_extension;
}


x86 assembly (clang, -O0):
<parse_extension>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x10(%rbp)
sub    $0x2,%eax
je     11ae <parse_extension+0x8e>
jmp    1144 <parse_extension+0x24>
mov    -0x10(%rbp),%eax
sub    $0x10,%eax
je     11c8 <parse_extension+0xa8>
jmp    1155 <parse_extension+0x35>
mov    -0x10(%rbp),%eax
sub    $0x40,%eax
je     11cd <parse_extension+0xad>
jmp    1166 <parse_extension+0x46>
mov    -0x10(%rbp),%eax
sub    $0x50,%eax
je     11d2 <parse_extension+0xb2>
jmp    1177 <parse_extension+0x57>
mov    -0x10(%rbp),%eax
sub    $0x60,%eax
je     11d7 <parse_extension+0xb7>
jmp    1188 <parse_extension+0x68>
mov    -0x10(%rbp),%eax
sub    $0xf0,%eax
je     11dc <parse_extension+0xbc>
jmp    119b <parse_extension+0x7b>
mov    -0x10(%rbp),%eax
sub    $0xff,%eax
je     11e1 <parse_extension+0xc1>
jmp    11e6 <parse_extension+0xc6>
mov    -0x8(%rbp),%rdi
call   1040 <extension_version@plt>
mov    -0x8(%rbp),%rdi
call   1030 <parse_cea@plt>
mov    %eax,-0xc(%rbp)
jmp    11eb <parse_extension+0xcb>
jmp    11eb <parse_extension+0xcb>
jmp    11eb <parse_extension+0xcb>
jmp    11eb <parse_extension+0xcb>
jmp    11eb <parse_extension+0xcb>
jmp    11eb <parse_extension+0xcb>
jmp    11e6 <parse_extension+0xc6>
jmp    11eb <parse_extension+0xcb>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_extension>:
push   %rbx
cmpb   $0x2,(%rdi)
jne    1137 <parse_extension+0x17>
mov    %rdi,%rbx
call   1040 <extension_version@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <parse_cea@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [21 x i8] c"CEA extension block\0A\00"
@.str.2 = [21 x i8] c"VTB extension block\0A\00"
@.str.3 = [20 x i8] c"DI extension block\0A\00"
@.str.4 = [20 x i8] c"LS extension block\0A\00"
@.str.5 = [22 x i8] c"DPVL extension block\0A\00"
@.str.6 = [11 x i8] c"Block map\0A\00"
@.str.7 = [39 x i8] c"Manufacturer-specific extension block\0A\00"
@.str.8 = [25 x i8] c"Unknown extension block\0A\00"
define i32 @parse_extension(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
switch i32 %7, label %19 [
i32 2, label %8
i32 16, label %13
i32 64, label %14
i32 80, label %15
i32 96, label %16
i32 240, label %17
i32 255, label %18
]
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i32 @extension_version(i8* %9)
%11 = load i8*, i8** %2
%12 = call i32 @parse_cea(i8* %11)
store i32 %12, i32* %3
br label %20
13: ; preds = %1
br label %20
14: ; preds = %1
br label %20
15: ; preds = %1
br label %20
16: ; preds = %1
br label %20
17: ; preds = %1
br label %20
18: ; preds = %1
br label %19
19: ; preds = %1, %18
br label %20
20: ; preds = %19, %17, %16, %15, %14, %13, %8
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @parse_extension(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 2
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @extension_version(i8* %0)
%6 = tail call i32 @parse_cea(i8* %0)
br label %7
7: ; preds = %1, %4
%8 = phi i32 [ %6, %4 ], [ undef, %1 ]
ret i32 %8
}