#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, int);
void serial_configure_baud_rate(unsigned short com, unsigned short divisor) {
  outb((com + 3), 0x80);
  outb((com), (divisor >> 8) && 0x00FF);
  outb((com), divisor && 0x00FF);
}


x86 assembly (clang, -O0):
<serial_configure_baud_rate>:
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    $0x3,%eax
mov    $0x80,%esi
movzwl %ax,%edi
call   1030 <outb@plt>
mov    -0x2(%rbp),%ax
mov    %ax,-0x8(%rbp)
movzwl -0x4(%rbp),%ecx
sar    $0x8,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x5(%rbp)
je     1161 <serial_configure_baud_rate+0x51>
mov    $0x1,%al
mov    %al,-0x5(%rbp)
jmp    1161 <serial_configure_baud_rate+0x51>
mov    -0x8(%rbp),%ax
mov    -0x5(%rbp),%cl
and    $0x1,%cl
movzbl %cl,%esi
movzwl %ax,%edi
call   1030 <outb@plt>
mov    -0x2(%rbp),%ax
mov    %ax,-0xc(%rbp)
movzwl -0x4(%rbp),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     119a <serial_configure_baud_rate+0x8a>
mov    $0x1,%al
mov    %al,-0x9(%rbp)
jmp    119a <serial_configure_baud_rate+0x8a>
mov    -0xc(%rbp),%ax
mov    -0x9(%rbp),%cl
and    $0x1,%cl
movzbl %cl,%esi
movzwl %ax,%edi
call   1030 <outb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serial_configure_baud_rate>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
lea    0x3(%rbx),%eax
movzwl %ax,%edi
mov    $0x80,%esi
call   1030 <outb@plt>
xor    %esi,%esi
cmp    $0x100,%ebp
setae  %sil
mov    %ebx,%edi
call   1030 <outb@plt>
xor    %esi,%esi
test   %ebp,%ebp
setne  %sil
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @serial_configure_baud_rate(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, 3
%8 = trunc i32 %7 to i16
%9 = call i32 @outb(i16 zeroext %8, i32 128)
%10 = load i16, i16* %3
%11 = load i16, i16* %4
%12 = zext i16 %11 to i32
%13 = ashr i32 %12, 8
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %2
br label %16
16: ; preds = %15, %2
%17 = phi i1 [ false, %2 ], [ true, %15 ]
%18 = zext i1 %17 to i32
%19 = call i32 @outb(i16 zeroext %10, i32 %18)
%20 = load i16, i16* %3
%21 = load i16, i16* %4
%22 = zext i16 %21 to i32
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %16
br label %25
25: ; preds = %24, %16
%26 = phi i1 [ false, %16 ], [ true, %24 ]
%27 = zext i1 %26 to i32
%28 = call i32 @outb(i16 zeroext %20, i32 %27)
ret void
}

LLVM IR (-O2):
define void @serial_configure_baud_rate(i16 zeroext %0, i16 zeroext %1) {
%3 = add i16 %0, 3
%4 = tail call i32 @outb(i16 zeroext %3, i32 128)
%5 = icmp ugt i16 %1, 255
%6 = zext i1 %5 to i32
%7 = tail call i32 @outb(i16 zeroext %0, i32 %6)
%8 = icmp ne i16 %1, 0
%9 = zext i1 %8 to i32
%10 = tail call i32 @outb(i16 zeroext %0, i32 %9)
ret void
}