#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_CW_send(char *, int);
void drv_CW1602_defchar(const int ascii, const unsigned char *buffer) {
  int i;
  char cmd[12] = "\376Nn12345678\375";
  cmd[2] = (char)ascii;
  for (i = 0; i < 8; i++) {
    cmd[3 + i] = buffer[i] & 0x1f;
  }
  drv_CW_send(cmd, 12);
}


x86 assembly (clang, -O0):
<drv_CW1602_defchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed8(%rip),%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %al,-0x1e(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    1175 <drv_CW1602_defchar+0x65>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
and    $0x1f,%eax
mov    %al,%cl
mov    -0x14(%rbp),%eax
add    $0x3,%eax
cltq
mov    %cl,-0x20(%rbp,%rax,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1140 <drv_CW1602_defchar+0x30>
lea    -0x20(%rbp),%rdi
mov    $0xc,%esi
call   1030 <drv_CW_send@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drv_CW1602_defchar>:
sub    $0x18,%rsp
movabs $0x35343332316e4efe,%rax
33 34 35
mov    %rax,0x8(%rsp)
movl   $0xfd383736,0x10(%rsp)
fd
mov    %dil,0xa(%rsp)
mov    (%rsi),%al
and    $0x1f,%al
mov    %al,0xb(%rsp)
mov    0x1(%rsi),%al
and    $0x1f,%al
mov    %al,0xc(%rsp)
mov    0x2(%rsi),%al
and    $0x1f,%al
mov    %al,0xd(%rsp)
mov    0x3(%rsi),%al
and    $0x1f,%al
mov    %al,0xe(%rsp)
mov    0x4(%rsi),%al
and    $0x1f,%al
mov    %al,0xf(%rsp)
mov    0x5(%rsi),%al
and    $0x1f,%al
mov    %al,0x10(%rsp)
mov    0x6(%rsi),%al
and    $0x1f,%al
mov    %al,0x11(%rsp)
mov    0x7(%rsi),%al
and    $0x1f,%al
mov    %al,0x12(%rsp)
lea    0x8(%rsp),%rdi
mov    $0xc,%esi
call   1030 <drv_CW_send@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.drv_CW1602_defchar.cmd = [12 x i8] c"\FENn12345678\FD"
define void @drv_CW1602_defchar(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [12 x i8]
store i32 %0, i32* %3
store i8* %1, i8** %4
%7 = bitcast [12 x i8]* %6 to i8*
%8 = load i32, i32* %3
%9 = trunc i32 %8 to i8
%10 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 2
store i8 %9, i8* %10
store i32 0, i32* %5
br label %11
11: ; preds = %27, %2
%12 = load i32, i32* %5
%13 = icmp slt i32 %12, 8
br i1 %13, label %14, label %30
14: ; preds = %11
%15 = load i8*, i8** %4
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = and i32 %20, 31
%22 = trunc i32 %21 to i8
%23 = load i32, i32* %5
%24 = add nsw i32 3, %23
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 %25
store i8 %22, i8* %26
br label %27
27: ; preds = %14
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %11
30: ; preds = %11
%31 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 0
%32 = call i32 @drv_CW_send(i8* %31, i32 12)
ret void
}

LLVM IR (-O2):
@__const.drv_CW1602_defchar.cmd = [12 x i8] c"\FENn12345678\FD"
define void @drv_CW1602_defchar(i32 %0, i8* nocapture %1) {
%3 = alloca [12 x i8]
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%5 = trunc i32 %0 to i8
%6 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 2
store i8 %5, i8* %6
%7 = load i8, i8* %1
%8 = and i8 %7, 31
%9 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 3
store i8 %8, i8* %9
%10 = getelementptr inbounds i8, i8* %1, i64 1
%11 = load i8, i8* %10
%12 = and i8 %11, 31
%13 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 4
store i8 %12, i8* %13
%14 = getelementptr inbounds i8, i8* %1, i64 2
%15 = load i8, i8* %14
%16 = and i8 %15, 31
%17 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 5
store i8 %16, i8* %17
%18 = getelementptr inbounds i8, i8* %1, i64 3
%19 = load i8, i8* %18
%20 = and i8 %19, 31
%21 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 6
store i8 %20, i8* %21
%22 = getelementptr inbounds i8, i8* %1, i64 4
%23 = load i8, i8* %22
%24 = and i8 %23, 31
%25 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 7
store i8 %24, i8* %25
%26 = getelementptr inbounds i8, i8* %1, i64 5
%27 = load i8, i8* %26
%28 = and i8 %27, 31
%29 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 8
store i8 %28, i8* %29
%30 = getelementptr inbounds i8, i8* %1, i64 6
%31 = load i8, i8* %30
%32 = and i8 %31, 31
%33 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 9
store i8 %32, i8* %33
%34 = getelementptr inbounds i8, i8* %1, i64 7
%35 = load i8, i8* %34
%36 = and i8 %35, 31
%37 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 10
store i8 %36, i8* %37
%38 = call i32 @drv_CW_send(i8* %4, i32 12)
ret void
}