#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*/ bfnt_draw_char(int, int, int, int, int);
int /*<<< orphan*/ bmp_printf(int, int, int, char *, ...);
int /*<<< orphan*/ call(char *);
int /*<<< orphan*/ qprintf(char *);
void qemu_hello() {
  bmp_printf((0 | (((4) << 16) & (0xFFFF0000)) | ((0) & 0xFF) << 8 |
              ((0) & 0xFF) << 0),
             50, 50, "Hello from QEMU!");
  for (int i = 1; i < 14; i++) {
    bfnt_draw_char(-i, i * 50, 100, 0x0B, 0x01);
    bmp_printf((0 |
                (((0 | (((2) << 16) & (0xFFFF0000)) | ((0) & 0xFF) << 8 |
                   ((0) & 0xFF) << 0)) &
                 (0xFFFF0000)) |
                ((0x01) & 0xFF) << 8 | ((0x0B) & 0xFF) << 0),
               i * 50, 140, "%d", i);
  }
  qprintf("\nHello at QEMU console!\n\n");
  call("dispcheck");
  call("shutdown");
  while (1)
    ;
}


x86 assembly (clang, -O0):
<qemu_hello>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x40000,%edi
mov    $0x32,%edx
lea    0xea7(%rip),%rcx
mov    %edx,%esi
mov    $0x0,%al
call   1030 <bmp_printf@plt>
movl   $0x1,-0x4(%rbp)
cmpl   $0xe,-0x4(%rbp)
jge    11bf <qemu_hello+0x7f>
xor    %edi,%edi
sub    -0x4(%rbp),%edi
imul   $0x32,-0x4(%rbp),%esi
mov    $0x64,%edx
mov    $0xb,%ecx
mov    $0x1,%r8d
call   1040 <bfnt_draw_char@plt>
imul   $0x32,-0x4(%rbp),%esi
mov    -0x4(%rbp),%r8d
mov    $0x2010b,%edi
mov    $0x8c,%edx
lea    0xe67(%rip),%rcx
mov    $0x0,%al
call   1030 <bmp_printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1169 <qemu_hello+0x29>
lea    0xe4e(%rip),%rdi
call   1050 <qprintf@plt>
lea    0xe5c(%rip),%rdi
call   1060 <call@plt>
lea    0xe5a(%rip),%rdi
call   1060 <call@plt>
jmp    11e3 <qemu_hello+0xa3>

x86 assembly (clang, -O2):
<qemu_hello>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xeb2(%rip),%rcx
mov    $0x32,%ebx
mov    $0x40000,%edi
mov    $0x32,%esi
mov    $0x32,%edx
xor    %eax,%eax
call   1030 <bmp_printf@plt>
mov    $0x1,%r14d
mov    $0xffffffff,%ebp
lea    0xe96(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %ebx,%esi
mov    $0x64,%edx
mov    $0xb,%ecx
mov    $0x1,%r8d
call   1040 <bfnt_draw_char@plt>
mov    $0x2010b,%edi
mov    %ebx,%esi
mov    $0x8c,%edx
mov    %r15,%rcx
mov    %r14d,%r8d
xor    %eax,%eax
call   1030 <bmp_printf@plt>
add    $0x1,%r14d
add    $0x32,%ebx
add    $0xffffffff,%ebp
cmp    $0x2bc,%ebx
jne    1180 <qemu_hello+0x40>
lea    0xe49(%rip),%rdi
call   1050 <qprintf@plt>
lea    0xe57(%rip),%rdi
call   1060 <call@plt>
lea    0xe55(%rip),%rdi
call   1060 <call@plt>
nopl   0x0(%rax,%rax,1)
jmp    11f0 <qemu_hello+0xb0>

LLVM IR (-O0):
@.str = [17 x i8] c"Hello from QEMU!\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [26 x i8] c"\0AHello at QEMU console!\0A\0A\00"
@.str.3 = [10 x i8] c"dispcheck\00"
@.str.4 = [9 x i8] c"shutdown\00"
define void @qemu_hello() {
%1 = alloca i32
%2 = call i32 (i32, i32, i32, i8*, ...) @bmp_printf(i32 262144, i32 50, i32 50, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %1
br label %3
3: ; preds = %16, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 14
br i1 %5, label %6, label %19
6: ; preds = %3
%7 = load i32, i32* %1
%8 = sub nsw i32 0, %7
%9 = load i32, i32* %1
%10 = mul nsw i32 %9, 50
%11 = call i32 @bfnt_draw_char(i32 %8, i32 %10, i32 100, i32 11, i32 1)
%12 = load i32, i32* %1
%13 = mul nsw i32 %12, 50
%14 = load i32, i32* %1
%15 = call i32 (i32, i32, i32, i8*, ...) @bmp_printf(i32 131339, i32 %13, i32 140, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %6
%17 = load i32, i32* %1
%18 = add nsw i32 %17, 1
store i32 %18, i32* %1
br label %3
19: ; preds = %3
%20 = call i32 @qprintf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 @call(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 @call(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %23
23: ; preds = %19, %23
br label %23
}

LLVM IR (-O2):
@.str = [17 x i8] c"Hello from QEMU!\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [26 x i8] c"\0AHello at QEMU console!\0A\0A\00"
@.str.3 = [10 x i8] c"dispcheck\00"
@.str.4 = [9 x i8] c"shutdown\00"
define void @qemu_hello() {
%1 = tail call i32 (i32, i32, i32, i8*, ...) @bmp_printf(i32 262144, i32 50, i32 50, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %6
2: ; preds = %6
%3 = tail call i32 @qprintf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @call(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 @call(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %14
6: ; preds = %0, %6
%7 = phi i32 [ 1, %0 ], [ %12, %6 ]
%8 = sub nsw i32 0, %7
%9 = mul nuw nsw i32 %7, 50
%10 = tail call i32 @bfnt_draw_char(i32 %8, i32 %9, i32 100, i32 11, i32 1)
%11 = tail call i32 (i32, i32, i32, i8*, ...) @bmp_printf(i32 131339, i32 %9, i32 140, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%12 = add nuw nsw i32 %7, 1
%13 = icmp eq i32 %12, 14
br i1 %13, label %2, label %6
14: ; preds = %2, %14
br label %14
}