#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*/ v4l2_std_id;

/* Variables and functions */
int /*<<< orphan*/ V4L2_STD_NTSC_M;
int /*<<< orphan*/ V4L2_STD_NTSC_M_JP;
int /*<<< orphan*/ V4L2_STD_PAL;
int /*<<< orphan*/ V4L2_STD_PAL_60;
int /*<<< orphan*/ V4L2_STD_PAL_M;
int /*<<< orphan*/ V4L2_STD_PAL_N;
int /*<<< orphan*/ V4L2_STD_PAL_Nc;
int /*<<< orphan*/ V4L2_STD_SECAM;
v4l2_std_id videoinput_get_v4l2_norm(int norm) {
  if (norm == 0) {
    return V4L2_STD_NTSC_M;
  } else if (norm == 1) {
    return V4L2_STD_PAL;
  } else if (norm == 2) {
    return V4L2_STD_SECAM;
  } else if (norm == 3) {
    return V4L2_STD_PAL_Nc;
  } else if (norm == 4) {
    return V4L2_STD_PAL_M;
  } else if (norm == 5) {
    return V4L2_STD_PAL_N;
  } else if (norm == 6) {
    return V4L2_STD_NTSC_M_JP;
  } else if (norm == 7) {
    return V4L2_STD_PAL_60;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<videoinput_get_v4l2_norm>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1122 <videoinput_get_v4l2_norm+0x22>
mov    0x2e98(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11e6 <videoinput_get_v4l2_norm+0xe6>
cmpl   $0x1,-0x8(%rbp)
jne    113d <videoinput_get_v4l2_norm+0x3d>
mov    0x2ebd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11e6 <videoinput_get_v4l2_norm+0xe6>
cmpl   $0x2,-0x8(%rbp)
jne    1158 <videoinput_get_v4l2_norm+0x58>
mov    0x2e72(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11e6 <videoinput_get_v4l2_norm+0xe6>
cmpl   $0x3,-0x8(%rbp)
jne    1173 <videoinput_get_v4l2_norm+0x73>
mov    0x2e4f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11e6 <videoinput_get_v4l2_norm+0xe6>
cmpl   $0x4,-0x8(%rbp)
jne    118e <videoinput_get_v4l2_norm+0x8e>
mov    0x2e4c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11e6 <videoinput_get_v4l2_norm+0xe6>
cmpl   $0x5,-0x8(%rbp)
jne    11a9 <videoinput_get_v4l2_norm+0xa9>
mov    0x2e09(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11e6 <videoinput_get_v4l2_norm+0xe6>
cmpl   $0x6,-0x8(%rbp)
jne    11c4 <videoinput_get_v4l2_norm+0xc4>
mov    0x2e3e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11e6 <videoinput_get_v4l2_norm+0xe6>
cmpl   $0x7,-0x8(%rbp)
jne    11df <videoinput_get_v4l2_norm+0xdf>
mov    0x2e0b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11e6 <videoinput_get_v4l2_norm+0xe6>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<videoinput_get_v4l2_norm>:
cmp    $0x7,%edi
ja     1121 <videoinput_get_v4l2_norm+0x21>
mov    %edi,%eax
lea    0xef2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e92(%rip),%rax
mov    (%rax),%eax
ret
xor    %eax,%eax
ret
mov    0x2ec5(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2e8b(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2e79(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2e87(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2e55(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2e9b(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2e79(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@V4L2_STD_NTSC_M = global i32 0
@V4L2_STD_PAL = global i32 0
@V4L2_STD_SECAM = global i32 0
@V4L2_STD_PAL_Nc = global i32 0
@V4L2_STD_PAL_M = global i32 0
@V4L2_STD_PAL_N = global i32 0
@V4L2_STD_NTSC_M_JP = global i32 0
@V4L2_STD_PAL_60 = global i32 0
define i32 @videoinput_get_v4l2_norm(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load i32, i32* @V4L2_STD_NTSC_M
store i32 %7, i32* %2
br label %44
8: ; preds = %1
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = load i32, i32* @V4L2_STD_PAL
store i32 %12, i32* %2
br label %44
13: ; preds = %8
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, 2
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = load i32, i32* @V4L2_STD_SECAM
store i32 %17, i32* %2
br label %44
18: ; preds = %13
%19 = load i32, i32* %3
%20 = icmp eq i32 %19, 3
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = load i32, i32* @V4L2_STD_PAL_Nc
store i32 %22, i32* %2
br label %44
23: ; preds = %18
%24 = load i32, i32* %3
%25 = icmp eq i32 %24, 4
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = load i32, i32* @V4L2_STD_PAL_M
store i32 %27, i32* %2
br label %44
28: ; preds = %23
%29 = load i32, i32* %3
%30 = icmp eq i32 %29, 5
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = load i32, i32* @V4L2_STD_PAL_N
store i32 %32, i32* %2
br label %44
33: ; preds = %28
%34 = load i32, i32* %3
%35 = icmp eq i32 %34, 6
br i1 %35, label %36, label %38
36: ; preds = %33
%37 = load i32, i32* @V4L2_STD_NTSC_M_JP
store i32 %37, i32* %2
br label %44
38: ; preds = %33
%39 = load i32, i32* %3
%40 = icmp eq i32 %39, 7
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = load i32, i32* @V4L2_STD_PAL_60
store i32 %42, i32* %2
br label %44
43: ; preds = %38
store i32 0, i32* %2
br label %44
44: ; preds = %43, %41, %36, %31, %26, %21, %16, %11, %6
%45 = load i32, i32* %2
ret i32 %45
}

LLVM IR (-O2):
@V4L2_STD_NTSC_M = global i32 0
@V4L2_STD_PAL = global i32 0
@V4L2_STD_SECAM = global i32 0
@V4L2_STD_PAL_Nc = global i32 0
@V4L2_STD_PAL_M = global i32 0
@V4L2_STD_PAL_N = global i32 0
@V4L2_STD_NTSC_M_JP = global i32 0
@V4L2_STD_PAL_60 = global i32 0
define i32 @videoinput_get_v4l2_norm(i32 %0) {
switch i32 %0, label %18 [
i32 0, label %2
i32 1, label %4
i32 2, label %6
i32 3, label %8
i32 4, label %10
i32 5, label %12
i32 6, label %14
i32 7, label %16
]
2: ; preds = %1
%3 = load i32, i32* @V4L2_STD_NTSC_M
br label %18
4: ; preds = %1
%5 = load i32, i32* @V4L2_STD_PAL
br label %18
6: ; preds = %1
%7 = load i32, i32* @V4L2_STD_SECAM
br label %18
8: ; preds = %1
%9 = load i32, i32* @V4L2_STD_PAL_Nc
br label %18
10: ; preds = %1
%11 = load i32, i32* @V4L2_STD_PAL_M
br label %18
12: ; preds = %1
%13 = load i32, i32* @V4L2_STD_PAL_N
br label %18
14: ; preds = %1
%15 = load i32, i32* @V4L2_STD_NTSC_M_JP
br label %18
16: ; preds = %1
%17 = load i32, i32* @V4L2_STD_PAL_60
br label %18
18: ; preds = %1, %16, %14, %12, %10, %8, %6, %4, %2
%19 = phi i32 [ %3, %2 ], [ %5, %4 ], [ %7, %6 ], [ %9, %8 ], [ %11, %10 ], [ %13, %12 ], [ %15, %14 ], [ %17, %16 ], [ 0, %1 ]
ret i32 %19
}