#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_generic_serial_write(char *, int);
void drv_BuE_MT_defchar(const int ascii, const unsigned char *matrix) {
  int i;
  char cmd[22] = "\033"
                 "&T";
  cmd[3] = '\0';
  cmd[4] = 0x40 | 8 * ascii;
  for (i = 0; i < 8; i++) {
    cmd[2 * i + 5] = '\1';
    cmd[2 * i + 6] = matrix[i] & 0x1f;
  }
  cmd[21] = '\377';
  drv_generic_serial_write(cmd, 22);
}


x86 assembly (clang, -O0):
<drv_BuE_MT_defchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xed5(%rip),%eax
mov    %eax,-0x20(%rbp)
mov    0xecf(%rip),%ax
mov    %ax,-0x1c(%rbp)
movb   $0x0,-0x2d(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x3,%eax
or     $0x40,%eax
mov    %al,-0x2c(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    11a8 <drv_BuE_MT_defchar+0x98>
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
add    $0x5,%eax
cltq
movb   $0x1,-0x30(%rbp,%rax,1)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
and    $0x1f,%eax
mov    %al,%cl
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
add    $0x6,%eax
cltq
mov    %cl,-0x30(%rbp,%rax,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1160 <drv_BuE_MT_defchar+0x50>
movb   $0xff,-0x1b(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x16,%esi
call   1030 <drv_generic_serial_write@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drv_BuE_MT_defchar>:
sub    $0x18,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x3(%rsp)
shl    $0x3,%dil
or     $0x40,%dil
mov    %dil,0x4(%rsp)
movb   $0x1,0x5(%rsp)
mov    (%rsi),%al
and    $0x1f,%al
mov    %al,0x6(%rsp)
movb   $0x1,0x7(%rsp)
mov    0x1(%rsi),%al
and    $0x1f,%al
mov    %al,0x8(%rsp)
movb   $0x1,0x9(%rsp)
mov    0x2(%rsi),%al
and    $0x1f,%al
mov    %al,0xa(%rsp)
movb   $0x1,0xb(%rsp)
mov    0x3(%rsi),%al
and    $0x1f,%al
mov    %al,0xc(%rsp)
movb   $0x1,0xd(%rsp)
mov    0x4(%rsi),%al
and    $0x1f,%al
mov    %al,0xe(%rsp)
movb   $0x1,0xf(%rsp)
mov    0x5(%rsi),%al
and    $0x1f,%al
mov    %al,0x10(%rsp)
movb   $0x1,0x11(%rsp)
mov    0x6(%rsi),%al
and    $0x1f,%al
mov    %al,0x12(%rsp)
movb   $0x1,0x13(%rsp)
mov    0x7(%rsi),%al
and    $0x1f,%al
mov    %al,0x14(%rsp)
movb   $0xff,0x15(%rsp)
mov    %rsp,%rdi
mov    $0x16,%esi
call   1030 <drv_generic_serial_write@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.drv_BuE_MT_defchar.cmd = [22 x i8] c"\1B&T\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
define void @drv_BuE_MT_defchar(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [22 x i8]
store i32 %0, i32* %3
store i8* %1, i8** %4
%7 = bitcast [22 x i8]* %6 to i8*
%8 = getelementptr inbounds [22 x i8], [22 x i8]* %6, i64 0, i64 3
store i8 0, i8* %8
%9 = load i32, i32* %3
%10 = mul nsw i32 8, %9
%11 = or i32 64, %10
%12 = trunc i32 %11 to i8
%13 = getelementptr inbounds [22 x i8], [22 x i8]* %6, i64 0, i64 4
store i8 %12, i8* %13
store i32 0, i32* %5
br label %14
14: ; preds = %36, %2
%15 = load i32, i32* %5
%16 = icmp slt i32 %15, 8
br i1 %16, label %17, label %39
17: ; preds = %14
%18 = load i32, i32* %5
%19 = mul nsw i32 2, %18
%20 = add nsw i32 %19, 5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [22 x i8], [22 x i8]* %6, i64 0, i64 %21
store i8 1, i8* %22
%23 = load i8*, i8** %4
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
%27 = load i8, i8* %26
%28 = zext i8 %27 to i32
%29 = and i32 %28, 31
%30 = trunc i32 %29 to i8
%31 = load i32, i32* %5
%32 = mul nsw i32 2, %31
%33 = add nsw i32 %32, 6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [22 x i8], [22 x i8]* %6, i64 0, i64 %34
store i8 %30, i8* %35
br label %36
36: ; preds = %17
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
store i32 %38, i32* %5
br label %14
39: ; preds = %14
%40 = getelementptr inbounds [22 x i8], [22 x i8]* %6, i64 0, i64 21
store i8 -1, i8* %40
%41 = getelementptr inbounds [22 x i8], [22 x i8]* %6, i64 0, i64 0
%42 = call i32 @drv_generic_serial_write(i8* %41, i32 22)
ret void
}

LLVM IR (-O2):
@__const.drv_BuE_MT_defchar.cmd = [22 x i8] c"\1B&T\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
define void @drv_BuE_MT_defchar(i32 %0, i8* nocapture %1) {
%3 = alloca [22 x i8]
%4 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 3
store i8 0, i8* %5
%6 = trunc i32 %0 to i8
%7 = shl i8 %6, 3
%8 = or i8 %7, 64
%9 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 4
store i8 %8, i8* %9
%10 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 5
store i8 1, i8* %10
%11 = load i8, i8* %1
%12 = and i8 %11, 31
%13 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 6
store i8 %12, i8* %13
%14 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 7
store i8 1, i8* %14
%15 = getelementptr inbounds i8, i8* %1, i64 1
%16 = load i8, i8* %15
%17 = and i8 %16, 31
%18 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 8
store i8 %17, i8* %18
%19 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 9
store i8 1, i8* %19
%20 = getelementptr inbounds i8, i8* %1, i64 2
%21 = load i8, i8* %20
%22 = and i8 %21, 31
%23 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 10
store i8 %22, i8* %23
%24 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 11
store i8 1, i8* %24
%25 = getelementptr inbounds i8, i8* %1, i64 3
%26 = load i8, i8* %25
%27 = and i8 %26, 31
%28 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 12
store i8 %27, i8* %28
%29 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 13
store i8 1, i8* %29
%30 = getelementptr inbounds i8, i8* %1, i64 4
%31 = load i8, i8* %30
%32 = and i8 %31, 31
%33 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 14
store i8 %32, i8* %33
%34 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 15
store i8 1, i8* %34
%35 = getelementptr inbounds i8, i8* %1, i64 5
%36 = load i8, i8* %35
%37 = and i8 %36, 31
%38 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 16
store i8 %37, i8* %38
%39 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 17
store i8 1, i8* %39
%40 = getelementptr inbounds i8, i8* %1, i64 6
%41 = load i8, i8* %40
%42 = and i8 %41, 31
%43 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 18
store i8 %42, i8* %43
%44 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 19
store i8 1, i8* %44
%45 = getelementptr inbounds i8, i8* %1, i64 7
%46 = load i8, i8* %45
%47 = and i8 %46, 31
%48 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 20
store i8 %47, i8* %48
%49 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 21
store i8 -1, i8* %49
%50 = call i32 @drv_generic_serial_write(i8* %4, i32 22)
ret void
}