#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*/ vpoke(int /*<<< orphan*/, int /*<<< orphan*/);
void vprint(unsigned char posx, unsigned char posy, char *text,
            unsigned int size) {
  int address = 6144 + (posy * 32) + posx;
  while (size-- > 0) {
    vpoke(address++, *(text++));
  }
}


x86 assembly (clang, -O0):
<vprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %dil,%sil
mov    %sil,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x5,%eax
add    $0x1800,%eax
movzbl -0x1(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
jbe    117c <vprint+0x6c>
mov    -0x18(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%esi
call   1030 <vpoke@plt>
jmp    1141 <vprint+0x31>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vprint>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %ecx,%ecx
je     1157 <vprint+0x47>
mov    %rdx,%r14
movzbl %dil,%eax
movzbl %sil,%edx
shl    $0x5,%edx
lea    (%rdx,%rax,1),%r15d
add    $0x1800,%r15d
mov    %ecx,%r12d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
lea    (%r15,%rbx,1),%edi
movsbl (%r14,%rbx,1),%esi
call   1030 <vpoke@plt>
add    $0x1,%rbx
cmp    %ebx,%r12d
jne    1140 <vprint+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @vprint(i8 zeroext %0, i8 zeroext %1, i8* %2, i32 %3) {
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i8 %0, i8* %5
store i8 %1, i8* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = load i8, i8* %6
%11 = zext i8 %10 to i32
%12 = mul nsw i32 %11, 32
%13 = add nsw i32 6144, %12
%14 = load i8, i8* %5
%15 = zext i8 %14 to i32
%16 = add nsw i32 %13, %15
store i32 %16, i32* %9
br label %17
17: ; preds = %21, %4
%18 = load i32, i32* %8
%19 = add i32 %18, -1
store i32 %19, i32* %8
%20 = icmp ugt i32 %18, 0
br i1 %20, label %21, label %29
21: ; preds = %17
%22 = load i32, i32* %9
%23 = add nsw i32 %22, 1
store i32 %23, i32* %9
%24 = load i8*, i8** %7
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %7
%26 = load i8, i8* %24
%27 = sext i8 %26 to i32
%28 = call i32 @vpoke(i32 %22, i32 %27)
br label %17
29: ; preds = %17
ret void
}

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