#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_C(FILE *fp, uint8_t c) {
  fprintf(fp, "TYPE:");
  switch (c) {
  case 0:
    fprintf(fp, "C,%d:No ADS-B emitter category information\n", c);
    break;
  case 1:
    fprintf(fp, "Emergency vehicle\n");
    break;
  case 2:
    fprintf(fp, "Service vehicle\n");
    break;
  case 3:
    fprintf(fp, "Fixed ground or tethered obstruction\n");
    break;
  case 4:
  case 5:
  case 6:
  case 7:
    fprintf(fp, "C,%d:Reserved\n", c);
    break;
  default:
    fprintf(fp, "C,%d:Invalid category\n", c);
  }
}


x86 assembly (clang, -O0):
<pr_cat_C>:
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     11cf <pr_cat_C+0xbf>
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    11e4 <pr_cat_C+0xd4>
mov    -0x8(%rbp),%rdi
lea    0xed7(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11e4 <pr_cat_C+0xd4>
mov    -0x8(%rbp),%rdi
lea    0xed3(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11e4 <pr_cat_C+0xd4>
mov    -0x8(%rbp),%rdi
lea    0xecd(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11e4 <pr_cat_C+0xd4>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xed9(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11e4 <pr_cat_C+0xd4>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xece(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_cat_C>:
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     1161 <pr_cat_C+0x41>
mov    %ebp,%eax
lea    0xeb1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf3d(%rip),%rsi
jmp    1168 <pr_cat_C+0x48>
lea    0xf43(%rip),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fprintf@plt>
lea    0xea5(%rip),%rsi
mov    %rbx,%rdi
xor    %edx,%edx
jmp    116d <pr_cat_C+0x4d>
lea    0xec3(%rip),%rdi
mov    $0x12,%esi
jmp    11b0 <pr_cat_C+0x90>
lea    0xec8(%rip),%rdi
mov    $0x10,%esi
jmp    11b0 <pr_cat_C+0x90>
lea    0xecb(%rip),%rdi
mov    $0x25,%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"C,%d:No ADS-B emitter category information\0A\00"
@.str.2 = [19 x i8] c"Emergency vehicle\0A\00"
@.str.3 = [17 x i8] c"Service vehicle\0A\00"
@.str.4 = [38 x i8] c"Fixed ground or tethered obstruction\0A\00"
@.str.5 = [15 x i8] c"C,%d:Reserved\0A\00"
@.str.6 = [23 x i8] c"C,%d:Invalid category\0A\00"
define void @pr_cat_C(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 %25 [
i32 0, label %8
i32 1, label %12
i32 2, label %15
i32 3, label %18
i32 4, label %21
i32 5, label %21
i32 6, label %21
i32 7, label %21
]
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 %29
12: ; preds = %2
%13 = load i32*, i32** %3
%14 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %29
15: ; preds = %2
%16 = load i32*, i32** %3
%17 = call i32 (i32*, i8*, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %29
18: ; preds = %2
%19 = load i32*, i32** %3
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %19, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
br label %29
21: ; preds = %2, %2, %2, %2
%22 = load i32*, i32** %3
%23 = load i32, i32* %4
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %22, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 %23)
br label %29
25: ; preds = %2
%26 = load i32*, i32** %3
%27 = load i32, i32* %4
%28 = call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %25, %21, %18, %15, %12, %8
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"TYPE:\00"
@.str.1 = [44 x i8] c"C,%d:No ADS-B emitter category information\0A\00"
@.str.2 = [19 x i8] c"Emergency vehicle\0A\00"
@.str.3 = [17 x i8] c"Service vehicle\0A\00"
@.str.4 = [38 x i8] c"Fixed ground or tethered obstruction\0A\00"
@.str.5 = [15 x i8] c"C,%d:Reserved\0A\00"
@.str.6 = [23 x i8] c"C,%d:Invalid category\0A\00"
define void @pr_cat_C(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 %14 [
i32 0, label %4
i32 1, label %6
i32 2, label %8
i32 3, label %10
i32 4, label %12
i32 5, label %12
i32 6, label %12
i32 7, label %12
]
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 %16
6: ; preds = %2
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i64 18, i64 1, i32* %0)
br label %16
8: ; preds = %2
%9 = tail call i64 @fwrite(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i64 16, i64 1, i32* %0)
br label %16
10: ; preds = %2
%11 = tail call i64 @fwrite(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i64 37, i64 1, i32* %0)
br label %16
12: ; preds = %2, %2, %2, %2
%13 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 %1)
br label %16
14: ; preds = %2
%15 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %1)
br label %16
16: ; preds = %14, %12, %10, %8, %6, %4
ret void
}