#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_PHAnderson_send(char const *, int);
void drv_PHAnderson_write(const int row, const int col, const char *data,
                          int len) {
  char cmd[7];
  cmd[0] = '?';
  cmd[1] = 'y';
  cmd[2] = row + '0';
  cmd[3] = '?';
  cmd[4] = 'x';
  cmd[5] = col / 10 + '0';
  cmd[6] = col % 10 + '0';
  drv_PHAnderson_send(cmd, 7);
  drv_PHAnderson_send(data, len);
}


x86 assembly (clang, -O0):
<drv_PHAnderson_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)
movb   $0x3f,-0x1b(%rbp)
movb   $0x79,-0x1a(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x19(%rbp)
movb   $0x3f,-0x18(%rbp)
movb   $0x78,-0x17(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
mov    %al,-0x16(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%al
mov    %al,-0x15(%rbp)
lea    -0x1b(%rbp),%rdi
mov    $0x7,%esi
call   1030 <drv_PHAnderson_send@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <drv_PHAnderson_send@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drv_PHAnderson_write>:
push   %rbp
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rdx,%rbx
movw   $0x793f,0x1(%rsp)
add    $0x30,%dil
mov    %dil,0x3(%rsp)
movw   $0x783f,0x4(%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,0x6(%rsp)
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
add    $0x30,%al
mov    %al,0x7(%rsp)
lea    0x1(%rsp),%rdi
mov    $0x7,%esi
call   1030 <drv_PHAnderson_send@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <drv_PHAnderson_send@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @drv_PHAnderson_write(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [7 x i8]
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = getelementptr inbounds [7 x i8], [7 x i8]* %9, i64 0, i64 0
store i8 63, i8* %10
%11 = getelementptr inbounds [7 x i8], [7 x i8]* %9, i64 0, i64 1
store i8 121, i8* %11
%12 = load i32, i32* %5
%13 = add nsw i32 %12, 48
%14 = trunc i32 %13 to i8
%15 = getelementptr inbounds [7 x i8], [7 x i8]* %9, i64 0, i64 2
store i8 %14, i8* %15
%16 = getelementptr inbounds [7 x i8], [7 x i8]* %9, i64 0, i64 3
store i8 63, i8* %16
%17 = getelementptr inbounds [7 x i8], [7 x i8]* %9, i64 0, i64 4
store i8 120, i8* %17
%18 = load i32, i32* %6
%19 = sdiv i32 %18, 10
%20 = add nsw i32 %19, 48
%21 = trunc i32 %20 to i8
%22 = getelementptr inbounds [7 x i8], [7 x i8]* %9, i64 0, i64 5
store i8 %21, i8* %22
%23 = load i32, i32* %6
%24 = srem i32 %23, 10
%25 = add nsw i32 %24, 48
%26 = trunc i32 %25 to i8
%27 = getelementptr inbounds [7 x i8], [7 x i8]* %9, i64 0, i64 6
store i8 %26, i8* %27
%28 = getelementptr inbounds [7 x i8], [7 x i8]* %9, i64 0, i64 0
%29 = call i32 @drv_PHAnderson_send(i8* %28, i32 7)
%30 = load i8*, i8** %7
%31 = load i32, i32* %8
%32 = call i32 @drv_PHAnderson_send(i8* %30, i32 %31)
ret void
}

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