#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_D(FILE *fp, uint8_t c) {
  fprintf(fp, "TYPE:");
  switch (c) {
  case 0:
    fprintf(fp, "D,%d:No ADS-B emitter category information\n", c);
    break;
  case 1:
  case 2:
  case 3:
  case 4:
  case 5:
  case 6:
  case 7:
    fprintf(fp, "D,%d:Reserved", c);
    break;
  default:
    fprintf(fp, "D,%d:Invalid category", c);
  }
}


x86 assembly (clang, -O0):
<pr_cat_D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed6(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     1158 <pr_cat_D+0x48>
jmp    1144 <pr_cat_D+0x34>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
sub    $0x7,%eax
jb     1172 <pr_cat_D+0x62>
jmp    118c <pr_cat_D+0x7c>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xea0(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11a1 <pr_cat_D+0x91>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xeb2(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11a1 <pr_cat_D+0x91>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xea6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_cat_D>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
lea    0xed0(%rip),%rdi
mov    $0x5,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1040 <fwrite@plt>
lea    -0x1(%rbx),%eax
cmp    $0x7,%eax
jae    1164 <pr_cat_D+0x44>
lea    0xee1(%rip),%rsi
mov    %r14,%rdi
mov    %ebx,%edx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fprintf@plt>
test   %ebx,%ebx
jne    1176 <pr_cat_D+0x56>
lea    0xe97(%rip),%rsi
mov    %r14,%rdi
xor    %edx,%edx
jmp    1156 <pr_cat_D+0x36>
lea    0xec3(%rip),%rsi
jmp    1151 <pr_cat_D+0x31>

LLVM IR (-O0):
@.str = [6 x i8] c"TYPE:\00"
@.str.1 = [44 x i8] c"D,%d:No ADS-B emitter category information\0A\00"
@.str.2 = [14 x i8] c"D,%d:Reserved\00"
@.str.3 = [22 x i8] c"D,%d:Invalid category\00"
define void @pr_cat_D(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 %16 [
i32 0, label %8
i32 1, label %12
i32 2, label %12
i32 3, label %12
i32 4, label %12
i32 5, label %12
i32 6, label %12
i32 7, label %12
]
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 %20
12: ; preds = %2, %2, %2, %2, %2, %2, %2
%13 = load i32*, i32** %3
%14 = load i32, i32* %4
%15 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %14)
br label %20
16: ; preds = %2
%17 = load i32*, i32** %3
%18 = load i32, i32* %4
%19 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %16, %12, %8
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"TYPE:\00"
@.str.1 = [44 x i8] c"D,%d:No ADS-B emitter category information\0A\00"
@.str.2 = [14 x i8] c"D,%d:Reserved\00"
@.str.3 = [22 x i8] c"D,%d:Invalid category\00"
define void @pr_cat_D(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 %8 [
i32 0, label %4
i32 1, label %6
i32 2, label %6
i32 3, label %6
i32 4, label %6
i32 5, label %6
i32 6, label %6
i32 7, label %6
]
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 %10
6: ; preds = %2, %2, %2, %2, %2, %2, %2
%7 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %1)
br label %10
8: ; preds = %2
%9 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %1)
br label %10
10: ; preds = %8, %6, %4
ret void
}