#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 */

/* Type definitions */

/* Variables and functions */
int scsi_request(char *, int /*<<< orphan*/, int /*<<< orphan*/, int, int, int,
                 int, int, int /*<<< orphan*/, int /*<<< orphan*/, int,
                 int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
                 int /*<<< orphan*/, int, int, unsigned char, unsigned char,
                 unsigned char, int /*<<< orphan*/, unsigned char,
                 unsigned char, unsigned char);
int mode_select(int bsize, int density) {
  return scsi_request(
      "mode_select", 0, 0, 6, 12, 0x02, 0x15, 0x10, 0, 0, 12, 0, 0, 0, 0, 8,
      density, ((unsigned char)(((0)) >> 16)), ((unsigned char)(((0)) >> 8)),
      ((unsigned char)(0)), 0, ((unsigned char)(((bsize)) >> 16)),
      ((unsigned char)(((bsize)) >> 8)), ((unsigned char)(bsize)));
}


x86 assembly (clang, -O0):
<mode_select>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x98,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    -0x10(%rbp),%ebx
mov    -0xc(%rbp),%eax
sar    $0x10,%eax
mov    %al,%r11b
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
mov    %al,%r10b
mov    -0xc(%rbp),%eax
lea    0xebf(%rip),%rdi
xor    %edx,%edx
mov    $0x6,%ecx
mov    $0xc,%r8d
mov    $0x2,%r9d
mov    %edx,%esi
movl   $0x15,(%rsp)
movl   $0x10,0x8(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0x18(%rsp)
movl   $0xc,0x20(%rsp)
movl   $0x0,0x28(%rsp)
movl   $0x0,0x30(%rsp)
movl   $0x0,0x38(%rsp)
movl   $0x0,0x40(%rsp)
movl   $0x8,0x48(%rsp)
mov    %ebx,0x50(%rsp)
movl   $0x0,0x58(%rsp)
movl   $0x0,0x60(%rsp)
movl   $0x0,0x68(%rsp)
movl   $0x0,0x70(%rsp)
movzbl %r11b,%r11d
mov    %r11d,0x78(%rsp)
movzbl %r10b,%r10d
mov    %r10d,0x80(%rsp)
movzbl %al,%eax
mov    %eax,0x88(%rsp)
call   1030 <scsi_request@plt>
add    $0x98,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<mode_select>:
push   %rbx
mov    %esi,%r10d
mov    %edi,%ecx
mov    %edi,%edx
shr    $0x10,%edx
movzbl %cl,%eax
movzbl %ch,%ebx
movzbl %dl,%r11d
lea    0xed4(%rip),%rdi
xor    %esi,%esi
xor    %edx,%edx
mov    $0x6,%ecx
mov    $0xc,%r8d
mov    $0x2,%r9d
push   %rax
push   %rbx
push   %r11
push   $0x0
push   $0x0
push   $0x0
push   $0x0
push   %r10
push   $0x8
push   $0x0
push   $0x0
push   $0x0
push   $0x0
push   $0xc
push   $0x0
push   $0x0
push   $0x10
push   $0x15
call   1030 <scsi_request@plt>
add    $0x90,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"mode_select\00"
define i32 @mode_select(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = ashr i32 %6, 16
%8 = trunc i32 %7 to i8
%9 = load i32, i32* %3
%10 = ashr i32 %9, 8
%11 = trunc i32 %10 to i8
%12 = load i32, i32* %3
%13 = trunc i32 %12 to i8
%14 = call i32 @scsi_request(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 0, i32 0, i32 6, i32 12, i32 2, i32 21, i32 16, i32 0, i32 0, i32 12, i32 0, i32 0, i32 0, i32 0, i32 8, i32 %5, i8 zeroext 0, i8 zeroext 0, i8 zeroext 0, i32 0, i8 zeroext %8, i8 zeroext %11, i8 zeroext %13)
ret i32 %14
}

LLVM IR (-O2):
@.str = [12 x i8] c"mode_select\00"
define i32 @mode_select(i32 %0, i32 %1) {
%3 = lshr i32 %0, 16
%4 = trunc i32 %3 to i8
%5 = lshr i32 %0, 8
%6 = trunc i32 %5 to i8
%7 = trunc i32 %0 to i8
%8 = tail call i32 @scsi_request(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 0, i32 0, i32 6, i32 12, i32 2, i32 21, i32 16, i32 0, i32 0, i32 12, i32 0, i32 0, i32 0, i32 0, i32 8, i32 %1, i8 zeroext 0, i8 zeroext 0, i8 zeroext 0, i32 0, i8 zeroext %4, i8 zeroext %6, i8 zeroext %7)
ret i32 %8
}