#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*/ DrawHorzChar2(int, int, unsigned int *, int, int, int);
int /*<<< orphan*/ DrawVertChar2(int, int, unsigned int *, int, int, int);
void PutCharImage2(int col, int row, int value, int scale, int vert,
                   int color) {
  unsigned char *ptr2 = (unsigned char *)0x8000 + ((value >> 1) * 128);
  if (vert == 0)
    DrawHorzChar2(col, row, (unsigned int *)ptr2, scale, color, value & 1);
  else
    DrawVertChar2(col, row, (unsigned int *)ptr2, scale, color, value & 1);
}


x86 assembly (clang, -O0):
<PutCharImage2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x1,%eax
shl    $0x7,%eax
movslq %eax,%rcx
mov    $0x8000,%eax
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1181 <PutCharImage2+0x61>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0xc(%rbp),%r9d
and    $0x1,%r9d
call   1030 <DrawHorzChar2@plt>
jmp    119f <PutCharImage2+0x7f>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0xc(%rbp),%r9d
and    $0x1,%r9d
call   1040 <DrawVertChar2@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PutCharImage2>:
mov    %edx,%eax
shl    $0x6,%edx
and    $0xffffff80,%edx
movslq %edx,%rdx
add    $0x8000,%rdx
and    $0x1,%eax
test   %r8d,%r8d
je     1145 <PutCharImage2+0x25>
mov    %r9d,%r8d
mov    %eax,%r9d
jmp    1040 <DrawVertChar2@plt>
mov    %r9d,%r8d
mov    %eax,%r9d
jmp    1030 <DrawHorzChar2@plt>

LLVM IR (-O0):
define void @PutCharImage2(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%14 = load i32, i32* %9
%15 = ashr i32 %14, 1
%16 = mul nsw i32 %15, 128
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* inttoptr (i64 32768 to i8*), i64 %17
store i8* %18, i8** %13
%19 = load i32, i32* %11
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %31
21: ; preds = %6
%22 = load i32, i32* %7
%23 = load i32, i32* %8
%24 = load i8*, i8** %13
%25 = bitcast i8* %24 to i32*
%26 = load i32, i32* %10
%27 = load i32, i32* %12
%28 = load i32, i32* %9
%29 = and i32 %28, 1
%30 = call i32 @DrawHorzChar2(i32 %22, i32 %23, i32* %25, i32 %26, i32 %27, i32 %29)
br label %41
31: ; preds = %6
%32 = load i32, i32* %7
%33 = load i32, i32* %8
%34 = load i8*, i8** %13
%35 = bitcast i8* %34 to i32*
%36 = load i32, i32* %10
%37 = load i32, i32* %12
%38 = load i32, i32* %9
%39 = and i32 %38, 1
%40 = call i32 @DrawVertChar2(i32 %32, i32 %33, i32* %35, i32 %36, i32 %37, i32 %39)
br label %41
41: ; preds = %31, %21
ret void
}

LLVM IR (-O2):
define void @PutCharImage2(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = shl nsw i32 %2, 6
%8 = and i32 %7, -128
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* inttoptr (i64 32768 to i8*), i64 %9
%11 = icmp eq i32 %4, 0
%12 = bitcast i8* %10 to i32*
%13 = and i32 %2, 1
br i1 %11, label %14, label %16
14: ; preds = %6
%15 = tail call i32 @DrawHorzChar2(i32 %0, i32 %1, i32* %12, i32 %3, i32 %5, i32 %13)
br label %18
16: ; preds = %6
%17 = tail call i32 @DrawVertChar2(i32 %0, i32 %1, i32* %12, i32 %3, i32 %5, i32 %13)
br label %18
18: ; preds = %16, %14
ret void
}