#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void shwfnt(char *fnt, int fntlen) {
  int rowsz;
  char *p, *q;
  rowsz = 0;
  p = (char *)fnt;
  q = (char *)fnt + fntlen;
  while (p < q) {
    fprintf(stderr, "%c", *p++);
    rowsz++;
    if (rowsz >= 12) {
      fprintf(stderr, "\n");
      rowsz = 0;
    }
  }
}


x86 assembly (clang, -O0):
<shwfnt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    11aa <shwfnt+0x9a>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl (%rax),%edx
lea    0xe93(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0xc,-0x10(%rbp)
jl     11a5 <shwfnt+0x95>
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
lea    0xe6c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x10(%rbp)
jmp    113d <shwfnt+0x2d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shwfnt>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1187 <shwfnt+0x77>
mov    %rdi,%rbx
movslq %esi,%r12
add    %rdi,%r12
mov    0x2eb1(%rip),%r13
lea    0xeca(%rip),%r14
lea    0xec6(%rip),%r15
xor    %ebp,%ebp
jmp    1165 <shwfnt+0x55>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x0(%r13),%edi
xor    %ebp,%ebp
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
cmp    %r12,%rbx
jae    1187 <shwfnt+0x77>
mov    0x0(%r13),%edi
movsbl (%rbx),%edx
add    $0x1,%rbx
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
cmp    $0xb,%ebp
jge    1150 <shwfnt+0x40>
add    $0x1,%ebp
cmp    %r12,%rbx
jb     1165 <shwfnt+0x55>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [3 x i8] c"%c\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @shwfnt(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
%8 = load i8*, i8** %3
store i8* %8, i8** %6
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
store i8* %12, i8** %7
br label %13
13: ; preds = %31, %2
%14 = load i8*, i8** %6
%15 = load i8*, i8** %7
%16 = icmp ult i8* %14, %15
br i1 %16, label %17, label %32
17: ; preds = %13
%18 = load i32, i32* @stderr
%19 = load i8*, i8** %6
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %6
%21 = load i8, i8* %19
%22 = sext i8 %21 to i32
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
%26 = load i32, i32* %5
%27 = icmp sge i32 %26, 12
br i1 %27, label %28, label %31
28: ; preds = %17
%29 = load i32, i32* @stderr
%30 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %5
br label %31
31: ; preds = %28, %17
br label %13
32: ; preds = %13
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [3 x i8] c"%c\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @shwfnt(i8* %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %22
6: ; preds = %2, %19
%7 = phi i32 [ %20, %19 ], [ 0, %2 ]
%8 = phi i8* [ %10, %19 ], [ %0, %2 ]
%9 = load i32, i32* @stderr
%10 = getelementptr inbounds i8, i8* %8, i64 1
%11 = load i8, i8* %8
%12 = sext i8 %11 to i32
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = add nsw i32 %7, 1
%15 = icmp sgt i32 %7, 10
br i1 %15, label %16, label %19
16: ; preds = %6
%17 = load i32, i32* @stderr
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %19
19: ; preds = %16, %6
%20 = phi i32 [ 0, %16 ], [ %14, %6 ]
%21 = icmp ult i8* %10, %4
br i1 %21, label %6, label %22
22: ; preds = %19, %2
ret void
}