#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_write_row(int row, long data) {
  uint8_t out[8] = {
      row + 1, data >> 24, row + 1, data >> 16,
      row + 1, data >> 8,  row + 1, data,
  };
  return spi_send(out, 8);
}


x86 assembly (clang, -O0):
<led_write_row>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
sar    $0x18,%rax
mov    %eax,-0x2c(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
sar    $0x10,%rax
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
sar    $0x8,%rax
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
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_write_row>:
sub    $0x28,%rsp
add    $0x1,%edi
mov    %edi,(%rsp)
mov    %rsi,%rax
shr    $0x18,%rax
mov    %eax,0x4(%rsp)
mov    %edi,0x8(%rsp)
mov    %rsi,%rax
shr    $0x10,%rax
mov    %eax,0xc(%rsp)
mov    %edi,0x10(%rsp)
mov    %rsi,%rax
shr    $0x8,%rax
mov    %eax,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_write_row(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca [8 x i32]
store i32 %0, i32* %3
store i64 %1, i64* %4
%6 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 0
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 1
store i32 %8, i32* %6
%9 = getelementptr inbounds i32, i32* %6, i64 1
%10 = load i64, i64* %4
%11 = ashr i64 %10, 24
%12 = trunc i64 %11 to i32
store i32 %12, i32* %9
%13 = getelementptr inbounds i32, i32* %9, i64 1
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %13
%16 = getelementptr inbounds i32, i32* %13, i64 1
%17 = load i64, i64* %4
%18 = ashr i64 %17, 16
%19 = trunc i64 %18 to i32
store i32 %19, i32* %16
%20 = getelementptr inbounds i32, i32* %16, i64 1
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %20
%23 = getelementptr inbounds i32, i32* %20, i64 1
%24 = load i64, i64* %4
%25 = ashr i64 %24, 8
%26 = trunc i64 %25 to i32
store i32 %26, i32* %23
%27 = getelementptr inbounds i32, i32* %23, i64 1
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %27
%30 = getelementptr inbounds i32, i32* %27, i64 1
%31 = load i64, i64* %4
%32 = trunc i64 %31 to i32
store i32 %32, i32* %30
%33 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 0
%34 = call i32 @spi_send(i32* %33, i32 8)
ret i32 %34
}

LLVM IR (-O2):
define i32 @led_write_row(i32 %0, i64 %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
%6 = add nsw i32 %0, 1
store i32 %6, i32* %5
%7 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 1
%8 = lshr i64 %1, 24
%9 = trunc i64 %8 to i32
store i32 %9, i32* %7
%10 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 2
store i32 %6, i32* %10
%11 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 3
%12 = lshr i64 %1, 16
%13 = trunc i64 %12 to i32
store i32 %13, i32* %11
%14 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 4
store i32 %6, i32* %14
%15 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 5
%16 = lshr i64 %1, 8
%17 = trunc i64 %16 to i32
store i32 %17, i32* %15
%18 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 6
store i32 %6, i32* %18
%19 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 7
%20 = trunc i64 %1 to i32
store i32 %20, i32* %19
%21 = call i32 @spi_send(i32* %5, i32 8)
ret i32 %21
}