#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 v4l2_sliced_vbi_data {
  int id;
  int line;
  int /*<<< orphan*/ field;
};

/* Variables and functions */
int /*<<< orphan*/ decode_cc(struct v4l2_sliced_vbi_data *);
int /*<<< orphan*/ decode_vps(struct v4l2_sliced_vbi_data *);
int /*<<< orphan*/ decode_wss(struct v4l2_sliced_vbi_data *);
int /*<<< orphan*/ printf(char *);
void process(struct v4l2_sliced_vbi_data *s) {
  if (s->id == 0)
    return;
  switch (s->id) {
  case (0x0001):
    printf("teletext\n");
    break;
  case (0x0400):
    if (s->line != 16 || s->field)
      break;
    decode_vps(s);
    break;
  case (0x4000):
    if (s->line != 23 || s->field)
      break;
    decode_wss(s);
    break;
  case (0x1000):
    if (s->line != 21)
      break;
    decode_cc(s);
    break;
  default:
    printf("unknown\n");
    break;
  }
}


x86 assembly (clang, -O0):
<process>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
jne    115e <process+0x1e>
jmp    124a <process+0x10a>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1,%eax
je     11ae <process+0x6e>
jmp    1175 <process+0x35>
mov    -0xc(%rbp),%eax
sub    $0x400,%eax
je     11bf <process+0x7f>
jmp    1188 <process+0x48>
mov    -0xc(%rbp),%eax
sub    $0x1000,%eax
je     121d <process+0xdd>
jmp    119b <process+0x5b>
mov    -0xc(%rbp),%eax
sub    $0x4000,%eax
je     11ee <process+0xae>
jmp    123e <process+0xfe>
lea    0xe4b(%rip),%rdi
call   1050 <printf@plt>
jmp    124a <process+0x10a>
mov    -0x8(%rbp),%rax
cmpl   $0x10,0x4(%rax)
jne    11db <process+0x9b>
mov    -0x8(%rbp),%rax
cmpl   $0x0,0x8(%rax)
je     11e0 <process+0xa0>
jmp    124a <process+0x10a>
mov    -0x8(%rbp),%rdi
call   1030 <decode_vps@plt>
jmp    124a <process+0x10a>
mov    -0x8(%rbp),%rax
cmpl   $0x17,0x4(%rax)
jne    120a <process+0xca>
mov    -0x8(%rbp),%rax
cmpl   $0x0,0x8(%rax)
je     120f <process+0xcf>
jmp    124a <process+0x10a>
mov    -0x8(%rbp),%rdi
call   1040 <decode_wss@plt>
jmp    124a <process+0x10a>
mov    -0x8(%rbp),%rax
cmpl   $0x15,0x4(%rax)
je     1230 <process+0xf0>
jmp    124a <process+0x10a>
mov    -0x8(%rbp),%rdi
call   1060 <decode_cc@plt>
jmp    124a <process+0x10a>
lea    0xdc5(%rip),%rdi
call   1050 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process>:
mov    (%rdi),%eax
cmp    $0x3ff,%eax
jle    116f <process+0x2f>
cmp    $0x400,%eax
je     1184 <process+0x44>
cmp    $0x1000,%eax
je     1195 <process+0x55>
cmp    $0x4000,%eax
jne    11a1 <process+0x61>
cmpl   $0x17,0x4(%rdi)
jne    11a0 <process+0x60>
cmpl   $0x0,0x8(%rdi)
jne    11a0 <process+0x60>
jmp    1040 <decode_wss@plt>
test   %eax,%eax
je     11a0 <process+0x60>
cmp    $0x1,%eax
jne    11a1 <process+0x61>
lea    0xe81(%rip),%rdi
jmp    1050 <puts@plt>
cmpl   $0x10,0x4(%rdi)
jne    11a0 <process+0x60>
cmpl   $0x0,0x8(%rdi)
jne    11a0 <process+0x60>
jmp    1030 <decode_vps@plt>
cmpl   $0x15,0x4(%rdi)
jne    11a0 <process+0x60>
jmp    1060 <decode_cc@plt>
ret
lea    0xe61(%rip),%rdi
jmp    1050 <puts@plt>

