#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(unsigned short, scalar_t__);
void write_word_mode0(short ioaddr, unsigned short value) {
  outb(value & 0x0f, ioaddr + 0);
  value >>= 4;
  outb((value & 0x0f) | 0x10, ioaddr + 0);
  value >>= 4;
  outb(value & 0x0f, ioaddr + 0);
  value >>= 4;
  outb((value & 0x0f) | 0x10, ioaddr + 0);
}


x86 assembly (clang, -O0):
<write_word_mode0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
movzwl -0x4(%rbp),%eax
and    $0xf,%eax
movswl -0x2(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rsi
movzwl %ax,%edi
call   1030 <outb@plt>
movzwl -0x4(%rbp),%eax
sar    $0x4,%eax
mov    %ax,-0x4(%rbp)
movzwl -0x4(%rbp),%eax
and    $0xf,%eax
or     $0x10,%eax
movswl -0x2(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rsi
movzwl %ax,%edi
call   1030 <outb@plt>
movzwl -0x4(%rbp),%eax
sar    $0x4,%eax
mov    %ax,-0x4(%rbp)
movzwl -0x4(%rbp),%eax
and    $0xf,%eax
movswl -0x2(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rsi
movzwl %ax,%edi
call   1030 <outb@plt>
movzwl -0x4(%rbp),%eax
sar    $0x4,%eax
mov    %ax,-0x4(%rbp)
movzwl -0x4(%rbp),%eax
and    $0xf,%eax
or     $0x10,%eax
movswl -0x2(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rsi
movzwl %ax,%edi
call   1030 <outb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_word_mode0>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
movslq %edi,%r14
mov    %esi,%edi
and    $0xf,%edi
mov    %r14,%rsi
call   1030 <outb@plt>
mov    %ebx,%edi
shr    $0x4,%edi
and    $0xf,%edi
or     $0x10,%edi
mov    %r14,%rsi
call   1030 <outb@plt>
mov    %ebx,%edi
shr    $0x8,%edi
and    $0xf,%edi
mov    %r14,%rsi
call   1030 <outb@plt>
shr    $0xc,%ebx
or     $0x10,%ebx
mov    %ebx,%edi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @write_word_mode0(i16 signext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %4
%6 = zext i16 %5 to i32
%7 = and i32 %6, 15
%8 = trunc i32 %7 to i16
%9 = load i16, i16* %3
%10 = sext i16 %9 to i32
%11 = add nsw i32 %10, 0
%12 = sext i32 %11 to i64
%13 = call i32 @outb(i16 zeroext %8, i64 %12)
%14 = load i16, i16* %4
%15 = zext i16 %14 to i32
%16 = ashr i32 %15, 4
%17 = trunc i32 %16 to i16
store i16 %17, i16* %4
%18 = load i16, i16* %4
%19 = zext i16 %18 to i32
%20 = and i32 %19, 15
%21 = or i32 %20, 16
%22 = trunc i32 %21 to i16
%23 = load i16, i16* %3
%24 = sext i16 %23 to i32
%25 = add nsw i32 %24, 0
%26 = sext i32 %25 to i64
%27 = call i32 @outb(i16 zeroext %22, i64 %26)
%28 = load i16, i16* %4
%29 = zext i16 %28 to i32
%30 = ashr i32 %29, 4
%31 = trunc i32 %30 to i16
store i16 %31, i16* %4
%32 = load i16, i16* %4
%33 = zext i16 %32 to i32
%34 = and i32 %33, 15
%35 = trunc i32 %34 to i16
%36 = load i16, i16* %3
%37 = sext i16 %36 to i32
%38 = add nsw i32 %37, 0
%39 = sext i32 %38 to i64
%40 = call i32 @outb(i16 zeroext %35, i64 %39)
%41 = load i16, i16* %4
%42 = zext i16 %41 to i32
%43 = ashr i32 %42, 4
%44 = trunc i32 %43 to i16
store i16 %44, i16* %4
%45 = load i16, i16* %4
%46 = zext i16 %45 to i32
%47 = and i32 %46, 15
%48 = or i32 %47, 16
%49 = trunc i32 %48 to i16
%50 = load i16, i16* %3
%51 = sext i16 %50 to i32
%52 = add nsw i32 %51, 0
%53 = sext i32 %52 to i64
%54 = call i32 @outb(i16 zeroext %49, i64 %53)
ret void
}

LLVM IR (-O2):
define void @write_word_mode0(i16 signext %0, i16 zeroext %1) {
%3 = and i16 %1, 15
%4 = sext i16 %0 to i64
%5 = tail call i32 @outb(i16 zeroext %3, i64 %4)
%6 = lshr i16 %1, 4
%7 = and i16 %6, 15
%8 = or i16 %7, 16
%9 = tail call i32 @outb(i16 zeroext %8, i64 %4)
%10 = lshr i16 %1, 8
%11 = and i16 %10, 15
%12 = tail call i32 @outb(i16 zeroext %11, i64 %4)
%13 = lshr i16 %1, 12
%14 = or i16 %13, 16
%15 = tail call i32 @outb(i16 zeroext %14, i64 %4)
ret void
}