#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 /*<<< orphan*/ outb(int, int);
int bl_common(int drive, int numblock, int count) {
  outb(0x1F1, 0x00);
  outb(0x1F2, count);
  outb(0x1F3, (unsigned char)numblock);
  outb(0x1F4, (unsigned char)(numblock >> 8));
  outb(0x1F5, (unsigned char)(numblock >> 16));
  outb(0x1F6, 0xE0 | (drive << 4) | ((numblock >> 24) & 0x0F));
  return 0;
}


x86 assembly (clang, -O0):
<bl_common>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    $0x1f1,%edi
xor    %esi,%esi
call   1030 <outb@plt>
mov    -0xc(%rbp),%esi
mov    $0x1f2,%edi
call   1030 <outb@plt>
mov    -0x8(%rbp),%eax
movzbl %al,%esi
mov    $0x1f3,%edi
call   1030 <outb@plt>
mov    -0x8(%rbp),%eax
sar    $0x8,%eax
movzbl %al,%esi
mov    $0x1f4,%edi
call   1030 <outb@plt>
mov    -0x8(%rbp),%eax
sar    $0x10,%eax
movzbl %al,%esi
mov    $0x1f5,%edi
call   1030 <outb@plt>
mov    -0x4(%rbp),%esi
shl    $0x4,%esi
or     $0xe0,%esi
mov    -0x8(%rbp),%eax
sar    $0x18,%eax
and    $0xf,%eax
or     %eax,%esi
mov    $0x1f6,%edi
call   1030 <outb@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bl_common>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x1f1,%edi
xor    %esi,%esi
call   1030 <outb@plt>
mov    $0x1f2,%edi
mov    %r14d,%esi
call   1030 <outb@plt>
movzbl %bl,%esi
mov    $0x1f3,%edi
call   1030 <outb@plt>
movzbl %bh,%esi
mov    $0x1f4,%edi
call   1030 <outb@plt>
mov    %ebx,%eax
shr    $0x10,%eax
movzbl %al,%esi
mov    $0x1f5,%edi
call   1030 <outb@plt>
shl    $0x4,%ebp
shr    $0x18,%ebx
and    $0xf,%ebx
or     %ebp,%ebx
or     $0xe0,%ebx
mov    $0x1f6,%edi
mov    %ebx,%esi
call   1030 <outb@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @bl_common(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = call i32 @outb(i32 497, i32 0)
%8 = load i32, i32* %6
%9 = call i32 @outb(i32 498, i32 %8)
%10 = load i32, i32* %5
%11 = trunc i32 %10 to i8
%12 = zext i8 %11 to i32
%13 = call i32 @outb(i32 499, i32 %12)
%14 = load i32, i32* %5
%15 = ashr i32 %14, 8
%16 = trunc i32 %15 to i8
%17 = zext i8 %16 to i32
%18 = call i32 @outb(i32 500, i32 %17)
%19 = load i32, i32* %5
%20 = ashr i32 %19, 16
%21 = trunc i32 %20 to i8
%22 = zext i8 %21 to i32
%23 = call i32 @outb(i32 501, i32 %22)
%24 = load i32, i32* %4
%25 = shl i32 %24, 4
%26 = or i32 224, %25
%27 = load i32, i32* %5
%28 = ashr i32 %27, 24
%29 = and i32 %28, 15
%30 = or i32 %26, %29
%31 = call i32 @outb(i32 502, i32 %30)
ret i32 0
}

LLVM IR (-O2):
define i32 @bl_common(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @outb(i32 497, i32 0)
%5 = tail call i32 @outb(i32 498, i32 %2)
%6 = and i32 %1, 255
%7 = tail call i32 @outb(i32 499, i32 %6)
%8 = lshr i32 %1, 8
%9 = and i32 %8, 255
%10 = tail call i32 @outb(i32 500, i32 %9)
%11 = lshr i32 %1, 16
%12 = and i32 %11, 255
%13 = tail call i32 @outb(i32 501, i32 %12)
%14 = shl i32 %0, 4
%15 = lshr i32 %1, 24
%16 = and i32 %15, 15
%17 = or i32 %16, %14
%18 = or i32 %17, 224
%19 = tail call i32 @outb(i32 502, i32 %18)
ret i32 0
}