#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;
struct pci_dev {
  int dummy;
};

/* Variables and functions */
int pci_read_byte(struct pci_dev *, int);
int /*<<< orphan*/ rpci_write_byte(struct pci_dev *, int, int);
int enable_flash_ht1000(struct pci_dev *dev, const char *name) {
  uint8_t val;
  val = pci_read_byte(dev, 0x41);
  val |= 0x0e;
  rpci_write_byte(dev, 0x41, val);
  val = pci_read_byte(dev, 0x43);
  val |= (1 << 4);
  rpci_write_byte(dev, 0x43, val);
  return 0;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x41,%esi
call   1030 <pci_read_byte@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
or     $0xe,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    $0x41,%esi
call   1040 <rpci_write_byte@plt>
mov    -0x8(%rbp),%rdi
mov    $0x43,%esi
call   1030 <pci_read_byte@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
or     $0x10,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    $0x43,%esi
call   1040 <rpci_write_byte@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbx
mov    %rdi,%rbx
mov    $0x41,%esi
call   1030 <pci_read_byte@plt>
or     $0xe,%eax
mov    %rbx,%rdi
mov    $0x41,%esi
mov    %eax,%edx
call   1040 <rpci_write_byte@plt>
mov    %rbx,%rdi
mov    $0x43,%esi
call   1030 <pci_read_byte@plt>
or     $0x10,%eax
mov    %rbx,%rdi
mov    $0x43,%esi
mov    %eax,%edx
call   1040 <rpci_write_byte@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.pci_dev = type { i32 }
define i32 @enable_flash_ht1000(%struct.pci_dev* %0, i8* %1) {
%3 = alloca %struct.pci_dev*
%4 = alloca i8*
%5 = alloca i32
store %struct.pci_dev* %0, %struct.pci_dev** %3
store i8* %1, i8** %4
%6 = load %struct.pci_dev*, %struct.pci_dev** %3
%7 = call i32 @pci_read_byte(%struct.pci_dev* %6, i32 65)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = or i32 %8, 14
store i32 %9, i32* %5
%10 = load %struct.pci_dev*, %struct.pci_dev** %3
%11 = load i32, i32* %5
%12 = call i32 @rpci_write_byte(%struct.pci_dev* %10, i32 65, i32 %11)
%13 = load %struct.pci_dev*, %struct.pci_dev** %3
%14 = call i32 @pci_read_byte(%struct.pci_dev* %13, i32 67)
store i32 %14, i32* %5
%15 = load i32, i32* %5
%16 = or i32 %15, 16
store i32 %16, i32* %5
%17 = load %struct.pci_dev*, %struct.pci_dev** %3
%18 = load i32, i32* %5
%19 = call i32 @rpci_write_byte(%struct.pci_dev* %17, i32 67, i32 %18)
ret i32 0
}

LLVM IR (-O2):
%struct.pci_dev = type { i32 }
define i32 @enable_flash_ht1000(%struct.pci_dev* %0, i8* nocapture readnone %1) {
%3 = tail call i32 @pci_read_byte(%struct.pci_dev* %0, i32 65)
%4 = or i32 %3, 14
%5 = tail call i32 @rpci_write_byte(%struct.pci_dev* %0, i32 65, i32 %4)
%6 = tail call i32 @pci_read_byte(%struct.pci_dev* %0, i32 67)
%7 = or i32 %6, 16
%8 = tail call i32 @rpci_write_byte(%struct.pci_dev* %0, i32 67, i32 %7)
ret i32 0
}