#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 */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ gpio_write_value(int, int);
int /*<<< orphan*/ lcd_enable();
void lcd_send_command(uint8_t command) {
  gpio_write_value(66, 0);
  uint8_t command_msb = ((command >> 4) & 0X0f);
  gpio_write_value(68, (command_msb & (1 << 0)));
  gpio_write_value(45, (command_msb & (1 << 1)));
  gpio_write_value(44, (command_msb & (1 << 2)));
  gpio_write_value(26, (command_msb & (1 << 3)));
  lcd_enable();
  uint8_t command_lsb = ((command & 0x0f));
  gpio_write_value(68, (command_lsb & (1 << 0)));
  gpio_write_value(45, (command_lsb & (1 << 1)));
  gpio_write_value(44, (command_lsb & (1 << 2)));
  gpio_write_value(26, (command_lsb & (1 << 3)));
  lcd_enable();
}


x86 assembly (clang, -O0):
<lcd_send_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x42,%edi
xor    %esi,%esi
call   1030 <gpio_write_value@plt>
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
and    $0xf,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
and    $0x1,%esi
mov    $0x44,%edi
call   1030 <gpio_write_value@plt>
mov    -0x8(%rbp),%esi
and    $0x2,%esi
mov    $0x2d,%edi
call   1030 <gpio_write_value@plt>
mov    -0x8(%rbp),%esi
and    $0x4,%esi
mov    $0x2c,%edi
call   1030 <gpio_write_value@plt>
mov    -0x8(%rbp),%esi
and    $0x8,%esi
mov    $0x1a,%edi
call   1030 <gpio_write_value@plt>
mov    $0x0,%al
call   1040 <lcd_enable@plt>
mov    -0x4(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
and    $0x1,%esi
mov    $0x44,%edi
call   1030 <gpio_write_value@plt>
mov    -0xc(%rbp),%esi
and    $0x2,%esi
mov    $0x2d,%edi
call   1030 <gpio_write_value@plt>
mov    -0xc(%rbp),%esi
and    $0x4,%esi
mov    $0x2c,%edi
call   1030 <gpio_write_value@plt>
mov    -0xc(%rbp),%esi
and    $0x8,%esi
mov    $0x1a,%edi
call   1030 <gpio_write_value@plt>
mov    $0x0,%al
call   1040 <lcd_enable@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcd_send_command>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0x42,%edi
xor    %esi,%esi
call   1030 <gpio_write_value@plt>
mov    %ebx,%ebp
shr    $0x4,%ebp
mov    %ebp,%esi
and    $0x1,%esi
mov    $0x44,%edi
call   1030 <gpio_write_value@plt>
mov    %ebp,%esi
and    $0x2,%esi
mov    $0x2d,%edi
call   1030 <gpio_write_value@plt>
mov    %ebp,%esi
and    $0x4,%esi
mov    $0x2c,%edi
call   1030 <gpio_write_value@plt>
and    $0x8,%ebp
mov    $0x1a,%edi
mov    %ebp,%esi
call   1030 <gpio_write_value@plt>
xor    %eax,%eax
call   1040 <lcd_enable@plt>
mov    %ebx,%esi
and    $0x1,%esi
mov    $0x44,%edi
call   1030 <gpio_write_value@plt>
mov    %ebx,%esi
and    $0x2,%esi
mov    $0x2d,%edi
call   1030 <gpio_write_value@plt>
mov    %ebx,%esi
and    $0x4,%esi
mov    $0x2c,%edi
call   1030 <gpio_write_value@plt>
and    $0x8,%ebx
mov    $0x1a,%edi
mov    %ebx,%esi
call   1030 <gpio_write_value@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <lcd_enable@plt>

LLVM IR (-O0):
define void @lcd_send_command(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = call i32 @gpio_write_value(i32 66, i32 0)
%6 = load i32, i32* %2
%7 = ashr i32 %6, 4
%8 = and i32 %7, 15
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = and i32 %9, 1
%11 = call i32 @gpio_write_value(i32 68, i32 %10)
%12 = load i32, i32* %3
%13 = and i32 %12, 2
%14 = call i32 @gpio_write_value(i32 45, i32 %13)
%15 = load i32, i32* %3
%16 = and i32 %15, 4
%17 = call i32 @gpio_write_value(i32 44, i32 %16)
%18 = load i32, i32* %3
%19 = and i32 %18, 8
%20 = call i32 @gpio_write_value(i32 26, i32 %19)
%21 = call i32 (...) @lcd_enable()
%22 = load i32, i32* %2
%23 = and i32 %22, 15
store i32 %23, i32* %4
%24 = load i32, i32* %4
%25 = and i32 %24, 1
%26 = call i32 @gpio_write_value(i32 68, i32 %25)
%27 = load i32, i32* %4
%28 = and i32 %27, 2
%29 = call i32 @gpio_write_value(i32 45, i32 %28)
%30 = load i32, i32* %4
%31 = and i32 %30, 4
%32 = call i32 @gpio_write_value(i32 44, i32 %31)
%33 = load i32, i32* %4
%34 = and i32 %33, 8
%35 = call i32 @gpio_write_value(i32 26, i32 %34)
%36 = call i32 (...) @lcd_enable()
ret void
}

LLVM IR (-O2):
define void @lcd_send_command(i32 %0) {
%2 = tail call i32 @gpio_write_value(i32 66, i32 0)
%3 = lshr i32 %0, 4
%4 = and i32 %3, 1
%5 = tail call i32 @gpio_write_value(i32 68, i32 %4)
%6 = and i32 %3, 2
%7 = tail call i32 @gpio_write_value(i32 45, i32 %6)
%8 = and i32 %3, 4
%9 = tail call i32 @gpio_write_value(i32 44, i32 %8)
%10 = and i32 %3, 8
%11 = tail call i32 @gpio_write_value(i32 26, i32 %10)
%12 = tail call i32 (...) @lcd_enable()
%13 = and i32 %0, 1
%14 = tail call i32 @gpio_write_value(i32 68, i32 %13)
%15 = and i32 %0, 2
%16 = tail call i32 @gpio_write_value(i32 45, i32 %15)
%17 = and i32 %0, 4
%18 = tail call i32 @gpio_write_value(i32 44, i32 %17)
%19 = and i32 %0, 8
%20 = tail call i32 @gpio_write_value(i32 26, i32 %19)
%21 = tail call i32 (...) @lcd_enable()
ret void
}