#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*/ Delay();
void DisplayColour(unsigned char BackgroundColour,
                   unsigned char ForegroundColour) {
  unsigned char Colour;
  Colour = ((BackgroundColour << 4) & 0xF0) | (ForegroundColour & 0x0F);
  unsigned short *DisplayMemoryPtr = (unsigned short *)0xB8000;
  unsigned int DisplaySize = 2000;
  unsigned int i = 0;
  while (i < DisplaySize) {
    DisplayMemoryPtr[i++] = (((unsigned short)Colour) << 8) | 0x00;
  }
  Delay();
}


x86 assembly (clang, -O0):
<DisplayColour>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x4,%eax
and    $0xf0,%eax
movzbl -0x2(%rbp),%ecx
and    $0xf,%ecx
or     %ecx,%eax
mov    %al,-0x3(%rbp)
mov    $0xb8000,%eax
mov    %rax,-0x10(%rbp)
movl   $0x7d0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    1189 <DisplayColour+0x79>
movzbl -0x3(%rbp),%eax
movzwl %ax,%eax
shl    $0x8,%eax
or     $0x0,%eax
mov    %ax,%dx
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x18(%rbp)
mov    %ecx,%ecx
mov    %dx,(%rax,%rcx,2)
jmp    1153 <DisplayColour+0x43>
mov    $0x0,%al
call   1030 <Delay@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DisplayColour>:
mov    $0xb8090,%eax
shl    $0x4,%dil
and    $0xf,%sil
or     %dil,%sil
movzbl %sil,%ecx
movd   %ecx,%xmm0
pshuflw $0x0,%xmm0,%xmm0
pshufd $0x0,%xmm0,%xmm0
psllw  $0x8,%xmm0
xor    %ecx,%ecx
nopl   0x0(%rax)
movdqa %xmm0,-0x90(%rax,%rcx,2)
ff ff
movdqa %xmm0,-0x80(%rax,%rcx,2)
movdqa %xmm0,-0x70(%rax,%rcx,2)
movdqa %xmm0,-0x60(%rax,%rcx,2)
movdqa %xmm0,-0x50(%rax,%rcx,2)
movdqa %xmm0,-0x40(%rax,%rcx,2)
movdqa %xmm0,-0x30(%rax,%rcx,2)
movdqa %xmm0,-0x20(%rax,%rcx,2)
movdqa %xmm0,-0x10(%rax,%rcx,2)
movdqa %xmm0,(%rax,%rcx,2)
add    $0x50,%rcx
cmp    $0x7d0,%rcx
jne    1140 <DisplayColour+0x30>
xor    %eax,%eax
jmp    1030 <Delay@plt>

LLVM IR (-O0):
define void @DisplayColour(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
%6 = alloca i16*
%7 = alloca i32
%8 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
%9 = load i8, i8* %3
%10 = zext i8 %9 to i32
%11 = shl i32 %10, 4
%12 = and i32 %11, 240
%13 = load i8, i8* %4
%14 = zext i8 %13 to i32
%15 = and i32 %14, 15
%16 = or i32 %12, %15
%17 = trunc i32 %16 to i8
store i8 %17, i8* %5
store i16* inttoptr (i64 753664 to i16*), i16** %6
store i32 2000, i32* %7
store i32 0, i32* %8
br label %18
18: ; preds = %22, %2
%19 = load i32, i32* %8
%20 = load i32, i32* %7
%21 = icmp ult i32 %19, %20
br i1 %21, label %22, label %34
22: ; preds = %18
%23 = load i8, i8* %5
%24 = zext i8 %23 to i16
%25 = zext i16 %24 to i32
%26 = shl i32 %25, 8
%27 = or i32 %26, 0
%28 = trunc i32 %27 to i16
%29 = load i16*, i16** %6
%30 = load i32, i32* %8
%31 = add i32 %30, 1
store i32 %31, i32* %8
%32 = zext i32 %30 to i64
%33 = getelementptr inbounds i16, i16* %29, i64 %32
store i16 %28, i16* %33
br label %18
34: ; preds = %18
%35 = call i32 (...) @Delay()
ret void
}

LLVM IR (-O2):
define void @DisplayColour(i8 zeroext %0, i8 zeroext %1) {
%3 = shl i8 %0, 4
%4 = and i8 %1, 15
%5 = or i8 %4, %3
%6 = zext i8 %5 to i16
%7 = shl nuw i16 %6, 8
%8 = insertelement <8 x i16> poison, i16 %7, i64 0
%9 = shufflevector <8 x i16> %8, <8 x i16> poison, <8 x i32> zeroinitializer
%10 = insertelement <8 x i16> poison, i16 %7, i64 0
%11 = shufflevector <8 x i16> %10, <8 x i16> poison, <8 x i32> zeroinitializer
br label %12
12: ; preds = %12, %2
%13 = phi i64 [ 0, %2 ], [ %38, %12 ]
%14 = getelementptr inbounds i16, i16* inttoptr (i64 753664 to i16*), i64 %13
%15 = bitcast i16* %14 to <8 x i16>*
store <8 x i16> %9, <8 x i16>* %15
%16 = getelementptr inbounds i16, i16* %14, i64 8
%17 = bitcast i16* %16 to <8 x i16>*
store <8 x i16> %11, <8 x i16>* %17
%18 = add nuw nsw i64 %13, 16
%19 = getelementptr inbounds i16, i16* inttoptr (i64 753664 to i16*), i64 %18
%20 = bitcast i16* %19 to <8 x i16>*
store <8 x i16> %9, <8 x i16>* %20
%21 = getelementptr inbounds i16, i16* %19, i64 8
%22 = bitcast i16* %21 to <8 x i16>*
store <8 x i16> %11, <8 x i16>* %22
%23 = add nuw nsw i64 %13, 32
%24 = getelementptr inbounds i16, i16* inttoptr (i64 753664 to i16*), i64 %23
%25 = bitcast i16* %24 to <8 x i16>*
store <8 x i16> %9, <8 x i16>* %25
%26 = getelementptr inbounds i16, i16* %24, i64 8
%27 = bitcast i16* %26 to <8 x i16>*
store <8 x i16> %11, <8 x i16>* %27
%28 = add nuw nsw i64 %13, 48
%29 = getelementptr inbounds i16, i16* inttoptr (i64 753664 to i16*), i64 %28
%30 = bitcast i16* %29 to <8 x i16>*
store <8 x i16> %9, <8 x i16>* %30
%31 = getelementptr inbounds i16, i16* %29, i64 8
%32 = bitcast i16* %31 to <8 x i16>*
store <8 x i16> %11, <8 x i16>* %32
%33 = add nuw nsw i64 %13, 64
%34 = getelementptr inbounds i16, i16* inttoptr (i64 753664 to i16*), i64 %33
%35 = bitcast i16* %34 to <8 x i16>*
store <8 x i16> %9, <8 x i16>* %35
%36 = getelementptr inbounds i16, i16* %34, i64 8
%37 = bitcast i16* %36 to <8 x i16>*
store <8 x i16> %11, <8 x i16>* %37
%38 = add nuw nsw i64 %13, 80
%39 = icmp eq i64 %38, 2000
br i1 %39, label %40, label %12
40: ; preds = %12
%41 = tail call i32 (...) @Delay()
ret void
}