#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 /*<<< orphan*/ fe_type_t;
typedef enum fe_delivery_system {
  ____Placeholder_fe_delivery_system
} fe_delivery_system;

/* Variables and functions */
int /*<<< orphan*/ FE_ATSC;
int /*<<< orphan*/ FE_OFDM;
int /*<<< orphan*/ FE_QAM;
int /*<<< orphan*/ FE_QPSK;
#define SYS_ATSC 137
#define SYS_DSS 136
#define SYS_DVBC_ANNEX_AC 135
#define SYS_DVBC_ANNEX_B 134
#define SYS_DVBH 133
#define SYS_DVBS 132
#define SYS_DVBS2 131
#define SYS_DVBT 130
#define SYS_DVBT2 129
#define SYS_ISDBT 128
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int map_delivery_mode(fe_type_t *type, enum fe_delivery_system delsys) {
  switch (delsys) {
  case SYS_DSS:
  case SYS_DVBS:
  case SYS_DVBS2:
    *type = FE_QPSK;
    break;
  case SYS_DVBT:
  case SYS_DVBT2:
  case SYS_DVBH:
  case SYS_ISDBT:
    *type = FE_OFDM;
    break;
  case SYS_DVBC_ANNEX_AC:
    *type = FE_QAM;
    break;
  case SYS_ATSC:
  case SYS_DVBC_ANNEX_B:
    *type = FE_ATSC;
    break;
  default:
    fprintf(stderr,
            "Delivery system unsupported, please report to linux-media ML\n");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<map_delivery_mode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x9,%eax
ja     1198 <map_delivery_mode+0x88>
mov    -0x20(%rbp),%rax
lea    0xec1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e79(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    11b9 <map_delivery_mode+0xa9>
mov    0x2e85(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    11b9 <map_delivery_mode+0xa9>
mov    0x2e49(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    11b9 <map_delivery_mode+0xa9>
mov    0x2e45(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    11b9 <map_delivery_mode+0xa9>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
lea    0xe80(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c0 <map_delivery_mode+0xb0>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<map_delivery_mode>:
push   %rax
add    $0xffffff80,%esi
cmp    $0x9,%esi
ja     1153 <map_delivery_mode+0x43>
lea    0xee0(%rip),%rax
movslq (%rax,%rsi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
mov    0x2eb8(%rip),%rax
jmp    114b <map_delivery_mode+0x3b>
mov    0x2e8f(%rip),%rax
jmp    114b <map_delivery_mode+0x3b>
mov    0x2e8e(%rip),%rax
jmp    114b <map_delivery_mode+0x3b>
mov    0x2e75(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rdi)
xor    %eax,%eax
pop    %rcx
ret
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
lea    0xec5(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@FE_QPSK = global i32 0
@FE_OFDM = global i32 0
@FE_QAM = global i32 0
@FE_ATSC = global i32 0
@stderr = global i32 0
@.str = [62 x i8] c"Delivery system unsupported, please report to linux-media ML\0A\00"
define i32 @map_delivery_mode(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
switch i32 %6, label %19 [
i32 136, label %7
i32 132, label %7
i32 131, label %7
i32 130, label %10
i32 129, label %10
i32 133, label %10
i32 128, label %10
i32 135, label %13
i32 137, label %16
i32 134, label %16
]
7: ; preds = %2, %2, %2
%8 = load i32, i32* @FE_QPSK
%9 = load i32*, i32** %4
store i32 %8, i32* %9
br label %22
10: ; preds = %2, %2, %2, %2
%11 = load i32, i32* @FE_OFDM
%12 = load i32*, i32** %4
store i32 %11, i32* %12
br label %22
13: ; preds = %2
%14 = load i32, i32* @FE_QAM
%15 = load i32*, i32** %4
store i32 %14, i32* %15
br label %22
16: ; preds = %2, %2
%17 = load i32, i32* @FE_ATSC
%18 = load i32*, i32** %4
store i32 %17, i32* %18
br label %22
19: ; preds = %2
%20 = load i32, i32* @stderr
%21 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %23
22: ; preds = %16, %13, %10, %7
store i32 0, i32* %3
br label %23
23: ; preds = %22, %19
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@FE_QPSK = global i32 0
@FE_OFDM = global i32 0
@FE_QAM = global i32 0
@FE_ATSC = global i32 0
@stderr = global i32 0
@.str = [62 x i8] c"Delivery system unsupported, please report to linux-media ML\0A\00"
define i32 @map_delivery_mode(i32* nocapture writeonly %0, i32 %1) {
switch i32 %1, label %11 [
i32 136, label %3
i32 132, label %3
i32 131, label %3
i32 130, label %5
i32 129, label %5
i32 133, label %5
i32 128, label %5
i32 135, label %7
i32 137, label %9
i32 134, label %9
]
3: ; preds = %2, %2, %2
%4 = load i32, i32* @FE_QPSK
store i32 %4, i32* %0
br label %14
5: ; preds = %2, %2, %2, %2
%6 = load i32, i32* @FE_OFDM
store i32 %6, i32* %0
br label %14
7: ; preds = %2
%8 = load i32, i32* @FE_QAM
store i32 %8, i32* %0
br label %14
9: ; preds = %2, %2
%10 = load i32, i32* @FE_ATSC
store i32 %10, i32* %0
br label %14
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %3, %5, %7, %9, %11
%15 = phi i32 [ -1, %11 ], [ 0, %9 ], [ 0, %7 ], [ 0, %5 ], [ 0, %3 ]
ret i32 %15
}