#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*/ putfont8(char *, int, int, int, char, char *);
void putfonts8_asc(char *vram, int xsize, int x, int y, char color,
                   const char *s) {
  extern char hankaku[4096];
  for (; *s != 0x00; ++s) {
    putfont8(vram, xsize, x, y, color, hankaku + *s * 16);
    x += 8;
  }
}


x86 assembly (clang, -O0):
<putfonts8_asc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %r8b,%al
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    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     118b <putfonts8_asc+0x7b>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x15(%rbp),%al
mov    -0x20(%rbp),%r8
movsbl (%r8),%r8d
shl    $0x4,%r8d
movslq %r8d,%r8
mov    0x2e83(%rip),%r9
add    %r8,%r9
movsbl %al,%r8d
call   1030 <putfont8@plt>
mov    -0x10(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    112f <putfonts8_asc+0x1f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putfonts8_asc>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    (%r9),%al
test   %al,%al
je     1171 <putfonts8_asc+0x61>
mov    %r9,%rbx
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %esi,%r15d
mov    %rdi,%r12
add    $0x1,%rbx
movsbl %r8b,%r13d
nopl   0x0(%rax,%rax,1)
movsbl %al,%eax
shl    $0x4,%eax
movslq %eax,%r9
add    0x2e98(%rip),%r9
mov    %r12,%rdi
mov    %r15d,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
mov    %r13d,%r8d
call   1030 <putfont8@plt>
add    $0x8,%ebp
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1140 <putfonts8_asc+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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