#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 lspcon_i2c_spi_disable_hw_write(int);
int lspcon_i2c_spi_enable_write_status_register(int);
int lspcon_i2c_spi_enable_write_status_register_protection(int);
int lspcon_i2c_spi_wait_rom_free(int);
int lspcon_i2c_spi_enable_write_protection(int fd) {
  int ret = lspcon_i2c_spi_enable_write_status_register(fd);
  ret |= lspcon_i2c_spi_enable_write_status_register_protection(fd);
  ret |= lspcon_i2c_spi_wait_rom_free(fd);
  ret |= lspcon_i2c_spi_disable_hw_write(fd);
  return ret;
}


x86 assembly (clang, -O0):
<lspcon_i2c_spi_enable_write_protection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1060 <lspcon_i2c_spi_enable_write_status_register@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <lspcon_i2c_spi_enable_write_status_register_protection@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <lspcon_i2c_spi_wait_rom_free@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <lspcon_i2c_spi_disable_hw_write@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lspcon_i2c_spi_enable_write_protection>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
call   1060 <lspcon_i2c_spi_enable_write_status_register@plt>
mov    %eax,%r14d
mov    %ebx,%edi
call   1050 <lspcon_i2c_spi_enable_write_status_register_protection@plt>
mov    %eax,%ebp
or     %r14d,%ebp
mov    %ebx,%edi
call   1030 <lspcon_i2c_spi_wait_rom_free@plt>
mov    %eax,%r14d
mov    %ebx,%edi
call   1040 <lspcon_i2c_spi_disable_hw_write@plt>
or     %r14d,%eax
or     %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @lspcon_i2c_spi_enable_write_protection(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @lspcon_i2c_spi_enable_write_status_register(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = call i32 @lspcon_i2c_spi_enable_write_status_register_protection(i32 %6)
%8 = load i32, i32* %3
%9 = or i32 %8, %7
store i32 %9, i32* %3
%10 = load i32, i32* %2
%11 = call i32 @lspcon_i2c_spi_wait_rom_free(i32 %10)
%12 = load i32, i32* %3
%13 = or i32 %12, %11
store i32 %13, i32* %3
%14 = load i32, i32* %2
%15 = call i32 @lspcon_i2c_spi_disable_hw_write(i32 %14)
%16 = load i32, i32* %3
%17 = or i32 %16, %15
store i32 %17, i32* %3
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @lspcon_i2c_spi_enable_write_protection(i32 %0) {
%2 = tail call i32 @lspcon_i2c_spi_enable_write_status_register(i32 %0)
%3 = tail call i32 @lspcon_i2c_spi_enable_write_status_register_protection(i32 %0)
%4 = or i32 %3, %2
%5 = tail call i32 @lspcon_i2c_spi_wait_rom_free(i32 %0)
%6 = or i32 %4, %5
%7 = tail call i32 @lspcon_i2c_spi_disable_hw_write(i32 %0)
%8 = or i32 %6, %7
ret i32 %8
}