#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 */
typedef struct TYPE_12__ TYPE_6__;
typedef struct TYPE_11__ TYPE_5__;
typedef struct TYPE_10__ TYPE_4__;
typedef struct TYPE_9__ TYPE_3__;
typedef struct TYPE_8__ TYPE_2__;
typedef struct TYPE_7__ TYPE_1__;

/* Type definitions */
struct TYPE_7__ {
  void *dataformat;
};
struct TYPE_11__ {
  void *sample_format;
};
struct TYPE_10__ {
  void *pixelformat;
};
struct TYPE_9__ {
  void *pixelformat;
};
struct TYPE_8__ {
  void *pixelformat;
};
struct TYPE_12__ {
  TYPE_1__ meta;
  TYPE_5__ vbi;
  TYPE_4__ sdr;
  TYPE_3__ pix_mp;
  TYPE_2__ pix;
};
struct v4l2_format {
  int type;
  TYPE_6__ fmt;
};
typedef void *__u32;

/* Variables and functions */
#define V4L2_BUF_TYPE_META_CAPTURE 137
#define V4L2_BUF_TYPE_META_OUTPUT 136
#define V4L2_BUF_TYPE_SDR_CAPTURE 135
#define V4L2_BUF_TYPE_SDR_OUTPUT 134
#define V4L2_BUF_TYPE_VBI_CAPTURE 133
#define V4L2_BUF_TYPE_VBI_OUTPUT 132
#define V4L2_BUF_TYPE_VIDEO_CAPTURE 131
#define V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE 130
#define V4L2_BUF_TYPE_VIDEO_OUTPUT 129
#define V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE 128
void v4l_format_s_pixelformat(struct v4l2_format *fmt, __u32 pixelformat) {
  switch (fmt->type) {
  case V4L2_BUF_TYPE_VIDEO_CAPTURE:
  case V4L2_BUF_TYPE_VIDEO_OUTPUT:
    fmt->fmt.pix.pixelformat = pixelformat;
    break;
  case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
  case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
    fmt->fmt.pix_mp.pixelformat = pixelformat;
    break;
  case V4L2_BUF_TYPE_SDR_CAPTURE:
  case V4L2_BUF_TYPE_SDR_OUTPUT:
    fmt->fmt.sdr.pixelformat = pixelformat;
    break;
  case V4L2_BUF_TYPE_VBI_CAPTURE:
  case V4L2_BUF_TYPE_VBI_OUTPUT:
    fmt->fmt.vbi.sample_format = pixelformat;
    break;
  case V4L2_BUF_TYPE_META_CAPTURE:
  case V4L2_BUF_TYPE_META_OUTPUT:
    fmt->fmt.meta.dataformat = pixelformat;
    break;
  }
}


