#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*/ drv_RB_command(int, int);
int /*<<< orphan*/ drv_RB_data(char *, int, int);
void drv_RB_defchar(const int ascii, const unsigned char *matrix) {
  int i;
  char buffer[8];
  for (i = 0; i < 8; i++) {
    buffer[i] = matrix[i] & 0x1f;
  }
  drv_RB_command(0x40 | 8 * ascii, 80);
  drv_RB_data(buffer, 8, 120);
}


x86 assembly (clang, -O0):
<drv_RB_defchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    1167 <drv_RB_defchar+0x47>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
and    $0x1f,%eax
mov    %al,%cl
movslq -0x14(%rbp),%rax
mov    %cl,-0x1c(%rbp,%rax,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1136 <drv_RB_defchar+0x16>
mov    -0x4(%rbp),%edi
shl    $0x3,%edi
or     $0x40,%edi
mov    $0x50,%esi
call   1030 <drv_RB_command@plt>
lea    -0x1c(%rbp),%rdi
mov    $0x8,%esi
mov    $0x78,%edx
call   1040 <drv_RB_data@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drv_RB_defchar>:
push   %rax
mov    (%rsi),%al
and    $0x1f,%al
mov    %al,(%rsp)
mov    0x1(%rsi),%al
and    $0x1f,%al
mov    %al,0x1(%rsp)
mov    0x2(%rsi),%al
and    $0x1f,%al
mov    %al,0x2(%rsp)
mov    0x3(%rsi),%al
and    $0x1f,%al
mov    %al,0x3(%rsp)
mov    0x4(%rsi),%al
and    $0x1f,%al
mov    %al,0x4(%rsp)
mov    0x5(%rsi),%al
and    $0x1f,%al
mov    %al,0x5(%rsp)
mov    0x6(%rsi),%al
and    $0x1f,%al
mov    %al,0x6(%rsp)
mov    0x7(%rsi),%al
and    $0x1f,%al
mov    %al,0x7(%rsp)
shl    $0x3,%edi
or     $0x40,%edi
mov    $0x50,%esi
call   1030 <drv_RB_command@plt>
mov    %rsp,%rdi
mov    $0x8,%esi
mov    $0x78,%edx
call   1040 <drv_RB_data@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @drv_RB_defchar(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [8 x i8]
store i32 %0, i32* %3
store i8* %1, i8** %4
store i32 0, i32* %5
br label %7
7: ; preds = %22, %2
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 8
br i1 %9, label %10, label %25
10: ; preds = %7
%11 = load i8*, i8** %4
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = and i32 %16, 31
%18 = trunc i32 %17 to i8
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 %20
store i8 %18, i8* %21
br label %22
22: ; preds = %10
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %7
25: ; preds = %7
%26 = load i32, i32* %3
%27 = mul nsw i32 8, %26
%28 = or i32 64, %27
%29 = call i32 @drv_RB_command(i32 %28, i32 80)
%30 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%31 = call i32 @drv_RB_data(i8* %30, i32 8, i32 120)
ret void
}

LLVM IR (-O2):
define void @drv_RB_defchar(i32 %0, i8* nocapture %1) {
%3 = alloca [8 x i8]
%4 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%5 = load i8, i8* %1
%6 = and i8 %5, 31
store i8 %6, i8* %4
%7 = getelementptr inbounds i8, i8* %1, i64 1
%8 = load i8, i8* %7
%9 = and i8 %8, 31
%10 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 1
store i8 %9, i8* %10
%11 = getelementptr inbounds i8, i8* %1, i64 2
%12 = load i8, i8* %11
%13 = and i8 %12, 31
%14 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 2
store i8 %13, i8* %14
%15 = getelementptr inbounds i8, i8* %1, i64 3
%16 = load i8, i8* %15
%17 = and i8 %16, 31
%18 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 3
store i8 %17, i8* %18
%19 = getelementptr inbounds i8, i8* %1, i64 4
%20 = load i8, i8* %19
%21 = and i8 %20, 31
%22 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 4
store i8 %21, i8* %22
%23 = getelementptr inbounds i8, i8* %1, i64 5
%24 = load i8, i8* %23
%25 = and i8 %24, 31
%26 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 5
store i8 %25, i8* %26
%27 = getelementptr inbounds i8, i8* %1, i64 6
%28 = load i8, i8* %27
%29 = and i8 %28, 31
%30 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 6
store i8 %29, i8* %30
%31 = getelementptr inbounds i8, i8* %1, i64 7
%32 = load i8, i8* %31
%33 = and i8 %32, 31
%34 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 7
store i8 %33, i8* %34
%35 = shl nsw i32 %0, 3
%36 = or i32 %35, 64
%37 = tail call i32 @drv_RB_command(i32 %36, i32 80)
%38 = call i32 @drv_RB_data(i8* %4, i32 8, i32 120)
ret void
}