#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*/ mbox_property(int, unsigned int *);
unsigned get_firmware_revision(int file_desc) {
  int i = 0;
  unsigned p[32];
  p[i++] = 0;
  p[i++] = 0x00000000;
  p[i++] = 0x10000;
  p[i++] = 4;
  p[i++] = 0;
  p[i++] = 0;
  p[i++] = 0x00000000;
  p[0] = i * sizeof *p;
  mbox_property(file_desc, p);
  return p[5];
}


x86 assembly (clang, -O0):
<get_firmware_revision>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cltq
movl   $0x0,-0x90(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cltq
movl   $0x0,-0x90(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cltq
movl   $0x10000,-0x90(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cltq
movl   $0x4,-0x90(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cltq
movl   $0x0,-0x90(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cltq
movl   $0x0,-0x90(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cltq
movl   $0x0,-0x90(%rbp,%rax,4)
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,-0x90(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x90(%rbp),%rsi
call   1030 <mbox_property@plt>
mov    -0x7c(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_firmware_revision>:
sub    $0x88,%rsp
movq   $0x0,0x10(%rsp)
movl   $0x0,0x18(%rsp)
movaps 0xed1(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
call   1030 <mbox_property@plt>
mov    0x14(%rsp),%eax
add    $0x88,%rsp
ret

LLVM IR (-O0):
define i32 @get_firmware_revision(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [32 x i32]
store i32 %0, i32* %2
store i32 0, i32* %3
%5 = load i32, i32* %3
%6 = add nsw i32 %5, 1
store i32 %6, i32* %3
%7 = sext i32 %5 to i64
%8 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 %7
store i32 0, i32* %8
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 1
store i32 %10, i32* %3
%11 = sext i32 %9 to i64
%12 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 %11
store i32 0, i32* %12
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
%15 = sext i32 %13 to i64
%16 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 %15
store i32 65536, i32* %16
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
%19 = sext i32 %17 to i64
%20 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 %19
store i32 4, i32* %20
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
%23 = sext i32 %21 to i64
%24 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 %23
store i32 0, i32* %24
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
%27 = sext i32 %25 to i64
%28 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 %27
store i32 0, i32* %28
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
%31 = sext i32 %29 to i64
%32 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 %31
store i32 0, i32* %32
%33 = load i32, i32* %3
%34 = sext i32 %33 to i64
%35 = mul i64 %34, 4
%36 = trunc i64 %35 to i32
%37 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 0
store i32 %36, i32* %37
%38 = load i32, i32* %2
%39 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 0
%40 = call i32 @mbox_property(i32 %38, i32* %39)
%41 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 5
%42 = load i32, i32* %41
ret i32 %42
}

LLVM IR (-O2):
define i32 @get_firmware_revision(i32 %0) {
%2 = alloca [32 x i32]
%3 = bitcast [32 x i32]* %2 to i8*
%4 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 0
%5 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 4
store i32 0, i32* %5
%6 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 5
store i32 0, i32* %6
%7 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 6
store i32 0, i32* %7
%8 = bitcast [32 x i32]* %2 to <4 x i32>*
store <4 x i32> <i32 28, i32 0, i32 65536, i32 4>, <4 x i32>* %8
%9 = call i32 @mbox_property(i32 %0, i32* %4)
%10 = load i32, i32* %6
ret i32 %10
}