#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_8__ TYPE_4__;
typedef struct TYPE_7__ TYPE_3__;
typedef struct TYPE_6__ TYPE_2__;
typedef struct TYPE_5__ TYPE_1__;

/* Type definitions */
struct TYPE_7__ {
  unsigned int field;
};
struct TYPE_6__ {
  unsigned int field;
};
struct TYPE_5__ {
  unsigned int field;
};
struct TYPE_8__ {
  TYPE_3__ win;
  TYPE_2__ pix_mp;
  TYPE_1__ pix;
};
struct v4l2_format {
  int type;
  TYPE_4__ fmt;
};

/* Variables and functions */
#define V4L2_BUF_TYPE_VIDEO_CAPTURE 133
#define V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE 132
#define V4L2_BUF_TYPE_VIDEO_OUTPUT 131
#define V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE 130
#define V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY 129
#define V4L2_BUF_TYPE_VIDEO_OVERLAY 128
void v4l_format_s_field(struct v4l2_format *fmt, unsigned field) {
  switch (fmt->type) {
  case V4L2_BUF_TYPE_VIDEO_CAPTURE:
  case V4L2_BUF_TYPE_VIDEO_OUTPUT:
    fmt->fmt.pix.field = field;
    break;
  case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
  case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
    fmt->fmt.pix_mp.field = field;
    break;
  case V4L2_BUF_TYPE_VIDEO_OVERLAY:
  case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
    fmt->fmt.win.field = field;
    break;
  }
}


x86 assembly (clang, -O0):
<v4l_format_s_field>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
add    $0xffffff80,%eax
sub    $0x2,%eax
jb     118f <v4l_format_s_field+0x8f>
jmp    1125 <v4l_format_s_field+0x25>
mov    -0x10(%rbp),%eax
sub    $0x82,%eax
je     1180 <v4l_format_s_field+0x80>
jmp    1138 <v4l_format_s_field+0x38>
mov    -0x10(%rbp),%eax
sub    $0x83,%eax
je     1171 <v4l_format_s_field+0x71>
jmp    114b <v4l_format_s_field+0x4b>
mov    -0x10(%rbp),%eax
sub    $0x84,%eax
je     1180 <v4l_format_s_field+0x80>
jmp    115e <v4l_format_s_field+0x5e>
mov    -0x10(%rbp),%eax
sub    $0x85,%eax
jne    1199 <v4l_format_s_field+0x99>
jmp    1171 <v4l_format_s_field+0x71>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0xc(%rax)
jmp    1199 <v4l_format_s_field+0x99>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
jmp    1199 <v4l_format_s_field+0x99>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<v4l_format_s_field>:
mov    (%rdi),%eax
add    $0xffffff80,%eax
cmp    $0x5,%eax
ja     1130 <v4l_format_s_field+0x30>
mov    $0x3,%ecx
bt     %eax,%ecx
jb     1124 <v4l_format_s_field+0x24>
mov    $0x14,%ecx
bt     %eax,%ecx
jae    112a <v4l_format_s_field+0x2a>
add    $0x8,%rdi
jmp    112e <v4l_format_s_field+0x2e>
add    $0x4,%rdi
jmp    112e <v4l_format_s_field+0x2e>
add    $0xc,%rdi
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.v4l2_format = type { i32, %struct.TYPE_8__ }
%struct.TYPE_8__ = type { %struct.TYPE_7__, %struct.TYPE_6__, %struct.TYPE_5__ }
%struct.TYPE_7__ = type { i32 }
%struct.TYPE_6__ = type { i32 }
%struct.TYPE_5__ = type { i32 }
define void @v4l_format_s_field(%struct.v4l2_format* %0, i32 %1) {
%3 = alloca %struct.v4l2_format*
%4 = alloca i32
store %struct.v4l2_format* %0, %struct.v4l2_format** %3
store i32 %1, i32* %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 %26 [
i32 133, label %8
i32 131, label %8
i32 132, label %14
i32 130, label %14
i32 128, label %20
i32 129, label %20
]
8: ; preds = %2, %2
%9 = load i32, i32* %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_8__, %struct.TYPE_8__* %11, i32 0, i32 2
%13 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %12, i32 0, i32 0
store i32 %9, i32* %13
br label %26
14: ; preds = %2, %2
%15 = load i32, i32* %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_8__, %struct.TYPE_8__* %17, i32 0, i32 1
%19 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %18, i32 0, i32 0
store i32 %15, i32* %19
br label %26
20: ; preds = %2, %2
%21 = load i32, i32* %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_8__, %struct.TYPE_8__* %23, i32 0, i32 0
%25 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %24, i32 0, i32 0
store i32 %21, i32* %25
br label %26
26: ; preds = %2, %20, %14, %8
ret void
}

LLVM IR (-O2):
%struct.v4l2_format = type { i32, %struct.TYPE_8__ }
%struct.TYPE_8__ = type { %struct.TYPE_7__, %struct.TYPE_6__, %struct.TYPE_5__ }
%struct.TYPE_7__ = type { i32 }
%struct.TYPE_6__ = type { i32 }
%struct.TYPE_5__ = type { i32 }
define void @v4l_format_s_field(%struct.v4l2_format* nocapture %0, i32 %1) {
%3 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %0, i64 0, i32 0
%4 = load i32, i32* %3
switch i32 %4, label %13 [
i32 133, label %5
i32 131, label %5
i32 132, label %7
i32 130, label %7
i32 128, label %9
i32 129, label %9
]
5: ; preds = %2, %2
%6 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %0, i64 0, i32 1, i32 2, i32 0
br label %11
7: ; preds = %2, %2
%8 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %0, i64 0, i32 1, i32 1, i32 0
br label %11
9: ; preds = %2, %2
%10 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %0, i64 0, i32 1, i32 0, i32 0
br label %11
11: ; preds = %5, %7, %9
%12 = phi i32* [ %10, %9 ], [ %8, %7 ], [ %6, %5 ]
store i32 %1, i32* %12
br label %13
13: ; preds = %11, %2
ret void
}