#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 */
struct tl880_dev {
  int dummy;
};

/* Variables and functions */
scalar_t__ CHECK_NULL(struct tl880_dev *);
int /*<<< orphan*/ tl880_set_video_source(struct tl880_dev *, int, int);
void tl880_set_ntsc_input(struct tl880_dev *tl880dev, int input) {
  if (CHECK_NULL(tl880dev)) {
    return;
  }
  switch (input) {
  default:
  case 0:
    tl880_set_video_source(tl880dev, 2, 4);
    break;
  case 1:
    tl880_set_video_source(tl880dev, 3, 4);
    break;
  case 2:
    tl880_set_video_source(tl880dev, 1, 5);
    break;
  }
}


x86 assembly (clang, -O0):
<tl880_set_ntsc_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <CHECK_NULL@plt>
cmp    $0x0,%rax
je     1147 <tl880_set_ntsc_input+0x27>
jmp    11c4 <tl880_set_ntsc_input+0xa4>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     1181 <tl880_set_ntsc_input+0x61>
jmp    115a <tl880_set_ntsc_input+0x3a>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     1199 <tl880_set_ntsc_input+0x79>
jmp    116b <tl880_set_ntsc_input+0x4b>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     11b1 <tl880_set_ntsc_input+0x91>
jmp    117c <tl880_set_ntsc_input+0x5c>
jmp    1181 <tl880_set_ntsc_input+0x61>
mov    -0x8(%rbp),%rdi
mov    $0x2,%esi
mov    $0x4,%edx
call   1030 <tl880_set_video_source@plt>
jmp    11c4 <tl880_set_ntsc_input+0xa4>
mov    -0x8(%rbp),%rdi
mov    $0x3,%esi
mov    $0x4,%edx
call   1030 <tl880_set_video_source@plt>
jmp    11c4 <tl880_set_ntsc_input+0xa4>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
mov    $0x5,%edx
call   1030 <tl880_set_video_source@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tl880_set_ntsc_input>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1040 <CHECK_NULL@plt>
test   %rax,%rax
je     1139 <tl880_set_ntsc_input+0x19>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    %rbx,%rdi
cmp    $0x1,%ebp
je     1152 <tl880_set_ntsc_input+0x32>
cmp    $0x2,%ebp
jne    1159 <tl880_set_ntsc_input+0x39>
mov    $0x1,%esi
mov    $0x5,%edx
jmp    1163 <tl880_set_ntsc_input+0x43>
mov    $0x3,%esi
jmp    115e <tl880_set_ntsc_input+0x3e>
mov    $0x2,%esi
mov    $0x4,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <tl880_set_video_source@plt>

LLVM IR (-O0):
%struct.tl880_dev = type { i32 }
define void @tl880_set_ntsc_input(%struct.tl880_dev* %0, i32 %1) {
%3 = alloca %struct.tl880_dev*
%4 = alloca i32
store %struct.tl880_dev* %0, %struct.tl880_dev** %3
store i32 %1, i32* %4
%5 = load %struct.tl880_dev*, %struct.tl880_dev** %3
%6 = call i64 @CHECK_NULL(%struct.tl880_dev* %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %2
br label %21
9: ; preds = %2
%10 = load i32, i32* %4
switch i32 %10, label %11 [
i32 0, label %12
i32 1, label %15
i32 2, label %18
]
11: ; preds = %9
br label %12
12: ; preds = %9, %11
%13 = load %struct.tl880_dev*, %struct.tl880_dev** %3
%14 = call i32 @tl880_set_video_source(%struct.tl880_dev* %13, i32 2, i32 4)
br label %21
15: ; preds = %9
%16 = load %struct.tl880_dev*, %struct.tl880_dev** %3
%17 = call i32 @tl880_set_video_source(%struct.tl880_dev* %16, i32 3, i32 4)
br label %21
18: ; preds = %9
%19 = load %struct.tl880_dev*, %struct.tl880_dev** %3
%20 = call i32 @tl880_set_video_source(%struct.tl880_dev* %19, i32 1, i32 5)
br label %21
21: ; preds = %8, %18, %15, %12
ret void
}

LLVM IR (-O2):
%struct.tl880_dev = type { i32 }
define void @tl880_set_ntsc_input(%struct.tl880_dev* %0, i32 %1) {
%3 = tail call i64 @CHECK_NULL(%struct.tl880_dev* %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %12
5: ; preds = %2
switch i32 %1, label %6 [
i32 2, label %10
i32 1, label %8
]
6: ; preds = %5
%7 = tail call i32 @tl880_set_video_source(%struct.tl880_dev* %0, i32 2, i32 4)
br label %12
8: ; preds = %5
%9 = tail call i32 @tl880_set_video_source(%struct.tl880_dev* %0, i32 3, i32 4)
br label %12
10: ; preds = %5
%11 = tail call i32 @tl880_set_video_source(%struct.tl880_dev* %0, i32 1, i32 5)
br label %12
12: ; preds = %2, %10, %8, %6
ret void
}