#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*/ PutFont(char *, int, int, int, char, char *);
void PutString(char *vram, int vramx, int x, int y, char color, char *bmap,
               unsigned char *string) {
  for (; *string != 0x00; string++) {
    PutFont(vram, vramx, x, y, color, bmap + *string * 16);
    x += 8;
  }
  return;
}


x86 assembly (clang, -O0):
<PutString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %r8b,%al
mov    0x10(%rbp),%r8
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %al,-0x15(%rbp)
mov    %r9,-0x20(%rbp)
mov    0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x0,%eax
je     118c <PutString+0x7c>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x15(%rbp),%al
mov    -0x20(%rbp),%r9
mov    0x10(%rbp),%r8
movzbl (%r8),%r8d
shl    $0x4,%r8d
movslq %r8d,%r8
add    %r8,%r9
movsbl %al,%r8d
call   1030 <PutFont@plt>
mov    -0x10(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x10(%rbp)
mov    0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,0x10(%rbp)
jmp    1133 <PutString+0x23>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PutString>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x40(%rsp),%r14
mov    (%r14),%al
test   %al,%al
je     117f <PutString+0x6f>
mov    %r9,%rbp
mov    %ecx,%r12d
mov    %edx,%ebx
mov    %esi,%r13d
mov    %rdi,%r15
add    $0x1,%r14
movsbl %r8b,%edx
mov    %edx,0x4(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl %al,%r9d
shl    $0x4,%r9
add    %rbp,%r9
mov    %r15,%rdi
mov    %r13d,%esi
mov    %ebx,%edx
mov    %r12d,%ecx
mov    0x4(%rsp),%r8d
call   1030 <PutFont@plt>
add    $0x8,%ebx
movzbl (%r14),%eax
add    $0x1,%r14
test   %al,%al
jne    1150 <PutString+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @PutString(i8* %0, i32 %1, i32 %2, i32 %3, i8 signext %4, i8* %5, i8* nocapture %6) {
%8 = load i8, i8* %6
%9 = icmp eq i8 %8, 0
br i1 %9, label %22, label %10
10: ; preds = %7, %10
%11 = phi i8 [ %20, %10 ], [ %8, %7 ]
%12 = phi i8* [ %19, %10 ], [ %6, %7 ]
%13 = phi i32 [ %18, %10 ], [ %2, %7 ]
%14 = zext i8 %11 to i64
%15 = shl nuw nsw i64 %14, 4
%16 = getelementptr inbounds i8, i8* %5, i64 %15
%17 = tail call i32 @PutFont(i8* %0, i32 %1, i32 %13, i32 %3, i8 signext %4, i8* %16)
%18 = add nsw i32 %13, 8
%19 = getelementptr inbounds i8, i8* %12, i64 1
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 0
br i1 %21, label %22, label %10
22: ; preds = %10, %7
ret void
}