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

/* Type definitions */
struct TYPE_9__ {
  void *samples_per_line;
};
struct TYPE_8__ {
  TYPE_2__ *plane_fmt;
};
struct TYPE_6__ {
  void *bytesperline;
};
struct TYPE_10__ {
  TYPE_4__ vbi;
  TYPE_3__ pix_mp;
  TYPE_1__ pix;
};
struct v4l2_format {
  int type;
  TYPE_5__ fmt;
};
typedef void *__u32;
struct TYPE_7__ {
  void *bytesperline;
};

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


x86 assembly (clang, -O0):
<v4l_format_s_bytesperline>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
sub    $0x80,%eax
je     1192 <v4l_format_s_bytesperline+0x92>
jmp    1128 <v4l_format_s_bytesperline+0x28>
mov    -0x18(%rbp),%eax
sub    $0x81,%eax
je     1177 <v4l_format_s_bytesperline+0x77>
jmp    113b <v4l_format_s_bytesperline+0x3b>
mov    -0x18(%rbp),%eax
sub    $0x82,%eax
je     1192 <v4l_format_s_bytesperline+0x92>
jmp    114e <v4l_format_s_bytesperline+0x4e>
mov    -0x18(%rbp),%eax
sub    $0x83,%eax
je     1177 <v4l_format_s_bytesperline+0x77>
jmp    1161 <v4l_format_s_bytesperline+0x61>
mov    -0x18(%rbp),%eax
add    $0xffffff7c,%eax
sub    $0x2,%eax
jb     11aa <v4l_format_s_bytesperline+0xaa>
jmp    11c5 <v4l_format_s_bytesperline+0xc5>
cmpl   $0x0,-0x14(%rbp)
jne    118d <v4l_format_s_bytesperline+0x8d>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x18(%rax)
jmp    11c5 <v4l_format_s_bytesperline+0xc5>
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
mov    -0x14(%rbp),%ecx
mov    %rdx,(%rax,%rcx,8)
jmp    11c5 <v4l_format_s_bytesperline+0xc5>
cmpl   $0x0,-0x14(%rbp)
jne    11c0 <v4l_format_s_bytesperline+0xc0>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x8(%rax)
jmp    11c5 <v4l_format_s_bytesperline+0xc5>
pop    %rbp
ret

x86 assembly (clang, -O2):
<v4l_format_s_bytesperline>:
mov    (%rdi),%eax
add    $0xffffff80,%eax
cmp    $0x5,%eax
ja     1122 <v4l_format_s_bytesperline+0x22>
mov    $0x5,%ecx
bt     %eax,%ecx
jb     1123 <v4l_format_s_bytesperline+0x23>
mov    $0xa,%ecx
bt     %eax,%ecx
jae    1134 <v4l_format_s_bytesperline+0x34>
test   %edx,%edx
je     1140 <v4l_format_s_bytesperline+0x40>
ret
mov    %edx,%eax
shl    $0x3,%rax
add    0x10(%rdi),%rax
mov    %rax,%rdi
mov    %rsi,(%rdi)
ret
test   %edx,%edx
jne    1122 <v4l_format_s_bytesperline+0x22>
add    $0x8,%rdi
mov    %rsi,(%rdi)
ret
add    $0x18,%rdi
mov    %rsi,(%rdi)
ret

LLVM IR (-O0):
%struct.v4l2_format = type { i32, %struct.TYPE_10__ }
%struct.TYPE_10__ = type { %struct.TYPE_9__, %struct.TYPE_8__, %struct.TYPE_6__ }
%struct.TYPE_9__ = type { i8* }
%struct.TYPE_8__ = type { %struct.TYPE_7__* }
%struct.TYPE_7__ = type { i8* }
%struct.TYPE_6__ = type { i8* }
define void @v4l_format_s_bytesperline(%struct.v4l2_format* %0, i8* %1, i32 %2) {
%4 = alloca %struct.v4l2_format*
%5 = alloca i8*
%6 = alloca i32
store %struct.v4l2_format* %0, %struct.v4l2_format** %4
store i8* %1, i8** %5
store i32 %2, i32* %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 %41 [
i32 131, label %10
i32 129, label %10
i32 130, label %20
i32 128, label %20
i32 133, label %31
i32 132, label %31
]
10: ; preds = %3, %3
%11 = load i32, i32* %6
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %19
13: ; preds = %10
%14 = load i8*, i8** %5
%15 = load %struct.v4l2_format*, %struct.v4l2_format** %4
%16 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %15, i32 0, i32 1
%17 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %16, i32 0, i32 2
%18 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %17, i32 0, i32 0
store i8* %14, i8** %18
br label %19
19: ; preds = %13, %10
br label %41
20: ; preds = %3, %3
%21 = load i8*, i8** %5
%22 = load %struct.v4l2_format*, %struct.v4l2_format** %4
%23 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %22, i32 0, i32 1
%24 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %23, i32 0, i32 1
%25 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %24, i32 0, i32 0
%26 = load %struct.TYPE_7__*, %struct.TYPE_7__** %25
%27 = load i32, i32* %6
%28 = zext i32 %27 to i64
%29 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %26, i64 %28
%30 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %29, i32 0, i32 0
store i8* %21, i8** %30
br label %41
31: ; preds = %3, %3
%32 = load i32, i32* %6
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %40
34: ; preds = %31
%35 = load i8*, i8** %5
%36 = load %struct.v4l2_format*, %struct.v4l2_format** %4
%37 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %36, i32 0, i32 1
%38 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %37, i32 0, i32 0
%39 = getelementptr inbounds %struct.TYPE_9__, %struct.TYPE_9__* %38, i32 0, i32 0
store i8* %35, i8** %39
br label %40
40: ; preds = %34, %31
br label %41
41: ; preds = %3, %40, %20, %19
ret void
}

LLVM IR (-O2):
%struct.v4l2_format = type { i32, %struct.TYPE_10__ }
%struct.TYPE_10__ = type { %struct.TYPE_9__, %struct.TYPE_8__, %struct.TYPE_6__ }
%struct.TYPE_9__ = type { i8* }
%struct.TYPE_8__ = type { %struct.TYPE_7__* }
%struct.TYPE_7__ = type { i8* }
%struct.TYPE_6__ = type { i8* }
define void @v4l_format_s_bytesperline(%struct.v4l2_format* nocapture %0, i8* %1, i32 %2) {
%4 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %0, i64 0, i32 0
%5 = load i32, i32* %4
switch i32 %5, label %21 [
i32 131, label %6
i32 129, label %6
i32 130, label %10
i32 128, label %10
i32 133, label %15
i32 132, label %15
]
6: ; preds = %3, %3
%7 = icmp eq i32 %2, 0
br i1 %7, label %8, label %21
8: ; preds = %6
%9 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %0, i64 0, i32 1, i32 2, i32 0
br label %19
10: ; preds = %3, %3
%11 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %0, i64 0, i32 1, i32 1, i32 0
%12 = load %struct.TYPE_7__*, %struct.TYPE_7__** %11
%13 = zext i32 %2 to i64
%14 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %12, i64 %13, i32 0
br label %19
15: ; preds = %3, %3
%16 = icmp eq i32 %2, 0
br i1 %16, label %17, label %21
17: ; preds = %15
%18 = getelementptr inbounds %struct.v4l2_format, %struct.v4l2_format* %0, i64 0, i32 1, i32 0, i32 0
br label %19
19: ; preds = %10, %8, %17
%20 = phi i8** [ %18, %17 ], [ %9, %8 ], [ %14, %10 ]
store i8* %1, i8** %20
br label %21
21: ; preds = %19, %15, %6, %3
ret void
}