#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__ {
  TYPE_2__ *plane_fmt;
};
struct TYPE_5__ {
  void *sizeimage;
};
struct TYPE_8__ {
  TYPE_3__ pix_mp;
  TYPE_1__ pix;
};
struct v4l2_format {
  int type;
  TYPE_4__ fmt;
};
typedef void *__u32;
struct TYPE_6__ {
  void *sizeimage;
};

/* Variables and functions */
#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_sizeimage(struct v4l2_format *fmt, unsigned plane,
                            __u32 sizeimage) {
  switch (fmt->type) {
  case V4L2_BUF_TYPE_VIDEO_CAPTURE:
  case V4L2_BUF_TYPE_VIDEO_OUTPUT:
    fmt->fmt.pix.sizeimage = sizeimage;
    break;
  case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
  case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
    fmt->fmt.pix_mp.plane_fmt[plane].sizeimage = sizeimage;
    break;
  }
}


x86 assembly (clang, -O0):
<v4l_format_s_sizeimage>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x3,%eax
ja     115f <v4l_format_s_sizeimage+0x5f>
mov    -0x20(%rbp),%rax
lea    0xece(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x10(%rax)
jmp    115f <v4l_format_s_sizeimage+0x5f>
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0xc(%rbp),%ecx
mov    %rdx,(%rax,%rcx,8)
pop    %rbp
ret

x86 assembly (clang, -O2):
<v4l_format_s_sizeimage>:
mov    (%rdi),%eax
add    $0xffffff80,%eax
cmp    $0x3,%eax
ja     1130 <v4l_format_s_sizeimage+0x30>
lea    0xeef(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %esi,%eax
shl    $0x3,%rax
add    0x8(%rdi),%rax
mov    %rax,%rdi
jmp    112d <v4l_format_s_sizeimage+0x2d>
add    $0x10,%rdi
mov    %rdx,(%rdi)
ret

LLVM IR (-O0):
%struct.v4l2_format = type { i32, %struct.TYPE_8__ }
%struct.TYPE_8__ = type { %struct.TYPE_7__, %struct.TYPE_5__ }
%struct.TYPE_7__ = type { %struct.TYPE_6__* }
%struct.TYPE_6__ = type { i8* }
%struct.TYPE_5__ = type { i8* }
define void @v4l_format_s_sizeimage(%struct.v4l2_format* %0, i32 %1, i8* %2) {
%4 = alloca %struct.v4l2_format*
%5 = alloca i32
%6 = alloca i8*
store %struct.v4l2_format* %0, %struct.v4l2_format** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load %struct.v4l2_format*, %struct.v4l2_format** %4
%8 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %7, i32 0, i32 0
%9 = load i32, i32* %8
switch i32 %9, label %27 [
i32 131, label %10
i32 129, label %10
i32 130, label %16
i32 128, label %16
]
10: ; preds = %3, %3
%11 = load i8*, i8** %6
%12 = load %struct.v4l2_format*, %struct.v4l2_format** %4
%13 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %12, i32 0, i32 1
%14 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %13, i32 0, i32 1
%15 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %14, i32 0, i32 0
store i8* %11, i8** %15
br label %27
16: ; preds = %3, %3
%17 = load i8*, i8** %6
%18 = load %struct.v4l2_format*, %struct.v4l2_format** %4
%19 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %18, i32 0, i32 1
%20 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %19, i32 0, i32 0
%21 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %20, i32 0, i32 0
%22 = load %struct.TYPE_6__*, %struct.TYPE_6__** %21
%23 = load i32, i32* %5
%24 = zext i32 %23 to i64
%25 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %22, i64 %24
%26 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %25, i32 0, i32 0
store i8* %17, i8** %26
br label %27
27: ; preds = %3, %16, %10
ret void
}

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