#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 /*<<< orphan*/ error(char *);
int spi_transfer_w32(unsigned int *, unsigned int *);
void small1_send(unsigned int chr) {
  unsigned int CMD = 2;
  unsigned int rbuf = 31;
  int ret = spi_transfer_w32(&CMD, &rbuf);
  if (ret)
    error("Cannot write");
  ret = spi_transfer_w32(&chr, &rbuf);
  if (ret)
    error("Cannot write");
}


x86 assembly (clang, -O0):
<small1_send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
movl   $0x1f,-0xc(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <spi_transfer_w32@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     115f <small1_send+0x3f>
lea    0xea6(%rip),%rdi
call   1030 <error@plt>
lea    -0x4(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <spi_transfer_w32@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1185 <small1_send+0x65>
lea    0xe80(%rip),%rdi
call   1030 <error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<small1_send>:
sub    $0x18,%rsp
mov    %edi,0x14(%rsp)
movl   $0x2,0x10(%rsp)
movl   $0x1f,0xc(%rsp)
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rsi
call   1040 <spi_transfer_w32@plt>
test   %eax,%eax
je     1157 <small1_send+0x37>
lea    0xeae(%rip),%rdi
call   1030 <error@plt>
lea    0x14(%rsp),%rdi
lea    0xc(%rsp),%rsi
call   1040 <spi_transfer_w32@plt>
test   %eax,%eax
je     1176 <small1_send+0x56>
lea    0xe8f(%rip),%rdi
call   1030 <error@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Cannot write\00"
define void @small1_send(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
store i32 2, i32* %3
store i32 31, i32* %4
%6 = call i32 @spi_transfer_w32(i32* %3, i32* %4)
store i32 %6, i32* %5
%7 = load i32, i32* %5
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %1
%12 = call i32 @spi_transfer_w32(i32* %2, i32* %4)
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = call i32 @error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %11
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"Cannot write\00"
define void @small1_send(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = bitcast i32* %3 to i8*
store i32 2, i32* %3
%6 = bitcast i32* %4 to i8*
store i32 31, i32* %4
%7 = call i32 @spi_transfer_w32(i32* %3, i32* %4)
%8 = icmp eq i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %1
%10 = call i32 @error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %1
%12 = call i32 @spi_transfer_w32(i32* %2, i32* %4)
%13 = icmp eq i32 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = call i32 @error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14, %11
ret void
}