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

/* Variables and functions */
int /*<<< orphan*/ gpio_write_and_close(int, int);
int /*<<< orphan*/ spi_data_send_8(int, int /*<<< orphan*/ *,
                                   int /*<<< orphan*/);
int spi_init(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ usleep(int);
void alfa_set_output(uint8_t state[], uint8_t size) {
  int dev;
  gpio_write_and_close(20, 1);
  dev = spi_init(0, 8, 2500);
  spi_data_send_8(dev, state, size);
  usleep(1);
  gpio_write_and_close(24, 1);
  usleep(1);
  gpio_write_and_close(24, 0);
  gpio_write_and_close(20, 0);
}


x86 assembly (clang, -O0):
<alfa_set_output>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x14,%edi
mov    $0x1,%esi
call   1030 <gpio_write_and_close@plt>
xor    %edi,%edi
mov    $0x8,%esi
mov    $0x9c4,%edx
call   1040 <spi_init@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1050 <spi_data_send_8@plt>
mov    $0x1,%edi
call   1060 <usleep@plt>
mov    $0x18,%edi
mov    $0x1,%esi
call   1030 <gpio_write_and_close@plt>
mov    $0x1,%edi
call   1060 <usleep@plt>
mov    $0x18,%edi
xor    %esi,%esi
call   1030 <gpio_write_and_close@plt>
mov    $0x14,%edi
xor    %esi,%esi
call   1030 <gpio_write_and_close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alfa_set_output>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    $0x14,%edi
mov    $0x1,%esi
call   1030 <gpio_write_and_close@plt>
xor    %edi,%edi
mov    $0x8,%esi
mov    $0x9c4,%edx
call   1040 <spi_init@plt>
mov    %eax,%edi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1050 <spi_data_send_8@plt>
mov    $0x1,%edi
call   1060 <usleep@plt>
mov    $0x18,%edi
mov    $0x1,%esi
call   1030 <gpio_write_and_close@plt>
mov    $0x1,%edi
call   1060 <usleep@plt>
mov    $0x18,%edi
xor    %esi,%esi
call   1030 <gpio_write_and_close@plt>
mov    $0x14,%edi
xor    %esi,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <gpio_write_and_close@plt>

LLVM IR (-O0):
define void @alfa_set_output(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = call i32 @gpio_write_and_close(i32 20, i32 1)
%7 = call i32 @spi_init(i32 0, i32 8, i32 2500)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = load i32*, i32** %3
%10 = load i32, i32* %4
%11 = call i32 @spi_data_send_8(i32 %8, i32* %9, i32 %10)
%12 = call i32 @usleep(i32 1)
%13 = call i32 @gpio_write_and_close(i32 24, i32 1)
%14 = call i32 @usleep(i32 1)
%15 = call i32 @gpio_write_and_close(i32 24, i32 0)
%16 = call i32 @gpio_write_and_close(i32 20, i32 0)
ret void
}

LLVM IR (-O2):
define void @alfa_set_output(i32* %0, i32 %1) {
%3 = tail call i32 @gpio_write_and_close(i32 20, i32 1)
%4 = tail call i32 @spi_init(i32 0, i32 8, i32 2500)
%5 = tail call i32 @spi_data_send_8(i32 %4, i32* %0, i32 %1)
%6 = tail call i32 @usleep(i32 1)
%7 = tail call i32 @gpio_write_and_close(i32 24, i32 1)
%8 = tail call i32 @usleep(i32 1)
%9 = tail call i32 @gpio_write_and_close(i32 24, i32 0)
%10 = tail call i32 @gpio_write_and_close(i32 20, i32 0)
ret void
}