#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_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int x0;
  int y0;
  int x1;
  int y1;
  int color;
  scalar_t__ data;
  int /*<<< orphan*/ cmd;
};
typedef TYPE_1__ osd_cmd_t;

/* Variables and functions */
int /*<<< orphan*/ OSD_Open;
int /*<<< orphan*/ OSD_SEND_CMD;
int ioctl(int, int /*<<< orphan*/, TYPE_1__ *);
int OSDOpen(int dev, int x0, int y0, int x1, int y1, int BitPerPixel, int mix) {
  osd_cmd_t dc;
  dc.cmd = OSD_Open;
  dc.x0 = x0;
  dc.y0 = y0;
  dc.x1 = x1;
  dc.y1 = y1;
  dc.data = 0;
  dc.color = BitPerPixel & 0xf;
  return ioctl(dev, OSD_SEND_CMD, &dc);
}


x86 assembly (clang, -O0):
<OSDOpen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x34(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x18(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0x30(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e82(%rip),%rax
mov    (%rax),%esi
lea    -0x40(%rbp),%rdx
call   1030 <ioctl@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OSDOpen>:
sub    $0x28,%rsp
mov    0x2ebd(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x20(%rsp)
mov    %esi,(%rsp)
mov    %edx,0x4(%rsp)
mov    %ecx,0x8(%rsp)
mov    %r8d,0xc(%rsp)
movq   $0x0,0x18(%rsp)
and    $0xf,%r9d
mov    %r9d,0x10(%rsp)
mov    0x2ea6(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
call   1030 <ioctl@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i32, i32, i32, i32, i64, i32 }
@OSD_Open = global i32 0
@OSD_SEND_CMD = global i32 0
define i32 @OSDOpen(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca %struct.TYPE_3__
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%16 = load i32, i32* @OSD_Open
%17 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %15, i32 0, i32 6
store i32 %16, i32* %17
%18 = load i32, i32* %9
%19 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %15, i32 0, i32 0
store i32 %18, i32* %19
%20 = load i32, i32* %10
%21 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %15, i32 0, i32 1
store i32 %20, i32* %21
%22 = load i32, i32* %11
%23 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %15, i32 0, i32 2
store i32 %22, i32* %23
%24 = load i32, i32* %12
%25 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %15, i32 0, i32 3
store i32 %24, i32* %25
%26 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %15, i32 0, i32 5
store i64 0, i64* %26
%27 = load i32, i32* %13
%28 = and i32 %27, 15
%29 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %15, i32 0, i32 4
store i32 %28, i32* %29
%30 = load i32, i32* %8
%31 = load i32, i32* @OSD_SEND_CMD
%32 = call i32 @ioctl(i32 %30, i32 %31, %struct.TYPE_3__* %15)
ret i32 %32
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i32, i32, i32, i32, i64, i32 }
@OSD_Open = global i32 0
@OSD_SEND_CMD = global i32 0
define i32 @OSDOpen(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca %struct.TYPE_3__
%9 = bitcast %struct.TYPE_3__* %8 to i8*
%10 = load i32, i32* @OSD_Open
%11 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i64 0, i32 6
store i32 %10, i32* %11
%12 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i64 0, i32 0
store i32 %1, i32* %12
%13 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i64 0, i32 1
store i32 %2, i32* %13
%14 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i64 0, i32 2
store i32 %3, i32* %14
%15 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i64 0, i32 3
store i32 %4, i32* %15
%16 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i64 0, i32 5
store i64 0, i64* %16
%17 = and i32 %5, 15
%18 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i64 0, i32 4
store i32 %17, i32* %18
%19 = load i32, i32* @OSD_SEND_CMD
%20 = call i32 @ioctl(i32 %0, i32 %19, %struct.TYPE_3__* %8)
ret i32 %20
}