#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 const *, int);
void drv_WN_write(const int row, const int col, const char *data, int len) {
  char cmd[8] = "\033"
                "[r;ccH";
  cmd[2] = '1' + row;
  cmd[4] = '0' + (col / 10);
  cmd[5] = '1' + (col % 10);
  drv_generic_serial_write(cmd, 7);
  drv_generic_serial_write(data, len);
}


x86 assembly (clang, -O0):
<drv_WN_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x1c(%rbp)
mov    -0x4(%rbp),%eax
add    $0x31,%eax
mov    %al,-0x1a(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
mov    %al,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x31,%edx
mov    %dl,%al
mov    %al,-0x17(%rbp)
lea    -0x1c(%rbp),%rdi
mov    $0x7,%esi
call   1030 <drv_generic_serial_write@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <drv_generic_serial_write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drv_WN_write>:
push   %rbp
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rdx,%rbx
movabs $0x4863633b725b1b,%rax
mov    %rax,(%rsp)
add    $0x31,%dil
mov    %dil,0x2(%rsp)
movslq %esi,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
lea    0x30(%rcx),%edx
mov    %dl,0x4(%rsp)
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
add    $0x31,%al
mov    %al,0x5(%rsp)
mov    %rsp,%rdi
mov    $0x7,%esi
call   1030 <drv_generic_serial_write@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <drv_generic_serial_write@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@__const.drv_WN_write.cmd = [8 x i8] c"\1B[r;ccH\00"
define void @drv_WN_write(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [8 x i8]
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = bitcast [8 x i8]* %9 to i8*
%11 = load i32, i32* %5
%12 = add nsw i32 49, %11
%13 = trunc i32 %12 to i8
%14 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 2
store i8 %13, i8* %14
%15 = load i32, i32* %6
%16 = sdiv i32 %15, 10
%17 = add nsw i32 48, %16
%18 = trunc i32 %17 to i8
%19 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 4
store i8 %18, i8* %19
%20 = load i32, i32* %6
%21 = srem i32 %20, 10
%22 = add nsw i32 49, %21
%23 = trunc i32 %22 to i8
%24 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 5
store i8 %23, i8* %24
%25 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%26 = call i32 @drv_generic_serial_write(i8* %25, i32 7)
%27 = load i8*, i8** %7
%28 = load i32, i32* %8
%29 = call i32 @drv_generic_serial_write(i8* %27, i32 %28)
ret void
}

LLVM IR (-O2):
define void @drv_WN_write(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i64
%6 = bitcast i64* %5 to [8 x i8]*
%7 = bitcast i64* %5 to i8*
store i64 20375476173429531, i64* %5
%8 = trunc i32 %0 to i8
%9 = add i8 %8, 49
%10 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 2
store i8 %9, i8* %10
%11 = sdiv i32 %1, 10
%12 = trunc i32 %11 to i8
%13 = add i8 %12, 48
%14 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 4
store i8 %13, i8* %14
%15 = srem i32 %1, 10
%16 = trunc i32 %15 to i8
%17 = add nsw i8 %16, 49
%18 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 5
store i8 %17, i8* %18
%19 = call i32 @drv_generic_serial_write(i8* %7, i32 7)
%20 = call i32 @drv_generic_serial_write(i8* %2, i32 %3)
ret void
}