#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fire(int, int, int, int *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ init_transform_map(int, int, int *);
int spi_open(char *, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  if (argc < 2) {
    fprintf(stderr, "Usage: %s <spi-device>\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  int fd = spi_open(argv[1], 0, 2000000, 8);
  int transform_map[12 * 10];
  init_transform_map(12, 10, transform_map);
  fire(fd, 12, 10, transform_map);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x200,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x4(%rbp)
jge    1196 <main+0x46>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe7d(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %esi,%esi
mov    $0x1e8480,%edx
mov    $0x8,%ecx
call   1060 <spi_open@plt>
mov    %eax,-0x14(%rbp)
lea    -0x200(%rbp),%rdx
mov    $0xc,%edi
mov    $0xa,%esi
call   1050 <init_transform_map@plt>
mov    -0x14(%rbp),%edi
lea    -0x200(%rbp),%rcx
mov    $0xc,%esi
mov    $0xa,%edx
call   1040 <fire@plt>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x1e8,%rsp
cmp    $0x1,%edi
jle    11ac <main+0x5c>
mov    0x8(%rsi),%rdi
xor    %esi,%esi
mov    $0x1e8480,%edx
mov    $0x8,%ecx
call   1060 <spi_open@plt>
mov    %eax,%ebx
mov    %rsp,%r14
mov    $0xc,%edi
mov    $0xa,%esi
mov    %r14,%rdx
call   1050 <init_transform_map@plt>
mov    %ebx,%edi
mov    $0xc,%esi
mov    $0xa,%edx
mov    %r14,%rcx
call   1040 <fire@plt>
xor    %eax,%eax
add    $0x1e8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xe41(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e0d(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"Usage: %s <spi-device>\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca [120 x i32]
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %17
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8**, i8*** %4
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = load i32, i32* @EXIT_FAILURE
%16 = call i32 @exit(i32 %15)
unreachable
17: ; preds = %2
%18 = load i8**, i8*** %4
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @spi_open(i8* %20, i32 0, i32 2000000, i32 8)
store i32 %21, i32* %5
%22 = getelementptr inbounds [120 x i32], [120 x i32]* %6, i64 0, i64 0
%23 = call i32 @init_transform_map(i32 12, i32 10, i32* %22)
%24 = load i32, i32* %5
%25 = getelementptr inbounds [120 x i32], [120 x i32]* %6, i64 0, i64 0
%26 = call i32 @fire(i32 %24, i32 12, i32 10, i32* %25)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"Usage: %s <spi-device>\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [120 x i32]
%4 = icmp slt i32 %0, 2
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = load i8*, i8** %1
%8 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load i32, i32* @EXIT_FAILURE
%10 = tail call i32 @exit(i32 %9)
unreachable
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32 @spi_open(i8* %13, i32 0, i32 2000000, i32 8)
%15 = bitcast [120 x i32]* %3 to i8*
%16 = getelementptr inbounds [120 x i32], [120 x i32]* %3, i64 0, i64 0
%17 = call i32 @init_transform_map(i32 12, i32 10, i32* %16)
%18 = call i32 @fire(i32 %14, i32 12, i32 10, i32* %16)
ret i32 0
}