#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*/ GLCD_GoTo(unsigned char, unsigned char);
unsigned char GLCD_ReadData();
int /*<<< orphan*/ GLCD_WriteData(unsigned char);
void GLCD_SetPixel(unsigned char x, unsigned char y, unsigned char color) {
  unsigned char tmp;
  GLCD_GoTo(x, y / 8);
  tmp = GLCD_ReadData();
  GLCD_GoTo(x, y / 8);
  tmp = GLCD_ReadData();
  GLCD_GoTo(x, y / 8);
  if (color)
    tmp |= (1 << (y % 8));
  else
    tmp &= ~(1 << (y % 8));
  GLCD_WriteData(tmp);
}


x86 assembly (clang, -O0):
<GLCD_SetPixel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %dil,%dl
mov    %dl,-0x1(%rbp)
mov    %cl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
mov    -0x1(%rbp),%cl
movzbl -0x2(%rbp),%eax
mov    $0x8,%esi
cltd
idiv   %esi
movzbl %cl,%edi
movzbl %al,%esi
call   1030 <GLCD_GoTo@plt>
mov    $0x0,%al
call   1040 <GLCD_ReadData@plt>
mov    %al,-0x4(%rbp)
mov    -0x1(%rbp),%cl
movzbl -0x2(%rbp),%eax
mov    $0x8,%esi
cltd
idiv   %esi
movzbl %cl,%edi
movzbl %al,%esi
call   1030 <GLCD_GoTo@plt>
mov    $0x0,%al
call   1040 <GLCD_ReadData@plt>
mov    %al,-0x4(%rbp)
mov    -0x1(%rbp),%cl
movzbl -0x2(%rbp),%eax
mov    $0x8,%esi
cltd
idiv   %esi
movzbl %cl,%edi
movzbl %al,%esi
call   1030 <GLCD_GoTo@plt>
cmpb   $0x0,-0x3(%rbp)
je     11da <GLCD_SetPixel+0xaa>
movzbl -0x2(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
movzbl -0x4(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x4(%rbp)
jmp    11fd <GLCD_SetPixel+0xcd>
movzbl -0x2(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
xor    $0xffffffff,%ecx
movzbl -0x4(%rbp),%eax
and    %ecx,%eax
mov    %al,-0x4(%rbp)
movzbl -0x4(%rbp),%edi
call   1050 <GLCD_WriteData@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GLCD_SetPixel>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r14d
mov    %esi,%r15d
mov    %edi,%ebx
mov    %r15d,%eax
shr    $0x3,%al
movzbl %al,%ebp
mov    %ebp,%esi
call   1030 <GLCD_GoTo@plt>
xor    %eax,%eax
call   1040 <GLCD_ReadData@plt>
mov    %ebx,%edi
mov    %ebp,%esi
call   1030 <GLCD_GoTo@plt>
xor    %eax,%eax
call   1040 <GLCD_ReadData@plt>
mov    %eax,%r12d
mov    %ebx,%edi
mov    %ebp,%esi
call   1030 <GLCD_GoTo@plt>
mov    %r15d,%ecx
and    $0x7,%cl
mov    $0x1,%al
shl    %cl,%al
mov    $0xfe,%dl
mov    %r15d,%ecx
rol    %cl,%dl
or     %r12b,%al
and    %r12b,%dl
test   %r14d,%r14d
movzbl %dl,%ecx
movzbl %al,%eax
cmove  %ecx,%eax
movzbl %al,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <GLCD_WriteData@plt>

LLVM IR (-O0):
define void @GLCD_SetPixel(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
store i8 %0, i8* %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%8 = load i8, i8* %4
%9 = load i8, i8* %5
%10 = zext i8 %9 to i32
%11 = sdiv i32 %10, 8
%12 = trunc i32 %11 to i8
%13 = call i32 @GLCD_GoTo(i8 zeroext %8, i8 zeroext %12)
%14 = call zeroext i8 (...) @GLCD_ReadData()
store i8 %14, i8* %7
%15 = load i8, i8* %4
%16 = load i8, i8* %5
%17 = zext i8 %16 to i32
%18 = sdiv i32 %17, 8
%19 = trunc i32 %18 to i8
%20 = call i32 @GLCD_GoTo(i8 zeroext %15, i8 zeroext %19)
%21 = call zeroext i8 (...) @GLCD_ReadData()
store i8 %21, i8* %7
%22 = load i8, i8* %4
%23 = load i8, i8* %5
%24 = zext i8 %23 to i32
%25 = sdiv i32 %24, 8
%26 = trunc i32 %25 to i8
%27 = call i32 @GLCD_GoTo(i8 zeroext %22, i8 zeroext %26)
%28 = load i8, i8* %6
%29 = icmp ne i8 %28, 0
br i1 %29, label %30, label %39
30: ; preds = %3
%31 = load i8, i8* %5
%32 = zext i8 %31 to i32
%33 = srem i32 %32, 8
%34 = shl i32 1, %33
%35 = load i8, i8* %7
%36 = zext i8 %35 to i32
%37 = or i32 %36, %34
%38 = trunc i32 %37 to i8
store i8 %38, i8* %7
br label %49
39: ; preds = %3
%40 = load i8, i8* %5
%41 = zext i8 %40 to i32
%42 = srem i32 %41, 8
%43 = shl i32 1, %42
%44 = xor i32 %43, -1
%45 = load i8, i8* %7
%46 = zext i8 %45 to i32
%47 = and i32 %46, %44
%48 = trunc i32 %47 to i8
store i8 %48, i8* %7
br label %49
49: ; preds = %39, %30
%50 = load i8, i8* %7
%51 = call i32 @GLCD_WriteData(i8 zeroext %50)
ret void
}

LLVM IR (-O2):
define void @GLCD_SetPixel(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = lshr i8 %1, 3
%5 = tail call i32 @GLCD_GoTo(i8 zeroext %0, i8 zeroext %4)
%6 = tail call zeroext i8 (...) @GLCD_ReadData()
%7 = tail call i32 @GLCD_GoTo(i8 zeroext %0, i8 zeroext %4)
%8 = tail call zeroext i8 (...) @GLCD_ReadData()
%9 = tail call i32 @GLCD_GoTo(i8 zeroext %0, i8 zeroext %4)
%10 = icmp eq i8 %2, 0
%11 = and i8 %1, 7
%12 = shl nuw i8 1, %11
%13 = or i8 %8, %12
%14 = xor i8 %12, -1
%15 = and i8 %8, %14
%16 = select i1 %10, i8 %15, i8 %13
%17 = tail call i32 @GLCD_WriteData(i8 zeroext %16)
ret void
}