#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*/ put_char(char, int, int, int, int, int, int,
                            unsigned char *);
int strlen(char *);
void vmwTextXY(char *string, int x, int y, int color, int background,
               int overwrite, int which_font, unsigned char *buffer) {
  int i;
  for (i = 0; i < strlen(string); i++) {
    put_char(string[i], x + (i * 8), y, color, background, overwrite,
             which_font, buffer);
  }
}


x86 assembly (clang, -O0):
<vmwTextXY>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
cmp    %ecx,%eax
jge    11b4 <vmwTextXY+0x94>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,1),%dil
mov    -0xc(%rbp),%esi
mov    -0x20(%rbp),%eax
shl    $0x3,%eax
add    %eax,%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
mov    0x10(%rbp),%r10d
mov    0x18(%rbp),%rax
movsbl %dil,%edi
mov    %r10d,(%rsp)
mov    %rax,0x8(%rsp)
call   1040 <put_char@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    114b <vmwTextXY+0x2b>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vmwTextXY>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,0x4(%rsp)
mov    %r8d,%r15d
mov    %ecx,%r12d
mov    %edx,%r13d
mov    %esi,%ebx
mov    %rdi,%rbp
call   1030 <strlen@plt>
test   %eax,%eax
jle    118e <vmwTextXY+0x6e>
xor    %r14d,%r14d
nopw   0x0(%rax,%rax,1)
movsbl 0x0(%rbp,%r14,1),%edi
mov    %ebx,%esi
mov    %r13d,%edx
mov    %r12d,%ecx
mov    %r15d,%r8d
mov    0x4(%rsp),%r9d
push   0x48(%rsp)
mov    0x48(%rsp),%eax
push   %rax
call   1040 <put_char@plt>
add    $0x10,%rsp
add    $0x1,%r14
mov    %rbp,%rdi
call   1030 <strlen@plt>
cltq
add    $0x8,%ebx
cmp    %rax,%r14
jl     1150 <vmwTextXY+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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