#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 spi_send(int *, int);
int led_op(int op, int val) {
  uint8_t out[8] = {
      op, val, op, val, op, val, op, val,
  };
  return spi_send(out, 8);
}


x86 assembly (clang, -O0):
<led_op>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x8,%esi
call   1030 <spi_send@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<led_op>:
sub    $0x28,%rsp
mov    %edi,(%rsp)
mov    %esi,0x4(%rsp)
mov    %edi,0x8(%rsp)
mov    %esi,0xc(%rsp)
mov    %edi,0x10(%rsp)
mov    %esi,0x14(%rsp)
mov    %edi,0x18(%rsp)
mov    %esi,0x1c(%rsp)
mov    %rsp,%rdi
mov    $0x8,%esi
call   1030 <spi_send@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
define i32 @led_op(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [8 x i32]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 0
%7 = load i32, i32* %3
store i32 %7, i32* %6
%8 = getelementptr inbounds i32, i32* %6, i64 1
%9 = load i32, i32* %4
store i32 %9, i32* %8
%10 = getelementptr inbounds i32, i32* %8, i64 1
%11 = load i32, i32* %3
store i32 %11, i32* %10
%12 = getelementptr inbounds i32, i32* %10, i64 1
%13 = load i32, i32* %4
store i32 %13, i32* %12
%14 = getelementptr inbounds i32, i32* %12, i64 1
%15 = load i32, i32* %3
store i32 %15, i32* %14
%16 = getelementptr inbounds i32, i32* %14, i64 1
%17 = load i32, i32* %4
store i32 %17, i32* %16
%18 = getelementptr inbounds i32, i32* %16, i64 1
%19 = load i32, i32* %3
store i32 %19, i32* %18
%20 = getelementptr inbounds i32, i32* %18, i64 1
%21 = load i32, i32* %4
store i32 %21, i32* %20
%22 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 0
%23 = call i32 @spi_send(i32* %22, i32 8)
ret i32 %23
}

LLVM IR (-O2):
define i32 @led_op(i32 %0, i32 %1) {
%3 = alloca [8 x i32]
%4 = bitcast [8 x i32]* %3 to i8*
%5 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 0
store i32 %0, i32* %5
%6 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 1
store i32 %1, i32* %6
%7 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 2
store i32 %0, i32* %7
%8 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 3
store i32 %1, i32* %8
%9 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 4
store i32 %0, i32* %9
%10 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 5
store i32 %1, i32* %10
%11 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 6
store i32 %0, i32* %11
%12 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 7
store i32 %1, i32* %12
%13 = call i32 @spi_send(i32* %5, i32 8)
ret i32 %13
}