#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 uint8_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void pr_cat_B(FILE *fp, uint8_t c) {
  fprintf(fp, "TYPE:");
  switch (c) {
  case 0:
    fprintf(fp, "B,%d:No ADS-B emitter category information\n", c);
    break;
  case 1:
    fprintf(fp, "Glider / Sailplane\n");
    break;
  case 2:
    fprintf(fp, "Lighter-than-air\n");
    break;
  case 3:
    fprintf(fp, "Parachutist\n");
    break;
  case 4:
    fprintf(fp, "Hang-glider\n");
    break;
  case 5:
    fprintf(fp, "Reserved\n");
    break;
  case 6:
    fprintf(fp, "Unmanned aerial vehicle\n");
    break;
  case 7:
    fprintf(fp, "Trans-atmospheric vehicle\n");
    break;
  default:
    fprintf(fp, "B,%d:Invalid category\n", c);
  }
}


x86 assembly (clang, -O0):
<pr_cat_B>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xef6(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    -0xc(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x7,%rax
ja     1211 <pr_cat_B+0x101>
mov    -0x18(%rbp),%rax
lea    0xeb3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xec2(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1226 <pr_cat_B+0x116>
mov    -0x8(%rbp),%rdi
lea    0xed7(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1226 <pr_cat_B+0x116>
mov    -0x8(%rbp),%rdi
lea    0xed4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1226 <pr_cat_B+0x116>
mov    -0x8(%rbp),%rdi
lea    0xecf(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1226 <pr_cat_B+0x116>
mov    -0x8(%rbp),%rdi
lea    0xec5(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1226 <pr_cat_B+0x116>
mov    -0x8(%rbp),%rdi
lea    0xebb(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1226 <pr_cat_B+0x116>
mov    -0x8(%rbp),%rdi
lea    0xeae(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1226 <pr_cat_B+0x116>
mov    -0x8(%rbp),%rdi
lea    0xeb0(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1226 <pr_cat_B+0x116>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xeb1(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_cat_B>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xef1(%rip),%rdi
mov    $0x5,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
cmp    $0x7,%ebp
ja     1166 <pr_cat_B+0x46>
mov    %ebp,%eax
lea    0xeb1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xec7(%rip),%rsi
mov    %rbx,%rdi
xor    %edx,%edx
jmp    1172 <pr_cat_B+0x52>
lea    0xf63(%rip),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fprintf@plt>
lea    0xecc(%rip),%rdi
mov    $0x13,%esi
jmp    11da <pr_cat_B+0xba>
lea    0xed2(%rip),%rdi
mov    $0x11,%esi
jmp    11da <pr_cat_B+0xba>
lea    0xed6(%rip),%rdi
jmp    11ab <pr_cat_B+0x8b>
lea    0xeda(%rip),%rdi
mov    $0xc,%esi
jmp    11da <pr_cat_B+0xba>
lea    0xed9(%rip),%rdi
mov    $0x9,%esi
jmp    11da <pr_cat_B+0xba>
lea    0xed5(%rip),%rdi
mov    $0x18,%esi
jmp    11da <pr_cat_B+0xba>
lea    0xee0(%rip),%rdi
mov    $0x1a,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <fwrite@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"TYPE:\00"
@.str.1 = [44 x i8] c"B,%d:No ADS-B emitter category information\0A\00"
@.str.2 = [20 x i8] c"Glider / Sailplane\0A\00"
@.str.3 = [18 x i8] c"Lighter-than-air\0A\00"
@.str.4 = [13 x i8] c"Parachutist\0A\00"
@.str.5 = [13 x i8] c"Hang-glider\0A\00"
@.str.6 = [10 x i8] c"Reserved\0A\00"
@.str.7 = [25 x i8] c"Unmanned aerial vehicle\0A\00"
@.str.8 = [27 x i8] c"Trans-atmospheric vehicle\0A\00"
@.str.9 = [23 x i8] c"B,%d:Invalid category\0A\00"
define void @pr_cat_B(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* %4
switch i32 %7, label %33 [
i32 0, label %8
i32 1, label %12
i32 2, label %15
i32 3, label %18
i32 4, label %21
i32 5, label %24
i32 6, label %27
i32 7, label %30
]
8: ; preds = %2
%9 = load i32*, i32** %3
%10 = load i32, i32* %4
%11 = call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i32 %10)
br label %37
12: ; preds = %2
%13 = load i32*, i32** %3
%14 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %37
15: ; preds = %2
%16 = load i32*, i32** %3
%17 = call i32 (i32*, i8*, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %37
18: ; preds = %2
%19 = load i32*, i32** %3
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %19, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
br label %37
21: ; preds = %2
%22 = load i32*, i32** %3
%23 = call i32 (i32*, i8*, ...) @fprintf(i32* %22, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
br label %37
24: ; preds = %2
%25 = load i32*, i32** %3
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %25, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
br label %37
27: ; preds = %2
%28 = load i32*, i32** %3
%29 = call i32 (i32*, i8*, ...) @fprintf(i32* %28, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
br label %37
30: ; preds = %2
%31 = load i32*, i32** %3
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
br label %37
33: ; preds = %2
%34 = load i32*, i32** %3
%35 = load i32, i32* %4
%36 = call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %33, %30, %27, %24, %21, %18, %15, %12, %8
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"TYPE:\00"
@.str.1 = [44 x i8] c"B,%d:No ADS-B emitter category information\0A\00"
@.str.2 = [20 x i8] c"Glider / Sailplane\0A\00"
@.str.3 = [18 x i8] c"Lighter-than-air\0A\00"
@.str.4 = [13 x i8] c"Parachutist\0A\00"
@.str.5 = [13 x i8] c"Hang-glider\0A\00"
@.str.6 = [10 x i8] c"Reserved\0A\00"
@.str.7 = [25 x i8] c"Unmanned aerial vehicle\0A\00"
@.str.8 = [27 x i8] c"Trans-atmospheric vehicle\0A\00"
@.str.9 = [23 x i8] c"B,%d:Invalid category\0A\00"
define void @pr_cat_B(i32* nocapture %0, i32 %1) {
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 5, i64 1, i32* %0)
switch i32 %1, label %20 [
i32 0, label %4
i32 1, label %6
i32 2, label %8
i32 3, label %10
i32 4, label %12
i32 5, label %14
i32 6, label %16
i32 7, label %18
]
4: ; preds = %2
%5 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i32 0)
br label %22
6: ; preds = %2
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i64 19, i64 1, i32* %0)
br label %22
8: ; preds = %2
%9 = tail call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i64 17, i64 1, i32* %0)
br label %22
10: ; preds = %2
%11 = tail call i64 @fwrite(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i64 12, i64 1, i32* %0)
br label %22
12: ; preds = %2
%13 = tail call i64 @fwrite(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i64 12, i64 1, i32* %0)
br label %22
14: ; preds = %2
%15 = tail call i64 @fwrite(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i64 9, i64 1, i32* %0)
br label %22
16: ; preds = %2
%17 = tail call i64 @fwrite(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i64 24, i64 1, i32* %0)
br label %22
18: ; preds = %2
%19 = tail call i64 @fwrite(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i64 26, i64 1, i32* %0)
br label %22
20: ; preds = %2
%21 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i32 %1)
br label %22
22: ; preds = %20, %18, %16, %14, %12, %10, %8, %6, %4
ret void
}