LLVM IR (-O0):
%struct.v4l2_sliced_vbi_data = type { i32, i32, i32 }
@.str = [10 x i8] c"teletext\0A\00"
@.str.1 = [9 x i8] c"unknown\0A\00"
define void @process(%struct.v4l2_sliced_vbi_data* %0) {
%2 = alloca %struct.v4l2_sliced_vbi_data*
store %struct.v4l2_sliced_vbi_data* %0, %struct.v4l2_sliced_vbi_data** %2
%3 = load %struct.v4l2_sliced_vbi_data*, %struct.v4l2_sliced_vbi_data** %2
%4 = getelementptr inbounds %struct.v4l2_sliced_vbi_data, %struct.v4l2_sliced_vbi_data* %3, i32 0, i32 0
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
br label %53
8: ; preds = %1
%9 = load %struct.v4l2_sliced_vbi_data*, %struct.v4l2_sliced_vbi_data** %2
%10 = getelementptr inbounds %struct.v4l2_sliced_vbi_data, %struct.v4l2_sliced_vbi_data* %9, i32 0, i32 0
%11 = load i32, i32* %10
switch i32 %11, label %51 [
i32 1, label %12
i32 1024, label %14
i32 16384, label %28
i32 4096, label %42
]
12: ; preds = %8
%13 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %53
14: ; preds = %8
%15 = load %struct.v4l2_sliced_vbi_data*, %struct.v4l2_sliced_vbi_data** %2
%16 = getelementptr inbounds %struct.v4l2_sliced_vbi_data, %struct.v4l2_sliced_vbi_data* %15, i32 0, i32 1
%17 = load i32, i32* %16
%18 = icmp ne i32 %17, 16
br i1 %18, label %24, label %19
19: ; preds = %14
%20 = load %struct.v4l2_sliced_vbi_data*, %struct.v4l2_sliced_vbi_data** %2
%21 = getelementptr inbounds %struct.v4l2_sliced_vbi_data, %struct.v4l2_sliced_vbi_data* %20, i32 0, i32 2
%22 = load i32, i32* %21
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %19, %14
br label %53
25: ; preds = %19
%26 = load %struct.v4l2_sliced_vbi_data*, %struct.v4l2_sliced_vbi_data** %2
%27 = call i32 @decode_vps(%struct.v4l2_sliced_vbi_data* %26)
br label %53
28: ; preds = %8
%29 = load %struct.v4l2_sliced_vbi_data*, %struct.v4l2_sliced_vbi_data** %2
%30 = getelementptr inbounds %struct.v4l2_sliced_vbi_data, %struct.v4l2_sliced_vbi_data* %29, i32 0, i32 1
%31 = load i32, i32* %30
%32 = icmp ne i32 %31, 23
br i1 %32, label %38, label %33
33: ; preds = %28
%34 = load %struct.v4l2_sliced_vbi_data*, %struct.v4l2_sliced_vbi_data** %2
%35 = getelementptr inbounds %struct.v4l2_sliced_vbi_data, %struct.v4l2_sliced_vbi_data* %34, i32 0, i32 2
%36 = load i32, i32* %35
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %33, %28
br label %53
39: ; preds = %33
%40 = load %struct.v4l2_sliced_vbi_data*, %struct.v4l2_sliced_vbi_data** %2
%41 = call i32 @decode_wss(%struct.v4l2_sliced_vbi_data* %40)
br label %53
42: ; preds = %8
%43 = load %struct.v4l2_sliced_vbi_data*, %struct.v4l2_sliced_vbi_data** %2
%44 = getelementptr inbounds %struct.v4l2_sliced_vbi_data, %struct.v4l2_sliced_vbi_data* %43, i32 0, i32 1
%45 = load i32, i32* %44
%46 = icmp ne i32 %45, 21
br i1 %46, label %47, label %48
47: ; preds = %42
br label %53
48: ; preds = %42
%49 = load %struct.v4l2_sliced_vbi_data*, %struct.v4l2_sliced_vbi_data** %2
%50 = call i32 @decode_cc(%struct.v4l2_sliced_vbi_data* %49)
br label %53
51: ; preds = %8
%52 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %53
53: ; preds = %7, %51, %48, %47, %39, %38, %25, %24, %12
ret void
}

LLVM IR (-O2):
%struct.v4l2_sliced_vbi_data = type { i32, i32, i32 }
@str = [9 x i8] c"teletext\00"
@str.2 = [8 x i8] c"unknown\00"
define void @process(%struct.v4l2_sliced_vbi_data* %0) {
%2 = getelementptr inbounds %struct.v4l2_sliced_vbi_data, %struct.v4l2_sliced_vbi_data* %0, i64 0, i32 0
%3 = load i32, i32* %2
switch i32 %3, label %32 [
i32 0, label %34
i32 1, label %4
i32 1024, label %6
i32 16384, label %16
i32 4096, label %26
]
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
br label %34
6: ; preds = %1
%7 = getelementptr inbounds %struct.v4l2_sliced_vbi_data, %struct.v4l2_sliced_vbi_data* %0, i64 0, i32 1
%8 = load i32, i32* %7
%9 = icmp eq i32 %8, 16
br i1 %9, label %10, label %34
10: ; preds = %6
%11 = getelementptr inbounds %struct.v4l2_sliced_vbi_data, %struct.v4l2_sliced_vbi_data* %0, i64 0, i32 2
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %34
14: ; preds = %10
%15 = tail call i32 @decode_vps(%struct.v4l2_sliced_vbi_data* %0)
br label %34
16: ; preds = %1
%17 = getelementptr inbounds %struct.v4l2_sliced_vbi_data, %struct.v4l2_sliced_vbi_data* %0, i64 0, i32 1
%18 = load i32, i32* %17
%19 = icmp eq i32 %18, 23
br i1 %19, label %20, label %34
20: ; preds = %16
%21 = getelementptr inbounds %struct.v4l2_sliced_vbi_data, %struct.v4l2_sliced_vbi_data* %0, i64 0, i32 2
%22 = load i32, i32* %21
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %34
24: ; preds = %20
%25 = tail call i32 @decode_wss(%struct.v4l2_sliced_vbi_data* %0)
br label %34
26: ; preds = %1
%27 = getelementptr inbounds %struct.v4l2_sliced_vbi_data, %struct.v4l2_sliced_vbi_data* %0, i64 0, i32 1
%28 = load i32, i32* %27
%29 = icmp eq i32 %28, 21
br i1 %29, label %30, label %34
30: ; preds = %26
%31 = tail call i32 @decode_cc(%struct.v4l2_sliced_vbi_data* %0)
br label %34
32: ; preds = %1
%33 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.2, i64 0, i64 0))
br label %34
34: ; preds = %1, %26, %16, %20, %6, %10, %32, %30, %24, %14, %4
ret void
}