x86 assembly (clang, -O0):
<v4l_format_s_pixelformat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x9,%eax
ja     1188 <v4l_format_s_pixelformat+0x88>
mov    -0x18(%rbp),%rax
lea    0xed1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x28(%rax)
jmp    1188 <v4l_format_s_pixelformat+0x88>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x20(%rax)
jmp    1188 <v4l_format_s_pixelformat+0x88>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x18(%rax)
jmp    1188 <v4l_format_s_pixelformat+0x88>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x10(%rax)
jmp    1188 <v4l_format_s_pixelformat+0x88>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<v4l_format_s_pixelformat>:
mov    (%rdi),%eax
add    $0xffffff80,%eax
cmp    $0x9,%eax
ja     1139 <v4l_format_s_pixelformat+0x39>
lea    0xeef(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
add    $0x20,%rdi
jmp    1136 <v4l_format_s_pixelformat+0x36>
add    $0x28,%rdi
jmp    1136 <v4l_format_s_pixelformat+0x36>
add    $0x10,%rdi
jmp    1136 <v4l_format_s_pixelformat+0x36>
add    $0x18,%rdi
jmp    1136 <v4l_format_s_pixelformat+0x36>
add    $0x8,%rdi
mov    %rsi,(%rdi)
ret

LLVM IR (-O0):
%struct.v4l2_format = type { i32, %struct.TYPE_12__ }
%struct.TYPE_12__ = type { %struct.TYPE_7__, %struct.TYPE_11__, %struct.TYPE_10__, %struct.TYPE_9__, %struct.TYPE_8__ }
%struct.TYPE_7__ = type { i8* }
%struct.TYPE_11__ = type { i8* }
%struct.TYPE_10__ = type { i8* }
%struct.TYPE_9__ = type { i8* }
%struct.TYPE_8__ = type { i8* }
define void @v4l_format_s_pixelformat(%struct.v4l2_format* %0, i8* %1) {
%3 = alloca %struct.v4l2_format*
%4 = alloca i8*
store %struct.v4l2_format* %0, %struct.v4l2_format** %3
store i8* %1, i8** %4
%5 = load %struct.v4l2_format*, %struct.v4l2_format** %3
%6 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %5, i32 0, i32 0
%7 = load i32, i32* %6
switch i32 %7, label %38 [
i32 131, label %8
i32 129, label %8
i32 130, label %14
i32 128, label %14
i32 135, label %20
i32 134, label %20
i32 133, label %26
i32 132, label %26
i32 137, label %32
i32 136, label %32
]
8: ; preds = %2, %2
%9 = load i8*, i8** %4
%10 = load %struct.v4l2_format*, %struct.v4l2_format** %3
%11 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %10, i32 0, i32 1
%12 = getelementptr inbounds %struct.TYPE_12__, %struct.TYPE_12__* %11, i32 0, i32 4
%13 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %12, i32 0, i32 0
store i8* %9, i8** %13
br label %38
14: ; preds = %2, %2
%15 = load i8*, i8** %4
%16 = load %struct.v4l2_format*, %struct.v4l2_format** %3
%17 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %16, i32 0, i32 1
%18 = getelementptr inbounds %struct.TYPE_12__, %struct.TYPE_12__* %17, i32 0, i32 3
%19 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %18, i32 0, i32 0
store i8* %15, i8** %19
br label %38
20: ; preds = %2, %2
%21 = load i8*, i8** %4
%22 = load %struct.v4l2_format*, %struct.v4l2_format** %3
%23 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %22, i32 0, i32 1
%24 = getelementptr inbounds %struct.TYPE_12__, %struct.TYPE_12__* %23, i32 0, i32 2
%25 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %24, i32 0, i32 0
store i8* %21, i8** %25
br label %38
26: ; preds = %2, %2
%27 = load i8*, i8** %4
%28 = load %struct.v4l2_format*, %struct.v4l2_format** %3
%29 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %28, i32 0, i32 1
%30 = getelementptr inbounds %struct.TYPE_12__, %struct.TYPE_12__* %29, i32 0, i32 1
%31 = getelementptr inbounds %struct.TYPE_11__, %struct.TYPE_11__* %30, i32 0, i32 0
store i8* %27, i8** %31
br label %38
32: ; preds = %2, %2
%33 = load i8*, i8** %4
%34 = load %struct.v4l2_format*, %struct.v4l2_format** %3
%35 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %34, i32 0, i32 1
%36 = getelementptr inbounds %struct.TYPE_12__, %struct.TYPE_12__* %35, i32 0, i32 0
%37 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %36, i32 0, i32 0
store i8* %33, i8** %37
br label %38
38: ; preds = %2, %32, %26, %20, %14, %8
ret void
}

LLVM IR (-O2):
%struct.v4l2_format = type { i32, %struct.TYPE_12__ }
%struct.TYPE_12__ = type { %struct.TYPE_7__, %struct.TYPE_11__, %struct.TYPE_10__, %struct.TYPE_9__, %struct.TYPE_8__ }
%struct.TYPE_7__ = type { i8* }
%struct.TYPE_11__ = type { i8* }
%struct.TYPE_10__ = type { i8* }
%struct.TYPE_9__ = type { i8* }
%struct.TYPE_8__ = type { i8* }
define void @v4l_format_s_pixelformat(%struct.v4l2_format* nocapture %0, i8* %1) {
%3 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %0, i64 0, i32 0
%4 = load i32, i32* %3
switch i32 %4, label %17 [
i32 131, label %5
i32 129, label %5
i32 130, label %7
i32 128, label %7
i32 135, label %9
i32 134, label %9
i32 133, label %11
i32 132, label %11
i32 137, label %13
i32 136, label %13
]
5: ; preds = %2, %2
%6 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %0, i64 0, i32 1, i32 4, i32 0
br label %15
7: ; preds = %2, %2
%8 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %0, i64 0, i32 1, i32 3, i32 0
br label %15
9: ; preds = %2, %2
%10 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %0, i64 0, i32 1, i32 2, i32 0
br label %15
11: ; preds = %2, %2
%12 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %0, i64 0, i32 1, i32 1, i32 0
br label %15
13: ; preds = %2, %2
%14 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %0, i64 0, i32 1, i32 0, i32 0
br label %15
15: ; preds = %5, %7, %9, %11, %13
%16 = phi i8** [ %14, %13 ], [ %12, %11 ], [ %10, %9 ], [ %8, %7 ], [ %6, %5 ]
store i8* %1, i8** %16
br label %17
17: ; preds = %15, %2
ret void
}