#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*/ os_printoutput(char *);
int /*<<< orphan*/ os_sleep(int);
int /*<<< orphan*/ sprintf(char *, char *, int);
void adb_tap(int x, int y) {
  char tapcommand[2048] = {0};
  sprintf(tapcommand, "adb shell sendevent /dev/input/event1 3 0 %d",
          x * (0x8000 / 1600));
  os_printoutput(tapcommand);
  os_printoutput("adb shell sendevent /dev/input/event1 0 0 0");
  sprintf(tapcommand, "adb shell sendevent /dev/input/event1 3 1 %d",
          y * (0x8000 / 900));
  os_printoutput(tapcommand);
  os_printoutput("adb shell sendevent /dev/input/event1 0 0 0");
  os_printoutput("adb shell sendevent /dev/input/event1 1 272 1");
  os_printoutput("adb shell sendevent /dev/input/event1 0 0 0");
  os_sleep(100);
  os_printoutput("adb shell sendevent /dev/input/event1 1 272 0");
  os_printoutput("adb shell sendevent /dev/input/event1 0 0 0");
}


x86 assembly (clang, -O0):
<adb_tap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x810,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x810(%rbp),%rdi
xor    %esi,%esi
mov    $0x800,%edx
call   1050 <memset@plt>
lea    -0x810(%rbp),%rdi
imul   $0x14,-0x4(%rbp),%edx
lea    0xe8a(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x810(%rbp),%rdi
call   1030 <os_printoutput@plt>
lea    0xe9f(%rip),%rdi
call   1030 <os_printoutput@plt>
lea    -0x810(%rbp),%rdi
imul   $0x24,-0x8(%rbp),%edx
lea    0xeb4(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x810(%rbp),%rdi
call   1030 <os_printoutput@plt>
lea    0xe70(%rip),%rdi
call   1030 <os_printoutput@plt>
lea    0xebd(%rip),%rdi
call   1030 <os_printoutput@plt>
lea    0xe58(%rip),%rdi
call   1030 <os_printoutput@plt>
mov    $0x64,%edi
call   1040 <os_sleep@plt>
lea    0xec9(%rip),%rdi
call   1030 <os_printoutput@plt>
lea    0xe36(%rip),%rdi
call   1030 <os_printoutput@plt>
add    $0x810,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<adb_tap>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x808,%rsp
mov    %esi,%r12d
mov    %edi,%ebx
mov    %rsp,%r15
mov    $0x800,%edx
mov    %r15,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
shl    $0x2,%ebx
lea    (%rbx,%rbx,4),%edx
lea    0xe8e(%rip),%rsi
mov    %r15,%rdi
call   1060 <sprintf@plt>
mov    %r15,%rdi
call   1030 <os_printoutput@plt>
lea    0xea4(%rip),%r14
mov    %r14,%rdi
call   1030 <os_printoutput@plt>
shl    $0x2,%r12d
lea    (%r12,%r12,8),%edx
lea    0xeb9(%rip),%rsi
mov    %r15,%rdi
call   1060 <sprintf@plt>
mov    %r15,%rdi
call   1030 <os_printoutput@plt>
mov    %r14,%rdi
call   1030 <os_printoutput@plt>
lea    0xec7(%rip),%rdi
call   1030 <os_printoutput@plt>
mov    %r14,%rdi
call   1030 <os_printoutput@plt>
mov    $0x64,%edi
call   1040 <os_sleep@plt>
lea    0xed7(%rip),%rdi
call   1030 <os_printoutput@plt>
mov    %r14,%rdi
call   1030 <os_printoutput@plt>
add    $0x808,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [45 x i8] c"adb shell sendevent /dev/input/event1 3 0 %d\00"
@.str.1 = [44 x i8] c"adb shell sendevent /dev/input/event1 0 0 0\00"
@.str.2 = [45 x i8] c"adb shell sendevent /dev/input/event1 3 1 %d\00"
@.str.3 = [46 x i8] c"adb shell sendevent /dev/input/event1 1 272 1\00"
@.str.4 = [46 x i8] c"adb shell sendevent /dev/input/event1 1 272 0\00"
define void @adb_tap(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [2048 x i8]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = bitcast [2048 x i8]* %5 to i8*
%7 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%8 = load i32, i32* %3
%9 = mul nsw i32 %8, 20
%10 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%12 = call i32 @os_printoutput(i8* %11)
%13 = call i32 @os_printoutput(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%14 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%15 = load i32, i32* %4
%16 = mul nsw i32 %15, 36
%17 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%19 = call i32 @os_printoutput(i8* %18)
%20 = call i32 @os_printoutput(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 @os_printoutput(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 @os_printoutput(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 @os_sleep(i32 100)
%24 = call i32 @os_printoutput(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0))
%25 = call i32 @os_printoutput(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [45 x i8] c"adb shell sendevent /dev/input/event1 3 0 %d\00"
@.str.1 = [44 x i8] c"adb shell sendevent /dev/input/event1 0 0 0\00"
@.str.2 = [45 x i8] c"adb shell sendevent /dev/input/event1 3 1 %d\00"
@.str.3 = [46 x i8] c"adb shell sendevent /dev/input/event1 1 272 1\00"
@.str.4 = [46 x i8] c"adb shell sendevent /dev/input/event1 1 272 0\00"
define void @adb_tap(i32 %0, i32 %1) {
%3 = alloca [2048 x i8]
%4 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%5 = mul nsw i32 %0, 20
%6 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 @os_printoutput(i8* %4)
%8 = call i32 @os_printoutput(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%9 = mul nsw i32 %1, 36
%10 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = call i32 @os_printoutput(i8* %4)
%12 = call i32 @os_printoutput(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @os_printoutput(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @os_printoutput(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @os_sleep(i32 100)
%16 = call i32 @os_printoutput(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0))
%17 = call i32 @os_printoutput(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
ret void
}