#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*/ putchar(char);
void console_fontbank(int row, int bank) {
  char banks[] = {'6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@'};
  putchar(0x1b);
  putchar('j');
  putchar(0x1b);
  putchar('Y');
  putchar(' ' + row);
  putchar(' ' + 0);
  putchar(0x1b);
  putchar('_');
  if (bank < 0)
    bank = 0;
  if (bank > 10)
    bank = 10;
  putchar(banks[bank]);
  putchar(0x1b);
  putchar('k');
}


x86 assembly (clang, -O0):
<console_fontbank>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0xedb(%rip),%rax
mov    %rax,-0x13(%rbp)
mov    0xed8(%rip),%ax
mov    %ax,-0xb(%rbp)
mov    0xed0(%rip),%al
mov    %al,-0x9(%rbp)
mov    $0x1b,%edi
call   1030 <putchar@plt>
mov    $0x6a,%edi
call   1030 <putchar@plt>
mov    $0x1b,%edi
call   1030 <putchar@plt>
mov    $0x59,%edi
call   1030 <putchar@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x1b,%edi
call   1030 <putchar@plt>
mov    $0x5f,%edi
call   1030 <putchar@plt>
cmpl   $0x0,-0x8(%rbp)
jge    11a2 <console_fontbank+0x92>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jle    11b3 <console_fontbank+0xa3>
movl   $0xa,-0x8(%rbp)
movslq -0x8(%rbp),%rax
movsbl -0x13(%rbp,%rax,1),%edi
call   1030 <putchar@plt>
mov    $0x1b,%edi
call   1030 <putchar@plt>
mov    $0x6b,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<console_fontbank>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x1b,%edi
call   1030 <putchar@plt>
mov    $0x6a,%edi
call   1030 <putchar@plt>
mov    $0x1b,%edi
call   1030 <putchar@plt>
mov    $0x59,%edi
call   1030 <putchar@plt>
add    $0x20,%bpl
movsbl %bpl,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x1b,%edi
call   1030 <putchar@plt>
mov    $0x5f,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
test   %ebx,%ebx
cmovns %ebx,%eax
cmp    $0xa,%eax
mov    $0xa,%ecx
cmovb  %eax,%ecx
lea    0xe7d(%rip),%rax
movsbl (%rcx,%rax,1),%edi
call   1030 <putchar@plt>
mov    $0x1b,%edi
call   1030 <putchar@plt>
mov    $0x6b,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@__const.console_fontbank.banks = [11 x i8] c"6789:;<=>?@"
define void @console_fontbank(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [11 x i8]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = bitcast [11 x i8]* %5 to i8*
%7 = call i32 @putchar(i8 signext 27)
%8 = call i32 @putchar(i8 signext 106)
%9 = call i32 @putchar(i8 signext 27)
%10 = call i32 @putchar(i8 signext 89)
%11 = load i32, i32* %3
%12 = add nsw i32 32, %11
%13 = trunc i32 %12 to i8
%14 = call i32 @putchar(i8 signext %13)
%15 = call i32 @putchar(i8 signext 32)
%16 = call i32 @putchar(i8 signext 27)
%17 = call i32 @putchar(i8 signext 95)
%18 = load i32, i32* %4
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %2
store i32 0, i32* %4
br label %21
21: ; preds = %20, %2
%22 = load i32, i32* %4
%23 = icmp sgt i32 %22, 10
br i1 %23, label %24, label %25
24: ; preds = %21
store i32 10, i32* %4
br label %25
25: ; preds = %24, %21
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = call i32 @putchar(i8 signext %29)
%31 = call i32 @putchar(i8 signext 27)
%32 = call i32 @putchar(i8 signext 107)
ret void
}

LLVM IR (-O2):
@__const.console_fontbank.banks = [11 x i8] c"6789:;<=>?@"
define void @console_fontbank(i32 %0, i32 %1) {
%3 = tail call i32 @putchar(i8 signext 27)
%4 = tail call i32 @putchar(i8 signext 106)
%5 = tail call i32 @putchar(i8 signext 27)
%6 = tail call i32 @putchar(i8 signext 89)
%7 = trunc i32 %0 to i8
%8 = add i8 %7, 32
%9 = tail call i32 @putchar(i8 signext %8)
%10 = tail call i32 @putchar(i8 signext 32)
%11 = tail call i32 @putchar(i8 signext 27)
%12 = tail call i32 @putchar(i8 signext 95)
%13 = icmp sgt i32 %1, 0
%14 = select i1 %13, i32 %1, i32 0
%15 = icmp ult i32 %14, 10
%16 = select i1 %15, i32 %14, i32 10
%17 = zext i32 %16 to i64
%18 = getelementptr inbounds [11 x i8], [11 x i8]* @__const.console_fontbank.banks, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = tail call i32 @putchar(i8 signext %19)
%21 = tail call i32 @putchar(i8 signext 27)
%22 = tail call i32 @putchar(i8 signext 107)
ret void
}