#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 */
typedef unsigned short com;

/* Variables and functions */
int /*<<< orphan*/ outb(unsigned short, int);
void serial_configure(unsigned short com, unsigned short divisor) {
  outb((com) + 1, 0x00);
  outb((com + 3), 0x80);
  outb((com), divisor & 0x00FF);
  outb((com) + 1, (divisor >> 8) & 0x00FF);
  outb((com + 3), 0x03);
  outb((com + 2), 0xC7);
  outb((com + 4), 0x0B);
}


x86 assembly (clang, -O0):
<serial_configure>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
movzwl -0x2(%rbp),%eax
add    $0x1,%eax
xor    %esi,%esi
movzwl %ax,%edi
call   1030 <outb@plt>
movzwl -0x2(%rbp),%eax
add    $0x3,%eax
mov    $0x80,%esi
movzwl %ax,%edi
call   1030 <outb@plt>
mov    -0x2(%rbp),%ax
movzwl -0x4(%rbp),%esi
and    $0xff,%esi
movzwl %ax,%edi
call   1030 <outb@plt>
movzwl -0x2(%rbp),%eax
add    $0x1,%eax
movzwl -0x4(%rbp),%esi
sar    $0x8,%esi
and    $0xff,%esi
movzwl %ax,%edi
call   1030 <outb@plt>
movzwl -0x2(%rbp),%eax
add    $0x3,%eax
mov    $0x3,%esi
movzwl %ax,%edi
call   1030 <outb@plt>
movzwl -0x2(%rbp),%eax
add    $0x2,%eax
mov    $0xc7,%esi
movzwl %ax,%edi
call   1030 <outb@plt>
movzwl -0x2(%rbp),%eax
add    $0x4,%eax
mov    $0xb,%esi
movzwl %ax,%edi
call   1030 <outb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serial_configure>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
lea    0x1(%rbx),%eax
movzwl %ax,%r14d
mov    %r14d,%edi
xor    %esi,%esi
call   1030 <outb@plt>
lea    0x3(%rbx),%eax
movzwl %ax,%r15d
mov    %r15d,%edi
mov    $0x80,%esi
call   1030 <outb@plt>
movzbl %bpl,%esi
mov    %ebx,%edi
call   1030 <outb@plt>
shr    $0x8,%ebp
mov    %r14d,%edi
mov    %ebp,%esi
call   1030 <outb@plt>
mov    %r15d,%edi
mov    $0x3,%esi
call   1030 <outb@plt>
lea    0x2(%rbx),%eax
movzwl %ax,%edi
mov    $0xc7,%esi
call   1030 <outb@plt>
add    $0x4,%ebx
movzwl %bx,%edi
mov    $0xb,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @serial_configure(i16 zeroext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %3
%6 = zext i16 %5 to i32
%7 = add nsw i32 %6, 1
%8 = trunc i32 %7 to i16
%9 = call i32 @outb(i16 zeroext %8, i32 0)
%10 = load i16, i16* %3
%11 = zext i16 %10 to i32
%12 = add nsw i32 %11, 3
%13 = trunc i32 %12 to i16
%14 = call i32 @outb(i16 zeroext %13, i32 128)
%15 = load i16, i16* %3
%16 = load i16, i16* %4
%17 = zext i16 %16 to i32
%18 = and i32 %17, 255
%19 = call i32 @outb(i16 zeroext %15, i32 %18)
%20 = load i16, i16* %3
%21 = zext i16 %20 to i32
%22 = add nsw i32 %21, 1
%23 = trunc i32 %22 to i16
%24 = load i16, i16* %4
%25 = zext i16 %24 to i32
%26 = ashr i32 %25, 8
%27 = and i32 %26, 255
%28 = call i32 @outb(i16 zeroext %23, i32 %27)
%29 = load i16, i16* %3
%30 = zext i16 %29 to i32
%31 = add nsw i32 %30, 3
%32 = trunc i32 %31 to i16
%33 = call i32 @outb(i16 zeroext %32, i32 3)
%34 = load i16, i16* %3
%35 = zext i16 %34 to i32
%36 = add nsw i32 %35, 2
%37 = trunc i32 %36 to i16
%38 = call i32 @outb(i16 zeroext %37, i32 199)
%39 = load i16, i16* %3
%40 = zext i16 %39 to i32
%41 = add nsw i32 %40, 4
%42 = trunc i32 %41 to i16
%43 = call i32 @outb(i16 zeroext %42, i32 11)
ret void
}

LLVM IR (-O2):
define void @serial_configure(i16 zeroext %0, i16 zeroext %1) {
%3 = add i16 %0, 1
%4 = tail call i32 @outb(i16 zeroext %3, i32 0)
%5 = add i16 %0, 3
%6 = tail call i32 @outb(i16 zeroext %5, i32 128)
%7 = zext i16 %1 to i32
%8 = and i32 %7, 255
%9 = tail call i32 @outb(i16 zeroext %0, i32 %8)
%10 = lshr i32 %7, 8
%11 = tail call i32 @outb(i16 zeroext %3, i32 %10)
%12 = tail call i32 @outb(i16 zeroext %5, i32 3)
%13 = add i16 %0, 2
%14 = tail call i32 @outb(i16 zeroext %13, i32 199)
%15 = add i16 %0, 4
%16 = tail call i32 @outb(i16 zeroext %15, i32 11)
ret void
}