#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_GU311_send_string(char *, int);
int /*<<< orphan*/ memcpy(char *, char const *, int);
void drv_GU311_make_text_string(const int row, const int col, const char *data,
                                int len) {
  static char cmd[96] = {0x01, 'C', 0, 0, 'S', 0};
  unsigned char start_addr;
  start_addr = (0x16 * row) + col;
  if (start_addr > 0x57)
    return;
  if (len > 0x57)
    return;
  cmd[2] = start_addr;
  cmd[3] = len;
  memcpy(cmd + 5, data, len);
  drv_GU311_send_string(cmd, len + 5);
}


x86 assembly (clang, -O0):
<drv_GU311_make_text_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
imul   $0x16,-0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %al,-0x15(%rbp)
movzbl -0x15(%rbp),%eax
cmp    $0x57,%eax
jle    1151 <drv_GU311_make_text_string+0x31>
jmp    1197 <drv_GU311_make_text_string+0x77>
cmpl   $0x57,-0x14(%rbp)
jle    1160 <drv_GU311_make_text_string+0x40>
jmp    1197 <drv_GU311_make_text_string+0x77>
mov    -0x15(%rbp),%al
mov    %al,0x2ed9(%rip)
mov    -0x14(%rbp),%eax
mov    %al,0x2ed1(%rip)
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0x2ec5(%rip),%rdi
call   1040 <memcpy@plt>
mov    -0x14(%rbp),%esi
add    $0x5,%esi
lea    0x2eae(%rip),%rdi
call   1030 <drv_GU311_send_string@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drv_GU311_make_text_string>:
push   %r14
push   %rbx
push   %rax
mov    %ecx,%ebx
lea    (%rdi,%rdi,4),%eax
lea    (%rdi,%rax,4),%eax
add    %edi,%eax
add    %esi,%eax
mov    %eax,%ecx
and    $0xf8,%ecx
cmp    $0x57,%ecx
ja     117a <drv_GU311_make_text_string+0x5a>
cmp    $0x57,%ebx
jg     117a <drv_GU311_make_text_string+0x5a>
mov    %al,0x2efa(%rip)
lea    0x2ef1(%rip),%r14
mov    %bl,0x2eee(%rip)
lea    0x2ee9(%rip),%rdi
mov    %rdx,%rsi
mov    %ebx,%edx
call   1040 <memcpy@plt>
add    $0x5,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <drv_GU311_send_string@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@drv_GU311_make_text_string.cmd = internal global <{ i8, i8, i8, i8, i8, [91 x i8] }> <{ i8 1, i8 67, i8 0, i8 0, i8 83, [91 x i8] zeroinitializer }>
define void @drv_GU311_make_text_string(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = load i32, i32* %5
%11 = mul nsw i32 22, %10
%12 = load i32, i32* %6
%13 = add nsw i32 %11, %12
%14 = trunc i32 %13 to i8
store i8 %14, i8* %9
%15 = load i8, i8* %9
%16 = zext i8 %15 to i32
%17 = icmp sgt i32 %16, 87
br i1 %17, label %18, label %19
18: ; preds = %4
br label %33
19: ; preds = %4
%20 = load i32, i32* %8
%21 = icmp sgt i32 %20, 87
br i1 %21, label %22, label %23
22: ; preds = %19
br label %33
23: ; preds = %19
%24 = load i8, i8* %9
store i8 %24, i8* getelementptr inbounds ([96 x i8], [96 x i8]* bitcast (<{ i8, i8, i8, i8, i8, [91 x i8] }>* @drv_GU311_make_text_string.cmd to [96 x i8]*), i64 0, i64 2)
%25 = load i32, i32* %8
%26 = trunc i32 %25 to i8
store i8 %26, i8* getelementptr inbounds ([96 x i8], [96 x i8]* bitcast (<{ i8, i8, i8, i8, i8, [91 x i8] }>* @drv_GU311_make_text_string.cmd to [96 x i8]*), i64 0, i64 3)
%27 = load i8*, i8** %7
%28 = load i32, i32* %8
%29 = call i32 @memcpy(i8* getelementptr inbounds ([96 x i8], [96 x i8]* bitcast (<{ i8, i8, i8, i8, i8, [91 x i8] }>* @drv_GU311_make_text_string.cmd to [96 x i8]*), i64 0, i64 5), i8* %27, i32 %28)
%30 = load i32, i32* %8
%31 = add nsw i32 %30, 5
%32 = call i32 @drv_GU311_send_string(i8* getelementptr inbounds ([96 x i8], [96 x i8]* bitcast (<{ i8, i8, i8, i8, i8, [91 x i8] }>* @drv_GU311_make_text_string.cmd to [96 x i8]*), i64 0, i64 0), i32 %31)
br label %33
33: ; preds = %23, %22, %18
ret void
}

LLVM IR (-O2):
@drv_GU311_make_text_string.cmd = internal global <{ i8, i8, i8, i8, i8, [91 x i8] }> <{ i8 1, i8 67, i8 0, i8 0, i8 83, [91 x i8] zeroinitializer }>
define void @drv_GU311_make_text_string(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = mul nsw i32 %0, 22
%6 = add nsw i32 %5, %1
%7 = and i32 %6, 248
%8 = icmp ugt i32 %7, 87
%9 = icmp sgt i32 %3, 87
%10 = or i1 %8, %9
br i1 %10, label %17, label %11
11: ; preds = %4
%12 = trunc i32 %6 to i8
store i8 %12, i8* getelementptr inbounds (<{ i8, i8, i8, i8, i8, [91 x i8] }>, <{ i8, i8, i8, i8, i8, [91 x i8] }>* @drv_GU311_make_text_string.cmd, i64 0, i32 2)
%13 = trunc i32 %3 to i8
store i8 %13, i8* getelementptr inbounds (<{ i8, i8, i8, i8, i8, [91 x i8] }>, <{ i8, i8, i8, i8, i8, [91 x i8] }>* @drv_GU311_make_text_string.cmd, i64 0, i32 3)
%14 = tail call i32 @memcpy(i8* getelementptr inbounds (<{ i8, i8, i8, i8, i8, [91 x i8] }>, <{ i8, i8, i8, i8, i8, [91 x i8] }>* @drv_GU311_make_text_string.cmd, i64 0, i32 5, i64 0), i8* %2, i32 %3)
%15 = add nsw i32 %3, 5
%16 = tail call i32 @drv_GU311_send_string(i8* getelementptr inbounds (<{ i8, i8, i8, i8, i8, [91 x i8] }>, <{ i8, i8, i8, i8, i8, [91 x i8] }>* @drv_GU311_make_text_string.cmd, i64 0, i32 0), i32 %15)
br label %17
17: ; preds = %4, %11
ret void
}