#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 putfont8_asc(char *vram, int xsize, int x, int y, char c, char *s) {
  extern char hankaku[4096];
  int i = 0;
  for (; *s != '\0'; s++, i++) {
    putfont8(vram, xsize, x + i * 8, y, c, hankaku + *s * 16);
  }
}


x86 assembly (clang, -O0):
<putfont8_asc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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)
movl   $0x0,-0x24(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     119a <putfont8_asc+0x8a>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x24(%rbp),%eax
shl    $0x3,%eax
add    %eax,%edx
mov    -0x14(%rbp),%ecx
mov    -0x15(%rbp),%al
mov    -0x20(%rbp),%r8
movsbl (%r8),%r8d
shl    $0x4,%r8d
movslq %r8d,%r8
mov    0x2e74(%rip),%r9
add    %r8,%r9
movsbl %al,%r8d
call   1030 <putfont8@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1136 <putfont8_asc+0x26>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putfont8_asc>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    (%r9),%al
test   %al,%al
je     1171 <putfont8_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>
movzbl (%rbx),%eax
add    $0x8,%ebp
add    $0x1,%rbx
test   %al,%al
jne    1140 <putfont8_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 @putfont8_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*
%13 = alloca i32
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
store i32 0, i32* %13
br label %14
14: ; preds = %35, %6
%15 = load i8*, i8** %12
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %40
19: ; preds = %14
%20 = load i8*, i8** %7
%21 = load i32, i32* %8
%22 = load i32, i32* %9
%23 = load i32, i32* %13
%24 = mul nsw i32 %23, 8
%25 = add nsw i32 %22, %24
%26 = load i32, i32* %10
%27 = load i8, i8* %11
%28 = load i8*, i8** %12
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = mul nsw i32 %30, 16
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @hankaku, i64 0, i64 0), i64 %32
%34 = call i32 @putfont8(i8* %20, i32 %21, i32 %25, i32 %26, i8 signext %27, i8* %33)
br label %35
35: ; preds = %19
%36 = load i8*, i8** %12
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %12
%38 = load i32, i32* %13
%39 = add nsw i32 %38, 1
store i32 %39, i32* %13
br label %14
40: ; preds = %14
ret void
}

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